@bithomp/xrpl-api 3.1.18 → 3.2.0
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/client.js +1 -0
- package/lib/common/index.js +17 -7
- package/lib/index.js +17 -7
- package/lib/ledger/account_info.js +17 -7
- package/lib/ledger/account_lines.js +17 -7
- package/lib/ledger/account_namespace.js +17 -7
- package/lib/ledger/account_nfts.js +17 -7
- package/lib/ledger/account_objects.js +17 -7
- package/lib/ledger/account_offers.js +17 -7
- package/lib/ledger/account_tx.js +17 -7
- package/lib/ledger/amm_info.js +17 -7
- package/lib/ledger/book_offers.js +17 -7
- package/lib/ledger/currency.js +17 -7
- package/lib/ledger/fee.js +17 -7
- package/lib/ledger/gateway_balances.js +17 -7
- package/lib/ledger/ledger.js +17 -7
- package/lib/ledger/ledger_entry.js +17 -7
- package/lib/ledger/manifest.js +17 -7
- package/lib/ledger/nft_info.js +17 -7
- package/lib/ledger/server_definitions.js +17 -7
- package/lib/ledger/server_info.js +17 -7
- package/lib/ledger/transaction.js +17 -7
- package/lib/ledger/vl-v2.js +17 -7
- package/lib/ledger/vl.js +17 -7
- package/lib/models/index.d.ts +3 -0
- package/lib/models/index.js +6 -1
- package/lib/models/manifest.js +17 -7
- package/lib/models/mptoken.d.ts +7 -0
- package/lib/models/mptoken.js +26 -0
- package/lib/models/vl.js +17 -7
- package/lib/parse/index.js +17 -7
- package/lib/parse/ledger/account-order.js +3 -3
- package/lib/parse/ledger/amount.d.ts +2 -2
- package/lib/parse/ledger/amount.js +8 -5
- package/lib/parse/ledger/mptoken-authorize-flags.d.ts +5 -0
- package/lib/parse/ledger/mptoken-authorize-flags.js +8 -0
- package/lib/parse/ledger/mptoken-issuance-create-flags.d.ts +5 -0
- package/lib/parse/ledger/mptoken-issuance-create-flags.js +8 -0
- package/lib/parse/ledger/mptoken-issuance-set-flags.d.ts +5 -0
- package/lib/parse/ledger/mptoken-issuance-set-flags.js +8 -0
- package/lib/parse/ledger/orderbook-order.js +3 -3
- package/lib/parse/outcome/amm_changes.d.ts +2 -1
- package/lib/parse/outcome/balance_changes.d.ts +15 -2
- package/lib/parse/outcome/balance_changes.js +33 -2
- package/lib/parse/outcome/delivered_amount.d.ts +2 -2
- package/lib/parse/outcome/did_changes.d.ts +2 -1
- package/lib/parse/outcome/escrow_changes.d.ts +1 -1
- package/lib/parse/outcome/index.d.ts +2 -0
- package/lib/parse/outcome/index.js +5 -1
- package/lib/parse/outcome/locked_balance_changes.d.ts +14 -2
- package/lib/parse/outcome/locked_balance_changes.js +2 -21
- package/lib/parse/outcome/mptoken_changes.d.ts +1 -0
- package/lib/parse/outcome/mptoken_changes.js +84 -0
- package/lib/parse/outcome/mptoken_issuance_changes.d.ts +1 -0
- package/lib/parse/outcome/mptoken_issuance_changes.js +94 -0
- package/lib/parse/outcome/oracle_changes.d.ts +2 -1
- package/lib/parse/outcome/orderbook_changes.d.ts +14 -2
- package/lib/parse/outcome/orderbook_changes.js +2 -2
- package/lib/parse/outcome/orderbook_quality.js +17 -7
- package/lib/parse/outcome.js +4 -20
- package/lib/parse/specification/account-delete.js +17 -7
- package/lib/parse/specification/amendment.js +17 -7
- package/lib/parse/specification/amm-bid.js +17 -7
- package/lib/parse/specification/amm-create.js +17 -7
- package/lib/parse/specification/amm-delete.js +17 -7
- package/lib/parse/specification/amm-deposit.js +17 -7
- package/lib/parse/specification/amm-vote.js +17 -7
- package/lib/parse/specification/amm-withdraw.js +17 -7
- package/lib/parse/specification/check-cancel.js +17 -7
- package/lib/parse/specification/check-cash.js +17 -7
- package/lib/parse/specification/check-create.js +17 -7
- package/lib/parse/specification/clawback.js +17 -7
- package/lib/parse/specification/deposit-preauth.js +17 -7
- package/lib/parse/specification/did-delete.js +17 -7
- package/lib/parse/specification/did-set.js +17 -7
- package/lib/parse/specification/escrow-cancel.js +17 -7
- package/lib/parse/specification/escrow-create.js +17 -7
- package/lib/parse/specification/escrow-finish.js +17 -7
- package/lib/parse/specification/genesis-mint.js +17 -7
- package/lib/parse/specification/import.js +17 -7
- package/lib/parse/specification/invoke.js +17 -7
- package/lib/parse/specification/mptoken-authorize.d.ts +3 -0
- package/lib/parse/specification/mptoken-authorize.js +58 -0
- package/lib/parse/specification/mptoken-issuance-create.d.ts +3 -0
- package/lib/parse/specification/mptoken-issuance-create.js +60 -0
- package/lib/parse/specification/mptoken-issuance-destroy.d.ts +3 -0
- package/lib/parse/specification/mptoken-issuance-destroy.js +52 -0
- package/lib/parse/specification/mptoken-issuance-set.d.ts +3 -0
- package/lib/parse/specification/mptoken-issuance-set.js +58 -0
- package/lib/parse/specification/nftoken-accept-offer.js +22 -7
- package/lib/parse/specification/nftoken-burn.js +22 -7
- package/lib/parse/specification/nftoken-cancel-offer.js +22 -7
- package/lib/parse/specification/nftoken-create-offer.js +17 -7
- package/lib/parse/specification/nftoken-mint.js +34 -7
- package/lib/parse/specification/offer-cancel.js +22 -9
- package/lib/parse/specification/offer-create.js +22 -9
- package/lib/parse/specification/oracle-delete.js +17 -9
- package/lib/parse/specification/oracle-set.js +17 -7
- package/lib/parse/specification/payment-channel-claim.js +17 -7
- package/lib/parse/specification/payment-channel-create.js +17 -7
- package/lib/parse/specification/payment-channel-fund.js +17 -7
- package/lib/parse/specification/payment.js +17 -7
- package/lib/parse/specification/remit.js +17 -7
- package/lib/parse/specification/settings.js +17 -7
- package/lib/parse/specification/ticket-create.js +17 -7
- package/lib/parse/specification/trustline.js +17 -7
- package/lib/parse/specification/unl-report.js +17 -7
- package/lib/parse/specification/uritoken-burn.js +17 -7
- package/lib/parse/specification/uritoken-buy.js +17 -7
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +17 -7
- package/lib/parse/specification/uritoken-create-sell-offer.js +17 -7
- package/lib/parse/specification/uritoken-mint.js +17 -7
- package/lib/parse/transaction.d.ts +4 -1
- package/lib/parse/transaction.js +24 -8
- package/lib/parse/utils.d.ts +2 -2
- package/lib/parse/utils.js +4 -1
- package/lib/types/account.d.ts +2 -2
- package/lib/types/amounts.d.ts +6 -2
- package/lib/types/checks.d.ts +2 -2
- package/lib/types/mptokens.d.ts +69 -0
- package/lib/types/mptokens.js +36 -0
- package/lib/types/nftokens.d.ts +3 -0
- package/lib/types/outcome.d.ts +6 -19
- package/lib/v1/utils.d.ts +1 -1
- package/lib/v1/utils.js +18 -10
- package/lib/validator.js +18 -16
- package/lib/wallet.js +17 -7
- package/package.json +15 -12
package/lib/v1/utils.js
CHANGED
|
@@ -8,18 +8,26 @@ const client_1 = require("../client");
|
|
|
8
8
|
function toRippledAmount(amount) {
|
|
9
9
|
if (typeof amount === "string")
|
|
10
10
|
return amount;
|
|
11
|
-
if (
|
|
12
|
-
|
|
11
|
+
if ("currency" in amount) {
|
|
12
|
+
if (amount.currency === (0, client_1.getNativeCurrency)()) {
|
|
13
|
+
return (0, common_1.xrpToDrops)(amount.value);
|
|
14
|
+
}
|
|
15
|
+
else if (amount.currency === "drops") {
|
|
16
|
+
return amount.value;
|
|
17
|
+
}
|
|
18
|
+
const issuer = amount.counterparty || amount.issuer;
|
|
19
|
+
return {
|
|
20
|
+
currency: amount.currency,
|
|
21
|
+
issuer,
|
|
22
|
+
value: amount.value,
|
|
23
|
+
};
|
|
13
24
|
}
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
25
|
+
if ("mpt_issuance_id" in amount) {
|
|
26
|
+
return {
|
|
27
|
+
value: amount.value,
|
|
28
|
+
mpt_issuance_id: amount.mpt_issuance_id,
|
|
29
|
+
};
|
|
16
30
|
}
|
|
17
|
-
const issuer = amount.counterparty || amount.issuer;
|
|
18
|
-
return {
|
|
19
|
-
currency: amount.currency,
|
|
20
|
-
issuer,
|
|
21
|
-
value: amount.value,
|
|
22
|
-
};
|
|
23
31
|
}
|
|
24
32
|
function getClassicAccountAndTag(Account, expectedTag) {
|
|
25
33
|
if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
|
package/lib/validator.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -34,7 +44,6 @@ exports.verify2 = verify2;
|
|
|
34
44
|
const assert = __importStar(require("assert"));
|
|
35
45
|
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
36
46
|
const Crypto = __importStar(require("crypto"));
|
|
37
|
-
const Base58 = __importStar(require("./base58"));
|
|
38
47
|
const elliptic_1 = __importDefault(require("elliptic"));
|
|
39
48
|
const secp256k1 = new elliptic_1.default.ec("secp256k1");
|
|
40
49
|
const ed25519 = new elliptic_1.default.eddsa("ed25519");
|
|
@@ -56,14 +65,7 @@ function classicAddressFromValidatorPK(pk) {
|
|
|
56
65
|
const pubkeyOuterHash = Crypto.createHash("ripemd160");
|
|
57
66
|
pubkeyOuterHash.update(pubkeyInnerHash.digest());
|
|
58
67
|
const accountID = pubkeyOuterHash.digest();
|
|
59
|
-
|
|
60
|
-
const payload = Buffer.concat([addressTypePrefix, accountID]);
|
|
61
|
-
const chksumHash1 = Crypto.createHash("sha256").update(payload).digest();
|
|
62
|
-
const chksumHash2 = Crypto.createHash("sha256").update(chksumHash1).digest();
|
|
63
|
-
const checksum = chksumHash2.slice(0, 4);
|
|
64
|
-
const dataToEncode = Buffer.concat([payload, checksum]);
|
|
65
|
-
const address = Base58.encode(dataToEncode);
|
|
66
|
-
return address;
|
|
68
|
+
return (0, ripple_address_codec_1.encodeAccountID)(accountID);
|
|
67
69
|
}
|
|
68
70
|
function generateSecrets() {
|
|
69
71
|
const keypair = Crypto.generateKeyPairSync("ed25519", {
|
package/lib/wallet.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test": "node ./node_modules/mocha/bin/mocha",
|
|
42
42
|
"build": "tsc",
|
|
43
43
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
44
|
-
"lint": "eslint
|
|
44
|
+
"lint": "eslint",
|
|
45
45
|
"prepare": "npm run build",
|
|
46
46
|
"prepublishOnly": "npm test && npm run lint",
|
|
47
47
|
"preversion": "npm run lint",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"lib/**/*"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"axios": "^1.7.
|
|
55
|
+
"axios": "^1.7.9",
|
|
56
56
|
"base-x": "^5.0.0",
|
|
57
57
|
"bignumber.js": "^9.1.2",
|
|
58
58
|
"elliptic": "^6.6.1",
|
|
@@ -62,26 +62,29 @@
|
|
|
62
62
|
"xrpl": "^4.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
66
|
+
"@eslint/js": "^9.17.0",
|
|
65
67
|
"@types/chai": "^5.0.1",
|
|
66
68
|
"@types/chai-as-promised": "^8.0.1",
|
|
67
69
|
"@types/lodash": "^4.17.13",
|
|
68
|
-
"@types/mocha": "^10.0.
|
|
70
|
+
"@types/mocha": "^10.0.10",
|
|
69
71
|
"@types/nconf": "^0.10.7",
|
|
70
|
-
"@types/node": "^
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
72
|
+
"@types/node": "^22.10.2",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
74
|
+
"@typescript-eslint/parser": "^8.18.1",
|
|
73
75
|
"chai": "^4.5.0",
|
|
74
76
|
"chai-as-promised": "^7.1.2",
|
|
75
|
-
"eslint": "^
|
|
77
|
+
"eslint": "^9.17.0",
|
|
76
78
|
"eslint-config-prettier": "^9.1.0",
|
|
77
79
|
"eslint-plugin-chai-friendly": "^1.0.1",
|
|
78
80
|
"eslint-plugin-import": "^2.31.0",
|
|
79
|
-
"eslint-plugin-n": "^17.
|
|
80
|
-
"eslint-plugin-promise": "^7.1
|
|
81
|
-
"
|
|
81
|
+
"eslint-plugin-n": "^17.15.1",
|
|
82
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
83
|
+
"globals": "^15.14.0",
|
|
84
|
+
"mocha": "^11.0.1",
|
|
82
85
|
"nconf": "^0.12.1",
|
|
83
86
|
"ts-jest": "^29.2.5",
|
|
84
87
|
"ts-node": "^10.9.2",
|
|
85
|
-
"typescript": "^5.
|
|
88
|
+
"typescript": "^5.7.2"
|
|
86
89
|
}
|
|
87
90
|
}
|