@bithomp/xrpl-api 3.7.14 → 3.7.16

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.
@@ -61,6 +61,7 @@ declare class Connection extends EventEmitter {
61
61
  private updateLatency;
62
62
  private reconnect;
63
63
  private removeClient;
64
+ private removeWatchTimer;
64
65
  private setupEmitter;
65
66
  private resetTypes;
66
67
  private updateSubscriptions;
package/lib/connection.js CHANGED
@@ -88,10 +88,7 @@ class Connection extends events_1.EventEmitter {
88
88
  url: this.url,
89
89
  shutdown: this.shutdown,
90
90
  });
91
- if (this.connectionWatchTimer !== null) {
92
- clearTimeout(this.connectionWatchTimer);
93
- this.connectionWatchTimer = null;
94
- }
91
+ this.removeWatchTimer();
95
92
  this.removeClient();
96
93
  this.client = new XRPLConnection.Connection(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
97
94
  this.setupEmitter();
@@ -107,8 +104,9 @@ class Connection extends events_1.EventEmitter {
107
104
  url: this.url,
108
105
  error: err?.message || err?.name || err,
109
106
  });
107
+ this.removeWatchTimer();
110
108
  this.removeClient();
111
- this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, RECONNECT_TIMEOUT);
109
+ this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, LEDGER_CLOSED_TIMEOUT);
112
110
  }
113
111
  }
