@bithomp/xrpl-api 3.0.9 → 3.1.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.
@@ -1,10 +1,12 @@
1
1
  import { EventEmitter } from "events";
2
- import { Request, Response } from "xrpl";
2
+ import { Request, Response, APIVersion } from "xrpl";
3
+ export declare const DEFAULT_API_VERSION = 1;
3
4
  export interface ConnectionOptions {
4
5
  logger?: any;
5
6
  timeout?: number;
6
7
  connectionTimeout?: number;
7
8
  networkID?: number;
9
+ apiVersion?: APIVersion;
8
10
  }
9
11
  export interface LatencyInfo {
10
12
  timestamp: Date;
@@ -34,6 +36,7 @@ declare class Connection extends EventEmitter {
34
36
  readonly connectionTimeout: number;
35
37
  readonly hash?: string;
36
38
  private networkID?;
39
+ private apiVersion;
37
40
  private serverInfoUpdating;
38
41
  serverInfo: any;
39
42
  private shutdown;
package/lib/connection.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Connection = void 0;
6
+ exports.Connection = exports.DEFAULT_API_VERSION = void 0;
7
7
  const crypto_1 = __importDefault(require("crypto"));
8
8
  const events_1 = require("events");
9
9
  const xrpl_1 = require("xrpl");
@@ -14,6 +14,7 @@ const RECONNECT_TIMEOUT = 1000 * 5;
14
14
  const LEDGER_CLOSED_TIMEOUT = 1000 * 15;
15
15
  const SERVER_INFO_UPDATE_INTERVAL = 1000 * 60 * 5;
16
16
  const AVAILABLE_LEDGER_INDEX_WINDOW = 1000;
17
+ exports.DEFAULT_API_VERSION = xrpl_1.RIPPLED_API_V1;
17
18
  class Connection extends events_1.EventEmitter {
18
19
  constructor(url, type, options = {}) {
19
20
  super();
@@ -38,6 +39,7 @@ class Connection extends events_1.EventEmitter {
38
39
  if (typeof options.networkID === "number") {
39
40
  this.networkID = options.networkID;
40
41
  }
42
+ this.apiVersion = options.apiVersion || exports.DEFAULT_API_VERSION;
41
43
  this.serverInfoUpdating = false;
42
44
  this.serverInfo = null;
43
45
  this.streams = {
@@ -56,6 +58,7 @@ class Connection extends events_1.EventEmitter {
56
58
  });
57
59
  await this.removeClient();
58
60
  this.client = new xrpl_1.Client(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
61
+ this.client.apiVersion = this.apiVersion;
59
62
  this.setupEmitter();
60
63
  await this.client.connect();
61
64
  await this.updateServerInfo();
@@ -0,0 +1,2 @@
1
+ import { FormattedGenesisMint } from "../../types/genesis_mint";
2
+ export declare function parseGenesisMints(tx: any): FormattedGenesisMint[] | undefined;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseGenesisMints = parseGenesisMints;
7
+ const amount_1 = __importDefault(require("./amount"));
8
+ function parseGenesisMints(tx) {
9
+ if (tx && tx.GenesisMints) {
10
+ return tx.GenesisMints.map((m) => {
11
+ return {
12
+ amount: (0, amount_1.default)(m.GenesisMint.Amount),
13
+ destination: m.GenesisMint.Destination,
14
+ };
15
+ });
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ import { FormattedGenesisMintSpecification } from "../../types/genesis_mint";
2
+ declare function parseGenesisMint(tx: any): FormattedGenesisMintSpecification;
3
+ export default parseGenesisMint;
@@ -0,0 +1,39 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const assert = __importStar(require("assert"));
27
+ const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
29
+ const memos_1 = require("../ledger/memos");
30
+ const genesis_mints_1 = require("../ledger/genesis-mints");
31
+ function parseGenesisMint(tx) {
32
+ assert.ok(tx.TransactionType === "GenesisMint");
33
+ return (0, common_1.removeUndefined)({
34
+ genesisMints: (0, genesis_mints_1.parseGenesisMints)(tx),
35
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
36
+ memos: (0, memos_1.parseMemos)(tx),
37
+ });
38
+ }
39
+ exports.default = parseGenesisMint;
@@ -18,10 +18,11 @@ import { FormattedUNLReportSpecification } from "../types/unl_reports";
18
18
  import { FormattedRemitsSpecification } from "../types/remits";
19
19
  import { FormattedClawbackSpecification } from "../types/clawback";
20
20
  import { FormattedAmmBidSpecification, FormattedAmmCreateSpecification, FormattedAmmDeleteSpecification, FormattedAmmDepositSpecification, FormattedAmmWithdrawSpecification, FormattedAmmVoteSpecification } from "../types/amm";
21
+ import { FormattedGenesisMintSpecification } from "../types/genesis_mint";
21
22
  import { FormattedAmendmentSpecification } from "../types/amendments";
22
23
  import { FormattedFeeUpdateSpecification } from "../types/fees";
23
24
  declare function parseTransactionType(type: string): string;
24
- export type FormattedSpecification = FormattedSettingsSpecification | FormattedAccountDeleteSpecification | FormattedCheckCancelSpecification | FormattedCheckCashSpecification | FormattedCheckCreateSpecification | FormattedDepositPreauthSpecification | FormattedEscrowCancelSpecification | FormattedEscrowCreateSpecification | FormattedEscrowFinishSpecification | FormattedOfferCancelSpecification | FormattedOfferCreateSpecification | FormattedPaymentSpecification | FormattedPaymentChannelClaimSpecification | FormattedPaymentChannelCreateSpecification | FormattedPaymentChannelFundSpecification | FormattedTicketCreateSpecification | FormattedTrustlineSpecification | FormattedNFTokenBurnSpecification | FormattedNFTokenMintSpecification | FormattedNFTokenCancelOfferSpecification | FormattedNFTokenCreateOfferSpecification | FormattedNFTokenAcceptOfferSpecification | FormattedURITokenBurnSpecification | FormattedURITokenBuySpecification | FormattedURITokenCreateSellOfferSpecification | FormattedURITokenCancelSellOfferSpecification | FormattedURITokenMintSpecification | FormattedImportSpecification | FormattedInvokeSpecification | FormattedUNLReportSpecification | FormattedRemitsSpecification | FormattedClawbackSpecification | FormattedAmmBidSpecification | FormattedAmmCreateSpecification | FormattedAmmDeleteSpecification | FormattedAmmDepositSpecification | FormattedAmmWithdrawSpecification | FormattedAmmVoteSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
25
+ export type FormattedSpecification = FormattedSettingsSpecification | FormattedAccountDeleteSpecification | FormattedCheckCancelSpecification | FormattedCheckCashSpecification | FormattedCheckCreateSpecification | FormattedDepositPreauthSpecification | FormattedEscrowCancelSpecification | FormattedEscrowCreateSpecification | FormattedEscrowFinishSpecification | FormattedOfferCancelSpecification | FormattedOfferCreateSpecification | FormattedPaymentSpecification | FormattedPaymentChannelClaimSpecification | FormattedPaymentChannelCreateSpecification | FormattedPaymentChannelFundSpecification | FormattedTicketCreateSpecification | FormattedTrustlineSpecification | FormattedNFTokenBurnSpecification | FormattedNFTokenMintSpecification | FormattedNFTokenCancelOfferSpecification | FormattedNFTokenCreateOfferSpecification | FormattedNFTokenAcceptOfferSpecification | FormattedURITokenBurnSpecification | FormattedURITokenBuySpecification | FormattedURITokenCreateSellOfferSpecification | FormattedURITokenCancelSellOfferSpecification | FormattedURITokenMintSpecification | FormattedImportSpecification | FormattedInvokeSpecification | FormattedUNLReportSpecification | FormattedRemitsSpecification | FormattedClawbackSpecification | FormattedAmmBidSpecification | FormattedAmmCreateSpecification | FormattedAmmDeleteSpecification | FormattedAmmDepositSpecification | FormattedAmmWithdrawSpecification | FormattedAmmVoteSpecification | FormattedGenesisMintSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
25
26
  export interface FormattedTransaction {
26
27
  type: string;
27
28
  address: string;
@@ -46,6 +46,7 @@ const amm_delete_1 = __importDefault(require("./specification/amm-delete"));
46
46
  const amm_deposit_1 = __importDefault(require("./specification/amm-deposit"));
47
47
  const amm_withdraw_1 = __importDefault(require("./specification/amm-withdraw"));
48
48
  const amm_vote_1 = __importDefault(require("./specification/amm-vote"));
49
+ const genesis_mint_1 = __importDefault(require("./specification/genesis-mint"));
49
50
  const amendment_1 = __importDefault(require("./specification/amendment"));
50
51
  const fee_update_1 = __importDefault(require("./specification/fee-update"));
51
52
  const transactionTypeToType = {
@@ -89,6 +90,7 @@ const transactionTypeToType = {
89
90
  AMMDeposit: "ammDeposit",
90
91
  AMMWithdraw: "ammWithdraw",
91
92
  AMMVote: "ammVote",
93
+ GenesisMint: "genesisMint",
92
94
  EnableAmendment: "amendment",
93
95
  SetFee: "feeUpdate",
94
96
  };
@@ -134,6 +136,7 @@ const parserTypeFunc = {
134
136
  ammDeposit: amm_deposit_1.default,
135
137
  ammWithdraw: amm_withdraw_1.default,
136
138
  ammVote: amm_vote_1.default,
139
+ genesisMint: genesis_mint_1.default,
137
140
  amendment: amendment_1.default,
138
141
  feeUpdate: fee_update_1.default,
139
142
  };
@@ -0,0 +1,9 @@
1
+ import { FormattedAmount } from "./amounts";
2
+ import { FormattedBaseSpecification } from "./specification";
3
+ export type FormattedGenesisMint = {
4
+ amount: FormattedAmount;
5
+ destination: string;
6
+ };
7
+ export type FormattedGenesisMintSpecification = {
8
+ genesisMints?: FormattedGenesisMint[];
9
+ } & FormattedBaseSpecification;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.0.9",
3
+ "version": "3.1.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",
@@ -11,19 +11,23 @@
11
11
  "url": "git+https://github.com/Bithomp/xrpl-api.git"
12
12
  },
13
13
  "engines": {
14
- "node": ">=16.0.0"
14
+ "node": ">=18.0.0"
15
15
  },
16
16
  "keywords": [
17
17
  "xrpl",
18
- "ws",
18
+ "rippled",
19
+ "clio",
19
20
  "xrp",
20
- "xah",
21
21
  "nft",
22
22
  "xls20",
23
23
  "xls35",
24
24
  "unl",
25
25
  "bithomp",
26
- "xahau"
26
+ "xahau",
27
+ "xahaud",
28
+ "xah",
29
+ "hooks",
30
+ "ws"
27
31
  ],
28
32
  "funding": {
29
33
  "type": "individual",
@@ -51,21 +55,21 @@
51
55
  "axios": "^1.7.2",
52
56
  "base-x": "^5.0.0",
53
57
  "bignumber.js": "^9.1.2",
54
- "elliptic": "^6.5.5",
58
+ "elliptic": "^6.5.6",
55
59
  "lodash": "^4.17.21",
56
60
  "ripple-address-codec": "^5.0.0",
57
61
  "ripple-binary-codec": "^2.1.0",
58
- "xrpl": "^3.1.0"
62
+ "xrpl": "^4.0.0"
59
63
  },
60
64
  "devDependencies": {
61
65
  "@types/chai": "^4.3.16",
62
66
  "@types/chai-as-promised": "^7.1.8",
63
- "@types/lodash": "^4.17.6",
67
+ "@types/lodash": "^4.17.7",
64
68
  "@types/mocha": "^10.0.7",
65
69
  "@types/nconf": "^0.10.6",
66
- "@types/node": "^20.14.10",
67
- "@typescript-eslint/eslint-plugin": "^7.16.0",
68
- "@typescript-eslint/parser": "^7.16.0",
70
+ "@types/node": "^20.14.11",
71
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
72
+ "@typescript-eslint/parser": "^7.16.1",
69
73
  "chai": "^4.4.1",
70
74
  "chai-as-promised": "^7.1.2",
71
75
  "eslint": "^8.57.0",