@lifi/sdk-provider-ethereum 4.2.12 → 4.3.0
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 +54 -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
|
@@ -2,13 +2,13 @@ import { getAllowance } from "../../actions/getAllowance.js";
|
|
|
2
2
|
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
3
3
|
import { resolveAllowanceSpender } from "./helpers/resolveAllowanceSpender.js";
|
|
4
4
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
5
|
-
|
|
5
|
+
// src/core/tasks/EthereumCheckAllowanceTask.ts
|
|
6
6
|
var EthereumCheckAllowanceTask = class extends BaseStepExecutionTask {
|
|
7
7
|
async shouldRun(context) {
|
|
8
8
|
return !context.hasMatchingPermit;
|
|
9
9
|
}
|
|
10
10
|
async run(context) {
|
|
11
|
-
const { step, checkClient, client, statusManager } = context;
|
|
11
|
+
const { step, checkClient, client, statusManager, fromChain } = context;
|
|
12
12
|
const action = statusManager.initializeAction({
|
|
13
13
|
step,
|
|
14
14
|
type: "CHECK_ALLOWANCE",
|
|
@@ -20,7 +20,7 @@ var EthereumCheckAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
20
20
|
const fromAmount = BigInt(step.action.fromAmount);
|
|
21
21
|
const updatedClient = await checkClient(step);
|
|
22
22
|
if (!updatedClient) return { status: "PAUSED" };
|
|
23
|
-
const allowance = await getAllowance(client, updatedClient, step.action.fromToken.address, updatedClient.account.address, spenderAddress);
|
|
23
|
+
const allowance = await getAllowance(client, updatedClient, step.action.fromToken.address, updatedClient.account.address, spenderAddress, fromChain.id);
|
|
24
24
|
statusManager.updateAction(step, action.type, "DONE");
|
|
25
25
|
return {
|
|
26
26
|
status: "COMPLETED",
|
|
@@ -33,7 +33,6 @@ var EthereumCheckAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { EthereumCheckAllowanceTask };
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=EthereumCheckAllowanceTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumCheckAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { getAllowance } from '../../actions/getAllowance.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumCheckAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n return !context.hasMatchingPermit\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const { step, checkClient, client, statusManager } = context\n\n // Start new allowance check\n const action = statusManager.initializeAction({\n step,\n type: 'CHECK_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const { spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n const fromAmount = BigInt(step.action.fromAmount)\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const allowance = await getAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n updatedClient.account!.address,\n spenderAddress\n )\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: {\n hasAllowance: allowance > 0n,\n hasSufficientAllowance: fromAmount <= allowance,\n executionStrategy,\n allowanceSpender: spenderAddress,\n },\n }\n }\n}\n"],"mappings":";;;;;AAOA,IAAa,6BAAb,cAAgD,sBAAsB;CACpE,MAAe,UACb,SACkB;EAClB,OAAO,CAAC,QAAQ;CAClB;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EAAE,MAAM,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"EthereumCheckAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumCheckAllowanceTask.ts"],"sourcesContent":["import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { getAllowance } from '../../actions/getAllowance.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumCheckAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n return !context.hasMatchingPermit\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const { step, checkClient, client, statusManager, fromChain } = context\n\n // Start new allowance check\n const action = statusManager.initializeAction({\n step,\n type: 'CHECK_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const { spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n const fromAmount = BigInt(step.action.fromAmount)\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const allowance = await getAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n updatedClient.account!.address,\n spenderAddress,\n fromChain.id\n )\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: {\n hasAllowance: allowance > 0n,\n hasSufficientAllowance: fromAmount <= allowance,\n executionStrategy,\n allowanceSpender: spenderAddress,\n },\n }\n }\n}\n"],"mappings":";;;;;AAOA,IAAa,6BAAb,cAAgD,sBAAsB;CACpE,MAAe,UACb,SACkB;EAClB,OAAO,CAAC,QAAQ;CAClB;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EAAE,MAAM,aAAa,QAAQ,eAAe,cAAc;EAGhE,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,oBAAoB,MAAM,6BAA6B,OAAO;EACpE,MAAM,EAAE,mBAAmB,MAAM,wBAC/B,SACA,iBACF;EAEA,MAAM,aAAa,OAAO,KAAK,OAAO,UAAU;EAEhD,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,YAAY,MAAM,aACtB,QACA,eACA,KAAK,OAAO,UAAU,SACtB,cAAc,QAAS,SACvB,gBACA,UAAU,EACZ;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GACL,QAAQ;GACR,SAAS;IACP,cAAc,YAAY;IAC1B,wBAAwB,cAAc;IACtC;IACA,kBAAkB;GACpB;EACF;CACF;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { CheckBalanceOptions, CheckBalanceTask } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumCheckBalanceTask.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Skips the outer-tx gas check for steps where the wallet doesn't fund it:
|
|
6
5
|
* smart-contract wallets (Safe Apps, 4337, 7579, …) where the
|
|
@@ -13,5 +12,4 @@ import { CheckBalanceOptions, CheckBalanceTask } from "@lifi/sdk";
|
|
|
13
12
|
export declare class EthereumCheckBalanceTask extends CheckBalanceTask {
|
|
14
13
|
protected override getCheckBalanceOptions(context: EthereumStepExecutorContext): Promise<CheckBalanceOptions>;
|
|
15
14
|
}
|
|
16
|
-
//#endregion
|
|
17
15
|
//# sourceMappingURL=EthereumCheckBalanceTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckBalanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckBalanceTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumCheckBalanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckBalanceTask.ts"],"mappings":";;;;;;;;;;;qBAoBa,iCAAiC;qBACnB,uBACvB,SAAS,8BACR,QAAQ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
2
1
|
import { getAccountCode } from "../../actions/getAccountCode.js";
|
|
3
2
|
import { isSmartContractWalletCode } from "../../actions/isSmartContractWallet.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
4
|
+
import { CheckBalanceTask, isGaslessStep } from "@lifi/sdk";
|
|
5
|
+
// src/core/tasks/EthereumCheckBalanceTask.ts
|
|
6
6
|
/**
|
|
7
7
|
* Skips the outer-tx gas check for steps where the wallet doesn't fund it:
|
|
8
8
|
* smart-contract wallets (Safe Apps, 4337, 7579, …) where the
|
|
@@ -15,6 +15,7 @@ import { CheckBalanceTask } from "@lifi/sdk";
|
|
|
15
15
|
var EthereumCheckBalanceTask = class extends CheckBalanceTask {
|
|
16
16
|
async getCheckBalanceOptions(context) {
|
|
17
17
|
const { client, step, fromChain } = context;
|
|
18
|
+
if (isGaslessStep(step)) return { walletPaysGas: false };
|
|
18
19
|
const userFundsTransaction = isPermit2AllowanceLane(step, fromChain);
|
|
19
20
|
if (step.typedData?.length && !userFundsTransaction) return { walletPaysGas: false };
|
|
20
21
|
const fromAddress = step.action.fromAddress;
|
|
@@ -27,7 +28,6 @@ var EthereumCheckBalanceTask = class extends CheckBalanceTask {
|
|
|
27
28
|
return { walletPaysGas: !isSmartContractWalletCode(code) };
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
|
-
//#endregion
|
|
31
31
|
export { EthereumCheckBalanceTask };
|
|
32
32
|
|
|
33
33
|
//# sourceMappingURL=EthereumCheckBalanceTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckBalanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumCheckBalanceTask.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"EthereumCheckBalanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumCheckBalanceTask.ts"],"sourcesContent":["import {\n type CheckBalanceOptions,\n CheckBalanceTask,\n isGaslessStep,\n} from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { getAccountCode } from '../../actions/getAccountCode.js'\nimport { isSmartContractWalletCode } from '../../actions/isSmartContractWallet.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { isPermit2AllowanceLane } from '../../utils/getTypedDataLane.js'\n\n/**\n * Skips the outer-tx gas check for steps where the wallet doesn't fund it:\n * smart-contract wallets (Safe Apps, 4337, 7579, …) where the\n * executor / bundler / paymaster pays, and typed-data steps the user does not\n * fund. Source amount and non-included native fees are still verified.\n *\n * Skip-bias is intentional: a wrong skip is caught by the wallet rejecting\n * the tx; a wrong enforce blocks a tx that would have succeeded.\n */\nexport class EthereumCheckBalanceTask extends CheckBalanceTask {\n protected override async getCheckBalanceOptions(\n context: EthereumStepExecutorContext\n ): Promise<CheckBalanceOptions> {\n const { client, step, fromChain } = context\n\n // The relayer pays the gas of a gasless step. Before prepare the step has\n // no typed data yet, so the relay fee is the only signal.\n if (isGaslessStep(step)) {\n return { walletPaysGas: false }\n }\n\n const userFundsTransaction = isPermit2AllowanceLane(step, fromChain)\n if (step.typedData?.length && !userFundsTransaction) {\n return { walletPaysGas: false }\n }\n\n // Funding wallet (NOT signer) — for Safe Apps these usually match, but\n // the balance question is about the funder. Compare with\n // `canAccountUseNativePermits`, which uses the signer.\n const fromAddress = step.action.fromAddress as Address | undefined\n if (!fromAddress) {\n return {}\n }\n\n // `step.action.fromChainId` (NOT wallet's connected chain) so cross-\n // chain / post-chain-switch flows query the chain that executes the step.\n const code = await getAccountCode({\n client,\n chainId: step.action.fromChainId,\n address: fromAddress,\n })\n\n // `code === undefined` on RPC failure → falls through to \"treat as EOA\"\n // since `isSmartContractWalletCode(undefined)` is `false` (conservative:\n // strict gas check stays on, today's behavior).\n return { walletPaysGas: !isSmartContractWalletCode(code) }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAa,2BAAb,cAA8C,iBAAiB;CAC7D,MAAyB,uBACvB,SAC8B;EAC9B,MAAM,EAAE,QAAQ,MAAM,cAAc;EAIpC,IAAI,cAAc,IAAI,GACpB,OAAO,EAAE,eAAe,MAAM;EAGhC,MAAM,uBAAuB,uBAAuB,MAAM,SAAS;EACnE,IAAI,KAAK,WAAW,UAAU,CAAC,sBAC7B,OAAO,EAAE,eAAe,MAAM;EAMhC,MAAM,cAAc,KAAK,OAAO;EAChC,IAAI,CAAC,aACH,OAAO,CAAC;EAKV,MAAM,OAAO,MAAM,eAAe;GAChC;GACA,SAAS,KAAK,OAAO;GACrB,SAAS;EACX,CAAC;EAKD,OAAO,EAAE,eAAe,CAAC,0BAA0B,IAAI,EAAE;CAC3D;AACF"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumCheckPermitsTask.d.ts
|
|
4
3
|
export declare class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
5
4
|
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
5
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=EthereumCheckPermitsTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckPermitsTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckPermitsTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumCheckPermitsTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckPermitsTask.ts"],"mappings":";;qBAUa,iCAAiC;WAC7B,UACb,SAAS,8BACR;EAWG,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getTypedDataInLane, getTypedDataLane, isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
2
1
|
import { getDomainChainId } from "../../utils/getDomainChainId.js";
|
|
2
|
+
import { getTypedDataInLane, getTypedDataLane, isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
3
3
|
import { signTypedDataEntries } from "./helpers/signTypedDataEntries.js";
|
|
4
4
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
5
|
-
|
|
5
|
+
// src/core/tasks/EthereumCheckPermitsTask.ts
|
|
6
6
|
var EthereumCheckPermitsTask = class extends BaseStepExecutionTask {
|
|
7
7
|
async shouldRun(context) {
|
|
8
8
|
const { step, fromChain, disableMessageSigning } = context;
|
|
@@ -31,7 +31,6 @@ var EthereumCheckPermitsTask = class extends BaseStepExecutionTask {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { EthereumCheckPermitsTask };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=EthereumCheckPermitsTask.js.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumNativePermitTask.d.ts
|
|
4
3
|
export declare class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
5
4
|
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
5
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=EthereumNativePermitTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumNativePermitTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumNativePermitTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"mappings":";;qBAgBa,iCAAiC;WAC7B,UACb,SAAS,8BACR;EA4BG,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { getNativePermit } from "../../permits/getNativePermit.js";
|
|
2
|
+
import { isNativePermitValid } from "../../permits/isNativePermitValid.js";
|
|
1
3
|
import { getActionWithFallback } from "../../utils/getActionWithFallback.js";
|
|
2
4
|
import { isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
3
|
-
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
4
5
|
import { isValidSignature } from "../../utils/isValidSignature.js";
|
|
5
|
-
import {
|
|
6
|
-
import { isNativePermitValid } from "../../permits/isNativePermitValid.js";
|
|
6
|
+
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
7
7
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
8
8
|
import { signTypedData } from "viem/actions";
|
|
9
9
|
import { getAction } from "viem/utils";
|
|
10
|
-
|
|
10
|
+
// src/core/tasks/EthereumNativePermitTask.ts
|
|
11
11
|
var EthereumNativePermitTask = class extends BaseStepExecutionTask {
|
|
12
12
|
async shouldRun(context) {
|
|
13
13
|
const { step, fromChain, hasMatchingPermit, hasSufficientAllowance, disableMessageSigning } = context;
|
|
@@ -35,7 +35,7 @@ var EthereumNativePermitTask = class extends BaseStepExecutionTask {
|
|
|
35
35
|
spenderAddress: fromChain.permit2Proxy,
|
|
36
36
|
amount: fromAmount,
|
|
37
37
|
ownerAddress: updatedClient.account.address
|
|
38
|
-
});
|
|
38
|
+
}, fromChain.id);
|
|
39
39
|
if (!nativePermitData) {
|
|
40
40
|
statusManager.updateAction(step, action.type, "DONE");
|
|
41
41
|
return { status: "COMPLETED" };
|
|
@@ -71,7 +71,6 @@ var EthereumNativePermitTask = class extends BaseStepExecutionTask {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
//#endregion
|
|
75
74
|
export { EthereumNativePermitTask };
|
|
76
75
|
|
|
77
76
|
//# sourceMappingURL=EthereumNativePermitTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumNativePermitTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n type SignedTypedData,\n type TaskResult,\n} from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { signTypedData } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { getNativePermit } from '../../permits/getNativePermit.js'\nimport { isNativePermitValid } from '../../permits/isNativePermitValid.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { getActionWithFallback } from '../../utils/getActionWithFallback.js'\nimport { isPermit2AllowanceLane } from '../../utils/getTypedDataLane.js'\nimport { isValidSignature } from '../../utils/isValidSignature.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\n\nexport class EthereumNativePermitTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n const {\n step,\n fromChain,\n hasMatchingPermit,\n hasSufficientAllowance,\n disableMessageSigning,\n } = context\n\n if (hasMatchingPermit || hasSufficientAllowance) {\n return false\n }\n\n if (isPermit2AllowanceLane(step, fromChain)) {\n return false\n }\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const batchingSupported = executionStrategy === 'batched'\n // Check if proxy contract is available and message signing is not disabled, also not available for atomic batch\n const isNativePermitAvailable =\n !!fromChain.permit2Proxy &&\n !batchingSupported &&\n !disableMessageSigning &&\n !step.estimate.skipPermit\n return isNativePermitAvailable\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n fromChain,\n statusManager,\n allowUserInteraction,\n checkClient,\n signedTypedData: currentSignedTypedData,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'NATIVE_PERMIT',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const fromAmount = BigInt(step.action.fromAmount)\n\n const nativePermitData = await getActionWithFallback(\n client,\n updatedClient,\n getNativePermit,\n 'getNativePermit',\n {\n client,\n viemClient: updatedClient,\n chainId: fromChain.id,\n tokenAddress: step.action.fromToken.address as Address,\n spenderAddress: fromChain.permit2Proxy as Address,\n amount: fromAmount,\n ownerAddress: updatedClient.account!.address,\n }\n )\n\n if (!nativePermitData) {\n statusManager.updateAction(step, action.type, 'DONE')\n return { status: 'COMPLETED' }\n }\n\n const signedTypedData = [...currentSignedTypedData]\n\n // Check if we already have a valid permit for this chain and requirements\n const signedTypedDataForChain = signedTypedData.find((signedTypedData) =>\n isNativePermitValid(signedTypedData, nativePermitData)\n )\n\n if (!signedTypedDataForChain) {\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n // Sign the permit\n const signature = await getAction(\n updatedClient,\n signTypedData,\n 'signTypedData'\n )({\n account: updatedClient.account!,\n domain: nativePermitData.domain,\n types: nativePermitData.types,\n primaryType: nativePermitData.primaryType,\n message: nativePermitData.message,\n })\n\n // Some wallets resolve signTypedData with a nullish or empty value\n // instead of rejecting — skip the permit and fall back to the\n // Permit2/standard approval flow\n if (!isValidSignature(signature)) {\n statusManager.updateAction(step, action.type, 'DONE')\n return { status: 'COMPLETED' }\n }\n\n // Add the new permit to the signed permits array\n const signedPermit: SignedTypedData = {\n ...nativePermitData,\n signature,\n }\n signedTypedData.push(signedPermit)\n }\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: { signedTypedData, hasMatchingPermit: true },\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAgBA,IAAa,2BAAb,cAA8C,sBAAsB;CAClE,MAAe,UACb,SACkB;EAClB,MAAM,EACJ,MACA,WACA,mBACA,wBACA,0BACE;EAEJ,IAAI,qBAAqB,wBACvB,OAAO;EAGT,IAAI,uBAAuB,MAAM,SAAS,GACxC,OAAO;EAIT,MAAM,oBAAoB,MADM,6BAA6B,OAAO,MACpB;EAOhD,OAJE,CAAC,CAAC,UAAU,gBACZ,CAAC,qBACD,CAAC,yBACD,CAAC,KAAK,SAAS;CAEnB;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,QACA,WACA,eACA,sBACA,aACA,iBAAiB,2BACf;EAEJ,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,aAAa,OAAO,KAAK,OAAO,UAAU;EAEhD,MAAM,mBAAmB,MAAM,sBAC7B,QACA,eACA,iBACA,mBACA;GACE;GACA,YAAY;GACZ,SAAS,UAAU;GACnB,cAAc,KAAK,OAAO,UAAU;GACpC,gBAAgB,UAAU;GAC1B,QAAQ;GACR,cAAc,cAAc,QAAS;EACvC,
|
|
1
|
+
{"version":3,"file":"EthereumNativePermitTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n type SignedTypedData,\n type TaskResult,\n} from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { signTypedData } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { getNativePermit } from '../../permits/getNativePermit.js'\nimport { isNativePermitValid } from '../../permits/isNativePermitValid.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport { getActionWithFallback } from '../../utils/getActionWithFallback.js'\nimport { isPermit2AllowanceLane } from '../../utils/getTypedDataLane.js'\nimport { isValidSignature } from '../../utils/isValidSignature.js'\nimport { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\n\nexport class EthereumNativePermitTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n const {\n step,\n fromChain,\n hasMatchingPermit,\n hasSufficientAllowance,\n disableMessageSigning,\n } = context\n\n if (hasMatchingPermit || hasSufficientAllowance) {\n return false\n }\n\n if (isPermit2AllowanceLane(step, fromChain)) {\n return false\n }\n\n const executionStrategy = await getEthereumExecutionStrategy(context)\n const batchingSupported = executionStrategy === 'batched'\n // Check if proxy contract is available and message signing is not disabled, also not available for atomic batch\n const isNativePermitAvailable =\n !!fromChain.permit2Proxy &&\n !batchingSupported &&\n !disableMessageSigning &&\n !step.estimate.skipPermit\n return isNativePermitAvailable\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n fromChain,\n statusManager,\n allowUserInteraction,\n checkClient,\n signedTypedData: currentSignedTypedData,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'NATIVE_PERMIT',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n const fromAmount = BigInt(step.action.fromAmount)\n\n const nativePermitData = await getActionWithFallback(\n client,\n updatedClient,\n getNativePermit,\n 'getNativePermit',\n {\n client,\n viemClient: updatedClient,\n chainId: fromChain.id,\n tokenAddress: step.action.fromToken.address as Address,\n spenderAddress: fromChain.permit2Proxy as Address,\n amount: fromAmount,\n ownerAddress: updatedClient.account!.address,\n },\n fromChain.id\n )\n\n if (!nativePermitData) {\n statusManager.updateAction(step, action.type, 'DONE')\n return { status: 'COMPLETED' }\n }\n\n const signedTypedData = [...currentSignedTypedData]\n\n // Check if we already have a valid permit for this chain and requirements\n const signedTypedDataForChain = signedTypedData.find((signedTypedData) =>\n isNativePermitValid(signedTypedData, nativePermitData)\n )\n\n if (!signedTypedDataForChain) {\n statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')\n\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n // Sign the permit\n const signature = await getAction(\n updatedClient,\n signTypedData,\n 'signTypedData'\n )({\n account: updatedClient.account!,\n domain: nativePermitData.domain,\n types: nativePermitData.types,\n primaryType: nativePermitData.primaryType,\n message: nativePermitData.message,\n })\n\n // Some wallets resolve signTypedData with a nullish or empty value\n // instead of rejecting — skip the permit and fall back to the\n // Permit2/standard approval flow\n if (!isValidSignature(signature)) {\n statusManager.updateAction(step, action.type, 'DONE')\n return { status: 'COMPLETED' }\n }\n\n // Add the new permit to the signed permits array\n const signedPermit: SignedTypedData = {\n ...nativePermitData,\n signature,\n }\n signedTypedData.push(signedPermit)\n }\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: { signedTypedData, hasMatchingPermit: true },\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAgBA,IAAa,2BAAb,cAA8C,sBAAsB;CAClE,MAAe,UACb,SACkB;EAClB,MAAM,EACJ,MACA,WACA,mBACA,wBACA,0BACE;EAEJ,IAAI,qBAAqB,wBACvB,OAAO;EAGT,IAAI,uBAAuB,MAAM,SAAS,GACxC,OAAO;EAIT,MAAM,oBAAoB,MADM,6BAA6B,OAAO,MACpB;EAOhD,OAJE,CAAC,CAAC,UAAU,gBACZ,CAAC,qBACD,CAAC,yBACD,CAAC,KAAK,SAAS;CAEnB;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,QACA,WACA,eACA,sBACA,aACA,iBAAiB,2BACf;EAEJ,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,aAAa,OAAO,KAAK,OAAO,UAAU;EAEhD,MAAM,mBAAmB,MAAM,sBAC7B,QACA,eACA,iBACA,mBACA;GACE;GACA,YAAY;GACZ,SAAS,UAAU;GACnB,cAAc,KAAK,OAAO,UAAU;GACpC,gBAAgB,UAAU;GAC1B,QAAQ;GACR,cAAc,cAAc,QAAS;EACvC,GACA,UAAU,EACZ;EAEA,IAAI,CAAC,kBAAkB;GACrB,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;GACpD,OAAO,EAAE,QAAQ,YAAY;EAC/B;EAEA,MAAM,kBAAkB,CAAC,GAAG,sBAAsB;EAOlD,IAAI,CAJ4B,gBAAgB,MAAM,oBACpD,oBAAoB,iBAAiB,gBAAgB,CAG5B,GAAG;GAC5B,cAAc,aAAa,MAAM,OAAO,MAAM,iBAAiB;GAE/D,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;GAI5B,MAAM,YAAY,MAAM,UACtB,eACA,eACA,eACF,CAAC,CAAC;IACA,SAAS,cAAc;IACvB,QAAQ,iBAAiB;IACzB,OAAO,iBAAiB;IACxB,aAAa,iBAAiB;IAC9B,SAAS,iBAAiB;GAC5B,CAAC;GAKD,IAAI,CAAC,iBAAiB,SAAS,GAAG;IAChC,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;IACpD,OAAO,EAAE,QAAQ,YAAY;GAC/B;GAGA,MAAM,eAAgC;IACpC,GAAG;IACH;GACF;GACA,gBAAgB,KAAK,YAAY;EACnC;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GACL,QAAQ;GACR,SAAS;IAAE;IAAiB,mBAAmB;GAAK;EACtD;CACF;AACF"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumPermit2AllowanceTask.d.ts
|
|
4
3
|
/** Signs the Permit2 allowances a caller attached to its own step, before prepare. */
|
|
5
4
|
export declare class EthereumPermit2AllowanceTask extends BaseStepExecutionTask {
|
|
6
5
|
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
6
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
7
|
}
|
|
9
|
-
//#endregion
|
|
10
8
|
//# sourceMappingURL=EthereumPermit2AllowanceTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumPermit2AllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumPermit2AllowanceTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumPermit2AllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumPermit2AllowanceTask.ts"],"mappings":";;;qBASa,qCAAqC;WACjC,UACb,SAAS,8BACR;EAMG,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTypedDataInLane, isPermit2AllowanceLane } from "../../utils/getTypedDataLane.js";
|
|
2
2
|
import { signTypedDataEntries } from "./helpers/signTypedDataEntries.js";
|
|
3
3
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
4
|
-
|
|
4
|
+
// src/core/tasks/EthereumPermit2AllowanceTask.ts
|
|
5
5
|
/** Signs the Permit2 allowances a caller attached to its own step, before prepare. */
|
|
6
6
|
var EthereumPermit2AllowanceTask = class extends BaseStepExecutionTask {
|
|
7
7
|
async shouldRun(context) {
|
|
@@ -26,7 +26,6 @@ var EthereumPermit2AllowanceTask = class extends BaseStepExecutionTask {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
//#endregion
|
|
30
29
|
export { EthereumPermit2AllowanceTask };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=EthereumPermit2AllowanceTask.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/EthereumPrepareTransactionTask.d.ts
|
|
4
3
|
export declare class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumPrepareTransactionTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumPrepareTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumPrepareTransactionTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumPrepareTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumPrepareTransactionTask.ts"],"mappings":";;qBAuBa,uCAAuC;EAC5C,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { STRATEGY_AFTER_PREPARE, getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
2
1
|
import { getMaxPriorityFeePerGas } from "../../actions/getMaxPriorityFeePerGas.js";
|
|
2
|
+
import { STRATEGY_AFTER_PREPARE, getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
3
3
|
import { getUpdatedStep } from "./helpers/getUpdatedStep.js";
|
|
4
4
|
import { isAllowancePreparedForAnotherStrategy } from "./helpers/isAllowancePreparedForAnotherStrategy.js";
|
|
5
5
|
import { preservePermit2Allowances } from "./helpers/preservePermit2Allowances.js";
|
|
6
|
-
import { BaseStepExecutionTask, ExecuteStepRetryError, LiFiErrorCode, TransactionError, stepComparison } from "@lifi/sdk";
|
|
7
|
-
|
|
6
|
+
import { BaseStepExecutionTask, ExecuteStepRetryError, LiFiErrorCode, TransactionError, isGaslessStep, stepComparison } from "@lifi/sdk";
|
|
7
|
+
// src/core/tasks/EthereumPrepareTransactionTask.ts
|
|
8
8
|
var EthereumPrepareTransactionTask = class extends BaseStepExecutionTask {
|
|
9
9
|
async run(context) {
|
|
10
|
-
const { step, client, executionOptions, statusManager, allowUserInteraction, checkClient, isBridgeExecution, signedTypedData, ethereumClient, fromChain } = context;
|
|
10
|
+
const { step, client, executionOptions, statusManager, allowUserInteraction, checkClient, isBridgeExecution, signedTypedData, ethereumClient, fromChain, disableMessageSigning } = context;
|
|
11
11
|
if (!statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP")) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. Action not found.");
|
|
12
|
+
if (isGaslessStep(step) && disableMessageSigning) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. A gasless step needs message signing, which is disabled.");
|
|
12
13
|
const typedDataBeforePrepare = step.typedData;
|
|
13
|
-
const updatedStep = await getUpdatedStep(client, step,
|
|
14
|
+
const updatedStep = await getUpdatedStep(client, step, executionOptions, signedTypedData);
|
|
15
|
+
if (isGaslessStep(step) && updatedStep.authorization) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. The gasless step needs an EIP-7702 authorization, which the relayer does not support yet.");
|
|
14
16
|
const comparedStep = await stepComparison(statusManager, step, updatedStep, allowUserInteraction, executionOptions);
|
|
15
17
|
const answeredTypedData = updatedStep.typedData ?? step.typedData;
|
|
16
18
|
Object.assign(step, {
|
|
@@ -33,7 +35,7 @@ var EthereumPrepareTransactionTask = class extends BaseStepExecutionTask {
|
|
|
33
35
|
if (ethereumClient.account?.type === "local") {
|
|
34
36
|
const updatedClient = await checkClient(step);
|
|
35
37
|
if (!updatedClient) return { status: "PAUSED" };
|
|
36
|
-
maxPriorityFeePerGas = await getMaxPriorityFeePerGas(client, updatedClient);
|
|
38
|
+
maxPriorityFeePerGas = await getMaxPriorityFeePerGas(client, updatedClient, fromChain.id);
|
|
37
39
|
} else maxPriorityFeePerGas = step.transactionRequest.maxPriorityFeePerGas ? BigInt(step.transactionRequest.maxPriorityFeePerGas) : void 0;
|
|
38
40
|
transactionRequest = {
|
|
39
41
|
chainId: step.transactionRequest.chainId,
|
|
@@ -64,7 +66,6 @@ var EthereumPrepareTransactionTask = class extends BaseStepExecutionTask {
|
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
|
-
//#endregion
|
|
68
69
|
export { EthereumPrepareTransactionTask };
|
|
69
70
|
|
|
70
71
|
//# sourceMappingURL=EthereumPrepareTransactionTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumPrepareTransactionTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumPrepareTransactionTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n ExecuteStepRetryError,\n LiFiErrorCode,\n stepComparison,\n type TaskResult,\n TransactionError,\n type TransactionParameters,\n} from '@lifi/sdk'\nimport { getMaxPriorityFeePerGas } from '../../actions/getMaxPriorityFeePerGas.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport {\n getEthereumExecutionStrategy,\n STRATEGY_AFTER_PREPARE,\n} from './helpers/getEthereumExecutionStrategy.js'\nimport { getUpdatedStep
|
|
1
|
+
{"version":3,"file":"EthereumPrepareTransactionTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumPrepareTransactionTask.ts"],"sourcesContent":["import {\n BaseStepExecutionTask,\n ExecuteStepRetryError,\n isGaslessStep,\n LiFiErrorCode,\n stepComparison,\n type TaskResult,\n TransactionError,\n type TransactionParameters,\n} from '@lifi/sdk'\nimport { getMaxPriorityFeePerGas } from '../../actions/getMaxPriorityFeePerGas.js'\nimport type { EthereumStepExecutorContext } from '../../types.js'\nimport {\n getEthereumExecutionStrategy,\n STRATEGY_AFTER_PREPARE,\n} from './helpers/getEthereumExecutionStrategy.js'\nimport {\n type GaslessStepFields,\n getUpdatedStep,\n} from './helpers/getUpdatedStep.js'\nimport { isAllowancePreparedForAnotherStrategy } from './helpers/isAllowancePreparedForAnotherStrategy.js'\nimport { preservePermit2Allowances } from './helpers/preservePermit2Allowances.js'\n\nexport class EthereumPrepareTransactionTask extends BaseStepExecutionTask {\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n client,\n executionOptions,\n statusManager,\n allowUserInteraction,\n checkClient,\n isBridgeExecution,\n signedTypedData,\n ethereumClient,\n fromChain,\n disableMessageSigning,\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 // The relayer executes a gasless step from the user's signature, and the\n // user has no gas to send it themselves. Fail before the re-quote.\n if (isGaslessStep(step) && disableMessageSigning) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. A gasless step needs message signing, which is disabled.'\n )\n }\n\n // A replay restores it, so the replay re-quotes like this attempt did.\n const typedDataBeforePrepare = step.typedData\n\n // Try to prepare a new transaction request and update the step with typed data\n const updatedStep = await getUpdatedStep(\n client,\n step,\n executionOptions,\n signedTypedData\n )\n\n // An EIP-7702 authorization installs a delegation on an account that has\n // none. The relayer rejects it for now, so signing it would be wasted.\n if (\n isGaslessStep(step) &&\n (updatedStep as GaslessStepFields).authorization\n ) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. The gasless step needs an EIP-7702 authorization, which the relayer does not support yet.'\n )\n }\n\n const comparedStep = await stepComparison(\n statusManager,\n step,\n updatedStep,\n allowUserInteraction,\n executionOptions\n )\n\n const answeredTypedData = updatedStep.typedData ?? step.typedData\n\n Object.assign(step, {\n ...comparedStep,\n execution: step.execution,\n typedData: preservePermit2Allowances(\n step,\n updatedStep.typedData,\n fromChain\n ),\n })\n\n if (!step.transactionRequest && !answeredTypedData?.length) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Transaction request is not found.'\n )\n }\n\n // Recompute execution strategy after PrepareTransaction mutates step\n const executionStrategy = await getEthereumExecutionStrategy(context, true)\n\n // The allowance tasks ran before prepare, in the strategy the step seemed\n // to have. In `batched` they only queued their work. If the re-quote moves\n // the step to a strategy that work does not fit, replay the step in the new\n // strategy (JUMEMB-102): only the batched task sends queued calls, and the\n // new strategy can need another spender. Sending the queued calls instead\n // could approve that wrong spender.\n //\n // A first run in `standard` is not replayed: its approval can already be\n // on-chain, and a signer that fails the Permit2 probe cannot use the relayed\n // lane anyway. A replay is checked again, whatever its strategy.\n const allowanceStrategy = context.executionStrategy\n const isReplay = context.retryParams !== undefined\n if (\n allowanceStrategy &&\n (allowanceStrategy === 'batched' || isReplay) &&\n (await isAllowancePreparedForAnotherStrategy(\n context,\n allowanceStrategy,\n executionStrategy\n ))\n ) {\n // `executeRoute` replays a step only once, so a second change fails it.\n if (isReplay) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n `Unable to prepare transaction. The step resolved to the ${executionStrategy} strategy after its allowance was prepared for ${allowanceStrategy}.`\n )\n }\n step.typedData = typedDataBeforePrepare\n throw new ExecuteStepRetryError(\n `The step resolved to the ${executionStrategy} strategy after its allowance was prepared for ${allowanceStrategy}; retry in that strategy`,\n { [STRATEGY_AFTER_PREPARE]: executionStrategy }\n )\n }\n\n let transactionRequest: TransactionParameters | undefined\n if (step.transactionRequest) {\n // Only fetch maxPriorityFeePerGas for local accounts\n let maxPriorityFeePerGas: bigint | undefined\n if (ethereumClient.account?.type === 'local') {\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n maxPriorityFeePerGas = await getMaxPriorityFeePerGas(\n client,\n updatedClient,\n fromChain.id\n )\n } else {\n maxPriorityFeePerGas = step.transactionRequest.maxPriorityFeePerGas\n ? BigInt(step.transactionRequest.maxPriorityFeePerGas)\n : undefined\n }\n transactionRequest = {\n chainId: step.transactionRequest.chainId,\n to: step.transactionRequest.to,\n from: step.transactionRequest.from,\n data: step.transactionRequest.data,\n value: step.transactionRequest.value\n ? BigInt(step.transactionRequest.value)\n : undefined,\n gas: step.transactionRequest.gasLimit\n ? BigInt(step.transactionRequest.gasLimit)\n : undefined,\n // gasPrice: step.transactionRequest.gasPrice\n // ? BigInt(step.transactionRequest.gasPrice as string)\n // : undefined,\n // maxFeePerGas: step.transactionRequest.maxFeePerGas\n // ? BigInt(step.transactionRequest.maxFeePerGas as string)\n // : undefined,\n maxPriorityFeePerGas,\n }\n }\n\n if (executionOptions?.updateTransactionRequestHook && transactionRequest) {\n const customizedTransactionRequest: TransactionParameters =\n await executionOptions.updateTransactionRequestHook({\n requestType: 'transaction',\n ...transactionRequest,\n })\n transactionRequest = {\n ...transactionRequest,\n ...customizedTransactionRequest,\n }\n }\n\n return {\n status: 'COMPLETED',\n context: { transactionRequest, executionStrategy },\n }\n }\n}\n"],"mappings":";;;;;;;AAuBA,IAAa,iCAAb,cAAoD,sBAAsB;CACxE,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,QACA,kBACA,eACA,sBACA,aACA,mBACA,iBACA,gBACA,WACA,0BACE;EAOJ,IAAI,CALW,cAAc,WAC3B,MACA,oBAAoB,gBAAgB,MAG5B,GACR,MAAM,IAAI,iBACR,cAAc,uBACd,kDACF;EAKF,IAAI,cAAc,IAAI,KAAK,uBACzB,MAAM,IAAI,iBACR,cAAc,uBACd,yFACF;EAIF,MAAM,yBAAyB,KAAK;EAGpC,MAAM,cAAc,MAAM,eACxB,QACA,MACA,kBACA,eACF;EAIA,IACE,cAAc,IAAI,KACjB,YAAkC,eAEnC,MAAM,IAAI,iBACR,cAAc,uBACd,0HACF;EAGF,MAAM,eAAe,MAAM,eACzB,eACA,MACA,aACA,sBACA,gBACF;EAEA,MAAM,oBAAoB,YAAY,aAAa,KAAK;EAExD,OAAO,OAAO,MAAM;GAClB,GAAG;GACH,WAAW,KAAK;GAChB,WAAW,0BACT,MACA,YAAY,WACZ,SACF;EACF,CAAC;EAED,IAAI,CAAC,KAAK,sBAAsB,CAAC,mBAAmB,QAClD,MAAM,IAAI,iBACR,cAAc,uBACd,kEACF;EAIF,MAAM,oBAAoB,MAAM,6BAA6B,SAAS,IAAI;EAY1E,MAAM,oBAAoB,QAAQ;EAClC,MAAM,WAAW,QAAQ,gBAAgB,KAAA;EACzC,IACE,sBACC,sBAAsB,aAAa,aACnC,MAAM,sCACL,SACA,mBACA,iBACF,GACA;GAEA,IAAI,UACF,MAAM,IAAI,iBACR,cAAc,uBACd,2DAA2D,kBAAkB,iDAAiD,kBAAkB,EAClJ;GAEF,KAAK,YAAY;GACjB,MAAM,IAAI,sBACR,4BAA4B,kBAAkB,iDAAiD,kBAAkB,2BACjH,GAAG,yBAAyB,kBAAkB,CAChD;EACF;EAEA,IAAI;EACJ,IAAI,KAAK,oBAAoB;GAE3B,IAAI;GACJ,IAAI,eAAe,SAAS,SAAS,SAAS;IAC5C,MAAM,gBAAgB,MAAM,YAAY,IAAI;IAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;IAE5B,uBAAuB,MAAM,wBAC3B,QACA,eACA,UAAU,EACZ;GACF,OACE,uBAAuB,KAAK,mBAAmB,uBAC3C,OAAO,KAAK,mBAAmB,oBAAoB,IACnD,KAAA;GAEN,qBAAqB;IACnB,SAAS,KAAK,mBAAmB;IACjC,IAAI,KAAK,mBAAmB;IAC5B,MAAM,KAAK,mBAAmB;IAC9B,MAAM,KAAK,mBAAmB;IAC9B,OAAO,KAAK,mBAAmB,QAC3B,OAAO,KAAK,mBAAmB,KAAK,IACpC,KAAA;IACJ,KAAK,KAAK,mBAAmB,WACzB,OAAO,KAAK,mBAAmB,QAAQ,IACvC,KAAA;IAOJ;GACF;EACF;EAEA,IAAI,kBAAkB,gCAAgC,oBAAoB;GACxE,MAAM,+BACJ,MAAM,iBAAiB,6BAA6B;IAClD,aAAa;IACb,GAAG;GACL,CAAC;GACH,qBAAqB;IACnB,GAAG;IACH,GAAG;GACL;EACF;EAEA,OAAO;GACL,QAAQ;GACR,SAAS;IAAE;IAAoB;GAAkB;EACnD;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/EthereumRelayedSignAndExecuteTask.d.ts
|
|
4
3
|
export declare class EthereumRelayedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumRelayedSignAndExecuteTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumRelayedSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumRelayedSignAndExecuteTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumRelayedSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumRelayedSignAndExecuteTask.ts"],"mappings":";;qBAkBa,0CAA0C;EAC/C,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { signTypedDataEntries } from "./helpers/signTypedDataEntries.js";
|
|
2
|
-
import { isNativePermitValid } from "../../permits/isNativePermitValid.js";
|
|
3
1
|
import { isHyperliquidAgentStep } from "../../hyperliquid/isHyperliquidAgentStep.js";
|
|
2
|
+
import { isNativePermitValid } from "../../permits/isNativePermitValid.js";
|
|
4
3
|
import { isTypedDataAlreadySigned } from "./helpers/isTypedDataAlreadySigned.js";
|
|
5
4
|
import { signHyperliquidTypedData } from "./helpers/signHyperliquidTypedData.js";
|
|
5
|
+
import { signTypedDataEntries } from "./helpers/signTypedDataEntries.js";
|
|
6
6
|
import { BaseStepExecutionTask, CLEARED_TRANSACTION_FIELDS, LiFiErrorCode, TransactionError, assertNoOpenTransaction, relayTransaction } from "@lifi/sdk";
|
|
7
|
-
|
|
7
|
+
// src/core/tasks/EthereumRelayedSignAndExecuteTask.ts
|
|
8
8
|
var EthereumRelayedSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
9
9
|
async run(context) {
|
|
10
10
|
const { step, client, statusManager, isBridgeExecution, signedTypedData: currentSignedTypedData } = context;
|
|
@@ -45,7 +45,6 @@ var EthereumRelayedSignAndExecuteTask = class extends BaseStepExecutionTask {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { EthereumRelayedSignAndExecuteTask };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=EthereumRelayedSignAndExecuteTask.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/EthereumRelayedWaitForTransactionTask.d.ts
|
|
4
3
|
export declare class EthereumRelayedWaitForTransactionTask extends BaseStepExecutionTask {
|
|
5
4
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
6
5
|
}
|
|
7
|
-
//#endregion
|
|
8
6
|
//# sourceMappingURL=EthereumRelayedWaitForTransactionTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumRelayedWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumRelayedWaitForTransactionTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumRelayedWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumRelayedWaitForTransactionTask.ts"],"mappings":";;qBAqBa,8CAA8C;EACnD,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { updateActionWithReceipt } from "./helpers/updateActionWithReceipt.js";
|
|
2
1
|
import { waitForRelayedTransactionReceipt } from "../../actions/waitForRelayedTransactionReceipt.js";
|
|
2
|
+
import { updateActionWithReceipt } from "./helpers/updateActionWithReceipt.js";
|
|
3
3
|
import { BaseStepExecutionTask, LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
4
|
-
|
|
4
|
+
// src/core/tasks/EthereumRelayedWaitForTransactionTask.ts
|
|
5
5
|
/** The same check as the SDK's internal `isAbortError`. */
|
|
6
6
|
const isAbortError = (error) => typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
7
7
|
var EthereumRelayedWaitForTransactionTask = class extends BaseStepExecutionTask {
|
|
@@ -21,7 +21,6 @@ var EthereumRelayedWaitForTransactionTask = class extends BaseStepExecutionTask
|
|
|
21
21
|
return { status: "COMPLETED" };
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { EthereumRelayedWaitForTransactionTask };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=EthereumRelayedWaitForTransactionTask.js.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumResetAllowanceTask.d.ts
|
|
4
3
|
export declare class EthereumResetAllowanceTask extends BaseStepExecutionTask {
|
|
5
4
|
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
5
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=EthereumResetAllowanceTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumResetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumResetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.ts"],"mappings":";;qBAWa,mCAAmC;WAC/B,UACb,SAAS,8BACR;EAYG,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
2
|
-
import { resolveAllowanceSpender } from "./helpers/resolveAllowanceSpender.js";
|
|
3
1
|
import { resolveTransactionHash } from "../../actions/resolveTransactionHash.js";
|
|
4
2
|
import { setAllowance } from "../../actions/setAllowance.js";
|
|
5
3
|
import { waitForTransactionReceipt } from "../../actions/waitForTransactionReceipt.js";
|
|
4
|
+
import { convertExtendedChain } from "../../utils/convertExtendedChain.js";
|
|
5
|
+
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
6
6
|
import { getTxLink } from "./helpers/getTxLink.js";
|
|
7
|
+
import { resolveAllowanceSpender } from "./helpers/resolveAllowanceSpender.js";
|
|
7
8
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
8
|
-
|
|
9
|
+
// src/core/tasks/EthereumResetAllowanceTask.ts
|
|
9
10
|
var EthereumResetAllowanceTask = class extends BaseStepExecutionTask {
|
|
10
11
|
async shouldRun(context) {
|
|
11
12
|
const { step, hasMatchingPermit, hasSufficientAllowance, hasAllowance } = context;
|
|
@@ -29,7 +30,7 @@ var EthereumResetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
29
30
|
const { spenderAddress } = await resolveAllowanceSpender(context, executionStrategy);
|
|
30
31
|
const updatedClient = await checkClient(step);
|
|
31
32
|
if (!updatedClient) return { status: "PAUSED" };
|
|
32
|
-
const resetResult = await setAllowance(client, updatedClient, step.action.fromToken.address, spenderAddress, 0n, executionOptions, batchingSupported);
|
|
33
|
+
const resetResult = await setAllowance(client, updatedClient, step.action.fromToken.address, spenderAddress, 0n, executionOptions, batchingSupported, convertExtendedChain(fromChain));
|
|
33
34
|
const calls = [...currentCalls];
|
|
34
35
|
if (batchingSupported) calls.push({
|
|
35
36
|
to: step.action.fromToken.address,
|
|
@@ -45,7 +46,7 @@ var EthereumResetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
45
46
|
const finalHash = (await waitForTransactionReceipt(client, {
|
|
46
47
|
client: updatedClient,
|
|
47
48
|
chainId: fromChain.id,
|
|
48
|
-
txHash:
|
|
49
|
+
txHash: resolvedTxHash,
|
|
49
50
|
onReplaced(response) {
|
|
50
51
|
const newHash = response.transaction.hash;
|
|
51
52
|
statusManager.updateAction(step, action.type, "PENDING", {
|
|
@@ -69,7 +70,6 @@ var EthereumResetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
|
-
//#endregion
|
|
73
73
|
export { EthereumResetAllowanceTask };
|
|
74
74
|
|
|
75
75
|
//# sourceMappingURL=EthereumResetAllowanceTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumResetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.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 { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumResetAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n const { step, hasMatchingPermit, hasSufficientAllowance, hasAllowance } =\n context\n\n return (\n !hasMatchingPermit &&\n !hasSufficientAllowance &&\n !!step.estimate.approvalReset &&\n !!hasAllowance\n )\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n statusManager,\n allowUserInteraction,\n checkClient,\n fromChain,\n executionOptions,\n client,\n calls: currentCalls,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'RESET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n statusManager.updateAction(step, action.type, 'RESET_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 const { spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n // Reset allowance to 0 if required\n const resetResult = await setAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n spenderAddress,\n 0n,\n executionOptions,\n batchingSupported\n )\n\n const calls = [...currentCalls]\n if (batchingSupported) {\n calls.push({\n to: step.action.fromToken.address as Address,\n data: resetResult,\n chainId: step.action.fromToken.chainId,\n })\n } else {\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n resetResult,\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":"EthereumResetAllowanceTask.js","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.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 { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'\nimport { getTxLink } from './helpers/getTxLink.js'\nimport { resolveAllowanceSpender } from './helpers/resolveAllowanceSpender.js'\n\nexport class EthereumResetAllowanceTask extends BaseStepExecutionTask {\n override async shouldRun(\n context: EthereumStepExecutorContext\n ): Promise<boolean> {\n const { step, hasMatchingPermit, hasSufficientAllowance, hasAllowance } =\n context\n\n return (\n !hasMatchingPermit &&\n !hasSufficientAllowance &&\n !!step.estimate.approvalReset &&\n !!hasAllowance\n )\n }\n\n async run(context: EthereumStepExecutorContext): Promise<TaskResult> {\n const {\n step,\n statusManager,\n allowUserInteraction,\n checkClient,\n fromChain,\n executionOptions,\n client,\n calls: currentCalls,\n } = context\n\n const action = statusManager.initializeAction({\n step,\n type: 'RESET_ALLOWANCE',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n statusManager.updateAction(step, action.type, 'RESET_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 const { spenderAddress } = await resolveAllowanceSpender(\n context,\n executionStrategy\n )\n\n const updatedClient = await checkClient(step)\n if (!updatedClient) {\n return { status: 'PAUSED' }\n }\n\n // Reset allowance to 0 if required\n const resetResult = await setAllowance(\n client,\n updatedClient,\n step.action.fromToken.address as Address,\n spenderAddress,\n 0n,\n executionOptions,\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: resetResult,\n chainId: step.action.fromToken.chainId,\n })\n } else {\n const resolvedTxHash = await resolveTransactionHash(\n client,\n updatedClient,\n resetResult,\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, 'PENDING', {\n txHash: finalHash,\n txLink: getTxLink(fromChain, finalHash),\n })\n }\n\n statusManager.updateAction(step, action.type, 'DONE')\n\n return {\n status: 'COMPLETED',\n context: { calls, executionStrategy },\n }\n }\n}\n"],"mappings":";;;;;;;;;AAWA,IAAa,6BAAb,cAAgD,sBAAsB;CACpE,MAAe,UACb,SACkB;EAClB,MAAM,EAAE,MAAM,mBAAmB,wBAAwB,iBACvD;EAEF,OACE,CAAC,qBACD,CAAC,0BACD,CAAC,CAAC,KAAK,SAAS,iBAChB,CAAC,CAAC;CAEN;CAEA,MAAM,IAAI,SAA2D;EACnE,MAAM,EACJ,MACA,eACA,sBACA,aACA,WACA,kBACA,QACA,OAAO,iBACL;EAEJ,MAAM,SAAS,cAAc,iBAAiB;GAC5C;GACA,MAAM;GACN,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,cAAc,aAAa,MAAM,OAAO,MAAM,kBAAkB;GAC9D,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;EAChD,MAAM,EAAE,mBAAmB,MAAM,wBAC/B,SACA,iBACF;EAEA,MAAM,gBAAgB,MAAM,YAAY,IAAI;EAC5C,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,SAAS;EAI5B,MAAM,cAAc,MAAM,aACxB,QACA,eACA,KAAK,OAAO,UAAU,SACtB,gBACA,IACA,kBACA,mBACA,qBAAqB,SAAS,CAChC;EAEA,MAAM,QAAQ,CAAC,GAAG,YAAY;EAC9B,IAAI,mBACF,MAAM,KAAK;GACT,IAAI,KAAK,OAAO,UAAU;GAC1B,MAAM;GACN,SAAS,KAAK,OAAO,UAAU;EACjC,CAAC;OACI;GACL,MAAM,iBAAiB,MAAM,uBAC3B,QACA,eACA,aACA,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,WAAW;IACvD,QAAQ;IACR,QAAQ,UAAU,WAAW,SAAS;GACxC,CAAC;EACH;EAEA,cAAc,aAAa,MAAM,OAAO,MAAM,MAAM;EAEpD,OAAO;GACL,QAAQ;GACR,SAAS;IAAE;IAAO;GAAkB;EACtC;CACF;AACF"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/EthereumSetAllowanceTask.d.ts
|
|
4
3
|
export declare class EthereumSetAllowanceTask extends BaseStepExecutionTask {
|
|
5
4
|
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
5
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=EthereumSetAllowanceTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"mappings":";;qBAYa,iCAAiC;WAC7B,UACb,SAAS,8BACR;EAIG,IAAI,SAAS,8BAA8B,QAAQ"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
2
|
-
import { resolveAllowanceSpender } from "./helpers/resolveAllowanceSpender.js";
|
|
3
1
|
import { resolveTransactionHash } from "../../actions/resolveTransactionHash.js";
|
|
4
2
|
import { setAllowance } from "../../actions/setAllowance.js";
|
|
5
3
|
import { waitForTransactionReceipt } from "../../actions/waitForTransactionReceipt.js";
|
|
6
|
-
import {
|
|
4
|
+
import { convertExtendedChain } from "../../utils/convertExtendedChain.js";
|
|
7
5
|
import { getApprovalAmount } from "./helpers/getApprovalAmount.js";
|
|
6
|
+
import { getEthereumExecutionStrategy } from "./helpers/getEthereumExecutionStrategy.js";
|
|
7
|
+
import { getTxLink } from "./helpers/getTxLink.js";
|
|
8
|
+
import { resolveAllowanceSpender } from "./helpers/resolveAllowanceSpender.js";
|
|
8
9
|
import { BaseStepExecutionTask } from "@lifi/sdk";
|
|
9
|
-
|
|
10
|
+
// src/core/tasks/EthereumSetAllowanceTask.ts
|
|
10
11
|
var EthereumSetAllowanceTask = class extends BaseStepExecutionTask {
|
|
11
12
|
async shouldRun(context) {
|
|
12
13
|
return !context.hasMatchingPermit && !context.hasSufficientAllowance;
|
|
@@ -30,7 +31,7 @@ var EthereumSetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
30
31
|
const approveAmount = getApprovalAmount(context, permit2Supported);
|
|
31
32
|
const updatedClient = await checkClient(step);
|
|
32
33
|
if (!updatedClient) return { status: "PAUSED" };
|
|
33
|
-
const approveResult = await setAllowance(client, updatedClient, step.action.fromToken.address, spenderAddress, approveAmount, executionOptions, batchingSupported);
|
|
34
|
+
const approveResult = await setAllowance(client, updatedClient, step.action.fromToken.address, spenderAddress, approveAmount, executionOptions, batchingSupported, convertExtendedChain(fromChain));
|
|
34
35
|
const calls = [...currentCalls];
|
|
35
36
|
if (batchingSupported) {
|
|
36
37
|
calls.push({
|
|
@@ -48,7 +49,7 @@ var EthereumSetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
48
49
|
const finalHash = (await waitForTransactionReceipt(client, {
|
|
49
50
|
client: updatedClient,
|
|
50
51
|
chainId: fromChain.id,
|
|
51
|
-
txHash:
|
|
52
|
+
txHash: resolvedTxHash,
|
|
52
53
|
onReplaced(response) {
|
|
53
54
|
const newHash = response.transaction.hash;
|
|
54
55
|
statusManager.updateAction(step, action.type, "PENDING", {
|
|
@@ -71,7 +72,6 @@ var EthereumSetAllowanceTask = class extends BaseStepExecutionTask {
|
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
|
-
//#endregion
|
|
75
75
|
export { EthereumSetAllowanceTask };
|
|
76
76
|
|
|
77
77
|
//# sourceMappingURL=EthereumSetAllowanceTask.js.map
|