@bithomp/xrpl-api 2.7.7 → 2.7.10

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.
@@ -40,6 +40,7 @@ async function getAccountLines(account, options = {}) {
40
40
  currency: options.currency,
41
41
  ledger_index: options.ledgerIndex || "validated",
42
42
  limit: options.limit,
43
+ marker: options.marker,
43
44
  });
44
45
  if (!response) {
45
46
  return {
@@ -100,15 +100,15 @@ async function getAccountAllOffers(account, options = {}) {
100
100
  response.limit = accountOffers.length;
101
101
  break;
102
102
  }
103
- if (response.offers.length === 0) {
104
- break;
105
- }
106
103
  if (response.marker) {
107
104
  options.marker = response.marker;
108
105
  }
109
106
  else {
110
107
  break;
111
108
  }
109
+ if (response.offers.length === 0) {
110
+ break;
111
+ }
112
112
  }
113
113
  if (response.error) {
114
114
  const { error, error_code, error_message, status, validated } = response;
@@ -2,10 +2,14 @@ import { LedgerIndex } from "../models/ledger";
2
2
  import { OrderbookInfo } from "../models/book_offers";
3
3
  import { IssuedCurrency } from "../types";
4
4
  import { ErrorResponse } from "../models/base_model";
5
- export interface GetGetBookOffers {
5
+ export interface GetGetBookOffersOptions {
6
6
  ledgerIndex?: LedgerIndex;
7
7
  limit?: number;
8
8
  marker?: any;
9
9
  }
10
- export declare function getBookOffers(taker: string, takerGets: IssuedCurrency, takerPays: IssuedCurrency, options?: GetGetBookOffers): Promise<object | ErrorResponse>;
11
- export declare function getOrderbook(taker: string, orderbook: OrderbookInfo, options?: GetGetBookOffers): Promise<object | ErrorResponse>;
10
+ export declare function getBookOffers(taker: string, takerGets: IssuedCurrency, takerPays: IssuedCurrency, options?: GetGetBookOffersOptions): Promise<object | ErrorResponse>;
11
+ export interface GetGetOrderBookOptions {
12
+ ledgerIndex?: LedgerIndex;
13
+ limit?: number;
14
+ }
15
+ export declare function getOrderbook(taker: string, orderbook: OrderbookInfo, options?: GetGetOrderBookOptions): Promise<object | ErrorResponse>;
@@ -41,6 +41,7 @@ async function getBookOffers(taker, takerGets, takerPays, options = {}) {
41
41
  taker_pays: takerPays,
42
42
  ledger_index: options.ledgerIndex || "validated",
43
43
  limit: options.limit,
44
+ marker: options.marker,
44
45
  });
45
46
  if (!response) {
46
47
  return {
@@ -14,6 +14,7 @@ export * from "./ledger_entry";
14
14
  export * from "./manifest";
15
15
  export * from "./nft_info";
16
16
  export * from "./server_info";
17
+ export * from "./server_definitions";
17
18
  export * from "./transaction";
18
19
  export * from "./vl";
19
20
  export * from "./vl-v2";
@@ -30,6 +30,7 @@ __exportStar(require("./ledger_entry"), exports);
30
30
  __exportStar(require("./manifest"), exports);
31
31
  __exportStar(require("./nft_info"), exports);
32
32
  __exportStar(require("./server_info"), exports);
33
+ __exportStar(require("./server_definitions"), exports);
33
34
  __exportStar(require("./transaction"), exports);
34
35
  __exportStar(require("./vl"), exports);
35
36
  __exportStar(require("./vl-v2"), exports);
@@ -0,0 +1,7 @@
1
+ import { Connection } from "../connection";
2
+ import { ErrorResponse } from "../models/base_model";
3
+ import { ServerDefinitionsResponseResult } from "../models/server_definitions";
4
+ export interface GetServerDefinitionsOptions {
5
+ connection?: Connection;
6
+ }
7
+ export declare function getServerDefinitions(options?: GetServerDefinitionsOptions): Promise<ServerDefinitionsResponseResult | ErrorResponse>;
@@ -0,0 +1,54 @@
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
+ exports.getServerDefinitions = void 0;
27
+ const Client = __importStar(require("../client"));
28
+ async function getServerDefinitions(options = {}) {
29
+ const connection = options.connection || Client.findConnection();
30
+ if (!connection) {
31
+ throw new Error("There is no connection");
32
+ }
33
+ const response = await connection.request({
34
+ command: "server_definitions",
35
+ });
36
+ if (!response) {
37
+ return {
38
+ status: "error",
39
+ error: "invalidResponse",
40
+ };
41
+ }
42
+ if (response.error) {
43
+ const { error, error_code, error_message, status, validated } = response;
44
+ return {
45
+ error,
46
+ error_code,
47
+ error_message,
48
+ status,
49
+ validated,
50
+ };
51
+ }
52
+ return response?.result;
53
+ }
54
+ exports.getServerDefinitions = getServerDefinitions;
@@ -8,6 +8,7 @@ export * from "./account_lines";
8
8
  export * from "./account_namespace";
9
9
  export * from "./account_uritokens";
10
10
  export * from "./vl";
11
+ export * from "./server_definitions";
11
12
  export { parseAffectedObjects } from "../parse/outcome/affected_objects";
12
13
  export { parseNFTokenChanges } from "../parse/outcome/nftoken_changes";
13
14
  export { parseNFTokenOfferChanges } from "../parse/outcome/nftoken_offer_changes";
@@ -28,6 +28,7 @@ __exportStar(require("./account_lines"), exports);
28
28
  __exportStar(require("./account_namespace"), exports);
29
29
  __exportStar(require("./account_uritokens"), exports);
30
30
  __exportStar(require("./vl"), exports);
31
+ __exportStar(require("./server_definitions"), exports);
31
32
  var affected_objects_1 = require("../parse/outcome/affected_objects");
32
33
  Object.defineProperty(exports, "parseAffectedObjects", { enumerable: true, get: function () { return affected_objects_1.parseAffectedObjects; } });
33
34
  var nftoken_changes_1 = require("../parse/outcome/nftoken_changes");
@@ -0,0 +1,33 @@
1
+ interface FieldInfo {
2
+ nth: number;
3
+ isVLEncoded: boolean;
4
+ isSerialized: boolean;
5
+ isSigningField: boolean;
6
+ type: string;
7
+ }
8
+ interface DefinitionsData {
9
+ TYPES: Record<string, number>;
10
+ LEDGER_ENTRY_TYPES: Record<string, number>;
11
+ FIELDS: (string | FieldInfo)[][];
12
+ TRANSACTION_RESULTS: Record<string, number>;
13
+ TRANSACTION_TYPES: Record<string, number>;
14
+ }
15
+ interface AmendmentInterface {
16
+ count?: number;
17
+ enabled?: boolean;
18
+ name?: string;
19
+ supported?: boolean;
20
+ threshold?: number;
21
+ validations?: number;
22
+ vetoed?: string;
23
+ }
24
+ interface ServerDefinitionsResponseResultBase extends DefinitionsData {
25
+ features?: {
26
+ [key: string]: AmendmentInterface;
27
+ }[];
28
+ }
29
+ export type ServerDefinitionsResponseResult = {
30
+ hash: string;
31
+ native_currency_code?: string;
32
+ } & ServerDefinitionsResponseResultBase;
33
+ export {};
@@ -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": "2.7.7",
3
+ "version": "2.7.10",
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",