@bithomp/xrpl-api 2.6.0 → 2.6.3
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.
- package/lib/ledger/currency.js +4 -3
- package/lib/models/index.d.ts +1 -1
- package/lib/models/index.js +2 -2
- package/lib/parse/ledger/import.d.ts +2 -0
- package/lib/parse/ledger/import.js +32 -0
- package/lib/parse/outcome/affected_objects.js +3 -3
- package/lib/parse/outcome/hooks_executions.d.ts +13 -0
- package/lib/parse/outcome/hooks_executions.js +43 -0
- package/lib/parse/outcome/index.d.ts +1 -0
- package/lib/parse/outcome/index.js +3 -1
- package/lib/parse/outcome.js +19 -3
- package/lib/parse/specification/import.d.ts +3 -0
- package/lib/parse/specification/import.js +45 -0
- package/lib/parse/specification/invoke.d.ts +3 -0
- package/lib/parse/specification/invoke.js +47 -0
- package/lib/parse/transaction.d.ts +4 -1
- package/lib/parse/transaction.js +6 -0
- package/lib/v1/common/types/objects/hook.d.ts +14 -0
- package/lib/v1/common/types/objects/hook.js +2 -0
- package/lib/v1/common/types/objects/import.d.ts +18 -0
- package/lib/v1/common/types/objects/import.js +2 -0
- package/lib/v1/common/types/objects/index.d.ts +7 -0
- package/lib/v1/common/types/objects/index.js +7 -0
- package/lib/v1/common/types/objects/invoke.d.ts +6 -0
- package/lib/v1/common/types/objects/invoke.js +2 -0
- package/package.json +3 -1
package/lib/ledger/currency.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.parseCurrencyInformation = void 0;
|
|
|
27
27
|
const Client = __importStar(require("../client"));
|
|
28
28
|
const utils_1 = require("../parse/utils");
|
|
29
29
|
const transaction_1 = require("../parse/transaction");
|
|
30
|
+
const client_1 = require("../client");
|
|
30
31
|
const maxLength = 12;
|
|
31
32
|
async function parseCurrencyInformation(currency) {
|
|
32
33
|
if (!currency || typeof currency !== "string") {
|
|
@@ -35,7 +36,7 @@ async function parseCurrencyInformation(currency) {
|
|
|
35
36
|
if (currency.length < 3) {
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
38
|
-
if (currency.length === 3 && currency.trim().
|
|
39
|
+
if (currency.length === 3 && currency.trim().toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
39
40
|
return decodeSimple(currency);
|
|
40
41
|
}
|
|
41
42
|
if (isHex(currency)) {
|
|
@@ -118,7 +119,7 @@ async function decodeXlf15d(currencyCode) {
|
|
|
118
119
|
}
|
|
119
120
|
function decodeHex(currencyHex) {
|
|
120
121
|
const decodedHex = (0, utils_1.hexToString)(currencyHex)?.slice(0, maxLength)?.trim();
|
|
121
|
-
if (decodedHex.match(/[a-zA-Z0-9]{3,}/) && decodedHex.
|
|
122
|
+
if (decodedHex.match(/[a-zA-Z0-9]{3,}/) && decodedHex.toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
122
123
|
return {
|
|
123
124
|
type: "hex",
|
|
124
125
|
currencyCode: currencyHex,
|
|
@@ -157,7 +158,7 @@ function ctiTransactionCheckGen(txHash) {
|
|
|
157
158
|
function isXlf15d(currencyHex) {
|
|
158
159
|
const hex = currencyHex.toString().replace(/(00)+$/g, "");
|
|
159
160
|
const xlf15d = Buffer.from(hex, "hex").slice(8).toString("utf-8").slice(0, maxLength).trim();
|
|
160
|
-
if (xlf15d.match(/[a-zA-Z0-9]{3,}/) && xlf15d.
|
|
161
|
+
if (xlf15d.match(/[a-zA-Z0-9]{3,}/) && xlf15d.toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
161
162
|
return true;
|
|
162
163
|
}
|
|
163
164
|
return false;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -24,5 +24,5 @@ import parseNFTOfferFlags from "../parse/ledger/nftoken-offer-flags";
|
|
|
24
24
|
import parseNFTokenAcceptOffer from "../parse/specification/nftoken-accept-offer";
|
|
25
25
|
import parseNFTokenCancelOffer from "../parse/specification/nftoken-cancel-offer";
|
|
26
26
|
import parseNFTokenCreateOffer from "../parse/specification/nftoken-create-offer";
|
|
27
|
-
import parseURITokenFlags from "../parse/ledger/
|
|
27
|
+
import parseURITokenFlags from "../parse/ledger/uritoken-flags";
|
|
28
28
|
export { parseNFTokenMint, parseNFTokenBurn, parseNFTokenFlags, parseNFTOfferFlags, parseNFTokenAcceptOffer, parseNFTokenCancelOffer, parseNFTokenCreateOffer, parseURITokenFlags, };
|
package/lib/models/index.js
CHANGED
|
@@ -60,5 +60,5 @@ const nftoken_cancel_offer_1 = __importDefault(require("../parse/specification/n
|
|
|
60
60
|
exports.parseNFTokenCancelOffer = nftoken_cancel_offer_1.default;
|
|
61
61
|
const nftoken_create_offer_1 = __importDefault(require("../parse/specification/nftoken-create-offer"));
|
|
62
62
|
exports.parseNFTokenCreateOffer = nftoken_create_offer_1.default;
|
|
63
|
-
const
|
|
64
|
-
exports.parseURITokenFlags =
|
|
63
|
+
const uritoken_flags_1 = __importDefault(require("../parse/ledger/uritoken-flags"));
|
|
64
|
+
exports.parseURITokenFlags = uritoken_flags_1.default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseImportBlob = void 0;
|
|
4
|
+
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
|
5
|
+
const vl_1 = require("../../models/vl");
|
|
6
|
+
function parseImportBlob(blob) {
|
|
7
|
+
try {
|
|
8
|
+
const decodedBlob = JSON.parse(Buffer.from(blob, "hex").toString("utf8"));
|
|
9
|
+
const data = decodedBlob.validation.data;
|
|
10
|
+
for (const key in data) {
|
|
11
|
+
if (data.hasOwnProperty(key)) {
|
|
12
|
+
data[key] = (0, ripple_binary_codec_1.decode)(data[key]);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
ledger: decodedBlob.ledger,
|
|
17
|
+
validation: {
|
|
18
|
+
data,
|
|
19
|
+
unl: (0, vl_1.parseVL)(decodedBlob.validation.unl),
|
|
20
|
+
},
|
|
21
|
+
transaction: {
|
|
22
|
+
tx: (0, ripple_binary_codec_1.decode)(decodedBlob.transaction.blob),
|
|
23
|
+
meta: (0, ripple_binary_codec_1.decode)(decodedBlob.transaction.meta),
|
|
24
|
+
proof: decodedBlob.transaction.proof,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
return blob;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.parseImportBlob = parseImportBlob;
|
|
@@ -9,7 +9,7 @@ const nftoken_offer_changes_1 = require("./nftoken_offer_changes");
|
|
|
9
9
|
const account_nfts_1 = require("../../models/account_nfts");
|
|
10
10
|
const nftoken_flags_1 = __importDefault(require("../ledger/nftoken-flags"));
|
|
11
11
|
const nftoken_offer_flags_1 = __importDefault(require("../ledger/nftoken-offer-flags"));
|
|
12
|
-
const
|
|
12
|
+
const uritoken_flags_1 = __importDefault(require("../ledger/uritoken-flags"));
|
|
13
13
|
const common_1 = require("../../common");
|
|
14
14
|
function parseAffectedObjects(tx) {
|
|
15
15
|
return new AffectedObjects(tx).call();
|
|
@@ -118,7 +118,7 @@ class AffectedObjects {
|
|
|
118
118
|
if (affectedNode.CreatedNode) {
|
|
119
119
|
uritokens[uritokenID] = (0, common_1.removeUndefined)({
|
|
120
120
|
uritokenID,
|
|
121
|
-
flags: (0,
|
|
121
|
+
flags: (0, uritoken_flags_1.default)(node.NewFields.Flags),
|
|
122
122
|
uri: node.NewFields.URI,
|
|
123
123
|
digest: node.NewFields.Digest,
|
|
124
124
|
issuer: node.NewFields.Issuer,
|
|
@@ -130,7 +130,7 @@ class AffectedObjects {
|
|
|
130
130
|
if (affectedNode.ModifiedNode || affectedNode.DeletedNode) {
|
|
131
131
|
uritokens[uritokenID] = (0, common_1.removeUndefined)({
|
|
132
132
|
uritokenID,
|
|
133
|
-
flags: (0,
|
|
133
|
+
flags: (0, uritoken_flags_1.default)(node.FinalFields.Flags),
|
|
134
134
|
uri: node.FinalFields.URI,
|
|
135
135
|
digest: node.FinalFields.Digest,
|
|
136
136
|
issuer: node.FinalFields.Issuer,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface FormattedHooksExecutionInterface {
|
|
2
|
+
account: string;
|
|
3
|
+
emitCount: number;
|
|
4
|
+
executionIndex: number;
|
|
5
|
+
hash: string;
|
|
6
|
+
instructionCount: string;
|
|
7
|
+
result: number;
|
|
8
|
+
returnCode: string;
|
|
9
|
+
returnString: string;
|
|
10
|
+
stateChangeCount: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseHooksExecutions(tx: any): FormattedHooksExecutionInterface[] | undefined;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseHooksExecutions = void 0;
|
|
4
|
+
function parseHooksExecutions(tx) {
|
|
5
|
+
return new HooksExecutions(tx).call();
|
|
6
|
+
}
|
|
7
|
+
exports.parseHooksExecutions = parseHooksExecutions;
|
|
8
|
+
class HooksExecutions {
|
|
9
|
+
constructor(tx) {
|
|
10
|
+
this.tx = tx;
|
|
11
|
+
this.executions = [];
|
|
12
|
+
}
|
|
13
|
+
call() {
|
|
14
|
+
const hookExecutions = this.tx.meta.HookExecutions;
|
|
15
|
+
if (!hookExecutions) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
for (const execution of hookExecutions) {
|
|
19
|
+
if (execution.HookExecution) {
|
|
20
|
+
this.executions.push(this.parseHookExecution(execution.HookExecution));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (this.executions.length === 0) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return this.executions;
|
|
27
|
+
}
|
|
28
|
+
parseHookExecution(hookExecution) {
|
|
29
|
+
let hookReturnString = Buffer.from(hookExecution.HookReturnString, "hex");
|
|
30
|
+
hookReturnString = hookReturnString.subarray(0, hookReturnString.indexOf(0x00));
|
|
31
|
+
return {
|
|
32
|
+
account: hookExecution.HookAccount,
|
|
33
|
+
emitCount: hookExecution.HookEmitCount,
|
|
34
|
+
executionIndex: hookExecution.HookExecutionIndex,
|
|
35
|
+
hash: hookExecution.HookHash,
|
|
36
|
+
instructionCount: hookExecution.HookInstructionCount,
|
|
37
|
+
result: hookExecution.HookResult,
|
|
38
|
+
returnCode: hookExecution.HookReturnCode,
|
|
39
|
+
returnString: hookReturnString.toString("utf-8"),
|
|
40
|
+
stateChangeCount: hookExecution.HookStateChangeCount,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -7,3 +7,4 @@ export { parseBalanceChanges } from "./balance_changes";
|
|
|
7
7
|
export { parseLockedBalanceChanges } from "./locked_balance_changes";
|
|
8
8
|
export { parseChannelChanges } from "./channel_changes";
|
|
9
9
|
export { parseOrderbookChanges } from "./orderbook_changes";
|
|
10
|
+
export { parseHooksExecutions } from "./hooks_executions";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseOrderbookChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
|
|
3
|
+
exports.parseHooksExecutions = exports.parseOrderbookChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
|
|
4
4
|
var affected_objects_1 = require("./affected_objects");
|
|
5
5
|
Object.defineProperty(exports, "parseAffectedObjects", { enumerable: true, get: function () { return affected_objects_1.parseAffectedObjects; } });
|
|
6
6
|
var nftoken_changes_1 = require("./nftoken_changes");
|
|
@@ -19,3 +19,5 @@ var channel_changes_1 = require("./channel_changes");
|
|
|
19
19
|
Object.defineProperty(exports, "parseChannelChanges", { enumerable: true, get: function () { return channel_changes_1.parseChannelChanges; } });
|
|
20
20
|
var orderbook_changes_1 = require("./orderbook_changes");
|
|
21
21
|
Object.defineProperty(exports, "parseOrderbookChanges", { enumerable: true, get: function () { return orderbook_changes_1.parseOrderbookChanges; } });
|
|
22
|
+
var hooks_executions_1 = require("./hooks_executions");
|
|
23
|
+
Object.defineProperty(exports, "parseHooksExecutions", { enumerable: true, get: function () { return hooks_executions_1.parseHooksExecutions; } });
|
package/lib/parse/outcome.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseOutcome = void 0;
|
|
7
7
|
const index_1 = require("./outcome/index");
|
|
8
|
+
const import_1 = require("./ledger/import");
|
|
8
9
|
const amount_1 = __importDefault(require("./ledger/amount"));
|
|
9
10
|
const utils_1 = require("./utils");
|
|
10
11
|
const common_1 = require("../common");
|
|
@@ -26,7 +27,7 @@ function removeEmptyCounterpartyInOrderbookChanges(orderbookChanges) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
function parseDeliveredAmount(tx) {
|
|
29
|
-
if (
|
|
30
|
+
if (!["Import", "Payment"].includes(tx.TransactionType) || tx.meta.TransactionResult !== "tesSUCCESS") {
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
32
33
|
if (tx.meta.delivered_amount && tx.meta.delivered_amount === "unavailable") {
|
|
@@ -41,8 +42,21 @@ function parseDeliveredAmount(tx) {
|
|
|
41
42
|
if (tx.Amount && !(0, utils_1.isPartialPayment)(tx)) {
|
|
42
43
|
return (0, amount_1.default)(tx.Amount);
|
|
43
44
|
}
|
|
44
|
-
if (tx.
|
|
45
|
-
|
|
45
|
+
if (tx.TransactionType === "Import") {
|
|
46
|
+
const balanceChanges = (0, index_1.parseBalanceChanges)(tx.meta);
|
|
47
|
+
const blob = (0, import_1.parseImportBlob)(tx.Blob);
|
|
48
|
+
if (typeof blob === "string") {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const account = blob.transaction.tx.Account;
|
|
52
|
+
const balanceChange = balanceChanges[account];
|
|
53
|
+
if (!balanceChange || balanceChange.length !== 1) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
currency: balanceChange[0].currency,
|
|
58
|
+
value: balanceChange[0].value,
|
|
59
|
+
};
|
|
46
60
|
}
|
|
47
61
|
return undefined;
|
|
48
62
|
}
|
|
@@ -60,6 +74,7 @@ function parseOutcome(tx) {
|
|
|
60
74
|
const uritokenChanges = (0, index_1.parseURITokenChanges)(tx);
|
|
61
75
|
const uritokenSellOfferChanges = (0, index_1.parseURITokenSellOfferChanges)(tx);
|
|
62
76
|
const affectedObjects = (0, index_1.parseAffectedObjects)(tx);
|
|
77
|
+
const hooksExecutions = (0, index_1.parseHooksExecutions)(tx);
|
|
63
78
|
removeEmptyCounterpartyInBalanceChanges(balanceChanges);
|
|
64
79
|
removeEmptyCounterpartyInBalanceChanges(lockedBalanceChanges);
|
|
65
80
|
removeEmptyCounterpartyInOrderbookChanges(orderbookChanges);
|
|
@@ -76,6 +91,7 @@ function parseOutcome(tx) {
|
|
|
76
91
|
uritokenChanges: Object.keys(uritokenChanges).length > 0 ? uritokenChanges : undefined,
|
|
77
92
|
uritokenSellOfferChanges: Object.keys(uritokenSellOfferChanges).length > 0 ? uritokenSellOfferChanges : undefined,
|
|
78
93
|
affectedObjects: affectedObjects ? (0, common_1.removeUndefined)(affectedObjects) : undefined,
|
|
94
|
+
hooksExecutions,
|
|
79
95
|
ledgerVersion: tx.ledger_index,
|
|
80
96
|
indexInLedger: tx.meta.TransactionIndex,
|
|
81
97
|
deliveredAmount: parseDeliveredAmount(tx),
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const common_1 = require("../../common");
|
|
31
|
+
const memos_1 = __importDefault(require("../ledger/memos"));
|
|
32
|
+
const import_1 = require("../ledger/import");
|
|
33
|
+
function parseImport(tx) {
|
|
34
|
+
assert.ok(tx.TransactionType === "Import");
|
|
35
|
+
const source = {
|
|
36
|
+
address: tx.Account,
|
|
37
|
+
tag: tx.SourceTag,
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
blob: (0, import_1.parseImportBlob)(tx.Blob),
|
|
41
|
+
source: (0, common_1.removeUndefined)(source),
|
|
42
|
+
memos: (0, memos_1.default)(tx),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.default = parseImport;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const common_1 = require("../../common");
|
|
31
|
+
const memos_1 = __importDefault(require("../ledger/memos"));
|
|
32
|
+
function parseInvoke(tx) {
|
|
33
|
+
assert.ok(tx.TransactionType === "Invoke");
|
|
34
|
+
const source = {
|
|
35
|
+
address: tx.Account,
|
|
36
|
+
tag: tx.SourceTag,
|
|
37
|
+
};
|
|
38
|
+
const destination = {
|
|
39
|
+
address: tx.Destination,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
source: (0, common_1.removeUndefined)(source),
|
|
43
|
+
destination: (0, common_1.removeUndefined)(destination),
|
|
44
|
+
memos: (0, memos_1.default)(tx),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.default = parseInvoke;
|
|
@@ -10,10 +10,13 @@ import { FormattedPaymentChannelClaimSpecification, FormattedPaymentChannelCreat
|
|
|
10
10
|
import { FormattedTicketCreateSpecification } from "../v1/common/types/objects/tickets";
|
|
11
11
|
import { FormattedTrustlineSpecification } from "../v1/common/types/objects/trustlines";
|
|
12
12
|
import { FormattedNFTokenBurnSpecification, FormattedNFTokenMintSpecification, FormattedNFTokenCancelOfferSpecification, FormattedNFTokenCreateOfferSpecification, FormattedNFTokenAcceptOfferSpecification } from "../v1/common/types/objects/nftokens";
|
|
13
|
+
import { FormattedURITokenBurnSpecification, FormattedURITokenBuySpecification, FormattedURITokenCreateSellOfferSpecification, FormattedURITokenCancelSellOfferSpecification, FormattedURITokenMintSpecification } from "../v1/common/types/objects/uritokens";
|
|
14
|
+
import { FormattedImportSpecification } from "../v1/common/types/objects/import";
|
|
15
|
+
import { FormattedInvokeSpecification } from "../v1/common/types/objects/invoke";
|
|
13
16
|
import { FormattedAmendmentSpecification } from "../v1/common/types/objects/amendments";
|
|
14
17
|
import { FormattedFeeUpdateSpecification } from "../v1/common/types/objects/fees";
|
|
15
18
|
declare function parseTransactionType(type: string): string;
|
|
16
|
-
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 | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
|
|
19
|
+
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 | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification;
|
|
17
20
|
export interface FormattedTransaction {
|
|
18
21
|
type: string;
|
|
19
22
|
address: string;
|
package/lib/parse/transaction.js
CHANGED
|
@@ -33,6 +33,8 @@ const uritoken_buy_1 = __importDefault(require("./specification/uritoken-buy"));
|
|
|
33
33
|
const uritoken_cancel_sell_offer_1 = __importDefault(require("./specification/uritoken-cancel-sell-offer"));
|
|
34
34
|
const uritoken_create_sell_offer_1 = __importDefault(require("./specification/uritoken-create-sell-offer"));
|
|
35
35
|
const uritoken_mint_1 = __importDefault(require("./specification/uritoken-mint"));
|
|
36
|
+
const import_1 = __importDefault(require("./specification/import"));
|
|
37
|
+
const invoke_1 = __importDefault(require("./specification/invoke"));
|
|
36
38
|
const amendment_1 = __importDefault(require("./specification/amendment"));
|
|
37
39
|
const fee_update_1 = __importDefault(require("./specification/fee-update"));
|
|
38
40
|
const transactionTypeToType = {
|
|
@@ -65,6 +67,8 @@ const transactionTypeToType = {
|
|
|
65
67
|
URITokenCreateSellOffer: "uritokenCreateSellOffer",
|
|
66
68
|
URITokenCancelSellOffer: "uritokenCancelSellOffer",
|
|
67
69
|
URITokenBuy: "uritokenBuy",
|
|
70
|
+
Import: "import",
|
|
71
|
+
Invoke: "invoke",
|
|
68
72
|
EnableAmendment: "amendment",
|
|
69
73
|
SetFee: "feeUpdate",
|
|
70
74
|
};
|
|
@@ -100,6 +104,8 @@ const parserTypeFunc = {
|
|
|
100
104
|
uritokenCreateSellOffer: uritoken_create_sell_offer_1.default,
|
|
101
105
|
uritokenCancelSellOffer: uritoken_cancel_sell_offer_1.default,
|
|
102
106
|
uritokenMint: uritoken_mint_1.default,
|
|
107
|
+
import: import_1.default,
|
|
108
|
+
invoke: invoke_1.default,
|
|
103
109
|
amendment: amendment_1.default,
|
|
104
110
|
feeUpdate: fee_update_1.default,
|
|
105
111
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface HookExecutionObjectInterface {
|
|
2
|
+
HookExecution: HookExecutionInterface;
|
|
3
|
+
}
|
|
4
|
+
export interface HookExecutionInterface {
|
|
5
|
+
HookAccount: string;
|
|
6
|
+
HookEmitCount: number;
|
|
7
|
+
HookExecutionIndex: number;
|
|
8
|
+
HookHash: string;
|
|
9
|
+
HookInstructionCount: string;
|
|
10
|
+
HookResult: number;
|
|
11
|
+
HookReturnCode: string;
|
|
12
|
+
HookReturnString: string;
|
|
13
|
+
HookStateChangeCount: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormattedBaseSpecification } from "./specification";
|
|
2
|
+
import { FormattedSourceAddress } from "./account";
|
|
3
|
+
export type FormattedImportBlobSpecification = {
|
|
4
|
+
ledger: number;
|
|
5
|
+
validation: {
|
|
6
|
+
data: any;
|
|
7
|
+
unl: any;
|
|
8
|
+
};
|
|
9
|
+
transaction: {
|
|
10
|
+
tx: any;
|
|
11
|
+
meta: any;
|
|
12
|
+
proof: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type FormattedImportSpecification = {
|
|
16
|
+
source: FormattedSourceAddress;
|
|
17
|
+
blob: FormattedImportBlobSpecification | string;
|
|
18
|
+
} & FormattedBaseSpecification;
|
|
@@ -12,4 +12,11 @@ export * from "./settings";
|
|
|
12
12
|
export * from "./signers";
|
|
13
13
|
export * from "./transactions";
|
|
14
14
|
export * from "./trustlines";
|
|
15
|
+
export * from "./nftokens";
|
|
16
|
+
export * from "./uritokens";
|
|
17
|
+
export * from "./amendments";
|
|
18
|
+
export * from "./fees";
|
|
19
|
+
export * from "./import";
|
|
20
|
+
export * from "./invoke";
|
|
21
|
+
export * from "./hook";
|
|
15
22
|
export * from "../../../../types";
|
|
@@ -28,4 +28,11 @@ __exportStar(require("./settings"), exports);
|
|
|
28
28
|
__exportStar(require("./signers"), exports);
|
|
29
29
|
__exportStar(require("./transactions"), exports);
|
|
30
30
|
__exportStar(require("./trustlines"), exports);
|
|
31
|
+
__exportStar(require("./nftokens"), exports);
|
|
32
|
+
__exportStar(require("./uritokens"), exports);
|
|
33
|
+
__exportStar(require("./amendments"), exports);
|
|
34
|
+
__exportStar(require("./fees"), exports);
|
|
35
|
+
__exportStar(require("./import"), exports);
|
|
36
|
+
__exportStar(require("./invoke"), exports);
|
|
37
|
+
__exportStar(require("./hook"), exports);
|
|
31
38
|
__exportStar(require("../../../../types"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormattedBaseSpecification } from "./specification";
|
|
2
|
+
import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
|
|
3
|
+
export type FormattedInvokeSpecification = {
|
|
4
|
+
source: FormattedSourceAddress;
|
|
5
|
+
destination: FormattedDestinationAddress;
|
|
6
|
+
} & FormattedBaseSpecification;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
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",
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"xrpl",
|
|
18
18
|
"ws",
|
|
19
19
|
"xrp",
|
|
20
|
+
"xah",
|
|
20
21
|
"nft",
|
|
21
22
|
"xls20",
|
|
23
|
+
"xls35",
|
|
22
24
|
"unl",
|
|
23
25
|
"bithomp"
|
|
24
26
|
],
|