@bithomp/xrpl-api 3.7.24 → 3.7.26

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/connection.js CHANGED
@@ -52,7 +52,7 @@ exports.DEFAULT_API_VERSION = xrpl_1.RIPPLED_API_V1;
52
52
  const SLOW_DOWN_ERROR_MESSAGES = [
53
53
  "slowDown",
54
54
  "Unexpected server response: 429",
55
- "You are placing too much load on the server."
55
+ "You are placing too much load on the server.",
56
56
  ];
57
57
  class Connection extends events_1.EventEmitter {
58
58
  constructor(url, type, options = {}) {
@@ -103,15 +103,20 @@ class Connection extends events_1.EventEmitter {
103
103
  this.connectionValidation("connect");
104
104
  }
105
105
  catch (err) {
106
+ const errorMessage = err?.message || err?.name || err;
106
107
  this.logger?.warn({
107
108
  service: "Bithomp::XRPL::Connection",
108
109
  function: "connect",
109
110
  url: this.url,
110
- error: err?.message || err?.name || err,
111
+ error: errorMessage,
111
112
  });
112
113
  this.removeWatchTimer();
113
114
  this.removeClient();
114
- this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, LEDGER_CLOSED_TIMEOUT);
115
+ let reconnectDelay = LEDGER_CLOSED_TIMEOUT;
116
+ if (SLOW_DOWN_ERROR_MESSAGES.includes(errorMessage)) {
117
+ reconnectDelay = LEDGER_CLOSED_TIMEOUT * 5;
118
+ }
119
+ this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, reconnectDelay);
115
120
  }
116
121
  }
