@lifi/sdk-provider-ethereum 4.0.1-alpha.0 → 4.0.2
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 +31 -0
- package/README.md +88 -5
- package/dist/cjs/EthereumProvider.d.ts +7 -2
- package/dist/cjs/EthereumProvider.js +36 -39
- package/dist/cjs/EthereumProvider.js.map +1 -1
- package/dist/cjs/actions/checkPermitSupport.d.ts +32 -10
- package/dist/cjs/actions/checkPermitSupport.js +39 -30
- package/dist/cjs/actions/checkPermitSupport.js.map +1 -1
- package/dist/cjs/actions/constants.d.ts +53 -48
- package/dist/cjs/actions/constants.js +85 -75
- package/dist/cjs/actions/constants.js.map +1 -1
- package/dist/cjs/actions/getAccountCode.d.ts +30 -0
- package/dist/cjs/actions/getAccountCode.js +30 -0
- package/dist/cjs/actions/getAccountCode.js.map +1 -0
- package/dist/cjs/actions/getAllowance.d.ts +27 -7
- package/dist/cjs/actions/getAllowance.js +68 -69
- package/dist/cjs/actions/getAllowance.js.map +1 -1
- package/dist/cjs/actions/getEthereumBalance.d.ts +8 -3
- package/dist/cjs/actions/getEthereumBalance.js +70 -89
- package/dist/cjs/actions/getEthereumBalance.js.map +1 -1
- package/dist/cjs/actions/getMaxPriorityFeePerGas.d.ts +8 -3
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js +14 -24
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js.map +1 -1
- package/dist/cjs/actions/getMulticallAddress.d.ts +8 -3
- package/dist/cjs/actions/getMulticallAddress.js +6 -6
- package/dist/cjs/actions/getMulticallAddress.js.map +1 -1
- package/dist/cjs/actions/isBatchingSupported.d.ts +15 -6
- package/dist/cjs/actions/isBatchingSupported.js +17 -25
- package/dist/cjs/actions/isBatchingSupported.js.map +1 -1
- package/dist/cjs/actions/isSafeSignature.d.ts +23 -0
- package/dist/cjs/actions/isSafeSignature.js +24 -0
- package/dist/cjs/actions/isSafeSignature.js.map +1 -0
- package/dist/cjs/actions/isSafeWallet.d.ts +23 -0
- package/dist/cjs/actions/isSafeWallet.js +37 -0
- package/dist/cjs/actions/isSafeWallet.js.map +1 -0
- package/dist/cjs/actions/isSmartContractWallet.d.ts +10 -0
- package/dist/cjs/actions/isSmartContractWallet.js +13 -0
- package/dist/cjs/actions/isSmartContractWallet.js.map +1 -0
- package/dist/cjs/actions/resolveENSAddress.d.ts +7 -2
- package/dist/cjs/actions/resolveENSAddress.js +12 -16
- package/dist/cjs/actions/resolveENSAddress.js.map +1 -1
- package/dist/cjs/actions/resolveEthereumAddress.d.ts +7 -2
- package/dist/cjs/actions/resolveEthereumAddress.js +9 -8
- package/dist/cjs/actions/resolveEthereumAddress.js.map +1 -1
- package/dist/cjs/actions/resolveTransactionHash.d.ts +8 -0
- package/dist/cjs/actions/resolveTransactionHash.js +24 -0
- package/dist/cjs/actions/resolveTransactionHash.js.map +1 -0
- package/dist/cjs/actions/resolveUNSAddress.d.ts +7 -2
- package/dist/cjs/actions/resolveUNSAddress.js +62 -77
- package/dist/cjs/actions/resolveUNSAddress.js.map +1 -1
- package/dist/cjs/actions/setAllowance.d.ts +39 -6
- package/dist/cjs/actions/setAllowance.js +66 -62
- package/dist/cjs/actions/setAllowance.js.map +1 -1
- package/dist/cjs/actions/waitForBatchTransactionReceipt.d.ts +9 -4
- package/dist/cjs/actions/waitForBatchTransactionReceipt.js +24 -26
- package/dist/cjs/actions/waitForBatchTransactionReceipt.js.map +1 -1
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.d.ts +9 -5
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js +31 -39
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js.map +1 -1
- package/dist/cjs/actions/waitForSafeTransactionExecution.d.ts +30 -0
- package/dist/cjs/actions/waitForSafeTransactionExecution.js +54 -0
- package/dist/cjs/actions/waitForSafeTransactionExecution.js.map +1 -0
- package/dist/cjs/actions/waitForTransactionReceipt.d.ts +17 -8
- package/dist/cjs/actions/waitForTransactionReceipt.js +33 -35
- package/dist/cjs/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/cjs/client/publicClient.d.ts +14 -3
- package/dist/cjs/client/publicClient.js +43 -50
- package/dist/cjs/client/publicClient.js.map +1 -1
- package/dist/cjs/client/safeClient.d.ts +17 -0
- package/dist/cjs/client/safeClient.js +44 -0
- package/dist/cjs/client/safeClient.js.map +1 -0
- package/dist/cjs/client/types.d.ts +22 -0
- package/dist/cjs/client/types.js +0 -0
- package/dist/cjs/core/EthereumStepExecutor.d.ts +25 -0
- package/dist/cjs/core/EthereumStepExecutor.js +87 -0
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js +40 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js +24 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js +39 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +19 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +32 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +54 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js +70 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +60 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +60 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js +19 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js +76 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +80 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js +24 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +74 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js +31 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js +17 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js +19 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js +23 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +24 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.js +9 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +101 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.js +9 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js +11 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +68 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/switchChain.d.ts +23 -0
- package/dist/cjs/core/tasks/helpers/switchChain.js +35 -0
- package/dist/cjs/core/tasks/helpers/switchChain.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js +19 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js.map +1 -0
- package/dist/cjs/errors/parseEthereumErrors.d.ts +8 -3
- package/dist/cjs/errors/parseEthereumErrors.js +48 -55
- package/dist/cjs/errors/parseEthereumErrors.js.map +1 -1
- package/dist/cjs/hyperliquid/agentWallet.d.ts +13 -0
- package/dist/cjs/hyperliquid/agentWallet.js +90 -0
- package/dist/cjs/hyperliquid/agentWallet.js.map +1 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.d.ts +10 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js +21 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js.map +1 -0
- package/dist/cjs/index.d.ts +17 -16
- package/dist/cjs/index.js +37 -37
- package/dist/cjs/permits/allowanceTransfer.d.ts +38 -33
- package/dist/cjs/permits/allowanceTransfer.js +114 -80
- package/dist/cjs/permits/allowanceTransfer.js.map +1 -1
- package/dist/cjs/permits/canAccountUseNativePermits.d.ts +14 -0
- package/dist/cjs/permits/canAccountUseNativePermits.js +25 -0
- package/dist/cjs/permits/canAccountUseNativePermits.js.map +1 -0
- package/dist/cjs/permits/constants.d.ts +81 -53
- package/dist/cjs/permits/constants.js +109 -45
- package/dist/cjs/permits/constants.js.map +1 -1
- package/dist/cjs/permits/domain.d.ts +7 -2
- package/dist/cjs/permits/domain.js +11 -9
- package/dist/cjs/permits/domain.js.map +1 -1
- package/dist/cjs/permits/encodeNativePermitData.d.ts +7 -2
- package/dist/cjs/permits/encodeNativePermitData.js +20 -12
- package/dist/cjs/permits/encodeNativePermitData.js.map +1 -1
- package/dist/cjs/permits/encodePermit2Data.d.ts +7 -3
- package/dist/cjs/permits/encodePermit2Data.js +33 -28
- package/dist/cjs/permits/encodePermit2Data.js.map +1 -1
- package/dist/cjs/permits/getNativePermit.d.ts +30 -11
- package/dist/cjs/permits/getNativePermit.js +234 -302
- package/dist/cjs/permits/getNativePermit.js.map +1 -1
- package/dist/cjs/permits/getPermitTransferFromValues.d.ts +9 -4
- package/dist/cjs/permits/getPermitTransferFromValues.js +22 -21
- package/dist/cjs/permits/getPermitTransferFromValues.js.map +1 -1
- package/dist/cjs/permits/invariant.d.ts +20 -1
- package/dist/cjs/permits/invariant.js +27 -14
- package/dist/cjs/permits/invariant.js.map +1 -1
- package/dist/cjs/permits/isDelegationDesignatorCode.d.ts +26 -1
- package/dist/cjs/permits/isDelegationDesignatorCode.js +26 -4
- package/dist/cjs/permits/isDelegationDesignatorCode.js.map +1 -1
- package/dist/cjs/permits/isNativePermitValid.d.ts +10 -2
- package/dist/cjs/permits/isNativePermitValid.js +16 -30
- package/dist/cjs/permits/isNativePermitValid.js.map +1 -1
- package/dist/cjs/permits/signPermit2Message.d.ts +14 -10
- package/dist/cjs/permits/signPermit2Message.js +40 -41
- package/dist/cjs/permits/signPermit2Message.js.map +1 -1
- package/dist/cjs/permits/signatureTransfer.d.ts +39 -34
- package/dist/cjs/permits/signatureTransfer.js +145 -104
- package/dist/cjs/permits/signatureTransfer.js.map +1 -1
- package/dist/cjs/permits/types.d.ts +19 -14
- package/dist/cjs/permits/types.js +0 -3
- package/dist/cjs/types.d.ts +65 -40
- package/dist/cjs/types.js +7 -5
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/abi.d.ts +12 -212
- package/dist/cjs/utils/abi.js +28 -29
- package/dist/cjs/utils/abi.js.map +1 -1
- package/dist/cjs/utils/convertExtendedChain.d.ts +8 -3
- package/dist/cjs/utils/convertExtendedChain.js +19 -22
- package/dist/cjs/utils/convertExtendedChain.js.map +1 -1
- package/dist/cjs/utils/getActionWithFallback.d.ts +23 -4
- package/dist/cjs/utils/getActionWithFallback.js +28 -19
- package/dist/cjs/utils/getActionWithFallback.js.map +1 -1
- package/dist/cjs/utils/getDomainChainId.d.ts +12 -2
- package/dist/cjs/utils/getDomainChainId.js +17 -16
- package/dist/cjs/utils/getDomainChainId.js.map +1 -1
- package/dist/cjs/utils/getSafeApiKey.d.ts +7 -0
- package/dist/cjs/utils/getSafeApiKey.js +12 -0
- package/dist/cjs/utils/getSafeApiKey.js.map +1 -0
- package/dist/cjs/utils/isContractCallStep.d.ts +7 -2
- package/dist/cjs/utils/isContractCallStep.js +6 -4
- package/dist/cjs/utils/isContractCallStep.js.map +1 -1
- package/dist/cjs/utils/isExtendedChain.d.ts +7 -2
- package/dist/cjs/utils/isExtendedChain.js +6 -14
- package/dist/cjs/utils/isExtendedChain.js.map +1 -1
- package/dist/cjs/utils/isGaslessStep.d.ts +8 -3
- package/dist/cjs/utils/isGaslessStep.js +6 -6
- package/dist/cjs/utils/isGaslessStep.js.map +1 -1
- package/dist/cjs/utils/isRelayerStep.d.ts +8 -3
- package/dist/cjs/utils/isRelayerStep.js +6 -4
- package/dist/cjs/utils/isRelayerStep.js.map +1 -1
- package/dist/cjs/utils/isZeroAddress.d.ts +7 -3
- package/dist/cjs/utils/isZeroAddress.js +10 -9
- package/dist/cjs/utils/isZeroAddress.js.map +1 -1
- package/dist/cjs/utils/median.d.ts +5 -1
- package/dist/cjs/utils/median.js +9 -12
- package/dist/cjs/utils/median.js.map +1 -1
- package/dist/cjs/version.d.ts +6 -2
- package/dist/cjs/version.js +8 -5
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/EthereumProvider.d.ts +7 -2
- package/dist/esm/EthereumProvider.d.ts.map +1 -0
- package/dist/esm/EthereumProvider.js +36 -37
- package/dist/esm/EthereumProvider.js.map +1 -1
- package/dist/esm/actions/checkPermitSupport.d.ts +31 -24
- package/dist/esm/actions/checkPermitSupport.d.ts.map +1 -0
- package/dist/esm/actions/checkPermitSupport.js +38 -40
- package/dist/esm/actions/checkPermitSupport.js.map +1 -1
- package/dist/esm/actions/constants.d.ts +53 -48
- package/dist/esm/actions/constants.d.ts.map +1 -0
- package/dist/esm/actions/constants.js +79 -71
- package/dist/esm/actions/constants.js.map +1 -1
- package/dist/esm/actions/getAccountCode.d.ts +30 -0
- package/dist/esm/actions/getAccountCode.d.ts.map +1 -0
- package/dist/esm/actions/getAccountCode.js +29 -0
- package/dist/esm/actions/getAccountCode.js.map +1 -0
- package/dist/esm/actions/getAllowance.d.ts +25 -20
- package/dist/esm/actions/getAllowance.d.ts.map +1 -0
- package/dist/esm/actions/getAllowance.js +67 -84
- package/dist/esm/actions/getAllowance.js.map +1 -1
- package/dist/esm/actions/getEthereumBalance.d.ts +8 -3
- package/dist/esm/actions/getEthereumBalance.d.ts.map +1 -0
- package/dist/esm/actions/getEthereumBalance.js +70 -86
- package/dist/esm/actions/getEthereumBalance.js.map +1 -1
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts +8 -3
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/esm/actions/getMaxPriorityFeePerGas.js +15 -22
- package/dist/esm/actions/getMaxPriorityFeePerGas.js.map +1 -1
- package/dist/esm/actions/getMulticallAddress.d.ts +8 -3
- package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -0
- package/dist/esm/actions/getMulticallAddress.js +7 -4
- package/dist/esm/actions/getMulticallAddress.js.map +1 -1
- package/dist/esm/actions/isBatchingSupported.d.ts +15 -6
- package/dist/esm/actions/isBatchingSupported.d.ts.map +1 -0
- package/dist/esm/actions/isBatchingSupported.js +16 -24
- package/dist/esm/actions/isBatchingSupported.js.map +1 -1
- package/dist/esm/actions/isSafeSignature.d.ts +23 -0
- package/dist/esm/actions/isSafeSignature.d.ts.map +1 -0
- package/dist/esm/actions/isSafeSignature.js +23 -0
- package/dist/esm/actions/isSafeSignature.js.map +1 -0
- package/dist/esm/actions/isSafeWallet.d.ts +23 -0
- package/dist/esm/actions/isSafeWallet.d.ts.map +1 -0
- package/dist/esm/actions/isSafeWallet.js +37 -0
- package/dist/esm/actions/isSafeWallet.js.map +1 -0
- package/dist/esm/actions/isSmartContractWallet.d.ts +10 -0
- package/dist/esm/actions/isSmartContractWallet.d.ts.map +1 -0
- package/dist/esm/actions/isSmartContractWallet.js +12 -0
- package/dist/esm/actions/isSmartContractWallet.js.map +1 -0
- package/dist/esm/actions/resolveENSAddress.d.ts +7 -2
- package/dist/esm/actions/resolveENSAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveENSAddress.js +13 -15
- package/dist/esm/actions/resolveENSAddress.js.map +1 -1
- package/dist/esm/actions/resolveEthereumAddress.d.ts +7 -2
- package/dist/esm/actions/resolveEthereumAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveEthereumAddress.js +9 -6
- package/dist/esm/actions/resolveEthereumAddress.js.map +1 -1
- package/dist/esm/actions/resolveTransactionHash.d.ts +8 -0
- package/dist/esm/actions/resolveTransactionHash.d.ts.map +1 -0
- package/dist/esm/actions/resolveTransactionHash.js +23 -0
- package/dist/esm/actions/resolveTransactionHash.js.map +1 -0
- package/dist/esm/actions/resolveUNSAddress.d.ts +7 -2
- package/dist/esm/actions/resolveUNSAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveUNSAddress.js +62 -76
- package/dist/esm/actions/resolveUNSAddress.js.map +1 -1
- package/dist/esm/actions/setAllowance.d.ts +37 -23
- package/dist/esm/actions/setAllowance.d.ts.map +1 -0
- package/dist/esm/actions/setAllowance.js +65 -79
- package/dist/esm/actions/setAllowance.js.map +1 -1
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts +9 -4
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForBatchTransactionReceipt.js +25 -24
- package/dist/esm/actions/waitForBatchTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts +9 -5
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js +32 -37
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts +30 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts.map +1 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.js +53 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.js.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.d.ts +17 -8
- package/dist/esm/actions/waitForTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.js +32 -35
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/client/publicClient.d.ts +13 -8
- package/dist/esm/client/publicClient.d.ts.map +1 -0
- package/dist/esm/client/publicClient.js +43 -56
- package/dist/esm/client/publicClient.js.map +1 -1
- package/dist/esm/client/safeClient.d.ts +17 -0
- package/dist/esm/client/safeClient.d.ts.map +1 -0
- package/dist/esm/client/safeClient.js +43 -0
- package/dist/esm/client/safeClient.js.map +1 -0
- package/dist/esm/client/types.d.ts +22 -0
- package/dist/esm/client/types.d.ts.map +1 -0
- package/dist/esm/client/types.js +1 -0
- package/dist/esm/core/EthereumStepExecutor.d.ts +25 -0
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/EthereumStepExecutor.js +86 -0
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js +39 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js +23 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js +38 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +19 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +31 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +53 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js +69 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +59 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +59 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js +18 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js +75 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +79 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js +23 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +73 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js +30 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js +16 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js +18 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js +22 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +23 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getTxLink.js +8 -0
- package/dist/esm/core/tasks/helpers/getTxLink.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js +100 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.js +8 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.js.map +1 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js +10 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +67 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -0
- package/dist/esm/core/tasks/helpers/switchChain.d.ts +23 -0
- package/dist/esm/core/tasks/helpers/switchChain.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/switchChain.js +34 -0
- package/dist/esm/core/tasks/helpers/switchChain.js.map +1 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js +18 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js.map +1 -0
- package/dist/esm/errors/parseEthereumErrors.d.ts +8 -3
- package/dist/esm/errors/parseEthereumErrors.d.ts.map +1 -0
- package/dist/esm/errors/parseEthereumErrors.js +48 -75
- package/dist/esm/errors/parseEthereumErrors.js.map +1 -1
- package/dist/esm/hyperliquid/agentWallet.d.ts +13 -0
- package/dist/esm/hyperliquid/agentWallet.d.ts.map +1 -0
- package/dist/esm/hyperliquid/agentWallet.js +89 -0
- package/dist/esm/hyperliquid/agentWallet.js.map +1 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts +10 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts.map +1 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.js +17 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.js.map +1 -0
- package/dist/esm/index.d.ts +17 -16
- package/dist/esm/index.js +17 -17
- package/dist/esm/package.json +1 -1
- package/dist/esm/permits/allowanceTransfer.d.ts +38 -33
- package/dist/esm/permits/allowanceTransfer.d.ts.map +1 -0
- package/dist/esm/permits/allowanceTransfer.js +111 -77
- package/dist/esm/permits/allowanceTransfer.js.map +1 -1
- package/dist/esm/permits/canAccountUseNativePermits.d.ts +14 -0
- package/dist/esm/permits/canAccountUseNativePermits.d.ts.map +1 -0
- package/dist/esm/permits/canAccountUseNativePermits.js +24 -0
- package/dist/esm/permits/canAccountUseNativePermits.js.map +1 -0
- package/dist/esm/permits/constants.d.ts +77 -72
- package/dist/esm/permits/constants.d.ts.map +1 -0
- package/dist/esm/permits/constants.js +85 -66
- package/dist/esm/permits/constants.js.map +1 -1
- package/dist/esm/permits/domain.d.ts +7 -2
- package/dist/esm/permits/domain.d.ts.map +1 -0
- package/dist/esm/permits/domain.js +11 -7
- package/dist/esm/permits/domain.js.map +1 -1
- package/dist/esm/permits/encodeNativePermitData.d.ts +7 -2
- package/dist/esm/permits/encodeNativePermitData.d.ts.map +1 -0
- package/dist/esm/permits/encodeNativePermitData.js +21 -10
- package/dist/esm/permits/encodeNativePermitData.js.map +1 -1
- package/dist/esm/permits/encodePermit2Data.d.ts +7 -3
- package/dist/esm/permits/encodePermit2Data.d.ts.map +1 -0
- package/dist/esm/permits/encodePermit2Data.js +34 -26
- package/dist/esm/permits/encodePermit2Data.js.map +1 -1
- package/dist/esm/permits/getNativePermit.d.ts +29 -19
- package/dist/esm/permits/getNativePermit.d.ts.map +1 -0
- package/dist/esm/permits/getNativePermit.js +232 -346
- package/dist/esm/permits/getNativePermit.js.map +1 -1
- package/dist/esm/permits/getPermitTransferFromValues.d.ts +9 -4
- package/dist/esm/permits/getPermitTransferFromValues.d.ts.map +1 -0
- package/dist/esm/permits/getPermitTransferFromValues.js +23 -19
- package/dist/esm/permits/getPermitTransferFromValues.js.map +1 -1
- package/dist/esm/permits/invariant.d.ts +19 -20
- package/dist/esm/permits/invariant.d.ts.map +1 -0
- package/dist/esm/permits/invariant.js +26 -40
- package/dist/esm/permits/invariant.js.map +1 -1
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts +25 -21
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts.map +1 -0
- package/dist/esm/permits/isDelegationDesignatorCode.js +25 -21
- package/dist/esm/permits/isDelegationDesignatorCode.js.map +1 -1
- package/dist/esm/permits/isNativePermitValid.d.ts +9 -4
- package/dist/esm/permits/isNativePermitValid.d.ts.map +1 -0
- package/dist/esm/permits/isNativePermitValid.js +16 -38
- package/dist/esm/permits/isNativePermitValid.js.map +1 -1
- package/dist/esm/permits/signPermit2Message.d.ts +14 -10
- package/dist/esm/permits/signPermit2Message.d.ts.map +1 -0
- package/dist/esm/permits/signPermit2Message.js +40 -40
- package/dist/esm/permits/signPermit2Message.js.map +1 -1
- package/dist/esm/permits/signatureTransfer.d.ts +39 -34
- package/dist/esm/permits/signatureTransfer.d.ts.map +1 -0
- package/dist/esm/permits/signatureTransfer.js +145 -102
- package/dist/esm/permits/signatureTransfer.js.map +1 -1
- package/dist/esm/permits/types.d.ts +19 -14
- package/dist/esm/permits/types.d.ts.map +1 -0
- package/dist/esm/permits/types.js +0 -1
- package/dist/esm/types.d.ts +65 -43
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +7 -3
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/abi.d.ts +12 -212
- package/dist/esm/utils/abi.d.ts.map +1 -0
- package/dist/esm/utils/abi.js +22 -27
- package/dist/esm/utils/abi.js.map +1 -1
- package/dist/esm/utils/convertExtendedChain.d.ts +8 -3
- package/dist/esm/utils/convertExtendedChain.d.ts.map +1 -0
- package/dist/esm/utils/convertExtendedChain.js +20 -20
- package/dist/esm/utils/convertExtendedChain.js.map +1 -1
- package/dist/esm/utils/getActionWithFallback.d.ts +22 -17
- package/dist/esm/utils/getActionWithFallback.d.ts.map +1 -0
- package/dist/esm/utils/getActionWithFallback.js +28 -32
- package/dist/esm/utils/getActionWithFallback.js.map +1 -1
- package/dist/esm/utils/getDomainChainId.d.ts +11 -6
- package/dist/esm/utils/getDomainChainId.d.ts.map +1 -0
- package/dist/esm/utils/getDomainChainId.js +17 -20
- package/dist/esm/utils/getDomainChainId.js.map +1 -1
- package/dist/esm/utils/getSafeApiKey.d.ts +7 -0
- package/dist/esm/utils/getSafeApiKey.d.ts.map +1 -0
- package/dist/esm/utils/getSafeApiKey.js +11 -0
- package/dist/esm/utils/getSafeApiKey.js.map +1 -0
- package/dist/esm/utils/isContractCallStep.d.ts +7 -2
- package/dist/esm/utils/isContractCallStep.d.ts.map +1 -0
- package/dist/esm/utils/isContractCallStep.js +6 -2
- package/dist/esm/utils/isContractCallStep.js.map +1 -1
- package/dist/esm/utils/isExtendedChain.d.ts +7 -2
- package/dist/esm/utils/isExtendedChain.d.ts.map +1 -0
- package/dist/esm/utils/isExtendedChain.js +6 -12
- package/dist/esm/utils/isExtendedChain.js.map +1 -1
- package/dist/esm/utils/isGaslessStep.d.ts +8 -3
- package/dist/esm/utils/isGaslessStep.d.ts.map +1 -0
- package/dist/esm/utils/isGaslessStep.js +6 -4
- package/dist/esm/utils/isGaslessStep.js.map +1 -1
- package/dist/esm/utils/isRelayerStep.d.ts +8 -3
- package/dist/esm/utils/isRelayerStep.d.ts.map +1 -0
- package/dist/esm/utils/isRelayerStep.js +6 -2
- package/dist/esm/utils/isRelayerStep.js.map +1 -1
- package/dist/esm/utils/isZeroAddress.d.ts +7 -3
- package/dist/esm/utils/isZeroAddress.d.ts.map +1 -0
- package/dist/esm/utils/isZeroAddress.js +9 -7
- package/dist/esm/utils/isZeroAddress.js.map +1 -1
- package/dist/esm/utils/median.d.ts +5 -1
- package/dist/esm/utils/median.d.ts.map +1 -0
- package/dist/esm/utils/median.js +10 -10
- package/dist/esm/utils/median.js.map +1 -1
- package/dist/esm/version.d.ts +6 -2
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +6 -2
- package/dist/esm/version.js.map +1 -1
- package/package.json +7 -6
- package/src/EthereumProvider.ts +2 -1
- package/src/actions/constants.ts +2 -0
- package/src/actions/getAccountCode.ts +41 -0
- package/src/actions/getAllowance.ts +1 -1
- package/src/actions/getEthereumBalance.ts +11 -2
- package/src/actions/isSafeSignature.ts +34 -0
- package/src/actions/isSafeWallet.ts +55 -0
- package/src/actions/isSmartContractWallet.ts +9 -0
- package/src/actions/resolveTransactionHash.ts +36 -0
- package/src/actions/setAllowance.ts +8 -2
- package/src/actions/waitForSafeTransactionExecution.ts +126 -0
- package/src/client/safeClient.ts +112 -0
- package/src/client/types.ts +18 -0
- package/src/core/EthereumStepExecutor.ts +183 -0
- package/src/core/tasks/EthereumBatchedSignAndExecuteTask.ts +76 -0
- package/src/core/tasks/EthereumBatchedWaitForTransactionTask.ts +70 -0
- package/src/core/tasks/EthereumCheckAllowanceTask.ts +72 -0
- package/src/core/tasks/EthereumCheckBalanceTask.ts +50 -0
- package/src/core/tasks/EthereumCheckPermitsTask.ts +94 -0
- package/src/core/tasks/EthereumNativePermitTask.ts +129 -0
- package/src/core/tasks/EthereumPrepareTransactionTask.ts +128 -0
- package/src/core/tasks/EthereumRelayedSignAndExecuteTask.ts +121 -0
- package/src/core/tasks/EthereumRelayedWaitForTransactionTask.ts +48 -0
- package/src/core/tasks/EthereumResetAllowanceTask.ts +131 -0
- package/src/core/tasks/EthereumSetAllowanceTask.ts +132 -0
- package/src/core/tasks/EthereumSignAndExecuteTask.ts +49 -0
- package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +158 -0
- package/src/core/tasks/EthereumStandardWaitForTransactionTask.ts +65 -0
- package/src/core/tasks/EthereumWaitForTransactionStatusTask.ts +33 -0
- package/src/core/tasks/EthereumWaitForTransactionTask.ts +19 -0
- package/src/core/tasks/helpers/estimateTransactionRequest.ts +42 -0
- package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +45 -0
- package/src/core/tasks/helpers/getTxLink.ts +6 -0
- package/src/core/tasks/helpers/getUpdatedStep.ts +160 -0
- package/src/core/tasks/helpers/isPermit2Supported.ts +28 -0
- package/src/core/tasks/helpers/shouldCheckForAllowance.ts +24 -0
- package/src/core/tasks/helpers/signHyperliquidTypedData.ts +110 -0
- package/src/core/tasks/helpers/switchChain.ts +64 -0
- package/src/core/tasks/helpers/updateActionWithReceipt.ts +40 -0
- package/src/errors/parseEthereumErrors.ts +18 -4
- package/src/hyperliquid/agentWallet.ts +157 -0
- package/src/hyperliquid/isHyperliquidAgentStep.ts +24 -0
- package/src/index.ts +4 -0
- package/src/permits/allowanceTransfer.ts +5 -5
- package/src/permits/canAccountUseNativePermits.ts +31 -0
- package/src/permits/constants.ts +13 -11
- package/src/permits/getNativePermit.ts +19 -55
- package/src/permits/getPermitTransferFromValues.ts +1 -1
- package/src/permits/isDelegationDesignatorCode.ts +2 -2
- package/src/permits/signatureTransfer.ts +2 -2
- package/src/types.ts +34 -4
- package/src/utils/abi.ts +7 -7
- package/src/utils/getSafeApiKey.ts +10 -0
- package/src/version.ts +1 -1
- package/dist/cjs/EthereumStepExecutor.d.ts +0 -23
- package/dist/cjs/EthereumStepExecutor.js +0 -515
- package/dist/cjs/EthereumStepExecutor.js.map +0 -1
- package/dist/cjs/actions/checkAllowance.d.ts +0 -28
- package/dist/cjs/actions/checkAllowance.js +0 -236
- package/dist/cjs/actions/checkAllowance.js.map +0 -1
- package/dist/cjs/actions/switchChain.d.ts +0 -3
- package/dist/cjs/actions/switchChain.js +0 -40
- package/dist/cjs/actions/switchChain.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/permits/types.js.map +0 -1
- package/dist/esm/EthereumStepExecutor.d.ts +0 -23
- package/dist/esm/EthereumStepExecutor.js +0 -570
- package/dist/esm/EthereumStepExecutor.js.map +0 -1
- package/dist/esm/actions/checkAllowance.d.ts +0 -28
- package/dist/esm/actions/checkAllowance.js +0 -256
- package/dist/esm/actions/checkAllowance.js.map +0 -1
- package/dist/esm/actions/switchChain.d.ts +0 -20
- package/dist/esm/actions/switchChain.js +0 -54
- package/dist/esm/actions/switchChain.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/permits/types.js.map +0 -1
- package/dist/types/EthereumProvider.d.ts +0 -3
- package/dist/types/EthereumProvider.d.ts.map +0 -1
- package/dist/types/EthereumStepExecutor.d.ts +0 -24
- package/dist/types/EthereumStepExecutor.d.ts.map +0 -1
- package/dist/types/actions/checkAllowance.d.ts +0 -29
- package/dist/types/actions/checkAllowance.d.ts.map +0 -1
- package/dist/types/actions/checkPermitSupport.d.ts +0 -29
- package/dist/types/actions/checkPermitSupport.d.ts.map +0 -1
- package/dist/types/actions/constants.d.ts +0 -51
- package/dist/types/actions/constants.d.ts.map +0 -1
- package/dist/types/actions/getAllowance.d.ts +0 -23
- package/dist/types/actions/getAllowance.d.ts.map +0 -1
- package/dist/types/actions/getEthereumBalance.d.ts +0 -4
- package/dist/types/actions/getEthereumBalance.d.ts.map +0 -1
- package/dist/types/actions/getMaxPriorityFeePerGas.d.ts +0 -4
- package/dist/types/actions/getMaxPriorityFeePerGas.d.ts.map +0 -1
- package/dist/types/actions/getMulticallAddress.d.ts +0 -4
- package/dist/types/actions/getMulticallAddress.d.ts.map +0 -1
- package/dist/types/actions/isBatchingSupported.d.ts +0 -8
- package/dist/types/actions/isBatchingSupported.d.ts.map +0 -1
- package/dist/types/actions/resolveENSAddress.d.ts +0 -3
- package/dist/types/actions/resolveENSAddress.d.ts.map +0 -1
- package/dist/types/actions/resolveEthereumAddress.d.ts +0 -3
- package/dist/types/actions/resolveEthereumAddress.d.ts.map +0 -1
- package/dist/types/actions/resolveUNSAddress.d.ts +0 -3
- package/dist/types/actions/resolveUNSAddress.d.ts.map +0 -1
- package/dist/types/actions/setAllowance.d.ts +0 -26
- package/dist/types/actions/setAllowance.d.ts.map +0 -1
- package/dist/types/actions/switchChain.d.ts +0 -21
- package/dist/types/actions/switchChain.d.ts.map +0 -1
- package/dist/types/actions/waitForBatchTransactionReceipt.d.ts +0 -5
- package/dist/types/actions/waitForBatchTransactionReceipt.d.ts.map +0 -1
- package/dist/types/actions/waitForRelayedTransactionReceipt.d.ts +0 -6
- package/dist/types/actions/waitForRelayedTransactionReceipt.d.ts.map +0 -1
- package/dist/types/actions/waitForTransactionReceipt.d.ts +0 -11
- package/dist/types/actions/waitForTransactionReceipt.d.ts.map +0 -1
- package/dist/types/client/publicClient.d.ts +0 -10
- package/dist/types/client/publicClient.d.ts.map +0 -1
- package/dist/types/errors/parseEthereumErrors.d.ts +0 -4
- package/dist/types/errors/parseEthereumErrors.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -17
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/permits/allowanceTransfer.d.ts +0 -41
- package/dist/types/permits/allowanceTransfer.d.ts.map +0 -1
- package/dist/types/permits/constants.d.ts +0 -79
- package/dist/types/permits/constants.d.ts.map +0 -1
- package/dist/types/permits/domain.d.ts +0 -3
- package/dist/types/permits/domain.d.ts.map +0 -1
- package/dist/types/permits/encodeNativePermitData.d.ts +0 -3
- package/dist/types/permits/encodeNativePermitData.d.ts.map +0 -1
- package/dist/types/permits/encodePermit2Data.d.ts +0 -4
- package/dist/types/permits/encodePermit2Data.d.ts.map +0 -1
- package/dist/types/permits/getNativePermit.d.ts +0 -23
- package/dist/types/permits/getNativePermit.d.ts.map +0 -1
- package/dist/types/permits/getPermitTransferFromValues.d.ts +0 -5
- package/dist/types/permits/getPermitTransferFromValues.d.ts.map +0 -1
- package/dist/types/permits/invariant.d.ts +0 -22
- package/dist/types/permits/invariant.d.ts.map +0 -1
- package/dist/types/permits/isDelegationDesignatorCode.d.ts +0 -23
- package/dist/types/permits/isDelegationDesignatorCode.d.ts.map +0 -1
- package/dist/types/permits/isNativePermitValid.d.ts +0 -6
- package/dist/types/permits/isNativePermitValid.d.ts.map +0 -1
- package/dist/types/permits/signPermit2Message.d.ts +0 -13
- package/dist/types/permits/signPermit2Message.d.ts.map +0 -1
- package/dist/types/permits/signatureTransfer.d.ts +0 -41
- package/dist/types/permits/signatureTransfer.d.ts.map +0 -1
- package/dist/types/permits/types.d.ts +0 -18
- package/dist/types/permits/types.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -54
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/abi.d.ts +0 -213
- package/dist/types/utils/abi.d.ts.map +0 -1
- package/dist/types/utils/convertExtendedChain.d.ts +0 -4
- package/dist/types/utils/convertExtendedChain.d.ts.map +0 -1
- package/dist/types/utils/getActionWithFallback.d.ts +0 -20
- package/dist/types/utils/getActionWithFallback.d.ts.map +0 -1
- package/dist/types/utils/getDomainChainId.d.ts +0 -8
- package/dist/types/utils/getDomainChainId.d.ts.map +0 -1
- package/dist/types/utils/isContractCallStep.d.ts +0 -3
- package/dist/types/utils/isContractCallStep.d.ts.map +0 -1
- package/dist/types/utils/isExtendedChain.d.ts +0 -3
- package/dist/types/utils/isExtendedChain.d.ts.map +0 -1
- package/dist/types/utils/isGaslessStep.d.ts +0 -4
- package/dist/types/utils/isGaslessStep.d.ts.map +0 -1
- package/dist/types/utils/isRelayerStep.d.ts +0 -4
- package/dist/types/utils/isRelayerStep.d.ts.map +0 -1
- package/dist/types/utils/isZeroAddress.d.ts +0 -4
- package/dist/types/utils/isZeroAddress.d.ts.map +0 -1
- package/dist/types/utils/median.d.ts +0 -2
- package/dist/types/utils/median.d.ts.map +0 -1
- package/dist/types/version.d.ts +0 -3
- package/dist/types/version.d.ts.map +0 -1
- package/src/EthereumStepExecutor.ts +0 -860
- package/src/actions/checkAllowance.ts +0 -442
- package/src/actions/switchChain.ts +0 -85
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LiFiErrorCode,
|
|
3
|
+
type SDKClient,
|
|
4
|
+
TransactionError,
|
|
5
|
+
waitForResult,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import type { Address, Hash } from 'viem'
|
|
8
|
+
import { getSafeClient } from '../client/safeClient.js'
|
|
9
|
+
import { getSafeApiKey } from '../utils/getSafeApiKey.js'
|
|
10
|
+
|
|
11
|
+
export interface WaitForSafeTransactionExecutionProps {
|
|
12
|
+
chainId: number
|
|
13
|
+
safeAddress: Address
|
|
14
|
+
signature: string
|
|
15
|
+
pollingInterval?: number
|
|
16
|
+
timeout?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Polls the Safe Transaction Service until the transaction matching the given signature
|
|
21
|
+
* is executed, then resolves with the on-chain transaction hash.
|
|
22
|
+
*
|
|
23
|
+
* @param client - {@link SDKClient}
|
|
24
|
+
* @param props - {@link WaitForSafeTransactionExecutionProps}
|
|
25
|
+
* @returns The on-chain transaction hash once the Safe transaction is executed.
|
|
26
|
+
* @throws {TransactionError} If the transaction fails, is replaced, or polling times out.
|
|
27
|
+
*/
|
|
28
|
+
export async function waitForSafeTransactionExecution(
|
|
29
|
+
client: SDKClient,
|
|
30
|
+
{
|
|
31
|
+
chainId,
|
|
32
|
+
safeAddress,
|
|
33
|
+
signature,
|
|
34
|
+
pollingInterval,
|
|
35
|
+
timeout: timeoutMs,
|
|
36
|
+
}: WaitForSafeTransactionExecutionProps
|
|
37
|
+
): Promise<Hash> {
|
|
38
|
+
const basePollingInterval = pollingInterval ?? 10_000
|
|
39
|
+
const timeout = timeoutMs ?? 3_600_000 * 24 // 24 hours default
|
|
40
|
+
const safeApiKey = getSafeApiKey(client)
|
|
41
|
+
const safeClient = getSafeClient(chainId, safeApiKey)
|
|
42
|
+
let safeTxHash: Hash | undefined
|
|
43
|
+
let originalNonce: number | undefined
|
|
44
|
+
let pollCount = 0
|
|
45
|
+
const normalizedSignature = signature.toLowerCase()
|
|
46
|
+
const startTime = Date.now()
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
return await waitForResult<Hash>(
|
|
50
|
+
async () => {
|
|
51
|
+
pollCount++
|
|
52
|
+
|
|
53
|
+
if (Date.now() - startTime > timeout) {
|
|
54
|
+
throw new Error('Safe transaction polling timed out')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Resolve signature to safeTxHash
|
|
58
|
+
if (!safeTxHash) {
|
|
59
|
+
const { results } = await safeClient.getTransactions(safeAddress)
|
|
60
|
+
|
|
61
|
+
const match = results.find((tx) =>
|
|
62
|
+
tx.confirmations?.some(
|
|
63
|
+
(c) => c.signature?.toLowerCase() === normalizedSignature
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
if (!match) {
|
|
67
|
+
return undefined
|
|
68
|
+
}
|
|
69
|
+
safeTxHash = match.safeTxHash as Hash
|
|
70
|
+
originalNonce = Number(match.nonce)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// single-tx lookup for execution status
|
|
74
|
+
const tx = await safeClient.getTransaction(safeTxHash)
|
|
75
|
+
|
|
76
|
+
if (tx.isExecuted) {
|
|
77
|
+
if (!tx.isSuccessful) {
|
|
78
|
+
throw new TransactionError(
|
|
79
|
+
LiFiErrorCode.TransactionFailed,
|
|
80
|
+
'Safe transaction failed.'
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
if (!tx.transactionHash) {
|
|
84
|
+
throw new TransactionError(
|
|
85
|
+
LiFiErrorCode.TransactionFailed,
|
|
86
|
+
'Safe transaction executed but no transaction hash returned.'
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
return tx.transactionHash as Hash
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Check for replacement every 3rd poll
|
|
93
|
+
if (pollCount % 3 === 0) {
|
|
94
|
+
const { results } = await safeClient.getTransactions(safeAddress)
|
|
95
|
+
const replaced = results.find(
|
|
96
|
+
(t) =>
|
|
97
|
+
t.isExecuted &&
|
|
98
|
+
Number(t.nonce) >= originalNonce! &&
|
|
99
|
+
t.safeTxHash !== safeTxHash
|
|
100
|
+
)
|
|
101
|
+
if (replaced) {
|
|
102
|
+
throw new TransactionError(
|
|
103
|
+
LiFiErrorCode.TransactionCanceled,
|
|
104
|
+
'Safe transaction was replaced by another transaction.'
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return undefined
|
|
110
|
+
},
|
|
111
|
+
// Dynamic backoff: 10s → 30s, increasing by 2s each poll
|
|
112
|
+
(poll) => Math.min(basePollingInterval + poll * 2_000, 30_000),
|
|
113
|
+
Number.MAX_SAFE_INTEGER,
|
|
114
|
+
(_attempts, error) => !(error instanceof TransactionError)
|
|
115
|
+
)
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (error instanceof TransactionError) {
|
|
118
|
+
throw error
|
|
119
|
+
}
|
|
120
|
+
// Timeout or maxRetries exhausted
|
|
121
|
+
throw new TransactionError(
|
|
122
|
+
LiFiErrorCode.TransactionFailed,
|
|
123
|
+
'Safe transaction timed out waiting for execution.'
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { LruMap } from '@lifi/sdk'
|
|
2
|
+
import type { Address, Hash } from 'viem'
|
|
3
|
+
import type {
|
|
4
|
+
SafeInfo,
|
|
5
|
+
SafeMultisigTransaction,
|
|
6
|
+
SafeMultisigTransactionList,
|
|
7
|
+
} from './types.js'
|
|
8
|
+
|
|
9
|
+
const SAFE_CLIENT_GATEWAY = 'https://safe-client.safe.global'
|
|
10
|
+
|
|
11
|
+
// 1 hour TTL for transaction service URLs (rarely change)
|
|
12
|
+
const TX_SERVICE_URL_CACHE_TTL = 60 * 60 * 1_000
|
|
13
|
+
|
|
14
|
+
interface CacheEntry<T> {
|
|
15
|
+
value: T
|
|
16
|
+
expiresAt: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Cache for Safe Transaction Service URLs per chain
|
|
20
|
+
const txServiceUrlCache = new LruMap<CacheEntry<string>>(12)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the Safe Transaction Service URL for a given chain ID
|
|
24
|
+
*/
|
|
25
|
+
async function getTransactionServiceUrl(chainId: number): Promise<string> {
|
|
26
|
+
const cached = txServiceUrlCache.get(chainId.toString())
|
|
27
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
28
|
+
return cached.value
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const response = await fetch(`${SAFE_CLIENT_GATEWAY}/v1/chains/${chainId}`)
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Failed to resolve Safe Transaction Service URL for chain ${chainId}: ${response.status}`
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const data = (await response.json()) as {
|
|
39
|
+
transactionService: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const url = data.transactionService
|
|
43
|
+
txServiceUrlCache.set(chainId.toString(), {
|
|
44
|
+
value: url,
|
|
45
|
+
expiresAt: Date.now() + TX_SERVICE_URL_CACHE_TTL,
|
|
46
|
+
})
|
|
47
|
+
return url
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function request<T>(
|
|
51
|
+
chainId: number,
|
|
52
|
+
path: string,
|
|
53
|
+
apiKey?: string
|
|
54
|
+
): Promise<T> {
|
|
55
|
+
const baseUrl = await getTransactionServiceUrl(chainId)
|
|
56
|
+
const headers: Record<string, string> = {}
|
|
57
|
+
if (apiKey) {
|
|
58
|
+
headers.Authorization = `Bearer ${apiKey}`
|
|
59
|
+
}
|
|
60
|
+
const response = await fetch(`${baseUrl}${path}`, { headers })
|
|
61
|
+
if (!response.ok) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Safe Transaction Service request failed: ${response.status} ${response.statusText}`
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
return response.json() as Promise<T>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface SafeClientInterface {
|
|
70
|
+
getInfo: (address: Address) => Promise<SafeInfo>
|
|
71
|
+
getTransaction: (safeTxHash: Hash) => Promise<SafeMultisigTransaction>
|
|
72
|
+
getTransactions: (
|
|
73
|
+
safeAddress: Address,
|
|
74
|
+
options?: { executed?: boolean; limit?: number }
|
|
75
|
+
) => Promise<SafeMultisigTransactionList>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const getSafeClient = (
|
|
79
|
+
chainId: number,
|
|
80
|
+
apiKey?: string
|
|
81
|
+
): SafeClientInterface => ({
|
|
82
|
+
getInfo: (address: Address) =>
|
|
83
|
+
request<SafeInfo>(chainId, `/api/v1/safes/${address}/`, apiKey),
|
|
84
|
+
|
|
85
|
+
getTransaction: (safeTxHash: Hash) =>
|
|
86
|
+
request<SafeMultisigTransaction>(
|
|
87
|
+
chainId,
|
|
88
|
+
`/api/v1/multisig-transactions/${safeTxHash}/`,
|
|
89
|
+
apiKey
|
|
90
|
+
),
|
|
91
|
+
|
|
92
|
+
getTransactions: (
|
|
93
|
+
safeAddress: Address,
|
|
94
|
+
options?: { executed?: boolean; limit?: number }
|
|
95
|
+
) => {
|
|
96
|
+
const params = new URLSearchParams()
|
|
97
|
+
if (options?.executed !== undefined) {
|
|
98
|
+
params.set('executed', String(options.executed))
|
|
99
|
+
}
|
|
100
|
+
if (options?.limit !== undefined) {
|
|
101
|
+
params.set('limit', String(options.limit))
|
|
102
|
+
}
|
|
103
|
+
const qs = params.toString()
|
|
104
|
+
return request<SafeMultisigTransactionList>(
|
|
105
|
+
chainId,
|
|
106
|
+
`/api/v1/safes/${safeAddress}/multisig-transactions/${qs ? `?${qs}` : ''}`,
|
|
107
|
+
apiKey
|
|
108
|
+
)
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
export type SafeClient = ReturnType<typeof getSafeClient>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SafeInfo {
|
|
2
|
+
threshold: number
|
|
3
|
+
owners: string[]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface SafeMultisigTransaction {
|
|
7
|
+
safeTxHash: string
|
|
8
|
+
nonce: number
|
|
9
|
+
isExecuted: boolean
|
|
10
|
+
transactionHash?: string
|
|
11
|
+
isSuccessful?: boolean
|
|
12
|
+
confirmations?: Array<{ signature?: string }>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SafeMultisigTransactionList {
|
|
16
|
+
count: number
|
|
17
|
+
results: SafeMultisigTransaction[]
|
|
18
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutor,
|
|
3
|
+
createDefaultStorage,
|
|
4
|
+
type ExecuteStepRetryError,
|
|
5
|
+
type ExecuteStepRetryParams,
|
|
6
|
+
type ExecutionAction,
|
|
7
|
+
LiFiErrorCode,
|
|
8
|
+
type LiFiStepExtended,
|
|
9
|
+
type SDKClient,
|
|
10
|
+
type SDKError,
|
|
11
|
+
type SDKStorage,
|
|
12
|
+
type StepExecutorBaseContext,
|
|
13
|
+
type StepExecutorOptions,
|
|
14
|
+
TaskPipeline,
|
|
15
|
+
TransactionError,
|
|
16
|
+
} from '@lifi/sdk'
|
|
17
|
+
import type { Client, GetAddressesReturnType } from 'viem'
|
|
18
|
+
import { getAddresses } from 'viem/actions'
|
|
19
|
+
import { getAction } from 'viem/utils'
|
|
20
|
+
import { parseEthereumErrors } from '../errors/parseEthereumErrors.js'
|
|
21
|
+
import type { EthereumStepExecutorContext } from '../types.js'
|
|
22
|
+
import { isZeroAddress } from '../utils/isZeroAddress.js'
|
|
23
|
+
import { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.js'
|
|
24
|
+
import { EthereumCheckBalanceTask } from './tasks/EthereumCheckBalanceTask.js'
|
|
25
|
+
import { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'
|
|
26
|
+
import { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'
|
|
27
|
+
import { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'
|
|
28
|
+
import { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'
|
|
29
|
+
import { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'
|
|
30
|
+
import { EthereumSignAndExecuteTask } from './tasks/EthereumSignAndExecuteTask.js'
|
|
31
|
+
import { EthereumWaitForTransactionStatusTask } from './tasks/EthereumWaitForTransactionStatusTask.js'
|
|
32
|
+
import { EthereumWaitForTransactionTask } from './tasks/EthereumWaitForTransactionTask.js'
|
|
33
|
+
import { shouldCheckForAllowance } from './tasks/helpers/shouldCheckForAllowance.js'
|
|
34
|
+
import { switchChain } from './tasks/helpers/switchChain.js'
|
|
35
|
+
|
|
36
|
+
interface EthereumStepExecutorOptions extends StepExecutorOptions {
|
|
37
|
+
client: Client
|
|
38
|
+
switchChain?: (chainId: number) => Promise<Client | undefined>
|
|
39
|
+
disableMessageSigning?: boolean
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class EthereumStepExecutor extends BaseStepExecutor {
|
|
43
|
+
private client: Client
|
|
44
|
+
private switchChain?: (chainId: number) => Promise<Client | undefined>
|
|
45
|
+
private storage?: SDKStorage
|
|
46
|
+
private disableMessageSigning?: boolean
|
|
47
|
+
|
|
48
|
+
constructor(options: EthereumStepExecutorOptions) {
|
|
49
|
+
super(options)
|
|
50
|
+
this.client = options.client
|
|
51
|
+
this.switchChain = options.switchChain
|
|
52
|
+
this.disableMessageSigning = options.disableMessageSigning
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private getStorage = (client: SDKClient): SDKStorage => {
|
|
56
|
+
if (!this.storage) {
|
|
57
|
+
this.storage = client.config.storage ?? createDefaultStorage()
|
|
58
|
+
}
|
|
59
|
+
return this.storage
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override parseErrors = (
|
|
63
|
+
error: Error,
|
|
64
|
+
step?: LiFiStepExtended,
|
|
65
|
+
action?: ExecutionAction,
|
|
66
|
+
retryParams?: ExecuteStepRetryParams
|
|
67
|
+
): Promise<SDKError | ExecuteStepRetryError> =>
|
|
68
|
+
parseEthereumErrors(error, step, action, retryParams)
|
|
69
|
+
|
|
70
|
+
// Ensure that we are using the right chain and wallet when executing transactions.
|
|
71
|
+
checkClient = async (
|
|
72
|
+
step: LiFiStepExtended,
|
|
73
|
+
targetChainId?: number
|
|
74
|
+
): Promise<Client | undefined> => {
|
|
75
|
+
const updatedClient = await switchChain(
|
|
76
|
+
this.client,
|
|
77
|
+
targetChainId ?? step.action.fromChainId,
|
|
78
|
+
this.allowUserInteraction,
|
|
79
|
+
this.switchChain
|
|
80
|
+
)
|
|
81
|
+
if (updatedClient) {
|
|
82
|
+
this.client = updatedClient
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Prevent execution of the quote by wallet different from the one which requested the quote
|
|
86
|
+
let accountAddress = this.client.account?.address
|
|
87
|
+
if (!accountAddress) {
|
|
88
|
+
const accountAddresses = (await getAction(
|
|
89
|
+
this.client,
|
|
90
|
+
getAddresses,
|
|
91
|
+
'getAddresses'
|
|
92
|
+
)(undefined)) as GetAddressesReturnType
|
|
93
|
+
accountAddress = accountAddresses?.[0]
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()
|
|
97
|
+
) {
|
|
98
|
+
throw new TransactionError(
|
|
99
|
+
LiFiErrorCode.WalletChangedDuringExecution,
|
|
100
|
+
'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
return updatedClient
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
override createContext = async (
|
|
107
|
+
baseContext: StepExecutorBaseContext
|
|
108
|
+
): Promise<EthereumStepExecutorContext> => {
|
|
109
|
+
const { step, fromChain } = baseContext
|
|
110
|
+
|
|
111
|
+
const isFromNativeToken =
|
|
112
|
+
fromChain.nativeToken.address === step.action.fromToken.address &&
|
|
113
|
+
isZeroAddress(step.action.fromToken.address)
|
|
114
|
+
|
|
115
|
+
// Check if message signing is disabled - useful for smart contract wallets
|
|
116
|
+
// We also disable message signing for custom steps
|
|
117
|
+
const disableMessageSigning =
|
|
118
|
+
!!this.disableMessageSigning || step.type !== 'lifi'
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
...baseContext,
|
|
122
|
+
isFromNativeToken,
|
|
123
|
+
disableMessageSigning,
|
|
124
|
+
ethereumClient: this.client,
|
|
125
|
+
checkClient: this.checkClient,
|
|
126
|
+
getStorage: this.getStorage,
|
|
127
|
+
// Signed typed data for native permits and other messages
|
|
128
|
+
signedTypedData: [],
|
|
129
|
+
// Calls for atomic batch transactions (EIP-5792)
|
|
130
|
+
calls: [],
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
override createPipeline = (
|
|
135
|
+
context: EthereumStepExecutorContext
|
|
136
|
+
): TaskPipeline => {
|
|
137
|
+
const { step, isBridgeExecution, isFromNativeToken } = context
|
|
138
|
+
|
|
139
|
+
const tasks = [
|
|
140
|
+
new EthereumCheckPermitsTask(),
|
|
141
|
+
new EthereumCheckAllowanceTask(),
|
|
142
|
+
new EthereumNativePermitTask(),
|
|
143
|
+
new EthereumResetAllowanceTask(),
|
|
144
|
+
new EthereumSetAllowanceTask(),
|
|
145
|
+
new EthereumCheckBalanceTask(),
|
|
146
|
+
new EthereumPrepareTransactionTask(),
|
|
147
|
+
new EthereumSignAndExecuteTask(),
|
|
148
|
+
new EthereumWaitForTransactionTask(),
|
|
149
|
+
new EthereumWaitForTransactionStatusTask(),
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
const doCheckAllowance = shouldCheckForAllowance(
|
|
153
|
+
step,
|
|
154
|
+
isBridgeExecution,
|
|
155
|
+
isFromNativeToken,
|
|
156
|
+
this.statusManager
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
let taskName: string
|
|
160
|
+
if (doCheckAllowance) {
|
|
161
|
+
taskName = EthereumCheckPermitsTask.name
|
|
162
|
+
} else {
|
|
163
|
+
const swapOrBridgeAction = this.statusManager.findAction(
|
|
164
|
+
step,
|
|
165
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
166
|
+
)
|
|
167
|
+
taskName =
|
|
168
|
+
swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId
|
|
169
|
+
? swapOrBridgeAction?.status === 'DONE'
|
|
170
|
+
? EthereumWaitForTransactionStatusTask.name
|
|
171
|
+
: EthereumWaitForTransactionTask.name
|
|
172
|
+
: EthereumCheckBalanceTask.name
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const firstTaskIndex = tasks.findIndex(
|
|
176
|
+
(task) => task.constructor.name === taskName
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
const tasksToRun = tasks.slice(firstTaskIndex)
|
|
180
|
+
|
|
181
|
+
return new TaskPipeline(tasksToRun)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
LiFiErrorCode,
|
|
4
|
+
type TaskResult,
|
|
5
|
+
TransactionError,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import type { Address, Hash, Hex } from 'viem'
|
|
8
|
+
import { sendCalls } from 'viem/actions'
|
|
9
|
+
import { getAction } from 'viem/utils'
|
|
10
|
+
import type { Call, EthereumStepExecutorContext } from '../../types.js'
|
|
11
|
+
|
|
12
|
+
export class EthereumBatchedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
13
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
14
|
+
const {
|
|
15
|
+
step,
|
|
16
|
+
fromChain,
|
|
17
|
+
statusManager,
|
|
18
|
+
checkClient,
|
|
19
|
+
transactionRequest,
|
|
20
|
+
calls: currentCalls,
|
|
21
|
+
isBridgeExecution,
|
|
22
|
+
} = context
|
|
23
|
+
|
|
24
|
+
const calls = [...currentCalls]
|
|
25
|
+
|
|
26
|
+
const action = statusManager.findAction(
|
|
27
|
+
step,
|
|
28
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
29
|
+
)
|
|
30
|
+
if (!action) {
|
|
31
|
+
throw new TransactionError(
|
|
32
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
33
|
+
'Unable to prepare transaction. Action not found.'
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Make sure that the chain is still correct
|
|
38
|
+
const updatedClient = await checkClient(step)
|
|
39
|
+
if (!updatedClient) {
|
|
40
|
+
return { status: 'PAUSED' }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!transactionRequest) {
|
|
44
|
+
throw new TransactionError(
|
|
45
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
46
|
+
'Unable to prepare transaction. Transaction request is not found.'
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const transferCall: Call = {
|
|
51
|
+
chainId: fromChain.id,
|
|
52
|
+
data: transactionRequest.data as Hex,
|
|
53
|
+
to: transactionRequest.to as Address,
|
|
54
|
+
value: transactionRequest.value,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
calls.push(transferCall)
|
|
58
|
+
|
|
59
|
+
const { id } = await getAction(
|
|
60
|
+
updatedClient,
|
|
61
|
+
sendCalls,
|
|
62
|
+
'sendCalls'
|
|
63
|
+
)({
|
|
64
|
+
account: updatedClient.account!,
|
|
65
|
+
calls,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
69
|
+
taskId: id as Hash,
|
|
70
|
+
txType: 'batched',
|
|
71
|
+
signedAt: Date.now(),
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
return { status: 'COMPLETED', context: { calls } }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
LiFiErrorCode,
|
|
4
|
+
type TaskResult,
|
|
5
|
+
TransactionError,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import type { Hash } from 'viem'
|
|
8
|
+
import { waitForBatchTransactionReceipt } from '../../actions/waitForBatchTransactionReceipt.js'
|
|
9
|
+
import type {
|
|
10
|
+
EthereumStepExecutorContext,
|
|
11
|
+
WalletCallReceipt,
|
|
12
|
+
} from '../../types.js'
|
|
13
|
+
import { updateActionWithReceipt } from './helpers/updateActionWithReceipt.js'
|
|
14
|
+
|
|
15
|
+
export class EthereumBatchedWaitForTransactionTask extends BaseStepExecutionTask {
|
|
16
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
17
|
+
const { step, statusManager, fromChain, isBridgeExecution, checkClient } =
|
|
18
|
+
context
|
|
19
|
+
|
|
20
|
+
const action = statusManager.findAction(
|
|
21
|
+
step,
|
|
22
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
if (!action) {
|
|
26
|
+
throw new TransactionError(
|
|
27
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
28
|
+
'Unable to prepare transaction. Action not found.'
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const updatedClient = await checkClient(step)
|
|
33
|
+
if (!updatedClient) {
|
|
34
|
+
return { status: 'PAUSED' }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const transactionReceipt = await waitForBatchTransactionReceipt(
|
|
38
|
+
updatedClient,
|
|
39
|
+
action.taskId as Hash,
|
|
40
|
+
(result) => {
|
|
41
|
+
const receipt = result.receipts?.find((r) => r.status === 'reverted') as
|
|
42
|
+
| WalletCallReceipt
|
|
43
|
+
| undefined
|
|
44
|
+
if (receipt) {
|
|
45
|
+
updateActionWithReceipt(
|
|
46
|
+
statusManager,
|
|
47
|
+
step,
|
|
48
|
+
fromChain,
|
|
49
|
+
receipt,
|
|
50
|
+
action
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
updateActionWithReceipt(
|
|
57
|
+
statusManager,
|
|
58
|
+
step,
|
|
59
|
+
fromChain,
|
|
60
|
+
transactionReceipt,
|
|
61
|
+
action
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
if (isBridgeExecution) {
|
|
65
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return { status: 'COMPLETED' }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
2
|
+
import type { Address } from 'viem'
|
|
3
|
+
import { getAllowance } from '../../actions/getAllowance.js'
|
|
4
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
5
|
+
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
6
|
+
import { isPermit2Supported } from './helpers/isPermit2Supported.js'
|
|
7
|
+
|
|
8
|
+
export class EthereumCheckAllowanceTask extends BaseStepExecutionTask {
|
|
9
|
+
override async shouldRun(
|
|
10
|
+
context: EthereumStepExecutorContext
|
|
11
|
+
): Promise<boolean> {
|
|
12
|
+
return !context.hasMatchingPermit
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
16
|
+
const {
|
|
17
|
+
step,
|
|
18
|
+
checkClient,
|
|
19
|
+
fromChain,
|
|
20
|
+
client,
|
|
21
|
+
statusManager,
|
|
22
|
+
isFromNativeToken,
|
|
23
|
+
disableMessageSigning,
|
|
24
|
+
} = context
|
|
25
|
+
|
|
26
|
+
// Start new allowance check
|
|
27
|
+
const action = statusManager.initializeAction({
|
|
28
|
+
step,
|
|
29
|
+
type: 'CHECK_ALLOWANCE',
|
|
30
|
+
chainId: step.action.fromChainId,
|
|
31
|
+
status: 'STARTED',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const executionStrategy = await getEthereumExecutionStrategy(context)
|
|
35
|
+
const permit2Supported = isPermit2Supported(
|
|
36
|
+
step,
|
|
37
|
+
fromChain,
|
|
38
|
+
isFromNativeToken,
|
|
39
|
+
disableMessageSigning,
|
|
40
|
+
executionStrategy
|
|
41
|
+
)
|
|
42
|
+
const spenderAddress = permit2Supported
|
|
43
|
+
? fromChain.permit2
|
|
44
|
+
: step.estimate.approvalAddress
|
|
45
|
+
|
|
46
|
+
const fromAmount = BigInt(step.action.fromAmount)
|
|
47
|
+
|
|
48
|
+
const updatedClient = await checkClient(step)
|
|
49
|
+
if (!updatedClient) {
|
|
50
|
+
return { status: 'PAUSED' }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const allowance = await getAllowance(
|
|
54
|
+
client,
|
|
55
|
+
updatedClient,
|
|
56
|
+
step.action.fromToken.address as Address,
|
|
57
|
+
updatedClient.account!.address,
|
|
58
|
+
spenderAddress as Address
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
status: 'COMPLETED',
|
|
65
|
+
context: {
|
|
66
|
+
hasAllowance: allowance > 0n,
|
|
67
|
+
hasSufficientAllowance: fromAmount <= allowance,
|
|
68
|
+
executionStrategy,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|