@lifi/sdk-provider-tron 4.1.5 → 4.1.7
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/CHANGELOG.md +16 -0
- package/README.md +9 -0
- package/dist/cjs/actions/getTronBalance.js +2 -1
- package/dist/cjs/actions/getTronBalance.js.map +1 -1
- package/dist/cjs/core/TronStepExecutor.js +8 -5
- package/dist/cjs/core/TronStepExecutor.js.map +1 -1
- package/dist/cjs/core/constants.d.ts +3 -0
- package/dist/cjs/core/constants.js +6 -0
- package/dist/cjs/core/constants.js.map +1 -1
- package/dist/cjs/core/tasks/TronCheckAllowanceTask.js +2 -1
- package/dist/cjs/core/tasks/TronCheckAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.js +11 -1
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/TronWaitForTransactionTask.js +63 -15
- package/dist/cjs/core/tasks/TronWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/isTronTransactionDropped.d.ts +22 -0
- package/dist/cjs/core/tasks/helpers/isTronTransactionDropped.js +88 -0
- package/dist/cjs/core/tasks/helpers/isTronTransactionDropped.js.map +1 -0
- package/dist/cjs/rpc/broadcastTronTransaction.d.ts +31 -0
- package/dist/cjs/rpc/broadcastTronTransaction.js +68 -0
- package/dist/cjs/rpc/broadcastTronTransaction.js.map +1 -0
- package/dist/cjs/rpc/waitForTronTxConfirmation.d.ts +5 -3
- package/dist/cjs/rpc/waitForTronTxConfirmation.js +7 -5
- package/dist/cjs/rpc/waitForTronTxConfirmation.js.map +1 -1
- package/dist/cjs/utils/trc20Abi.d.ts +10 -0
- package/dist/cjs/utils/trc20Abi.js +39 -0
- package/dist/cjs/utils/trc20Abi.js.map +1 -0
- package/dist/cjs/utils/tronSignedTransaction.d.ts +19 -0
- package/dist/cjs/utils/tronSignedTransaction.js +40 -0
- package/dist/cjs/utils/tronSignedTransaction.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/getTronBalance.d.ts.map +1 -1
- package/dist/esm/actions/getTronBalance.js +2 -1
- package/dist/esm/actions/getTronBalance.js.map +1 -1
- package/dist/esm/core/TronStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/TronStepExecutor.js +9 -6
- package/dist/esm/core/TronStepExecutor.js.map +1 -1
- package/dist/esm/core/constants.d.ts +3 -0
- package/dist/esm/core/constants.d.ts.map +1 -1
- package/dist/esm/core/constants.js +4 -1
- package/dist/esm/core/constants.js.map +1 -1
- package/dist/esm/core/tasks/TronCheckAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronCheckAllowanceTask.js +2 -1
- package/dist/esm/core/tasks/TronCheckAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/TronSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronSignAndExecuteTask.js +12 -2
- package/dist/esm/core/tasks/TronSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/TronWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronWaitForTransactionTask.js +64 -16
- package/dist/esm/core/tasks/TronWaitForTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/helpers/isTronTransactionDropped.d.ts +22 -0
- package/dist/esm/core/tasks/helpers/isTronTransactionDropped.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/isTronTransactionDropped.js +87 -0
- package/dist/esm/core/tasks/helpers/isTronTransactionDropped.js.map +1 -0
- package/dist/esm/rpc/broadcastTronTransaction.d.ts +31 -0
- package/dist/esm/rpc/broadcastTronTransaction.d.ts.map +1 -0
- package/dist/esm/rpc/broadcastTronTransaction.js +67 -0
- package/dist/esm/rpc/broadcastTronTransaction.js.map +1 -0
- package/dist/esm/rpc/waitForTronTxConfirmation.d.ts +5 -3
- package/dist/esm/rpc/waitForTronTxConfirmation.d.ts.map +1 -1
- package/dist/esm/rpc/waitForTronTxConfirmation.js +7 -5
- package/dist/esm/rpc/waitForTronTxConfirmation.js.map +1 -1
- package/dist/esm/utils/trc20Abi.d.ts +10 -0
- package/dist/esm/utils/trc20Abi.d.ts.map +1 -0
- package/dist/esm/utils/trc20Abi.js +38 -0
- package/dist/esm/utils/trc20Abi.js.map +1 -0
- package/dist/esm/utils/tronSignedTransaction.d.ts +19 -0
- package/dist/esm/utils/tronSignedTransaction.d.ts.map +1 -0
- package/dist/esm/utils/tronSignedTransaction.js +38 -0
- package/dist/esm/utils/tronSignedTransaction.js.map +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/getTronBalance.ts +2 -1
- package/src/core/TronStepExecutor.ts +29 -8
- package/src/core/constants.ts +12 -0
- package/src/core/tasks/TronCheckAllowanceTask.ts +2 -1
- package/src/core/tasks/TronSignAndExecuteTask.ts +32 -0
- package/src/core/tasks/TronWaitForTransactionTask.ts +153 -33
- package/src/core/tasks/helpers/isTronTransactionDropped.ts +159 -0
- package/src/rpc/broadcastTronTransaction.ts +92 -0
- package/src/rpc/waitForTronTxConfirmation.ts +13 -5
- package/src/utils/trc20Abi.ts +26 -0
- package/src/utils/tronSignedTransaction.ts +53 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rpc_callTronRpcsWithRetry = require("./callTronRpcsWithRetry.js");
|
|
3
|
+
const require_utils_stripHexPrefix = require("../utils/stripHexPrefix.js");
|
|
4
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
5
|
+
//#region src/rpc/broadcastTronTransaction.ts
|
|
6
|
+
/**
|
|
7
|
+
* The codes that java-tron's `Wallet.broadcastTransaction` returns before it
|
|
8
|
+
* puts the transaction into the node's pending pool: a node that answers one
|
|
9
|
+
* of them does not hold the transaction. Any other code proves nothing: for
|
|
10
|
+
* example, java-tron returns `NOT_ENOUGH_EFFECTIVE_CONNECTION` after the push,
|
|
11
|
+
* and `OTHER_ERROR` does not say at which step the broadcast failed.
|
|
12
|
+
*/
|
|
13
|
+
const PRE_PUSH_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
14
|
+
"SIGERROR",
|
|
15
|
+
"BLOCK_UNSOLIDIFIED",
|
|
16
|
+
"NO_CONNECTION",
|
|
17
|
+
"SERVER_BUSY",
|
|
18
|
+
"CONTRACT_VALIDATE_ERROR",
|
|
19
|
+
"CONTRACT_EXE_ERROR",
|
|
20
|
+
"BANDWITH_ERROR",
|
|
21
|
+
"BANDWIDTH_ERROR",
|
|
22
|
+
"TAPOS_ERROR",
|
|
23
|
+
"TOO_BIG_TRANSACTION_ERROR",
|
|
24
|
+
"TRANSACTION_EXPIRATION_ERROR"
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* Broadcasts a signed transaction through the Tron RPCs in turn.
|
|
28
|
+
*
|
|
29
|
+
* - `accepted`: a node took the transaction. `DUP_TRANSACTION_ERROR` counts as
|
|
30
|
+
* accepted: the node already has it.
|
|
31
|
+
* - `rejected`: every node refused it with a code of
|
|
32
|
+
* `PRE_PUSH_REJECTION_CODES`, or no node was tried. No node holds the
|
|
33
|
+
* transaction.
|
|
34
|
+
* - `unknown`: at least one attempt failed in another way: a network error, a
|
|
35
|
+
* different code (for example `NOT_ENOUGH_EFFECTIVE_CONNECTION`, which comes
|
|
36
|
+
* after the push) or an answer without a code (such as an `{ Error }` body).
|
|
37
|
+
* That node may hold the transaction.
|
|
38
|
+
*
|
|
39
|
+
* `error` is what `callTronRpcsWithRetry` threw, unchanged.
|
|
40
|
+
*/
|
|
41
|
+
async function broadcastTronTransaction(client, signedTransaction) {
|
|
42
|
+
let attempts = 0;
|
|
43
|
+
let rejections = 0;
|
|
44
|
+
try {
|
|
45
|
+
const broadcastResult = await require_rpc_callTronRpcsWithRetry.callTronRpcsWithRetry(client, async (tronWeb) => {
|
|
46
|
+
attempts++;
|
|
47
|
+
const result = await tronWeb.trx.sendRawTransaction(signedTransaction);
|
|
48
|
+
if (!result.result && String(result.code) !== "DUP_TRANSACTION_ERROR") {
|
|
49
|
+
if (PRE_PUSH_REJECTION_CODES.has(String(result.code))) rejections++;
|
|
50
|
+
throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, `Transaction broadcast failed: ${result.code || "Unknown error"}`);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
status: "accepted",
|
|
56
|
+
txHash: require_utils_stripHexPrefix.stripHexPrefix(broadcastResult.transaction?.txID ?? signedTransaction.txID)
|
|
57
|
+
};
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
status: rejections === attempts ? "rejected" : "unknown",
|
|
61
|
+
error
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.broadcastTronTransaction = broadcastTronTransaction;
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=broadcastTronTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcastTronTransaction.js","names":["callTronRpcsWithRetry","TransactionError","LiFiErrorCode","stripHexPrefix"],"sources":["../../../src/rpc/broadcastTronTransaction.ts"],"sourcesContent":["import { LiFiErrorCode, type SDKClient, TransactionError } from '@lifi/sdk'\nimport type { SignedTransaction } from '@tronweb3/tronwallet-abstract-adapter'\nimport { stripHexPrefix } from '../utils/stripHexPrefix.js'\nimport { callTronRpcsWithRetry } from './callTronRpcsWithRetry.js'\n\nexport type TronBroadcastResult =\n | { status: 'accepted'; txHash: string }\n | { status: 'rejected'; error: unknown }\n | { status: 'unknown'; error: unknown }\n\n/**\n * The codes that java-tron's `Wallet.broadcastTransaction` returns before it\n * puts the transaction into the node's pending pool: a node that answers one\n * of them does not hold the transaction. Any other code proves nothing: for\n * example, java-tron returns `NOT_ENOUGH_EFFECTIVE_CONNECTION` after the push,\n * and `OTHER_ERROR` does not say at which step the broadcast failed.\n */\nconst PRE_PUSH_REJECTION_CODES: ReadonlySet<string> = new Set([\n 'SIGERROR',\n 'BLOCK_UNSOLIDIFIED',\n 'NO_CONNECTION',\n 'SERVER_BUSY',\n 'CONTRACT_VALIDATE_ERROR',\n 'CONTRACT_EXE_ERROR',\n // java-tron's spelling (api.proto `BANDWITH_ERROR = 4`). The HTTP API sends\n // the enum name. `BANDWIDTH_ERROR` is a harmless alias.\n 'BANDWITH_ERROR',\n 'BANDWIDTH_ERROR',\n 'TAPOS_ERROR',\n 'TOO_BIG_TRANSACTION_ERROR',\n 'TRANSACTION_EXPIRATION_ERROR',\n])\n\n/**\n * Broadcasts a signed transaction through the Tron RPCs in turn.\n *\n * - `accepted`: a node took the transaction. `DUP_TRANSACTION_ERROR` counts as\n * accepted: the node already has it.\n * - `rejected`: every node refused it with a code of\n * `PRE_PUSH_REJECTION_CODES`, or no node was tried. No node holds the\n * transaction.\n * - `unknown`: at least one attempt failed in another way: a network error, a\n * different code (for example `NOT_ENOUGH_EFFECTIVE_CONNECTION`, which comes\n * after the push) or an answer without a code (such as an `{ Error }` body).\n * That node may hold the transaction.\n *\n * `error` is what `callTronRpcsWithRetry` threw, unchanged.\n */\nexport async function broadcastTronTransaction(\n client: SDKClient,\n signedTransaction: SignedTransaction\n): Promise<TronBroadcastResult> {\n let attempts = 0\n let rejections = 0\n try {\n const broadcastResult = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n attempts++\n const result = await tronWeb.trx.sendRawTransaction(signedTransaction)\n\n if (!result.result && String(result.code) !== 'DUP_TRANSACTION_ERROR') {\n // Only a pre-push code is a definite rejection. The message is\n // never read.\n if (PRE_PUSH_REJECTION_CODES.has(String(result.code))) {\n rejections++\n }\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n `Transaction broadcast failed: ${result.code || 'Unknown error'}`\n )\n }\n\n return result\n }\n )\n\n // DUP_TRANSACTION_ERROR responses omit the `transaction` field — fall back\n // to the txID computed locally from the signed transaction in that case.\n return {\n status: 'accepted',\n txHash: stripHexPrefix(\n broadcastResult.transaction?.txID ?? signedTransaction.txID\n ),\n }\n } catch (error) {\n return {\n status: rejections === attempts ? 'rejected' : 'unknown',\n error,\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,2CAAgD,IAAI,IAAI;CAC5D;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;;;;;;;;AAiBD,eAAsB,yBACpB,QACA,mBAC8B;CAC9B,IAAI,WAAW;CACf,IAAI,aAAa;CACjB,IAAI;EACF,MAAM,kBAAkB,MAAMA,kCAAAA,sBAC5B,QACA,OAAO,YAAY;GACjB;GACA,MAAM,SAAS,MAAM,QAAQ,IAAI,mBAAmB,iBAAiB;GAErE,IAAI,CAAC,OAAO,UAAU,OAAO,OAAO,IAAI,MAAM,yBAAyB;IAGrE,IAAI,yBAAyB,IAAI,OAAO,OAAO,IAAI,CAAC,GAClD;IAEF,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,mBACd,iCAAiC,OAAO,QAAQ,iBAClD;GACF;GAEA,OAAO;EACT,CACF;EAIA,OAAO;GACL,QAAQ;GACR,QAAQC,6BAAAA,eACN,gBAAgB,aAAa,QAAQ,kBAAkB,IACzD;EACF;CACF,SAAS,OAAO;EACd,OAAO;GACL,QAAQ,eAAe,WAAW,aAAa;GAC/C;EACF;CACF;AACF"}
|
|
@@ -6,9 +6,11 @@ import { SDKClient } from "@lifi/sdk";
|
|
|
6
6
|
* Tron marks a failed execution with a top-level `result: 'FAILED'` (omitted on
|
|
7
7
|
* success) and puts the reason in `receipt.result`; both are checked. Throws
|
|
8
8
|
* `TransactionError` without retry on failure (`InsufficientFunds` for
|
|
9
|
-
* OUT_OF_ENERGY, `TransactionFailed` otherwise)
|
|
10
|
-
* `TRON_POLL_MAX_ERROR_RETRIES` transient RPC errors
|
|
11
|
-
* `TRON_POLL_MAX_POLLS`, since `waitForResult`'s
|
|
9
|
+
* OUT_OF_ENERGY, `TransactionFailed` otherwise); these errors are marked
|
|
10
|
+
* `final`. Tolerates up to `TRON_POLL_MAX_ERROR_RETRIES` transient RPC errors
|
|
11
|
+
* and caps total polls at `TRON_POLL_MAX_POLLS`, since `waitForResult`'s
|
|
12
|
+
* maxRetries counts errors only. The poll timeout and RPC errors are not
|
|
13
|
+
* final: the transaction may still be included.
|
|
12
14
|
*/
|
|
13
15
|
export declare function waitForTronTxConfirmation(client: SDKClient, txHash: string, onChainFailureMessage?: string): Promise<void>;
|
|
14
16
|
//#endregion
|
|
@@ -6,8 +6,8 @@ let _lifi_sdk = require("@lifi/sdk");
|
|
|
6
6
|
const NON_FAILURE_CONTRACT_RESULTS = /* @__PURE__ */ new Set(["SUCCESS", "DEFAULT"]);
|
|
7
7
|
function createOnChainFailureError(messageStem, reason) {
|
|
8
8
|
const stem = messageStem.replace(/\.$/, "");
|
|
9
|
-
if (reason === "OUT_OF_ENERGY") return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.InsufficientFunds, `${stem}: ${reason}. The account may need more TRX to cover the energy fee
|
|
10
|
-
return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, reason ? `${stem}: ${reason}.` : `${stem}
|
|
9
|
+
if (reason === "OUT_OF_ENERGY") return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.InsufficientFunds, `${stem}: ${reason}. The account may need more TRX to cover the energy fee.`, void 0, { final: true });
|
|
10
|
+
return new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, reason ? `${stem}: ${reason}.` : `${stem}.`, void 0, { final: true });
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Polls getTransactionInfo until the transaction is indexed, then resolves.
|
|
@@ -15,9 +15,11 @@ function createOnChainFailureError(messageStem, reason) {
|
|
|
15
15
|
* Tron marks a failed execution with a top-level `result: 'FAILED'` (omitted on
|
|
16
16
|
* success) and puts the reason in `receipt.result`; both are checked. Throws
|
|
17
17
|
* `TransactionError` without retry on failure (`InsufficientFunds` for
|
|
18
|
-
* OUT_OF_ENERGY, `TransactionFailed` otherwise)
|
|
19
|
-
* `TRON_POLL_MAX_ERROR_RETRIES` transient RPC errors
|
|
20
|
-
* `TRON_POLL_MAX_POLLS`, since `waitForResult`'s
|
|
18
|
+
* OUT_OF_ENERGY, `TransactionFailed` otherwise); these errors are marked
|
|
19
|
+
* `final`. Tolerates up to `TRON_POLL_MAX_ERROR_RETRIES` transient RPC errors
|
|
20
|
+
* and caps total polls at `TRON_POLL_MAX_POLLS`, since `waitForResult`'s
|
|
21
|
+
* maxRetries counts errors only. The poll timeout and RPC errors are not
|
|
22
|
+
* final: the transaction may still be included.
|
|
21
23
|
*/
|
|
22
24
|
async function waitForTronTxConfirmation(client, txHash, onChainFailureMessage = "Transaction failed on-chain") {
|
|
23
25
|
let polls = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForTronTxConfirmation.js","names":["TransactionError","LiFiErrorCode","waitForResult","callTronRpcsWithRetry","TRON_POLL_INTERVAL_MS"],"sources":["../../../src/rpc/waitForTronTxConfirmation.ts"],"sourcesContent":["import {\n LiFiErrorCode,\n type SDKClient,\n TransactionError,\n waitForResult,\n} from '@lifi/sdk'\nimport {\n TRON_POLL_INTERVAL_MS,\n TRON_POLL_MAX_ERROR_RETRIES,\n TRON_POLL_MAX_POLLS,\n} from '../core/constants.js'\nimport { callTronRpcsWithRetry } from './callTronRpcsWithRetry.js'\n\n// `receipt.result` is java-tron's `Transaction.Result.contractResult` enum. It has\n// no FAILED member: SUCCESS and DEFAULT (enum 0) mean success, anything else is\n// an execution failure (REVERT, OUT_OF_ENERGY, OUT_OF_TIME, …).\nconst NON_FAILURE_CONTRACT_RESULTS = new Set(['SUCCESS', 'DEFAULT'])\n\nfunction createOnChainFailureError(\n messageStem: string,\n reason?: string\n): TransactionError {\n const stem = messageStem.replace(/\\.$/, '')\n if (reason === 'OUT_OF_ENERGY') {\n return new TransactionError(\n LiFiErrorCode.InsufficientFunds,\n `${stem}: ${reason}. The account may need more TRX to cover the energy fee
|
|
1
|
+
{"version":3,"file":"waitForTronTxConfirmation.js","names":["TransactionError","LiFiErrorCode","waitForResult","callTronRpcsWithRetry","TRON_POLL_INTERVAL_MS"],"sources":["../../../src/rpc/waitForTronTxConfirmation.ts"],"sourcesContent":["import {\n LiFiErrorCode,\n type SDKClient,\n TransactionError,\n waitForResult,\n} from '@lifi/sdk'\nimport {\n TRON_POLL_INTERVAL_MS,\n TRON_POLL_MAX_ERROR_RETRIES,\n TRON_POLL_MAX_POLLS,\n} from '../core/constants.js'\nimport { callTronRpcsWithRetry } from './callTronRpcsWithRetry.js'\n\n// `receipt.result` is java-tron's `Transaction.Result.contractResult` enum. It has\n// no FAILED member: SUCCESS and DEFAULT (enum 0) mean success, anything else is\n// an execution failure (REVERT, OUT_OF_ENERGY, OUT_OF_TIME, …).\nconst NON_FAILURE_CONTRACT_RESULTS = new Set(['SUCCESS', 'DEFAULT'])\n\nfunction createOnChainFailureError(\n messageStem: string,\n reason?: string\n): TransactionError {\n const stem = messageStem.replace(/\\.$/, '')\n // The transaction is in a block and failed there: the outcome is final, so\n // \"Try again\" may sign a new transaction.\n if (reason === 'OUT_OF_ENERGY') {\n return new TransactionError(\n LiFiErrorCode.InsufficientFunds,\n `${stem}: ${reason}. The account may need more TRX to cover the energy fee.`,\n undefined,\n { final: true }\n )\n }\n return new TransactionError(\n LiFiErrorCode.TransactionFailed,\n reason ? `${stem}: ${reason}.` : `${stem}.`,\n undefined,\n { final: true }\n )\n}\n\n/**\n * Polls getTransactionInfo until the transaction is indexed, then resolves.\n *\n * Tron marks a failed execution with a top-level `result: 'FAILED'` (omitted on\n * success) and puts the reason in `receipt.result`; both are checked. Throws\n * `TransactionError` without retry on failure (`InsufficientFunds` for\n * OUT_OF_ENERGY, `TransactionFailed` otherwise); these errors are marked\n * `final`. Tolerates up to `TRON_POLL_MAX_ERROR_RETRIES` transient RPC errors\n * and caps total polls at `TRON_POLL_MAX_POLLS`, since `waitForResult`'s\n * maxRetries counts errors only. The poll timeout and RPC errors are not\n * final: the transaction may still be included.\n */\nexport async function waitForTronTxConfirmation(\n client: SDKClient,\n txHash: string,\n onChainFailureMessage = 'Transaction failed on-chain'\n): Promise<void> {\n let polls = 0\n await waitForResult(\n async () => {\n if (++polls > TRON_POLL_MAX_POLLS) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Transaction confirmation timeout.'\n )\n }\n const txInfo = await callTronRpcsWithRetry(client, (tronWeb) =>\n tronWeb.trx.getTransactionInfo(txHash)\n )\n if (!txInfo?.id) {\n return undefined\n }\n const contractResult = txInfo.receipt?.result\n const isContractFailure =\n !!contractResult && !NON_FAILURE_CONTRACT_RESULTS.has(contractResult)\n if (txInfo.result === 'FAILED' || isContractFailure) {\n throw createOnChainFailureError(\n onChainFailureMessage,\n isContractFailure ? contractResult : undefined\n )\n }\n return txInfo\n },\n TRON_POLL_INTERVAL_MS,\n TRON_POLL_MAX_ERROR_RETRIES,\n (_count, error) => !(error instanceof TransactionError)\n )\n}\n"],"mappings":";;;;;AAgBA,MAAM,+CAA+B,IAAI,IAAI,CAAC,WAAW,SAAS,CAAC;AAEnE,SAAS,0BACP,aACA,QACkB;CAClB,MAAM,OAAO,YAAY,QAAQ,OAAO,EAAE;CAG1C,IAAI,WAAW,iBACb,OAAO,IAAIA,UAAAA,iBACTC,UAAAA,cAAc,mBACd,GAAG,KAAK,IAAI,OAAO,2DACnB,KAAA,GACA,EAAE,OAAO,KAAK,CAChB;CAEF,OAAO,IAAID,UAAAA,iBACTC,UAAAA,cAAc,mBACd,SAAS,GAAG,KAAK,IAAI,OAAO,KAAK,GAAG,KAAK,IACzC,KAAA,GACA,EAAE,OAAO,KAAK,CAChB;AACF;;;;;;;;;;;;;AAcA,eAAsB,0BACpB,QACA,QACA,wBAAwB,+BACT;CACf,IAAI,QAAQ;CACZ,OAAA,GAAMC,UAAAA,cAAAA,CACJ,YAAY;EACV,IAAI,EAAE,QAAA,IACJ,MAAM,IAAIF,UAAAA,iBACRC,UAAAA,cAAc,mBACd,mCACF;EAEF,MAAM,SAAS,MAAME,kCAAAA,sBAAsB,SAAS,YAClD,QAAQ,IAAI,mBAAmB,MAAM,CACvC;EACA,IAAI,CAAC,QAAQ,IACX;EAEF,MAAM,iBAAiB,OAAO,SAAS;EACvC,MAAM,oBACJ,CAAC,CAAC,kBAAkB,CAAC,6BAA6B,IAAI,cAAc;EACtE,IAAI,OAAO,WAAW,YAAY,mBAChC,MAAM,0BACJ,uBACA,oBAAoB,iBAAiB,KAAA,CACvC;EAEF,OAAO;CACT,GACAC,uBAAAA,uBAAAA,IAEC,QAAQ,UAAU,EAAE,iBAAiBJ,UAAAA,iBACxC;AACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Types } from "tronweb";
|
|
2
|
+
//#region src/utils/trc20Abi.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The TRC-20 reads the SDK makes. With a static ABI, `tronWeb.contract(abi,
|
|
5
|
+
* address)` needs no `wallet/getcontract` request, and TronWeb does not keep
|
|
6
|
+
* the token's ABI and bytecode in `trx.cache.contracts`, which never shrinks.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TRC20_ABI: Types.ContractAbiInterface;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=trc20Abi.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utils/trc20Abi.ts
|
|
3
|
+
/**
|
|
4
|
+
* The TRC-20 reads the SDK makes. With a static ABI, `tronWeb.contract(abi,
|
|
5
|
+
* address)` needs no `wallet/getcontract` request, and TronWeb does not keep
|
|
6
|
+
* the token's ABI and bytecode in `trx.cache.contracts`, which never shrinks.
|
|
7
|
+
*/
|
|
8
|
+
const TRC20_ABI = [{
|
|
9
|
+
inputs: [{
|
|
10
|
+
name: "owner",
|
|
11
|
+
type: "address"
|
|
12
|
+
}],
|
|
13
|
+
name: "balanceOf",
|
|
14
|
+
outputs: [{
|
|
15
|
+
name: "",
|
|
16
|
+
type: "uint256"
|
|
17
|
+
}],
|
|
18
|
+
stateMutability: "view",
|
|
19
|
+
type: "function"
|
|
20
|
+
}, {
|
|
21
|
+
inputs: [{
|
|
22
|
+
name: "owner",
|
|
23
|
+
type: "address"
|
|
24
|
+
}, {
|
|
25
|
+
name: "spender",
|
|
26
|
+
type: "address"
|
|
27
|
+
}],
|
|
28
|
+
name: "allowance",
|
|
29
|
+
outputs: [{
|
|
30
|
+
name: "",
|
|
31
|
+
type: "uint256"
|
|
32
|
+
}],
|
|
33
|
+
stateMutability: "view",
|
|
34
|
+
type: "function"
|
|
35
|
+
}];
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.TRC20_ABI = TRC20_ABI;
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=trc20Abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trc20Abi.js","names":[],"sources":["../../../src/utils/trc20Abi.ts"],"sourcesContent":["import type { Types } from 'tronweb'\n\n/**\n * The TRC-20 reads the SDK makes. With a static ABI, `tronWeb.contract(abi,\n * address)` needs no `wallet/getcontract` request, and TronWeb does not keep\n * the token's ABI and bytecode in `trx.cache.contracts`, which never shrinks.\n */\nexport const TRC20_ABI: Types.ContractAbiInterface = [\n {\n inputs: [{ name: 'owner', type: 'address' }],\n name: 'balanceOf',\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n ],\n name: 'allowance',\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n]\n"],"mappings":";;;;;;;AAOA,MAAa,YAAwC,CACnD;CACE,QAAQ,CAAC;EAAE,MAAM;EAAS,MAAM;CAAU,CAAC;CAC3C,MAAM;CACN,SAAS,CAAC;EAAE,MAAM;EAAI,MAAM;CAAU,CAAC;CACvC,iBAAiB;CACjB,MAAM;AACR,GACA;CACE,QAAQ,CACN;EAAE,MAAM;EAAS,MAAM;CAAU,GACjC;EAAE,MAAM;EAAW,MAAM;CAAU,CACrC;CACA,MAAM;CACN,SAAS,CAAC;EAAE,MAAM;EAAI,MAAM;CAAU,CAAC;CACvC,iBAAiB;CACjB,MAAM;AACR,CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SignedTransaction } from "@tronweb3/tronwallet-abstract-adapter";
|
|
2
|
+
//#region src/utils/tronSignedTransaction.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reads a signed transaction back from `ExecutionAction.txHex`.
|
|
5
|
+
*
|
|
6
|
+
* Returns `undefined` unless the value carries everything a resume needs: the
|
|
7
|
+
* `txID` to look the transaction up, a signature to resend it and
|
|
8
|
+
* `raw_data.expiration` to tell when it can no longer land.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseTronSignedTransaction(txHex: string): SignedTransaction | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Serializes a signed transaction for `ExecutionAction.txHex`.
|
|
13
|
+
*
|
|
14
|
+
* Returns `undefined` when the result would not read back with
|
|
15
|
+
* `parseTronSignedTransaction`, so a stored value is always usable on resume.
|
|
16
|
+
*/
|
|
17
|
+
export declare function serializeTronSignedTransaction(signedTransaction: SignedTransaction): string | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=tronSignedTransaction.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_stripHexPrefix = require("./stripHexPrefix.js");
|
|
3
|
+
//#region src/utils/tronSignedTransaction.ts
|
|
4
|
+
const TX_ID_PATTERN = /^[0-9a-f]{64}$/i;
|
|
5
|
+
/**
|
|
6
|
+
* Reads a signed transaction back from `ExecutionAction.txHex`.
|
|
7
|
+
*
|
|
8
|
+
* Returns `undefined` unless the value carries everything a resume needs: the
|
|
9
|
+
* `txID` to look the transaction up, a signature to resend it and
|
|
10
|
+
* `raw_data.expiration` to tell when it can no longer land.
|
|
11
|
+
*/
|
|
12
|
+
function parseTronSignedTransaction(txHex) {
|
|
13
|
+
let value;
|
|
14
|
+
try {
|
|
15
|
+
value = JSON.parse(txHex);
|
|
16
|
+
} catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!value || typeof value !== "object") return;
|
|
20
|
+
const { txID, signature, raw_data } = value;
|
|
21
|
+
if (typeof txID !== "string" || !TX_ID_PATTERN.test(require_utils_stripHexPrefix.stripHexPrefix(txID))) return;
|
|
22
|
+
if (!Array.isArray(signature) || !signature.length) return;
|
|
23
|
+
if (typeof raw_data?.expiration !== "number" || !Number.isFinite(raw_data.expiration)) return;
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Serializes a signed transaction for `ExecutionAction.txHex`.
|
|
28
|
+
*
|
|
29
|
+
* Returns `undefined` when the result would not read back with
|
|
30
|
+
* `parseTronSignedTransaction`, so a stored value is always usable on resume.
|
|
31
|
+
*/
|
|
32
|
+
function serializeTronSignedTransaction(signedTransaction) {
|
|
33
|
+
const txHex = JSON.stringify(signedTransaction);
|
|
34
|
+
return txHex && parseTronSignedTransaction(txHex) ? txHex : void 0;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.parseTronSignedTransaction = parseTronSignedTransaction;
|
|
38
|
+
exports.serializeTronSignedTransaction = serializeTronSignedTransaction;
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=tronSignedTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tronSignedTransaction.js","names":["stripHexPrefix"],"sources":["../../../src/utils/tronSignedTransaction.ts"],"sourcesContent":["import type { SignedTransaction } from '@tronweb3/tronwallet-abstract-adapter'\nimport { stripHexPrefix } from './stripHexPrefix.js'\n\n// A txID is the SHA-256 of `raw_data_hex`: 32 bytes, 64 hex characters.\nconst TX_ID_PATTERN = /^[0-9a-f]{64}$/i\n\n/**\n * Reads a signed transaction back from `ExecutionAction.txHex`.\n *\n * Returns `undefined` unless the value carries everything a resume needs: the\n * `txID` to look the transaction up, a signature to resend it and\n * `raw_data.expiration` to tell when it can no longer land.\n */\nexport function parseTronSignedTransaction(\n txHex: string\n): SignedTransaction | undefined {\n let value: unknown\n try {\n value = JSON.parse(txHex)\n } catch {\n return undefined\n }\n if (!value || typeof value !== 'object') {\n return undefined\n }\n const { txID, signature, raw_data } = value as Partial<SignedTransaction>\n if (typeof txID !== 'string' || !TX_ID_PATTERN.test(stripHexPrefix(txID))) {\n return undefined\n }\n if (!Array.isArray(signature) || !signature.length) {\n return undefined\n }\n if (\n typeof raw_data?.expiration !== 'number' ||\n !Number.isFinite(raw_data.expiration)\n ) {\n return undefined\n }\n return value as SignedTransaction\n}\n\n/**\n * Serializes a signed transaction for `ExecutionAction.txHex`.\n *\n * Returns `undefined` when the result would not read back with\n * `parseTronSignedTransaction`, so a stored value is always usable on resume.\n */\nexport function serializeTronSignedTransaction(\n signedTransaction: SignedTransaction\n): string | undefined {\n const txHex = JSON.stringify(signedTransaction) as string | undefined\n return txHex && parseTronSignedTransaction(txHex) ? txHex : undefined\n}\n"],"mappings":";;;AAIA,MAAM,gBAAgB;;;;;;;;AAStB,SAAgB,2BACd,OAC+B;CAC/B,IAAI;CACJ,IAAI;EACF,QAAQ,KAAK,MAAM,KAAK;CAC1B,QAAQ;EACN;CACF;CACA,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B;CAEF,MAAM,EAAE,MAAM,WAAW,aAAa;CACtC,IAAI,OAAO,SAAS,YAAY,CAAC,cAAc,KAAKA,6BAAAA,eAAe,IAAI,CAAC,GACtE;CAEF,IAAI,CAAC,MAAM,QAAQ,SAAS,KAAK,CAAC,UAAU,QAC1C;CAEF,IACE,OAAO,UAAU,eAAe,YAChC,CAAC,OAAO,SAAS,SAAS,UAAU,GAEpC;CAEF,OAAO;AACT;;;;;;;AAQA,SAAgB,+BACd,mBACoB;CACpB,MAAM,QAAQ,KAAK,UAAU,iBAAiB;CAC9C,OAAO,SAAS,2BAA2B,KAAK,IAAI,QAAQ,KAAA;AAC9D"}
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-tron'\nexport const version = '4.1.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-tron'\nexport const version = '4.1.7'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTronBalance.d.ts","names":[],"sources":["../../../src/actions/getTronBalance.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getTronBalance.d.ts","names":[],"sources":["../../../src/actions/getTronBalance.ts"],"mappings":";;qBAiBa,iBACX,QAAQ,WACR,uBACA,QAAQ,SACR,gCACC,QAAQ"}
|
|
@@ -3,6 +3,7 @@ import { callTronRpcsWithRetry } from "../rpc/callTronRpcsWithRetry.js";
|
|
|
3
3
|
import { encodeAddressCalldata, toEvmHex } from "../utils/address.js";
|
|
4
4
|
import { isZeroAddress } from "../utils/isZeroAddress.js";
|
|
5
5
|
import { multicall3Abi } from "../utils/multicall3Abi.js";
|
|
6
|
+
import { TRC20_ABI } from "../utils/trc20Abi.js";
|
|
6
7
|
import { getMulticallAddress } from "./getMulticallAddress.js";
|
|
7
8
|
import { withDedupe } from "@lifi/sdk";
|
|
8
9
|
import { TronWeb } from "tronweb";
|
|
@@ -63,7 +64,7 @@ const getTronBalanceDefault = async (client, tokens, walletAddress) => {
|
|
|
63
64
|
const queue = tokens.map((token) => {
|
|
64
65
|
if (isZeroAddress(token.address)) return withDedupe(async () => BigInt(await tronWeb.trx.getBalance(walletAddress)), { id: `${getTronBalanceDefault.name}.getBalance.${walletAddress}.${host}` });
|
|
65
66
|
return withDedupe(async () => {
|
|
66
|
-
const balance = await
|
|
67
|
+
const balance = await tronWeb.contract(TRC20_ABI, token.address).balanceOf(walletAddress).call({ from: walletAddress });
|
|
67
68
|
return BigInt(balance.toString());
|
|
68
69
|
}, { id: `${getTronBalanceDefault.name}.balanceOf.${token.address}.${walletAddress}.${host}` });
|
|
69
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTronBalance.js","names":[],"sources":["../../../src/actions/getTronBalance.ts"],"sourcesContent":["import type { SDKClient, Token, TokenAmount } from '@lifi/sdk'\nimport { withDedupe } from '@lifi/sdk'\nimport { TronWeb } from 'tronweb'\nimport { DEFAULT_MULTICALL_BATCH_SIZE } from '../core/constants.js'\nimport { callTronRpcsWithRetry } from '../rpc/callTronRpcsWithRetry.js'\nimport { encodeAddressCalldata, toEvmHex } from '../utils/address.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { multicall3Abi } from '../utils/multicall3Abi.js'\nimport { getMulticallAddress } from './getMulticallAddress.js'\n\nconst BALANCE_OF_SELECTOR = TronWeb.sha3('balanceOf(address)').slice(2, 10)\nconst GET_ETH_BALANCE_SELECTOR = TronWeb.sha3('getEthBalance(address)').slice(\n 2,\n 10\n)\n\nexport const getTronBalance = async (\n client: SDKClient,\n walletAddress: string,\n tokens: Token[],\n multicallBatchSize: number = DEFAULT_MULTICALL_BATCH_SIZE\n): Promise<TokenAmount[]> => {\n if (tokens.length === 0) {\n return []\n }\n const { chainId } = tokens[0]\n for (const token of tokens) {\n if (token.chainId !== chainId) {\n console.warn('Requested tokens have to be on the same chain.')\n }\n }\n\n const multicallAddress = await getMulticallAddress(client, chainId)\n\n if (multicallAddress && tokens.length > 1) {\n return getTronBalanceMulticall(\n client,\n tokens,\n walletAddress,\n multicallAddress,\n multicallBatchSize\n )\n }\n\n return getTronBalanceDefault(client, tokens, walletAddress)\n}\n\nconst getTronBalanceMulticall = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string,\n multicallAddress: string,\n batchSize: number\n): Promise<TokenAmount[]> => {\n const walletHex = toEvmHex(walletAddress)\n const multicallHex = toEvmHex(multicallAddress)\n\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const contract = tronWeb.contract(multicall3Abi, multicallAddress)\n\n // TronWeb encodes tuples positionally: [target, allowFailure, callData]\n const allCalls = tokens.map((token) => {\n const isNative = isZeroAddress(token.address)\n return [\n isNative ? multicallHex : toEvmHex(token.address),\n true,\n encodeAddressCalldata(\n isNative ? GET_ETH_BALANCE_SELECTOR : BALANCE_OF_SELECTOR,\n walletHex\n ),\n ]\n })\n\n // Chunk calls to avoid CPU timeout on Tron nodes\n const batches: (typeof allCalls)[] = []\n for (let i = 0; i < allCalls.length; i += batchSize) {\n batches.push(allCalls.slice(i, i + batchSize))\n }\n\n const [block, ...batchResults] = await Promise.all([\n tronWeb.trx.getCurrentBlock(),\n ...batches.map((batch, idx) =>\n contract\n .aggregate3(batch)\n .call({ from: walletAddress })\n // TronWeb wraps the single return value in an extra array\n .then((r: unknown[]) => r[0] as Array<[boolean, string]>)\n .catch((error: Error) => {\n console.warn(\n `[getTronBalance] batch ${idx + 1}/${batches.length} failed:`,\n error.message\n )\n return batch.map(() => [false, '0x'] as [boolean, string])\n })\n ),\n ])\n\n const blockNumber = block.block_header?.raw_data?.number\n return [\n blockNumber !== undefined ? BigInt(blockNumber) : undefined,\n batchResults.flat(),\n ]\n }\n )\n\n return tokens.map((token, i) => {\n // Guard against an unexpected length mismatch between tokens and flattened batch results.\n const entry = results[i] as [boolean, string] | undefined\n if (!entry) {\n return { ...token, blockNumber }\n }\n const [success, returnData] = entry\n if (!success) {\n // RPC failure: amount is omitted (undefined)\n // Consumers must treat a missing amount as \"balance unavailable\", not zero.\n return { ...token, blockNumber }\n }\n return { ...token, amount: BigInt(returnData), blockNumber }\n })\n}\n\nconst getTronBalanceDefault = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string\n): Promise<TokenAmount[]> => {\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const host = tronWeb.fullNode.host\n const queue: Promise<bigint>[] = tokens.map((token) => {\n if (isZeroAddress(token.address)) {\n return withDedupe(\n async () => BigInt(await tronWeb.trx.getBalance(walletAddress)),\n {\n id: `${getTronBalanceDefault.name}.getBalance.${walletAddress}.${host}`,\n }\n )\n }\n return withDedupe(\n async () => {\n const contract =
|
|
1
|
+
{"version":3,"file":"getTronBalance.js","names":[],"sources":["../../../src/actions/getTronBalance.ts"],"sourcesContent":["import type { SDKClient, Token, TokenAmount } from '@lifi/sdk'\nimport { withDedupe } from '@lifi/sdk'\nimport { TronWeb } from 'tronweb'\nimport { DEFAULT_MULTICALL_BATCH_SIZE } from '../core/constants.js'\nimport { callTronRpcsWithRetry } from '../rpc/callTronRpcsWithRetry.js'\nimport { encodeAddressCalldata, toEvmHex } from '../utils/address.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { multicall3Abi } from '../utils/multicall3Abi.js'\nimport { TRC20_ABI } from '../utils/trc20Abi.js'\nimport { getMulticallAddress } from './getMulticallAddress.js'\n\nconst BALANCE_OF_SELECTOR = TronWeb.sha3('balanceOf(address)').slice(2, 10)\nconst GET_ETH_BALANCE_SELECTOR = TronWeb.sha3('getEthBalance(address)').slice(\n 2,\n 10\n)\n\nexport const getTronBalance = async (\n client: SDKClient,\n walletAddress: string,\n tokens: Token[],\n multicallBatchSize: number = DEFAULT_MULTICALL_BATCH_SIZE\n): Promise<TokenAmount[]> => {\n if (tokens.length === 0) {\n return []\n }\n const { chainId } = tokens[0]\n for (const token of tokens) {\n if (token.chainId !== chainId) {\n console.warn('Requested tokens have to be on the same chain.')\n }\n }\n\n const multicallAddress = await getMulticallAddress(client, chainId)\n\n if (multicallAddress && tokens.length > 1) {\n return getTronBalanceMulticall(\n client,\n tokens,\n walletAddress,\n multicallAddress,\n multicallBatchSize\n )\n }\n\n return getTronBalanceDefault(client, tokens, walletAddress)\n}\n\nconst getTronBalanceMulticall = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string,\n multicallAddress: string,\n batchSize: number\n): Promise<TokenAmount[]> => {\n const walletHex = toEvmHex(walletAddress)\n const multicallHex = toEvmHex(multicallAddress)\n\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const contract = tronWeb.contract(multicall3Abi, multicallAddress)\n\n // TronWeb encodes tuples positionally: [target, allowFailure, callData]\n const allCalls = tokens.map((token) => {\n const isNative = isZeroAddress(token.address)\n return [\n isNative ? multicallHex : toEvmHex(token.address),\n true,\n encodeAddressCalldata(\n isNative ? GET_ETH_BALANCE_SELECTOR : BALANCE_OF_SELECTOR,\n walletHex\n ),\n ]\n })\n\n // Chunk calls to avoid CPU timeout on Tron nodes\n const batches: (typeof allCalls)[] = []\n for (let i = 0; i < allCalls.length; i += batchSize) {\n batches.push(allCalls.slice(i, i + batchSize))\n }\n\n const [block, ...batchResults] = await Promise.all([\n tronWeb.trx.getCurrentBlock(),\n ...batches.map((batch, idx) =>\n contract\n .aggregate3(batch)\n .call({ from: walletAddress })\n // TronWeb wraps the single return value in an extra array\n .then((r: unknown[]) => r[0] as Array<[boolean, string]>)\n .catch((error: Error) => {\n console.warn(\n `[getTronBalance] batch ${idx + 1}/${batches.length} failed:`,\n error.message\n )\n return batch.map(() => [false, '0x'] as [boolean, string])\n })\n ),\n ])\n\n const blockNumber = block.block_header?.raw_data?.number\n return [\n blockNumber !== undefined ? BigInt(blockNumber) : undefined,\n batchResults.flat(),\n ]\n }\n )\n\n return tokens.map((token, i) => {\n // Guard against an unexpected length mismatch between tokens and flattened batch results.\n const entry = results[i] as [boolean, string] | undefined\n if (!entry) {\n return { ...token, blockNumber }\n }\n const [success, returnData] = entry\n if (!success) {\n // RPC failure: amount is omitted (undefined)\n // Consumers must treat a missing amount as \"balance unavailable\", not zero.\n return { ...token, blockNumber }\n }\n return { ...token, amount: BigInt(returnData), blockNumber }\n })\n}\n\nconst getTronBalanceDefault = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string\n): Promise<TokenAmount[]> => {\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const host = tronWeb.fullNode.host\n const queue: Promise<bigint>[] = tokens.map((token) => {\n if (isZeroAddress(token.address)) {\n return withDedupe(\n async () => BigInt(await tronWeb.trx.getBalance(walletAddress)),\n {\n id: `${getTronBalanceDefault.name}.getBalance.${walletAddress}.${host}`,\n }\n )\n }\n return withDedupe(\n async () => {\n const contract = tronWeb.contract(TRC20_ABI, token.address)\n const balance = await contract\n .balanceOf(walletAddress)\n .call({ from: walletAddress })\n return BigInt(balance.toString())\n },\n {\n id: `${getTronBalanceDefault.name}.balanceOf.${token.address}.${walletAddress}.${host}`,\n }\n )\n })\n\n return Promise.all([\n withDedupe(\n async (): Promise<bigint | undefined> => {\n const block = await tronWeb.trx.getCurrentBlock()\n const n = block.block_header?.raw_data?.number\n return n !== undefined ? BigInt(n) : undefined\n },\n { id: `${getTronBalanceDefault.name}.getCurrentBlock.${host}` }\n ),\n Promise.allSettled(queue),\n ])\n }\n )\n\n const tokenAmounts: TokenAmount[] = tokens.map((token, index) => {\n const result = results[index]\n if (result.status === 'rejected') {\n // RPC failure: amount is omitted (undefined), matching getSolanaBalance's contract.\n // Consumers must treat a missing amount as \"balance unavailable\", not zero.\n return { ...token, blockNumber }\n }\n return { ...token, amount: result.value, blockNumber }\n })\n\n return tokenAmounts\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAM,sBAAsB,QAAQ,KAAK,oBAAoB,CAAC,CAAC,MAAM,GAAG,EAAE;AAC1E,MAAM,2BAA2B,QAAQ,KAAK,wBAAwB,CAAC,CAAC,MACtE,GACA,EACF;AAEA,MAAa,iBAAiB,OAC5B,QACA,eACA,QACA,qBAAA,OAC2B;CAC3B,IAAI,OAAO,WAAW,GACpB,OAAO,CAAC;CAEV,MAAM,EAAE,YAAY,OAAO;CAC3B,KAAK,MAAM,SAAS,QAClB,IAAI,MAAM,YAAY,SACpB,QAAQ,KAAK,gDAAgD;CAIjE,MAAM,mBAAmB,MAAM,oBAAoB,QAAQ,OAAO;CAElE,IAAI,oBAAoB,OAAO,SAAS,GACtC,OAAO,wBACL,QACA,QACA,eACA,kBACA,kBACF;CAGF,OAAO,sBAAsB,QAAQ,QAAQ,aAAa;AAC5D;AAEA,MAAM,0BAA0B,OAC9B,QACA,QACA,eACA,kBACA,cAC2B;CAC3B,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,eAAe,SAAS,gBAAgB;CAE9C,MAAM,CAAC,aAAa,WAAW,MAAM,sBACnC,QACA,OAAO,YAAY;EACjB,MAAM,WAAW,QAAQ,SAAS,eAAe,gBAAgB;EAGjE,MAAM,WAAW,OAAO,KAAK,UAAU;GACrC,MAAM,WAAW,cAAc,MAAM,OAAO;GAC5C,OAAO;IACL,WAAW,eAAe,SAAS,MAAM,OAAO;IAChD;IACA,sBACE,WAAW,2BAA2B,qBACtC,SACF;GACF;EACF,CAAC;EAGD,MAAM,UAA+B,CAAC;EACtC,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK,WACxC,QAAQ,KAAK,SAAS,MAAM,GAAG,IAAI,SAAS,CAAC;EAG/C,MAAM,CAAC,OAAO,GAAG,gBAAgB,MAAM,QAAQ,IAAI,CACjD,QAAQ,IAAI,gBAAgB,GAC5B,GAAG,QAAQ,KAAK,OAAO,QACrB,SACG,WAAW,KAAK,CAAC,CACjB,KAAK,EAAE,MAAM,cAAc,CAAC,CAAC,CAE7B,MAAM,MAAiB,EAAE,EAA8B,CAAC,CACxD,OAAO,UAAiB;GACvB,QAAQ,KACN,0BAA0B,MAAM,EAAE,GAAG,QAAQ,OAAO,WACpD,MAAM,OACR;GACA,OAAO,MAAM,UAAU,CAAC,OAAO,IAAI,CAAsB;EAC3D,CAAC,CACL,CACF,CAAC;EAED,MAAM,cAAc,MAAM,cAAc,UAAU;EAClD,OAAO,CACL,gBAAgB,KAAA,IAAY,OAAO,WAAW,IAAI,KAAA,GAClD,aAAa,KAAK,CACpB;CACF,CACF;CAEA,OAAO,OAAO,KAAK,OAAO,MAAM;EAE9B,MAAM,QAAQ,QAAQ;EACtB,IAAI,CAAC,OACH,OAAO;GAAE,GAAG;GAAO;EAAY;EAEjC,MAAM,CAAC,SAAS,cAAc;EAC9B,IAAI,CAAC,SAGH,OAAO;GAAE,GAAG;GAAO;EAAY;EAEjC,OAAO;GAAE,GAAG;GAAO,QAAQ,OAAO,UAAU;GAAG;EAAY;CAC7D,CAAC;AACH;AAEA,MAAM,wBAAwB,OAC5B,QACA,QACA,kBAC2B;CAC3B,MAAM,CAAC,aAAa,WAAW,MAAM,sBACnC,QACA,OAAO,YAAY;EACjB,MAAM,OAAO,QAAQ,SAAS;EAC9B,MAAM,QAA2B,OAAO,KAAK,UAAU;GACrD,IAAI,cAAc,MAAM,OAAO,GAC7B,OAAO,WACL,YAAY,OAAO,MAAM,QAAQ,IAAI,WAAW,aAAa,CAAC,GAC9D,EACE,IAAI,GAAG,sBAAsB,KAAK,cAAc,cAAc,GAAG,OACnE,CACF;GAEF,OAAO,WACL,YAAY;IAEV,MAAM,UAAU,MADC,QAAQ,SAAS,WAAW,MAAM,OACtB,CAAC,CAC3B,UAAU,aAAa,CAAC,CACxB,KAAK,EAAE,MAAM,cAAc,CAAC;IAC/B,OAAO,OAAO,QAAQ,SAAS,CAAC;GAClC,GACA,EACE,IAAI,GAAG,sBAAsB,KAAK,aAAa,MAAM,QAAQ,GAAG,cAAc,GAAG,OACnF,CACF;EACF,CAAC;EAED,OAAO,QAAQ,IAAI,CACjB,WACE,YAAyC;GAEvC,MAAM,KAAI,MADU,QAAQ,IAAI,gBAAgB,EAAA,CAChC,cAAc,UAAU;GACxC,OAAO,MAAM,KAAA,IAAY,OAAO,CAAC,IAAI,KAAA;EACvC,GACA,EAAE,IAAI,GAAG,sBAAsB,KAAK,mBAAmB,OAAO,CAChE,GACA,QAAQ,WAAW,KAAK,CAC1B,CAAC;CACH,CACF;CAYA,OAVoC,OAAO,KAAK,OAAO,UAAU;EAC/D,MAAM,SAAS,QAAQ;EACvB,IAAI,OAAO,WAAW,YAGpB,OAAO;GAAE,GAAG;GAAO;EAAY;EAEjC,OAAO;GAAE,GAAG;GAAO,QAAQ,OAAO;GAAO;EAAY;CACvD,CAEkB;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronStepExecutor.d.ts","names":[],"sources":["../../../src/core/TronStepExecutor.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TronStepExecutor.d.ts","names":[],"sources":["../../../src/core/TronStepExecutor.ts"],"mappings":";;;qBA0Ba,yBAAyB;UAC5B;EAER,YAAY,SAAS;EAKrB,cAAe,MAAM;WAUZ,cACP,OAAO,OACP,OAAO,kBACP,SAAS,oBACR,QAAQ;WAEF,gBACP,aAAa,4BACZ,QAAQ;WAQF,iBACP,SAAS,4BACR"}
|
|
@@ -4,7 +4,7 @@ import { TronCheckAllowanceTask } from "./tasks/TronCheckAllowanceTask.js";
|
|
|
4
4
|
import { TronSetAllowanceTask } from "./tasks/TronSetAllowanceTask.js";
|
|
5
5
|
import { TronSignAndExecuteTask } from "./tasks/TronSignAndExecuteTask.js";
|
|
6
6
|
import { TronWaitForTransactionTask } from "./tasks/TronWaitForTransactionTask.js";
|
|
7
|
-
import { BaseStepExecutor, CheckBalanceTask, LiFiErrorCode, PrepareTransactionTask, TaskPipeline, TransactionError, WaitForTransactionStatusTask } from "@lifi/sdk";
|
|
7
|
+
import { BaseStepExecutor, CheckBalanceTask, LiFiErrorCode, PrepareTransactionTask, TaskPipeline, TransactionError, WaitForTransactionStatusTask, hasOpenTransaction } from "@lifi/sdk";
|
|
8
8
|
//#region src/core/TronStepExecutor.ts
|
|
9
9
|
var TronStepExecutor = class extends BaseStepExecutor {
|
|
10
10
|
wallet;
|
|
@@ -37,11 +37,14 @@ var TronStepExecutor = class extends BaseStepExecutor {
|
|
|
37
37
|
new WaitForTransactionStatusTask(isBridgeExecution ? "RECEIVING_CHAIN" : "SWAP")
|
|
38
38
|
];
|
|
39
39
|
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const isTransactionOpen = hasOpenTransaction(swapOrBridgeAction);
|
|
41
|
+
const doCheckAllowance = !isTransactionOpen && !isFromNativeToken && !!step.estimate.approvalAddress && !step.estimate.skipApproval;
|
|
42
|
+
let firstTask;
|
|
43
|
+
if (doCheckAllowance) firstTask = TronCheckAllowanceTask;
|
|
44
|
+
else if (isTransactionOpen) firstTask = swapOrBridgeAction?.status === "DONE" ? WaitForTransactionStatusTask : TronWaitForTransactionTask;
|
|
45
|
+
else firstTask = CheckBalanceTask;
|
|
46
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor === firstTask);
|
|
47
|
+
if (firstTaskIndex === -1) throw new TransactionError(LiFiErrorCode.InternalError, "TronStepExecutor.createPipeline: first task not found");
|
|
45
48
|
const tasksToRun = tasks.slice(firstTaskIndex);
|
|
46
49
|
return new TaskPipeline(tasksToRun);
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronStepExecutor.js","names":[],"sources":["../../../src/core/TronStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport type { Adapter } from '@tronweb3/tronwallet-abstract-adapter'\nimport { parseTronErrors } from '../errors/parseTronErrors.js'\nimport type {\n TronStepExecutorContext,\n TronStepExecutorOptions,\n} from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './tasks/TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './tasks/TronSetAllowanceTask.js'\nimport { TronSignAndExecuteTask } from './tasks/TronSignAndExecuteTask.js'\nimport { TronWaitForTransactionTask } from './tasks/TronWaitForTransactionTask.js'\n\nexport class TronStepExecutor extends BaseStepExecutor {\n private wallet: Adapter\n\n constructor(options: TronStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n }\n\n checkWallet = (step: LiFiStepExtended): void => {\n const address = this.wallet.address\n if (address && address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseTronErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<TronStepExecutorContext> => {\n return {\n ...baseContext,\n wallet: this.wallet,\n checkWallet: this.checkWallet,\n }\n }\n\n override createPipeline = (\n context: TronStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const isFromNativeToken = isZeroAddress(step.action.fromToken.address)\n\n const tasks = [\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new TronSignAndExecuteTask(),\n new TronWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n const doCheckAllowance =\n !
|
|
1
|
+
{"version":3,"file":"TronStepExecutor.js","names":[],"sources":["../../../src/core/TronStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n hasOpenTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport type { Adapter } from '@tronweb3/tronwallet-abstract-adapter'\nimport { parseTronErrors } from '../errors/parseTronErrors.js'\nimport type {\n TronStepExecutorContext,\n TronStepExecutorOptions,\n} from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './tasks/TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './tasks/TronSetAllowanceTask.js'\nimport { TronSignAndExecuteTask } from './tasks/TronSignAndExecuteTask.js'\nimport { TronWaitForTransactionTask } from './tasks/TronWaitForTransactionTask.js'\n\nexport class TronStepExecutor extends BaseStepExecutor {\n private wallet: Adapter\n\n constructor(options: TronStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n }\n\n checkWallet = (step: LiFiStepExtended): void => {\n const address = this.wallet.address\n if (address && address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseTronErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<TronStepExecutorContext> => {\n return {\n ...baseContext,\n wallet: this.wallet,\n checkWallet: this.checkWallet,\n }\n }\n\n override createPipeline = (\n context: TronStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const isFromNativeToken = isZeroAddress(step.action.fromToken.address)\n\n const tasks = [\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new TronSignAndExecuteTask(),\n new TronWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n // A transaction signed for this action may still land (`txHash` after a\n // broadcast, `txHex` right after signing). Resume at the confirmation wait:\n // re-checking the allowance, re-preparing or re-signing could execute the\n // swap twice. A final failure is not open, so \"Try again\" signs anew.\n const isTransactionOpen = hasOpenTransaction(swapOrBridgeAction)\n\n const doCheckAllowance =\n !isTransactionOpen &&\n !isFromNativeToken &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n\n let firstTask:\n | typeof TronCheckAllowanceTask\n | typeof TronWaitForTransactionTask\n | typeof WaitForTransactionStatusTask\n | typeof CheckBalanceTask\n if (doCheckAllowance) {\n firstTask = TronCheckAllowanceTask\n } else if (isTransactionOpen) {\n firstTask =\n swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask\n : TronWaitForTransactionTask\n } else {\n firstTask = CheckBalanceTask\n }\n\n // Compare classes, not names: a minifier can give two task classes the\n // same name.\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor === firstTask\n )\n if (firstTaskIndex === -1) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'TronStepExecutor.createPipeline: first task not found'\n )\n }\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;AA0BA,IAAa,mBAAb,cAAsC,iBAAiB;CACrD;CAEA,YAAY,SAAkC;EAC5C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;CACxB;CAEA,eAAe,SAAiC;EAC9C,MAAM,UAAU,KAAK,OAAO;EAC5B,IAAI,WAAW,YAAY,KAAK,OAAO,aACrC,MAAM,IAAI,iBACR,cAAc,8BACd,mHACF;CAEJ;CAEA,eACE,OACA,MACA,WACsB,gBAAgB,OAAO,MAAM,MAAM;CAE3D,gBAAyB,OACvB,gBACqC;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB;CACF;CAEA,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,oBAAoB,cAAc,KAAK,OAAO,UAAU,OAAO;EAErE,MAAM,QAAQ;GACZ,IAAI,uBAAuB;GAC3B,IAAI,qBAAqB;GACzB,IAAI,iBAAiB;GACrB,IAAI,uBAAuB;GAC3B,IAAI,uBAAuB;GAC3B,IAAI,2BAA2B;GAC/B,IAAI,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EAMA,MAAM,oBAAoB,mBAAmB,kBAAkB;EAE/D,MAAM,mBACJ,CAAC,qBACD,CAAC,qBACD,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;EAEjB,IAAI;EAKJ,IAAI,kBACF,YAAY;OACP,IAAI,mBACT,YACE,oBAAoB,WAAW,SAC3B,+BACA;OAEN,YAAY;EAKd,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAI,iBACR,cAAc,eACd,uDACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAI,aAAa,UAAU;CACpC;AACF"}
|
|
@@ -3,5 +3,8 @@ export declare const TRON_POLL_INTERVAL_MS = 3e3;
|
|
|
3
3
|
export declare const TRON_POLL_MAX_POLLS = 40;
|
|
4
4
|
export declare const TRON_POLL_MAX_ERROR_RETRIES = 5;
|
|
5
5
|
export declare const DEFAULT_MULTICALL_BATCH_SIZE = 50;
|
|
6
|
+
export declare const TRON_EXPIRATION_OFFSET_MS = 6e4;
|
|
7
|
+
export declare const TRON_LOOKUP_WINDOW_MS: number;
|
|
8
|
+
export declare const TRON_HEAD_MARGIN_MS: number;
|
|
6
9
|
//#endregion
|
|
7
10
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/core/constants.ts"],"mappings":";qBAAa;qBAGA;qBAEA;qBAGA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/core/constants.ts"],"mappings":";qBAAa;qBAGA;qBAEA;qBAGA;qBAIA;qBAKA;qBAGA"}
|
|
@@ -3,7 +3,10 @@ const TRON_POLL_INTERVAL_MS = 3e3;
|
|
|
3
3
|
const TRON_POLL_MAX_POLLS = 40;
|
|
4
4
|
const TRON_POLL_MAX_ERROR_RETRIES = 5;
|
|
5
5
|
const DEFAULT_MULTICALL_BATCH_SIZE = 50;
|
|
6
|
+
const TRON_EXPIRATION_OFFSET_MS = 6e4;
|
|
7
|
+
const TRON_LOOKUP_WINDOW_MS = 864e5;
|
|
8
|
+
const TRON_HEAD_MARGIN_MS = 3e5;
|
|
6
9
|
//#endregion
|
|
7
|
-
export { DEFAULT_MULTICALL_BATCH_SIZE, TRON_POLL_INTERVAL_MS, TRON_POLL_MAX_ERROR_RETRIES, TRON_POLL_MAX_POLLS };
|
|
10
|
+
export { DEFAULT_MULTICALL_BATCH_SIZE, TRON_EXPIRATION_OFFSET_MS, TRON_HEAD_MARGIN_MS, TRON_LOOKUP_WINDOW_MS, TRON_POLL_INTERVAL_MS, TRON_POLL_MAX_ERROR_RETRIES, TRON_POLL_MAX_POLLS };
|
|
8
11
|
|
|
9
12
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/core/constants.ts"],"sourcesContent":["export const TRON_POLL_INTERVAL_MS = 3000\n// Maximum number of poll attempts before the confirmation wait times out.\n// At TRON_POLL_INTERVAL_MS=3000 this caps total wait at ~2 minutes.\nexport const TRON_POLL_MAX_POLLS = 40\n// Maximum tolerated RPC errors during confirmation polling before bailing.\nexport const TRON_POLL_MAX_ERROR_RETRIES = 5\n\n// Max tokens per aggregate3 multicall — avoids Tron node CPU timeouts on large lists.\nexport const DEFAULT_MULTICALL_BATCH_SIZE = 50\n"],"mappings":";AAAA,MAAa,wBAAwB;AAGrC,MAAa,sBAAsB;AAEnC,MAAa,8BAA8B;AAG3C,MAAa,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/core/constants.ts"],"sourcesContent":["export const TRON_POLL_INTERVAL_MS = 3000\n// Maximum number of poll attempts before the confirmation wait times out.\n// At TRON_POLL_INTERVAL_MS=3000 this caps total wait at ~2 minutes.\nexport const TRON_POLL_MAX_POLLS = 40\n// Maximum tolerated RPC errors during confirmation polling before bailing.\nexport const TRON_POLL_MAX_ERROR_RETRIES = 5\n\n// Max tokens per aggregate3 multicall — avoids Tron node CPU timeouts on large lists.\nexport const DEFAULT_MULTICALL_BATCH_SIZE = 50\n\n// `getCurrentRefBlockParams` sets `raw_data.expiration` to the ref block time\n// + 60 s. The ref block time is the earliest time the transaction can land.\nexport const TRON_EXPIRATION_OFFSET_MS = 60_000\n// A node's \"not found\" counts only while its head is less than this past the\n// earliest landing time: every node type keeps at least this much history\n// (lite fullnodes keep 65,536 blocks, about 54 h). Tron has no call that\n// proves coverage in the lookup response itself.\nexport const TRON_LOOKUP_WINDOW_MS: number = 24 * 60 * 60 * 1000\n// A node's \"not found\" also needs its head this far past the latest landing\n// time: more than a healthy node lags behind the chain.\nexport const TRON_HEAD_MARGIN_MS: number = 5 * 60_000\n"],"mappings":";AAAA,MAAa,wBAAwB;AAGrC,MAAa,sBAAsB;AAEnC,MAAa,8BAA8B;AAG3C,MAAa,+BAA+B;AAI5C,MAAa,4BAA4B;AAKzC,MAAa,wBAAgC;AAG7C,MAAa,sBAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"mappings":";;;qBAUa,+BAA+B;WAC3B,UAAU,SAAS,0BAA0B;EAI5D,IAAU,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { callTronRpcsWithRetry } from "../../rpc/callTronRpcsWithRetry.js";
|
|
2
|
+
import { TRC20_ABI } from "../../utils/trc20Abi.js";
|
|
2
3
|
import { BaseStepExecutionTask, LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
3
4
|
//#region src/core/tasks/TronCheckAllowanceTask.ts
|
|
4
5
|
var TronCheckAllowanceTask = class extends BaseStepExecutionTask {
|
|
@@ -20,7 +21,7 @@ var TronCheckAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
20
21
|
const spenderAddress = step.estimate.approvalAddress;
|
|
21
22
|
const fromAmount = BigInt(step.action.fromAmount);
|
|
22
23
|
const allowance = await callTronRpcsWithRetry(client, async (tronWeb) => {
|
|
23
|
-
const result = await
|
|
24
|
+
const result = await tronWeb.contract(TRC20_ABI, tokenAddress).allowance(ownerAddress, spenderAddress).call({ from: ownerAddress });
|
|
24
25
|
return BigInt(result.toString());
|
|
25
26
|
});
|
|
26
27
|
statusManager.updateAction(step, action.type, "DONE");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport { callTronRpcsWithRetry } from '../../rpc/callTronRpcsWithRetry.js'\nimport type { TronStepExecutorContext } from '../../types.js'\n\nexport class TronCheckAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n return !context.hasSufficientAllowance\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n const { step, client, wallet, statusManager } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'CHECK_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n if (!wallet.address) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'Wallet address is not available. Wallet may have been disconnected.'\n )\n }\n\n if (!step.estimate.approvalAddress) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Approval address is not available.'\n )\n }\n\n const ownerAddress = wallet.address\n const tokenAddress = step.action.fromToken.address\n const spenderAddress = step.estimate.approvalAddress\n const fromAmount = BigInt(step.action.fromAmount)\n\n const allowance = await callTronRpcsWithRetry(client, async (tronWeb) => {\n const contract =
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport { callTronRpcsWithRetry } from '../../rpc/callTronRpcsWithRetry.js'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { TRC20_ABI } from '../../utils/trc20Abi.js'\n\nexport class TronCheckAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n return !context.hasSufficientAllowance\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n const { step, client, wallet, statusManager } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'CHECK_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n if (!wallet.address) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'Wallet address is not available. Wallet may have been disconnected.'\n )\n }\n\n if (!step.estimate.approvalAddress) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Approval address is not available.'\n )\n }\n\n const ownerAddress = wallet.address\n const tokenAddress = step.action.fromToken.address\n const spenderAddress = step.estimate.approvalAddress\n const fromAmount = BigInt(step.action.fromAmount)\n\n const allowance = await callTronRpcsWithRetry(client, async (tronWeb) => {\n const contract = tronWeb.contract(TRC20_ABI, tokenAddress)\n const result = await contract\n .allowance(ownerAddress, spenderAddress)\n .call({ from: ownerAddress })\n return BigInt(result.toString())\n })\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: {\n hasSufficientAllowance: fromAmount <= allowance,\n },\n }\n }\n}\n"],"mappings":";;;;AAUA,IAAa,yBAAb,cAA4C,sBAAsB;CAChE,MAAe,UAAU,SAAoD;EAC3E,OAAO,CAAC,QAAQ;CAClB;CAEA,MAAM,IAAI,SAAuD;EAC/D,MAAM,EAAE,MAAM,QAAQ,QAAQ,kBAAkB;EAEhD,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,iBACR,cAAc,8BACd,qEACF;EAGF,IAAI,CAAC,KAAK,SAAS,iBACjB,MAAM,IAAI,iBACR,cAAc,uBACd,oCACF;EAGF,MAAM,eAAe,OAAO;EAC5B,MAAM,eAAe,KAAK,OAAO,UAAU;EAC3C,MAAM,iBAAiB,KAAK,SAAS;EACrC,MAAM,aAAa,OAAO,KAAK,OAAO,UAAU;EAEhD,MAAM,YAAY,MAAM,sBAAsB,QAAQ,OAAO,YAAY;GAEvE,MAAM,SAAS,MADE,QAAQ,SAAS,WAAW,YACjB,CAAC,CAC1B,UAAU,cAAc,cAAc,CAAC,CACvC,KAAK,EAAE,MAAM,aAAa,CAAC;GAC9B,OAAO,OAAO,OAAO,SAAS,CAAC;EACjC,CAAC;EAED,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GACL,QAAQ;GACR,SAAS,EACP,wBAAwB,cAAc,UACxC;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TronSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"mappings":";;;qBAea,+BAA+B;EAC1C,IAAU,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { callTronRpcsWithRetry } from "../../rpc/callTronRpcsWithRetry.js";
|
|
2
2
|
import { stripHexPrefix } from "../../utils/stripHexPrefix.js";
|
|
3
|
-
import {
|
|
3
|
+
import { serializeTronSignedTransaction } from "../../utils/tronSignedTransaction.js";
|
|
4
|
+
import { BaseStepExecutionTask, CLEARED_TRANSACTION_FIELDS, LiFiErrorCode, TransactionError, assertNoOpenTransaction } from "@lifi/sdk";
|
|
4
5
|
import { utils } from "tronweb";
|
|
5
6
|
//#region src/core/tasks/TronSignAndExecuteTask.ts
|
|
6
7
|
var TronSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
@@ -8,6 +9,7 @@ var TronSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
8
9
|
const { step, wallet, statusManager, isBridgeExecution, checkWallet, client } = context;
|
|
9
10
|
const action = statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
10
11
|
if (!action) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. Action not found.");
|
|
12
|
+
assertNoOpenTransaction(action);
|
|
11
13
|
if (!step.transactionRequest?.data) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. Transaction request is not found.");
|
|
12
14
|
checkWallet(step);
|
|
13
15
|
statusManager.updateAction(step, action.type, "ACTION_REQUIRED");
|
|
@@ -24,8 +26,16 @@ var TronSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
24
26
|
raw_data_hex: ""
|
|
25
27
|
}, { txLocal: true });
|
|
26
28
|
});
|
|
29
|
+
assertNoOpenTransaction(statusManager.findAction(step, action.type));
|
|
27
30
|
const signedTransaction = await wallet.signTransaction(transaction);
|
|
28
|
-
statusManager.
|
|
31
|
+
assertNoOpenTransaction(statusManager.findAction(step, action.type));
|
|
32
|
+
const txHex = serializeTronSignedTransaction(signedTransaction);
|
|
33
|
+
if (!txHex) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. The signed transaction is incomplete.");
|
|
34
|
+
statusManager.updateAction(step, action.type, "PENDING", {
|
|
35
|
+
...CLEARED_TRANSACTION_FIELDS,
|
|
36
|
+
txHex,
|
|
37
|
+
signedAt: Date.now()
|
|
38
|
+
});
|
|
29
39
|
return {
|
|
30
40
|
status: "COMPLETED",
|
|
31
41
|
context: { signedTransaction }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignAndExecuteTask.js","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Transaction } from '@tronweb3/tronwallet-abstract-adapter'\nimport { utils } from 'tronweb'\nimport { callTronRpcsWithRetry } from '../../rpc/callTronRpcsWithRetry.js'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { stripHexPrefix } from '../../utils/stripHexPrefix.js'\n\nexport class TronSignAndExecuteTask extends BaseStepExecutionTask {\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n wallet,\n statusManager,\n isBridgeExecution,\n checkWallet,\n client,\n } = context\n\n const action = statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n if (!action) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Action not found.'\n )\n }\n\n if (!step.transactionRequest?.data) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Transaction request is not found.'\n )\n }\n\n checkWallet(step)\n\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n\n if (!context.allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n const rawDataHex = stripHexPrefix(step.transactionRequest.data as string)\n\n const contractType =\n (step.transactionRequest.customData?.contractType as string) ??\n 'TriggerSmartContract'\n\n // Re-anchor to a fresh block — a stale `ref_block_hash` falls outside TronLink's\n // recent-block window and surfaces as a generic \"Network mismatched\" error. Then\n // `newTxID` re-runs the tx through TronWeb's `createTransaction`, dropping the\n // deserializer's non-protobuf artifacts and producing a consistent `txID` /\n // `raw_data_hex` pair.\n const transaction: Transaction = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const rawData = utils.deserializeTx.deserializeTransaction(\n contractType,\n rawDataHex\n )\n Object.assign(rawData, await tronWeb.trx.getCurrentRefBlockParams())\n return tronWeb.transactionBuilder.newTxID(\n { visible: false, txID: '', raw_data: rawData, raw_data_hex: '' },\n { txLocal: true }\n )\n }\n )\n\n const signedTransaction = await wallet.signTransaction(transaction)\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n signedAt: Date.now(),\n })\n\n return {\n status: 'COMPLETED',\n context: { signedTransaction },\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TronSignAndExecuteTask.js","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"sourcesContent":["import {\n assertNoOpenTransaction,\n BaseStepExecutionTask,\n CLEARED_TRANSACTION_FIELDS,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Transaction } from '@tronweb3/tronwallet-abstract-adapter'\nimport { utils } from 'tronweb'\nimport { callTronRpcsWithRetry } from '../../rpc/callTronRpcsWithRetry.js'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { stripHexPrefix } from '../../utils/stripHexPrefix.js'\nimport { serializeTronSignedTransaction } from '../../utils/tronSignedTransaction.js'\n\nexport class TronSignAndExecuteTask extends BaseStepExecutionTask {\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n wallet,\n statusManager,\n isBridgeExecution,\n checkWallet,\n client,\n } = context\n\n const action = statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n if (!action) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Action not found.'\n )\n }\n\n // A transaction signed earlier for this action may still land. Signing a\n // second one could execute the swap twice.\n assertNoOpenTransaction(action)\n\n if (!step.transactionRequest?.data) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Transaction request is not found.'\n )\n }\n\n checkWallet(step)\n\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n\n if (!context.allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n const rawDataHex = stripHexPrefix(step.transactionRequest.data as string)\n\n const contractType =\n (step.transactionRequest.customData?.contractType as string) ??\n 'TriggerSmartContract'\n\n // Re-anchor to a fresh block — a stale `ref_block_hash` falls outside TronLink's\n // recent-block window and surfaces as a generic \"Network mismatched\" error. Then\n // `newTxID` re-runs the tx through TronWeb's `createTransaction`, dropping the\n // deserializer's non-protobuf artifacts and producing a consistent `txID` /\n // `raw_data_hex` pair.\n const transaction: Transaction = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const rawData = utils.deserializeTx.deserializeTransaction(\n contractType,\n rawDataHex\n )\n Object.assign(rawData, await tronWeb.trx.getCurrentRefBlockParams())\n return tronWeb.transactionBuilder.newTxID(\n { visible: false, txID: '', raw_data: rawData, raw_data_hex: '' },\n { txLocal: true }\n )\n }\n )\n\n // Checked again right before the wallet: a late write of an older run\n // can merge its transaction into this action during the await above.\n assertNoOpenTransaction(statusManager.findAction(step, action.type))\n\n const signedTransaction = await wallet.signTransaction(transaction)\n\n // Checked once more after the wallet: a stopped run's late write can\n // merge its transaction into this action while the prompt is open.\n // Nothing awaits from here to the write below.\n assertNoOpenTransaction(statusManager.findAction(step, action.type))\n\n // Stored before the first broadcast, so a reload after signing resends\n // these bytes instead of asking the user to sign again.\n const txHex = serializeTronSignedTransaction(signedTransaction)\n if (!txHex) {\n // Without a txID and an expiration the transaction could not be tracked\n // once sent. Nothing was sent yet, so \"Try again\" signs a new one.\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. The signed transaction is incomplete.'\n )\n }\n\n // One write: the previous transaction's data is cleared together with\n // storing the new bytes, so no stale hash can look open again.\n statusManager.updateAction(step, action.type, 'PENDING', {\n ...CLEARED_TRANSACTION_FIELDS,\n txHex,\n signedAt: Date.now(),\n })\n\n return {\n status: 'COMPLETED',\n context: { signedTransaction },\n }\n }\n}\n"],"mappings":";;;;;;AAeA,IAAa,yBAAb,cAA4C,sBAAsB;CAChE,MAAM,IAAI,SAAuD;EAC/D,MAAM,EACJ,MACA,QACA,eACA,mBACA,aACA,WACE;EAEJ,MAAM,SAAS,cAAc,WAC3B,MACA,oBAAoB,gBAAgB,MACtC;EAEA,IAAI,CAAC,QACH,MAAM,IAAI,iBACR,cAAc,uBACd,kDACF;EAKF,wBAAwB,MAAM;EAE9B,IAAI,CAAC,KAAK,oBAAoB,MAC5B,MAAM,IAAI,iBACR,cAAc,uBACd,kEACF;EAGF,YAAY,IAAI;EAEhB,cAAc,aAAa,MAAM,OAAO,MAAM,iBAAiB;EAE/D,IAAI,CAAC,QAAQ,sBACX,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,aAAa,eAAe,KAAK,mBAAmB,IAAc;EAExE,MAAM,eACH,KAAK,mBAAmB,YAAY,gBACrC;EAOF,MAAM,cAA2B,MAAM,sBACrC,QACA,OAAO,YAAY;GACjB,MAAM,UAAU,MAAM,cAAc,uBAClC,cACA,UACF;GACA,OAAO,OAAO,SAAS,MAAM,QAAQ,IAAI,yBAAyB,CAAC;GACnE,OAAO,QAAQ,mBAAmB,QAChC;IAAE,SAAS;IAAO,MAAM;IAAI,UAAU;IAAS,cAAc;GAAG,GAChE,EAAE,SAAS,KAAK,CAClB;EACF,CACF;EAIA,wBAAwB,cAAc,WAAW,MAAM,OAAO,IAAI,CAAC;EAEnE,MAAM,oBAAoB,MAAM,OAAO,gBAAgB,WAAW;EAKlE,wBAAwB,cAAc,WAAW,MAAM,OAAO,IAAI,CAAC;EAInE,MAAM,QAAQ,+BAA+B,iBAAiB;EAC9D,IAAI,CAAC,OAGH,MAAM,IAAI,iBACR,cAAc,uBACd,sEACF;EAKF,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;GACvD,GAAG;GACH;GACA,UAAU,KAAK,IAAI;EACrB,CAAC;EAED,OAAO;GACL,QAAQ;GACR,SAAS,EAAE,kBAAkB;EAC/B;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronWaitForTransactionTask.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TronWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronWaitForTransactionTask.ts"],"mappings":";;;qBAgBa,mCAAmC;EAC9C,IAAU,SAAS,0BAA0B,QAAQ"}
|