117
122
  async disconnect() {
@@ -0,0 +1,3 @@
1
+ import { AuthorizeCredential } from "xrpl";
2
+ import { FormattedAuthorizeCredentials } from "../../types/deposits";
3
+ export declare function parseCredentials(credential: AuthorizeCredential): FormattedAuthorizeCredentials;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCredentials = parseCredentials;
4
+ const utils_1 = require("../utils");
5
+ function parseCredentials(credential) {
6
+ if (!credential.Credential) {
7
+ return {};
8
+ }
9
+ return {
10
+ issuer: credential.Credential.Issuer,
11
+ type: (0, utils_1.decodeHexData)(credential.Credential.CredentialType),
12
+ };
13
+ }
@@ -42,13 +42,7 @@ const signers_1 = require("../ledger/signers");
42
42
  const regular_key_1 = require("../ledger/regular-key");
43
43
  const delegate_1 = require("../ledger/delegate");
44
44
  const source_1 = require("../ledger/source");
45
- const utils_1 = require("../utils");
46
- function parseCredentials(credential) {
47
- return {
48
- issuer: credential.Credential.Issuer,
49
- type: (0, utils_1.decodeHexData)(credential.Credential.CredentialType),
50
- };
51
- }
45
+ const credential_1 = require("../ledger/credential");
52
46
  function parseDepositPreauth(tx, nativeCurrency) {
53
47
  assert.ok(tx.TransactionType === "DepositPreauth");
54
48
  return (0, common_1.removeUndefined)({
@@ -58,8 +52,8 @@ function parseDepositPreauth(tx, nativeCurrency) {
58
52
  source: (0, source_1.parseSource)(tx),
59
53
  authorize: tx.Authorize,
60
54
  unauthorize: tx.Unauthorize,
61
- authorizeCredentials: tx.AuthorizeCredentials ? tx.AuthorizeCredentials.map(parseCredentials) : undefined,
62
- unauthorizeCredentials: tx.UnauthorizeCredentials ? tx.UnauthorizeCredentials.map(parseCredentials) : undefined,
55
+ authorizeCredentials: tx.AuthorizeCredentials ? tx.AuthorizeCredentials.map(credential_1.parseCredentials) : undefined,
56
+ unauthorizeCredentials: tx.UnauthorizeCredentials ? tx.UnauthorizeCredentials.map(credential_1.parseCredentials) : undefined,
63
57
  emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
64
58
  flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
65
59
  memos: (0, memos_1.parseMemos)(tx),
@@ -0,0 +1,4 @@
1
+ import { PermissionedDomainSet } from "xrpl";
2
+ import { FormattedPermissionedDomainSetSpecification } from "../../types/credentials";
3
+ declare function parsePermissionedDomainSet(tx: PermissionedDomainSet, nativeCurrency?: string): FormattedPermissionedDomainSetSpecification;
4
+ export default parsePermissionedDomainSet;
@@ -0,0 +1,55 @@
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 common_1 = require("../../common");
38
+ const memos_1 = require("../ledger/memos");
39
+ const signers_1 = require("../ledger/signers");
40
+ const regular_key_1 = require("../ledger/regular-key");
41
+ const source_1 = require("../ledger/source");
42
+ const tx_global_flags_1 = require("../ledger/tx-global-flags");
43
+ const credential_1 = require("../ledger/credential");
44
+ function parsePermissionedDomainSet(tx, nativeCurrency) {
45
+ assert.ok(tx.TransactionType === "PermissionedDomainSet");
46
+ return (0, common_1.removeUndefined)({
47
+ source: (0, source_1.parseSource)(tx),
48
+ signers: (0, signers_1.parseSigners)(tx),
49
+ signer: (0, regular_key_1.parseSignerRegularKey)(tx),
50
+ acceptedCredentials: tx.AcceptedCredentials ? tx.AcceptedCredentials.map(credential_1.parseCredentials) : undefined,
51
+ flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
52
+ memos: (0, memos_1.parseMemos)(tx),
53
+ });
54
+ }
55
+ exports.default = parsePermissionedDomainSet;
@@ -22,7 +22,7 @@ import { FormattedAmmBidSpecification, FormattedAmmCreateSpecification, Formatte
22
22
  import { FormattedDIDSetSpecification, FormattedDIDDeleteSpecification } from "../types/did";
23
23
  import { FormattedOracleSetSpecification, FormattedOracleDeleteSpecification } from "../types/oracle";
24
24
  import { FormattedMPTokenIssuanceCreateSpecification, FormattedMPTokenAuthorizeSpecification, FormattedMPTokenIssuanceSetSpecification, FormattedMPTokenIssuanceDestroySpecification } from "../types/mptokens";
25
- import { FormattedCredentialCreateSpecification, FormattedCredentialAcceptSpecification, FormattedCredentialDeleteSpecification } from "../types/credentials";
25
+ import { FormattedCredentialCreateSpecification, FormattedCredentialAcceptSpecification, FormattedCredentialDeleteSpecification, FormattedPermissionedDomainSetSpecification } from "../types/credentials";
26
26
  import { FormattedDelegateSetSpecification } from "../types/delegate";
27
27
  import { FormattedSetRemarksSpecification } from "../types/remarks";
28
28
  import { FormattedGenesisMintSpecification } from "../types/genesis_mint";
@@ -82,6 +82,7 @@ import parseSetRemarks from "./specification/set-remarks";
82
82
  import parseCredentialCreate from "./specification/credential-create";
83
83
  import parseCredentialAccept from "./specification/credential-accept";
84
84
  import parseCredentialDelete from "./specification/credential-delete";
85
+ import parsePermissionedDomainSet from "./specification/permissioned-domain-set";
85
86
  import parseGenesisMint from "./specification/genesis-mint";
86
87
  import parseBatch from "./specification/batch";
87
88
  import parseCron from "./specification/cron";
@@ -142,6 +143,7 @@ export declare const parserTypeFunc: {
142
143
  CredentialCreate: typeof parseCredentialCreate;
143
144
  CredentialAccept: typeof parseCredentialAccept;
144
145
  CredentialDelete: typeof parseCredentialDelete;
146
+ PermissionedDomainSet: typeof parsePermissionedDomainSet;
145
147
  DelegateSet: typeof parseDelegateSet;
146
148
  SetRemarks: typeof parseSetRemarks;
147
149
  genesisMint: typeof parseGenesisMint;
@@ -152,7 +154,7 @@ export declare const parserTypeFunc: {
152
154
  feeUpdate: typeof parseFeeUpdate;
153
155
  UNLModify: typeof parseUNLModify;
154
156
  };
155
- 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;
157
+ 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 | FormattedPermissionedDomainSetSpecification | FormattedDelegateSetSpecification | FormattedSetRemarksSpecification | FormattedGenesisMintSpecification | FormattedBatchSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
156
158
  export interface FormattedTransaction {
157
159
  type: string;
158
160
  address: string;
@@ -63,6 +63,7 @@ const set_remarks_1 = __importDefault(require("./specification/set-remarks"));
63
63
  const credential_create_1 = __importDefault(require("./specification/credential-create"));
64
64
  const credential_accept_1 = __importDefault(require("./specification/credential-accept"));
65
65
  const credential_delete_1 = __importDefault(require("./specification/credential-delete"));
66
+ const permissioned_domain_set_1 = __importDefault(require("./specification/permissioned-domain-set"));
66
67
  const genesis_mint_1 = __importDefault(require("./specification/genesis-mint"));
67
68
  const batch_1 = __importDefault(require("./specification/batch"));
68
69
  const cron_1 = __importDefault(require("./specification/cron"));
@@ -124,6 +125,7 @@ const transactionTypeToType = {
124
125
  CredentialCreate: "CredentialCreate",
125
126
  CredentialAccept: "CredentialAccept",
126
127
  CredentialDelete: "CredentialDelete",
128
+ PermissionedDomainSet: "PermissionedDomainSet",
127
129
  DelegateSet: "DelegateSet",
128
130
  SetRemarks: "SetRemarks",
129
131
  GenesisMint: "genesisMint",
@@ -189,6 +191,7 @@ exports.parserTypeFunc = {
189
191
  CredentialCreate: credential_create_1.default,
190
192
  CredentialAccept: credential_accept_1.default,
191
193
  CredentialDelete: credential_delete_1.default,
194
+ PermissionedDomainSet: permissioned_domain_set_1.default,
192
195
  DelegateSet: delegate_set_1.default,
193
196
  SetRemarks: set_remarks_1.default,
194
197
  genesisMint: genesis_mint_1.default,
@@ -1,3 +1,4 @@
1
+ import { FormattedAuthorizeCredentials } from "./deposits";
1
2
  import { FormattedBaseSpecification } from "./specification";
2
3
  export declare enum CredentialFlags {
3
4
  lsfAccepted = 65536
@@ -23,3 +24,6 @@ export type FormattedCredentialDeleteSpecification = {
23
24
  subject?: string;
24
25
  credentialType?: string;
25
26
  } & FormattedBaseSpecification;
27
+ export type FormattedPermissionedDomainSetSpecification = {
28
+ acceptedCredentials?: FormattedAuthorizeCredentials[];
29
+ } & FormattedBaseSpecification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.7.24",
3
+ "version": "3.7.26",
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",
@@ -42,7 +42,7 @@
42
42
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
43
43
  "lint": "eslint",
44
44
  "prepare": "npm run build",
45
- "-prepublishOnly": "npm test && npm run lint",
45
+ "prepublishOnly": "npm test && npm run lint",
46
46
  "preversion": "npm run lint",
47
47
  "version": "npm run format && git add -A src",
48
48
  "postversion": "git push && git push --tags"
@@ -70,7 +70,7 @@
70
70
  "@types/lodash": "^4.17.23",
71
71
  "@types/mocha": "^10.0.10",
72
72
  "@types/nconf": "^0.10.7",
73
- "@types/node": "^25.0.10",
73
+ "@types/node": "^25.2.0",
74
74
  "@typescript-eslint/eslint-plugin": "^8.54.0",
75
75
  "@typescript-eslint/parser": "^8.54.0",
76
76
  "chai": "^6.2.2",