@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
2
2
|
import { isHex } from "viem";
|
|
3
|
-
|
|
3
|
+
// src/utils/isValidSignature.ts
|
|
4
4
|
/**
|
|
5
5
|
* Checks that a wallet-returned signature is a usable hex string.
|
|
6
6
|
* Some wallets can resolve `signTypedData` with a nullish or empty ('0x')
|
|
@@ -14,7 +14,6 @@ function isValidSignature(signature) {
|
|
|
14
14
|
function assertValidSignature(signature) {
|
|
15
15
|
if (!isValidSignature(signature)) throw new TransactionError(LiFiErrorCode.SignatureRejected, "Wallet did not return a valid signature.");
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { assertValidSignature, isValidSignature };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=isValidSignature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isZeroAddress.d.ts","names":[],"sources":["../../../src/utils/isZeroAddress.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isZeroAddress.d.ts","names":[],"sources":["../../../src/utils/isZeroAddress.ts"],"mappings":"A,qBAEa;qBAGA,gBAAiB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { zeroAddress } from "viem";
|
|
2
|
-
|
|
2
|
+
// src/utils/isZeroAddress.ts
|
|
3
3
|
const AlternativeAddressZero = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
4
4
|
const isZeroAddress = (address) => {
|
|
5
5
|
const lowercaseAddress = address?.toLowerCase();
|
|
6
6
|
return lowercaseAddress === zeroAddress || lowercaseAddress === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { AlternativeAddressZero, isZeroAddress };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=isZeroAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"median.d.ts","names":[],"sources":["../../../src/utils/median.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"median.d.ts","names":[],"sources":["../../../src/utils/median.ts"],"mappings":"A,qBAAa,SAAU"}
|
package/dist/esm/utils/median.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/median.ts
|
|
2
2
|
const median = (arr) => {
|
|
3
3
|
if (!arr.length) return;
|
|
4
4
|
const s = [...arr].sort((a, b) => a > b ? 1 : a < b ? -1 : 0);
|
|
@@ -6,7 +6,6 @@ const median = (arr) => {
|
|
|
6
6
|
if (s.length % 2 === 0) return (s[mid - 1] + s[mid]) / 2n;
|
|
7
7
|
return s[mid];
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { median };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=median.js.map
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":"A,qBAAa;qBACA"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.3.0'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-ethereum",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "LI.FI Ethereum SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lifi/sdk": "4.
|
|
32
|
-
"viem": "^2.57.
|
|
31
|
+
"@lifi/sdk": "4.13.0",
|
|
32
|
+
"viem": "^2.57.20"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
@@ -64,7 +64,8 @@ export const checkPermitSupport = async (
|
|
|
64
64
|
spenderAddress: chain.permit2Proxy as Address,
|
|
65
65
|
amount,
|
|
66
66
|
ownerAddress,
|
|
67
|
-
}
|
|
67
|
+
},
|
|
68
|
+
chain.id
|
|
68
69
|
)
|
|
69
70
|
|
|
70
71
|
let permit2Allowance: bigint | undefined
|
|
@@ -87,7 +88,8 @@ export const checkPermitSupport = async (
|
|
|
87
88
|
viemClient,
|
|
88
89
|
tokenAddress,
|
|
89
90
|
ownerAddress,
|
|
90
|
-
chain.permit2 as Address
|
|
91
|
+
chain.permit2 as Address,
|
|
92
|
+
chain.id
|
|
91
93
|
)
|
|
92
94
|
}
|
|
93
95
|
|
|
@@ -17,7 +17,8 @@ export const getAllowance = async (
|
|
|
17
17
|
viemClient: Client,
|
|
18
18
|
tokenAddress: Address,
|
|
19
19
|
ownerAddress: Address,
|
|
20
|
-
spenderAddress: Address
|
|
20
|
+
spenderAddress: Address,
|
|
21
|
+
chainId: number | undefined
|
|
21
22
|
): Promise<bigint> => {
|
|
22
23
|
try {
|
|
23
24
|
const approved = await getActionWithFallback(
|
|
@@ -30,7 +31,8 @@ export const getAllowance = async (
|
|
|
30
31
|
abi: allowanceAbi,
|
|
31
32
|
functionName: 'allowance' as const,
|
|
32
33
|
args: [ownerAddress, spenderAddress] as const,
|
|
33
|
-
}
|
|
34
|
+
},
|
|
35
|
+
chainId
|
|
34
36
|
)
|
|
35
37
|
return approved as bigint
|
|
36
38
|
} catch (_e) {
|
|
@@ -67,7 +69,8 @@ export const getAllowanceMulticall = async (
|
|
|
67
69
|
{
|
|
68
70
|
contracts,
|
|
69
71
|
multicallAddress: multicallAddress as Address,
|
|
70
|
-
}
|
|
72
|
+
},
|
|
73
|
+
chainId
|
|
71
74
|
)
|
|
72
75
|
|
|
73
76
|
if (!results.length) {
|
|
@@ -109,7 +112,8 @@ export const getTokenAllowance = async (
|
|
|
109
112
|
viemClient,
|
|
110
113
|
token.address as Address,
|
|
111
114
|
ownerAddress,
|
|
112
|
-
spenderAddress
|
|
115
|
+
spenderAddress,
|
|
116
|
+
token.chainId
|
|
113
117
|
)
|
|
114
118
|
return approved
|
|
115
119
|
}
|
|
@@ -6,7 +6,8 @@ import { median } from '../utils/median.js'
|
|
|
6
6
|
|
|
7
7
|
export const getMaxPriorityFeePerGas = async (
|
|
8
8
|
client: SDKClient,
|
|
9
|
-
viemClient: Client
|
|
9
|
+
viemClient: Client,
|
|
10
|
+
chainId: number | undefined
|
|
10
11
|
): Promise<bigint | undefined> => {
|
|
11
12
|
const block = await getActionWithFallback(
|
|
12
13
|
client,
|
|
@@ -15,7 +16,8 @@ export const getMaxPriorityFeePerGas = async (
|
|
|
15
16
|
'getBlock',
|
|
16
17
|
{
|
|
17
18
|
includeTransactions: true,
|
|
18
|
-
}
|
|
19
|
+
},
|
|
20
|
+
chainId
|
|
19
21
|
)
|
|
20
22
|
|
|
21
23
|
const maxPriorityFeePerGasList = (block.transactions as Transaction[])
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { SDKClient } from '@lifi/sdk'
|
|
2
|
-
import type
|
|
2
|
+
import { type Address, isHex } from 'viem'
|
|
3
3
|
import { getSafeApiKey } from '../utils/getSafeApiKey.js'
|
|
4
4
|
import { isSafeWallet } from './isSafeWallet.js'
|
|
5
5
|
|
|
6
6
|
export interface IsSafeSignatureProps {
|
|
7
|
-
hash:
|
|
7
|
+
hash: unknown
|
|
8
8
|
chainId: number
|
|
9
9
|
address?: Address
|
|
10
10
|
}
|
|
@@ -21,7 +21,7 @@ export async function isSafeSignature(
|
|
|
21
21
|
): Promise<boolean> {
|
|
22
22
|
// Signature: 65 bytes = 130 hex chars + 0x prefix = 132 chars
|
|
23
23
|
// Tx hash: 32 bytes = 64 hex chars + 0x prefix = 66 chars
|
|
24
|
-
if (!hash
|
|
24
|
+
if (!isHex(hash) || hash.length <= 66) {
|
|
25
25
|
return false
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LiFiErrorCode, type SDKClient, TransactionError } from '@lifi/sdk'
|
|
2
|
-
import type
|
|
2
|
+
import { type Client, type Hash, isHex } from 'viem'
|
|
3
3
|
import { isSafeSignature } from './isSafeSignature.js'
|
|
4
4
|
import { waitForSafeTransactionExecution } from './waitForSafeTransactionExecution.js'
|
|
5
5
|
|
|
@@ -16,14 +16,21 @@ export const resolveTransactionHash = async (
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
if (!isSignature) {
|
|
19
|
+
// Unchecked wallet answer; longer hex can be a Safe signature the lookup missed.
|
|
20
|
+
if (!isHex(txHashOrSignature) || txHashOrSignature.length < 66) {
|
|
21
|
+
throw new TransactionError(
|
|
22
|
+
LiFiErrorCode.TransactionFailed,
|
|
23
|
+
'The wallet did not return a transaction hash. The wallet may have sent the transaction. Before you try again, check the activity in your wallet.'
|
|
24
|
+
)
|
|
25
|
+
}
|
|
19
26
|
return txHashOrSignature
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
const safeAddress = viemClient.account?.address
|
|
23
|
-
if (!safeAddress
|
|
30
|
+
if (!safeAddress) {
|
|
24
31
|
throw new TransactionError(
|
|
25
32
|
LiFiErrorCode.TransactionFailed,
|
|
26
|
-
'Safe address
|
|
33
|
+
'Safe address not available for transaction tracking.'
|
|
27
34
|
)
|
|
28
35
|
}
|
|
29
36
|
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
} from '@lifi/sdk'
|
|
6
6
|
import type {
|
|
7
7
|
Address,
|
|
8
|
+
Chain,
|
|
8
9
|
Client,
|
|
9
10
|
Hash,
|
|
10
11
|
Hex,
|
|
@@ -15,6 +16,8 @@ import { sendTransaction } from 'viem/actions'
|
|
|
15
16
|
import { getAction } from 'viem/utils'
|
|
16
17
|
import type { ApproveTokenRequest, RevokeApprovalRequest } from '../types.js'
|
|
17
18
|
import { approveAbi } from '../utils/abi.js'
|
|
19
|
+
import { convertExtendedChain } from '../utils/convertExtendedChain.js'
|
|
20
|
+
import { getSendChain } from '../utils/getSendChain.js'
|
|
18
21
|
import { isZeroAddress } from '../utils/isZeroAddress.js'
|
|
19
22
|
import { getAllowance } from './getAllowance.js'
|
|
20
23
|
import { getMaxPriorityFeePerGas } from './getMaxPriorityFeePerGas.js'
|
|
@@ -26,7 +29,9 @@ export const setAllowance = async (
|
|
|
26
29
|
contractAddress: Address,
|
|
27
30
|
amount: bigint,
|
|
28
31
|
executionOptions?: ExecutionOptions,
|
|
29
|
-
returnPopulatedTransaction?: boolean
|
|
32
|
+
returnPopulatedTransaction?: boolean,
|
|
33
|
+
// Without it viem uses `viemClient.chain`, which can be stale.
|
|
34
|
+
chain?: Chain
|
|
30
35
|
): Promise<Hash | Hex> => {
|
|
31
36
|
const data = encodeFunctionData({
|
|
32
37
|
abi: approveAbi,
|
|
@@ -43,7 +48,11 @@ export const setAllowance = async (
|
|
|
43
48
|
data,
|
|
44
49
|
maxPriorityFeePerGas:
|
|
45
50
|
viemClient.account?.type === 'local'
|
|
46
|
-
? await getMaxPriorityFeePerGas(
|
|
51
|
+
? await getMaxPriorityFeePerGas(
|
|
52
|
+
client,
|
|
53
|
+
viemClient,
|
|
54
|
+
chain?.id ?? viemClient.chain?.id
|
|
55
|
+
)
|
|
47
56
|
: undefined,
|
|
48
57
|
}
|
|
49
58
|
|
|
@@ -72,9 +81,17 @@ export const setAllowance = async (
|
|
|
72
81
|
gasPrice: transactionRequest.gasPrice,
|
|
73
82
|
maxFeePerGas: transactionRequest.maxFeePerGas,
|
|
74
83
|
maxPriorityFeePerGas: transactionRequest.maxPriorityFeePerGas,
|
|
84
|
+
...(chain && { chain: getSendChain(viemClient, chain) }),
|
|
75
85
|
} as SendTransactionParameters)
|
|
76
86
|
}
|
|
77
87
|
|
|
88
|
+
// Without a known chain, viem keeps `walletClient.chain`, as before.
|
|
89
|
+
const getTokenChain = (
|
|
90
|
+
client: SDKClient,
|
|
91
|
+
chainId: number
|
|
92
|
+
): Promise<Chain | undefined> =>
|
|
93
|
+
client.getChainById(chainId).then(convertExtendedChain, () => undefined)
|
|
94
|
+
|
|
78
95
|
/**
|
|
79
96
|
* Set approval for a certain token and amount.
|
|
80
97
|
* @param client - The SDK client
|
|
@@ -98,7 +115,8 @@ export const setTokenAllowance = async (
|
|
|
98
115
|
walletClient,
|
|
99
116
|
token.address as Address,
|
|
100
117
|
walletClient.account!.address,
|
|
101
|
-
spenderAddress as Address
|
|
118
|
+
spenderAddress as Address,
|
|
119
|
+
token.chainId
|
|
102
120
|
)
|
|
103
121
|
|
|
104
122
|
if (amount > approvedAmount) {
|
|
@@ -107,7 +125,10 @@ export const setTokenAllowance = async (
|
|
|
107
125
|
walletClient,
|
|
108
126
|
token.address as Address,
|
|
109
127
|
spenderAddress as Address,
|
|
110
|
-
amount
|
|
128
|
+
amount,
|
|
129
|
+
undefined,
|
|
130
|
+
false,
|
|
131
|
+
await getTokenChain(client, token.chainId)
|
|
111
132
|
)
|
|
112
133
|
|
|
113
134
|
return approveTx
|
|
@@ -136,7 +157,8 @@ export const revokeTokenApproval = async (
|
|
|
136
157
|
walletClient,
|
|
137
158
|
token.address as Address,
|
|
138
159
|
walletClient.account!.address,
|
|
139
|
-
spenderAddress as Address
|
|
160
|
+
spenderAddress as Address,
|
|
161
|
+
token.chainId
|
|
140
162
|
)
|
|
141
163
|
if (approvedAmount > 0) {
|
|
142
164
|
const approveTx = await setAllowance(
|
|
@@ -144,7 +166,10 @@ export const revokeTokenApproval = async (
|
|
|
144
166
|
walletClient,
|
|
145
167
|
token.address as Address,
|
|
146
168
|
spenderAddress as Address,
|
|
147
|
-
0n
|
|
169
|
+
0n,
|
|
170
|
+
undefined,
|
|
171
|
+
false,
|
|
172
|
+
await getTokenChain(client, token.chainId)
|
|
148
173
|
)
|
|
149
174
|
|
|
150
175
|
return approveTx
|
|
@@ -3,14 +3,47 @@ import {
|
|
|
3
3
|
type ExtendedTransactionInfo,
|
|
4
4
|
type FullStatusData,
|
|
5
5
|
getRelayedTransactionStatus,
|
|
6
|
+
getStatus,
|
|
7
|
+
isGaslessStep,
|
|
6
8
|
LiFiErrorCode,
|
|
7
9
|
type LiFiStep,
|
|
10
|
+
type RelayStatusResponseData,
|
|
8
11
|
TransactionError,
|
|
9
12
|
waitForResult,
|
|
10
13
|
} from '@lifi/sdk'
|
|
11
14
|
import type { Hash } from 'viem'
|
|
15
|
+
import { getTransactionReceipt } from 'viem/actions'
|
|
16
|
+
import { getAction } from 'viem/utils'
|
|
17
|
+
import { getPublicClient } from '../client/publicClient.js'
|
|
12
18
|
import type { WalletCallReceipt } from '../types.js'
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Status errors in a row that end the wait. A failed request, `NOT_FOUND`, the
|
|
22
|
+
* 422/1004 answer of a failed lookup and a source receipt that cannot be
|
|
23
|
+
* loaded each count; a PENDING answer resets the count, so a long relay does
|
|
24
|
+
* not collect errors over its whole wait.
|
|
25
|
+
*/
|
|
26
|
+
const MAX_STATUS_ERRORS = 5
|
|
27
|
+
|
|
28
|
+
/** The on-chain outcome of a source transaction, or `undefined` when its receipt cannot be loaded. */
|
|
29
|
+
const getSourceOutcome = async (
|
|
30
|
+
client: SDKClient,
|
|
31
|
+
chainId: number,
|
|
32
|
+
hash: Hash
|
|
33
|
+
): Promise<'success' | 'reverted' | undefined> => {
|
|
34
|
+
try {
|
|
35
|
+
const publicClient = await getPublicClient(client, chainId)
|
|
36
|
+
const receipt = await getAction(
|
|
37
|
+
publicClient,
|
|
38
|
+
getTransactionReceipt,
|
|
39
|
+
'getTransactionReceipt'
|
|
40
|
+
)({ hash })
|
|
41
|
+
return receipt.status
|
|
42
|
+
} catch {
|
|
43
|
+
return undefined
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
14
47
|
/**
|
|
15
48
|
* Polls the relayer until the relayed transaction is done or has failed.
|
|
16
49
|
*
|
|
@@ -20,7 +53,7 @@ import type { WalletCallReceipt } from '../types.js'
|
|
|
20
53
|
* @param timeout - How long to wait for a result in milliseconds. Defaults to 24 hours.
|
|
21
54
|
* @param signal - Ends the wait: no status request starts after it aborts, and the request in flight and the sleep end at once.
|
|
22
55
|
* @returns The receipt of the relayed transaction.
|
|
23
|
-
* @throws {TransactionError} If the transaction failed, was not found, or no result arrived before the timeout. Only the failed transaction is a final outcome.
|
|
56
|
+
* @throws {TransactionError} If the transaction failed, the status was not found after five status errors in a row, or no result arrived before the timeout. Only the failed transaction is a final outcome.
|
|
24
57
|
* @throws The abort reason of `signal` once it aborts.
|
|
25
58
|
*/
|
|
26
59
|
export const waitForRelayedTransactionReceipt = async (
|
|
@@ -31,11 +64,14 @@ export const waitForRelayedTransactionReceipt = async (
|
|
|
31
64
|
signal?: AbortSignal
|
|
32
65
|
): Promise<WalletCallReceipt> => {
|
|
33
66
|
const startTime = Date.now()
|
|
67
|
+
const isGasless = isGaslessStep(step)
|
|
68
|
+
const isCrossChain = step.action.fromChainId !== step.action.toChainId
|
|
69
|
+
let statusErrors = 0
|
|
34
70
|
return waitForResult(
|
|
35
71
|
async () => {
|
|
36
72
|
// Without this check, a task that stays PENDING is polled forever:
|
|
37
|
-
// PENDING is
|
|
38
|
-
//
|
|
73
|
+
// PENDING is no status error, so the error limit does not apply. An
|
|
74
|
+
// error the poll throws ends it. Not final:
|
|
39
75
|
// the relayer may still execute the task, so the action keeps its task
|
|
40
76
|
// id and a resume waits for it again instead of signing a new one.
|
|
41
77
|
if (Date.now() - startTime > timeout) {
|
|
@@ -45,15 +81,28 @@ export const waitForRelayedTransactionReceipt = async (
|
|
|
45
81
|
)
|
|
46
82
|
}
|
|
47
83
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
84
|
+
// A gasless task id is a hash like a 1inch `Order` task id, so the step
|
|
85
|
+
// selects the endpoint. The task id alone routes a gasless request: a
|
|
86
|
+
// `bridge` would let a proxy such as the Jumper backend answer it with
|
|
87
|
+
// its own order lookup. The cast is the one `getRelayedTransactionStatus`
|
|
88
|
+
// makes for the Hyperliquid answer of the same endpoint.
|
|
89
|
+
const result = await (
|
|
90
|
+
isGasless
|
|
91
|
+
? (getStatus(
|
|
92
|
+
client,
|
|
93
|
+
{ taskId },
|
|
94
|
+
{ signal }
|
|
95
|
+
) as unknown as Promise<RelayStatusResponseData>)
|
|
96
|
+
: getRelayedTransactionStatus(
|
|
97
|
+
client,
|
|
98
|
+
{
|
|
99
|
+
taskId,
|
|
100
|
+
fromChain: step.action.fromChainId,
|
|
101
|
+
toChain: step.action.toChainId,
|
|
102
|
+
...(step.tool !== 'custom' && { bridge: step.tool }),
|
|
103
|
+
},
|
|
104
|
+
{ signal }
|
|
105
|
+
)
|
|
57
106
|
).catch((e) => {
|
|
58
107
|
// A request that the abort ended is no failure of the relayer.
|
|
59
108
|
if (process.env.NODE_ENV === 'development' && !signal?.aborted) {
|
|
@@ -62,9 +111,39 @@ export const waitForRelayedTransactionReceipt = async (
|
|
|
62
111
|
return undefined
|
|
63
112
|
})
|
|
64
113
|
|
|
114
|
+
// A gasless answer is the transfer status of `/v1/status`: it reports
|
|
115
|
+
// the relayed source transaction in `sending` once the relayer sent it.
|
|
116
|
+
// Only a bridge transfer ends the wait at its source; on one chain the
|
|
117
|
+
// relayed transaction is the whole transfer.
|
|
118
|
+
const gaslessStatus = isGasless
|
|
119
|
+
? (result as unknown as FullStatusData | undefined)
|
|
120
|
+
: undefined
|
|
121
|
+
const bridgeSource =
|
|
122
|
+
isCrossChain && gaslessStatus?.sending?.txHash
|
|
123
|
+
? ({
|
|
124
|
+
status: 'success',
|
|
125
|
+
transactionHash: gaslessStatus.sending.txHash,
|
|
126
|
+
transactionLink: gaslessStatus.sending.txLink,
|
|
127
|
+
} as unknown as WalletCallReceipt)
|
|
128
|
+
: undefined
|
|
129
|
+
|
|
130
|
+
const statusError = (error: TransactionError): undefined => {
|
|
131
|
+
statusErrors++
|
|
132
|
+
if (statusErrors < MAX_STATUS_ERRORS) {
|
|
133
|
+
return undefined
|
|
134
|
+
}
|
|
135
|
+
throw error
|
|
136
|
+
}
|
|
137
|
+
|
|
65
138
|
switch (result?.status) {
|
|
66
139
|
case 'PENDING':
|
|
67
|
-
|
|
140
|
+
statusErrors = 0
|
|
141
|
+
// A gasless bridge transfer whose source transaction landed waits for
|
|
142
|
+
// its destination. The source wait ends here, so a later bridge
|
|
143
|
+
// failure reaches the status task, not the FAILED below.
|
|
144
|
+
return gaslessStatus?.substatus === 'WAIT_DESTINATION_TRANSACTION'
|
|
145
|
+
? bridgeSource
|
|
146
|
+
: undefined
|
|
68
147
|
case 'DONE': {
|
|
69
148
|
const sending: ExtendedTransactionInfo | undefined =
|
|
70
149
|
(result?.transactionStatus?.sending as ExtendedTransactionInfo) ||
|
|
@@ -73,11 +152,38 @@ export const waitForRelayedTransactionReceipt = async (
|
|
|
73
152
|
return {
|
|
74
153
|
status: 'success',
|
|
75
154
|
gasUsed: sending?.gasUsed,
|
|
76
|
-
transactionHash: result?.metadata
|
|
155
|
+
transactionHash: result?.metadata?.txHash || sending?.txHash,
|
|
77
156
|
transactionLink: sending?.txLink,
|
|
78
157
|
} as unknown as WalletCallReceipt
|
|
79
158
|
}
|
|
80
159
|
case 'FAILED':
|
|
160
|
+
// FAILED with a hash is mostly a relayed source transaction that
|
|
161
|
+
// reverted and moved nothing, so a resume may sign again. A bridge
|
|
162
|
+
// can also fail after its source landed: the tokens left the wallet,
|
|
163
|
+
// and a resume must not sign and relay a second transfer. The status
|
|
164
|
+
// task follows that transfer, as for any bridge. The source receipt
|
|
165
|
+
// tells the two apart.
|
|
166
|
+
if (bridgeSource) {
|
|
167
|
+
const outcome = await getSourceOutcome(
|
|
168
|
+
client,
|
|
169
|
+
step.action.fromChainId,
|
|
170
|
+
bridgeSource.transactionHash
|
|
171
|
+
)
|
|
172
|
+
if (outcome === 'success') {
|
|
173
|
+
return bridgeSource
|
|
174
|
+
}
|
|
175
|
+
if (outcome === undefined) {
|
|
176
|
+
// The node may not have the receipt yet, so this counts as a
|
|
177
|
+
// status error. Not final: a resume waits for the same task and
|
|
178
|
+
// checks again.
|
|
179
|
+
return statusError(
|
|
180
|
+
new TransactionError(
|
|
181
|
+
LiFiErrorCode.TransactionFailed,
|
|
182
|
+
'The relayed transaction failed, and its source transaction could not be checked.'
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
81
187
|
throw new TransactionError(
|
|
82
188
|
LiFiErrorCode.TransactionFailed,
|
|
83
189
|
'Transaction was reverted.',
|
|
@@ -85,20 +191,19 @@ export const waitForRelayedTransactionReceipt = async (
|
|
|
85
191
|
{ final: true }
|
|
86
192
|
)
|
|
87
193
|
default:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
194
|
+
return statusError(
|
|
195
|
+
new TransactionError(
|
|
196
|
+
LiFiErrorCode.TransactionNotFound,
|
|
197
|
+
'Transaction not found.'
|
|
198
|
+
)
|
|
91
199
|
)
|
|
92
200
|
}
|
|
93
201
|
},
|
|
94
202
|
5000,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
error.code === LiFiErrorCode.TransactionFailed
|
|
100
|
-
)
|
|
101
|
-
},
|
|
203
|
+
undefined,
|
|
204
|
+
// The poll counts its own status errors, so every error it throws ends
|
|
205
|
+
// the wait.
|
|
206
|
+
() => false,
|
|
102
207
|
signal
|
|
103
208
|
)
|
|
104
209
|
}
|
|
@@ -10,6 +10,8 @@ import type { Address, Hash, Hex } from 'viem'
|
|
|
10
10
|
import { sendCalls } from 'viem/actions'
|
|
11
11
|
import { getAction } from 'viem/utils'
|
|
12
12
|
import type { Call, EthereumStepExecutorContext } from '../../types.js'
|
|
13
|
+
import { convertExtendedChain } from '../../utils/convertExtendedChain.js'
|
|
14
|
+
import { getSendChain } from '../../utils/getSendChain.js'
|
|
13
15
|
|
|
14
16
|
export class EthereumBatchedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
15
17
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
@@ -70,6 +72,8 @@ export class EthereumBatchedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
70
72
|
)({
|
|
71
73
|
account: updatedClient.account!,
|
|
72
74
|
calls,
|
|
75
|
+
// Without it `sendCalls` uses `client.chain`, which can be stale.
|
|
76
|
+
chain: getSendChain(updatedClient, convertExtendedChain(fromChain)),
|
|
73
77
|
})
|
|
74
78
|
|
|
75
79
|
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
@@ -13,7 +13,7 @@ export class EthereumCheckAllowanceTask extends BaseStepExecutionTask {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
16
|
-
const { step, checkClient, client, statusManager } = context
|
|
16
|
+
const { step, checkClient, client, statusManager, fromChain } = context
|
|
17
17
|
|
|
18
18
|
// Start new allowance check
|
|
19
19
|
const action = statusManager.initializeAction({
|
|
@@ -41,7 +41,8 @@ export class EthereumCheckAllowanceTask extends BaseStepExecutionTask {
|
|
|
41
41
|
updatedClient,
|
|
42
42
|
step.action.fromToken.address as Address,
|
|
43
43
|
updatedClient.account!.address,
|
|
44
|
-
spenderAddress
|
|
44
|
+
spenderAddress,
|
|
45
|
+
fromChain.id
|
|
45
46
|
)
|
|
46
47
|
|
|
47
48
|
statusManager.updateAction(step, action.type, 'DONE')
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type CheckBalanceOptions,
|
|
3
|
+
CheckBalanceTask,
|
|
4
|
+
isGaslessStep,
|
|
5
|
+
} from '@lifi/sdk'
|
|
2
6
|
import type { Address } from 'viem'
|
|
3
7
|
import { getAccountCode } from '../../actions/getAccountCode.js'
|
|
4
8
|
import { isSmartContractWalletCode } from '../../actions/isSmartContractWallet.js'
|
|
@@ -20,6 +24,12 @@ export class EthereumCheckBalanceTask extends CheckBalanceTask {
|
|
|
20
24
|
): Promise<CheckBalanceOptions> {
|
|
21
25
|
const { client, step, fromChain } = context
|
|
22
26
|
|
|
27
|
+
// The relayer pays the gas of a gasless step. Before prepare the step has
|
|
28
|
+
// no typed data yet, so the relay fee is the only signal.
|
|
29
|
+
if (isGaslessStep(step)) {
|
|
30
|
+
return { walletPaysGas: false }
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
const userFundsTransaction = isPermit2AllowanceLane(step, fromChain)
|
|
24
34
|
if (step.typedData?.length && !userFundsTransaction) {
|
|
25
35
|
return { walletPaysGas: false }
|
|
@@ -83,7 +83,8 @@ export class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
|
83
83
|
spenderAddress: fromChain.permit2Proxy as Address,
|
|
84
84
|
amount: fromAmount,
|
|
85
85
|
ownerAddress: updatedClient.account!.address,
|
|
86
|
-
}
|
|
86
|
+
},
|
|
87
|
+
fromChain.id
|
|
87
88
|
)
|
|
88
89
|
|
|
89
90
|
if (!nativePermitData) {
|