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.nativeAsset = exports.coreTypes = exports.DEFAULT_DEFINITIONS = exports.XrplDefinitionsBase = exports.XrplDefinitions = exports.TRANSACTION_TYPES = exports.decodeLedgerData = exports.decodeQuality = exports.encodeQuality = exports.encodeForMultisigning = exports.encodeForSigningClaim = exports.encodeForSigning = exports.encode = exports.decode = void 0;
|
27 | const assert = __importStar(require("assert"));
|
28 | const coretypes_1 = require("./coretypes");
|
29 | const ledger_hashes_1 = require("./ledger-hashes");
|
30 | Object.defineProperty(exports, "decodeLedgerData", { enumerable: true, get: function () { return ledger_hashes_1.decodeLedgerData; } });
|
31 | const enums_1 = require("./enums");
|
32 | Object.defineProperty(exports, "XrplDefinitionsBase", { enumerable: true, get: function () { return enums_1.XrplDefinitionsBase; } });
|
33 | Object.defineProperty(exports, "TRANSACTION_TYPES", { enumerable: true, get: function () { return enums_1.TRANSACTION_TYPES; } });
|
34 | Object.defineProperty(exports, "DEFAULT_DEFINITIONS", { enumerable: true, get: function () { return enums_1.DEFAULT_DEFINITIONS; } });
|
35 | const xrpl_definitions_1 = require("./enums/xrpl-definitions");
|
36 | Object.defineProperty(exports, "XrplDefinitions", { enumerable: true, get: function () { return xrpl_definitions_1.XrplDefinitions; } });
|
37 | const types_1 = require("./types");
|
38 | Object.defineProperty(exports, "coreTypes", { enumerable: true, get: function () { return types_1.coreTypes; } });
|
39 | const nativeasset_1 = require("./nativeasset");
|
40 | Object.defineProperty(exports, "nativeAsset", { enumerable: true, get: function () { return nativeasset_1.nativeAsset; } });
|
41 | const { signingData, signingClaimData, multiSigningData, binaryToJSON, serializeObject, } = coretypes_1.binary;
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | function decode(binary, definitions) {
|
50 | assert.ok(typeof binary === 'string', 'binary must be a hex string');
|
51 | return binaryToJSON(binary, definitions);
|
52 | }
|
53 | exports.decode = decode;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | function encode(json, definitions) {
|
63 | assert.ok(typeof json === 'object');
|
64 | return serializeObject(json, { definitions })
|
65 | .toString('hex')
|
66 | .toUpperCase();
|
67 | }
|
68 | exports.encode = encode;
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | function encodeForSigning(json, definitions) {
|
78 | assert.ok(typeof json === 'object');
|
79 | return signingData(json, coretypes_1.HashPrefix.transactionSig, {
|
80 | definitions,
|
81 | })
|
82 | .toString('hex')
|
83 | .toUpperCase();
|
84 | }
|
85 | exports.encodeForSigning = encodeForSigning;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | function encodeForSigningClaim(json) {
|
95 | assert.ok(typeof json === 'object');
|
96 | return signingClaimData(json)
|
97 | .toString('hex')
|
98 | .toUpperCase();
|
99 | }
|
100 | exports.encodeForSigningClaim = encodeForSigningClaim;
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | function encodeForMultisigning(json, signer, definitions) {
|
110 | assert.ok(typeof json === 'object');
|
111 | assert.equal(json['SigningPubKey'], '');
|
112 | const definitionsOpt = definitions ? { definitions } : undefined;
|
113 | return multiSigningData(json, signer, definitionsOpt)
|
114 | .toString('hex')
|
115 | .toUpperCase();
|
116 | }
|
117 | exports.encodeForMultisigning = encodeForMultisigning;
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 | function encodeQuality(value) {
|
125 | assert.ok(typeof value === 'string');
|
126 | return coretypes_1.quality.encode(value).toString('hex').toUpperCase();
|
127 | }
|
128 | exports.encodeQuality = encodeQuality;
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | function decodeQuality(value) {
|
136 | assert.ok(typeof value === 'string');
|
137 | return coretypes_1.quality.decode(value).toString();
|
138 | }
|
139 | exports.decodeQuality = decodeQuality;
|
140 |
|
\ | No newline at end of file |