114
112
  async disconnect() {
@@ -121,10 +119,7 @@ class Connection extends events_1.EventEmitter {
121
119
  if (this.isConnected()) {
122
120
  await this.unsubscribe();
123
121
  }
124
- if (this.connectionWatchTimer !== null) {
125
- clearTimeout(this.connectionWatchTimer);
126
- this.connectionWatchTimer = null;
127
- }
122
+ this.removeWatchTimer();
128
123
  this.removeClient();
129
124
  }
130
125
  async request(request, options) {
@@ -344,6 +339,12 @@ class Connection extends events_1.EventEmitter {
344
339
  catch (_err) {
345
340
  }
346
341
  }
342
+ removeWatchTimer() {
343
+ if (this.connectionWatchTimer !== null) {
344
+ clearTimeout(this.connectionWatchTimer);
345
+ this.connectionWatchTimer = null;
346
+ }
347
+ }
347
348
  setupEmitter() {
348
349
  if (!this.client) {
349
350
  return;
@@ -583,10 +584,7 @@ class Connection extends events_1.EventEmitter {
583
584
  url: this.url,
584
585
  shutdown: this.shutdown,
585
586
  });
586
- if (this.connectionWatchTimer !== null) {
587
- clearTimeout(this.connectionWatchTimer);
588
- this.connectionWatchTimer = null;
589
- }
587
+ this.removeWatchTimer();
590
588
  if (this.shutdown) {
591
589
  this.removeClient();
592
590
  return;
@@ -94,6 +94,7 @@ export declare const AccountSetFlags: {
94
94
  disallowIncomingPayChan: AccountSetAsfFlags;
95
95
  disallowIncomingTrustline: AccountSetAsfFlags;
96
96
  allowTrustLineClawback: AccountSetAsfFlags;
97
+ allowTrustLineLocking: AccountSetAsfFlags;
97
98
  tshCollect: XahauAccountSetAsfFlags;
98
99
  disallowIncomingRemit: XahauAccountSetAsfFlags;
99
100
  };
@@ -103,6 +104,13 @@ export declare const SignerListFlagsKeys: {
103
104
  export interface SignerListFlagsKeysInterface {
104
105
  oneOwnerCount?: boolean;
105
106
  }
107
+ export interface AccountFieldParametersInterface {
108
+ name: string;
109
+ encoding?: string;
110
+ length?: number;
111
+ defaults?: any;
112
+ shift?: number;
113
+ }
106
114
  export declare const AccountFields: {
107
115
  EmailHash: {
108
116
  name: string;
@@ -75,6 +75,7 @@ exports.AccountSetFlags = {
75
75
  disallowIncomingPayChan: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingPayChan,
76
76
  disallowIncomingTrustline: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingTrustline,
77
77
  allowTrustLineClawback: xrpl_1.AccountSetAsfFlags.asfAllowTrustLineClawback,
78
+ allowTrustLineLocking: xrpl_1.AccountSetAsfFlags.asfAllowTrustLineLocking,
78
79
  tshCollect: XahauAccountSetAsfFlags.asfTshCollect,
79
80
  disallowIncomingRemit: XahauAccountSetAsfFlags.asfDisallowIncomingRemit,
80
81
  };
@@ -1,2 +1,3 @@
1
- declare function parseFields(data: any): object;
1
+ import { AccountSet, SetRegularKey, SignerListSet } from "xrpl";
2
+ declare function parseFields(tx: AccountSet | SetRegularKey | SignerListSet): object;
2
3
  export default parseFields;
@@ -14,28 +14,28 @@ function parseField(info, value) {
14
14
  }
15
15
  return value;
16
16
  }
17
- function parseFields(data) {
17
+ function parseFields(tx) {
18
18
  const settings = {};
19
19
  for (const fieldName in account_info_1.AccountFields) {
20
- const fieldValue = data[fieldName];
20
+ const fieldValue = tx[fieldName];
21
21
  if (fieldValue != null) {
22
22
  const info = account_info_1.AccountFields[fieldName];
23
23
  settings[info.name] = parseField(info, fieldValue);
24
24
  }
25
25
  }
26
- if (data.signer_lists && data.signer_lists.length === 1) {
27
- settings.signers = {};
28
- if (data.signer_lists[0].SignerQuorum) {
29
- settings.signers.threshold = data.signer_lists[0].SignerQuorum;
30
- }
31
- if (data.signer_lists[0].SignerEntries) {
32
- settings.signers.weights = data.signer_lists[0].SignerEntries.map((entry) => {
33
- return {
34
- address: entry.SignerEntry.Account,
35
- weight: entry.SignerEntry.SignerWeight,
36
- };
37
- });
38
- }
26
+ if (tx.ClearFlag === account_info_1.AccountSetFlags.authorizedMinter && !settings.nftokenMinter) {
27
+ settings.nftokenMinter = "";
28
+ }
29
+ if (tx.SignerEntries && Array.isArray(tx.SignerEntries) && tx.SignerEntries.length > 0) {
30
+ settings.signerEntries = tx.SignerEntries.map((entry) => {
31
+ return {
32
+ account: entry.SignerEntry.Account,
33
+ signerWeight: entry.SignerEntry.SignerWeight,
34
+ };
35
+ });
36
+ }
37
+ if (tx.SignerQuorum) {
38
+ settings.signerQuorum = tx.SignerQuorum;
39
39
  }
40
40
  return settings;
41
41
  }
@@ -1,3 +1,4 @@
1
1
  import { AccountSet, SetRegularKey, SignerListSet } from "xrpl";
2
- declare function parseSettings(tx: AccountSet | SetRegularKey | SignerListSet, nativeCurrency?: string): any;
2
+ import { FormattedSettingsSpecification } from "../../types/settings";
3
+ declare function parseSettings(tx: AccountSet | SetRegularKey | SignerListSet, nativeCurrency?: string): FormattedSettingsSpecification;
3
4
  export default parseSettings;
@@ -1,12 +1,5 @@
1
1
  import { FormattedBaseSpecification } from "./specification";
2
- export type WeightedSigner = {
3
- address: string;
4
- weight: number;
5
- };
6
- export type Signers = {
7
- threshold?: number;
8
- weights: WeightedSigner[];
9
- };
2
+ import { FormattedTransactionSigner } from "./signers";
10
3
  export type FormattedSettingsSpecification = {
11
4
  defaultRipple?: boolean;
12
5
  depositAuth?: boolean;
@@ -26,7 +19,7 @@ export type FormattedSettingsSpecification = {
26
19
  regularKey?: string;
27
20
  requireAuthorization?: boolean;
28
21
  requireDestinationTag?: boolean;
29
- signers?: Signers;
22
+ signers?: FormattedTransactionSigner[] | null;
30
23
  transferRate?: number | null;
31
24
  tickSize?: number;
32
25
  nftokenMinter?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.7.14",
3
+ "version": "3.7.16",
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"
@@ -69,9 +69,9 @@
69
69
  "@types/mocha": "^10.0.10",
70
70
  "@types/nconf": "^0.10.7",
71
71
  "@types/node": "^22.15.21",
72
- "@typescript-eslint/eslint-plugin": "^8.46.2",
73
- "@typescript-eslint/parser": "^8.46.2",
74
- "chai": "^6.2.0",
72
+ "@typescript-eslint/eslint-plugin": "^8.47.0",
73
+ "@typescript-eslint/parser": "^8.47.0",
74
+ "chai": "^6.2.1",
75
75
  "chai-as-promised": "^8.0.2",
76
76
  "eslint": "^9.39.1",
77
77
  "eslint-config-prettier": "^10.1.8",