@bithomp/xrpl-api 2.7.9 → 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.
@@ -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.9",
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",