mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Compare commits
81 Commits
@xrplf/iso
...
xahau
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7916a14be2 | ||
|
|
92eb809397 | ||
|
|
799cd65386 | ||
|
|
29d145138b | ||
|
|
496f774154 | ||
|
|
0395c14392 | ||
|
|
2a77e2cd91 | ||
|
|
619c9ae13a | ||
|
|
8beb1292b5 | ||
|
|
649bf7d277 | ||
|
|
e0d368791b | ||
|
|
be9b48b071 | ||
|
|
55892c8b89 | ||
|
|
b1b4995047 | ||
|
|
a726a5a4f9 | ||
|
|
8992d3914e | ||
|
|
c2e01b3d10 | ||
|
|
8bfe5b42b8 | ||
|
|
385a56a1f7 | ||
|
|
f3960c3ccc | ||
|
|
a46e86f17e | ||
|
|
8f5d210806 | ||
|
|
17c91cdd3a | ||
|
|
74a41832ce | ||
|
|
275c95752b | ||
|
|
3bc3c2029b | ||
|
|
c9ef96e0a2 | ||
|
|
00f1a6bcdd | ||
|
|
3858a09e1f | ||
|
|
3aaf526107 | ||
|
|
1460cf5026 | ||
|
|
7e733c4446 | ||
|
|
735ac2eb07 | ||
|
|
c79a5db8f2 | ||
|
|
8e2aba3b78 | ||
|
|
39fed49654 | ||
|
|
a0678857a1 | ||
|
|
38e2091fd2 | ||
|
|
a528d6632a | ||
|
|
ab081e7db9 | ||
|
|
493c56c0fa | ||
|
|
c73b2c5a86 | ||
|
|
02e2b0e48e | ||
|
|
d3b03a536d | ||
|
|
036f1f9850 | ||
|
|
92849e57ce | ||
|
|
32f0d7b121 | ||
|
|
b27bbb49b3 | ||
|
|
23adb4924b | ||
|
|
9b3bb9c14b | ||
|
|
d441361999 | ||
|
|
fb94f2a020 | ||
|
|
7b56a49dae | ||
|
|
212686baae | ||
|
|
4d6fef597c | ||
|
|
8b596a6687 | ||
|
|
8afc9ad506 | ||
|
|
3b08d7d379 | ||
|
|
616ad4af60 | ||
|
|
dbdb35abb5 | ||
|
|
445a05e6ef | ||
|
|
ccad092fc2 | ||
|
|
faa23b430e | ||
|
|
923e5d16ac | ||
|
|
602ac481d7 | ||
|
|
b322396a99 | ||
|
|
b9af7bdb6c | ||
|
|
bdb3ad7f3e | ||
|
|
1fdbf85d47 | ||
|
|
3e3911464f | ||
|
|
be732a4a6b | ||
|
|
e505843dc6 | ||
|
|
ff9489ba10 | ||
|
|
365763d6f7 | ||
|
|
9349a6ba1a | ||
|
|
34f35a5912 | ||
|
|
05f16068ff | ||
|
|
ddda7f4552 | ||
|
|
38406212c3 | ||
|
|
62a0d39ac3 | ||
|
|
0e6ab4e4ee |
@@ -43,7 +43,7 @@ small
|
|||||||
|
|
||||||
[node_db]
|
[node_db]
|
||||||
type=NuDB
|
type=NuDB
|
||||||
path=/var/lib/rippled/db/nudb
|
path=/var/lib/xahaud/db/nudb
|
||||||
advisory_delete=0
|
advisory_delete=0
|
||||||
|
|
||||||
# How many ledgers do we want to keep (history)?
|
# How many ledgers do we want to keep (history)?
|
||||||
@@ -58,10 +58,10 @@ online_delete=256
|
|||||||
256
|
256
|
||||||
|
|
||||||
[database_path]
|
[database_path]
|
||||||
/var/lib/rippled/db
|
/var/lib/xahaud/db
|
||||||
|
|
||||||
[debug_logfile]
|
[debug_logfile]
|
||||||
/var/log/rippled/debug.log
|
/var/log/xahaud/debug.log
|
||||||
|
|
||||||
[sntp_servers]
|
[sntp_servers]
|
||||||
time.windows.com
|
time.windows.com
|
||||||
@@ -70,10 +70,10 @@ time.nist.gov
|
|||||||
pool.ntp.org
|
pool.ntp.org
|
||||||
|
|
||||||
[ips]
|
[ips]
|
||||||
r.ripple.com 51235
|
r.xahau.com 51235
|
||||||
|
|
||||||
[validators_file]
|
# # # # # [validators_file]
|
||||||
validators.txt
|
# # # # # validators.txt
|
||||||
|
|
||||||
[rpc_startup]
|
[rpc_startup]
|
||||||
{ "command": "log_level", "severity": "info" }
|
{ "command": "log_level", "severity": "info" }
|
||||||
@@ -92,81 +92,18 @@ validators.txt
|
|||||||
|
|
||||||
|
|
||||||
# In order to enable an amendment which by default would vote "No", you must include its amendment id and name here.
|
# In order to enable an amendment which by default would vote "No", you must include its amendment id and name here.
|
||||||
# To add amendments specifically from the latest releases of rippled:
|
# To add amendments specifically from the latest releases of xahaud:
|
||||||
# 1. Go to https://xrpl.org/known-amendments.html
|
# 1. Go to https://xrpl.org/known-amendments.html
|
||||||
# 2. Find the first amendment in the latest releases of rippled which are not already in the list below
|
# 2. Find the first amendment in the latest releases of xahaud which are not already in the list below
|
||||||
# 3. Click on each amendment to get their Amendment ID and name to add to this list manually.
|
# 3. Click on each amendment to get their Amendment ID and name to add to this list manually.
|
||||||
# You will likely update the list with all amendments from a new release of rippled all at once.
|
# You will likely update the list with all amendments from a new release of xahaud all at once.
|
||||||
|
|
||||||
# To get the list of amendments on a network (e.g. devnet) follow the steps in xrpl.js's CONTRIBUTING.md for "Updating the Docker container".
|
# To get the list of amendments on a network (e.g. devnet) follow the steps in xahau.js's CONTRIBUTING.md for "Updating the Docker container".
|
||||||
# https://github.com/XRPLF/xrpl.js/blob/main/CONTRIBUTING.md
|
# https://github.com/XRPLF/xahau.js/blob/main/CONTRIBUTING.md
|
||||||
# (Running the script `getNewAmendments.js` should help you identify any new amendments that should be added.)
|
# (Running the script `getNewAmendments.js` should help you identify any new amendments that should be added.)
|
||||||
#
|
#
|
||||||
# Note: The version of rippled you use this config with must have an implementation for the amendments you attempt to enable or it will crash.
|
# Note: The version of xahaud you use this config with must have an implementation for the amendments you attempt to enable or it will crash.
|
||||||
# If you need the version of rippled to be more up to date, you may need to make a comment on this repo: https://github.com/WietseWind/docker-rippled
|
# If you need the version of xahaud to be more up to date, you may need to make a comment on this repo: https://github.com/WietseWind/docker-xahaud
|
||||||
|
|
||||||
[features]
|
[network_id]
|
||||||
# Devnet amendments as of June 28th, 2023
|
63456
|
||||||
NegativeUNL
|
|
||||||
fixRemoveNFTokenAutoTrustLine
|
|
||||||
NonFungibleTokensV1
|
|
||||||
CheckCashMakesTrustLine
|
|
||||||
fixRmSmallIncreasedQOffers
|
|
||||||
fixSTAmountCanonicalize
|
|
||||||
FlowSortStrands
|
|
||||||
TicketBatch
|
|
||||||
fix1201
|
|
||||||
fixQualityUpperBound
|
|
||||||
FlowCross
|
|
||||||
EnforceInvariants
|
|
||||||
fix1523
|
|
||||||
HardenedValidations
|
|
||||||
DepositPreauth
|
|
||||||
MultiSignReserve
|
|
||||||
fix1623
|
|
||||||
FeeEscalation
|
|
||||||
PayChan
|
|
||||||
fix1513
|
|
||||||
RequireFullyCanonicalSig
|
|
||||||
fix1543
|
|
||||||
TickSize
|
|
||||||
fix1781
|
|
||||||
fixCheckThreading
|
|
||||||
fix1515
|
|
||||||
CryptoConditions
|
|
||||||
fix1528
|
|
||||||
fixPayChanRecipientOwnerDir
|
|
||||||
SortedDirectories
|
|
||||||
fix1578
|
|
||||||
fix1571
|
|
||||||
fixAmendmentMajorityCalc
|
|
||||||
fixTakerDryOfferRemoval
|
|
||||||
fixMasterKeyAsRegularKey
|
|
||||||
Flow
|
|
||||||
Escrow
|
|
||||||
TrustSetAuth
|
|
||||||
DeletableAccounts
|
|
||||||
DepositAuth
|
|
||||||
fix1368
|
|
||||||
fix1512
|
|
||||||
fix1373
|
|
||||||
MultiSign
|
|
||||||
Checks
|
|
||||||
NonFungibleTokensV1_1
|
|
||||||
# 1.10.0 Amendments
|
|
||||||
DisallowIncoming
|
|
||||||
fixNonFungibleTokensV1_2
|
|
||||||
fixTrustLinesToSelf
|
|
||||||
fixUniversalNumber
|
|
||||||
ImmediateOfferKilled
|
|
||||||
XRPFees
|
|
||||||
# 1.11.0 Amendments
|
|
||||||
ExpandedSignerList
|
|
||||||
# 1.12.0 Amendments
|
|
||||||
AMM
|
|
||||||
Clawback
|
|
||||||
fixReducedOffersV1
|
|
||||||
fixNFTokenRemint
|
|
||||||
# 2.0.0 Amendments
|
|
||||||
XChainBridge
|
|
||||||
DID
|
|
||||||
28
.coderabbit.yaml
Normal file
28
.coderabbit.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
|
||||||
|
language: "en-US"
|
||||||
|
reviews:
|
||||||
|
# Set the profile for reviews. Assertive profile yields more feedback, that may be considered nitpicky.
|
||||||
|
profile: "chill"
|
||||||
|
# Approve the review once CodeRabbit's comments are resolved. Note: In GitLab, all discussions must be resolved.
|
||||||
|
request_changes_workflow: false
|
||||||
|
# Generate a high level summary of the changes in the PR/MR description.
|
||||||
|
high_level_summary: false
|
||||||
|
# Generate a poem in the walkthrough comment.
|
||||||
|
poem: true
|
||||||
|
# Post review details on each review. Additionally, post a review status when a review is skipped in certain cases.
|
||||||
|
review_status: true
|
||||||
|
# Generate walkthrough in a markdown collapsible section.
|
||||||
|
collapse_walkthrough: false
|
||||||
|
# Abort the in-progress review if the pull request is closed or merged.
|
||||||
|
abort_on_close: true
|
||||||
|
auto_review:
|
||||||
|
# Automatic Review | Automatic code review
|
||||||
|
enabled: true
|
||||||
|
# Review draft PRs/MRs.
|
||||||
|
drafts: false
|
||||||
|
# Ignore reviewing if the title of the pull request contains any of these keywords (case-insensitive).
|
||||||
|
ignore_title_keywords:
|
||||||
|
- build(
|
||||||
|
chat:
|
||||||
|
# Enable the bot to reply automatically without requiring the user to tag it.
|
||||||
|
auto_reply: true
|
||||||
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@@ -12,13 +12,11 @@
|
|||||||
name: "CodeQL"
|
name: "CodeQL"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [ main, 1.x ]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '44 5 * * 6'
|
- cron: "44 5 * * 6"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
@@ -28,7 +26,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'javascript' ]
|
language: ["javascript"]
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
# Learn more:
|
# Learn more:
|
||||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|||||||
22
.github/workflows/nodejs.yml
vendored
22
.github/workflows/nodejs.yml
vendored
@@ -4,11 +4,11 @@
|
|||||||
name: Node.js CI
|
name: Node.js CI
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RIPPLED_DOCKER_IMAGE: rippleci/rippled:2.0.0-b4
|
XAHAUD_DOCKER_IMAGE: xahauci/xahaud:2025.2.6
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, 1.x]
|
branches: [main-xahau, 1.x]
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x]
|
node-version: [18.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x, 20.x]
|
node-version: [18.x, 20.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -101,14 +101,14 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x, 20.x]
|
node-version: [18.x, 20.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Run docker in background
|
- name: Run docker in background
|
||||||
run: |
|
run: |
|
||||||
docker run --detach --rm --name rippled-service -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/opt/ripple/etc/" --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true ${{ env.RIPPLED_DOCKER_IMAGE }} /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg
|
docker run --detach --rm --name xahaud-service -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/opt/xahau/etc/" --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true ${{ env.XAHAUD_DOCKER_IMAGE }} /opt/xahau/bin/xahaud -a --conf /opt/xahau/etc/xahaud.cfg
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
@@ -145,7 +145,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Stop docker container
|
- name: Stop docker container
|
||||||
if: always()
|
if: always()
|
||||||
run: docker stop rippled-service
|
run: docker stop xahaud-service
|
||||||
|
|
||||||
browser:
|
browser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -153,7 +153,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x]
|
node-version: [18.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -165,7 +165,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run docker in background
|
- name: Run docker in background
|
||||||
run: |
|
run: |
|
||||||
docker run --detach --rm --name rippled-service -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/opt/ripple/etc/" --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true ${{ env.RIPPLED_DOCKER_IMAGE }} /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg
|
docker run --detach --rm --name xahaud-service -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/opt/ripple/etc/" --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --env GITHUB_ACTIONS=true --env CI=true ${{ env.XAHAUD_DOCKER_IMAGE }} /opt/ripple/bin/xahaud -a --conf /opt/ripple/etc/xahaud.cfg
|
||||||
|
|
||||||
- name: Setup npm version 9
|
- name: Setup npm version 9
|
||||||
run: |
|
run: |
|
||||||
@@ -197,7 +197,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Stop docker container
|
- name: Stop docker container
|
||||||
if: always()
|
if: always()
|
||||||
run: docker stop rippled-service
|
run: docker stop xahaud-service
|
||||||
|
|
||||||
snippets:
|
snippets:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -205,7 +205,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x, 20.x]
|
node-version: [18.x, 20.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -39,7 +39,7 @@
|
|||||||
"enable": true
|
"enable": true
|
||||||
},
|
},
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.trimFinalNewlines": true,
|
"files.trimFinalNewlines": true,
|
||||||
|
|||||||
171
APPLICATIONS.md
171
APPLICATIONS.md
@@ -1,171 +0,0 @@
|
|||||||
# Applications using xrpl.js
|
|
||||||
|
|
||||||
A curated list of some of the projects and apps that leverage `xrpl.js` in some way.
|
|
||||||
|
|
||||||
**Have one to add?** Please edit this file and open a PR!
|
|
||||||
|
|
||||||
## Notice (disclaimer)
|
|
||||||
|
|
||||||
These sites are independent of Ripple and have not been authorized, endorsed, sponsored or otherwise approved by Ripple or its affiliates.
|
|
||||||
|
|
||||||
Warning: Use at your own risk.
|
|
||||||
|
|
||||||
## Exchanges
|
|
||||||
|
|
||||||
- **[The World Exchange](https://www.theworldexchange.net/)**
|
|
||||||
|
|
||||||
Trade, issue, and send directly on the XRP Ledger. A user interface for the XRPL's decentralized exchange. Includes an implementation of an autobridged order book for token-to-token trading pairs in the [source code](https://github.com/pftq/TheWorldExchange).
|
|
||||||
|
|
||||||
- **[Bitso](https://bitso.com/)**
|
|
||||||
|
|
||||||
Exchange allowing clients to buy and sell XRP, based in Mexico.
|
|
||||||
|
|
||||||
## Explorers
|
|
||||||
|
|
||||||
- **[xrpintel - XRP Intelligence](https://xrpintel.com/)**
|
|
||||||
|
|
||||||
Monitor the XRP Network in real time and explore historical statistics.
|
|
||||||
|
|
||||||
- **[XRP Charts](https://xrpcharts.ripple.com/)** (xrpcharts.ripple.com)
|
|
||||||
|
|
||||||
XRP Charts provides information based on public data, including trade volume, top markets, metrics, transactions, and more.
|
|
||||||
|
|
||||||
- **[Ripple Live](https://gatehub.net/live)** (gatehub.net/live)
|
|
||||||
|
|
||||||
Visualize XRP network transactions.
|
|
||||||
|
|
||||||
- **[XRPL Dev. Dashboard](https://xrp.fans/)** (xrp.fans)
|
|
||||||
|
|
||||||
Debugging dashboard for `rippled-ws-client-pool`, transaction and query explorer, and transaction signing and submission tool.
|
|
||||||
|
|
||||||
- **[XRP Value](http://xrpvalue.com/)**
|
|
||||||
|
|
||||||
Real-time XRP price, trades, and orderbook data from the XRP Ledger.
|
|
||||||
|
|
||||||
- **[Bithomp - XRP Explorer](https://bithomp.com/explorer/)**
|
|
||||||
|
|
||||||
Look up information by entering an address, transaction hash, username, or PayID.
|
|
||||||
|
|
||||||
- **[Bithomp - XRPL validators](https://bithomp.com/validators)**
|
|
||||||
|
|
||||||
List of XRPL validators, nodes, and testnet validators.
|
|
||||||
|
|
||||||
- **[XRP Scan - XRP Ledger explorer](https://xrpscan.com)**
|
|
||||||
|
|
||||||
XRP Ledger explorer, metrics and analytics.
|
|
||||||
|
|
||||||
- **[xrplorer](https://xrplorer.com)**
|
|
||||||
|
|
||||||
XRP Ledger explorer, API, metrics, and analytics using a graph database that is synchronized live with the XRPL.
|
|
||||||
|
|
||||||
## Data monitoring
|
|
||||||
|
|
||||||
- **[zerptracker](https://zerptracker.com)**
|
|
||||||
|
|
||||||
Monitor the XRPL using powerful JSONPath expressions, and receive notifications via email, SMS, webhooks, and more.
|
|
||||||
|
|
||||||
- **[Utility-Scan](https://utility-scan.com)**
|
|
||||||
|
|
||||||
Attempts to detect RippleNet on-demand liquidity (ODL) transactions through known fiat corridors and report these transactions in real time.
|
|
||||||
|
|
||||||
- **[XRPL Rosetta](https://threexrp.dev/)**
|
|
||||||
|
|
||||||
3D Globe written in three.js connected to a Node.js websocket server that is listening to exchanges and the XRPL. The visualization aims to show trading, ODL, and liquidity at exchanges, intra-exchange volume, and flows.
|
|
||||||
|
|
||||||
## Wallets and wallet tools
|
|
||||||
|
|
||||||
- **[GemWallet](https://gemwallet.app/)**
|
|
||||||
|
|
||||||
Users can use the GemWallet (non-custodial) web extension to interact with the XRPL from their browser. The documentation is available at [https://gemwallet.app/](https://gemwallet.app/docs/user-guide/introduction).
|
|
||||||
|
|
||||||
- **[XUMM](https://xumm.app/)**
|
|
||||||
|
|
||||||
Users can use the xumm application to track their accounts, balances and transactions. The true power of xumm is the platform available for developers.
|
|
||||||
|
|
||||||
- **[Xpring Wallet](https://xpring.io)** (uses `ripple-keypairs`)
|
|
||||||
|
|
||||||
Non-custodial XRP wallet.
|
|
||||||
|
|
||||||
- **[XRP Toolkit](https://www.xrptoolkit.com)**
|
|
||||||
|
|
||||||
A web interface to the XRP Ledger, supporting both hardware and software wallets.
|
|
||||||
|
|
||||||
- **[Toast Wallet](https://toastwallet.com/)**
|
|
||||||
|
|
||||||
A free, open source XRP Wallet for iOS, Android, Windows, Mac and Linux.
|
|
||||||
|
|
||||||
- **[Toastify Ledger](https://github.com/WietseWind/toastify-ledger)** (uses `ripple-keypairs`)
|
|
||||||
|
|
||||||
Add a Regular Key to a mnemonic XRP Wallet (e.g. Ledger Nano S) to use the account with a Family Seed (secret).
|
|
||||||
|
|
||||||
- **[Bithomp-submit](https://github.com/Bithomp/bithomp-submit)** (GitHub)
|
|
||||||
|
|
||||||
A tool to submit an offline-signed XRPL transaction.
|
|
||||||
|
|
||||||
- **[Kyte](https://kyteapp.co/)** (kyteapp.co) ([Source](https://github.com/WietseWind/Zerp-Wallet)) (Deprecated)
|
|
||||||
|
|
||||||
Web-based XRP wallet.
|
|
||||||
|
|
||||||
- **[XRP Vanity Address Generator](https://github.com/WietseWind/xrp-vanity-generator)** (Node.js)
|
|
||||||
|
|
||||||
A vanity address is a wallet address containing a few characters you like at the beginning or the end of the wallet address.
|
|
||||||
|
|
||||||
- **[XRP Account Mnemonic Recovery](https://github.com/WietseWind/xrp-mnemonic-recovery)** (uses `ripple-keypairs`)
|
|
||||||
|
|
||||||
Recover a 24 word mnemonic if one word is wrong or one word is missing.
|
|
||||||
|
|
||||||
- **[Trustline](https://trustline.co)**
|
|
||||||
|
|
||||||
A decentralized stablecoin wallet that runs on the XRP Ledger.
|
|
||||||
|
|
||||||
## Send and request payments
|
|
||||||
|
|
||||||
- **[XRP Tip Bot](https://www.xrptipbot.com/)**
|
|
||||||
|
|
||||||
A bot that enables users on reddit, Twitter and Discord to send XRP to each other through reddit comments and Twitter tweets.
|
|
||||||
|
|
||||||
- **[XRP Text](https://xrptext.com/)**
|
|
||||||
|
|
||||||
Send XRP using SMS text messages.
|
|
||||||
|
|
||||||
- **[XRParrot](https://xrparrot.com/)** (uses `ripple-address-codec`)
|
|
||||||
|
|
||||||
Easy EUR (SEPA) to XRP transfer (currency conversion).
|
|
||||||
|
|
||||||
- **[XRP Payment](https://xrpayments.co/)** (xrpayments.co)
|
|
||||||
|
|
||||||
Tool for generating a XRP payment request URI in a QR code, with currency converter.
|
|
||||||
|
|
||||||
## Development tools
|
|
||||||
|
|
||||||
- **[XRP Faucets for Testnet and Devnet](https://xrpl.org/xrp-testnet-faucet.html)**
|
|
||||||
|
|
||||||
Get some test funds for development on the test network. The faucet uses `xrpl.js`.
|
|
||||||
|
|
||||||
## Code samples and libraries
|
|
||||||
|
|
||||||
- **[ilp-plugin-xrp-paychan](https://github.com/interledgerjs/ilp-plugin-xrp-paychan)**
|
|
||||||
|
|
||||||
Send ILP payments using XRP and payment channels (PayChan).
|
|
||||||
|
|
||||||
- **[RunKit: WietseWind](https://runkit.com/wietsewind/)**
|
|
||||||
|
|
||||||
XRP Ledger code samples for Node.js.
|
|
||||||
|
|
||||||
- **[GitHub Gist: WietseWind](https://gist.github.com/WietseWind)**
|
|
||||||
|
|
||||||
XRP Ledger code samples for Node.js and the web (mostly).
|
|
||||||
|
|
||||||
- **[rippled-ws-client-sign](https://github.com/WietseWind/rippled-ws-client-sign)**
|
|
||||||
|
|
||||||
Sign transactions, with support for MultiSign.
|
|
||||||
|
|
||||||
- **[ILP-enabled power switch](https://xrpcommunity.blog/raspberry-pi-interledger-xp-powerswitch-howto/)** ([video](https://www.youtube.com/watch?v=c-eS0HQUuJg)) (uses [`moneyd-uplink-xrp`](https://github.com/interledgerjs/moneyd-uplink-xrp))
|
|
||||||
|
|
||||||
For about $30 in parts (Raspberry Pi, 3.3V Relay board and a few wires) you can build your own power switch that will switch on if a streaming ILP payment comes in. When the payment stream stops, the power turns off.
|
|
||||||
|
|
||||||
## Related apps that do not appear to use xrpl.js
|
|
||||||
|
|
||||||
- **[XRP Stats](https://ledger.exposed/)** (ledger.exposed)
|
|
||||||
|
|
||||||
Rich list, live ledger stats and XRP distribution. Visualize escrows and flow of funds.
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
We use Node v16 for development - that is the version that our linters require.
|
We use Node v18 for development - that is the version that our linters require.
|
||||||
You must also use `npm` v7. You can check your `npm` version with:
|
You must also use `npm` v7. You can check your `npm` version with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -47,7 +47,7 @@ npm run lint
|
|||||||
|
|
||||||
## Running Tests
|
## Running Tests
|
||||||
|
|
||||||
For integration and browser tests, we use a `rippled` node in standalone mode to test xrpl.js code against. To set this up, you can either configure and run `rippled` locally, or set up the Docker container `rippleci/rippled` by [following these instructions](#integration-tests). The latter will require you to [install Docker](https://docs.docker.com/get-docker/).
|
For integration and browser tests, we use a `xahaud` node in standalone mode to test xahau.js code against. To set this up, you can either configure and run `xahaud` locally, or set up the Docker container `xahauci/xahaud` by [following these instructions](#integration-tests). The latter will require you to [install Docker](https://docs.docker.com/get-docker/).
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
@@ -59,12 +59,12 @@ npm test
|
|||||||
|
|
||||||
### Integration Tests
|
### Integration Tests
|
||||||
|
|
||||||
From the top-level xrpl.js folder (one level above `packages`), run the following commands:
|
From the top-level xahau.js folder (one level above `packages`), run the following commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
# sets up the xahaud standalone Docker container - you can skip this step if you already have it set up
|
||||||
docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/opt/ripple/etc/ --platform linux/amd64 rippleci/rippled:2.0.0-b4 /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg
|
docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/opt/xahau/etc/ --platform linux/amd64 xahauci/xahaud:2025.2.6 /opt/xahau/bin/xahaud -a --conf /opt/xahau/etc/xahaud.cfg
|
||||||
npm run build
|
npm run build
|
||||||
npm run test:integration
|
npm run test:integration
|
||||||
```
|
```
|
||||||
@@ -73,9 +73,9 @@ Breaking down the command:
|
|||||||
* `docker run -p 6006:6006` starts a Docker container with an open port for admin WebSocket requests.
|
* `docker run -p 6006:6006` starts a Docker container with an open port for admin WebSocket requests.
|
||||||
* `--interactive` allows you to interact with the container.
|
* `--interactive` allows you to interact with the container.
|
||||||
* `-t` starts a terminal in the container for you to send commands to.
|
* `-t` starts a terminal in the container for you to send commands to.
|
||||||
* `--volume $PWD/.ci-config:/config/` identifies the `rippled.cfg` and `validators.txt` to import. It must be an absolute path, so we use `$PWD` instead of `./`.
|
* `--volume $PWD/.ci-config:/config/` identifies the `xahaud.cfg` and `validators.txt` to import. It must be an absolute path, so we use `$PWD` instead of `./`.
|
||||||
* `rippleci/rippled` is an image that is regularly updated with the latest `rippled` releases
|
* `xahauci/xahaud` is an image that is regularly updated with the latest `xahaud` releases
|
||||||
* `/opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg` starts `rippled` in standalone mode
|
* `/opt/xahau/bin/xahaud -a --conf /opt/xahau/etc/xahaud.cfg` starts `xahaud` in standalone mode
|
||||||
|
|
||||||
### Browser Tests
|
### Browser Tests
|
||||||
|
|
||||||
@@ -85,12 +85,12 @@ One is in the browser - run `npm run build:browserTests` and open `test/localInt
|
|||||||
|
|
||||||
The other is in the command line (this is what we use for CI) -
|
The other is in the command line (this is what we use for CI) -
|
||||||
|
|
||||||
This should be run from the `xrpl.js` top level folder (one above the `packages` folder).
|
This should be run from the `xahau.js` top level folder (one above the `packages` folder).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
# sets up the rippled standalone Docker container - you can skip this step if you already have it set up
|
# sets up the xahaud standalone Docker container - you can skip this step if you already have it set up
|
||||||
docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/opt/ripple/etc/ --platform linux/amd64 rippleci/rippled:2.0.0-b3 /opt/ripple/bin/rippled -a --conf /opt/ripple/etc/rippled.cfg
|
docker run -p 6006:6006 --interactive -t --volume $PWD/.ci-config:/opt/xahau/etc/ --platform linux/amd64 xahauci/xahaud:2025.2.6 /opt/xahau/bin/xahaud -a --conf /opt/xahau/etc/xahaud.cfg
|
||||||
npm run test:browser
|
npm run test:browser
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -100,45 +100,47 @@ This is a monorepo, which means that there are multiple packages in a single Git
|
|||||||
|
|
||||||
The 4 packages currently here are:
|
The 4 packages currently here are:
|
||||||
|
|
||||||
1. xrpl.js - The client library for interacting with the ledger.
|
1. xahau.js - The client library for interacting with the ledger.
|
||||||
2. ripple-binary-codec - A library for serializing and deserializing transactions for the ledger.
|
2. xahau-binary-codec - A library for serializing and deserializing transactions for the ledger.
|
||||||
3. ripple-keypairs - A library for generating and using cryptographic keypairs.
|
3. xahau-keypairs - A library for generating and using cryptographic keypairs.
|
||||||
4. ripple-address-codec - A library for encoding and decoding XRP Ledger addresses and seeds.
|
4. xahau-address-codec - A library for encoding and decoding Xahau Ledger addresses and seeds.
|
||||||
|
5. isomorphic - A collection of isomorphic implementations of crypto and utility functions.
|
||||||
|
6. secret-numbers - Generate XRPL Accounts with a number-based secret: 8 chunks of 6 digits.
|
||||||
|
|
||||||
Each package has it's own README which dives deeper into what it's main purpose is, and the core functionality it offers.
|
Each package has it's own README which dives deeper into what it's main purpose is, and the core functionality it offers.
|
||||||
They also run tests independently as they were originally in separate repositories.
|
They also run tests independently as they were originally in separate repositories.
|
||||||
|
|
||||||
These are managed in a monorepo because often a change in a lower-level library will also require a change in xrpl.js, and so it makes sense to be able to allow for modifications of all packages at once without coordinating versions across multiple repositories.
|
These are managed in a monorepo because often a change in a lower-level library will also require a change in xahau.js, and so it makes sense to be able to allow for modifications of all packages at once without coordinating versions across multiple repositories.
|
||||||
|
|
||||||
Let's dive a bit into how xrpl.js is structured!
|
Let's dive a bit into how xahau.js is structured!
|
||||||
|
|
||||||
### The File Structure
|
### The File Structure
|
||||||
|
|
||||||
Within the xrpl package, each folder has a specific purpose:
|
Within the xrpl package, each folder has a specific purpose:
|
||||||
|
|
||||||
**Client** - This contains logic for handling the websocket connection to rippled servers.
|
**Client** - This contains logic for handling the websocket connection to xahaud servers.
|
||||||
**Models** - These types model LedgerObjects, Requests/Methods, and Transactions in order to give type hints and nice errors for users.
|
**Models** - These types model LedgerObjects, Requests/Methods, and Transactions in order to give type hints and nice errors for users.
|
||||||
**Sugar** - This is where handy helper functions end up, like `submit`, `autofill`, and `getXRPBalance` amongst others.
|
**Sugar** - This is where handy helper functions end up, like `submit`, `autofill`, and `getXAHBalance` amongst others.
|
||||||
**Utils** - These are shared functions which are useful for conversions, or internal implementation details within the library.
|
**Utils** - These are shared functions which are useful for conversions, or internal implementation details within the library.
|
||||||
**Wallet** - This logic handles managing keys, addresses, and signing within xrpl.js
|
**Wallet** - This logic handles managing keys, addresses, and signing within xahau.js
|
||||||
|
|
||||||
### Writing Tests for xrpl.js
|
### Writing Tests for xahau.js
|
||||||
|
|
||||||
For every file in `src`, we try to have a corresponding file in `test` with unit tests.
|
For every file in `src`, we try to have a corresponding file in `test` with unit tests.
|
||||||
|
|
||||||
The goal is to maintain above 80% code coverage, and generally any new feature or bug fix should be accompanied by unit tests, and integration tests if applicable.
|
The goal is to maintain above 80% code coverage, and generally any new feature or bug fix should be accompanied by unit tests, and integration tests if applicable.
|
||||||
|
|
||||||
For an example of a unit test, check out the [autofill tests here](./packages/xrpl/test/client/autofill.ts).
|
For an example of a unit test, check out the [autofill tests here](./packages/xahau/test/client/autofill.ts).
|
||||||
|
|
||||||
If your code connects to the ledger (ex. Adding a new transaction type) it's handy to write integration tests to ensure that you can successfully interact with the ledger. Integration tests are generally run against a docker instance of rippled which contains the latest updates. Since standalone mode allows us to manually close ledgers, this allows us to run integration tests at a much faster rate than if we had to wait 4-5 seconds per transaction for the ledger to validate the transaction. [See above](#running-tests) for how to start up the docker container to run integration tests.
|
If your code connects to the ledger (ex. Adding a new transaction type) it's handy to write integration tests to ensure that you can successfully interact with the ledger. Integration tests are generally run against a docker instance of xahaud which contains the latest updates. Since standalone mode allows us to manually close ledgers, this allows us to run integration tests at a much faster rate than if we had to wait 4-5 seconds per transaction for the ledger to validate the transaction. [See above](#running-tests) for how to start up the docker container to run integration tests.
|
||||||
|
|
||||||
All integration tests should be written in the `test/integration` folder, with new `Requests` and `Transactions` tests being in their respective folders.
|
All integration tests should be written in the `test/integration` folder, with new `Requests` and `Transactions` tests being in their respective folders.
|
||||||
|
|
||||||
For an example of how to write an integration test for `xrpl.js`, you can look at the [Payment integration test](./packages/xrpl/test/integration/transactions/payment.ts).
|
For an example of how to write an integration test for `xahau.js`, you can look at the [Payment integration test](./packages/xahau/test/integration/transactions/payment.ts).
|
||||||
|
|
||||||
## Generate reference docs
|
## Generate reference docs
|
||||||
|
|
||||||
You can see the complete reference documentation at [`xrpl.js` docs](https://js.xrpl.org). You can also generate them locally using `typedoc`:
|
You can see the complete reference documentation at [`xahau.js` docs](https://js.xrpl.org). You can also generate them locally using `typedoc`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run docgen
|
npm run docgen
|
||||||
@@ -148,17 +150,17 @@ This updates `docs/` at the top level, where GitHub Pages looks for the docs.
|
|||||||
|
|
||||||
## Update `definitions.json`
|
## Update `definitions.json`
|
||||||
|
|
||||||
Use [this repo](https://github.com/RichardAH/xrpl-codec-gen) to generate a new `definitions.json` file from the rippled source code. Instructions are available in that README.
|
Use [this repo](https://github.com/RichardAH/xrpl-codec-gen) to generate a new `definitions.json` file from the xahaud source code. Instructions are available in that README.
|
||||||
|
|
||||||
## Adding and removing packages
|
## Adding and removing packages
|
||||||
|
|
||||||
`xrpl.js` uses `lerna` and `npm`'s workspaces features to manage a monorepo.
|
`xahau.js` uses `lerna` and `npm`'s workspaces features to manage a monorepo.
|
||||||
Adding and removing packages requires a slightly different process than normal
|
Adding and removing packages requires a slightly different process than normal
|
||||||
as a result.
|
as a result.
|
||||||
|
|
||||||
### Adding or removing development dependencies
|
### Adding or removing development dependencies
|
||||||
|
|
||||||
`xrpl.js` strives to use the same development dependencies in all packages.
|
`xahau.js` strives to use the same development dependencies in all packages.
|
||||||
You may add and remove dev dependencies like normal:
|
You may add and remove dev dependencies like normal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -173,38 +175,38 @@ npm uninstall --save-dev abbrev
|
|||||||
You need to specify which package is changing using the `-w` flag:
|
You need to specify which package is changing using the `-w` flag:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
### adding a new dependency to `xrpl`
|
### adding a new dependency to `xahau`
|
||||||
npm install abbrev -w xrpl
|
npm install abbrev -w xahau
|
||||||
### adding a new dependency to `ripple-keypairs`
|
### adding a new dependency to `xahau-keypairs`
|
||||||
npm install abbrev -w ripple-keypairs
|
npm install abbrev -w xahau-keypairs
|
||||||
### removing a dependency
|
### removing a dependency
|
||||||
npm uninstall abbrev -w xrpl
|
npm uninstall abbrev -w xahau
|
||||||
```
|
```
|
||||||
|
|
||||||
## Updating the Docker container for CI
|
## Updating the Docker container for CI
|
||||||
|
|
||||||
In order to test the library, we need to enable the latest amendments in the docker container.
|
In order to test the library, we need to enable the latest amendments in the docker container.
|
||||||
This requires updating the `/.ci-config/rippled.cfg` file with the hashes and names of new amendments.
|
This requires updating the `/.ci-config/xahaud.cfg` file with the hashes and names of new amendments.
|
||||||
|
|
||||||
In order to update the list, follow these steps from the top level of the library:
|
In order to update the list, follow these steps from the top level of the library:
|
||||||
1. Run `node ./.ci-config/getNewAmendments.js`
|
1. Run `node ./.ci-config/getNewAmendments.js`
|
||||||
2. If there are any new amendment hashes, add a comment to the end of `/.ci-config/rippled.cfg` with the date
|
2. If there are any new amendment hashes, add a comment to the end of `/.ci-config/xahaud.cfg` with the date
|
||||||
- `Ex. "# Added August 9th, 2023"`
|
- `Ex. "# Added August 9th, 2023"`
|
||||||
3. For each hash printed out by the script, add the hash and name to the config file.
|
3. For each hash printed out by the script, add the hash and name to the config file.
|
||||||
- Ex. `B2A4DB846F0891BF2C76AB2F2ACC8F5B4EC64437135C6E56F3F859DE5FFD5856 ExpandedSignerList`
|
- Ex. `B2A4DB846F0891BF2C76AB2F2ACC8F5B4EC64437135C6E56F3F859DE5FFD5856 ExpandedSignerList`
|
||||||
- You can look up the name by searching for the hash on https://xrpl.org/known-amendments.html
|
- You can look up the name by searching for the hash on https://xrpl.org/known-amendments.html
|
||||||
4. Push your changes
|
4. Push your changes
|
||||||
|
|
||||||
Note: The same updated config can be used to update xrpl-py's CI as well.
|
Note: The same updated config can be used to update xahau-py's CI as well.
|
||||||
|
|
||||||
## Updating `definitions.json`
|
## Updating `definitions.json`
|
||||||
|
|
||||||
This should almost always be done using the [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen) script - if the output needs manual intervention afterwards, consider updating the script instead.
|
This should almost always be done using the [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen) script - if the output needs manual intervention afterwards, consider updating the script instead.
|
||||||
|
|
||||||
1. Clone / pull the latest changes from [rippled](https://github.com/XRPLF/rippled) - Specifically the `develop` branch is usually the right one.
|
1. Clone / pull the latest changes from [xahaud](https://github.com/XRPLF/xahaud) - Specifically the `develop` branch is usually the right one.
|
||||||
2. Clone / pull the latest changes from [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen)
|
2. Clone / pull the latest changes from [`xrpl-codec-gen`](https://github.com/RichardAH/xrpl-codec-gen)
|
||||||
3. From the `xrpl-codec-gen` tool, follow the steps in the `README.md` to generate a new `definitions.json` file.
|
3. From the `xrpl-codec-gen` tool, follow the steps in the `README.md` to generate a new `definitions.json` file.
|
||||||
4. Replace the `definitions.json` file in the `ripple-binary-codec` with the newly generated file.
|
4. Replace the `definitions.json` file in the `xahau-binary-codec` with the newly generated file.
|
||||||
5. Verify that the changes make sense by inspection before submitting, as there may be updates required for the `xrpl-codec-gen` tool depending on the latest amendments we're updating to match.
|
5. Verify that the changes make sense by inspection before submitting, as there may be updates required for the `xrpl-codec-gen` tool depending on the latest amendments we're updating to match.
|
||||||
|
|
||||||
|
|
||||||
@@ -244,13 +246,13 @@ This should almost always be done using the [`xrpl-codec-gen`](https://github.co
|
|||||||
|
|
||||||
- Stable release: Run `npx lerna publish from-package --yes`
|
- Stable release: Run `npx lerna publish from-package --yes`
|
||||||
- Beta release: Run `npx lerna publish from-package --dist-tag beta --yes`
|
- Beta release: Run `npx lerna publish from-package --dist-tag beta --yes`
|
||||||
Notice this allows developers to install the package with `npm add xrpl@beta`
|
Notice this allows developers to install the package with `npm add xahau@beta`
|
||||||
|
|
||||||
1. If requested, enter your [npmjs.com](https://npmjs.com) OTP (one-time password) to complete publication.
|
1. If requested, enter your [npmjs.com](https://npmjs.com) OTP (one-time password) to complete publication.
|
||||||
|
|
||||||
NOW YOU HAVE PUBLISHED! But you're not done; we have to notify people!
|
NOW YOU HAVE PUBLISHED! But you're not done; we have to notify people!
|
||||||
|
|
||||||
1. Run `git tag <tagname> -m <tagname>`, where `<tagname>` is the new package and version (e.g. `xrpl@2.1.1`), for each version released.
|
1. Run `git tag <tagname> -m <tagname>`, where `<tagname>` is the new package and version (e.g. `xahau@2.1.1`), for each version released.
|
||||||
1. Run `git push --follow-tags`, to push the tags to Github.
|
1. Run `git push --follow-tags`, to push the tags to Github.
|
||||||
1. On GitHub, click the "Releases" link on the right-hand side of the page.
|
1. On GitHub, click the "Releases" link on the right-hand side of the page.
|
||||||
|
|
||||||
@@ -260,19 +262,19 @@ This should almost always be done using the [`xrpl-codec-gen`](https://github.co
|
|||||||
1. Click "Choose a tag", and choose a tag that you just created.
|
1. Click "Choose a tag", and choose a tag that you just created.
|
||||||
1. Edit the name of the release to match the tag (IE \<package\>@\<version\>) and edit the description as you see fit.
|
1. Edit the name of the release to match the tag (IE \<package\>@\<version\>) and edit the description as you see fit.
|
||||||
|
|
||||||
1. Send an email to [xrpl-announce](https://groups.google.com/g/xrpl-announce).
|
1. Send an email to [xahau-announce](https://groups.google.com/g/xahau-announce).
|
||||||
1. Lastly, send a similar message to the XRPL Discord in the [`javascript` channel](https://discord.com/channels/886050993802985492/886053111179915295). The message should include:
|
1. Lastly, send a similar message to the Xahau Discord in the [`javascript` channel](https://discord.com/channels/1085202760548499486/1085203623111295068). The message should include:
|
||||||
1. The version changes for xrpl libraries
|
1. The version changes for xahau libraries
|
||||||
1. A link to the more detailed changes
|
1. A link to the more detailed changes
|
||||||
1. Highlights of important changes
|
1. Highlights of important changes
|
||||||
|
|
||||||
|
|
||||||
## Mailing Lists
|
## Mailing Lists
|
||||||
|
|
||||||
We have a low-traffic mailing list for announcements of new `xrpl.js` releases. (About 1 email every couple of weeks)
|
We have a low-traffic mailing list for announcements of new `xahau.js` releases. (About 1 email every couple of weeks)
|
||||||
|
|
||||||
- [Subscribe to xrpl-announce](https://groups.google.com/g/xrpl-announce)
|
- [Subscribe to xahau-announce](https://groups.google.com/g/xahau-announce)
|
||||||
|
|
||||||
If you're using the XRP Ledger in production, you should run a [rippled server](https://github.com/ripple/rippled) and subscribe to the ripple-server mailing list as well.
|
If you're using the Xahau Ledger in production, you should run a [xahaud server](https://github.com/xahau/xahaud) and subscribe to the xahau-server mailing list as well.
|
||||||
|
|
||||||
- [Subscribe to ripple-server](https://groups.google.com/g/ripple-server)
|
- [Subscribe to xahau-server](https://groups.google.com/g/xahau-server)
|
||||||
|
|||||||
33
MIGRATION.md
33
MIGRATION.md
@@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
In xrpl.js 3.0, we've made significant improvements that result in a 60% reduction in bundle size for browser applications. We've also eliminated the need for polyfills with minimal disruption to existing code. This was achieved by replacing node-specific dependencies with ones that are compatible with browsers.
|
In xrpl.js 3.0, we've made significant improvements that result in a 60% reduction in bundle size for browser applications. We've also eliminated the need for polyfills with minimal disruption to existing code. This was achieved by replacing node-specific dependencies with ones that are compatible with browsers.
|
||||||
|
|
||||||
The main change you'll notice is the update replacing `Buffer` with `Uint8Array` across the board. This was done since browsers don't support `Buffer`. Fortunately, this transition is relatively straightforward, as `Buffer` is a subclass of `Uint8Array`, meaning in many circumstances `Buffer` can be directly replaced by `Uint8Array`. The primary difference is that `Buffer` has additional helper functions. We've listed the affected client library functions below in the `Uint8Array` section for your reference.
|
The two main changes you'll notice are:
|
||||||
|
* A breaking change to `Wallet` object creation, to use a more performant algorithm by default. See [here](#8-wallet-functions-default-to-ed25519-instead-of-secp256k1-signing-algorithm) for details.
|
||||||
|
* Replacing `Buffer` with `Uint8Array` across the board. This was done since browsers don't support `Buffer`. Fortunately, this transition is relatively straightforward, as `Buffer` is a subclass of `Uint8Array`, meaning in many circumstances `Buffer` can be directly replaced by `Uint8Array`. The primary difference is that `Buffer` has additional helper functions. We've listed the affected client library functions below in the `Uint8Array` section for your reference.
|
||||||
|
|
||||||
This migration guide also applies to:
|
This migration guide also applies to:
|
||||||
`ripple-address-codec` 4.3.1 -> 5.0.0
|
- `ripple-address-codec` 4.3.1 -> 5.0.0
|
||||||
`ripple-binary-codec` 1.11.0 -> 2.0.0
|
- `ripple-binary-codec` 1.11.0 -> 2.0.0
|
||||||
`ripple-keypairs` 1.3.1 -> 2.0.0
|
- `ripple-keypairs` 1.3.1 -> 2.0.0
|
||||||
|
- `xrpl-secret-numbers` 0.3.4 -> `@xrplf/secret-numbers` 1.0.0
|
||||||
|
|
||||||
# Why update to 3.0?
|
# Why update to 3.0?
|
||||||
|
|
||||||
@@ -229,9 +232,27 @@ This was done to remove a hard dependency on `https-proxy-agent` when running
|
|||||||
authorization: 'authorization'
|
authorization: 'authorization'
|
||||||
}`
|
}`
|
||||||
|
|
||||||
### 8. Bug fix: Setting an explicit `algorithm` when generating a wallet works now
|
### 8. `Wallet` functions default to `ed25519` instead of `secp256k1` signing algorithm
|
||||||
|
|
||||||
`Wallet.generate()` and `Wallet.fromSeed` were ignoring the `algorithm` parameter. This means that if you were manually specifying `algorithm` in any `Wallet` constructors, you may generate a different `Wallet` keypair when upgrading to 3.0. In that case to get the same generated wallets as before, don’t specify the `algorithm` parameter.
|
In previous releases of this library, `Wallet.generate()` and `Wallet.fromSeed` were ignoring the `algorithm` parameter. Instead, the algorithm was assumed from the seed provided; if it started with `sEd`, it would use `ed25519`, and otherwise it would use `secp256k1`. However, seeds do not actually have algorithms; a seed starting with `s...` can still use the `ed25519` algorithm.
|
||||||
|
|
||||||
|
With 3.0, we updated the default signing algorithm used by the `Wallet` object to always be `ed25519` in order to default to the higher-performance algorithm. This is a breaking change to all functions used to generate a Wallet, so if you have a pre-existing XRPL account that you're using to generate a specific Wallet using older versions of xrpl.js, you may need to specify that you are using `secp256k1` as the algorithm to decode your private key / seed / etc to get the same behavior as before. See below for specifically how to update your code.
|
||||||
|
|
||||||
|
If you are creating new accounts each time (ex. via `Client.fundWallet` or `Wallet.generate`), you do not need to specify the signing algorithm.
|
||||||
|
|
||||||
|
**Before**
|
||||||
|
```
|
||||||
|
Wallet.fromSeed('s...')
|
||||||
|
Wallet.fromEntropy(entropy)
|
||||||
|
deriveKeyPair(seed="s...")
|
||||||
|
```
|
||||||
|
|
||||||
|
**After**
|
||||||
|
```
|
||||||
|
Wallet.fromSeed(seed='s...',algorithm: 'ecdsa-secp256k1')
|
||||||
|
Wallet.fromEntropy(entropy, opts={algorithm: 'ecdsa-secp256k1'})
|
||||||
|
deriveKeypair(seed='s...', opts={ algorithm: 'ecdsa-secp256k1' }) (ripple-keypairs)
|
||||||
|
```
|
||||||
|
|
||||||
### 9. `AssertionError` → `Error`
|
### 9. `AssertionError` → `Error`
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ See the full reference documentation for all classes, methods, and utilities.
|
|||||||
4. Subscribing to changes in the ledger ([Ex. ledger, transactions, & more...](https://xrpl.org/subscribe.html))
|
4. Subscribing to changes in the ledger ([Ex. ledger, transactions, & more...](https://xrpl.org/subscribe.html))
|
||||||
5. Parsing ledger data into more convenient formats ([`xrpToDrops`](https://js.xrpl.org/functions/xrpToDrops.html) and [`rippleTimeToISOTime`](https://js.xrpl.org/functions/rippleTimeToISOTime.html))
|
5. Parsing ledger data into more convenient formats ([`xrpToDrops`](https://js.xrpl.org/functions/xrpToDrops.html) and [`rippleTimeToISOTime`](https://js.xrpl.org/functions/rippleTimeToISOTime.html))
|
||||||
|
|
||||||
All of which works in Node.js (tested for v16+) & web browsers (tested for Chrome).
|
All of which works in Node.js (tested for v18+) & web browsers (tested for Chrome).
|
||||||
|
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
+ **[Node.js v16](https://nodejs.org/)** is recommended. We also support v18 and v20. Other versions may work but are not frequently tested.
|
+ **[Node.js v18](https://nodejs.org/)** is recommended. We also support v20. Other versions may work but are not frequently tested.
|
||||||
|
|
||||||
### Installing xrpl.js
|
### Installing xrpl.js
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ async function main() {
|
|||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
client.disconnect();
|
await client.disconnect();
|
||||||
}
|
}
|
||||||
main();
|
main();
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
# Unique Setup Steps for Xrpl.js
|
# Unique Setup Steps for Xahau.js
|
||||||
|
|
||||||
Starting in 3.0 xrpl and all the packages in this repo no longer require custom configurations (ex. polyfills) to run.
|
Starting in 3.0 xahau and all the packages in this repo no longer require custom configurations (ex. polyfills) to run.
|
||||||
|
|
||||||
### Using xrpl.js from a CDN
|
### Using xahau.js from a CDN
|
||||||
|
|
||||||
You can avoid setting up your build system to handle `xrpl.js` by using a cdn version that is prebuilt for the browser.
|
You can avoid setting up your build system to handle `xahau.js` by using a cdn version that is prebuilt for the browser.
|
||||||
|
|
||||||
- unpkg `<script src="https://unpkg.com/xrpl@2.3.0/build/xrpl-latest-min.js"></script>`
|
- unpkg `<script src="https://unpkg.com/xahau@2.3.0/build/xahau-latest-min.js"></script>`
|
||||||
- jsdelivr `<script src="https://cdn.jsdelivr.net/npm/xrpl@2.3.0/build/xrpl-latest-min.js"></script>`
|
- jsdelivr `<script src="https://cdn.jsdelivr.net/npm/xahau@2.3.0/build/xahau-latest-min.js"></script>`
|
||||||
|
|
||||||
Ensure that the full path is provided so the browser can find the sourcemaps.
|
Ensure that the full path is provided so the browser can find the sourcemaps.
|
||||||
|
|
||||||
### Using xrpl.js with `create-react-app`
|
### Using xahau.js with `create-react-app`
|
||||||
|
|
||||||
Starting in 3.0 xrpl and its related packages no longer require custom configurations (ex. polyfills) to run.
|
Starting in 3.0 xahau and its related packages no longer require custom configurations (ex. polyfills) to run.
|
||||||
|
|
||||||
This online template uses these steps to run xrpl.js with React in the browser:
|
This online template uses these steps to run xahau.js with React in the browser:
|
||||||
https://codesandbox.io/s/xrpl-intro-pxgdjr?file=/src/App.js
|
https://codesandbox.io/s/xahau-intro-pxgdjr?file=/src/App.js
|
||||||
|
|
||||||
### Using xrpl.js with React Native
|
### Using xahau.js with React Native
|
||||||
|
|
||||||
If you want to use `xrpl.js` with React Native you will need to install polyfills for core NodeJS modules.
|
If you want to use `xahau.js` with React Native you will need to install polyfills for core NodeJS modules.
|
||||||
|
|
||||||
1. Install dependencies (you can use `yarn` as well):
|
1. Install dependencies (you can use `yarn` as well):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm install xrpl \
|
npm install xahau \
|
||||||
fast-text-encoding \
|
fast-text-encoding \
|
||||||
react-native-get-random-values
|
react-native-get-random-values
|
||||||
```
|
```
|
||||||
@@ -53,23 +53,23 @@ import './polyfills'
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using xrpl.js with Vite React
|
### Using xahau.js with Vite React
|
||||||
|
|
||||||
Starting in 3.0 xrpl and all the packages in this repo no longer require custom configurations (ex. polyfills) to run.
|
Starting in 3.0 xahau and all the packages in this repo no longer require custom configurations (ex. polyfills) to run.
|
||||||
|
|
||||||
### Using xrpl.js with Deno
|
### Using xahau.js with Deno
|
||||||
|
|
||||||
Until official support for [Deno](https://deno.land) is added, you can use the following work-around to use `xrpl.js` with Deno:
|
Until official support for [Deno](https://deno.land) is added, you can use the following work-around to use `xahau.js` with Deno:
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The following is currently broken due to https://github.com/denoland/deno/issues/20516.
|
> The following is currently broken due to https://github.com/denoland/deno/issues/20516.
|
||||||
> Once that is fixed there could be other issues as well.
|
> Once that is fixed there could be other issues as well.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import xrpl from 'https://dev.jspm.io/npm:xrpl';
|
import xahau from 'https://dev.jspm.io/npm:xahau';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const api = new (xrpl as any).Client('wss://s.altnet.rippletest.net:51233');
|
const api = new (xahau as any).Client('wss://xahau-test.net');
|
||||||
const address = 'rH8NxV12EuV...khfJ5uw9kT';
|
const address = 'rH8NxV12EuV...khfJ5uw9kT';
|
||||||
|
|
||||||
api.connect().then(() => {
|
api.connect().then(() => {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"version": "independent",
|
"version": "independent",
|
||||||
"useWorkspaces": true,
|
|
||||||
"npmClient": "npm"
|
"npmClient": "npm"
|
||||||
}
|
}
|
||||||
|
|||||||
440
migrate.ts
Normal file
440
migrate.ts
Normal file
@@ -0,0 +1,440 @@
|
|||||||
|
// replaceScript.ts
|
||||||
|
|
||||||
|
// @ts-ignore -- No types available for fs/promises
|
||||||
|
import * as fs from "fs/promises";
|
||||||
|
// @ts-ignore -- No types available for fs/promises
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const rippleDocker: string = "rippleci/rippled:2.2.0-b3";
|
||||||
|
const xahauDocker: string = "xahauci/xahaud:2025.2.6";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in a file with the given replacements.
|
||||||
|
* @param filePath - Path to the file.
|
||||||
|
* @param replacements - Object with key-value pairs for replacement.
|
||||||
|
*/
|
||||||
|
async function replaceTextInFile(
|
||||||
|
filePath: string,
|
||||||
|
replacements: { [key: string]: string }
|
||||||
|
): Promise<void> {
|
||||||
|
try {
|
||||||
|
let content = await fs.readFile(filePath, "utf-8");
|
||||||
|
for (const [key, value] of Object.entries(replacements)) {
|
||||||
|
const regex = new RegExp(escapeRegExp(key), "g");
|
||||||
|
content = content.replace(regex, value);
|
||||||
|
}
|
||||||
|
await fs.writeFile(filePath, content, "utf-8");
|
||||||
|
console.log(`Updated: ${filePath}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error processing file ${filePath}: ${(error as Error).message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escape special characters for use in RegExp.
|
||||||
|
* @param string - The string to escape.
|
||||||
|
* @returns The escaped string.
|
||||||
|
*/
|
||||||
|
function escapeRegExp(string: string): string {
|
||||||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace occurrences in pyproject.toml, specifically in the [tool.poetry] authors section.
|
||||||
|
* @param filePath - Path to pyproject.toml.
|
||||||
|
* @param newAuthors - Array of new authors to add.
|
||||||
|
*/
|
||||||
|
// async function replaceInPoetry(filePath: string, newAuthors: string[]): Promise<void> {
|
||||||
|
// try {
|
||||||
|
// let content = await fs.readFile(filePath, 'utf-8');
|
||||||
|
|
||||||
|
// // Replace specific texts
|
||||||
|
// const replacements: { [key: string]: string } = {
|
||||||
|
// "https://github.com/XRPLF/xrpl-py": "https://github.com/Xahau/xahau-py",
|
||||||
|
// "xrpl": "xahau",
|
||||||
|
// "xrp": "xah",
|
||||||
|
// "XRP ledger": "Xahau Ledger",
|
||||||
|
// };
|
||||||
|
|
||||||
|
// await replaceTextInFile(filePath, replacements);
|
||||||
|
|
||||||
|
// // Handle authors separately
|
||||||
|
// content = await fs.readFile(filePath, 'utf-8');
|
||||||
|
// const authorsRegex = /^authors\s*=\s*\[(.*?)\]/ms;
|
||||||
|
// const match = authorsRegex.exec(content);
|
||||||
|
// if (match) {
|
||||||
|
// const existingAuthors = match[1]
|
||||||
|
// .split(',')
|
||||||
|
// .map(author => author.trim().replace(/"/g, ''))
|
||||||
|
// .filter(author => author);
|
||||||
|
// const combinedAuthors = [...existingAuthors, ...newAuthors.map(author => author.trim())];
|
||||||
|
// const newAuthorsList = combinedAuthors.map(author => ` "${author}"`).join(',\n ');
|
||||||
|
// const newAuthorsSection = `authors = [\n${newAuthorsList}\n]`;
|
||||||
|
// content = content.replace(authorsRegex, newAuthorsSection);
|
||||||
|
// await fs.writeFile(filePath, content, 'utf-8');
|
||||||
|
// console.log(`Updated authors in: ${filePath}`);
|
||||||
|
// } else {
|
||||||
|
// console.warn(`Authors section not found in: ${filePath}`);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(`Error processing file ${filePath}: ${(error as Error).message}`);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in README.md.
|
||||||
|
* @param filePath - Path to README.md.
|
||||||
|
*/
|
||||||
|
async function replaceInReadme(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"from xrpl": "from xahau",
|
||||||
|
"xrpl-py": "xahau-py",
|
||||||
|
"xrpl.": "xahau.",
|
||||||
|
"xrpl-announce": "xahau-announce",
|
||||||
|
"xrpl-keypairs": "xahau-keypairs",
|
||||||
|
"XRP Ledger": "Xahau Ledger",
|
||||||
|
"https://s.altnet.rippletest.net:51234": "https://xahau-test.net",
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function replaceInUnique(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"Xrpl.js": "Xahau.js",
|
||||||
|
xrpl: "xahau",
|
||||||
|
"wss://s.altnet.rippletest.net:51233": "wss://xahau-test.net",
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in CONTRIBUTING.md or other contributing files.
|
||||||
|
* @param filePath - Path to the contributing file.
|
||||||
|
*/
|
||||||
|
async function replaceInContrib(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"xrpl.js": "xahau.js",
|
||||||
|
"xrpl-announce": "xahau-announce",
|
||||||
|
[rippleDocker]: xahauDocker,
|
||||||
|
"/opt/ripple/bin/rippled": "/opt/xahau/bin/xahaud",
|
||||||
|
"/opt/ripple/etc/rippled.cfg": "/opt/xahau/etc/xahaud.cfg",
|
||||||
|
ripple: "xahau",
|
||||||
|
rippled: "xahaud",
|
||||||
|
RIPPLED: "XAHAUD",
|
||||||
|
getXRPBalance: "getXAHBalance",
|
||||||
|
"/packages/xrpl": "/packages/xahau",
|
||||||
|
"`xrpl`": "`xahau`",
|
||||||
|
"-w xrpl": "-w xahau",
|
||||||
|
"xrpl-py": "xahau-py",
|
||||||
|
"xrpl@beta": "xahau@beta",
|
||||||
|
"`xrpl@2.1.1`": "`xahau@2.1.1`",
|
||||||
|
"xrpl libraries": "xahau libraries",
|
||||||
|
"XRP Ledger": "Xahau Ledger",
|
||||||
|
"XRPL Discord": "Xahau Discord",
|
||||||
|
"https://discord.com/channels/886050993802985492/886053111179915295":
|
||||||
|
"https://discord.com/channels/1085202760548499486/1085203623111295068",
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in CONTRIBUTING.md or other contributing files.
|
||||||
|
* @param filePath - Path to the contributing file.
|
||||||
|
*/
|
||||||
|
async function replaceInConfig(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"[validators_file]": "# [validators_file]",
|
||||||
|
"validators.txt": "# validators.txt",
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in GitHub workflow and config files.
|
||||||
|
* @param filePath - Path to the GitHub-related file.
|
||||||
|
*/
|
||||||
|
async function replaceInGitHub(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"[xahau]": "[main, xahau]",
|
||||||
|
"flake8 xrpl": "flake8 xahau",
|
||||||
|
"reexport xrpl": "reexport xahau",
|
||||||
|
"xrpl/": "xahau/",
|
||||||
|
"source xrpl": "source xahau",
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in generic Python or JSON files.
|
||||||
|
* @param filePath - Path to the file.
|
||||||
|
*/
|
||||||
|
async function replaceInPackage(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
'"xrpl.js"': '"xahau.js"',
|
||||||
|
'"xrpl"': '"xahau"',
|
||||||
|
'"ripple-address-codec"': '"xahau-address-codec"',
|
||||||
|
'"ripple-binary-codec"': '"xahau-binary-codec"',
|
||||||
|
'"ripple-keypairs"': '"xahau-keypairs"',
|
||||||
|
'"file:packages/ripple-address-codec"':
|
||||||
|
'"file:packages/xahau-address-codec"',
|
||||||
|
'"file:packages/ripple-binary-codec"': '"file:packages/xahau-binary-codec"',
|
||||||
|
'"file:packages/ripple-keypairs"': '"file:packages/xahau-keypairs"',
|
||||||
|
'"file:packages/xrpl"': '"file:packages/xahau"',
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in generic Python or JSON files.
|
||||||
|
* @param filePath - Path to the file.
|
||||||
|
*/
|
||||||
|
async function replaceInIsomorphic(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
'"git@github.com:XRPLF/xrpl.js.git"':
|
||||||
|
'"git@github.com:Xahaud/xahau.js.git"',
|
||||||
|
'"xrpl.js"': '"xahau.js"',
|
||||||
|
};
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace text in generic Python or JSON files.
|
||||||
|
* @param filePath - Path to the file.
|
||||||
|
*/
|
||||||
|
async function replaceInFile(filePath: string): Promise<void> {
|
||||||
|
const replacements: { [key: string]: string } = {
|
||||||
|
"from 'xrpl'": "from 'xahau'",
|
||||||
|
'"xrpl"': '"xahau"',
|
||||||
|
'"ripple-address-codec"': '"xahau-address-codec"',
|
||||||
|
'"ripple-binary-codec"': '"xahau-binary-codec"',
|
||||||
|
'"ripple-keypairs"': '"xahau-keypairs"',
|
||||||
|
"from xrpl": "from xahau",
|
||||||
|
"from './xrp-codec'": "from './xah-codec'",
|
||||||
|
"from './enums/xrpl-definitions'": "from './enums/xahau-definitions'",
|
||||||
|
"from '../src/enums/xrpl-definitions'":
|
||||||
|
"from '../src/enums/xahau-definitions'",
|
||||||
|
"from './xrpl-definitions-base'": "from './xahau-definitions-base'",
|
||||||
|
"from './fixtures/rippled'": "from './fixtures/xahaud'",
|
||||||
|
"`fixtures/rippled/": "`fixtures/xahaud/",
|
||||||
|
"from 'ripple-address-codec'": "from 'xahau-address-codec'",
|
||||||
|
"from 'ripple-binary-codec'": "from 'xahau-binary-codec'",
|
||||||
|
"from 'ripple-binary-codec/dist/types'":
|
||||||
|
"from 'xahau-binary-codec/dist/types'",
|
||||||
|
"from 'ripple-keypairs'": "from 'xahau-keypairs'",
|
||||||
|
"from '../fixtures/rippled'": "from '../fixtures/xahaud'",
|
||||||
|
"from '../fixtures/rippled/accountLines'":
|
||||||
|
"from '../fixtures/xahaud/accountLines'",
|
||||||
|
'"rootDir": "../../xrpl"': '"rootDir": "../../xahau"',
|
||||||
|
"../ripple-address-codec/tsconfig.json":
|
||||||
|
"../xahau-address-codec/tsconfig.json",
|
||||||
|
"../ripple-binary-codec/tsconfig.json":
|
||||||
|
"../xahau-binary-codec/tsconfig.json",
|
||||||
|
"../ripple-keypairs/tsconfig.json": "../xahau-keypairs/tsconfig.json",
|
||||||
|
"../ripple-address-codec/tsconfig.build.json":
|
||||||
|
"../xahau-address-codec/tsconfig.build.json",
|
||||||
|
"../ripple-binary-codec/tsconfig.build.json":
|
||||||
|
"../xahau-binary-codec/tsconfig.build.json",
|
||||||
|
"../ripple-keypairs/tsconfig.build.json":
|
||||||
|
"../xahau-keypairs/tsconfig.build.json",
|
||||||
|
"./getFeeXrp": "./getFeeXah",
|
||||||
|
"../../src/sugar/getFeeXrp": "../../src/sugar/getFeeXah",
|
||||||
|
"xrpl-announce": "xahau-announce",
|
||||||
|
"wss://s.altnet.rippletest.net:51233": "wss://xahau-test.net",
|
||||||
|
"wss://s.devnet.rippletest.net": "wss://jshooks.xahau-test.net",
|
||||||
|
"wss://testnet.xrpl-labs.com": "wss://xahau-test.net",
|
||||||
|
// "XRP": "XAH",
|
||||||
|
xrpToDrops: "xahToDrops",
|
||||||
|
dropsToXrp: "dropsToXah",
|
||||||
|
xrpConversion: "xahConversion",
|
||||||
|
XrplError: "XahlError",
|
||||||
|
RippledError: "XahaudError",
|
||||||
|
RippledNotInitializedError: "XahaudNotInitializedError",
|
||||||
|
XRPLFaucetError: "XAHLFaucetError",
|
||||||
|
'"xrp"': '"xah"',
|
||||||
|
'"xrpl-ledger"': '"xahau-ledger"',
|
||||||
|
'"xrp ledger"': '"xahau ledger"',
|
||||||
|
'"ripple",': '"xahau",',
|
||||||
|
"faucet.altnet.rippletest.net": "xahau-test.net/accounts",
|
||||||
|
"faucet.devnet.rippletest.net": "jshooks.xahau-test.net/accounts",
|
||||||
|
"0000000000000000000000005852500000000000":
|
||||||
|
"0000000000000000000000005841480000000000",
|
||||||
|
RIPPLED_API_V2: "XAHAUD_API_V2",
|
||||||
|
RIPPLED_API_V1: "XAHAUD_API_V1",
|
||||||
|
"export const DEFAULT_API_VERSION = XAHAUD_API_V2":
|
||||||
|
"export const DEFAULT_API_VERSION = XAHAUD_API_V1",
|
||||||
|
"api_version: 2,": "api_version: 1,",
|
||||||
|
"'XRP'": "'XAH'",
|
||||||
|
};
|
||||||
|
// const replacements: { [key: string]: string } = {
|
||||||
|
// "from xrpl": "from xahau",
|
||||||
|
// "import xrpl": "import xahau",
|
||||||
|
// "xrpl.utils": "xahau.utils",
|
||||||
|
// "xrpl.models.": "xahau.models.",
|
||||||
|
// "xrpl.core.": "xahau.core.",
|
||||||
|
// "flake8 xrpl": "flake8 xahau",
|
||||||
|
// "xrpl-announce": "xahau-announce",
|
||||||
|
// "../xrpl": "../xahau",
|
||||||
|
// "xrpllabsofficial/xrpld:1.12.0": "xahaulabsofficial/xahaud:1.12.0",
|
||||||
|
// "xrpl-py": "xahau-py",
|
||||||
|
// "https://s.altnet.rippletest.net:51234": "https://xahau-test.net",
|
||||||
|
// "https://xrplcluster.com/": "https://xahau.network",
|
||||||
|
// '_TEST_FAUCET_URL: Final[str] = "https://faucet.altnet.rippletest.net/accounts"':
|
||||||
|
// '_TEST_FAUCET_URL: Final[str] = "https://xahau-test.net/accounts"',
|
||||||
|
// '_DEV_FAUCET_URL: Final[str] = "https://faucet.devnet.rippletest.net/accounts"':
|
||||||
|
// '_DEV_FAUCET_URL: Final[str] = "https://xahau-test.net/accounts"',
|
||||||
|
// 'if "altnet" in url or "testnet" in url:':
|
||||||
|
// 'if "xahau-test" in url or "testnet" in url:',
|
||||||
|
// "https://s.devnet.rippletest.net:51234": "https://xahau-test.net",
|
||||||
|
// "wss://s.altnet.rippletest.net:51233": "wss://xahau-test.net",
|
||||||
|
// "wss://s.devnet.rippletest.net": "wss://xahau-test.net",
|
||||||
|
// "https://testnet.xrpl-labs.com": "https://xahau-test.net",
|
||||||
|
// "wss://testnet.xrpl-labs.com": "wss://xahau-test.net",
|
||||||
|
// "faucet.devnet.rippletest.net": "xahau-test.net",
|
||||||
|
// "wss://xahau-test.net:51233": "wss://xahau-test.net",
|
||||||
|
// '_DEFAULT_API_VERSION: Final[int] = 2': '_DEFAULT_API_VERSION: Final[int] = 1',
|
||||||
|
// '"xrpl.': '"xahau.',
|
||||||
|
// "XRP": "XAH",
|
||||||
|
// "xrp_to_drops": "xah_to_drops",
|
||||||
|
// "drops_to_xrp": "drops_to_xah",
|
||||||
|
// "xrp_conversions": "xah_conversions",
|
||||||
|
// // "XAHLModelException": "XRPLModelException", // Commented out as in Python
|
||||||
|
// "XRPLModelException": "XAHLModelException",
|
||||||
|
// "xahau.models.currencies.xrp": "xahau.models.currencies.xah",
|
||||||
|
// '"xrp"': '"xah"',
|
||||||
|
// "0000000000000000000000005852500000000000": "0000000000000000000000005841480000000000",
|
||||||
|
// "def test_does_account_exist_throws_for_invalid_account":
|
||||||
|
// "def _test_does_account_exist_throws_for_invalid_account",
|
||||||
|
// "def test_run_faucet_tests": "def _test_run_faucet_tests",
|
||||||
|
// // Additional replacements commented out as in Python
|
||||||
|
// // "TestAccountDelete": "NoTestAccountDelete",
|
||||||
|
// // "TestAMM": "NoTestAMM",
|
||||||
|
// // "TestClawback": "NoTestClawback",
|
||||||
|
// // "TestDeleteOracle": "NoTestDeleteOracle",
|
||||||
|
// // "TestDID": "NoTestDID",
|
||||||
|
// // "TestSetOracle": "NoTestSetOracle",
|
||||||
|
// // "TestXChain": "NoTestXChain",
|
||||||
|
// // "TestFeature": "NoTestFeature",
|
||||||
|
// };
|
||||||
|
await replaceTextInFile(filePath, replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for Python and JSON files in the given folders and perform replacements.
|
||||||
|
* @param folderPaths - Array of folder paths to search.
|
||||||
|
*/
|
||||||
|
async function searchAndReplaceInFolders(folderPaths: string[]): Promise<void> {
|
||||||
|
for (const folderPath of folderPaths) {
|
||||||
|
try {
|
||||||
|
const entries = await fs.readdir(folderPath, { withFileTypes: true });
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullPath = path.join(folderPath, entry.name);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
await searchAndReplaceInFolders([fullPath]);
|
||||||
|
} else if (
|
||||||
|
entry.isFile() &&
|
||||||
|
(fullPath.endsWith(".ts") ||
|
||||||
|
fullPath.endsWith(".js") ||
|
||||||
|
fullPath.endsWith(".json"))
|
||||||
|
) {
|
||||||
|
await replaceInFile(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error reading folder ${folderPath}: ${(error as Error).message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename a folder or file.
|
||||||
|
* @param oldName - Current name/path.
|
||||||
|
* @param newName - New name/path.
|
||||||
|
*/
|
||||||
|
async function renameItem(oldName: string, newName: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
await fs.rename(oldName, newName);
|
||||||
|
console.log(`Renamed ${oldName} to ${newName}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error renaming ${oldName} to ${newName}: ${(error as Error).message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a file.
|
||||||
|
* @param fileName - Path to the file to delete.
|
||||||
|
*/
|
||||||
|
async function deleteFile(fileName: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
await fs.unlink(fileName);
|
||||||
|
console.log(`Deleted file: ${fileName}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error deleting file ${fileName}: ${(error as Error).message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main function to execute all operations.
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
// Delete Files
|
||||||
|
// await deleteFile("APPLICATIONS.md")
|
||||||
|
// Renaming folders/files
|
||||||
|
// await renameItem("packages/xrpl", "packages/xahau");
|
||||||
|
// await renameItem("packages/ripple-address-codec", "packages/xahau-address-codec");
|
||||||
|
// await renameItem("packages/ripple-binary-codec", "packages/xahau-binary-codec");
|
||||||
|
// await renameItem("packages/ripple-keypairs", "packages/xahau-keypairs");
|
||||||
|
// await renameItem(".ci-config/rippled.cfg", ".ci-config/xahaud.cfg");
|
||||||
|
// await renameItem("packages/xahau/src/utils/xrpConversion.ts", "packages/xahau/src/utils/xahConversion.ts");
|
||||||
|
// await renameItem("packages/xahau/test/utils/xrpToDrops.ts", "packages/xahau/test/utils/xahToDrops.ts");
|
||||||
|
// await renameItem("packages/xrpl/test/client/getFeeXrp.test.ts", "packages/xrpl/test/client/getFeeXah.test.ts");
|
||||||
|
// await renameItem("packages/xrpl/test/client/getXahBalance.test.ts", "packages/xrpl/test/client/getXahBalance.test.ts")
|
||||||
|
// await renameItem("packages/xahau/src/sugar/getFeeXrp.ts", "packages/xahau/src/sugar/getFeeXah.ts")
|
||||||
|
// await renameItem("packages/xahau/test/fixtures/rippled", "packages/xahau/test/fixtures/xahaud")
|
||||||
|
// // Address Codec
|
||||||
|
// await renameItem("packages/xahau-address-codec/src/xrp-codec.ts", "packages/xahau-address-codec/src/xah-codec.ts");
|
||||||
|
// await renameItem("packages/xahau-address-codec/test/xrp-codec.test.ts", "packages/xahau-address-codec/test/xah-codec.test.ts");
|
||||||
|
|
||||||
|
// // Binary Codec
|
||||||
|
// await renameItem("packages/xahau-binary-codec/src/enums/xrpl-definitions-base.ts", "packages/xahau-binary-codec/src/enums/xahau-definitions-base.ts");
|
||||||
|
// await renameItem("packages/xahau-binary-codec/src/enums/xrpl-definitions.ts", "packages/xahau-binary-codec/src/enums/xahau-definitions.ts");
|
||||||
|
|
||||||
|
await replaceInIsomorphic("package.json");
|
||||||
|
await replaceInPackage("package.json");
|
||||||
|
// // Search and replace in specified folders
|
||||||
|
const folderList: string[] = ["packages"];
|
||||||
|
await searchAndReplaceInFolders(folderList);
|
||||||
|
|
||||||
|
// await replaceInUnique("UNIQUE_SETUPS.md");
|
||||||
|
|
||||||
|
// // Perform replacements in specific files
|
||||||
|
await replaceInConfig(".ci-config/xahaud.cfg");
|
||||||
|
await replaceInContrib("CONTRIBUTING.md");
|
||||||
|
// await replaceInGitHub(".github/workflows/integration_test.yml");
|
||||||
|
// await replaceInGitHub(".github/workflows/unit_test.yml");
|
||||||
|
// await replaceInGitHub(".pre-commit-config.yaml");
|
||||||
|
|
||||||
|
// // Uncomment and use if needed
|
||||||
|
// // await replaceInPoetry(
|
||||||
|
// // "pyproject.toml",
|
||||||
|
// // ["Denis Angell <denis@xrpl-labs.com>", "Tequ <tequ@xrplf.com>"],
|
||||||
|
// // );
|
||||||
|
|
||||||
|
// await replaceInReadme("README.md");
|
||||||
|
|
||||||
|
// // Delete a specific file
|
||||||
|
// await deleteFile(".github/workflows/snippet_test.yml");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the main function
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error(`Unexpected error: ${(error as Error).message}`);
|
||||||
|
});
|
||||||
9656
package-lock.json
generated
9656
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "xrpl.js",
|
"name": "xahau.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "lerna run analyze --stream",
|
"analyze": "lerna run analyze --stream",
|
||||||
@@ -16,16 +16,16 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xrplf/isomorphic": "file:packages/isomorphic",
|
"@xrplf/isomorphic": "file:packages/isomorphic",
|
||||||
"@xrplf/secret-numbers": "file:packages/secret-numbers",
|
"@xrplf/secret-numbers": "file:packages/secret-numbers",
|
||||||
"ripple-address-codec": "file:packages/ripple-address-codec",
|
"xahau-address-codec": "file:packages/xahau-address-codec",
|
||||||
"ripple-binary-codec": "file:packages/ripple-binary-codec",
|
"xahau-binary-codec": "file:packages/xahau-binary-codec",
|
||||||
"ripple-keypairs": "file:packages/ripple-keypairs",
|
"xahau-keypairs": "file:packages/xahau-keypairs",
|
||||||
"xrpl": "file:packages/xrpl"
|
"xahau": "file:packages/xahau"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.2.21",
|
"@types/chai": "^4.2.21",
|
||||||
"@types/jest": "^29.2.2",
|
"@types/jest": "^29.2.2",
|
||||||
"@types/lodash": "^4.14.136",
|
"@types/lodash": "^4.14.136",
|
||||||
"@types/node": "^16.18.38",
|
"@types/node": "^18.19.29",
|
||||||
"@types/ws": "^8.2.0",
|
"@types/ws": "^8.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
||||||
"@typescript-eslint/parser": "^5.28.0",
|
"@typescript-eslint/parser": "^5.28.0",
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"./packages/*"
|
"./packages/*"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0",
|
"node": ">=18.0.0",
|
||||||
"npm": ">=7.10.0 < 10.0.0"
|
"npm": ">=7.10.0 < 10.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# @xrplf/isomorphic Release History
|
# @xrplf/isomorphic Release History
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
## 1.0.1 (2024-06-03)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Throw error if `hexToBytes` or `hexToString` is provided a string that is not in hex
|
||||||
|
|
||||||
## 1.0.0 (2024-02-01)
|
## 1.0.0 (2024-02-01)
|
||||||
|
|
||||||
Initial release providing isomorphic and tree-shakable implementations of:
|
Initial release providing isomorphic and tree-shakable implementations of:
|
||||||
@@ -14,21 +22,3 @@ Initial release providing isomorphic and tree-shakable implementations of:
|
|||||||
* randomBytes
|
* randomBytes
|
||||||
* stringToHex
|
* stringToHex
|
||||||
* ws
|
* ws
|
||||||
|
|
||||||
## 1.0.0 Beta 1 (2023-11-30)
|
|
||||||
|
|
||||||
## Added
|
|
||||||
* hexToString
|
|
||||||
* stringToHex
|
|
||||||
|
|
||||||
## 1.0.0 Beta 0 (2023-10-19)
|
|
||||||
|
|
||||||
Initial release providing isomorphic and tree-shakable implementations of:
|
|
||||||
|
|
||||||
* ripemd160
|
|
||||||
* sha256
|
|
||||||
* sha512
|
|
||||||
* bytesToHash
|
|
||||||
* hashToBytes
|
|
||||||
* randomBytes
|
|
||||||
* ws_
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@xrplf/isomorphic",
|
"name": "@xrplf/isomorphic",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "A collection of isomorphic and tree-shakeable crypto hashes and utils for xrpl.js",
|
"description": "A collection of isomorphic and tree-shakeable crypto hashes and utils for xrpl.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"crypto",
|
"crypto",
|
||||||
"isomorphic",
|
"isomorphic",
|
||||||
"xrpl"
|
"xahau"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --build ./tsconfig.build.json",
|
"build": "tsc --build ./tsconfig.build.json",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"ws": "^8.13.0"
|
"ws": "^8.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.18.38",
|
"@types/node": "^18.18.38",
|
||||||
"@types/ws": "^8.5.6"
|
"@types/ws": "^8.5.6"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -43,6 +43,6 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=18.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
RandomBytesFn,
|
RandomBytesFn,
|
||||||
StringToHexFn,
|
StringToHexFn,
|
||||||
} from './types'
|
} from './types'
|
||||||
|
import { HEX_REGEX } from './shared'
|
||||||
|
|
||||||
/* eslint-disable func-style -- Typed to ensure uniformity between node and browser implementations and docs */
|
/* eslint-disable func-style -- Typed to ensure uniformity between node and browser implementations and docs */
|
||||||
export const bytesToHex: typeof BytesToHexFn = (bytes) => {
|
export const bytesToHex: typeof BytesToHexFn = (bytes) => {
|
||||||
@@ -22,6 +23,9 @@ export const bytesToHex: typeof BytesToHexFn = (bytes) => {
|
|||||||
export const hexToBytes: typeof HexToBytesFn = (hex): Uint8Array => {
|
export const hexToBytes: typeof HexToBytesFn = (hex): Uint8Array => {
|
||||||
const len = hex.length
|
const len = hex.length
|
||||||
const array = new Uint8Array(len / 2)
|
const array = new Uint8Array(len / 2)
|
||||||
|
if (!HEX_REGEX.test(hex)) {
|
||||||
|
throw new Error('Invalid hex string')
|
||||||
|
}
|
||||||
for (let i = 0; i < array.length; i++) {
|
for (let i = 0; i < array.length; i++) {
|
||||||
const j = i * 2
|
const j = i * 2
|
||||||
const hexByte = hex.slice(j, j + 2)
|
const hexByte = hex.slice(j, j + 2)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { randomBytes as cryptoRandomBytes } from 'crypto'
|
import { randomBytes as cryptoRandomBytes } from 'crypto'
|
||||||
import type { BytesToHexFn, HexToBytesFn, RandomBytesFn } from './types'
|
import type { BytesToHexFn, HexToBytesFn, RandomBytesFn } from './types'
|
||||||
import { HexToStringFn, StringToHexFn } from './types'
|
import { HexToStringFn, StringToHexFn } from './types'
|
||||||
|
import { HEX_REGEX } from './shared'
|
||||||
|
|
||||||
const OriginalBuffer = Symbol('OriginalBuffer')
|
const OriginalBuffer = Symbol('OriginalBuffer')
|
||||||
|
|
||||||
@@ -64,6 +65,9 @@ export const bytesToHex: typeof BytesToHexFn = (bytes) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const hexToBytes: typeof HexToBytesFn = (hex) => {
|
export const hexToBytes: typeof HexToBytesFn = (hex) => {
|
||||||
|
if (!HEX_REGEX.test(hex)) {
|
||||||
|
throw new Error('Invalid hex string')
|
||||||
|
}
|
||||||
return toUint8Array(Buffer.from(hex, 'hex'))
|
return toUint8Array(Buffer.from(hex, 'hex'))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +79,9 @@ export const hexToString: typeof HexToStringFn = (
|
|||||||
hex: string,
|
hex: string,
|
||||||
encoding = 'utf8',
|
encoding = 'utf8',
|
||||||
): string => {
|
): string => {
|
||||||
|
if (!HEX_REGEX.test(hex)) {
|
||||||
|
throw new Error('Invalid hex string')
|
||||||
|
}
|
||||||
return new TextDecoder(encoding).decode(hexToBytes(hex))
|
return new TextDecoder(encoding).decode(hexToBytes(hex))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { concatBytes } from '@noble/hashes/utils'
|
import { concatBytes } from '@noble/hashes/utils'
|
||||||
|
|
||||||
|
export const HEX_REGEX = /^[A-F0-9]*$/iu
|
||||||
|
|
||||||
export function concat(views: Uint8Array[]): Uint8Array {
|
export function concat(views: Uint8Array[]): Uint8Array {
|
||||||
return concatBytes(...views)
|
return concatBytes(...views)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,18 @@ describe('utils', function () {
|
|||||||
expect(hexToBytes('DEADBEEF')).toEqual(new Uint8Array([222, 173, 190, 239]))
|
expect(hexToBytes('DEADBEEF')).toEqual(new Uint8Array([222, 173, 190, 239]))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('hexToBytes - DEADBEEF', () => {
|
||||||
|
expect(hexToBytes('DEADBEEF')).toEqual(new Uint8Array([222, 173, 190, 239]))
|
||||||
|
})
|
||||||
|
|
||||||
it('bytesToHex - DEADBEEF', () => {
|
it('bytesToHex - DEADBEEF', () => {
|
||||||
expect(bytesToHex([222, 173, 190, 239])).toEqual('DEADBEEF')
|
expect(bytesToHex([222, 173, 190, 239])).toEqual('DEADBEEF')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('bytesToHex - bad hex', () => {
|
||||||
|
expect(() => hexToBytes('hello')).toThrow(new Error('Invalid hex string'))
|
||||||
|
})
|
||||||
|
|
||||||
it('bytesToHex - 010203', () => {
|
it('bytesToHex - 010203', () => {
|
||||||
expect(bytesToHex([1, 2, 3])).toEqual('010203')
|
expect(bytesToHex([1, 2, 3])).toEqual('010203')
|
||||||
})
|
})
|
||||||
@@ -43,6 +51,10 @@ describe('utils', function () {
|
|||||||
expect(hexToString('6465616462656566D68D')).toEqual('deadbeef֍')
|
expect(hexToString('6465616462656566D68D')).toEqual('deadbeef֍')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('hexToString - bad hex', () => {
|
||||||
|
expect(() => hexToString('hello')).toThrow(new Error('Invalid hex string'))
|
||||||
|
})
|
||||||
|
|
||||||
it('stringToHex - deadbeef+infinity symbol (utf8)', () => {
|
it('stringToHex - deadbeef+infinity symbol (utf8)', () => {
|
||||||
expect(stringToHex('deadbeef֍')).toEqual('6465616462656566D68D')
|
expect(stringToHex('deadbeef֍')).toEqual('6465616462656566D68D')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,24 +19,3 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
|
|||||||
* Unit tests run in a browser and node.
|
* Unit tests run in a browser and node.
|
||||||
* Remove `brorand` as a dependency and use `@xrplf/isomorphic` instead.
|
* Remove `brorand` as a dependency and use `@xrplf/isomorphic` instead.
|
||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
||||||
|
|
||||||
## 1.0.0 Beta 1 (2023-11-30)
|
|
||||||
|
|
||||||
### BREAKING CHANGES:
|
|
||||||
* Moved all methods that were on `Utils` are now individually exported.
|
|
||||||
* `Buffer` has been replaced with `UInt8Array` for both params and return values. `Buffer` may continue to work with params since they extend `UInt8Arrays`.
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
|
||||||
|
|
||||||
## 1.0.0 Beta 0 (2023-10-19)
|
|
||||||
|
|
||||||
* Add `xrpl-secret-numbers` by @WietseWind to the mono repo.
|
|
||||||
* `unpkg` and `jsdelivr` support was simplified.
|
|
||||||
* Unit tests run in a browser and node.
|
|
||||||
* Remove `brorand` as a dependency and use `@xrplf/isomorphic` instead.
|
|
||||||
|
|
||||||
### BREAKING CHANGES:
|
|
||||||
* `xrpl-secret-numbers` is now `@xrplf/secret-numbers`.
|
|
||||||
* The bundled file produced changed from `dist/browerified.js` to `build/xrplf-secret-numbers-latest.js`.
|
|
||||||
* Bundle variable is `xrplf_secret_numbers` instead of using browserify's loader.
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xrplf/isomorphic": "^1.0.0",
|
"@xrplf/isomorphic": "^1.0.0",
|
||||||
"ripple-keypairs": "^2.0.0"
|
"xahau-keypairs": "^2.0.0"
|
||||||
},
|
},
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"xrp",
|
"xah",
|
||||||
"xrpl-ledger",
|
"xahau-ledger",
|
||||||
"multi sign",
|
"multi sign",
|
||||||
"sign"
|
"sign"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { deriveAddress, deriveKeypair, generateSeed } from 'ripple-keypairs'
|
import { deriveAddress, deriveKeypair, generateSeed } from 'xahau-keypairs'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
entropyToSecret,
|
entropyToSecret,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { hexToBytes } from '@xrplf/isomorphic/utils'
|
import { hexToBytes } from '@xrplf/isomorphic/utils'
|
||||||
import { deriveAddress, deriveKeypair, generateSeed } from 'ripple-keypairs'
|
import { deriveAddress, deriveKeypair, generateSeed } from 'xahau-keypairs'
|
||||||
|
|
||||||
import { Account, secretToEntropy } from '../src'
|
import { Account, secretToEntropy } from '../src'
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"include": ["./src/**/*.ts", "./src/**/*.json"],
|
"include": ["./src/**/*.ts", "./src/**/*.json"],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"path": "../ripple-keypairs/tsconfig.json"
|
"path": "../xahau-keypairs/tsconfig.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,25 +15,6 @@
|
|||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
||||||
* Execute test in a browser in addition to node
|
* Execute test in a browser in addition to node
|
||||||
|
|
||||||
## 5.0.0 Beta 1 (2023-11-30)
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
* `Buffer` has been replaced with `UInt8Array` for both params and return values. `Buffer` may continue to work with params since they extend `UInt8Arrays`.
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
|
||||||
|
|
||||||
## 5.0.0 Beta 0 (2023-10-19)
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
* Bump typescript to 5.x
|
|
||||||
* Remove Node 14 support
|
|
||||||
* Remove `assert` dependency. If you were catching `AssertionError` you need to change to `Error`.
|
|
||||||
* Remove `create-hash` in favor of `@noble/hashes`
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
* Execute test in a browser in addition to node
|
|
||||||
|
|
||||||
## 4.3.1 (2023-09-27)
|
## 4.3.1 (2023-09-27)
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fix source-maps not finding their designated source
|
* Fix source-maps not finding their designated source
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-address-codec",
|
"name": "xahau-address-codec",
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"description": "encodes/decodes base58 encoded XRP Ledger identifiers",
|
"description": "encodes/decodes base58 encoded XRP Ledger identifiers",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -14,10 +14,10 @@
|
|||||||
"@xrplf/isomorphic": "^1.0.0"
|
"@xrplf/isomorphic": "^1.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ripple",
|
"xahau",
|
||||||
"xrp",
|
"xah",
|
||||||
"xrp ledger",
|
"xahau ledger",
|
||||||
"xrpl"
|
"xahau"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,6 +34,6 @@
|
|||||||
},
|
},
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16"
|
"node": ">= 18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
encodeAccountPublic,
|
encodeAccountPublic,
|
||||||
decodeAccountPublic,
|
decodeAccountPublic,
|
||||||
isValidClassicAddress,
|
isValidClassicAddress,
|
||||||
} from './xrp-codec'
|
} from './xah-codec'
|
||||||
|
|
||||||
const PREFIX_BYTES = {
|
const PREFIX_BYTES = {
|
||||||
// 5, 68
|
// 5, 68
|
||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 2.1.0 (2024-06-03)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Support for the Price Oracles amendment (XLS-47).
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Better error handling/error messages for serialization/deserialization errors.
|
||||||
|
|
||||||
## 2.0.0 (2024-02-01)
|
## 2.0.0 (2024-02-01)
|
||||||
|
|
||||||
### BREAKING CHANGES
|
### BREAKING CHANGES
|
||||||
@@ -19,23 +27,6 @@
|
|||||||
* `Comparable` is now a generic type so that it allows `compareTo` methods to take more that the type itself.
|
* `Comparable` is now a generic type so that it allows `compareTo` methods to take more that the type itself.
|
||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
||||||
|
|
||||||
## 2.0.0 Beta 1 (2023-11-30)
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
* `Buffer` has been replaced with `UInt8Array` for both params and return values. `Buffer` may continue to work with params since they extend `UInt8Arrays`.
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
* Eliminates 4 runtime dependencies: `base-x`, `base64-js`, `buffer`, and `ieee754`.
|
|
||||||
|
|
||||||
## 2.0.0 Beta 0 (2023-10-19)
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
* Bump typescript to 5.x
|
|
||||||
* Remove Node 14 support
|
|
||||||
* Remove decimal.js and big-integer. Use `BigNumber` from `bignumber.js` instead of `Decimal` and the native `BigInt` instead of `bigInt`.
|
|
||||||
* Remove `assert` dependency. If you were catching `AssertionError` you need to change to `Error`.
|
|
||||||
* Remove `create-hash` in favor of `@noble/hashes`
|
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
* Update type definitions which causing errors in tests that the code already supported
|
* Update type definitions which causing errors in tests that the code already supported
|
||||||
* `makeParser` to accept a `Buffer` in addition to `string`
|
* `makeParser` to accept a `Buffer` in addition to `string`
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-binary-codec",
|
"name": "xahau-binary-codec",
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
"description": "XRP Ledger binary codec",
|
"description": "XRP Ledger binary codec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
@@ -11,9 +11,9 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xrplf/isomorphic": "^1.0.0",
|
"@xrplf/isomorphic": "^1.0.1",
|
||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
"ripple-address-codec": "^5.0.0"
|
"xahau-address-codec": "^5.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --build tsconfig.build.json && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
"build": "tsc --build tsconfig.build.json && copyfiles ./src/enums/definitions.json ./dist/enums/",
|
||||||
@@ -24,10 +24,10 @@
|
|||||||
"lint": "eslint . --ext .ts --ext .test.js"
|
"lint": "eslint . --ext .ts --ext .test.js"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ripple",
|
"xahau",
|
||||||
"xrp",
|
"xah",
|
||||||
"xrp ledger",
|
"xahau ledger",
|
||||||
"xrpl"
|
"xahau"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -41,6 +41,6 @@
|
|||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"prettier": "@xrplf/prettier-config",
|
"prettier": "@xrplf/prettier-config",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16"
|
"node": ">= 18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"UInt512": 23,
|
"UInt512": 23,
|
||||||
"Issue": 24,
|
"Issue": 24,
|
||||||
"XChainBridge": 25,
|
"XChainBridge": 25,
|
||||||
|
"Currency": 26,
|
||||||
"Transaction": 10001,
|
"Transaction": 10001,
|
||||||
"LedgerEntry": 10002,
|
"LedgerEntry": 10002,
|
||||||
"Validation": 10003,
|
"Validation": 10003,
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
"NFTokenOffer": 55,
|
"NFTokenOffer": 55,
|
||||||
"AMM": 121,
|
"AMM": 121,
|
||||||
"DID": 73,
|
"DID": 73,
|
||||||
|
"Oracle": 128,
|
||||||
"Any": -3,
|
"Any": -3,
|
||||||
"Child": -2,
|
"Child": -2,
|
||||||
"Nickname": 110,
|
"Nickname": 110,
|
||||||
@@ -208,6 +210,16 @@
|
|||||||
"type": "UInt8"
|
"type": "UInt8"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"Scale",
|
||||||
|
{
|
||||||
|
"nth": 4,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "UInt8"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"TickSize",
|
"TickSize",
|
||||||
{
|
{
|
||||||
@@ -498,6 +510,16 @@
|
|||||||
"type": "UInt32"
|
"type": "UInt32"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"LastUpdateTime",
|
||||||
|
{
|
||||||
|
"nth": 15,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "UInt32"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"HighQualityIn",
|
"HighQualityIn",
|
||||||
{
|
{
|
||||||
@@ -828,6 +850,16 @@
|
|||||||
"type": "UInt32"
|
"type": "UInt32"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"OracleDocumentID",
|
||||||
|
{
|
||||||
|
"nth": 51,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "UInt32"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"IndexNext",
|
"IndexNext",
|
||||||
{
|
{
|
||||||
@@ -1028,6 +1060,16 @@
|
|||||||
"type": "UInt64"
|
"type": "UInt64"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"AssetPrice",
|
||||||
|
{
|
||||||
|
"nth": 23,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "UInt64"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"EmailHash",
|
"EmailHash",
|
||||||
{
|
{
|
||||||
@@ -1918,6 +1960,26 @@
|
|||||||
"type": "Blob"
|
"type": "Blob"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"AssetClass",
|
||||||
|
{
|
||||||
|
"nth": 28,
|
||||||
|
"isVLEncoded": true,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "Blob"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Provider",
|
||||||
|
{
|
||||||
|
"nth": 29,
|
||||||
|
"isVLEncoded": true,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "Blob"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"Account",
|
"Account",
|
||||||
{
|
{
|
||||||
@@ -2128,6 +2190,26 @@
|
|||||||
"type": "PathSet"
|
"type": "PathSet"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"BaseAsset",
|
||||||
|
{
|
||||||
|
"nth": 1,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "Currency"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"QuoteAsset",
|
||||||
|
{
|
||||||
|
"nth": 2,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "Currency"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"LockingChainIssue",
|
"LockingChainIssue",
|
||||||
{
|
{
|
||||||
@@ -2458,6 +2540,16 @@
|
|||||||
"type": "STObject"
|
"type": "STObject"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"PriceData",
|
||||||
|
{
|
||||||
|
"nth": 32,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "STObject"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"Signers",
|
"Signers",
|
||||||
{
|
{
|
||||||
@@ -2628,6 +2720,16 @@
|
|||||||
"type": "STArray"
|
"type": "STArray"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"PriceDataSeries",
|
||||||
|
{
|
||||||
|
"nth": 24,
|
||||||
|
"isVLEncoded": false,
|
||||||
|
"isSerialized": true,
|
||||||
|
"isSigningField": true,
|
||||||
|
"type": "STArray"
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"AuthAccounts",
|
"AuthAccounts",
|
||||||
{
|
{
|
||||||
@@ -2656,6 +2758,7 @@
|
|||||||
"telWRONG_NETWORK": -386,
|
"telWRONG_NETWORK": -386,
|
||||||
"telREQUIRES_NETWORK_ID": -385,
|
"telREQUIRES_NETWORK_ID": -385,
|
||||||
"telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
|
"telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
|
||||||
|
"telENV_RPC_FAILED": -383,
|
||||||
|
|
||||||
"temMALFORMED": -299,
|
"temMALFORMED": -299,
|
||||||
"temBAD_AMOUNT": -298,
|
"temBAD_AMOUNT": -298,
|
||||||
@@ -2703,6 +2806,8 @@
|
|||||||
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
|
||||||
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
||||||
"temEMPTY_DID": -254,
|
"temEMPTY_DID": -254,
|
||||||
|
"temARRAY_EMPTY": -253,
|
||||||
|
"temARRAY_TOO_LARGE": -252,
|
||||||
|
|
||||||
"tefFAILURE": -199,
|
"tefFAILURE": -199,
|
||||||
"tefALREADY": -198,
|
"tefALREADY": -198,
|
||||||
@@ -2739,7 +2844,6 @@
|
|||||||
"terQUEUED": -89,
|
"terQUEUED": -89,
|
||||||
"terPRE_TICKET": -88,
|
"terPRE_TICKET": -88,
|
||||||
"terNO_AMM": -87,
|
"terNO_AMM": -87,
|
||||||
"terSUBMITTED": -86,
|
|
||||||
|
|
||||||
"tesSUCCESS": 0,
|
"tesSUCCESS": 0,
|
||||||
|
|
||||||
@@ -2815,7 +2919,11 @@
|
|||||||
"tecXCHAIN_SELF_COMMIT": 184,
|
"tecXCHAIN_SELF_COMMIT": 184,
|
||||||
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
|
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
|
||||||
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186,
|
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186,
|
||||||
"tecEMPTY_DID": 187
|
"tecEMPTY_DID": 187,
|
||||||
|
"tecINVALID_UPDATE_TIME": 188,
|
||||||
|
"tecTOKEN_PAIR_NOT_FOUND": 189,
|
||||||
|
"tecARRAY_EMPTY": 190,
|
||||||
|
"tecARRAY_TOO_LARGE": 191
|
||||||
},
|
},
|
||||||
"TRANSACTION_TYPES": {
|
"TRANSACTION_TYPES": {
|
||||||
"Invalid": -1,
|
"Invalid": -1,
|
||||||
@@ -2864,6 +2972,8 @@
|
|||||||
"XChainCreateBridge": 48,
|
"XChainCreateBridge": 48,
|
||||||
"DIDSet": 49,
|
"DIDSet": 49,
|
||||||
"DIDDelete": 50,
|
"DIDDelete": 50,
|
||||||
|
"OracleSet": 51,
|
||||||
|
"OracleDelete": 52,
|
||||||
"EnableAmendment": 100,
|
"EnableAmendment": 100,
|
||||||
"SetFee": 101,
|
"SetFee": 101,
|
||||||
"UNLModify": 102
|
"UNLModify": 102
|
||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
XrplDefinitionsBase,
|
XrplDefinitionsBase,
|
||||||
FieldInstance,
|
FieldInstance,
|
||||||
Bytes,
|
Bytes,
|
||||||
} from './xrpl-definitions-base'
|
} from './xahau-definitions-base'
|
||||||
/**
|
/**
|
||||||
* By default, coreTypes from the `types` folder is where known type definitions are initialized to avoid import cycles.
|
* By default, coreTypes from the `types` folder is where known type definitions are initialized to avoid import cycles.
|
||||||
*/
|
*/
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
type DefinitionsData,
|
type DefinitionsData,
|
||||||
XrplDefinitionsBase,
|
XrplDefinitionsBase,
|
||||||
} from './xrpl-definitions-base'
|
} from './xahau-definitions-base'
|
||||||
import { coreTypes } from '../types'
|
import { coreTypes } from '../types'
|
||||||
import { SerializedType } from '../types/serialized-type'
|
import { SerializedType } from '../types/serialized-type'
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
TRANSACTION_TYPES,
|
TRANSACTION_TYPES,
|
||||||
DEFAULT_DEFINITIONS,
|
DEFAULT_DEFINITIONS,
|
||||||
} from './enums'
|
} from './enums'
|
||||||
import { XrplDefinitions } from './enums/xrpl-definitions'
|
import { XrplDefinitions } from './enums/xahau-definitions'
|
||||||
import { coreTypes } from './types'
|
import { coreTypes } from './types'
|
||||||
import { bytesToHex } from '@xrplf/isomorphic/utils'
|
import { bytesToHex } from '@xrplf/isomorphic/utils'
|
||||||
|
|
||||||
@@ -144,14 +144,18 @@ class BinaryParser {
|
|||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
type = this.readUInt8()
|
type = this.readUInt8()
|
||||||
if (type === 0 || type < 16) {
|
if (type === 0 || type < 16) {
|
||||||
throw new Error('Cannot read FieldOrdinal, type_code out of range')
|
throw new Error(
|
||||||
|
`Cannot read FieldOrdinal, type_code ${type} out of range`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nth === 0) {
|
if (nth === 0) {
|
||||||
nth = this.readUInt8()
|
nth = this.readUInt8()
|
||||||
if (nth === 0 || nth < 16) {
|
if (nth === 0 || nth < 16) {
|
||||||
throw new Error('Cannot read FieldOrdinal, field_code out of range')
|
throw new Error(
|
||||||
|
`Cannot read FieldOrdinal, field_code ${nth} out of range`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
encodeAccountID,
|
encodeAccountID,
|
||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
xAddressToClassicAddress,
|
xAddressToClassicAddress,
|
||||||
} from 'ripple-address-codec'
|
} from 'xahau-address-codec'
|
||||||
import { Hash160 } from './hash-160'
|
import { Hash160 } from './hash-160'
|
||||||
import { hexToBytes } from '@xrplf/isomorphic/utils'
|
import { hexToBytes } from '@xrplf/isomorphic/utils'
|
||||||
|
|
||||||
@@ -33,6 +33,9 @@ class Blob extends SerializedType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
|
if (!/^[A-F0-9]*$/iu.test(value)) {
|
||||||
|
throw new Error('Cannot construct Blob from a non-hex string')
|
||||||
|
}
|
||||||
return new Blob(hexToBytes(value))
|
return new Blob(hexToBytes(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ const STANDARD_FORMAT_HEX_REGEX = /^0{24}[\x00-\x7F]{6}0{10}$/
|
|||||||
*/
|
*/
|
||||||
function isoToBytes(iso: string): Uint8Array {
|
function isoToBytes(iso: string): Uint8Array {
|
||||||
const bytes = new Uint8Array(20)
|
const bytes = new Uint8Array(20)
|
||||||
if (iso !== 'XRP') {
|
if (iso !== 'XAH') {
|
||||||
const isoBytes = iso.split('').map((c) => c.charCodeAt(0))
|
const isoBytes = iso.split('').map((c) => c.charCodeAt(0))
|
||||||
bytes.set(isoBytes, 12)
|
bytes.set(isoBytes, 12)
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ function isIsoCode(iso: string): boolean {
|
|||||||
|
|
||||||
function isoCodeFromHex(code: Uint8Array): string | null {
|
function isoCodeFromHex(code: Uint8Array): string | null {
|
||||||
const iso = hexToString(bytesToHex(code))
|
const iso = hexToString(bytesToHex(code))
|
||||||
if (iso === 'XRP') {
|
if (iso === 'XAH') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (isIsoCode(iso)) {
|
if (isIsoCode(iso)) {
|
||||||
@@ -89,7 +89,7 @@ class Currency extends Hash160 {
|
|||||||
const hex = bytesToHex(this.bytes)
|
const hex = bytesToHex(this.bytes)
|
||||||
|
|
||||||
if (XRP_HEX_REGEX.test(hex)) {
|
if (XRP_HEX_REGEX.test(hex)) {
|
||||||
this._iso = 'XRP'
|
this._iso = 'XAH'
|
||||||
} else if (STANDARD_FORMAT_HEX_REGEX.test(hex)) {
|
} else if (STANDARD_FORMAT_HEX_REGEX.test(hex)) {
|
||||||
this._iso = isoCodeFromHex(this.bytes.slice(12, 15))
|
this._iso = isoCodeFromHex(this.bytes.slice(12, 15))
|
||||||
} else {
|
} else {
|
||||||
@@ -66,7 +66,7 @@ class Issue extends SerializedType {
|
|||||||
*/
|
*/
|
||||||
static fromParser(parser: BinaryParser): Issue {
|
static fromParser(parser: BinaryParser): Issue {
|
||||||
const currency = parser.read(20)
|
const currency = parser.read(20)
|
||||||
if (new Currency(currency).toJSON() === 'XRP') {
|
if (new Currency(currency).toJSON() === 'XAH') {
|
||||||
return new Issue(currency)
|
return new Issue(currency)
|
||||||
}
|
}
|
||||||
const currencyAndIssuer = [currency, parser.read(20)]
|
const currencyAndIssuer = [currency, parser.read(20)]
|
||||||
@@ -81,7 +81,7 @@ class Issue extends SerializedType {
|
|||||||
toJSON(): IssueObject {
|
toJSON(): IssueObject {
|
||||||
const parser = new BinaryParser(this.toString())
|
const parser = new BinaryParser(this.toString())
|
||||||
const currency = Currency.fromParser(parser) as Currency
|
const currency = Currency.fromParser(parser) as Currency
|
||||||
if (currency.toJSON() === 'XRP') {
|
if (currency.toJSON() === 'XAH') {
|
||||||
return { currency: currency.toJSON() }
|
return { currency: currency.toJSON() }
|
||||||
}
|
}
|
||||||
const issuer = AccountID.fromParser(parser) as AccountID
|
const issuer = AccountID.fromParser(parser) as AccountID
|
||||||
@@ -14,7 +14,13 @@ const OBJECT_END_MARKER = Uint8Array.from([0xe1])
|
|||||||
*/
|
*/
|
||||||
function isObjects(args): args is Array<JsonObject> {
|
function isObjects(args): args is Array<JsonObject> {
|
||||||
return (
|
return (
|
||||||
Array.isArray(args) && (args.length === 0 || typeof args[0] === 'object')
|
Array.isArray(args) &&
|
||||||
|
args.every(
|
||||||
|
(arg) =>
|
||||||
|
typeof arg === 'object' &&
|
||||||
|
Object.keys(arg).length === 1 &&
|
||||||
|
typeof Object.values(arg)[0] === 'object',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
XrplDefinitionsBase,
|
XrplDefinitionsBase,
|
||||||
} from '../enums'
|
} from '../enums'
|
||||||
import { SerializedType, JsonObject } from './serialized-type'
|
import { SerializedType, JsonObject } from './serialized-type'
|
||||||
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
import { xAddressToClassicAddress, isValidXAddress } from 'xahau-address-codec'
|
||||||
import { BinaryParser } from '../serdes/binary-parser'
|
import { BinaryParser } from '../serdes/binary-parser'
|
||||||
import { BinarySerializer, BytesList } from '../serdes/binary-serializer'
|
import { BinarySerializer, BytesList } from '../serdes/binary-serializer'
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import fixtures from './fixtures/codec-fixtures.json'
|
import fixtures from './fixtures/codec-fixtures.json'
|
||||||
import { decode, encode, decodeLedgerData } from '../src'
|
// import { decode, encode, decodeLedgerData } from '../src'
|
||||||
|
import { decode, encode } from '../src'
|
||||||
|
|
||||||
function json(object) {
|
function json(object) {
|
||||||
return JSON.stringify(object)
|
return JSON.stringify(object)
|
||||||
@@ -30,16 +31,17 @@ describe('ripple-binary-codec', function () {
|
|||||||
makeSuite('transactions', fixtures.transactions)
|
makeSuite('transactions', fixtures.transactions)
|
||||||
makeSuite('accountState', fixtures.accountState)
|
makeSuite('accountState', fixtures.accountState)
|
||||||
|
|
||||||
describe('ledgerData', function () {
|
// describe('ledgerData', function () {
|
||||||
if (fixtures.ledgerData) {
|
// console.log(fixtures)
|
||||||
fixtures.ledgerData.forEach((t, testN) => {
|
// if (fixtures.ledgerData) {
|
||||||
it(`ledgerData[${testN}] can decode ${t.binary} to ${json(
|
// fixtures.ledgerData.forEach((t, testN) => {
|
||||||
t.json,
|
// it(`ledgerData[${testN}] can decode ${t.binary} to ${json(
|
||||||
)}`, () => {
|
// t.json,
|
||||||
const decoded = decodeLedgerData(t.binary)
|
// )}`, () => {
|
||||||
expect(t.json).toEqual(decoded)
|
// const decoded = decodeLedgerData(t.binary)
|
||||||
})
|
// expect(t.json).toEqual(decoded)
|
||||||
})
|
// })
|
||||||
}
|
// })
|
||||||
})
|
// }
|
||||||
|
// })
|
||||||
})
|
})
|
||||||
@@ -2,7 +2,7 @@ import { hexOnly } from './utils'
|
|||||||
import { coreTypes, Amount, Hash160 } from '../src/types'
|
import { coreTypes, Amount, Hash160 } from '../src/types'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
|
|
||||||
import { encodeAccountID } from 'ripple-address-codec'
|
import { encodeAccountID } from 'xahau-address-codec'
|
||||||
import { Field, TransactionType } from '../src/enums'
|
import { Field, TransactionType } from '../src/enums'
|
||||||
import { makeParser, readJSON } from '../src/binary'
|
import { makeParser, readJSON } from '../src/binary'
|
||||||
import { BytesList } from '../src/serdes/binary-serializer'
|
import { BytesList } from '../src/serdes/binary-serializer'
|
||||||
@@ -238,19 +238,19 @@ function fieldParsingTests() {
|
|||||||
it('Field throws when type code out of range', () => {
|
it('Field throws when type code out of range', () => {
|
||||||
const parser = makeParser('0101')
|
const parser = makeParser('0101')
|
||||||
expect(() => parser.readField()).toThrow(
|
expect(() => parser.readField()).toThrow(
|
||||||
new Error('Cannot read FieldOrdinal, type_code out of range'),
|
new Error('Cannot read FieldOrdinal, type_code 1 out of range'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('Field throws when field code out of range', () => {
|
it('Field throws when field code out of range', () => {
|
||||||
const parser = makeParser('1001')
|
const parser = makeParser('1001')
|
||||||
expect(() => parser.readFieldOrdinal()).toThrow(
|
expect(() => parser.readFieldOrdinal()).toThrow(
|
||||||
new Error('Cannot read FieldOrdinal, field_code out of range'),
|
new Error('Cannot read FieldOrdinal, field_code 1 out of range'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('Field throws when both type and field code out of range', () => {
|
it('Field throws when both type and field code out of range', () => {
|
||||||
const parser = makeParser('000101')
|
const parser = makeParser('000101')
|
||||||
expect(() => parser.readFieldOrdinal()).toThrow(
|
expect(() => parser.readFieldOrdinal()).toThrow(
|
||||||
new Error('Cannot read FieldOrdinal, type_code out of range'),
|
new Error('Cannot read FieldOrdinal, type_code 1 out of range'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('readUIntN', () => {
|
it('readUIntN', () => {
|
||||||
@@ -387,7 +387,7 @@ function pathSetBinaryTests() {
|
|||||||
currency: 'BTC',
|
currency: 'BTC',
|
||||||
issuer: 'r3AWbdp2jQLXLywJypdoNwVSvr81xs3uhn',
|
issuer: 'r3AWbdp2jQLXLywJypdoNwVSvr81xs3uhn',
|
||||||
},
|
},
|
||||||
{ currency: 'XRP' },
|
{ currency: 'XAH' },
|
||||||
{
|
{
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user