@lifi/sdk-provider-tron 0.0.0-preview-e8c80bc4 → 0.0.0-preview-df697626
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 +10 -3
- package/dist/cjs/core/TronStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/TronCheckAllowanceAfterPrepareTask.js.map +1 -1
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.js.map +1 -1
- 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/core/TronStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/TronCheckAllowanceAfterPrepareTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronCheckAllowanceAfterPrepareTask.js.map +1 -1
- package/dist/esm/core/tasks/TronCheckAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronSetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/TronWaitForTransactionTask.d.ts.map +1 -1
- 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/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
# @lifi/sdk-provider-tron
|
|
2
2
|
|
|
3
|
-
## 0.0.0-preview-
|
|
3
|
+
## 0.0.0-preview-df697626
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`09fa8a3`](https://github.com/lifinance/sdk/commit/09fa8a35f30fe67f136cd6d6c7bd32c23f1b8c1f)]:
|
|
8
|
+
- @lifi/sdk@0.0.0-preview-df697626
|
|
9
|
+
|
|
10
|
+
## 4.1.11
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
6
13
|
|
|
7
14
|
- [#545](https://github.com/lifinance/sdk/pull/545) [`37688cc`](https://github.com/lifinance/sdk/commit/37688cc732187f08f429062e506b67dee2a2a30a) Thanks [@chybisov](https://github.com/chybisov)! - Update `tronweb` to 6.5.2.
|
|
8
15
|
Update `viem` to 2.57.19.
|
|
9
|
-
- Updated dependencies [[`b80e5f4`](https://github.com/lifinance/sdk/commit/b80e5f49941190812935644c55d5c9c075bac354), [`
|
|
10
|
-
- @lifi/sdk@
|
|
16
|
+
- Updated dependencies [[`aa5d2ff`](https://github.com/lifinance/sdk/commit/aa5d2ffe2acccc7c7e17eac09562f491eb9cc0ac), [`b80e5f4`](https://github.com/lifinance/sdk/commit/b80e5f49941190812935644c55d5c9c075bac354), [`3129a50`](https://github.com/lifinance/sdk/commit/3129a50fadf41317592b2403c42f2816540cb045)]:
|
|
17
|
+
- @lifi/sdk@4.13.0
|
|
11
18
|
|
|
12
19
|
## 4.1.10
|
|
13
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronStepExecutor.js","names":["BaseStepExecutor","TransactionError","LiFiErrorCode","parseTronErrors","isZeroAddress","TronCheckAllowanceTask","TronSetAllowanceTask","CheckBalanceTask","PrepareTransactionTask","TronCheckAllowanceAfterPrepareTask","TronSignAndExecuteTask","TronWaitForTransactionTask","WaitForTransactionStatusTask","hasOpenTransaction","TaskPipeline"],"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 { TronCheckAllowanceAfterPrepareTask } from './tasks/TronCheckAllowanceAfterPrepareTask.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 TronCheckAllowanceAfterPrepareTask(),\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":";;;;;;;;;;AA2BA,IAAa,mBAAb,cAAsCA,UAAAA,iBAAiB;
|
|
1
|
+
{"version":3,"file":"TronStepExecutor.js","names":["BaseStepExecutor","TransactionError","LiFiErrorCode","parseTronErrors","isZeroAddress","TronCheckAllowanceTask","TronSetAllowanceTask","CheckBalanceTask","PrepareTransactionTask","TronCheckAllowanceAfterPrepareTask","TronSignAndExecuteTask","TronWaitForTransactionTask","WaitForTransactionStatusTask","hasOpenTransaction","TaskPipeline"],"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 { TronCheckAllowanceAfterPrepareTask } from './tasks/TronCheckAllowanceAfterPrepareTask.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 TronCheckAllowanceAfterPrepareTask(),\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":";;;;;;;;;;AA2BA,IAAa,mBAAb,cAAsCA,UAAAA,iBAAiB;CAC7C;CAER,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,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,8BACd,mHACF;CAEJ;CAES,eACP,OACA,MACA,WACsBC,+BAAAA,gBAAgB,OAAO,MAAM,MAAM;CAElD,gBAAgB,OACvB,gBACqC;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB;CACF;CAES,kBACP,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,oBAAoBC,4BAAAA,cAAc,KAAK,OAAO,UAAU,OAAO;EAErE,MAAM,QAAQ;GACZ,IAAIC,0CAAAA,uBAAuB;GAC3B,IAAIC,wCAAAA,qBAAqB;GACzB,IAAIC,UAAAA,iBAAiB;GACrB,IAAIC,UAAAA,uBAAuB;GAC3B,IAAIC,sDAAAA,mCAAmC;GACvC,IAAIC,0CAAAA,uBAAuB;GAC3B,IAAIC,8CAAAA,2BAA2B;GAC/B,IAAIC,UAAAA,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EAMA,MAAM,qBAAA,GAAoBC,UAAAA,mBAAAA,CAAmB,kBAAkB;EAE/D,MAAM,mBACJ,CAAC,qBACD,CAAC,qBACD,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;EAEjB,IAAI;EAKJ,IAAI,kBACF,YAAYR,0CAAAA;OACP,IAAI,mBACT,YACE,oBAAoB,WAAW,SAC3BO,UAAAA,+BACAD,8CAAAA;OAEN,YAAYJ,UAAAA;EAKd,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAIN,UAAAA,iBACRC,UAAAA,cAAc,eACd,uDACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAIY,UAAAA,aAAa,UAAU;CACpC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.js","names":["BaseStepExecutionTask","TaskPipeline","TronCheckAllowanceTask","TronSetAllowanceTask","isZeroAddress"],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, TaskPipeline, type TaskResult } from '@lifi/sdk'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { isZeroAddress } from '../../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './TronSetAllowanceTask.js'\n\n/**\n * Runs after PrepareTransaction. Some providers only know the spender once\n * `/stepTransaction` builds the executable transaction, so the routing-time\n * step carries no `estimate.approvalAddress` and the allowance tasks before\n * prepare do not run. When the re-quote brings one, the allowance is read for\n * it, and set only if it falls short, before the transaction is signed.\n *\n * A spender that was already checked before prepare is not checked again.\n */\nexport class TronCheckAllowanceAfterPrepareTask extends BaseStepExecutionTask {\n private readonly allowancePipeline = new TaskPipeline([\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n ])\n\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n const { step, hasSufficientAllowance } = context\n // `hasSufficientAllowance` is only set by the allowance tasks, so it is\n // unset exactly when none ran before prepare.\n return (\n hasSufficientAllowance === undefined &&\n !isZeroAddress(step.action.fromToken.address) &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n )\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n return this.allowancePipeline.run(context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAa,qCAAb,cAAwDA,UAAAA,sBAAsB;
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.js","names":["BaseStepExecutionTask","TaskPipeline","TronCheckAllowanceTask","TronSetAllowanceTask","isZeroAddress"],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, TaskPipeline, type TaskResult } from '@lifi/sdk'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { isZeroAddress } from '../../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './TronSetAllowanceTask.js'\n\n/**\n * Runs after PrepareTransaction. Some providers only know the spender once\n * `/stepTransaction` builds the executable transaction, so the routing-time\n * step carries no `estimate.approvalAddress` and the allowance tasks before\n * prepare do not run. When the re-quote brings one, the allowance is read for\n * it, and set only if it falls short, before the transaction is signed.\n *\n * A spender that was already checked before prepare is not checked again.\n */\nexport class TronCheckAllowanceAfterPrepareTask extends BaseStepExecutionTask {\n private readonly allowancePipeline = new TaskPipeline([\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n ])\n\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n const { step, hasSufficientAllowance } = context\n // `hasSufficientAllowance` is only set by the allowance tasks, so it is\n // unset exactly when none ran before prepare.\n return (\n hasSufficientAllowance === undefined &&\n !isZeroAddress(step.action.fromToken.address) &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n )\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n return this.allowancePipeline.run(context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAa,qCAAb,cAAwDA,UAAAA,sBAAsB;CAC3D,oBAAoB,IAAIC,UAAAA,aAAa,CACpD,IAAIC,0CAAAA,uBAAuB,GAC3B,IAAIC,wCAAAA,qBAAqB,CAC3B,CAAC;CAED,MAAe,UAAU,SAAoD;EAC3E,MAAM,EAAE,MAAM,2BAA2B;EAGzC,OACE,2BAA2B,KAAA,KAC3B,CAACC,4BAAAA,cAAc,KAAK,OAAO,UAAU,OAAO,KAC5C,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;CAEnB;CAEA,MAAM,IAAI,SAAuD;EAC/D,OAAO,KAAK,kBAAkB,IAAI,OAAO;CAC3C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignAndExecuteTask.js","names":["BaseStepExecutionTask","TransactionError","LiFiErrorCode","stripHexPrefix","callTronRpcsWithRetry","utils","serializeTronSignedTransaction","CLEARED_TRANSACTION_FIELDS"],"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,cAA4CA,UAAAA,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,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,uBACd,kDACF;
|
|
1
|
+
{"version":3,"file":"TronSignAndExecuteTask.js","names":["BaseStepExecutionTask","TransactionError","LiFiErrorCode","assertNoOpenTransaction","stripHexPrefix","callTronRpcsWithRetry","utils","serializeTronSignedTransaction","CLEARED_TRANSACTION_FIELDS"],"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,cAA4CA,UAAAA,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,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,uBACd,kDACF;EAKFC,CAAAA,GAAAA,UAAAA,wBAAAA,CAAwB,MAAM;EAE9B,IAAI,CAAC,KAAK,oBAAoB,MAC5B,MAAM,IAAIF,UAAAA,iBACRC,UAAAA,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,aAAaE,6BAAAA,eAAe,KAAK,mBAAmB,IAAc;EAExE,MAAM,eACH,KAAK,mBAAmB,YAAY,gBACrC;EAOF,MAAM,cAA2B,MAAMC,kCAAAA,sBACrC,QACA,OAAO,YAAY;GACjB,MAAM,UAAUC,QAAAA,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;EAIAH,CAAAA,GAAAA,UAAAA,wBAAAA,CAAwB,cAAc,WAAW,MAAM,OAAO,IAAI,CAAC;EAEnE,MAAM,oBAAoB,MAAM,OAAO,gBAAgB,WAAW;EAKlEA,CAAAA,GAAAA,UAAAA,wBAAAA,CAAwB,cAAc,WAAW,MAAM,OAAO,IAAI,CAAC;EAInE,MAAM,QAAQI,oCAAAA,+BAA+B,iBAAiB;EAC9D,IAAI,CAAC,OAGH,MAAM,IAAIN,UAAAA,iBACRC,UAAAA,cAAc,uBACd,sEACF;EAKF,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;GACvD,GAAGM,UAAAA;GACH;GACA,UAAU,KAAK,IAAI;EACrB,CAAC;EAED,OAAO;GACL,QAAQ;GACR,SAAS,EAAE,kBAAkB;EAC/B;CACF;AACF"}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/sdk-provider-tron";
|
|
2
|
-
export declare const version = "0.0.0-preview-
|
|
2
|
+
export declare const version = "0.0.0-preview-df697626";
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
// src/version.ts
|
|
3
3
|
const name = "@lifi/sdk-provider-tron";
|
|
4
|
-
const version = "0.0.0-preview-
|
|
4
|
+
const version = "0.0.0-preview-df697626";
|
|
5
5
|
exports.name = name;
|
|
6
6
|
exports.version = version;
|
|
7
7
|
|
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 = '0.0.0-preview-
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-tron'\nexport const version = '0.0.0-preview-df697626'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
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 { TronCheckAllowanceAfterPrepareTask } from './tasks/TronCheckAllowanceAfterPrepareTask.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 TronCheckAllowanceAfterPrepareTask(),\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":";;;;;;;;;AA2BA,IAAa,mBAAb,cAAsC,iBAAiB;
|
|
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 { TronCheckAllowanceAfterPrepareTask } from './tasks/TronCheckAllowanceAfterPrepareTask.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 TronCheckAllowanceAfterPrepareTask(),\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":";;;;;;;;;AA2BA,IAAa,mBAAb,cAAsC,iBAAiB;CAC7C;CAER,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;CAES,eACP,OACA,MACA,WACsB,gBAAgB,OAAO,MAAM,MAAM;CAElD,gBAAgB,OACvB,gBACqC;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB;CACF;CAES,kBACP,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,mCAAmC;GACvC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"mappings":";;;;;;;;;;;qBAea,2CAA2C;mBACrC;WAKF,UAAU,SAAS,0BAA0B;
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"mappings":";;;;;;;;;;;qBAea,2CAA2C;mBACrC;WAKF,UAAU,SAAS,0BAA0B;EAYtD,IAAI,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.js","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, TaskPipeline, type TaskResult } from '@lifi/sdk'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { isZeroAddress } from '../../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './TronSetAllowanceTask.js'\n\n/**\n * Runs after PrepareTransaction. Some providers only know the spender once\n * `/stepTransaction` builds the executable transaction, so the routing-time\n * step carries no `estimate.approvalAddress` and the allowance tasks before\n * prepare do not run. When the re-quote brings one, the allowance is read for\n * it, and set only if it falls short, before the transaction is signed.\n *\n * A spender that was already checked before prepare is not checked again.\n */\nexport class TronCheckAllowanceAfterPrepareTask extends BaseStepExecutionTask {\n private readonly allowancePipeline = new TaskPipeline([\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n ])\n\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n const { step, hasSufficientAllowance } = context\n // `hasSufficientAllowance` is only set by the allowance tasks, so it is\n // unset exactly when none ran before prepare.\n return (\n hasSufficientAllowance === undefined &&\n !isZeroAddress(step.action.fromToken.address) &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n )\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n return this.allowancePipeline.run(context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,qCAAb,cAAwD,sBAAsB;
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceAfterPrepareTask.js","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceAfterPrepareTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, TaskPipeline, type TaskResult } from '@lifi/sdk'\nimport type { TronStepExecutorContext } from '../../types.js'\nimport { isZeroAddress } from '../../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './TronSetAllowanceTask.js'\n\n/**\n * Runs after PrepareTransaction. Some providers only know the spender once\n * `/stepTransaction` builds the executable transaction, so the routing-time\n * step carries no `estimate.approvalAddress` and the allowance tasks before\n * prepare do not run. When the re-quote brings one, the allowance is read for\n * it, and set only if it falls short, before the transaction is signed.\n *\n * A spender that was already checked before prepare is not checked again.\n */\nexport class TronCheckAllowanceAfterPrepareTask extends BaseStepExecutionTask {\n private readonly allowancePipeline = new TaskPipeline([\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n ])\n\n override async shouldRun(context: TronStepExecutorContext): Promise<boolean> {\n const { step, hasSufficientAllowance } = context\n // `hasSufficientAllowance` is only set by the allowance tasks, so it is\n // unset exactly when none ran before prepare.\n return (\n hasSufficientAllowance === undefined &&\n !isZeroAddress(step.action.fromToken.address) &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n )\n }\n\n async run(context: TronStepExecutorContext): Promise<TaskResult> {\n return this.allowancePipeline.run(context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,qCAAb,cAAwD,sBAAsB;CAC3D,oBAAoB,IAAI,aAAa,CACpD,IAAI,uBAAuB,GAC3B,IAAI,qBAAqB,CAC3B,CAAC;CAED,MAAe,UAAU,SAAoD;EAC3E,MAAM,EAAE,MAAM,2BAA2B;EAGzC,OACE,2BAA2B,KAAA,KAC3B,CAAC,cAAc,KAAK,OAAO,UAAU,OAAO,KAC5C,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;CAEnB;CAEA,MAAM,IAAI,SAAuD;EAC/D,OAAO,KAAK,kBAAkB,IAAI,OAAO;CAC3C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"mappings":";;qBAUa,+BAA+B;WAC3B,UAAU,SAAS,0BAA0B;
|
|
1
|
+
{"version":3,"file":"TronCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronCheckAllowanceTask.ts"],"mappings":";;qBAUa,+BAA+B;WAC3B,UAAU,SAAS,0BAA0B;EAItD,IAAI,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSetAllowanceTask.ts"],"mappings":";;qBAea,6BAA6B;WACzB,UAAU,SAAS,0BAA0B;
|
|
1
|
+
{"version":3,"file":"TronSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSetAllowanceTask.ts"],"mappings":";;qBAea,6BAA6B;WACzB,UAAU,SAAS,0BAA0B;EAItD,IAAI,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"mappings":";;qBAea,+BAA+B;
|
|
1
|
+
{"version":3,"file":"TronSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronSignAndExecuteTask.ts"],"mappings":";;qBAea,+BAA+B;EACpC,IAAI,SAAS,0BAA0B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronWaitForTransactionTask.ts"],"mappings":";;qBAgBa,mCAAmC;
|
|
1
|
+
{"version":3,"file":"TronWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/TronWaitForTransactionTask.ts"],"mappings":";;qBAgBa,mCAAmC;EACxC,IAAI,SAAS,0BAA0B,QAAQ"}
|
package/dist/esm/version.d.ts
CHANGED
package/dist/esm/version.js
CHANGED
package/dist/esm/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 = '0.0.0-preview-
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-tron'\nexport const version = '0.0.0-preview-df697626'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-tron",
|
|
3
|
-
"version": "0.0.0-preview-
|
|
3
|
+
"version": "0.0.0-preview-df697626",
|
|
4
4
|
"description": "LI.FI Tron SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lifi/sdk": "0.0.0-preview-
|
|
31
|
+
"@lifi/sdk": "0.0.0-preview-df697626",
|
|
32
32
|
"@tronweb3/tronwallet-abstract-adapter": "^1.3.0",
|
|
33
33
|
"tronweb": "^6.5.2"
|
|
34
34
|
},
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk-provider-tron'
|
|
2
|
-
export const version = '0.0.0-preview-
|
|
2
|
+
export const version = '0.0.0-preview-df697626'
|