@bithomp/xrpl-api 3.6.2 → 3.6.3

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/ledger/vl.js CHANGED
@@ -112,6 +112,9 @@ async function getVLBlobValidatorsManifest(validatorsPublicKeys) {
112
112
  if (response.error) {
113
113
  Promise.reject(response.error);
114
114
  }
115
+ if (!response.result || !response.result.manifest) {
116
+ return Promise.reject(new Error("Failed to get validator manifest"));
117
+ }
115
118
  return response.result;
116
119
  }));
117
120
  const validators = validatorsManifests.map((info) => {
@@ -1,3 +1,3 @@
1
1
  import { FormattedAmendmentSpecification } from "../../types/amendments";
2
- declare function parseAmendment(tx: any, nativeCurrency?: string): FormattedAmendmentSpecification;
2
+ declare function parseAmendment(tx: any): FormattedAmendmentSpecification;
3
3
  export default parseAmendment;
@@ -37,15 +37,13 @@ const assert = __importStar(require("assert"));
37
37
  const common_1 = require("../../common");
38
38
  const source_1 = require("../ledger/source");
39
39
  const emit_details_1 = require("../ledger/emit_details");
40
- const tx_global_flags_1 = require("../ledger/tx-global-flags");
41
40
  const memos_1 = require("../ledger/memos");
42
- function parseAmendment(tx, nativeCurrency) {
41
+ function parseAmendment(tx) {
43
42
  assert.ok(tx.TransactionType === "EnableAmendment");
44
43
  return (0, common_1.removeUndefined)({
45
44
  source: (0, source_1.parseSource)(tx),
46
45
  amendment: tx.Amendment,
47
46
  emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
48
- flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
49
47
  memos: (0, memos_1.parseMemos)(tx),
50
48
  });
51
49
  }
@@ -1,3 +1,3 @@
1
1
  import { FormattedFeeUpdateSpecification } from "../../types/fees";
2
- declare function parseFeeUpdate(tx: any, nativeCurrency?: string): FormattedFeeUpdateSpecification;
2
+ declare function parseFeeUpdate(tx: any): FormattedFeeUpdateSpecification;
3
3
  export default parseFeeUpdate;
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
7
  const common_1 = require("../../common");
8
8
  const emit_details_1 = require("../ledger/emit_details");
9
- const tx_global_flags_1 = require("../ledger/tx-global-flags");
10
9
  const memos_1 = require("../ledger/memos");
11
10
  const source_1 = require("../ledger/source");
12
- function parseFeeUpdate(tx, nativeCurrency) {
11
+ function parseFeeUpdate(tx) {
13
12
  const baseFeeDrops = new bignumber_js_1.default(tx.BaseFee, 16).toString();
14
13
  return {
15
14
  source: (0, source_1.parseSource)(tx),
@@ -18,7 +17,6 @@ function parseFeeUpdate(tx, nativeCurrency) {
18
17
  reserveBaseXRP: (0, common_1.dropsToXrp)(tx.ReserveBase),
19
18
  reserveIncrementXRP: (0, common_1.dropsToXrp)(tx.ReserveIncrement),
20
19
  emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
21
- flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
22
20
  memos: (0, memos_1.parseMemos)(tx),
23
21
  };
24
22
  }
@@ -0,0 +1,4 @@
1
+ import { UNLModify } from "xrpl";
2
+ import { FormattedUNLModifySpecification } from "../../types/unl_modify";
3
+ declare function parseUNLModify(tx: UNLModify): FormattedUNLModifySpecification;
4
+ export default parseUNLModify;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const assert = __importStar(require("assert"));
37
+ const ripple_address_codec_1 = require("ripple-address-codec");
38
+ const emit_details_1 = require("../ledger/emit_details");
39
+ const memos_1 = require("../ledger/memos");
40
+ const source_1 = require("../ledger/source");
41
+ function parseUNLModify(tx) {
42
+ assert.ok(tx.TransactionType === "UNLModify");
43
+ return {
44
+ source: (0, source_1.parseSource)(tx),
45
+ nUNL: tx.UNLModifyDisabling === 1,
46
+ PublicKey: tx.UNLModifyValidator,
47
+ publicKey: (0, ripple_address_codec_1.encodeNodePublic)(Buffer.from(tx.UNLModifyValidator, "hex")),
48
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
49
+ memos: (0, memos_1.parseMemos)(tx),
50
+ };
51
+ }
52
+ exports.default = parseUNLModify;
@@ -86,6 +86,7 @@ import parseGenesisMint from "./specification/genesis-mint";
86
86
  import parseBatch from "./specification/batch";
87
87
  import parseAmendment from "./specification/amendment";
88
88
  import parseFeeUpdate from "./specification/fee-update";
89
+ import parseUNLModify from "./specification/unl-modify";
89
90
  declare function parseTransactionType(type: string): string;
90
91
  export declare const parserTypeFunc: {
91
92
  settings: typeof parseSettings;
@@ -145,6 +146,7 @@ export declare const parserTypeFunc: {
145
146
  Batch: typeof parseBatch;
146
147
  amendment: typeof parseAmendment;
147
148
  feeUpdate: typeof parseFeeUpdate;
149
+ UNLModify: typeof parseUNLModify;
148
150
  };
149
151
  export type FormattedSpecification = FormattedUnrecognizedParserSpecification | FormattedSettingsSpecification | FormattedAccountDeleteSpecification | FormattedCheckCancelSpecification | FormattedCheckCashSpecification | FormattedCheckCreateSpecification | FormattedDepositPreauthSpecification | FormattedEscrowCancelSpecification | FormattedEscrowCreateSpecification | FormattedEscrowFinishSpecification | FormattedOfferCancelSpecification | FormattedOfferCreateSpecification | FormattedPaymentSpecification | FormattedPaymentChannelClaimSpecification | FormattedPaymentChannelCreateSpecification | FormattedPaymentChannelFundSpecification | FormattedTicketCreateSpecification | FormattedTrustlineSpecification | FormattedNFTokenBurnSpecification | FormattedNFTokenMintSpecification | FormattedNFTokenModifySpecification | FormattedNFTokenCancelOfferSpecification | FormattedNFTokenCreateOfferSpecification | FormattedNFTokenAcceptOfferSpecification | FormattedURITokenBurnSpecification | FormattedURITokenBuySpecification | FormattedURITokenCreateSellOfferSpecification | FormattedURITokenCancelSellOfferSpecification | FormattedURITokenMintSpecification | FormattedImportSpecification | FormattedInvokeSpecification | FormattedUNLReportSpecification | FormattedRemitsSpecification | FormattedClawbackSpecification | FormattedAmmBidSpecification | FormattedAmmCreateSpecification | FormattedAmmDeleteSpecification | FormattedAmmDepositSpecification | FormattedAmmWithdrawSpecification | FormattedAmmVoteSpecification | FormattedAmmClawbackSpecification | FormattedDIDSetSpecification | FormattedDIDDeleteSpecification | FormattedOracleSetSpecification | FormattedOracleDeleteSpecification | FormattedMPTokenIssuanceCreateSpecification | FormattedMPTokenAuthorizeSpecification | FormattedMPTokenIssuanceSetSpecification | FormattedMPTokenIssuanceDestroySpecification | FormattedCredentialCreateSpecification | FormattedCredentialAcceptSpecification | FormattedCredentialDeleteSpecification | FormattedDelegateSetSpecification | FormattedSetRemarksSpecification | FormattedGenesisMintSpecification | FormattedBatchSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
150
152
  export interface FormattedTransaction {
@@ -67,6 +67,7 @@ const genesis_mint_1 = __importDefault(require("./specification/genesis-mint"));
67
67
  const batch_1 = __importDefault(require("./specification/batch"));
68
68
  const amendment_1 = __importDefault(require("./specification/amendment"));
69
69
  const fee_update_1 = __importDefault(require("./specification/fee-update"));
70
+ const unl_modify_1 = __importDefault(require("./specification/unl-modify"));
70
71
  const transactionTypeToType = {
71
72
  AccountSet: "settings",
72
73
  AccountDelete: "accountDelete",
@@ -127,6 +128,7 @@ const transactionTypeToType = {
127
128
  Batch: "Batch",
128
129
  EnableAmendment: "amendment",
129
130
  SetFee: "feeUpdate",
131
+ UNLModify: "UNLModify",
130
132
  };
131
133
  function parseTransactionType(type) {
132
134
  return transactionTypeToType[type] || type;
@@ -189,6 +191,7 @@ exports.parserTypeFunc = {
189
191
  Batch: batch_1.default,
190
192
  amendment: amendment_1.default,
191
193
  feeUpdate: fee_update_1.default,
194
+ UNLModify: unl_modify_1.default,
192
195
  };
193
196
  function parseTransaction(tx, includeRawTransaction, nativeCurrency, definitions) {
194
197
  let universalTx = tx;
@@ -0,0 +1,6 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ export type FormattedUNLModifySpecification = {
3
+ nUNL?: boolean;
4
+ PublicKey?: string;
5
+ publicKey?: string;
6
+ } & FormattedBaseSpecification;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/wallet.d.ts CHANGED
@@ -30,4 +30,5 @@ export declare function signTransaction(wallet: Wallet, transaction: Transaction
30
30
  export declare function verifyTransaction(signedTransaction: Transaction | string, definitions?: XrplDefinitionsBase): boolean;
31
31
  export declare function verifySignature(signedTransaction: Transaction | string, explicitMultiSigner?: string | null, definitions?: XrplDefinitionsBase): VerifySignatureInterface;
32
32
  declare function hashSignedTx(tx: Transaction | string, definitions?: XrplDefinitionsBase, validateTx?: boolean): string;
33
- export { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS, hashSignedTx };
33
+ declare function getXahauDefinitions(): XrplDefinitionsBase | undefined;
34
+ export { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS, hashSignedTx, getXahauDefinitions };
package/lib/wallet.js CHANGED
@@ -46,6 +46,7 @@ exports.signTransaction = signTransaction;
46
46
  exports.verifyTransaction = verifyTransaction;
47
47
  exports.verifySignature = verifySignature;
48
48
  exports.hashSignedTx = hashSignedTx;
49
+ exports.getXahauDefinitions = getXahauDefinitions;
49
50
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
50
51
  const omitBy_1 = __importDefault(require("lodash/omitBy"));
51
52
  const Crypto = __importStar(require("crypto"));
@@ -271,3 +272,13 @@ function hashSignedTx(tx, definitions, validateTx) {
271
272
  const prefix = HashPrefix.TRANSACTION_ID.toString(16).toUpperCase();
272
273
  return (0, common_1.sha512Half)(prefix.concat(txBlob));
273
274
  }
275
+ function getXahauDefinitions() {
276
+ try {
277
+ const xahauEnums = require("../config/xahau_definitions.json");
278
+ const xahauDefinitions = new ripple_binary_codec_1.XrplDefinitions(xahauEnums);
279
+ return xahauDefinitions;
280
+ }
281
+ catch (_err) {
282
+ }
283
+ return undefined;
284
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.6.2",
3
+ "version": "3.6.3",
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",
@@ -43,7 +43,7 @@
43
43
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
44
44
  "lint": "eslint",
45
45
  "prepare": "npm run build",
46
- "-prepublishOnly": "npm test && npm run lint",
46
+ "prepublishOnly": "npm test && npm run lint",
47
47
  "preversion": "npm run lint",
48
48
  "version": "npm run format && git add -A src",
49
49
  "postversion": "git push && git push --tags"
@@ -52,7 +52,7 @@
52
52
  "lib/**/*"
53
53
  ],
54
54
  "dependencies": {
55
- "axios": "^1.11.0",
55
+ "axios": "^1.12.2",
56
56
  "base-x": "^5.0.1",
57
57
  "bignumber.js": "^9.3.1",
58
58
  "elliptic": "^6.6.1",
@@ -70,19 +70,19 @@
70
70
  "@types/mocha": "^10.0.10",
71
71
  "@types/nconf": "^0.10.7",
72
72
  "@types/node": "^22.15.21",
73
- "@typescript-eslint/eslint-plugin": "^8.42.0",
74
- "@typescript-eslint/parser": "^8.42.0",
73
+ "@typescript-eslint/eslint-plugin": "^8.44.0",
74
+ "@typescript-eslint/parser": "^8.44.0",
75
75
  "chai": "^6.0.1",
76
76
  "chai-as-promised": "^8.0.2",
77
- "eslint": "^9.34.0",
77
+ "eslint": "^9.35.0",
78
78
  "eslint-config-prettier": "^10.1.8",
79
79
  "eslint-plugin-chai-friendly": "^1.1.0",
80
80
  "eslint-plugin-import": "^2.32.0",
81
- "eslint-plugin-n": "^17.21.3",
81
+ "eslint-plugin-n": "^17.23.0",
82
82
  "eslint-plugin-promise": "^7.2.1",
83
83
  "mocha": "^11.7.2",
84
84
  "nconf": "^0.13.0",
85
- "ts-jest": "^29.4.1",
85
+ "ts-jest": "^29.4.2",
86
86
  "ts-node": "^10.9.2",
87
87
  "typescript": "^5.9.2"
88
88
  }