@bithomp/xrpl-api 3.0.8 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base58.d.ts +0 -1
- package/lib/base58.js +2 -3
- package/lib/client.js +6 -6
- package/lib/common/utils.js +9 -10
- package/lib/connection.d.ts +0 -1
- package/lib/faucet.js +5 -5
- package/lib/ledger/account_info.js +3 -4
- package/lib/ledger/account_lines.js +1 -2
- package/lib/ledger/account_namespace.js +1 -2
- package/lib/ledger/account_nfts.js +4 -5
- package/lib/ledger/account_objects.js +5 -6
- package/lib/ledger/account_offers.js +2 -3
- package/lib/ledger/account_tx.js +2 -3
- package/lib/ledger/amm_info.js +2 -3
- package/lib/ledger/book_offers.js +2 -3
- package/lib/ledger/currency.js +1 -2
- package/lib/ledger/fee.js +1 -2
- package/lib/ledger/gateway_balances.js +2 -3
- package/lib/ledger/ledger.js +2 -3
- package/lib/ledger/ledger_entry.js +4 -4
- package/lib/ledger/manifest.js +1 -2
- package/lib/ledger/nft_info.js +1 -2
- package/lib/ledger/server_definitions.js +1 -2
- package/lib/ledger/server_info.js +1 -2
- package/lib/ledger/transaction.js +6 -7
- package/lib/ledger/vl-v2.js +2 -3
- package/lib/ledger/vl.js +3 -4
- package/lib/models/account_info.js +5 -5
- package/lib/models/account_nfts.js +4 -5
- package/lib/models/account_object.js +3 -4
- package/lib/models/book_offers.js +1 -2
- package/lib/models/ledger.js +5 -5
- package/lib/models/manifest.d.ts +0 -1
- package/lib/models/manifest.js +3 -4
- package/lib/models/transaction.js +10 -11
- package/lib/models/vl.js +4 -5
- package/lib/parse/ledger/account-order.js +1 -2
- package/lib/parse/ledger/account.js +1 -2
- package/lib/parse/ledger/emit_details.js +1 -2
- package/lib/parse/ledger/flags.js +1 -2
- package/lib/parse/ledger/genesis-mints.d.ts +2 -0
- package/lib/parse/ledger/genesis-mints.js +17 -0
- package/lib/parse/ledger/import.js +1 -2
- package/lib/parse/ledger/ledger.js +1 -2
- package/lib/parse/ledger/memos.js +2 -3
- package/lib/parse/ledger/orderbook-order.js +1 -2
- package/lib/parse/outcome/affected_objects.js +1 -2
- package/lib/parse/outcome/amm_changes.js +1 -2
- package/lib/parse/outcome/balance_changes.js +2 -3
- package/lib/parse/outcome/channel_changes.js +1 -2
- package/lib/parse/outcome/emitted_txns.js +1 -2
- package/lib/parse/outcome/escrow_changes.js +1 -2
- package/lib/parse/outcome/hooks_executions.js +1 -2
- package/lib/parse/outcome/locked_balance_changes.js +2 -3
- package/lib/parse/outcome/nftoken_changes.js +1 -2
- package/lib/parse/outcome/nftoken_offer_changes.js +1 -2
- package/lib/parse/outcome/orderbook_changes.js +1 -2
- package/lib/parse/outcome/orderbook_quality.js +1 -2
- package/lib/parse/outcome/unl_report_changes.js +1 -2
- package/lib/parse/outcome/uritoken_changes.js +1 -2
- package/lib/parse/outcome/uritoken_sell_offer_changes.js +1 -2
- package/lib/parse/outcome.js +1 -2
- package/lib/parse/specification/account-delete.js +2 -0
- package/lib/parse/specification/amendment.js +27 -0
- package/lib/parse/specification/amm-bid.js +3 -1
- package/lib/parse/specification/amm-create.js +3 -1
- package/lib/parse/specification/amm-delete.js +3 -1
- package/lib/parse/specification/amm-deposit.js +3 -1
- package/lib/parse/specification/amm-vote.js +3 -1
- package/lib/parse/specification/amm-withdraw.js +3 -1
- package/lib/parse/specification/check-cancel.js +3 -1
- package/lib/parse/specification/check-cash.js +3 -1
- package/lib/parse/specification/check-create.js +3 -1
- package/lib/parse/specification/clawback.js +3 -1
- package/lib/parse/specification/deposit-preauth.js +3 -1
- package/lib/parse/specification/escrow-cancel.js +2 -0
- package/lib/parse/specification/escrow-create.js +2 -0
- package/lib/parse/specification/escrow-finish.js +2 -0
- package/lib/parse/specification/fee-update.js +3 -1
- package/lib/parse/specification/genesis-mint.d.ts +3 -0
- package/lib/parse/specification/genesis-mint.js +39 -0
- package/lib/parse/specification/import.js +2 -0
- package/lib/parse/specification/invoke.js +2 -0
- package/lib/parse/specification/nftoken-accept-offer.js +2 -0
- package/lib/parse/specification/nftoken-burn.js +2 -0
- package/lib/parse/specification/nftoken-cancel-offer.js +2 -0
- package/lib/parse/specification/nftoken-create-offer.js +2 -0
- package/lib/parse/specification/nftoken-mint.js +2 -0
- package/lib/parse/specification/offer-cancel.js +3 -1
- package/lib/parse/specification/offer-create.js +3 -1
- package/lib/parse/specification/payment-channel-claim.js +3 -1
- package/lib/parse/specification/payment-channel-create.js +3 -1
- package/lib/parse/specification/payment-channel-fund.js +3 -1
- package/lib/parse/specification/payment.js +3 -1
- package/lib/parse/specification/remit.js +2 -0
- package/lib/parse/specification/settings.js +2 -0
- package/lib/parse/specification/ticket-create.js +3 -1
- package/lib/parse/specification/trustline.js +3 -1
- package/lib/parse/specification/unl-report.js +2 -0
- package/lib/parse/specification/uritoken-burn.js +2 -0
- package/lib/parse/specification/uritoken-buy.js +2 -0
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -0
- package/lib/parse/specification/uritoken-create-sell-offer.js +2 -0
- package/lib/parse/specification/uritoken-mint.js +2 -3
- package/lib/parse/transaction.d.ts +2 -1
- package/lib/parse/transaction.js +5 -3
- package/lib/parse/utils.d.ts +0 -1
- package/lib/parse/utils.js +12 -13
- package/lib/types/genesis_mint.d.ts +9 -0
- package/lib/types/genesis_mint.js +2 -0
- package/lib/types/specification.d.ts +2 -0
- package/lib/v1/transaction/payment.js +1 -2
- package/lib/v1/utils.js +2 -3
- package/lib/validator.d.ts +0 -1
- package/lib/validator.js +5 -6
- package/lib/wallet.d.ts +0 -1
- package/lib/wallet.js +9 -9
- package/package.json +8 -8
package/lib/wallet.js
CHANGED
|
@@ -26,7 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.DEFAULT_DEFINITIONS = exports.XrplDefinitions = exports.XrplDefinitionsBase = void 0;
|
|
30
|
+
exports.isValidSecret = isValidSecret;
|
|
31
|
+
exports.walletFromSeed = walletFromSeed;
|
|
32
|
+
exports.generateAddress = generateAddress;
|
|
33
|
+
exports.isValidClassicAddress = isValidClassicAddress;
|
|
34
|
+
exports.checksumClassicAddress = checksumClassicAddress;
|
|
35
|
+
exports.signTransaction = signTransaction;
|
|
36
|
+
exports.verifyTransaction = verifyTransaction;
|
|
37
|
+
exports.hashSignedTx = hashSignedTx;
|
|
30
38
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
31
39
|
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
32
40
|
const Crypto = __importStar(require("crypto"));
|
|
@@ -52,7 +60,6 @@ function isValidSecret(secret) {
|
|
|
52
60
|
}
|
|
53
61
|
return false;
|
|
54
62
|
}
|
|
55
|
-
exports.isValidSecret = isValidSecret;
|
|
56
63
|
function walletFromSeed(seed, options) {
|
|
57
64
|
options = { ignoreSeedPayload: false, ...options };
|
|
58
65
|
let algorithm = options.algorithm;
|
|
@@ -77,13 +84,11 @@ function walletFromSeed(seed, options) {
|
|
|
77
84
|
const wallet = xrpl_1.Wallet.fromSeed(seed, { algorithm, masterAddress: options.masterAddress });
|
|
78
85
|
return wallet;
|
|
79
86
|
}
|
|
80
|
-
exports.walletFromSeed = walletFromSeed;
|
|
81
87
|
function generateAddress() {
|
|
82
88
|
const wallet = xrpl_1.Wallet.generate();
|
|
83
89
|
const { publicKey, privateKey, classicAddress, seed } = wallet;
|
|
84
90
|
return { publicKey, privateKey, address: classicAddress, seed: seed };
|
|
85
91
|
}
|
|
86
|
-
exports.generateAddress = generateAddress;
|
|
87
92
|
function isValidClassicAddress(address) {
|
|
88
93
|
if (!address || address.length === 0) {
|
|
89
94
|
return false;
|
|
@@ -101,14 +106,12 @@ function isValidClassicAddress(address) {
|
|
|
101
106
|
}
|
|
102
107
|
return true;
|
|
103
108
|
}
|
|
104
|
-
exports.isValidClassicAddress = isValidClassicAddress;
|
|
105
109
|
function checksumClassicAddress(buffer) {
|
|
106
110
|
const hash = buffer.slice(0, 21);
|
|
107
111
|
const checksumPrepare = Crypto.createHash("sha256").update(Buffer.from(hash)).digest();
|
|
108
112
|
const checksum = Crypto.createHash("sha256").update(checksumPrepare).digest();
|
|
109
113
|
return checksum;
|
|
110
114
|
}
|
|
111
|
-
exports.checksumClassicAddress = checksumClassicAddress;
|
|
112
115
|
function signTransaction(wallet, transaction, multisign, definitions, validateTx) {
|
|
113
116
|
let multisignAddress = false;
|
|
114
117
|
if (typeof multisign === "string" && multisign.startsWith("X")) {
|
|
@@ -144,14 +147,12 @@ function signTransaction(wallet, transaction, multisign, definitions, validateTx
|
|
|
144
147
|
hash: hashSignedTx(serialized, definitions),
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
|
-
exports.signTransaction = signTransaction;
|
|
148
150
|
function verifyTransaction(wallet, signedTransaction) {
|
|
149
151
|
const tx = typeof signedTransaction === "string" ? (0, ripple_binary_codec_1.decode)(signedTransaction) : signedTransaction;
|
|
150
152
|
const messageHex = (0, ripple_binary_codec_1.encodeForSigning)(tx);
|
|
151
153
|
const signature = tx.TxnSignature;
|
|
152
154
|
return (0, ripple_keypairs_1.verify)(messageHex, signature, wallet.publicKey);
|
|
153
155
|
}
|
|
154
|
-
exports.verifyTransaction = verifyTransaction;
|
|
155
156
|
function computeSignature(tx, privateKey, signAs, definitions) {
|
|
156
157
|
if (signAs) {
|
|
157
158
|
const classicAddress = (0, ripple_address_codec_1.isValidXAddress)(signAs) ? (0, ripple_address_codec_1.xAddressToClassicAddress)(signAs).classicAddress : signAs;
|
|
@@ -187,4 +188,3 @@ function hashSignedTx(tx, definitions, validateTx) {
|
|
|
187
188
|
const prefix = HashPrefix.TRANSACTION_ID.toString(16).toUpperCase();
|
|
188
189
|
return (0, common_1.sha512Half)(prefix.concat(txBlob));
|
|
189
190
|
}
|
|
190
|
-
exports.hashSignedTx = hashSignedTx;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/chai": "^4.3.16",
|
|
62
62
|
"@types/chai-as-promised": "^7.1.8",
|
|
63
|
-
"@types/lodash": "^4.17.
|
|
63
|
+
"@types/lodash": "^4.17.6",
|
|
64
64
|
"@types/mocha": "^10.0.7",
|
|
65
65
|
"@types/nconf": "^0.10.6",
|
|
66
|
-
"@types/node": "^20.14.
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
68
|
-
"@typescript-eslint/parser": "^7.
|
|
66
|
+
"@types/node": "^20.14.10",
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
68
|
+
"@typescript-eslint/parser": "^7.16.0",
|
|
69
69
|
"chai": "^4.4.1",
|
|
70
70
|
"chai-as-promised": "^7.1.2",
|
|
71
71
|
"eslint": "^8.57.0",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"eslint-plugin-chai-friendly": "^1.0.0",
|
|
74
74
|
"eslint-plugin-import": "^2.29.1",
|
|
75
75
|
"eslint-plugin-n": "^17.9.0",
|
|
76
|
-
"eslint-plugin-promise": "^6.
|
|
77
|
-
"mocha": "^10.
|
|
76
|
+
"eslint-plugin-promise": "^6.4.0",
|
|
77
|
+
"mocha": "^10.6.0",
|
|
78
78
|
"nconf": "^0.12.1",
|
|
79
|
-
"ts-jest": "^29.
|
|
79
|
+
"ts-jest": "^29.2.2",
|
|
80
80
|
"ts-node": "^10.9.2",
|
|
81
81
|
"typescript": "^5.4.5"
|
|
82
82
|
}
|