@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,50 @@
|
|
|
1
|
+
import { type CheckBalanceOptions, CheckBalanceTask } from '@lifi/sdk'
|
|
2
|
+
import type { Address } from 'viem'
|
|
3
|
+
import { getAccountCode } from '../../actions/getAccountCode.js'
|
|
4
|
+
import { isSmartContractWalletCode } from '../../actions/isSmartContractWallet.js'
|
|
5
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
6
|
+
import { isRelayerStep } from '../../utils/isRelayerStep.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Skips the outer-tx gas check for steps where the wallet doesn't fund it:
|
|
10
|
+
* smart-contract wallets (Safe Apps, 4337, 7579, …) where the
|
|
11
|
+
* executor / bundler / paymaster pays, and relayed steps. Source amount
|
|
12
|
+
* and non-included native fees are still verified.
|
|
13
|
+
*
|
|
14
|
+
* Skip-bias is intentional: a wrong skip is caught by the wallet rejecting
|
|
15
|
+
* the tx; a wrong enforce blocks a tx that would have succeeded.
|
|
16
|
+
*/
|
|
17
|
+
export class EthereumCheckBalanceTask extends CheckBalanceTask {
|
|
18
|
+
protected override async getCheckBalanceOptions(
|
|
19
|
+
context: EthereumStepExecutorContext
|
|
20
|
+
): Promise<CheckBalanceOptions> {
|
|
21
|
+
const { client, step } = context
|
|
22
|
+
|
|
23
|
+
// Relayer pays gas regardless of wallet shape — answer is fixed, no RPC
|
|
24
|
+
// needed.
|
|
25
|
+
if (isRelayerStep(step)) {
|
|
26
|
+
return { walletPaysGas: false }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Funding wallet (NOT signer) — for Safe Apps these usually match, but
|
|
30
|
+
// the balance question is about the funder. Compare with
|
|
31
|
+
// `canAccountUseNativePermits`, which uses the signer.
|
|
32
|
+
const fromAddress = step.action.fromAddress as Address | undefined
|
|
33
|
+
if (!fromAddress) {
|
|
34
|
+
return {}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// `step.action.fromChainId` (NOT wallet's connected chain) so cross-
|
|
38
|
+
// chain / post-chain-switch flows query the chain that executes the step.
|
|
39
|
+
const code = await getAccountCode({
|
|
40
|
+
client,
|
|
41
|
+
chainId: step.action.fromChainId,
|
|
42
|
+
address: fromAddress,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// `code === undefined` on RPC failure → falls through to "treat as EOA"
|
|
46
|
+
// since `isSmartContractWalletCode(undefined)` is `false` (conservative:
|
|
47
|
+
// strict gas check stays on, today's behavior).
|
|
48
|
+
return { walletPaysGas: !isSmartContractWalletCode(code) }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
type SignedTypedData,
|
|
4
|
+
type TaskResult,
|
|
5
|
+
} from '@lifi/sdk'
|
|
6
|
+
import { signTypedData } from 'viem/actions'
|
|
7
|
+
import { getAction } from 'viem/utils'
|
|
8
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
9
|
+
import { getDomainChainId } from '../../utils/getDomainChainId.js'
|
|
10
|
+
|
|
11
|
+
export class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
12
|
+
override async shouldRun(
|
|
13
|
+
context: EthereumStepExecutorContext
|
|
14
|
+
): Promise<boolean> {
|
|
15
|
+
const { step, disableMessageSigning } = context
|
|
16
|
+
|
|
17
|
+
const permitTypedData = step.typedData?.filter(
|
|
18
|
+
(typedData) => typedData.primaryType === 'Permit'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return !!permitTypedData?.length && !disableMessageSigning
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
25
|
+
const {
|
|
26
|
+
step,
|
|
27
|
+
statusManager,
|
|
28
|
+
allowUserInteraction,
|
|
29
|
+
checkClient,
|
|
30
|
+
signedTypedData: currentSignedTypedData,
|
|
31
|
+
} = context
|
|
32
|
+
|
|
33
|
+
const action = statusManager.initializeAction({
|
|
34
|
+
step,
|
|
35
|
+
type: 'PERMIT',
|
|
36
|
+
chainId: step.action.fromChainId,
|
|
37
|
+
status: 'STARTED',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// First, try to sign all permits in step.typedData
|
|
41
|
+
const permitTypedData =
|
|
42
|
+
step.typedData?.filter(
|
|
43
|
+
(typedData) => typedData.primaryType === 'Permit'
|
|
44
|
+
) ?? []
|
|
45
|
+
|
|
46
|
+
const signedTypedData = [...currentSignedTypedData]
|
|
47
|
+
for (const typedData of permitTypedData) {
|
|
48
|
+
statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')
|
|
49
|
+
|
|
50
|
+
if (!allowUserInteraction) {
|
|
51
|
+
return { status: 'PAUSED' }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const typedDataChainId =
|
|
55
|
+
getDomainChainId(typedData.domain) || step.action.fromChainId
|
|
56
|
+
|
|
57
|
+
// Switch to the permit's chain if needed
|
|
58
|
+
const permitClient = await checkClient(step, typedDataChainId)
|
|
59
|
+
if (!permitClient) {
|
|
60
|
+
return { status: 'PAUSED' }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const signature = await getAction(
|
|
64
|
+
permitClient,
|
|
65
|
+
signTypedData,
|
|
66
|
+
'signTypedData'
|
|
67
|
+
)({
|
|
68
|
+
account: permitClient.account!,
|
|
69
|
+
domain: typedData.domain,
|
|
70
|
+
types: typedData.types,
|
|
71
|
+
primaryType: typedData.primaryType,
|
|
72
|
+
message: typedData.message,
|
|
73
|
+
})
|
|
74
|
+
const signedPermit: SignedTypedData = {
|
|
75
|
+
...typedData,
|
|
76
|
+
signature,
|
|
77
|
+
}
|
|
78
|
+
signedTypedData.push(signedPermit)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Check if there's a signed permit for the source transaction chain
|
|
82
|
+
const matchingPermit = signedTypedData.find(
|
|
83
|
+
(signedTypedData) =>
|
|
84
|
+
getDomainChainId(signedTypedData.domain) === step.action.fromChainId
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
status: 'COMPLETED',
|
|
91
|
+
context: { signedTypedData, hasMatchingPermit: !!matchingPermit },
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
type SignedTypedData,
|
|
4
|
+
type TaskResult,
|
|
5
|
+
} from '@lifi/sdk'
|
|
6
|
+
import type { Address } from 'viem'
|
|
7
|
+
import { signTypedData } from 'viem/actions'
|
|
8
|
+
import { getAction } from 'viem/utils'
|
|
9
|
+
import { getNativePermit } from '../../permits/getNativePermit.js'
|
|
10
|
+
import { isNativePermitValid } from '../../permits/isNativePermitValid.js'
|
|
11
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
12
|
+
import { getActionWithFallback } from '../../utils/getActionWithFallback.js'
|
|
13
|
+
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
14
|
+
|
|
15
|
+
export class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
16
|
+
override async shouldRun(
|
|
17
|
+
context: EthereumStepExecutorContext
|
|
18
|
+
): Promise<boolean> {
|
|
19
|
+
const {
|
|
20
|
+
step,
|
|
21
|
+
fromChain,
|
|
22
|
+
hasMatchingPermit,
|
|
23
|
+
hasSufficientAllowance,
|
|
24
|
+
disableMessageSigning,
|
|
25
|
+
} = context
|
|
26
|
+
|
|
27
|
+
if (hasMatchingPermit || hasSufficientAllowance) {
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const executionStrategy = await getEthereumExecutionStrategy(context)
|
|
32
|
+
const batchingSupported = executionStrategy === 'batched'
|
|
33
|
+
// Check if proxy contract is available and message signing is not disabled, also not available for atomic batch
|
|
34
|
+
const isNativePermitAvailable =
|
|
35
|
+
!!fromChain.permit2Proxy &&
|
|
36
|
+
!batchingSupported &&
|
|
37
|
+
!disableMessageSigning &&
|
|
38
|
+
!step.estimate.skipPermit
|
|
39
|
+
return isNativePermitAvailable
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
43
|
+
const {
|
|
44
|
+
step,
|
|
45
|
+
client,
|
|
46
|
+
fromChain,
|
|
47
|
+
statusManager,
|
|
48
|
+
allowUserInteraction,
|
|
49
|
+
checkClient,
|
|
50
|
+
signedTypedData: currentSignedTypedData,
|
|
51
|
+
} = context
|
|
52
|
+
|
|
53
|
+
const action = statusManager.initializeAction({
|
|
54
|
+
step,
|
|
55
|
+
type: 'NATIVE_PERMIT',
|
|
56
|
+
chainId: step.action.fromChainId,
|
|
57
|
+
status: 'STARTED',
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const updatedClient = await checkClient(step)
|
|
61
|
+
if (!updatedClient) {
|
|
62
|
+
return { status: 'PAUSED' }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const fromAmount = BigInt(step.action.fromAmount)
|
|
66
|
+
|
|
67
|
+
const nativePermitData = await getActionWithFallback(
|
|
68
|
+
client,
|
|
69
|
+
updatedClient,
|
|
70
|
+
getNativePermit,
|
|
71
|
+
'getNativePermit',
|
|
72
|
+
{
|
|
73
|
+
client,
|
|
74
|
+
viemClient: updatedClient,
|
|
75
|
+
chainId: fromChain.id,
|
|
76
|
+
tokenAddress: step.action.fromToken.address as Address,
|
|
77
|
+
spenderAddress: fromChain.permit2Proxy as Address,
|
|
78
|
+
amount: fromAmount,
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if (!nativePermitData) {
|
|
83
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
84
|
+
return { status: 'COMPLETED' }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const signedTypedData = [...currentSignedTypedData]
|
|
88
|
+
|
|
89
|
+
// Check if we already have a valid permit for this chain and requirements
|
|
90
|
+
const signedTypedDataForChain = signedTypedData.find((signedTypedData) =>
|
|
91
|
+
isNativePermitValid(signedTypedData, nativePermitData)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if (!signedTypedDataForChain) {
|
|
95
|
+
statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')
|
|
96
|
+
|
|
97
|
+
if (!allowUserInteraction) {
|
|
98
|
+
return { status: 'PAUSED' }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Sign the permit
|
|
102
|
+
const signature = await getAction(
|
|
103
|
+
updatedClient,
|
|
104
|
+
signTypedData,
|
|
105
|
+
'signTypedData'
|
|
106
|
+
)({
|
|
107
|
+
account: updatedClient.account!,
|
|
108
|
+
domain: nativePermitData.domain,
|
|
109
|
+
types: nativePermitData.types,
|
|
110
|
+
primaryType: nativePermitData.primaryType,
|
|
111
|
+
message: nativePermitData.message,
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// Add the new permit to the signed permits array
|
|
115
|
+
const signedPermit: SignedTypedData = {
|
|
116
|
+
...nativePermitData,
|
|
117
|
+
signature,
|
|
118
|
+
}
|
|
119
|
+
signedTypedData.push(signedPermit)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
status: 'COMPLETED',
|
|
126
|
+
context: { signedTypedData, hasMatchingPermit: true },
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
LiFiErrorCode,
|
|
4
|
+
stepComparison,
|
|
5
|
+
type TaskResult,
|
|
6
|
+
TransactionError,
|
|
7
|
+
type TransactionParameters,
|
|
8
|
+
} from '@lifi/sdk'
|
|
9
|
+
import { getMaxPriorityFeePerGas } from '../../actions/getMaxPriorityFeePerGas.js'
|
|
10
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
11
|
+
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
12
|
+
import { getUpdatedStep } from './helpers/getUpdatedStep.js'
|
|
13
|
+
|
|
14
|
+
export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
15
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
16
|
+
const {
|
|
17
|
+
step,
|
|
18
|
+
client,
|
|
19
|
+
executionOptions,
|
|
20
|
+
statusManager,
|
|
21
|
+
allowUserInteraction,
|
|
22
|
+
checkClient,
|
|
23
|
+
isBridgeExecution,
|
|
24
|
+
signedTypedData,
|
|
25
|
+
ethereumClient,
|
|
26
|
+
} = context
|
|
27
|
+
|
|
28
|
+
const action = statusManager.findAction(
|
|
29
|
+
step,
|
|
30
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if (!action) {
|
|
34
|
+
throw new TransactionError(
|
|
35
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
36
|
+
'Unable to prepare transaction. Action not found.'
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Try to prepare a new transaction request and update the step with typed data
|
|
41
|
+
const updatedStep = await getUpdatedStep(
|
|
42
|
+
client,
|
|
43
|
+
step,
|
|
44
|
+
executionOptions,
|
|
45
|
+
signedTypedData
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
const comparedStep = await stepComparison(
|
|
49
|
+
statusManager,
|
|
50
|
+
step,
|
|
51
|
+
updatedStep,
|
|
52
|
+
allowUserInteraction,
|
|
53
|
+
executionOptions
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
Object.assign(step, {
|
|
57
|
+
...comparedStep,
|
|
58
|
+
execution: step.execution,
|
|
59
|
+
typedData: updatedStep.typedData ?? step.typedData,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
if (!step.transactionRequest && !step.typedData?.length) {
|
|
63
|
+
throw new TransactionError(
|
|
64
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
65
|
+
'Unable to prepare transaction. Transaction request is not found.'
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let transactionRequest: TransactionParameters | undefined
|
|
70
|
+
if (step.transactionRequest) {
|
|
71
|
+
// Only fetch maxPriorityFeePerGas for local accounts
|
|
72
|
+
let maxPriorityFeePerGas: bigint | undefined
|
|
73
|
+
if (ethereumClient.account?.type === 'local') {
|
|
74
|
+
const updatedClient = await checkClient(step)
|
|
75
|
+
if (!updatedClient) {
|
|
76
|
+
return { status: 'PAUSED' }
|
|
77
|
+
}
|
|
78
|
+
maxPriorityFeePerGas = await getMaxPriorityFeePerGas(
|
|
79
|
+
client,
|
|
80
|
+
updatedClient
|
|
81
|
+
)
|
|
82
|
+
} else {
|
|
83
|
+
maxPriorityFeePerGas = step.transactionRequest.maxPriorityFeePerGas
|
|
84
|
+
? BigInt(step.transactionRequest.maxPriorityFeePerGas)
|
|
85
|
+
: undefined
|
|
86
|
+
}
|
|
87
|
+
transactionRequest = {
|
|
88
|
+
chainId: step.transactionRequest.chainId,
|
|
89
|
+
to: step.transactionRequest.to,
|
|
90
|
+
from: step.transactionRequest.from,
|
|
91
|
+
data: step.transactionRequest.data,
|
|
92
|
+
value: step.transactionRequest.value
|
|
93
|
+
? BigInt(step.transactionRequest.value)
|
|
94
|
+
: undefined,
|
|
95
|
+
gas: step.transactionRequest.gasLimit
|
|
96
|
+
? BigInt(step.transactionRequest.gasLimit)
|
|
97
|
+
: undefined,
|
|
98
|
+
// gasPrice: step.transactionRequest.gasPrice
|
|
99
|
+
// ? BigInt(step.transactionRequest.gasPrice as string)
|
|
100
|
+
// : undefined,
|
|
101
|
+
// maxFeePerGas: step.transactionRequest.maxFeePerGas
|
|
102
|
+
// ? BigInt(step.transactionRequest.maxFeePerGas as string)
|
|
103
|
+
// : undefined,
|
|
104
|
+
maxPriorityFeePerGas,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (executionOptions?.updateTransactionRequestHook && transactionRequest) {
|
|
109
|
+
const customizedTransactionRequest: TransactionParameters =
|
|
110
|
+
await executionOptions.updateTransactionRequestHook({
|
|
111
|
+
requestType: 'transaction',
|
|
112
|
+
...transactionRequest,
|
|
113
|
+
})
|
|
114
|
+
transactionRequest = {
|
|
115
|
+
...transactionRequest,
|
|
116
|
+
...customizedTransactionRequest,
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Recompute execution strategy after PrepareTransaction mutates step
|
|
121
|
+
const executionStrategy = await getEthereumExecutionStrategy(context, true)
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
status: 'COMPLETED',
|
|
125
|
+
context: { transactionRequest, executionStrategy },
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
LiFiErrorCode,
|
|
4
|
+
relayTransaction,
|
|
5
|
+
type TaskResult,
|
|
6
|
+
TransactionError,
|
|
7
|
+
} from '@lifi/sdk'
|
|
8
|
+
import type { Hash } from 'viem'
|
|
9
|
+
import { signTypedData } from 'viem/actions'
|
|
10
|
+
import { getAction } from 'viem/utils'
|
|
11
|
+
import { isHyperliquidAgentStep } from '../../hyperliquid/isHyperliquidAgentStep.js'
|
|
12
|
+
import { isNativePermitValid } from '../../permits/isNativePermitValid.js'
|
|
13
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
14
|
+
import { getDomainChainId } from '../../utils/getDomainChainId.js'
|
|
15
|
+
import { signHyperliquidTypedData } from './helpers/signHyperliquidTypedData.js'
|
|
16
|
+
|
|
17
|
+
export class EthereumRelayedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
18
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
19
|
+
const {
|
|
20
|
+
step,
|
|
21
|
+
fromChain,
|
|
22
|
+
client,
|
|
23
|
+
statusManager,
|
|
24
|
+
allowUserInteraction,
|
|
25
|
+
checkClient,
|
|
26
|
+
isBridgeExecution,
|
|
27
|
+
signedTypedData: currentSignedTypedData,
|
|
28
|
+
} = context
|
|
29
|
+
|
|
30
|
+
const signedTypedData = [...currentSignedTypedData]
|
|
31
|
+
|
|
32
|
+
const action = statusManager.findAction(
|
|
33
|
+
step,
|
|
34
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if (!action) {
|
|
38
|
+
throw new TransactionError(
|
|
39
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
40
|
+
'Unable to prepare transaction. Action not found.'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const intentTypedData = step.typedData?.filter(
|
|
45
|
+
(typedData) =>
|
|
46
|
+
!signedTypedData.some((signedPermit) =>
|
|
47
|
+
isNativePermitValid(signedPermit, typedData)
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
if (!intentTypedData?.length) {
|
|
51
|
+
throw new TransactionError(
|
|
52
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
53
|
+
'Unable to prepare transaction. Typed data for transfer is not found.'
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
statusManager.updateAction(step, action.type, 'MESSAGE_REQUIRED')
|
|
58
|
+
|
|
59
|
+
if (isHyperliquidAgentStep(step)) {
|
|
60
|
+
const signedResults = await signHyperliquidTypedData(
|
|
61
|
+
context,
|
|
62
|
+
intentTypedData
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if (!signedResults) {
|
|
66
|
+
return { status: 'PAUSED' }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
signedTypedData.push(...signedResults)
|
|
70
|
+
} else {
|
|
71
|
+
for (const typedData of intentTypedData) {
|
|
72
|
+
if (!allowUserInteraction) {
|
|
73
|
+
return { status: 'PAUSED' }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const typedDataChainId =
|
|
77
|
+
getDomainChainId(typedData.domain) || fromChain.id
|
|
78
|
+
|
|
79
|
+
// Switch to the typed data's chain if needed
|
|
80
|
+
const updatedClient = await checkClient(step, typedDataChainId)
|
|
81
|
+
if (!updatedClient) {
|
|
82
|
+
return { status: 'PAUSED' }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const signature = await getAction(
|
|
86
|
+
updatedClient,
|
|
87
|
+
signTypedData,
|
|
88
|
+
'signTypedData'
|
|
89
|
+
)({
|
|
90
|
+
account: updatedClient.account!,
|
|
91
|
+
primaryType: typedData.primaryType,
|
|
92
|
+
domain: typedData.domain,
|
|
93
|
+
types: typedData.types,
|
|
94
|
+
message: typedData.message,
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
signedTypedData.push({
|
|
98
|
+
...typedData,
|
|
99
|
+
signature: signature,
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
statusManager.updateAction(step, action.type, 'PENDING')
|
|
105
|
+
|
|
106
|
+
const { execution, ...stepBase } = step
|
|
107
|
+
const relayedTransaction = await relayTransaction(client, {
|
|
108
|
+
...stepBase,
|
|
109
|
+
typedData: signedTypedData,
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
113
|
+
taskId: relayedTransaction.taskId as Hash,
|
|
114
|
+
txType: 'relayed',
|
|
115
|
+
txLink: relayedTransaction.txLink,
|
|
116
|
+
signedAt: Date.now(),
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
return { status: 'COMPLETED', context: { signedTypedData } }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseStepExecutionTask,
|
|
3
|
+
LiFiErrorCode,
|
|
4
|
+
type TaskResult,
|
|
5
|
+
TransactionError,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import type { Hash } from 'viem'
|
|
8
|
+
import { waitForRelayedTransactionReceipt } from '../../actions/waitForRelayedTransactionReceipt.js'
|
|
9
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
10
|
+
import { updateActionWithReceipt } from './helpers/updateActionWithReceipt.js'
|
|
11
|
+
|
|
12
|
+
export class EthereumRelayedWaitForTransactionTask extends BaseStepExecutionTask {
|
|
13
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
14
|
+
const { client, step, statusManager, fromChain, isBridgeExecution } =
|
|
15
|
+
context
|
|
16
|
+
|
|
17
|
+
const action = statusManager.findAction(
|
|
18
|
+
step,
|
|
19
|
+
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
20
|
+
)
|
|
21
|
+
if (!action) {
|
|
22
|
+
throw new TransactionError(
|
|
23
|
+
LiFiErrorCode.TransactionUnprepared,
|
|
24
|
+
'Unable to prepare transaction. Action not found.'
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const transactionReceipt = await waitForRelayedTransactionReceipt(
|
|
29
|
+
client,
|
|
30
|
+
action.taskId as Hash,
|
|
31
|
+
step
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
updateActionWithReceipt(
|
|
35
|
+
statusManager,
|
|
36
|
+
step,
|
|
37
|
+
fromChain,
|
|
38
|
+
transactionReceipt,
|
|
39
|
+
action
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if (isBridgeExecution) {
|
|
43
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return { status: 'COMPLETED' }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
2
|
+
import type { Address } from 'viem'
|
|
3
|
+
import { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'
|
|
4
|
+
import { setAllowance } from '../../actions/setAllowance.js'
|
|
5
|
+
import { waitForTransactionReceipt } from '../../actions/waitForTransactionReceipt.js'
|
|
6
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
7
|
+
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
8
|
+
import { getTxLink } from './helpers/getTxLink.js'
|
|
9
|
+
import { isPermit2Supported } from './helpers/isPermit2Supported.js'
|
|
10
|
+
|
|
11
|
+
export class EthereumResetAllowanceTask extends BaseStepExecutionTask {
|
|
12
|
+
override async shouldRun(
|
|
13
|
+
context: EthereumStepExecutorContext
|
|
14
|
+
): Promise<boolean> {
|
|
15
|
+
const { step, hasMatchingPermit, hasSufficientAllowance, hasAllowance } =
|
|
16
|
+
context
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
!hasMatchingPermit &&
|
|
20
|
+
!hasSufficientAllowance &&
|
|
21
|
+
!!step.estimate.approvalReset &&
|
|
22
|
+
!!hasAllowance
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
27
|
+
const {
|
|
28
|
+
step,
|
|
29
|
+
statusManager,
|
|
30
|
+
allowUserInteraction,
|
|
31
|
+
checkClient,
|
|
32
|
+
fromChain,
|
|
33
|
+
isFromNativeToken,
|
|
34
|
+
executionOptions,
|
|
35
|
+
client,
|
|
36
|
+
calls: currentCalls,
|
|
37
|
+
disableMessageSigning,
|
|
38
|
+
} = context
|
|
39
|
+
|
|
40
|
+
const action = statusManager.initializeAction({
|
|
41
|
+
step,
|
|
42
|
+
type: 'RESET_ALLOWANCE',
|
|
43
|
+
chainId: step.action.fromChainId,
|
|
44
|
+
status: 'STARTED',
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
statusManager.updateAction(step, action.type, 'RESET_REQUIRED', {
|
|
48
|
+
txHash: undefined,
|
|
49
|
+
txLink: undefined,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
if (!allowUserInteraction) {
|
|
53
|
+
return { status: 'PAUSED' }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const executionStrategy = await getEthereumExecutionStrategy(context)
|
|
57
|
+
const batchingSupported = executionStrategy === 'batched'
|
|
58
|
+
const permit2Supported = isPermit2Supported(
|
|
59
|
+
step,
|
|
60
|
+
fromChain,
|
|
61
|
+
isFromNativeToken,
|
|
62
|
+
disableMessageSigning,
|
|
63
|
+
executionStrategy
|
|
64
|
+
)
|
|
65
|
+
const spenderAddress = permit2Supported
|
|
66
|
+
? fromChain.permit2
|
|
67
|
+
: step.estimate.approvalAddress
|
|
68
|
+
|
|
69
|
+
const updatedClient = await checkClient(step)
|
|
70
|
+
if (!updatedClient) {
|
|
71
|
+
return { status: 'PAUSED' }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Reset allowance to 0 if required
|
|
75
|
+
const resetResult = await setAllowance(
|
|
76
|
+
client,
|
|
77
|
+
updatedClient,
|
|
78
|
+
step.action.fromToken.address as Address,
|
|
79
|
+
spenderAddress as Address,
|
|
80
|
+
0n,
|
|
81
|
+
executionOptions,
|
|
82
|
+
batchingSupported
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const calls = [...currentCalls]
|
|
86
|
+
if (batchingSupported) {
|
|
87
|
+
calls.push({
|
|
88
|
+
to: step.action.fromToken.address as Address,
|
|
89
|
+
data: resetResult,
|
|
90
|
+
chainId: step.action.fromToken.chainId,
|
|
91
|
+
})
|
|
92
|
+
} else {
|
|
93
|
+
const resolvedTxHash = await resolveTransactionHash(
|
|
94
|
+
client,
|
|
95
|
+
updatedClient,
|
|
96
|
+
resetResult,
|
|
97
|
+
fromChain.id
|
|
98
|
+
)
|
|
99
|
+
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
100
|
+
txHash: resolvedTxHash,
|
|
101
|
+
txLink: getTxLink(fromChain, resolvedTxHash),
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const transactionReceipt = await waitForTransactionReceipt(client, {
|
|
105
|
+
client: updatedClient,
|
|
106
|
+
chainId: fromChain.id,
|
|
107
|
+
txHash: resetResult as Address,
|
|
108
|
+
onReplaced(response) {
|
|
109
|
+
const newHash = response.transaction.hash
|
|
110
|
+
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
111
|
+
txHash: newHash,
|
|
112
|
+
txLink: getTxLink(fromChain, newHash),
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const finalHash = transactionReceipt?.transactionHash || resolvedTxHash
|
|
118
|
+
statusManager.updateAction(step, action.type, 'PENDING', {
|
|
119
|
+
txHash: finalHash,
|
|
120
|
+
txLink: getTxLink(fromChain, finalHash),
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
status: 'COMPLETED',
|
|
128
|
+
context: { calls, executionStrategy },
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|