@lifi/sdk-provider-ethereum 4.2.12 → 4.3.1
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 +61 -0
- package/dist/cjs/EthereumProvider.d.ts +1 -4
- package/dist/cjs/EthereumProvider.js +1 -2
- package/dist/cjs/actions/checkPermitSupport.d.ts +1 -4
- package/dist/cjs/actions/checkPermitSupport.js +5 -6
- package/dist/cjs/actions/checkPermitSupport.js.map +1 -1
- package/dist/cjs/actions/constants.d.ts +1 -4
- package/dist/cjs/actions/constants.js +1 -2
- package/dist/cjs/actions/getAccountCode.d.ts +1 -4
- package/dist/cjs/actions/getAccountCode.js +1 -2
- package/dist/cjs/actions/getAllowance.d.ts +2 -5
- package/dist/cjs/actions/getAllowance.js +6 -7
- package/dist/cjs/actions/getAllowance.js.map +1 -1
- package/dist/cjs/actions/getEthereumBalance.d.ts +1 -4
- package/dist/cjs/actions/getEthereumBalance.js +1 -2
- package/dist/cjs/actions/getMaxPriorityFeePerGas.d.ts +1 -4
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js +3 -4
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js.map +1 -1
- package/dist/cjs/actions/getMulticallAddress.d.ts +1 -4
- package/dist/cjs/actions/getMulticallAddress.js +1 -2
- package/dist/cjs/actions/isBatchingSupported.d.ts +1 -4
- package/dist/cjs/actions/isBatchingSupported.js +1 -2
- package/dist/cjs/actions/isSafeSignature.d.ts +2 -5
- package/dist/cjs/actions/isSafeSignature.js +3 -3
- package/dist/cjs/actions/isSafeSignature.js.map +1 -1
- package/dist/cjs/actions/isSafeWallet.d.ts +1 -4
- package/dist/cjs/actions/isSafeWallet.js +2 -3
- package/dist/cjs/actions/isSmartContractWallet.d.ts +1 -4
- package/dist/cjs/actions/isSmartContractWallet.js +1 -2
- package/dist/cjs/actions/resolveENSAddress.d.ts +1 -4
- package/dist/cjs/actions/resolveENSAddress.js +1 -2
- package/dist/cjs/actions/resolveEthereumAddress.d.ts +1 -4
- package/dist/cjs/actions/resolveEthereumAddress.js +1 -2
- package/dist/cjs/actions/resolveTransactionHash.d.ts +1 -4
- package/dist/cjs/actions/resolveTransactionHash.js +7 -4
- package/dist/cjs/actions/resolveTransactionHash.js.map +1 -1
- package/dist/cjs/actions/resolveUNSAddress.d.ts +1 -4
- package/dist/cjs/actions/resolveUNSAddress.js +2 -3
- package/dist/cjs/actions/setAllowance.d.ts +3 -6
- package/dist/cjs/actions/setAllowance.js +10 -7
- package/dist/cjs/actions/setAllowance.js.map +1 -1
- package/dist/cjs/actions/waitForBatchTransactionReceipt.d.ts +1 -4
- package/dist/cjs/actions/waitForBatchTransactionReceipt.js +1 -2
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.d.ts +2 -5
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js +50 -12
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js.map +1 -1
- package/dist/cjs/actions/waitForSafeTransactionExecution.d.ts +1 -4
- package/dist/cjs/actions/waitForSafeTransactionExecution.js +2 -3
- package/dist/cjs/actions/waitForTransactionReceipt.d.ts +1 -4
- package/dist/cjs/actions/waitForTransactionReceipt.js +1 -2
- package/dist/cjs/client/publicClient.d.ts +1 -4
- package/dist/cjs/client/publicClient.js +1 -2
- package/dist/cjs/client/safeClient.d.ts +1 -4
- package/dist/cjs/client/safeClient.js +1 -2
- package/dist/cjs/client/types.d.ts +1 -4
- package/dist/cjs/core/EthereumStepExecutor.d.ts +1 -4
- package/dist/cjs/core/EthereumStepExecutor.js +6 -7
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js +5 -3
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js +1 -2
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js +1 -2
- package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js +3 -4
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +3 -3
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +2 -3
- package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js +5 -6
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js +1 -2
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +7 -6
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +3 -4
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js +2 -3
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js +6 -6
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +7 -7
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js +2 -3
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +6 -6
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js +1 -2
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js +1 -2
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js +2 -3
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js +3 -4
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js +2 -3
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.js +2 -3
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +6 -4
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/getTxLink.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/getTxLink.js +1 -2
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +10 -5
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +11 -20
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js +1 -2
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js +1 -2
- package/dist/cjs/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.js +1 -2
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js +1 -2
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js +1 -2
- package/dist/cjs/core/tasks/helpers/resolveAllowanceSpender.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/resolveAllowanceSpender.js +1 -2
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js +1 -2
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js +2 -2
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +3 -4
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js +1 -2
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/switchChain.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/switchChain.js +1 -2
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.d.ts +1 -4
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js +1 -2
- package/dist/cjs/errors/parseEthereumErrors.d.ts +1 -4
- package/dist/cjs/errors/parseEthereumErrors.js +3 -3
- package/dist/cjs/errors/parseEthereumErrors.js.map +1 -1
- package/dist/cjs/hyperliquid/agentWallet.d.ts +1 -4
- package/dist/cjs/hyperliquid/agentWallet.js +1 -2
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.d.ts +1 -4
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js +1 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/permits/acceptsRawEcdsaSignature.d.ts +1 -4
- package/dist/cjs/permits/acceptsRawEcdsaSignature.js +1 -2
- package/dist/cjs/permits/allowanceTransfer.d.ts +1 -4
- package/dist/cjs/permits/allowanceTransfer.js +1 -2
- package/dist/cjs/permits/allowanceTransfer.js.map +1 -1
- package/dist/cjs/permits/canAccountUseNativePermits.d.ts +1 -4
- package/dist/cjs/permits/canAccountUseNativePermits.js +1 -2
- package/dist/cjs/permits/canAccountUsePermit2.d.ts +1 -4
- package/dist/cjs/permits/canAccountUsePermit2.js +1 -2
- package/dist/cjs/permits/constants.d.ts +1 -4
- package/dist/cjs/permits/constants.js +1 -2
- package/dist/cjs/permits/domain.d.ts +1 -4
- package/dist/cjs/permits/domain.js +1 -2
- package/dist/cjs/permits/encodeNativePermitData.d.ts +1 -4
- package/dist/cjs/permits/encodeNativePermitData.js +1 -2
- package/dist/cjs/permits/encodePermit2Data.d.ts +1 -4
- package/dist/cjs/permits/encodePermit2Data.js +1 -2
- package/dist/cjs/permits/getNativePermit.d.ts +1 -4
- package/dist/cjs/permits/getNativePermit.js +7 -8
- package/dist/cjs/permits/getNativePermit.js.map +1 -1
- package/dist/cjs/permits/getPermitTransferFromValues.d.ts +1 -4
- package/dist/cjs/permits/getPermitTransferFromValues.js +2 -3
- package/dist/cjs/permits/getPermitTransferFromValues.js.map +1 -1
- package/dist/cjs/permits/invariant.d.ts +1 -4
- package/dist/cjs/permits/invariant.js +1 -2
- package/dist/cjs/permits/isDelegationDesignatorCode.d.ts +1 -4
- package/dist/cjs/permits/isDelegationDesignatorCode.js +1 -2
- package/dist/cjs/permits/isNativePermitValid.d.ts +1 -4
- package/dist/cjs/permits/isNativePermitValid.js +2 -3
- package/dist/cjs/permits/isNativePermitValid.js.map +1 -1
- package/dist/cjs/permits/signPermit2Message.d.ts +1 -4
- package/dist/cjs/permits/signPermit2Message.js +1 -2
- package/dist/cjs/permits/signPermit2Message.js.map +1 -1
- package/dist/cjs/permits/signatureTransfer.d.ts +1 -4
- package/dist/cjs/permits/signatureTransfer.js +1 -2
- package/dist/cjs/permits/signatureTransfer.js.map +1 -1
- package/dist/cjs/permits/types.d.ts +1 -4
- package/dist/cjs/types.d.ts +7 -4
- package/dist/cjs/types.js +1 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/abi.d.ts +1 -4
- package/dist/cjs/utils/abi.js +1 -2
- package/dist/cjs/utils/convertExtendedChain.d.ts +1 -4
- package/dist/cjs/utils/convertExtendedChain.js +1 -2
- package/dist/cjs/utils/getActionWithFallback.d.ts +2 -4
- package/dist/cjs/utils/getActionWithFallback.js +3 -4
- package/dist/cjs/utils/getActionWithFallback.js.map +1 -1
- package/dist/cjs/utils/getDomainChainId.d.ts +1 -4
- package/dist/cjs/utils/getDomainChainId.js +1 -2
- package/dist/cjs/utils/getSafeApiKey.d.ts +1 -4
- package/dist/cjs/utils/getSafeApiKey.js +1 -2
- package/dist/cjs/utils/getSendChain.d.ts +2 -0
- package/dist/cjs/utils/getSendChain.js +6 -0
- package/dist/cjs/utils/getSendChain.js.map +1 -0
- package/dist/cjs/utils/getTypedDataLane.d.ts +1 -4
- package/dist/cjs/utils/getTypedDataLane.js +1 -2
- package/dist/cjs/utils/isContractCallStep.d.ts +1 -4
- package/dist/cjs/utils/isContractCallStep.js +1 -2
- package/dist/cjs/utils/isExtendedChain.d.ts +1 -4
- package/dist/cjs/utils/isExtendedChain.js +1 -2
- package/dist/cjs/utils/isGaslessStep.d.ts +8 -4
- package/dist/cjs/utils/isGaslessStep.js +8 -2
- package/dist/cjs/utils/isGaslessStep.js.map +1 -1
- package/dist/cjs/utils/isValidSignature.d.ts +1 -4
- package/dist/cjs/utils/isValidSignature.js +1 -2
- package/dist/cjs/utils/isZeroAddress.d.ts +1 -4
- package/dist/cjs/utils/isZeroAddress.js +1 -2
- package/dist/cjs/utils/median.d.ts +1 -4
- package/dist/cjs/utils/median.js +1 -2
- package/dist/cjs/version.d.ts +1 -4
- package/dist/cjs/version.js +2 -3
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/EthereumProvider.d.ts +0 -2
- package/dist/esm/EthereumProvider.d.ts.map +1 -1
- package/dist/esm/EthereumProvider.js +1 -2
- package/dist/esm/actions/checkPermitSupport.d.ts +0 -2
- package/dist/esm/actions/checkPermitSupport.d.ts.map +1 -1
- package/dist/esm/actions/checkPermitSupport.js +5 -6
- package/dist/esm/actions/checkPermitSupport.js.map +1 -1
- package/dist/esm/actions/constants.d.ts +0 -2
- package/dist/esm/actions/constants.d.ts.map +1 -1
- package/dist/esm/actions/constants.js +1 -2
- package/dist/esm/actions/getAccountCode.d.ts +0 -2
- package/dist/esm/actions/getAccountCode.d.ts.map +1 -1
- package/dist/esm/actions/getAccountCode.js +1 -2
- package/dist/esm/actions/getAllowance.d.ts +1 -3
- package/dist/esm/actions/getAllowance.d.ts.map +1 -1
- package/dist/esm/actions/getAllowance.js +6 -7
- package/dist/esm/actions/getAllowance.js.map +1 -1
- package/dist/esm/actions/getEthereumBalance.d.ts +0 -2
- package/dist/esm/actions/getEthereumBalance.d.ts.map +1 -1
- package/dist/esm/actions/getEthereumBalance.js +1 -2
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts +1 -3
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/esm/actions/getMaxPriorityFeePerGas.js +3 -4
- package/dist/esm/actions/getMaxPriorityFeePerGas.js.map +1 -1
- package/dist/esm/actions/getMulticallAddress.d.ts +0 -2
- package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -1
- package/dist/esm/actions/getMulticallAddress.js +1 -2
- package/dist/esm/actions/isBatchingSupported.d.ts +0 -2
- package/dist/esm/actions/isBatchingSupported.d.ts.map +1 -1
- package/dist/esm/actions/isBatchingSupported.js +1 -2
- package/dist/esm/actions/isSafeSignature.d.ts +1 -3
- package/dist/esm/actions/isSafeSignature.d.ts.map +1 -1
- package/dist/esm/actions/isSafeSignature.js +3 -3
- package/dist/esm/actions/isSafeSignature.js.map +1 -1
- package/dist/esm/actions/isSafeWallet.d.ts +0 -2
- package/dist/esm/actions/isSafeWallet.d.ts.map +1 -1
- package/dist/esm/actions/isSafeWallet.js +2 -3
- package/dist/esm/actions/isSmartContractWallet.d.ts +0 -2
- package/dist/esm/actions/isSmartContractWallet.d.ts.map +1 -1
- package/dist/esm/actions/isSmartContractWallet.js +1 -2
- package/dist/esm/actions/resolveENSAddress.d.ts +0 -2
- package/dist/esm/actions/resolveENSAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveENSAddress.js +1 -2
- package/dist/esm/actions/resolveEthereumAddress.d.ts +0 -2
- package/dist/esm/actions/resolveEthereumAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveEthereumAddress.js +1 -2
- package/dist/esm/actions/resolveTransactionHash.d.ts +0 -2
- package/dist/esm/actions/resolveTransactionHash.d.ts.map +1 -1
- package/dist/esm/actions/resolveTransactionHash.js +7 -4
- package/dist/esm/actions/resolveTransactionHash.js.map +1 -1
- package/dist/esm/actions/resolveUNSAddress.d.ts +0 -2
- package/dist/esm/actions/resolveUNSAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveUNSAddress.js +2 -3
- package/dist/esm/actions/setAllowance.d.ts +2 -4
- package/dist/esm/actions/setAllowance.d.ts.map +1 -1
- package/dist/esm/actions/setAllowance.js +10 -7
- package/dist/esm/actions/setAllowance.js.map +1 -1
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts +0 -2
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/actions/waitForBatchTransactionReceipt.js +1 -2
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts +1 -3
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js +51 -13
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts +0 -2
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts.map +1 -1
- package/dist/esm/actions/waitForSafeTransactionExecution.js +2 -3
- package/dist/esm/actions/waitForTransactionReceipt.d.ts +0 -2
- package/dist/esm/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/actions/waitForTransactionReceipt.js +1 -2
- package/dist/esm/client/publicClient.d.ts +0 -2
- package/dist/esm/client/publicClient.d.ts.map +1 -1
- package/dist/esm/client/publicClient.js +1 -2
- package/dist/esm/client/safeClient.d.ts +0 -2
- package/dist/esm/client/safeClient.d.ts.map +1 -1
- package/dist/esm/client/safeClient.js +1 -2
- package/dist/esm/client/types.d.ts +0 -2
- package/dist/esm/client/types.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.d.ts +0 -2
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.js +6 -7
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js +5 -3
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js +1 -2
- package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js +1 -2
- package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js +3 -4
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +4 -4
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +2 -3
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.js +5 -6
- package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js +1 -2
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +8 -7
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +3 -4
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js +2 -3
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js +6 -6
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +7 -7
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js +2 -3
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +6 -6
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js +1 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js +1 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js +2 -3
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -3
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js +3 -4
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js.map +1 -1
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.js +2 -3
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getApprovalAmount.js +2 -3
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +6 -4
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getTxLink.js +1 -2
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +10 -4
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js +12 -21
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js +1 -2
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js +1 -2
- package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.js +1 -2
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js +1 -2
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js +1 -2
- package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.js +1 -2
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.js +1 -2
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js +3 -3
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +3 -4
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.js +1 -2
- package/dist/esm/core/tasks/helpers/switchChain.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/switchChain.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/switchChain.js +1 -2
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts +0 -2
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js +1 -2
- package/dist/esm/errors/parseEthereumErrors.d.ts +0 -2
- package/dist/esm/errors/parseEthereumErrors.d.ts.map +1 -1
- package/dist/esm/errors/parseEthereumErrors.js +4 -4
- package/dist/esm/errors/parseEthereumErrors.js.map +1 -1
- package/dist/esm/hyperliquid/agentWallet.d.ts +0 -2
- package/dist/esm/hyperliquid/agentWallet.d.ts.map +1 -1
- package/dist/esm/hyperliquid/agentWallet.js +1 -2
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts +0 -2
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts.map +1 -1
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.js +1 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +8 -8
- package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts +0 -2
- package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts.map +1 -1
- package/dist/esm/permits/acceptsRawEcdsaSignature.js +1 -2
- package/dist/esm/permits/allowanceTransfer.d.ts +0 -2
- package/dist/esm/permits/allowanceTransfer.d.ts.map +1 -1
- package/dist/esm/permits/allowanceTransfer.js +1 -2
- package/dist/esm/permits/allowanceTransfer.js.map +1 -1
- package/dist/esm/permits/canAccountUseNativePermits.d.ts +0 -2
- package/dist/esm/permits/canAccountUseNativePermits.d.ts.map +1 -1
- package/dist/esm/permits/canAccountUseNativePermits.js +1 -2
- package/dist/esm/permits/canAccountUsePermit2.d.ts +0 -2
- package/dist/esm/permits/canAccountUsePermit2.d.ts.map +1 -1
- package/dist/esm/permits/canAccountUsePermit2.js +1 -2
- package/dist/esm/permits/constants.d.ts +0 -2
- package/dist/esm/permits/constants.d.ts.map +1 -1
- package/dist/esm/permits/constants.js +1 -2
- package/dist/esm/permits/domain.d.ts +0 -2
- package/dist/esm/permits/domain.d.ts.map +1 -1
- package/dist/esm/permits/domain.js +1 -2
- package/dist/esm/permits/encodeNativePermitData.d.ts +0 -2
- package/dist/esm/permits/encodeNativePermitData.d.ts.map +1 -1
- package/dist/esm/permits/encodeNativePermitData.js +1 -2
- package/dist/esm/permits/encodePermit2Data.d.ts +0 -2
- package/dist/esm/permits/encodePermit2Data.d.ts.map +1 -1
- package/dist/esm/permits/encodePermit2Data.js +1 -2
- package/dist/esm/permits/getNativePermit.d.ts +0 -2
- package/dist/esm/permits/getNativePermit.d.ts.map +1 -1
- package/dist/esm/permits/getNativePermit.js +7 -8
- package/dist/esm/permits/getNativePermit.js.map +1 -1
- package/dist/esm/permits/getPermitTransferFromValues.d.ts +0 -2
- package/dist/esm/permits/getPermitTransferFromValues.d.ts.map +1 -1
- package/dist/esm/permits/getPermitTransferFromValues.js +2 -3
- package/dist/esm/permits/getPermitTransferFromValues.js.map +1 -1
- package/dist/esm/permits/invariant.d.ts +0 -2
- package/dist/esm/permits/invariant.d.ts.map +1 -1
- package/dist/esm/permits/invariant.js +1 -2
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts +0 -2
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts.map +1 -1
- package/dist/esm/permits/isDelegationDesignatorCode.js +1 -2
- package/dist/esm/permits/isNativePermitValid.d.ts +0 -2
- package/dist/esm/permits/isNativePermitValid.d.ts.map +1 -1
- package/dist/esm/permits/isNativePermitValid.js +2 -3
- package/dist/esm/permits/isNativePermitValid.js.map +1 -1
- package/dist/esm/permits/signPermit2Message.d.ts +0 -2
- package/dist/esm/permits/signPermit2Message.d.ts.map +1 -1
- package/dist/esm/permits/signPermit2Message.js +1 -2
- package/dist/esm/permits/signatureTransfer.d.ts +0 -2
- package/dist/esm/permits/signatureTransfer.d.ts.map +1 -1
- package/dist/esm/permits/signatureTransfer.js +1 -2
- package/dist/esm/permits/types.d.ts +0 -2
- package/dist/esm/permits/types.d.ts.map +1 -1
- package/dist/esm/types.d.ts +6 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/abi.d.ts +0 -2
- package/dist/esm/utils/abi.d.ts.map +1 -1
- package/dist/esm/utils/abi.js +1 -2
- package/dist/esm/utils/convertExtendedChain.d.ts +0 -2
- package/dist/esm/utils/convertExtendedChain.d.ts.map +1 -1
- package/dist/esm/utils/convertExtendedChain.js +1 -2
- package/dist/esm/utils/getActionWithFallback.d.ts +2 -3
- package/dist/esm/utils/getActionWithFallback.d.ts.map +1 -1
- package/dist/esm/utils/getActionWithFallback.js +3 -4
- package/dist/esm/utils/getActionWithFallback.js.map +1 -1
- package/dist/esm/utils/getDomainChainId.d.ts +0 -2
- package/dist/esm/utils/getDomainChainId.d.ts.map +1 -1
- package/dist/esm/utils/getDomainChainId.js +1 -2
- package/dist/esm/utils/getSafeApiKey.d.ts +0 -2
- package/dist/esm/utils/getSafeApiKey.d.ts.map +1 -1
- package/dist/esm/utils/getSafeApiKey.js +1 -2
- package/dist/esm/utils/getSendChain.d.ts +3 -0
- package/dist/esm/utils/getSendChain.d.ts.map +1 -0
- package/dist/esm/utils/getSendChain.js +5 -0
- package/dist/esm/utils/getSendChain.js.map +1 -0
- package/dist/esm/utils/getTypedDataLane.d.ts +0 -2
- package/dist/esm/utils/getTypedDataLane.d.ts.map +1 -1
- package/dist/esm/utils/getTypedDataLane.js +1 -2
- package/dist/esm/utils/isContractCallStep.d.ts +0 -2
- package/dist/esm/utils/isContractCallStep.d.ts.map +1 -1
- package/dist/esm/utils/isContractCallStep.js +1 -2
- package/dist/esm/utils/isExtendedChain.d.ts +0 -2
- package/dist/esm/utils/isExtendedChain.d.ts.map +1 -1
- package/dist/esm/utils/isExtendedChain.js +1 -2
- package/dist/esm/utils/isGaslessStep.d.ts +7 -2
- package/dist/esm/utils/isGaslessStep.d.ts.map +1 -1
- package/dist/esm/utils/isGaslessStep.js +8 -2
- package/dist/esm/utils/isGaslessStep.js.map +1 -1
- package/dist/esm/utils/isValidSignature.d.ts +0 -2
- package/dist/esm/utils/isValidSignature.d.ts.map +1 -1
- package/dist/esm/utils/isValidSignature.js +1 -2
- package/dist/esm/utils/isZeroAddress.d.ts +0 -2
- package/dist/esm/utils/isZeroAddress.d.ts.map +1 -1
- package/dist/esm/utils/isZeroAddress.js +1 -2
- package/dist/esm/utils/median.d.ts +0 -2
- package/dist/esm/utils/median.d.ts.map +1 -1
- package/dist/esm/utils/median.js +1 -2
- package/dist/esm/version.d.ts +1 -3
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +2 -3
- package/dist/esm/version.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/checkPermitSupport.ts +4 -2
- package/src/actions/getAllowance.ts +8 -4
- package/src/actions/getMaxPriorityFeePerGas.ts +4 -2
- package/src/actions/isSafeSignature.ts +3 -3
- package/src/actions/resolveTransactionHash.ts +10 -3
- package/src/actions/setAllowance.ts +31 -6
- package/src/actions/waitForRelayedTransactionReceipt.ts +129 -24
- package/src/core/tasks/EthereumBatchedSignAndExecuteTask.ts +4 -0
- package/src/core/tasks/EthereumCheckAllowanceTask.ts +3 -2
- package/src/core/tasks/EthereumCheckBalanceTask.ts +11 -1
- package/src/core/tasks/EthereumNativePermitTask.ts +2 -1
- package/src/core/tasks/EthereumPrepareTransactionTask.ts +29 -3
- package/src/core/tasks/EthereumResetAllowanceTask.ts +4 -2
- package/src/core/tasks/EthereumSetAllowanceTask.ts +4 -2
- package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +4 -2
- package/src/core/tasks/helpers/estimateTransactionRequest.ts +4 -2
- package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +12 -3
- package/src/core/tasks/helpers/getUpdatedStep.ts +26 -25
- package/src/core/tasks/helpers/shouldCheckForAllowance.ts +8 -0
- package/src/errors/parseEthereumErrors.ts +11 -2
- package/src/index.ts +0 -1
- package/src/permits/allowanceTransfer.ts +1 -1
- package/src/permits/getNativePermit.ts +9 -5
- package/src/permits/getPermitTransferFromValues.ts +2 -1
- package/src/permits/isNativePermitValid.ts +1 -1
- package/src/types.ts +7 -2
- package/src/utils/getActionWithFallback.ts +3 -2
- package/src/utils/getSendChain.ts +6 -0
- package/src/utils/isGaslessStep.ts +7 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumSetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'\nimport { setAllowance } from '../../actions/setAllowance.js'\nimport { waitForTransactionReceipt } from '../../actions/waitForTransactionReceipt.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { getApprovalAmount } from './helpers/getApprovalAmount.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumSetAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n return !context.hasMatchingPermit && !context.hasSufficientAllowance\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n statusManager,\n executionOptions,\n fromChain,\n allowUserInteraction,\n checkClient,\n calls: currentCalls,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'SET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n // Clear the txHash and txLink from potential previous approval transaction\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED', {\n txHash: undefined,\n txLink: undefined,\n })\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const batchingSupported = executionStrategy === 'batched'\n // Check if chain has Permit2 contract deployed. Permit2 should not be available for atomic batch.\n const { permit2Supported, spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n // Set new allowance\n const approveAmount = getApprovalAmount(context, permit2Supported)\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const approveResult = await setAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n spenderAddress,\n approveAmount,\n executionOptions,\n // We need to return the populated transaction when batching is supported\n // instead of executing transaction on-chain\n batchingSupported\n )\n\n const calls = [...currentCalls]\n if (batchingSupported) {\n calls.push({\n to: step.action.fromToken.address as Address,\n data: approveResult,\n chainId: step.action.fromToken.chainId,\n })\n\n statusManager.updateAction(step, action.type, 'DONE')\n } else {\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n approveResult,\n fromChain.id\n )\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: resolvedTxHash,\n txLink: getTxLink(fromChain, resolvedTxHash),\n })\n\n const transactionReceipt = await waitForTransactionReceipt(client, {\n client: updatedClient,\n chainId: fromChain.id,\n txHash:
|
|
1
|
+
{"version":3,"file":"EthereumSetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'\nimport { setAllowance } from '../../actions/setAllowance.js'\nimport { waitForTransactionReceipt } from '../../actions/waitForTransactionReceipt.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { convertExtendedChain } from '../../utils/convertExtendedChain.js'\nimport { getApprovalAmount } from './helpers/getApprovalAmount.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumSetAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n return !context.hasMatchingPermit && !context.hasSufficientAllowance\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n statusManager,\n executionOptions,\n fromChain,\n allowUserInteraction,\n checkClient,\n calls: currentCalls,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'SET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n // Clear the txHash and txLink from potential previous approval transaction\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED', {\n txHash: undefined,\n txLink: undefined,\n })\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const batchingSupported = executionStrategy === 'batched'\n // Check if chain has Permit2 contract deployed. Permit2 should not be available for atomic batch.\n const { permit2Supported, spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n // Set new allowance\n const approveAmount = getApprovalAmount(context, permit2Supported)\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const approveResult = await setAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n spenderAddress,\n approveAmount,\n executionOptions,\n // We need to return the populated transaction when batching is supported\n // instead of executing transaction on-chain\n batchingSupported,\n convertExtendedChain(fromChain)\n )\n\n const calls = [...currentCalls]\n if (batchingSupported) {\n calls.push({\n to: step.action.fromToken.address as Address,\n data: approveResult,\n chainId: step.action.fromToken.chainId,\n })\n\n statusManager.updateAction(step, action.type, 'DONE')\n } else {\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n approveResult,\n fromChain.id\n )\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: resolvedTxHash,\n txLink: getTxLink(fromChain, resolvedTxHash),\n })\n\n const transactionReceipt = await waitForTransactionReceipt(client, {\n client: updatedClient,\n chainId: fromChain.id,\n txHash: resolvedTxHash,\n onReplaced(response) {\n const newHash = response.transaction.hash\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: newHash,\n txLink: getTxLink(fromChain, newHash),\n })\n },\n })\n\n const finalHash = transactionReceipt?.transactionHash || resolvedTxHash\n statusManager.updateAction(step, action.type, 'DONE', {\n txHash: finalHash,\n txLink: getTxLink(fromChain, finalHash),\n })\n }\n\n return {\n status: 'COMPLETED',\n context: { calls, executionStrategy },\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAa,2BAAb,cAA8C,sBAAsB;CAClE,MAAe,UACb,SACkB;EAClB,OAAO,CAAC,QAAQ,qBAAqB,CAAC,QAAQ;CAChD;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,QACA,eACA,kBACA,WACA,sBACA,aACA,OAAO,iBACL;EAEJ,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAGD,cAAc,aAAa,MAAM,OAAO,MAAM,mBAAmB;GAC/D,QAAQ,KAAA;GACR,QAAQ,KAAA;EACV,CAAC;EAED,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,oBAAoB,MAAM,6BAA6B,OAAO;EACpE,MAAM,oBAAoB,sBAAsB;EAEhD,MAAM,EAAE,kBAAkB,mBAAmB,MAAM,wBACjD,SACA,iBACF;EAGA,MAAM,gBAAgB,kBAAkB,SAAS,gBAAgB;EAEjE,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,gBAAgB,MAAM,aAC1B,QACA,eACA,KAAK,OAAO,UAAU,SACtB,gBACA,eACA,kBAGA,mBACA,qBAAqB,SAAS,CAChC;EAEA,MAAM,QAAQ,CAAC,GAAG,YAAY;EAC9B,IAAI,mBAAmB;GACrB,MAAM,KAAK;IACT,IAAI,KAAK,OAAO,UAAU;IAC1B,MAAM;IACN,SAAS,KAAK,OAAO,UAAU;GACjC,CAAC;GAED,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EACtD,OAAO;GACL,MAAM,iBAAiB,MAAM,uBAC3B,QACA,eACA,eACA,UAAU,EACZ;GACA,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;IACvD,QAAQ;IACR,QAAQ,UAAU,WAAW,cAAc;GAC7C,CAAC;GAeD,MAAM,aAAY,MAbe,0BAA0B,QAAQ;IACjE,QAAQ;IACR,SAAS,UAAU;IACnB,QAAQ;IACR,WAAW,UAAU;KACnB,MAAM,UAAU,SAAS,YAAY;KACrC,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;MACvD,QAAQ;MACR,QAAQ,UAAU,WAAW,OAAO;KACtC,CAAC;IACH;GACF,CAAC,EAAA,EAEqC,mBAAmB;GACzD,cAAc,aAAa,MAAM,OAAO,MAAM,QAAQ;IACpD,QAAQ;IACR,QAAQ,UAAU,WAAW,SAAS;GACxC,CAAC;EACH;EAEA,OAAO;GACL,QAAQ;GACR,SAAS;IAAE;IAAO;GAAkB;EACtC;CACF;AACF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumSignAndExecuteTask.d.ts
|
|
4
3
|
export declare class EthereumSignAndExecuteTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumSignAndExecuteTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSignAndExecuteTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSignAndExecuteTask.ts"],"mappings":";;qBAaa,mCAAmC;EACxC,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
2
1
|
import { EthereumBatchedSignAndExecuteTask } from "./EthereumBatchedSignAndExecuteTask.js";
|
|
3
2
|
import { EthereumRelayedSignAndExecuteTask } from "./EthereumRelayedSignAndExecuteTask.js";
|
|
4
3
|
import { EthereumStandardSignAndExecuteTask } from "./EthereumStandardSignAndExecuteTask.js";
|
|
4
|
+
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
5
5
|
import { BaseStepExecutionTask, LiFiErrorCode, TransactionError, assertNoOpenTransaction } from "@lifi/sdk";
|
|
6
|
-
|
|
6
|
+
// src/core/tasks/EthereumSignAndExecuteTask.ts
|
|
7
7
|
var EthereumSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
8
8
|
async run(context) {
|
|
9
9
|
const { step, statusManager, allowUserInteraction, transactionRequest, isBridgeExecution } = context;
|
|
@@ -18,7 +18,6 @@ var EthereumSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
18
18
|
return new EthereumStandardSignAndExecuteTask().run(context);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { EthereumSignAndExecuteTask };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=EthereumSignAndExecuteTask.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumStandardSignAndExecuteTask.d.ts
|
|
4
3
|
export declare class EthereumStandardSignAndExecuteTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumStandardSignAndExecuteTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStandardSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumStandardSignAndExecuteTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumStandardSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumStandardSignAndExecuteTask.ts"],"mappings":";;qBAuBa,2CAA2C;EAChD,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { resolvePermit2Support } from "./helpers/resolvePermit2Support.js";
|
|
2
1
|
import { resolveTransactionHash } from "../../actions/resolveTransactionHash.js";
|
|
3
|
-
import { getTxLink } from "./helpers/getTxLink.js";
|
|
4
2
|
import { encodeNativePermitData } from "../../permits/encodeNativePermitData.js";
|
|
5
3
|
import { encodePermit2Data } from "../../permits/encodePermit2Data.js";
|
|
6
4
|
import { signPermit2Message } from "../../permits/signPermit2Message.js";
|
|
7
5
|
import { convertExtendedChain } from "../../utils/convertExtendedChain.js";
|
|
6
|
+
import { getSendChain } from "../../utils/getSendChain.js";
|
|
8
7
|
import { estimateTransactionRequest } from "./helpers/estimateTransactionRequest.js";
|
|
9
8
|
import { findSignedNativePermit } from "./helpers/findSignedNativePermit.js";
|
|
9
|
+
import { getTxLink } from "./helpers/getTxLink.js";
|
|
10
|
+
import { resolvePermit2Support } from "./helpers/resolvePermit2Support.js";
|
|
10
11
|
import { BaseStepExecutionTask, CLEARED_TRANSACTION_FIELDS, LiFiErrorCode, TransactionError, assertNoOpenTransaction } from "@lifi/sdk";
|
|
11
12
|
import { sendTransaction } from "viem/actions";
|
|
12
13
|
import { getAction } from "viem/utils";
|
|
13
|
-
|
|
14
|
+
// src/core/tasks/EthereumStandardSignAndExecuteTask.ts
|
|
14
15
|
var EthereumStandardSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
15
16
|
async run(context) {
|
|
16
17
|
const { step, client, fromChain, statusManager, checkClient, transactionRequest, allowUserInteraction, isBridgeExecution } = context;
|
|
@@ -42,7 +43,7 @@ var EthereumStandardSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
42
43
|
...transactionRequest,
|
|
43
44
|
to: fromChain.permit2Proxy
|
|
44
45
|
};
|
|
45
|
-
finalTransactionRequest = await estimateTransactionRequest(client, updatedClient, finalTransactionRequest);
|
|
46
|
+
finalTransactionRequest = await estimateTransactionRequest(client, updatedClient, finalTransactionRequest, fromChain.id);
|
|
46
47
|
}
|
|
47
48
|
assertNoOpenTransaction(statusManager.findAction(step, action.type));
|
|
48
49
|
const txHash = await getAction(updatedClient, sendTransaction, "sendTransaction")({
|
|
@@ -54,7 +55,7 @@ var EthereumStandardSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
54
55
|
gasPrice: finalTransactionRequest.gasPrice,
|
|
55
56
|
maxFeePerGas: finalTransactionRequest.maxFeePerGas,
|
|
56
57
|
maxPriorityFeePerGas: finalTransactionRequest.maxPriorityFeePerGas,
|
|
57
|
-
chain: convertExtendedChain(fromChain)
|
|
58
|
+
chain: getSendChain(updatedClient, convertExtendedChain(fromChain))
|
|
58
59
|
});
|
|
59
60
|
const resolvedTxHash = await resolveTransactionHash(client, updatedClient, txHash, fromChain.id);
|
|
60
61
|
statusManager.updateAction(step, action.type, "PENDING", {
|
|
@@ -70,7 +71,6 @@ var EthereumStandardSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
|
-
//#endregion
|
|
74
74
|
export { EthereumStandardSignAndExecuteTask };
|
|
75
75
|
|
|
76
76
|
//# sourceMappingURL=EthereumStandardSignAndExecuteTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStandardSignAndExecuteTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumStandardSignAndExecuteTask.ts"],"sourcesContent":["import {\n assertNoOpenTransaction,\n BaseStepExecutionTask,\n CLEARED_TRANSACTION_FIELDS,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Address, Hex, SendTransactionParameters } from 'viem'\nimport { sendTransaction } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'\nimport { encodeNativePermitData } from '../../permits/encodeNativePermitData.js'\nimport { encodePermit2Data } from '../../permits/encodePermit2Data.js'\nimport { signPermit2Message } from '../../permits/signPermit2Message.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { convertExtendedChain } from '../../utils/convertExtendedChain.js'\nimport { estimateTransactionRequest } from './helpers/estimateTransactionRequest.js'\nimport { findSignedNativePermit } from './helpers/findSignedNativePermit.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolvePermit2Support } from './helpers/resolvePermit2Support.js'\n\nexport class EthereumStandardSignAndExecuteTask extends BaseStepExecutionTask {\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n fromChain,\n statusManager,\n checkClient,\n transactionRequest,\n allowUserInteraction,\n isBridgeExecution,\n } = context\n\n if (!transactionRequest) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Transaction request is not found.'\n )\n }\n\n const action = statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n if (!action) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Action not found.'\n )\n }\n\n // Make sure that the chain is still correct\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const signedNativePermitTypedData = findSignedNativePermit(context)\n // Resolved *after* the native-permit lookup, and short-circuited when one\n // is found: a matching permit always wins, so resolving the gate first\n // would spend an `eth_getCode` on a verdict this task never reads. The\n // ternary also makes the two routes explicitly exclusive.\n const permit2Supported = signedNativePermitTypedData\n ? false\n : await resolvePermit2Support(context, 'standard')\n if (signedNativePermitTypedData) {\n transactionRequest.data = encodeNativePermitData(\n step.action.fromToken.address as Address,\n BigInt(step.action.fromAmount),\n signedNativePermitTypedData.message.deadline,\n signedNativePermitTypedData.signature,\n transactionRequest.data as Hex\n )\n } else if (permit2Supported) {\n statusManager.updateAction(step, action.type, 'MESSAGE_REQUIRED')\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n const permit2Signature = await signPermit2Message(client, {\n client: updatedClient,\n chain: fromChain,\n tokenAddress: step.action.fromToken.address as Address,\n amount: BigInt(step.action.fromAmount),\n data: transactionRequest.data as Hex,\n })\n transactionRequest.data = encodePermit2Data(\n step.action.fromToken.address as Address,\n BigInt(step.action.fromAmount),\n permit2Signature.message.nonce,\n permit2Signature.message.deadline,\n transactionRequest.data as Hex,\n permit2Signature.signature\n )\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n }\n\n let finalTransactionRequest = transactionRequest\n if (signedNativePermitTypedData || permit2Supported) {\n // Target address should be the Permit2 proxy contract in case of native permit or Permit2\n finalTransactionRequest = {\n ...transactionRequest,\n to: fromChain.permit2Proxy as Address,\n }\n finalTransactionRequest = await estimateTransactionRequest(\n client,\n updatedClient,\n finalTransactionRequest\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 awaits above\n // (strategy, chain switch, permit prompt, gas estimate).\n assertNoOpenTransaction(statusManager.findAction(step, action.type))\n\n const txHash = await getAction(\n updatedClient,\n sendTransaction,\n 'sendTransaction'\n )({\n to: finalTransactionRequest.to as Address,\n account: updatedClient.account!,\n data: finalTransactionRequest.data as Hex,\n value: finalTransactionRequest.value,\n gas: finalTransactionRequest.gas,\n gasPrice: finalTransactionRequest.gasPrice,\n maxFeePerGas: finalTransactionRequest.maxFeePerGas,\n maxPriorityFeePerGas: finalTransactionRequest.maxPriorityFeePerGas,\n chain: convertExtendedChain(fromChain),\n } as SendTransactionParameters)\n\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n txHash,\n fromChain.id\n )\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n // A new transaction: nothing of the previous one may survive, least of\n // all its `txFinal` verdict.\n ...CLEARED_TRANSACTION_FIELDS,\n txHash: resolvedTxHash,\n txLink: getTxLink(fromChain, resolvedTxHash),\n txType: 'standard',\n signedAt: Date.now(),\n })\n\n return {\n status: 'COMPLETED',\n context: {\n transactionRequest: finalTransactionRequest,\n },\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumStandardSignAndExecuteTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumStandardSignAndExecuteTask.ts"],"sourcesContent":["import {\n assertNoOpenTransaction,\n BaseStepExecutionTask,\n CLEARED_TRANSACTION_FIELDS,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Address, Hex, SendTransactionParameters } from 'viem'\nimport { sendTransaction } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'\nimport { encodeNativePermitData } from '../../permits/encodeNativePermitData.js'\nimport { encodePermit2Data } from '../../permits/encodePermit2Data.js'\nimport { signPermit2Message } from '../../permits/signPermit2Message.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { convertExtendedChain } from '../../utils/convertExtendedChain.js'\nimport { getSendChain } from '../../utils/getSendChain.js'\nimport { estimateTransactionRequest } from './helpers/estimateTransactionRequest.js'\nimport { findSignedNativePermit } from './helpers/findSignedNativePermit.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolvePermit2Support } from './helpers/resolvePermit2Support.js'\n\nexport class EthereumStandardSignAndExecuteTask extends BaseStepExecutionTask {\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n fromChain,\n statusManager,\n checkClient,\n transactionRequest,\n allowUserInteraction,\n isBridgeExecution,\n } = context\n\n if (!transactionRequest) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Transaction request is not found.'\n )\n }\n\n const action = statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n if (!action) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Action not found.'\n )\n }\n\n // Make sure that the chain is still correct\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const signedNativePermitTypedData = findSignedNativePermit(context)\n // Resolved *after* the native-permit lookup, and short-circuited when one\n // is found: a matching permit always wins, so resolving the gate first\n // would spend an `eth_getCode` on a verdict this task never reads. The\n // ternary also makes the two routes explicitly exclusive.\n const permit2Supported = signedNativePermitTypedData\n ? false\n : await resolvePermit2Support(context, 'standard')\n if (signedNativePermitTypedData) {\n transactionRequest.data = encodeNativePermitData(\n step.action.fromToken.address as Address,\n BigInt(step.action.fromAmount),\n signedNativePermitTypedData.message.deadline,\n signedNativePermitTypedData.signature,\n transactionRequest.data as Hex\n )\n } else if (permit2Supported) {\n statusManager.updateAction(step, action.type, 'MESSAGE_REQUIRED')\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n const permit2Signature = await signPermit2Message(client, {\n client: updatedClient,\n chain: fromChain,\n tokenAddress: step.action.fromToken.address as Address,\n amount: BigInt(step.action.fromAmount),\n data: transactionRequest.data as Hex,\n })\n transactionRequest.data = encodePermit2Data(\n step.action.fromToken.address as Address,\n BigInt(step.action.fromAmount),\n permit2Signature.message.nonce,\n permit2Signature.message.deadline,\n transactionRequest.data as Hex,\n permit2Signature.signature\n )\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n }\n\n let finalTransactionRequest = transactionRequest\n if (signedNativePermitTypedData || permit2Supported) {\n // Target address should be the Permit2 proxy contract in case of native permit or Permit2\n finalTransactionRequest = {\n ...transactionRequest,\n to: fromChain.permit2Proxy as Address,\n }\n finalTransactionRequest = await estimateTransactionRequest(\n client,\n updatedClient,\n finalTransactionRequest,\n fromChain.id\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 awaits above\n // (strategy, chain switch, permit prompt, gas estimate).\n assertNoOpenTransaction(statusManager.findAction(step, action.type))\n\n const txHash = await getAction(\n updatedClient,\n sendTransaction,\n 'sendTransaction'\n )({\n to: finalTransactionRequest.to as Address,\n account: updatedClient.account!,\n data: finalTransactionRequest.data as Hex,\n value: finalTransactionRequest.value,\n gas: finalTransactionRequest.gas,\n gasPrice: finalTransactionRequest.gasPrice,\n maxFeePerGas: finalTransactionRequest.maxFeePerGas,\n maxPriorityFeePerGas: finalTransactionRequest.maxPriorityFeePerGas,\n chain: getSendChain(updatedClient, convertExtendedChain(fromChain)),\n } as SendTransactionParameters)\n\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n txHash,\n fromChain.id\n )\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n // A new transaction: nothing of the previous one may survive, least of\n // all its `txFinal` verdict.\n ...CLEARED_TRANSACTION_FIELDS,\n txHash: resolvedTxHash,\n txLink: getTxLink(fromChain, resolvedTxHash),\n txType: 'standard',\n signedAt: Date.now(),\n })\n\n return {\n status: 'COMPLETED',\n context: {\n transactionRequest: finalTransactionRequest,\n },\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAa,qCAAb,cAAwD,sBAAsB;CAC5E,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,QACA,WACA,eACA,aACA,oBACA,sBACA,sBACE;EAEJ,IAAI,CAAC,oBACH,MAAM,IAAI,iBACR,cAAc,uBACd,kEACF;EAGF,MAAM,SAAS,cAAc,WAC3B,MACA,oBAAoB,gBAAgB,MACtC;EACA,IAAI,CAAC,QACH,MAAM,IAAI,iBACR,cAAc,uBACd,kDACF;EAIF,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,8BAA8B,uBAAuB,OAAO;EAKlE,MAAM,mBAAmB,8BACrB,QACA,MAAM,sBAAsB,SAAS,UAAU;EACnD,IAAI,6BACF,mBAAmB,OAAO,uBACxB,KAAK,OAAO,UAAU,SACtB,OAAO,KAAK,OAAO,UAAU,GAC7B,4BAA4B,QAAQ,UACpC,4BAA4B,WAC5B,mBAAmB,IACrB;OACK,IAAI,kBAAkB;GAC3B,cAAc,aAAa,MAAM,OAAO,MAAM,kBAAkB;GAChE,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;GAE5B,MAAM,mBAAmB,MAAM,mBAAmB,QAAQ;IACxD,QAAQ;IACR,OAAO;IACP,cAAc,KAAK,OAAO,UAAU;IACpC,QAAQ,OAAO,KAAK,OAAO,UAAU;IACrC,MAAM,mBAAmB;GAC3B,CAAC;GACD,mBAAmB,OAAO,kBACxB,KAAK,OAAO,UAAU,SACtB,OAAO,KAAK,OAAO,UAAU,GAC7B,iBAAiB,QAAQ,OACzB,iBAAiB,QAAQ,UACzB,mBAAmB,MACnB,iBAAiB,SACnB;GACA,cAAc,aAAa,MAAM,OAAO,MAAM,iBAAiB;GAC/D,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;EAE9B;EAEA,IAAI,0BAA0B;EAC9B,IAAI,+BAA+B,kBAAkB;GAEnD,0BAA0B;IACxB,GAAG;IACH,IAAI,UAAU;GAChB;GACA,0BAA0B,MAAM,2BAC9B,QACA,eACA,yBACA,UAAU,EACZ;EACF;EAKA,wBAAwB,cAAc,WAAW,MAAM,OAAO,IAAI,CAAC;EAEnE,MAAM,SAAS,MAAM,UACnB,eACA,iBACA,iBACF,CAAC,CAAC;GACA,IAAI,wBAAwB;GAC5B,SAAS,cAAc;GACvB,MAAM,wBAAwB;GAC9B,OAAO,wBAAwB;GAC/B,KAAK,wBAAwB;GAC7B,UAAU,wBAAwB;GAClC,cAAc,wBAAwB;GACtC,sBAAsB,wBAAwB;GAC9C,OAAO,aAAa,eAAe,qBAAqB,SAAS,CAAC;EACpE,CAA8B;EAE9B,MAAM,iBAAiB,MAAM,uBAC3B,QACA,eACA,QACA,UAAU,EACZ;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;GAGvD,GAAG;GACH,QAAQ;GACR,QAAQ,UAAU,WAAW,cAAc;GAC3C,QAAQ;GACR,UAAU,KAAK,IAAI;EACrB,CAAC;EAED,OAAO;GACL,QAAQ;GACR,SAAS,EACP,oBAAoB,wBACtB;EACF;CACF;AACF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumStandardWaitForTransactionTask.d.ts
|
|
4
3
|
export declare class EthereumStandardWaitForTransactionTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumStandardWaitForTransactionTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStandardWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumStandardWaitForTransactionTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumStandardWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumStandardWaitForTransactionTask.ts"],"mappings":";;qBAWa,+CAA+C;EACpD,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { waitForTransactionReceipt } from "../../actions/waitForTransactionReceipt.js";
|
|
2
2
|
import { updateActionWithReceipt } from "./helpers/updateActionWithReceipt.js";
|
|
3
3
|
import { BaseStepExecutionTask, LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
4
|
-
|
|
4
|
+
// src/core/tasks/EthereumStandardWaitForTransactionTask.ts
|
|
5
5
|
var EthereumStandardWaitForTransactionTask = class extends BaseStepExecutionTask {
|
|
6
6
|
async run(context) {
|
|
7
7
|
const { client, step, statusManager, fromChain, isBridgeExecution, checkClient } = context;
|
|
@@ -25,7 +25,6 @@ var EthereumStandardWaitForTransactionTask = class extends BaseStepExecutionTask
|
|
|
25
25
|
return { status: "COMPLETED" };
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { EthereumStandardWaitForTransactionTask };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=EthereumStandardWaitForTransactionTask.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumWaitForTransactionStatusTask.d.ts
|
|
4
3
|
export declare class EthereumWaitForTransactionStatusTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumWaitForTransactionStatusTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumWaitForTransactionStatusTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumWaitForTransactionStatusTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumWaitForTransactionStatusTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumWaitForTransactionStatusTask.ts"],"mappings":";;qBAOa,6CAA6C;EAClD,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseStepExecutionTask, WaitForTransactionStatusTask } from "@lifi/sdk";
|
|
2
|
-
|
|
2
|
+
// src/core/tasks/EthereumWaitForTransactionStatusTask.ts
|
|
3
3
|
var EthereumWaitForTransactionStatusTask = class extends BaseStepExecutionTask {
|
|
4
4
|
async run(context) {
|
|
5
5
|
const { step, checkClient, isBridgeExecution, statusManager } = context;
|
|
@@ -10,7 +10,6 @@ var EthereumWaitForTransactionStatusTask = class extends BaseStepExecutionTask {
|
|
|
10
10
|
return await new WaitForTransactionStatusTask(isBridgeExecution ? "RECEIVING_CHAIN" : "SWAP").run(context);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { EthereumWaitForTransactionStatusTask };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=EthereumWaitForTransactionStatusTask.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumWaitForTransactionTask.d.ts
|
|
4
3
|
export declare class EthereumWaitForTransactionTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumWaitForTransactionTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumWaitForTransactionTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumWaitForTransactionTask.ts"],"mappings":";;qBAkBa,uCAAuC;EAC5C,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
2
1
|
import { EthereumBatchedWaitForTransactionTask } from "./EthereumBatchedWaitForTransactionTask.js";
|
|
3
2
|
import { EthereumRelayedWaitForTransactionTask } from "./EthereumRelayedWaitForTransactionTask.js";
|
|
4
3
|
import { EthereumStandardWaitForTransactionTask } from "./EthereumStandardWaitForTransactionTask.js";
|
|
4
|
+
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
5
5
|
import { BaseStepExecutionTask, hasOpenTransaction } from "@lifi/sdk";
|
|
6
|
-
|
|
6
|
+
// src/core/tasks/EthereumWaitForTransactionTask.ts
|
|
7
7
|
const TRANSACTION_METHOD_TYPES = [
|
|
8
8
|
"standard",
|
|
9
9
|
"batched",
|
|
@@ -19,7 +19,6 @@ var EthereumWaitForTransactionTask = class extends BaseStepExecutionTask {
|
|
|
19
19
|
return new EthereumStandardWaitForTransactionTask().run(context);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
//#endregion
|
|
23
22
|
export { EthereumWaitForTransactionTask };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=EthereumWaitForTransactionTask.js.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SDKClient, TransactionParameters } from "@lifi/sdk";
|
|
2
2
|
import { Client } from "viem";
|
|
3
|
-
|
|
4
|
-
export declare const estimateTransactionRequest: (client: SDKClient, viemClient: Client, transactionRequest: TransactionParameters) => Promise<TransactionParameters>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare const estimateTransactionRequest: (client: SDKClient, viemClient: Client, transactionRequest: TransactionParameters, chainId: number | undefined) => Promise<TransactionParameters>;
|
|
6
4
|
//# sourceMappingURL=estimateTransactionRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateTransactionRequest.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/estimateTransactionRequest.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"estimateTransactionRequest.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/estimateTransactionRequest.ts"],"mappings":";;qBAOa,6BACX,QAAQ,WACR,YAAY,QACZ,oBAAoB,uBACpB,gCACC,QAAQ"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { getActionWithFallback } from "../../../utils/getActionWithFallback.js";
|
|
2
2
|
import { estimateGas } from "viem/actions";
|
|
3
|
-
|
|
3
|
+
// src/core/tasks/helpers/estimateTransactionRequest.ts
|
|
4
4
|
const GAS_ESTIMATION_BUFFER = 300000n;
|
|
5
|
-
const estimateTransactionRequest = async (client, viemClient, transactionRequest) => {
|
|
5
|
+
const estimateTransactionRequest = async (client, viemClient, transactionRequest, chainId) => {
|
|
6
6
|
try {
|
|
7
7
|
const estimatedGas = await getActionWithFallback(client, viemClient, estimateGas, "estimateGas", {
|
|
8
8
|
account: viemClient.account,
|
|
9
9
|
to: transactionRequest.to,
|
|
10
10
|
data: transactionRequest.data,
|
|
11
11
|
value: transactionRequest.value
|
|
12
|
-
});
|
|
12
|
+
}, chainId);
|
|
13
13
|
transactionRequest.gas = (transactionRequest.gas && transactionRequest.gas > estimatedGas ? transactionRequest.gas : estimatedGas) + GAS_ESTIMATION_BUFFER;
|
|
14
14
|
} catch (_) {
|
|
15
15
|
if (transactionRequest.gas) transactionRequest.gas = transactionRequest.gas + GAS_ESTIMATION_BUFFER;
|
|
16
16
|
}
|
|
17
17
|
return transactionRequest;
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { estimateTransactionRequest };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=estimateTransactionRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateTransactionRequest.js","names":[],"sources":["../../../../../src/core/tasks/helpers/estimateTransactionRequest.ts"],"sourcesContent":["import type { SDKClient, TransactionParameters } from '@lifi/sdk'\nimport type { Address, Client, Hex } from 'viem'\nimport { estimateGas } from 'viem/actions'\nimport { getActionWithFallback } from '../../../utils/getActionWithFallback.js'\n\nconst GAS_ESTIMATION_BUFFER = 300_000n\n\nexport const estimateTransactionRequest = async (\n client: SDKClient,\n viemClient: Client,\n transactionRequest: TransactionParameters\n): Promise<TransactionParameters> => {\n try {\n // Try to re-estimate the gas due to additional Permit data\n const estimatedGas = await getActionWithFallback(\n client,\n viemClient,\n estimateGas,\n 'estimateGas',\n {\n account: viemClient.account!,\n to: transactionRequest.to as Address,\n data: transactionRequest.data as Hex,\n value: transactionRequest.value,\n }\n )\n // Use the higher of estimated vs original, then add buffer\n const baseGas =\n transactionRequest.gas && transactionRequest.gas > estimatedGas\n ? transactionRequest.gas\n : estimatedGas\n\n transactionRequest.gas = baseGas + GAS_ESTIMATION_BUFFER\n } catch (_) {\n // If estimation fails, add buffer to existing gas limit\n if (transactionRequest.gas) {\n transactionRequest.gas = transactionRequest.gas + GAS_ESTIMATION_BUFFER\n }\n }\n\n return transactionRequest\n}\n"],"mappings":";;;AAKA,MAAM,wBAAwB;AAE9B,MAAa,6BAA6B,OACxC,QACA,YACA,
|
|
1
|
+
{"version":3,"file":"estimateTransactionRequest.js","names":[],"sources":["../../../../../src/core/tasks/helpers/estimateTransactionRequest.ts"],"sourcesContent":["import type { SDKClient, TransactionParameters } from '@lifi/sdk'\nimport type { Address, Client, Hex } from 'viem'\nimport { estimateGas } from 'viem/actions'\nimport { getActionWithFallback } from '../../../utils/getActionWithFallback.js'\n\nconst GAS_ESTIMATION_BUFFER = 300_000n\n\nexport const estimateTransactionRequest = async (\n client: SDKClient,\n viemClient: Client,\n transactionRequest: TransactionParameters,\n chainId: number | undefined\n): Promise<TransactionParameters> => {\n try {\n // Try to re-estimate the gas due to additional Permit data\n const estimatedGas = await getActionWithFallback(\n client,\n viemClient,\n estimateGas,\n 'estimateGas',\n {\n account: viemClient.account!,\n to: transactionRequest.to as Address,\n data: transactionRequest.data as Hex,\n value: transactionRequest.value,\n },\n chainId\n )\n // Use the higher of estimated vs original, then add buffer\n const baseGas =\n transactionRequest.gas && transactionRequest.gas > estimatedGas\n ? transactionRequest.gas\n : estimatedGas\n\n transactionRequest.gas = baseGas + GAS_ESTIMATION_BUFFER\n } catch (_) {\n // If estimation fails, add buffer to existing gas limit\n if (transactionRequest.gas) {\n transactionRequest.gas = transactionRequest.gas + GAS_ESTIMATION_BUFFER\n }\n }\n\n return transactionRequest\n}\n"],"mappings":";;;AAKA,MAAM,wBAAwB;AAE9B,MAAa,6BAA6B,OACxC,QACA,YACA,oBACA,YACmC;CACnC,IAAI;EAEF,MAAM,eAAe,MAAM,sBACzB,QACA,YACA,aACA,eACA;GACE,SAAS,WAAW;GACpB,IAAI,mBAAmB;GACvB,MAAM,mBAAmB;GACzB,OAAO,mBAAmB;EAC5B,GACA,OACF;EAOA,mBAAmB,OAJjB,mBAAmB,OAAO,mBAAmB,MAAM,eAC/C,mBAAmB,MACnB,gBAE6B;CACrC,SAAS,GAAG;EAEV,IAAI,mBAAmB,KACrB,mBAAmB,MAAM,mBAAmB,MAAM;CAEtD;CAEA,OAAO;AACT"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
2
|
import { SignedTypedData } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/helpers/findSignedNativePermit.d.ts
|
|
4
3
|
/** The signed native EIP-2612 permit this step should execute through, if any. */
|
|
5
4
|
export declare function findSignedNativePermit(context: EthereumStepExecutorContext): SignedTypedData | undefined;
|
|
6
|
-
//#endregion
|
|
7
5
|
//# sourceMappingURL=findSignedNativePermit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findSignedNativePermit.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/findSignedNativePermit.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findSignedNativePermit.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/findSignedNativePermit.ts"],"mappings":";;;wBAOgB,uBACd,SAAS,8BACR"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { isPermit2AllowanceLaneInFlight } from "./hasPermit2AllowanceInFlight.js";
|
|
2
1
|
import { getDomainChainId } from "../../../utils/getDomainChainId.js";
|
|
3
2
|
import { isValidSignature } from "../../../utils/isValidSignature.js";
|
|
4
|
-
|
|
3
|
+
import { isPermit2AllowanceLaneInFlight } from "./hasPermit2AllowanceInFlight.js";
|
|
4
|
+
// src/core/tasks/helpers/findSignedNativePermit.ts
|
|
5
5
|
/** The signed native EIP-2612 permit this step should execute through, if any. */
|
|
6
6
|
function findSignedNativePermit(context) {
|
|
7
7
|
const { fromChain, signedTypedData } = context;
|
|
8
8
|
if (isPermit2AllowanceLaneInFlight(context)) return;
|
|
9
9
|
return signedTypedData.find((typedData) => typedData.primaryType === "Permit" && getDomainChainId(typedData.domain) === fromChain.id && isValidSignature(typedData.signature));
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { findSignedNativePermit };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=findSignedNativePermit.js.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
|
-
//#region src/core/tasks/helpers/getApprovalAmount.d.ts
|
|
3
2
|
/** How much of the source token to approve to the step's approval address. */
|
|
4
3
|
export declare function getApprovalAmount(context: EthereumStepExecutorContext, permit2Supported: boolean): bigint;
|
|
5
|
-
//#endregion
|
|
6
4
|
//# sourceMappingURL=getApprovalAmount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getApprovalAmount.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getApprovalAmount.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getApprovalAmount.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getApprovalAmount.ts"],"mappings":";;wBAKgB,kBACd,SAAS,6BACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getTypedDataInLane } from "../../../utils/getTypedDataLane.js";
|
|
2
1
|
import { MaxUint256 } from "../../../permits/constants.js";
|
|
3
|
-
|
|
2
|
+
import { getTypedDataInLane } from "../../../utils/getTypedDataLane.js";
|
|
3
|
+
// src/core/tasks/helpers/getApprovalAmount.ts
|
|
4
4
|
/** How much of the source token to approve to the step's approval address. */
|
|
5
5
|
function getApprovalAmount(context, permit2Supported) {
|
|
6
6
|
const { step, fromChain, disableMessageSigning } = context;
|
|
@@ -9,7 +9,6 @@ function getApprovalAmount(context, permit2Supported) {
|
|
|
9
9
|
const approvalAddress = step.estimate.approvalAddress?.toLowerCase();
|
|
10
10
|
return permit2Allowances.length > 0 && !!approvalAddress && permit2Allowances.every((typedData) => typedData.domain.verifyingContract?.toLowerCase() === approvalAddress) ? MaxUint256 : BigInt(step.action.fromAmount);
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { getApprovalAmount };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=getApprovalAmount.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
2
|
import { TransactionMethodType } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/helpers/getEthereumExecutionStrategy.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Retry param set by `EthereumPrepareTransactionTask`: the strategy prepare
|
|
6
5
|
* established when the allowance work done for `batched` did not fit it. The
|
|
@@ -19,5 +18,4 @@ export declare const STRATEGY_AFTER_PREPARE = "strategyAfterPrepare";
|
|
|
19
18
|
* a parameter.
|
|
20
19
|
*/
|
|
21
20
|
export declare function getEthereumExecutionStrategy(context: EthereumStepExecutorContext, afterPrepare?: boolean): Promise<TransactionMethodType>;
|
|
22
|
-
//#endregion
|
|
23
21
|
//# sourceMappingURL=getEthereumExecutionStrategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEthereumExecutionStrategy.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getEthereumExecutionStrategy.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getEthereumExecutionStrategy.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getEthereumExecutionStrategy.ts"],"mappings":";;;;;;;qBAUa;;;;;;;;;;;;wBA0BS,6BACpB,SAAS,6BACT,yBACC,QAAQ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isBatchingSupported } from "../../../actions/isBatchingSupported.js";
|
|
2
2
|
import { isPermit2AllowanceLane } from "../../../utils/getTypedDataLane.js";
|
|
3
|
-
|
|
3
|
+
import { isGaslessStep } from "@lifi/sdk";
|
|
4
|
+
// src/core/tasks/helpers/getEthereumExecutionStrategy.ts
|
|
4
5
|
/**
|
|
5
6
|
* Retry param set by `EthereumPrepareTransactionTask`: the strategy prepare
|
|
6
7
|
* established when the allowance work done for `batched` did not fit it. The
|
|
@@ -29,18 +30,19 @@ async function getEthereumExecutionStrategy(context, afterPrepare = false) {
|
|
|
29
30
|
if (!afterPrepare && executionStrategyContext) return executionStrategyContext;
|
|
30
31
|
const strategyAfterPrepare = retryParams?.[STRATEGY_AFTER_PREPARE];
|
|
31
32
|
if (!afterPrepare && isTransactionMethodType(strategyAfterPrepare)) return strategyAfterPrepare;
|
|
33
|
+
if (isGaslessStep(step)) return "relayed";
|
|
32
34
|
const atomicityNotReady = !!retryParams?.atomicityNotReady;
|
|
33
35
|
if (step.executionType === "message") return "relayed";
|
|
34
36
|
if (step.typedData?.length && !isPermit2AllowanceLane(step, fromChain)) return "relayed";
|
|
35
37
|
if (afterPrepare && step.typedData?.length && !step.transactionRequest) return "relayed";
|
|
36
38
|
if (atomicityNotReady || step.tool === "thorswap") return "standard";
|
|
37
39
|
const updatedClient = await checkClient(step) ?? ethereumClient;
|
|
38
|
-
|
|
40
|
+
context.batchingSupported ??= isBatchingSupported(client, {
|
|
39
41
|
client: updatedClient,
|
|
40
42
|
chainId: fromChain.id
|
|
41
|
-
})
|
|
43
|
+
});
|
|
44
|
+
return await context.batchingSupported ? "batched" : "standard";
|
|
42
45
|
}
|
|
43
|
-
//#endregion
|
|
44
46
|
export { STRATEGY_AFTER_PREPARE, getEthereumExecutionStrategy };
|
|
45
47
|
|
|
46
48
|
//# sourceMappingURL=getEthereumExecutionStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEthereumExecutionStrategy.js","names":[],"sources":["../../../../../src/core/tasks/helpers/getEthereumExecutionStrategy.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"getEthereumExecutionStrategy.js","names":[],"sources":["../../../../../src/core/tasks/helpers/getEthereumExecutionStrategy.ts"],"sourcesContent":["import { isGaslessStep, type TransactionMethodType } from '@lifi/sdk'\nimport { isBatchingSupported } from '../../../actions/isBatchingSupported.js'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\nimport { isPermit2AllowanceLane } from '../../../utils/getTypedDataLane.js'\n\n/**\n * Retry param set by `EthereumPrepareTransactionTask`: the strategy prepare\n * established when the allowance work done for `batched` did not fit it. The\n * replay starts in this strategy.\n */\nexport const STRATEGY_AFTER_PREPARE = 'strategyAfterPrepare'\n\n// A `Record` over the union, so a new strategy fails to compile here instead of\n// being ignored by the replay.\nconst TRANSACTION_METHOD_TYPES: Record<TransactionMethodType, true> = {\n standard: true,\n relayed: true,\n batched: true,\n}\n\nconst isTransactionMethodType = (\n value: unknown\n): value is TransactionMethodType =>\n typeof value === 'string' && Object.hasOwn(TRANSACTION_METHOD_TYPES, value)\n\n/**\n * Determines the execution strategy: 'relayed', 'batched', or 'standard'.\n * Falls back to 'standard' when EIP-5792 batching is unavailable,\n * the wallet rejected the 7702 upgrade, or the tool doesn't support it.\n *\n * `afterPrepare` marks the single call from `EthereumPrepareTransactionTask`.\n * The step has just been re-quoted, so the cached verdict is stale and, for the\n * first time, the absence of a `transactionRequest` is final rather than merely\n * not-yet-known. Both effects come from that one fact, which is why they share\n * a parameter.\n */\nexport async function getEthereumExecutionStrategy(\n context: EthereumStepExecutorContext,\n afterPrepare: boolean = false\n): Promise<TransactionMethodType> {\n const {\n step,\n checkClient,\n retryParams,\n client,\n fromChain,\n ethereumClient,\n executionStrategy: executionStrategyContext,\n } = context\n\n if (!afterPrepare && executionStrategyContext) {\n return executionStrategyContext\n }\n\n // A replay starts in the strategy its first prepare established. Prepare\n // restored the step's typed data before the replay, so nothing on the step\n // shows that strategy yet.\n const strategyAfterPrepare = retryParams?.[STRATEGY_AFTER_PREPARE]\n if (!afterPrepare && isTransactionMethodType(strategyAfterPrepare)) {\n return strategyAfterPrepare\n }\n\n // A gasless step only executes through the relay. Before prepare it has no\n // typed data yet, so the relay fee is the only signal.\n if (isGaslessStep(step)) {\n return 'relayed'\n }\n\n const atomicityNotReady = !!retryParams?.atomicityNotReady\n\n // Declared by the backend. It is the only signal that reaches the allowance\n // tasks, which run before a `transactionRequest` can exist.\n if (step.executionType === 'message') {\n return 'relayed'\n }\n\n // Typed data the user does not sign for its own send: gasless, `Order`,\n // Hyperliquid. A Permit2 allowance is the one shape excluded, because its signer\n // and its sender are the same person.\n if (step.typedData?.length && !isPermit2AllowanceLane(step, fromChain)) {\n return 'relayed'\n }\n\n // After prepare, missing means never: the step carries typed data and the user\n // has nothing to send, so the relayer is the only lane that can execute it.\n // This is a derivation, not a guess — no other strategy can run such a step.\n //\n // Before prepare the same expression is unsound. A Permit2 allowance that will\n // receive its transaction from `/stepTransaction` is indistinguishable from\n // one that never will, and calling it relayed there costs the step its\n // EIP-5792 batching.\n if (afterPrepare && step.typedData?.length && !step.transactionRequest) {\n return 'relayed'\n }\n\n if (atomicityNotReady || step.tool === 'thorswap') {\n return 'standard'\n }\n\n const updatedClient = (await checkClient(step)) ?? ethereumClient\n // A re-quote changes the step, not the wallet: prepare reuses the answer the\n // allowance tasks acted on, so a late read cannot flip the strategy.\n context.batchingSupported ??= isBatchingSupported(client, {\n client: updatedClient,\n chainId: fromChain.id,\n })\n return (await context.batchingSupported) ? 'batched' : 'standard'\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,yBAAyB;AAItC,MAAM,2BAAgE;CACpE,UAAU;CACV,SAAS;CACT,SAAS;AACX;AAEA,MAAM,2BACJ,UAEA,OAAO,UAAU,YAAY,OAAO,OAAO,0BAA0B,KAAK;;;;;;;;;;;;AAa5E,eAAsB,6BACpB,SACA,eAAwB,OACQ;CAChC,MAAM,EACJ,MACA,aACA,aACA,QACA,WACA,gBACA,mBAAmB,6BACjB;CAEJ,IAAI,CAAC,gBAAgB,0BACnB,OAAO;CAMT,MAAM,uBAAuB,cAAc;CAC3C,IAAI,CAAC,gBAAgB,wBAAwB,oBAAoB,GAC/D,OAAO;CAKT,IAAI,cAAc,IAAI,GACpB,OAAO;CAGT,MAAM,oBAAoB,CAAC,CAAC,aAAa;CAIzC,IAAI,KAAK,kBAAkB,WACzB,OAAO;CAMT,IAAI,KAAK,WAAW,UAAU,CAAC,uBAAuB,MAAM,SAAS,GACnE,OAAO;CAWT,IAAI,gBAAgB,KAAK,WAAW,UAAU,CAAC,KAAK,oBAClD,OAAO;CAGT,IAAI,qBAAqB,KAAK,SAAS,YACrC,OAAO;CAGT,MAAM,gBAAiB,MAAM,YAAY,IAAI,KAAM;CAGnD,QAAQ,sBAAsB,oBAAoB,QAAQ;EACxD,QAAQ;EACR,SAAS,UAAU;CACrB,CAAC;CACD,OAAQ,MAAM,QAAQ,oBAAqB,YAAY;AACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTxLink.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getTxLink.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTxLink.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getTxLink.ts"],"mappings":";;qBAGa,YAAa,OAAO,eAAe,QAAQ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/core/tasks/helpers/getTxLink.ts
|
|
2
2
|
const getTxLink = (chain, txHash) => {
|
|
3
3
|
return `${chain.metamask.blockExplorerUrls[0]}tx/${txHash}`;
|
|
4
4
|
};
|
|
5
|
-
//#endregion
|
|
6
5
|
export { getTxLink };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=getTxLink.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ExecutionOptions,
|
|
2
|
-
//#region src/core/tasks/helpers/getUpdatedStep.d.ts
|
|
1
|
+
import { ExecutionOptions, LiFiStepExtended, SDKClient, SignedTypedData } from "@lifi/sdk";
|
|
3
2
|
/** Re-quotes the step through the endpoint that matches how it will execute. */
|
|
4
|
-
export declare const getUpdatedStep: (client: SDKClient, step: LiFiStepExtended,
|
|
5
|
-
|
|
3
|
+
export declare const getUpdatedStep: (client: SDKClient, step: LiFiStepExtended, executionOptions?: ExecutionOptions, signedTypedData?: SignedTypedData[]) => Promise<LiFiStepExtended>;
|
|
4
|
+
/**
|
|
5
|
+
* Fields `/advanced/stepTransaction` adds to a gasless step. They are not in
|
|
6
|
+
* `@lifi/types` yet.
|
|
7
|
+
*/
|
|
8
|
+
export type GaslessStepFields = {
|
|
9
|
+
expiresAt?: number;
|
|
10
|
+
authorization?: unknown;
|
|
11
|
+
};
|
|
6
12
|
//# sourceMappingURL=getUpdatedStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUpdatedStep.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getUpdatedStep.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"mappings":";;qBAiBa,iBACX,QAAQ,WACR,MAAM,kBACN,mBAAmB,kBACnB,kBAAkB,sBACjB,QAAQ;;;;;YA0GC;EACV;EACA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { isGaslessStep } from "../../../utils/isGaslessStep.js";
|
|
2
1
|
import { PatcherMagicNumber } from "../../../permits/constants.js";
|
|
3
2
|
import { isContractCallStep } from "../../../utils/isContractCallStep.js";
|
|
4
|
-
import { LiFiErrorCode, TransactionError, convertQuoteToRoute, getContractCallsQuote,
|
|
5
|
-
|
|
3
|
+
import { LiFiErrorCode, TransactionError, convertQuoteToRoute, getContractCallsQuote, getStepTransaction, isGaslessStep, patchContractCalls } from "@lifi/sdk";
|
|
4
|
+
// src/core/tasks/helpers/getUpdatedStep.ts
|
|
6
5
|
/** Re-quotes the step through the endpoint that matches how it will execute. */
|
|
7
|
-
const getUpdatedStep = async (client, step,
|
|
6
|
+
const getUpdatedStep = async (client, step, executionOptions, signedTypedData) => {
|
|
8
7
|
if (isContractCallStep(step)) return getContractCallUpdatedStep(client, step, executionOptions);
|
|
9
|
-
if (isGaslessStep(step
|
|
8
|
+
if (isGaslessStep(step)) return getGaslessUpdatedStep(client, step);
|
|
10
9
|
return getStandardUpdatedStep(client, step, signedTypedData);
|
|
11
10
|
};
|
|
12
11
|
const getContractCallUpdatedStep = async (client, step, executionOptions) => {
|
|
@@ -70,21 +69,14 @@ const getContractCallUpdatedStep = async (client, step, executionOptions) => {
|
|
|
70
69
|
id: step.id
|
|
71
70
|
};
|
|
72
71
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
toToken: step.action.toToken.address,
|
|
82
|
-
slippage: step.action.slippage,
|
|
83
|
-
toAddress: step.action.toAddress,
|
|
84
|
-
allowBridges: [step.tool]
|
|
85
|
-
}),
|
|
86
|
-
id: step.id
|
|
87
|
-
};
|
|
72
|
+
/**
|
|
73
|
+
* A gasless step is re-quoted as the routes response gave it: the backend
|
|
74
|
+
* rejects typed data without signatures, and it builds new typed data, a new
|
|
75
|
+
* deadline and new nonces for every quote anyway.
|
|
76
|
+
*/
|
|
77
|
+
const getGaslessUpdatedStep = async (client, step) => {
|
|
78
|
+
const { typedData: _typedData, expiresAt: _expiresAt, authorization: _authorization, execution: _execution, ...restStep } = step;
|
|
79
|
+
return getStepTransaction(client, restStep);
|
|
88
80
|
};
|
|
89
81
|
const getStandardUpdatedStep = async (client, step, signedTypedData) => {
|
|
90
82
|
const filteredSignedTypedData = signedTypedData?.filter((item) => item.signature);
|
|
@@ -95,7 +87,6 @@ const getStandardUpdatedStep = async (client, step, signedTypedData) => {
|
|
|
95
87
|
} : restStep;
|
|
96
88
|
return getStepTransaction(client, params);
|
|
97
89
|
};
|
|
98
|
-
//#endregion
|
|
99
90
|
export { getUpdatedStep };
|
|
100
91
|
|
|
101
92
|
//# sourceMappingURL=getUpdatedStep.js.map
|