@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,8 @@
|
|
|
1
|
+
import { SDKClient, TransactionParameters } from "@lifi/sdk";
|
|
2
|
+
import { Client } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/helpers/estimateTransactionRequest.d.ts
|
|
5
|
+
declare const estimateTransactionRequest: (client: SDKClient, viemClient: Client, transactionRequest: TransactionParameters) => Promise<TransactionParameters>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { estimateTransactionRequest };
|
|
8
|
+
//# sourceMappingURL=estimateTransactionRequest.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_getActionWithFallback = require("../../../utils/getActionWithFallback.js");
|
|
3
|
+
let viem_actions = require("viem/actions");
|
|
4
|
+
//#region src/core/tasks/helpers/estimateTransactionRequest.ts
|
|
5
|
+
const GAS_ESTIMATION_BUFFER = 300000n;
|
|
6
|
+
const estimateTransactionRequest = async (client, viemClient, transactionRequest) => {
|
|
7
|
+
try {
|
|
8
|
+
const estimatedGas = await require_utils_getActionWithFallback.getActionWithFallback(client, viemClient, viem_actions.estimateGas, "estimateGas", {
|
|
9
|
+
account: viemClient.account,
|
|
10
|
+
to: transactionRequest.to,
|
|
11
|
+
data: transactionRequest.data,
|
|
12
|
+
value: transactionRequest.value
|
|
13
|
+
});
|
|
14
|
+
transactionRequest.gas = (transactionRequest.gas && transactionRequest.gas > estimatedGas ? transactionRequest.gas : estimatedGas) + GAS_ESTIMATION_BUFFER;
|
|
15
|
+
} catch (_) {
|
|
16
|
+
if (transactionRequest.gas) transactionRequest.gas = transactionRequest.gas + GAS_ESTIMATION_BUFFER;
|
|
17
|
+
}
|
|
18
|
+
return transactionRequest;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.estimateTransactionRequest = estimateTransactionRequest;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=estimateTransactionRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateTransactionRequest.js","names":["getActionWithFallback","estimateGas"],"sources":["../../../../../src/core/tasks/helpers/estimateTransactionRequest.ts"],"sourcesContent":["import type { SDKClient, TransactionParameters } from '@lifi/sdk'\nimport type { Address, Client, Hex } from 'viem'\nimport { estimateGas } from 'viem/actions'\nimport { getActionWithFallback } from '../../../utils/getActionWithFallback.js'\n\nconst GAS_ESTIMATION_BUFFER = 300_000n\n\nexport const estimateTransactionRequest = async (\n client: SDKClient,\n viemClient: Client,\n transactionRequest: TransactionParameters\n): Promise<TransactionParameters> => {\n try {\n // Try to re-estimate the gas due to additional Permit data\n const estimatedGas = await getActionWithFallback(\n client,\n viemClient,\n estimateGas,\n 'estimateGas',\n {\n account: viemClient.account!,\n to: transactionRequest.to as Address,\n data: transactionRequest.data as Hex,\n value: transactionRequest.value,\n }\n )\n // Use the higher of estimated vs original, then add buffer\n const baseGas =\n transactionRequest.gas && transactionRequest.gas > estimatedGas\n ? transactionRequest.gas\n : estimatedGas\n\n transactionRequest.gas = baseGas + GAS_ESTIMATION_BUFFER\n } catch (_) {\n // If estimation fails, add buffer to existing gas limit\n if (transactionRequest.gas) {\n transactionRequest.gas = transactionRequest.gas + GAS_ESTIMATION_BUFFER\n }\n }\n\n return transactionRequest\n}\n"],"mappings":";;;;AAKA,MAAM,wBAAwB;AAE9B,MAAa,6BAA6B,OACxC,QACA,YACA,uBACmC;CACnC,IAAI;EAEF,MAAM,eAAe,MAAMA,oCAAAA,sBACzB,QACA,YACAC,aAAAA,aACA,eACA;GACE,SAAS,WAAW;GACpB,IAAI,mBAAmB;GACvB,MAAM,mBAAmB;GACzB,OAAO,mBAAmB;EAC5B,CACF;EAOA,mBAAmB,OAJjB,mBAAmB,OAAO,mBAAmB,MAAM,eAC/C,mBAAmB,MACnB,gBAE6B;CACrC,SAAS,GAAG;EAEV,IAAI,mBAAmB,KACrB,mBAAmB,MAAM,mBAAmB,MAAM;CAEtD;CAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
|
+
import { TransactionMethodType } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/helpers/getEthereumExecutionStrategy.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Determines the execution strategy: 'relayed', 'batched', or 'standard'.
|
|
7
|
+
* Falls back to 'standard' when EIP-5792 batching is unavailable,
|
|
8
|
+
* the wallet rejected the 7702 upgrade, or the tool doesn't support it.
|
|
9
|
+
*/
|
|
10
|
+
declare function getEthereumExecutionStrategy(context: EthereumStepExecutorContext, forceRecalculate?: boolean): Promise<TransactionMethodType>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getEthereumExecutionStrategy };
|
|
13
|
+
//# sourceMappingURL=getEthereumExecutionStrategy.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_actions_isBatchingSupported = require("../../../actions/isBatchingSupported.js");
|
|
3
|
+
const require_utils_isRelayerStep = require("../../../utils/isRelayerStep.js");
|
|
4
|
+
//#region src/core/tasks/helpers/getEthereumExecutionStrategy.ts
|
|
5
|
+
/**
|
|
6
|
+
* Determines the execution strategy: 'relayed', 'batched', or 'standard'.
|
|
7
|
+
* Falls back to 'standard' when EIP-5792 batching is unavailable,
|
|
8
|
+
* the wallet rejected the 7702 upgrade, or the tool doesn't support it.
|
|
9
|
+
*/
|
|
10
|
+
async function getEthereumExecutionStrategy(context, forceRecalculate = false) {
|
|
11
|
+
const { step, checkClient, retryParams, client, fromChain, ethereumClient, executionStrategy: executionStrategyContext } = context;
|
|
12
|
+
if (!forceRecalculate && executionStrategyContext) return executionStrategyContext;
|
|
13
|
+
const atomicityNotReady = !!retryParams?.atomicityNotReady;
|
|
14
|
+
if (require_utils_isRelayerStep.isRelayerStep(step)) return "relayed";
|
|
15
|
+
if (atomicityNotReady || step.tool === "thorswap") return "standard";
|
|
16
|
+
return await require_actions_isBatchingSupported.isBatchingSupported(client, {
|
|
17
|
+
client: await checkClient(step) ?? ethereumClient,
|
|
18
|
+
chainId: fromChain.id
|
|
19
|
+
}) ? "batched" : "standard";
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.getEthereumExecutionStrategy = getEthereumExecutionStrategy;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=getEthereumExecutionStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEthereumExecutionStrategy.js","names":["isRelayerStep","isBatchingSupported"],"sources":["../../../../../src/core/tasks/helpers/getEthereumExecutionStrategy.ts"],"sourcesContent":["import type { TransactionMethodType } from '@lifi/sdk'\nimport { isBatchingSupported } from '../../../actions/isBatchingSupported.js'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\nimport { isRelayerStep } from '../../../utils/isRelayerStep.js'\n\n/**\n * Determines the execution strategy: 'relayed', 'batched', or 'standard'.\n * Falls back to 'standard' when EIP-5792 batching is unavailable,\n * the wallet rejected the 7702 upgrade, or the tool doesn't support it.\n */\nexport async function getEthereumExecutionStrategy(\n context: EthereumStepExecutorContext,\n forceRecalculate: boolean = false\n): Promise<TransactionMethodType> {\n const {\n step,\n checkClient,\n retryParams,\n client,\n fromChain,\n ethereumClient,\n executionStrategy: executionStrategyContext,\n } = context\n\n if (!forceRecalculate && executionStrategyContext) {\n return executionStrategyContext\n }\n\n const atomicityNotReady = !!retryParams?.atomicityNotReady\n const isRelayer = isRelayerStep(step)\n if (isRelayer) {\n return 'relayed'\n }\n\n if (atomicityNotReady || step.tool === 'thorswap') {\n return 'standard'\n }\n\n const updatedClient = (await checkClient(step)) ?? ethereumClient\n const batchingSupported = await isBatchingSupported(client, {\n client: updatedClient,\n chainId: fromChain.id,\n })\n return batchingSupported ? 'batched' : 'standard'\n}\n"],"mappings":";;;;;;;;;AAUA,eAAsB,6BACpB,SACA,mBAA4B,OACI;CAChC,MAAM,EACJ,MACA,aACA,aACA,QACA,WACA,gBACA,mBAAmB,6BACjB;CAEJ,IAAI,CAAC,oBAAoB,0BACvB,OAAO;CAGT,MAAM,oBAAoB,CAAC,CAAC,aAAa;CAEzC,IADkBA,4BAAAA,cAAc,IACpB,GACV,OAAO;CAGT,IAAI,qBAAqB,KAAK,SAAS,YACrC,OAAO;CAQT,OAAO,MAJyBC,oCAAAA,oBAAoB,QAAQ;EAC1D,QAFqB,MAAM,YAAY,IAAI,KAAM;EAGjD,SAAS,UAAU;CACrB,CAAC,IAC0B,YAAY;AACzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExtendedChain } from "@lifi/sdk";
|
|
2
|
+
import { Hash } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/helpers/getTxLink.d.ts
|
|
5
|
+
declare const getTxLink: (chain: ExtendedChain, txHash: Hash) => string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getTxLink };
|
|
8
|
+
//# sourceMappingURL=getTxLink.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/tasks/helpers/getTxLink.ts
|
|
3
|
+
const getTxLink = (chain, txHash) => {
|
|
4
|
+
return `${chain.metamask.blockExplorerUrls[0]}tx/${txHash}`;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.getTxLink = getTxLink;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=getTxLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTxLink.js","names":[],"sources":["../../../../../src/core/tasks/helpers/getTxLink.ts"],"sourcesContent":["import type { ExtendedChain } from '@lifi/sdk'\nimport type { Hash } from 'viem'\n\nexport const getTxLink = (chain: ExtendedChain, txHash: Hash) => {\n return `${chain.metamask.blockExplorerUrls[0]}tx/${txHash}`\n}\n"],"mappings":";;AAGA,MAAa,aAAa,OAAsB,WAAiB;CAC/D,OAAO,GAAG,MAAM,SAAS,kBAAkB,GAAG,KAAK;AACrD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExecutionOptions, LiFiStepExtended, SDKClient, SignedTypedData } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/core/tasks/helpers/getUpdatedStep.d.ts
|
|
4
|
+
declare const getUpdatedStep: (client: SDKClient, step: LiFiStepExtended, executionOptions?: ExecutionOptions, signedTypedData?: SignedTypedData[]) => Promise<LiFiStepExtended>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getUpdatedStep };
|
|
7
|
+
//# sourceMappingURL=getUpdatedStep.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_isRelayerStep = require("../../../utils/isRelayerStep.js");
|
|
3
|
+
const require_permits_constants = require("../../../permits/constants.js");
|
|
4
|
+
const require_utils_isContractCallStep = require("../../../utils/isContractCallStep.js");
|
|
5
|
+
const require_utils_isGaslessStep = require("../../../utils/isGaslessStep.js");
|
|
6
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
7
|
+
//#region src/core/tasks/helpers/getUpdatedStep.ts
|
|
8
|
+
const getUpdatedStep = async (client, step, executionOptions, signedTypedData) => {
|
|
9
|
+
if (require_utils_isContractCallStep.isContractCallStep(step)) return getContractCallUpdatedStep(client, step, executionOptions);
|
|
10
|
+
if (require_utils_isRelayerStep.isRelayerStep(step) && require_utils_isGaslessStep.isGaslessStep(step)) return getRelayerUpdatedStep(client, step);
|
|
11
|
+
return getStandardUpdatedStep(client, step, signedTypedData);
|
|
12
|
+
};
|
|
13
|
+
const getContractCallUpdatedStep = async (client, step, executionOptions) => {
|
|
14
|
+
const contractCallsResult = await executionOptions?.getContractCalls?.({
|
|
15
|
+
fromAddress: step.action.fromAddress,
|
|
16
|
+
fromAmount: BigInt(step.action.fromAmount),
|
|
17
|
+
fromChainId: step.action.fromChainId,
|
|
18
|
+
fromTokenAddress: step.action.fromToken.address,
|
|
19
|
+
slippage: step.action.slippage,
|
|
20
|
+
toAddress: step.action.toAddress,
|
|
21
|
+
toAmount: BigInt(step.estimate.toAmount),
|
|
22
|
+
toChainId: step.action.toChainId,
|
|
23
|
+
toTokenAddress: step.action.toToken.address
|
|
24
|
+
});
|
|
25
|
+
if (!contractCallsResult?.contractCalls?.length) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. Contract calls are not found.");
|
|
26
|
+
if (contractCallsResult.patcher) {
|
|
27
|
+
const patchedContractCalls = await (0, _lifi_sdk.patchContractCalls)(client, contractCallsResult.contractCalls.map((call) => ({
|
|
28
|
+
chainId: step.action.toChainId,
|
|
29
|
+
fromTokenAddress: call.fromTokenAddress,
|
|
30
|
+
targetContractAddress: call.toContractAddress,
|
|
31
|
+
callDataToPatch: call.toContractCallData,
|
|
32
|
+
delegateCall: false,
|
|
33
|
+
patches: [{ amountToReplace: require_permits_constants.PatcherMagicNumber.toString() }]
|
|
34
|
+
})));
|
|
35
|
+
contractCallsResult.contractCalls.forEach((call, index) => {
|
|
36
|
+
call.toContractAddress = patchedContractCalls[index].target;
|
|
37
|
+
call.toContractCallData = patchedContractCalls[index].callData;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Limitations of the retry logic for contract calls:
|
|
42
|
+
* - denyBridges and denyExchanges are not supported
|
|
43
|
+
* - allowBridges and allowExchanges are not supported
|
|
44
|
+
* - fee is not supported
|
|
45
|
+
* - toAmount is not supported
|
|
46
|
+
*/
|
|
47
|
+
const contractCallQuote = await (0, _lifi_sdk.getContractCallsQuote)(client, {
|
|
48
|
+
fromAddress: step.action.fromAddress,
|
|
49
|
+
fromChain: step.action.fromChainId,
|
|
50
|
+
fromToken: step.action.fromToken.address,
|
|
51
|
+
fromAmount: step.action.fromAmount,
|
|
52
|
+
toChain: step.action.toChainId,
|
|
53
|
+
toToken: step.action.toToken.address,
|
|
54
|
+
contractCalls: contractCallsResult.contractCalls,
|
|
55
|
+
toFallbackAddress: step.action.toAddress,
|
|
56
|
+
slippage: step.action.slippage
|
|
57
|
+
});
|
|
58
|
+
contractCallQuote.action.toToken = step.action.toToken;
|
|
59
|
+
const customStep = contractCallQuote.includedSteps?.find((s) => s.type === "custom");
|
|
60
|
+
if (customStep && contractCallsResult?.contractTool) {
|
|
61
|
+
const toolDetails = {
|
|
62
|
+
key: contractCallsResult.contractTool.name,
|
|
63
|
+
name: contractCallsResult.contractTool.name,
|
|
64
|
+
logoURI: contractCallsResult.contractTool.logoURI
|
|
65
|
+
};
|
|
66
|
+
customStep.toolDetails = toolDetails;
|
|
67
|
+
contractCallQuote.toolDetails = toolDetails;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...(0, _lifi_sdk.convertQuoteToRoute)(contractCallQuote, { adjustZeroOutputFromPreviousStep: executionOptions?.adjustZeroOutputFromPreviousStep }).steps[0],
|
|
71
|
+
id: step.id
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const getRelayerUpdatedStep = async (client, step) => {
|
|
75
|
+
return {
|
|
76
|
+
...await (0, _lifi_sdk.getRelayerQuote)(client, {
|
|
77
|
+
fromChain: step.action.fromChainId,
|
|
78
|
+
fromToken: step.action.fromToken.address,
|
|
79
|
+
fromAddress: step.action.fromAddress,
|
|
80
|
+
fromAmount: step.action.fromAmount,
|
|
81
|
+
toChain: step.action.toChainId,
|
|
82
|
+
toToken: step.action.toToken.address,
|
|
83
|
+
slippage: step.action.slippage,
|
|
84
|
+
toAddress: step.action.toAddress,
|
|
85
|
+
allowBridges: [step.tool]
|
|
86
|
+
}),
|
|
87
|
+
id: step.id
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
const getStandardUpdatedStep = async (client, step, signedTypedData) => {
|
|
91
|
+
const filteredSignedTypedData = signedTypedData?.filter((item) => item.signature);
|
|
92
|
+
const { typedData: _, ...restStep } = step;
|
|
93
|
+
return (0, _lifi_sdk.getStepTransaction)(client, filteredSignedTypedData?.length ? {
|
|
94
|
+
...restStep,
|
|
95
|
+
typedData: filteredSignedTypedData
|
|
96
|
+
} : restStep);
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
exports.getUpdatedStep = getUpdatedStep;
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=getUpdatedStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUpdatedStep.js","names":["isContractCallStep","isRelayerStep","isGaslessStep","TransactionError","LiFiErrorCode","PatcherMagicNumber"],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"sourcesContent":["import {\n convertQuoteToRoute,\n type ExecutionOptions,\n getContractCallsQuote,\n getRelayerQuote,\n getStepTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n patchContractCalls,\n type SDKClient,\n type SignedTypedData,\n TransactionError,\n} from '@lifi/sdk'\nimport { PatcherMagicNumber } from '../../../permits/constants.js'\nimport { isContractCallStep } from '../../../utils/isContractCallStep.js'\nimport { isGaslessStep } from '../../../utils/isGaslessStep.js'\nimport { isRelayerStep } from '../../../utils/isRelayerStep.js'\n\nexport const getUpdatedStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n executionOptions?: ExecutionOptions,\n signedTypedData?: SignedTypedData[]\n): Promise<LiFiStepExtended> => {\n if (isContractCallStep(step)) {\n return getContractCallUpdatedStep(client, step, executionOptions)\n }\n if (isRelayerStep(step) && isGaslessStep(step)) {\n return getRelayerUpdatedStep(client, step)\n }\n return getStandardUpdatedStep(client, step, signedTypedData)\n}\n\nconst getContractCallUpdatedStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n executionOptions?: ExecutionOptions\n): Promise<LiFiStepExtended> => {\n const contractCallsResult = await executionOptions?.getContractCalls?.({\n fromAddress: step.action.fromAddress!,\n fromAmount: BigInt(step.action.fromAmount),\n fromChainId: step.action.fromChainId,\n fromTokenAddress: step.action.fromToken.address,\n slippage: step.action.slippage,\n toAddress: step.action.toAddress,\n toAmount: BigInt(step.estimate.toAmount),\n toChainId: step.action.toChainId,\n toTokenAddress: step.action.toToken.address,\n })\n\n if (!contractCallsResult?.contractCalls?.length) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Contract calls are not found.'\n )\n }\n\n if (contractCallsResult.patcher) {\n const patchedContractCalls = await patchContractCalls(\n client,\n contractCallsResult.contractCalls.map((call) => ({\n chainId: step.action.toChainId,\n fromTokenAddress: call.fromTokenAddress,\n targetContractAddress: call.toContractAddress,\n callDataToPatch: call.toContractCallData,\n delegateCall: false,\n patches: [\n {\n amountToReplace: PatcherMagicNumber.toString(),\n },\n ],\n }))\n )\n\n contractCallsResult.contractCalls.forEach((call, index) => {\n call.toContractAddress = patchedContractCalls[index].target\n call.toContractCallData = patchedContractCalls[index].callData\n })\n }\n\n /**\n * Limitations of the retry logic for contract calls:\n * - denyBridges and denyExchanges are not supported\n * - allowBridges and allowExchanges are not supported\n * - fee is not supported\n * - toAmount is not supported\n */\n const contractCallQuote = await getContractCallsQuote(client, {\n fromAddress: step.action.fromAddress!,\n fromChain: step.action.fromChainId,\n fromToken: step.action.fromToken.address,\n fromAmount: step.action.fromAmount,\n toChain: step.action.toChainId,\n toToken: step.action.toToken.address,\n contractCalls: contractCallsResult.contractCalls,\n toFallbackAddress: step.action.toAddress,\n slippage: step.action.slippage,\n })\n\n contractCallQuote.action.toToken = step.action.toToken\n\n const customStep = contractCallQuote.includedSteps?.find(\n (s) => s.type === 'custom'\n )\n if (customStep && contractCallsResult?.contractTool) {\n const toolDetails = {\n key: contractCallsResult.contractTool.name,\n name: contractCallsResult.contractTool.name,\n logoURI: contractCallsResult.contractTool.logoURI,\n }\n customStep.toolDetails = toolDetails\n contractCallQuote.toolDetails = toolDetails\n }\n\n const route = convertQuoteToRoute(contractCallQuote, {\n adjustZeroOutputFromPreviousStep:\n executionOptions?.adjustZeroOutputFromPreviousStep,\n })\n\n return {\n ...route.steps[0],\n id: step.id,\n }\n}\n\nconst getRelayerUpdatedStep = async (\n client: SDKClient,\n step: LiFiStepExtended\n): Promise<LiFiStepExtended> => {\n const updatedRelayedStep = await getRelayerQuote(client, {\n fromChain: step.action.fromChainId,\n fromToken: step.action.fromToken.address,\n fromAddress: step.action.fromAddress!,\n fromAmount: step.action.fromAmount,\n toChain: step.action.toChainId,\n toToken: step.action.toToken.address,\n slippage: step.action.slippage,\n toAddress: step.action.toAddress,\n allowBridges: [step.tool],\n })\n return {\n ...updatedRelayedStep,\n id: step.id,\n }\n}\n\nconst getStandardUpdatedStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n signedTypedData?: SignedTypedData[]\n): Promise<LiFiStepExtended> => {\n const filteredSignedTypedData = signedTypedData?.filter(\n (item) => item.signature\n )\n const { typedData: _, ...restStep } = step\n const params = filteredSignedTypedData?.length\n ? { ...restStep, typedData: filteredSignedTypedData }\n : restStep\n return getStepTransaction(client, params)\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,iBAAiB,OAC5B,QACA,MACA,kBACA,oBAC8B;CAC9B,IAAIA,iCAAAA,mBAAmB,IAAI,GACzB,OAAO,2BAA2B,QAAQ,MAAM,gBAAgB;CAElE,IAAIC,4BAAAA,cAAc,IAAI,KAAKC,4BAAAA,cAAc,IAAI,GAC3C,OAAO,sBAAsB,QAAQ,IAAI;CAE3C,OAAO,uBAAuB,QAAQ,MAAM,eAAe;AAC7D;AAEA,MAAM,6BAA6B,OACjC,QACA,MACA,qBAC8B;CAC9B,MAAM,sBAAsB,MAAM,kBAAkB,mBAAmB;EACrE,aAAa,KAAK,OAAO;EACzB,YAAY,OAAO,KAAK,OAAO,UAAU;EACzC,aAAa,KAAK,OAAO;EACzB,kBAAkB,KAAK,OAAO,UAAU;EACxC,UAAU,KAAK,OAAO;EACtB,WAAW,KAAK,OAAO;EACvB,UAAU,OAAO,KAAK,SAAS,QAAQ;EACvC,WAAW,KAAK,OAAO;EACvB,gBAAgB,KAAK,OAAO,QAAQ;CACtC,CAAC;CAED,IAAI,CAAC,qBAAqB,eAAe,QACvC,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,uBACd,8DACF;CAGF,IAAI,oBAAoB,SAAS;EAC/B,MAAM,uBAAuB,OAAA,GAAA,UAAA,mBAAA,CAC3B,QACA,oBAAoB,cAAc,KAAK,UAAU;GAC/C,SAAS,KAAK,OAAO;GACrB,kBAAkB,KAAK;GACvB,uBAAuB,KAAK;GAC5B,iBAAiB,KAAK;GACtB,cAAc;GACd,SAAS,CACP,EACE,iBAAiBC,0BAAAA,mBAAmB,SAAS,EAC/C,CACF;EACF,EAAE,CACJ;EAEA,oBAAoB,cAAc,SAAS,MAAM,UAAU;GACzD,KAAK,oBAAoB,qBAAqB,MAAM,CAAC;GACrD,KAAK,qBAAqB,qBAAqB,MAAM,CAAC;EACxD,CAAC;CACH;;;;;;;;CASA,MAAM,oBAAoB,OAAA,GAAA,UAAA,sBAAA,CAA4B,QAAQ;EAC5D,aAAa,KAAK,OAAO;EACzB,WAAW,KAAK,OAAO;EACvB,WAAW,KAAK,OAAO,UAAU;EACjC,YAAY,KAAK,OAAO;EACxB,SAAS,KAAK,OAAO;EACrB,SAAS,KAAK,OAAO,QAAQ;EAC7B,eAAe,oBAAoB;EACnC,mBAAmB,KAAK,OAAO;EAC/B,UAAU,KAAK,OAAO;CACxB,CAAC;CAED,kBAAkB,OAAO,UAAU,KAAK,OAAO;CAE/C,MAAM,aAAa,kBAAkB,eAAe,MACjD,MAAM,EAAE,SAAS,QACpB;CACA,IAAI,cAAc,qBAAqB,cAAc;EACnD,MAAM,cAAc;GAClB,KAAK,oBAAoB,aAAa;GACtC,MAAM,oBAAoB,aAAa;GACvC,SAAS,oBAAoB,aAAa;EAC5C;EACA,WAAW,cAAc;EACzB,kBAAkB,cAAc;CAClC;CAOA,OAAO;EACL,IAAA,GAAA,UAAA,oBAAA,CANgC,mBAAmB,EACnD,kCACE,kBAAkB,iCACtB,CAGS,CAAC,CAAC,MAAM;EACf,IAAI,KAAK;CACX;AACF;AAEA,MAAM,wBAAwB,OAC5B,QACA,SAC8B;CAY9B,OAAO;EACL,GAAG,OAAA,GAAA,UAAA,gBAAA,CAZ4C,QAAQ;GACvD,WAAW,KAAK,OAAO;GACvB,WAAW,KAAK,OAAO,UAAU;GACjC,aAAa,KAAK,OAAO;GACzB,YAAY,KAAK,OAAO;GACxB,SAAS,KAAK,OAAO;GACrB,SAAS,KAAK,OAAO,QAAQ;GAC7B,UAAU,KAAK,OAAO;GACtB,WAAW,KAAK,OAAO;GACvB,cAAc,CAAC,KAAK,IAAI;EAC1B,CAAC;EAGC,IAAI,KAAK;CACX;AACF;AAEA,MAAM,yBAAyB,OAC7B,QACA,MACA,oBAC8B;CAC9B,MAAM,0BAA0B,iBAAiB,QAC9C,SAAS,KAAK,SACjB;CACA,MAAM,EAAE,WAAW,GAAG,GAAG,aAAa;CAItC,QAAA,GAAA,UAAA,mBAAA,CAA0B,QAHX,yBAAyB,SACpC;EAAE,GAAG;EAAU,WAAW;CAAwB,IAClD,QACoC;AAC1C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExtendedChain, LiFiStepExtended, TransactionMethodType } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/core/tasks/helpers/isPermit2Supported.d.ts
|
|
4
|
+
declare const isPermit2Supported: (step: LiFiStepExtended, fromChain: ExtendedChain, isFromNativeToken: boolean, disableMessageSigning: boolean, strategy: TransactionMethodType) => boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { isPermit2Supported };
|
|
7
|
+
//# sourceMappingURL=isPermit2Supported.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/tasks/helpers/isPermit2Supported.ts
|
|
3
|
+
const isPermit2Supported = (step, fromChain, isFromNativeToken, disableMessageSigning, strategy) => {
|
|
4
|
+
return !!fromChain.permit2 && !!fromChain.permit2Proxy && !isFromNativeToken && !disableMessageSigning && strategy !== "batched" && !!step.estimate.approvalAddress && !step.estimate.skipApproval && !step.estimate.skipPermit;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.isPermit2Supported = isPermit2Supported;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=isPermit2Supported.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPermit2Supported.js","names":[],"sources":["../../../../../src/core/tasks/helpers/isPermit2Supported.ts"],"sourcesContent":["import type {\n ExtendedChain,\n LiFiStepExtended,\n TransactionMethodType,\n} from '@lifi/sdk'\n\n/* Check if chain has Permit2 contract deployed.\n * Permit2 should not be available for atomic batch.\n */\nexport const isPermit2Supported = (\n step: LiFiStepExtended,\n fromChain: ExtendedChain,\n isFromNativeToken: boolean,\n disableMessageSigning: boolean,\n strategy: TransactionMethodType\n): boolean => {\n return (\n !!fromChain.permit2 &&\n !!fromChain.permit2Proxy &&\n !isFromNativeToken &&\n !disableMessageSigning &&\n strategy !== 'batched' &&\n // Approval address is not required for Permit2 per se, but we use it to skip allowance checks for direct transfers\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval &&\n !step.estimate.skipPermit\n )\n}\n"],"mappings":";;AASA,MAAa,sBACX,MACA,WACA,mBACA,uBACA,aACY;CACZ,OACE,CAAC,CAAC,UAAU,WACZ,CAAC,CAAC,UAAU,gBACZ,CAAC,qBACD,CAAC,yBACD,aAAa,aAEb,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS,gBACf,CAAC,KAAK,SAAS;AAEnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LiFiStepExtended, StatusManager } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/core/tasks/helpers/shouldCheckForAllowance.d.ts
|
|
4
|
+
declare const shouldCheckForAllowance: (step: LiFiStepExtended, isBridgeExecution: boolean, isFromNativeToken: boolean, statusManager: StatusManager) => boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { shouldCheckForAllowance };
|
|
7
|
+
//# sourceMappingURL=shouldCheckForAllowance.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/tasks/helpers/shouldCheckForAllowance.ts
|
|
3
|
+
const shouldCheckForAllowance = (step, isBridgeExecution, isFromNativeToken, statusManager) => {
|
|
4
|
+
const exchangeActionType = isBridgeExecution ? "CROSS_CHAIN" : "SWAP";
|
|
5
|
+
const swapOrBridgeAction = statusManager.findAction(step, exchangeActionType);
|
|
6
|
+
return !swapOrBridgeAction?.txHash && !swapOrBridgeAction?.taskId && !isFromNativeToken && !!step.estimate.approvalAddress && !step.estimate.skipApproval;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.shouldCheckForAllowance = shouldCheckForAllowance;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=shouldCheckForAllowance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldCheckForAllowance.js","names":[],"sources":["../../../../../src/core/tasks/helpers/shouldCheckForAllowance.ts"],"sourcesContent":["import type { LiFiStepExtended, StatusManager } from '@lifi/sdk'\n\nexport const shouldCheckForAllowance = (\n step: LiFiStepExtended,\n isBridgeExecution: boolean,\n isFromNativeToken: boolean,\n statusManager: StatusManager\n): boolean => {\n const exchangeActionType = isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n\n const swapOrBridgeAction = statusManager.findAction(step, exchangeActionType)\n\n return (\n // No existing swap/bridge transaction is pending\n !swapOrBridgeAction?.txHash &&\n // No existing swap/bridge batch/order is pending\n !swapOrBridgeAction?.taskId &&\n // Token is not native (address is not zero)\n !isFromNativeToken &&\n // Approval address is required for allowance checks, but may be null in special cases (e.g. direct transfers)\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n )\n}\n"],"mappings":";;AAEA,MAAa,2BACX,MACA,mBACA,mBACA,kBACY;CACZ,MAAM,qBAAqB,oBAAoB,gBAAgB;CAE/D,MAAM,qBAAqB,cAAc,WAAW,MAAM,kBAAkB;CAE5E,OAEE,CAAC,oBAAoB,UAErB,CAAC,oBAAoB,UAErB,CAAC,qBAED,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;AAEnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
|
+
import { SignedTypedData, TypedData } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/helpers/signHyperliquidTypedData.d.ts
|
|
5
|
+
declare const signHyperliquidTypedData: (context: EthereumStepExecutorContext, intentTypedData: TypedData[]) => Promise<SignedTypedData[] | undefined>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { signHyperliquidTypedData };
|
|
8
|
+
//# sourceMappingURL=signHyperliquidTypedData.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_getDomainChainId = require("../../../utils/getDomainChainId.js");
|
|
3
|
+
const require_hyperliquid_isHyperliquidAgentStep = require("../../../hyperliquid/isHyperliquidAgentStep.js");
|
|
4
|
+
const require_hyperliquid_agentWallet = require("../../../hyperliquid/agentWallet.js");
|
|
5
|
+
let viem_actions = require("viem/actions");
|
|
6
|
+
let viem_utils = require("viem/utils");
|
|
7
|
+
//#region src/core/tasks/helpers/signHyperliquidTypedData.ts
|
|
8
|
+
const signHyperliquidTypedData = async (context, intentTypedData) => {
|
|
9
|
+
const { step, fromChain, client, allowUserInteraction, checkClient, ethereumClient, getStorage } = context;
|
|
10
|
+
if (!allowUserInteraction) return;
|
|
11
|
+
const signedResults = [];
|
|
12
|
+
const ownerAddress = ethereumClient.account.address;
|
|
13
|
+
const storage = getStorage(client);
|
|
14
|
+
const existingAgentAddress = intentTypedData.find(require_hyperliquid_isHyperliquidAgentStep.isApproveAgentMessage)?.message.agentAddress;
|
|
15
|
+
const { account: agentAccount, needsApproval, expiresAt } = await require_hyperliquid_agentWallet.getOrCreateAgentWallet(storage, ownerAddress, existingAgentAddress);
|
|
16
|
+
for (const typedData of intentTypedData) if (require_hyperliquid_isHyperliquidAgentStep.isApproveAgentMessage(typedData)) {
|
|
17
|
+
if (!needsApproval) continue;
|
|
18
|
+
const message = {
|
|
19
|
+
...typedData.message,
|
|
20
|
+
agentAddress: agentAccount.address.toLowerCase(),
|
|
21
|
+
agentName: `${typedData.message.agentName} valid_until ${expiresAt}`
|
|
22
|
+
};
|
|
23
|
+
const updatedClient = await checkClient(step, require_utils_getDomainChainId.getDomainChainId(typedData.domain) || fromChain.id);
|
|
24
|
+
if (!updatedClient) return;
|
|
25
|
+
const signature = await (0, viem_utils.getAction)(updatedClient, viem_actions.signTypedData, "signTypedData")({
|
|
26
|
+
account: updatedClient.account,
|
|
27
|
+
primaryType: typedData.primaryType,
|
|
28
|
+
domain: typedData.domain,
|
|
29
|
+
types: typedData.types,
|
|
30
|
+
message
|
|
31
|
+
});
|
|
32
|
+
signedResults.push({
|
|
33
|
+
...typedData,
|
|
34
|
+
message,
|
|
35
|
+
signature
|
|
36
|
+
});
|
|
37
|
+
} else if (require_hyperliquid_isHyperliquidAgentStep.isApproveBuilderFeeMessage(typedData)) {
|
|
38
|
+
const updatedClient = await checkClient(step, require_utils_getDomainChainId.getDomainChainId(typedData.domain) || fromChain.id);
|
|
39
|
+
if (!updatedClient) return;
|
|
40
|
+
const signature = await (0, viem_utils.getAction)(updatedClient, viem_actions.signTypedData, "signTypedData")({
|
|
41
|
+
account: updatedClient.account,
|
|
42
|
+
primaryType: typedData.primaryType,
|
|
43
|
+
domain: typedData.domain,
|
|
44
|
+
types: typedData.types,
|
|
45
|
+
message: typedData.message
|
|
46
|
+
});
|
|
47
|
+
signedResults.push({
|
|
48
|
+
...typedData,
|
|
49
|
+
signature
|
|
50
|
+
});
|
|
51
|
+
} else if (require_hyperliquid_isHyperliquidAgentStep.isHyperliquidOrderMessage(typedData)) {
|
|
52
|
+
const signature = await agentAccount.signTypedData({
|
|
53
|
+
domain: typedData.domain,
|
|
54
|
+
types: typedData.types,
|
|
55
|
+
primaryType: typedData.primaryType,
|
|
56
|
+
message: typedData.message
|
|
57
|
+
});
|
|
58
|
+
signedResults.push({
|
|
59
|
+
...typedData,
|
|
60
|
+
signature
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return signedResults;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.signHyperliquidTypedData = signHyperliquidTypedData;
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=signHyperliquidTypedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signHyperliquidTypedData.js","names":["isApproveAgentMessage","getOrCreateAgentWallet","getDomainChainId","signTypedData","isApproveBuilderFeeMessage","isHyperliquidOrderMessage"],"sources":["../../../../../src/core/tasks/helpers/signHyperliquidTypedData.ts"],"sourcesContent":["import type { SignedTypedData, TypedData } from '@lifi/sdk'\nimport { signTypedData } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { getOrCreateAgentWallet } from '../../../hyperliquid/agentWallet.js'\nimport {\n isApproveAgentMessage,\n isApproveBuilderFeeMessage,\n isHyperliquidOrderMessage,\n} from '../../../hyperliquid/isHyperliquidAgentStep.js'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\nimport { getDomainChainId } from '../../../utils/getDomainChainId.js'\n\nexport const signHyperliquidTypedData = async (\n context: EthereumStepExecutorContext,\n intentTypedData: TypedData[]\n): Promise<SignedTypedData[] | undefined> => {\n const {\n step,\n fromChain,\n client,\n allowUserInteraction,\n checkClient,\n ethereumClient,\n getStorage,\n } = context\n\n if (!allowUserInteraction) {\n return\n }\n\n const signedResults: SignedTypedData[] = []\n const ownerAddress = ethereumClient.account!.address\n const storage = getStorage(client)\n\n const approveMessage = intentTypedData.find(isApproveAgentMessage)\n const existingAgentAddress = approveMessage?.message.agentAddress as\n | string\n | undefined\n\n const {\n account: agentAccount,\n needsApproval,\n expiresAt,\n } = await getOrCreateAgentWallet(storage, ownerAddress, existingAgentAddress)\n\n for (const typedData of intentTypedData) {\n if (isApproveAgentMessage(typedData)) {\n if (!needsApproval) {\n continue\n }\n\n const message = {\n ...typedData.message,\n agentAddress: agentAccount.address.toLowerCase(),\n agentName: `${typedData.message.agentName} valid_until ${expiresAt}`,\n }\n const typedDataChainId =\n getDomainChainId(typedData.domain) || fromChain.id\n\n const updatedClient = await checkClient(step, typedDataChainId)\n if (!updatedClient) {\n return\n }\n\n const signature = await getAction(\n updatedClient,\n signTypedData,\n 'signTypedData'\n )({\n account: updatedClient.account!,\n primaryType: typedData.primaryType,\n domain: typedData.domain,\n types: typedData.types,\n message,\n })\n signedResults.push({ ...typedData, message, signature })\n } else if (isApproveBuilderFeeMessage(typedData)) {\n const typedDataChainId =\n getDomainChainId(typedData.domain) || fromChain.id\n\n const updatedClient = await checkClient(step, typedDataChainId)\n if (!updatedClient) {\n return\n }\n\n const signature = await getAction(\n updatedClient,\n signTypedData,\n 'signTypedData'\n )({\n account: updatedClient.account!,\n primaryType: typedData.primaryType,\n domain: typedData.domain,\n types: typedData.types,\n message: typedData.message,\n })\n signedResults.push({ ...typedData, signature })\n } else if (isHyperliquidOrderMessage(typedData)) {\n const signature = await agentAccount.signTypedData({\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n })\n signedResults.push({ ...typedData, signature })\n }\n }\n\n return signedResults\n}\n"],"mappings":";;;;;;;AAYA,MAAa,2BAA2B,OACtC,SACA,oBAC2C;CAC3C,MAAM,EACJ,MACA,WACA,QACA,sBACA,aACA,gBACA,eACE;CAEJ,IAAI,CAAC,sBACH;CAGF,MAAM,gBAAmC,CAAC;CAC1C,MAAM,eAAe,eAAe,QAAS;CAC7C,MAAM,UAAU,WAAW,MAAM;CAGjC,MAAM,uBADiB,gBAAgB,KAAKA,2CAAAA,qBACF,CAAC,EAAE,QAAQ;CAIrD,MAAM,EACJ,SAAS,cACT,eACA,cACE,MAAMC,gCAAAA,uBAAuB,SAAS,cAAc,oBAAoB;CAE5E,KAAK,MAAM,aAAa,iBACtB,IAAID,2CAAAA,sBAAsB,SAAS,GAAG;EACpC,IAAI,CAAC,eACH;EAGF,MAAM,UAAU;GACd,GAAG,UAAU;GACb,cAAc,aAAa,QAAQ,YAAY;GAC/C,WAAW,GAAG,UAAU,QAAQ,UAAU,eAAe;EAC3D;EAIA,MAAM,gBAAgB,MAAM,YAAY,MAFtCE,+BAAAA,iBAAiB,UAAU,MAAM,KAAK,UAAU,EAEY;EAC9D,IAAI,CAAC,eACH;EAGF,MAAM,YAAY,OAAA,GAAA,WAAA,UAAA,CAChB,eACAC,aAAAA,eACA,eACF,CAAC,CAAC;GACA,SAAS,cAAc;GACvB,aAAa,UAAU;GACvB,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB;EACF,CAAC;EACD,cAAc,KAAK;GAAE,GAAG;GAAW;GAAS;EAAU,CAAC;CACzD,OAAO,IAAIC,2CAAAA,2BAA2B,SAAS,GAAG;EAIhD,MAAM,gBAAgB,MAAM,YAAY,MAFtCF,+BAAAA,iBAAiB,UAAU,MAAM,KAAK,UAAU,EAEY;EAC9D,IAAI,CAAC,eACH;EAGF,MAAM,YAAY,OAAA,GAAA,WAAA,UAAA,CAChB,eACAC,aAAAA,eACA,eACF,CAAC,CAAC;GACA,SAAS,cAAc;GACvB,aAAa,UAAU;GACvB,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB,SAAS,UAAU;EACrB,CAAC;EACD,cAAc,KAAK;GAAE,GAAG;GAAW;EAAU,CAAC;CAChD,OAAO,IAAIE,2CAAAA,0BAA0B,SAAS,GAAG;EAC/C,MAAM,YAAY,MAAM,aAAa,cAAc;GACjD,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB,aAAa,UAAU;GACvB,SAAS,UAAU;EACrB,CAAC;EACD,cAAc,KAAK;GAAE,GAAG;GAAW;EAAU,CAAC;CAChD;CAGF,OAAO;AACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Client } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/core/tasks/helpers/switchChain.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* This method checks whether the wallet client is configured for the correct chain.
|
|
6
|
+
* If yes it returns the wallet clien.
|
|
7
|
+
* If no and if user interaction is allowed it triggers the switchChain callback. If no user interaction is allowed it aborts.
|
|
8
|
+
*
|
|
9
|
+
* Account Type: local -
|
|
10
|
+
* We need to create and return a new connector client from the switchChain callback in order to continue execution on a new chain.
|
|
11
|
+
*
|
|
12
|
+
* Account Type: json-rpc -
|
|
13
|
+
* We can switch chain and return existing connector client from the switchChain callback in order to continue execution on a new chain.
|
|
14
|
+
* @param client The client to switch the chain for
|
|
15
|
+
* @param targetChainId The target chain id to switch to
|
|
16
|
+
* @param allowUserInteraction Whether user interaction is allowed
|
|
17
|
+
* @param switchChainCallback The callback to switch the chain
|
|
18
|
+
* @returns New connector client
|
|
19
|
+
*/
|
|
20
|
+
declare const switchChain: (client: Client, targetChainId: number, allowUserInteraction: boolean, switchChainCallback?: (chainId: number) => Promise<Client | undefined>) => Promise<Client | undefined>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { switchChain };
|
|
23
|
+
//# sourceMappingURL=switchChain.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
3
|
+
let viem_actions = require("viem/actions");
|
|
4
|
+
let viem_utils = require("viem/utils");
|
|
5
|
+
//#region src/core/tasks/helpers/switchChain.ts
|
|
6
|
+
/**
|
|
7
|
+
* This method checks whether the wallet client is configured for the correct chain.
|
|
8
|
+
* If yes it returns the wallet clien.
|
|
9
|
+
* If no and if user interaction is allowed it triggers the switchChain callback. If no user interaction is allowed it aborts.
|
|
10
|
+
*
|
|
11
|
+
* Account Type: local -
|
|
12
|
+
* We need to create and return a new connector client from the switchChain callback in order to continue execution on a new chain.
|
|
13
|
+
*
|
|
14
|
+
* Account Type: json-rpc -
|
|
15
|
+
* We can switch chain and return existing connector client from the switchChain callback in order to continue execution on a new chain.
|
|
16
|
+
* @param client The client to switch the chain for
|
|
17
|
+
* @param targetChainId The target chain id to switch to
|
|
18
|
+
* @param allowUserInteraction Whether user interaction is allowed
|
|
19
|
+
* @param switchChainCallback The callback to switch the chain
|
|
20
|
+
* @returns New connector client
|
|
21
|
+
*/
|
|
22
|
+
const switchChain = async (client, targetChainId, allowUserInteraction, switchChainCallback) => {
|
|
23
|
+
if (await (0, viem_utils.getAction)(client, viem_actions.getChainId, "getChainId")(void 0) === targetChainId) return client;
|
|
24
|
+
if (!allowUserInteraction) return;
|
|
25
|
+
if (!switchChainCallback) throw new _lifi_sdk.ProviderError(_lifi_sdk.LiFiErrorCode.ChainSwitchError, "Chain switch hook is not provided.");
|
|
26
|
+
const updatedClient = await switchChainCallback(targetChainId);
|
|
27
|
+
let updatedChainId;
|
|
28
|
+
if (updatedClient) updatedChainId = await (0, viem_utils.getAction)(updatedClient, viem_actions.getChainId, "getChainId")(void 0);
|
|
29
|
+
if (updatedChainId !== targetChainId) throw new _lifi_sdk.ProviderError(_lifi_sdk.LiFiErrorCode.ChainSwitchError, "Chain switch required.");
|
|
30
|
+
return updatedClient;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.switchChain = switchChain;
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=switchChain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switchChain.js","names":["getChainId","ProviderError","LiFiErrorCode"],"sources":["../../../../../src/core/tasks/helpers/switchChain.ts"],"sourcesContent":["import { LiFiErrorCode, ProviderError } from '@lifi/sdk'\nimport type { Client, GetChainIdReturnType } from 'viem'\nimport { getChainId } from 'viem/actions'\nimport { getAction } from 'viem/utils'\n\n/**\n * This method checks whether the wallet client is configured for the correct chain.\n * If yes it returns the wallet clien.\n * If no and if user interaction is allowed it triggers the switchChain callback. If no user interaction is allowed it aborts.\n *\n * Account Type: local -\n * We need to create and return a new connector client from the switchChain callback in order to continue execution on a new chain.\n *\n * Account Type: json-rpc -\n * We can switch chain and return existing connector client from the switchChain callback in order to continue execution on a new chain.\n * @param client The client to switch the chain for\n * @param targetChainId The target chain id to switch to\n * @param allowUserInteraction Whether user interaction is allowed\n * @param switchChainCallback The callback to switch the chain\n * @returns New connector client\n */\nexport const switchChain = async (\n client: Client,\n targetChainId: number,\n allowUserInteraction: boolean,\n switchChainCallback?: (chainId: number) => Promise<Client | undefined>\n): Promise<Client | undefined> => {\n // if we are already on the correct chain we can proceed directly\n const currentChainId = (await getAction(\n client,\n getChainId,\n 'getChainId'\n )(undefined)) as GetChainIdReturnType\n if (currentChainId === targetChainId) {\n return client\n }\n\n if (!allowUserInteraction) {\n return\n }\n if (!switchChainCallback) {\n throw new ProviderError(\n LiFiErrorCode.ChainSwitchError,\n 'Chain switch hook is not provided.'\n )\n }\n const updatedClient = await switchChainCallback(targetChainId)\n let updatedChainId: number | undefined\n if (updatedClient) {\n updatedChainId = (await getAction(\n updatedClient,\n getChainId,\n 'getChainId'\n )(undefined)) as GetChainIdReturnType\n }\n if (updatedChainId !== targetChainId) {\n throw new ProviderError(\n LiFiErrorCode.ChainSwitchError,\n 'Chain switch required.'\n )\n }\n\n return updatedClient\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cAAc,OACzB,QACA,eACA,sBACA,wBACgC;CAOhC,IAAI,OAAA,GAAA,WAAA,UAAA,CAJF,QACAA,aAAAA,YACA,YACF,CAAC,CAAC,KAAA,CAAS,MACY,eACrB,OAAO;CAGT,IAAI,CAAC,sBACH;CAEF,IAAI,CAAC,qBACH,MAAM,IAAIC,UAAAA,cACRC,UAAAA,cAAc,kBACd,oCACF;CAEF,MAAM,gBAAgB,MAAM,oBAAoB,aAAa;CAC7D,IAAI;CACJ,IAAI,eACF,iBAAkB,OAAA,GAAA,WAAA,UAAA,CAChB,eACAF,aAAAA,YACA,YACF,CAAC,CAAC,KAAA,CAAS;CAEb,IAAI,mBAAmB,eACrB,MAAM,IAAIC,UAAAA,cACRC,UAAAA,cAAc,kBACd,wBACF;CAGF,OAAO;AACT"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WalletCallReceipt as WalletCallReceipt$1 } from "../../../types.js";
|
|
2
|
+
import { ExecutionAction, ExtendedChain, LiFiStepExtended, StatusManager } from "@lifi/sdk";
|
|
3
|
+
import { TransactionReceipt } from "viem";
|
|
4
|
+
|
|
5
|
+
//#region src/core/tasks/helpers/updateActionWithReceipt.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Update action to PENDING with txHash/txLink from a transaction receipt when the receipt hash differs from current action.
|
|
8
|
+
* Returns the updated action or the same action if no update.
|
|
9
|
+
*/
|
|
10
|
+
declare function updateActionWithReceipt(statusManager: StatusManager, step: LiFiStepExtended, fromChain: ExtendedChain, receipt: TransactionReceipt | WalletCallReceipt$1 | undefined, action: ExecutionAction): ExecutionAction;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { updateActionWithReceipt };
|
|
13
|
+
//# sourceMappingURL=updateActionWithReceipt.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let viem_utils = require("viem/utils");
|
|
3
|
+
//#region src/core/tasks/helpers/updateActionWithReceipt.ts
|
|
4
|
+
/**
|
|
5
|
+
* Update action to PENDING with txHash/txLink from a transaction receipt when the receipt hash differs from current action.
|
|
6
|
+
* Returns the updated action or the same action if no update.
|
|
7
|
+
*/
|
|
8
|
+
function updateActionWithReceipt(statusManager, step, fromChain, receipt, action) {
|
|
9
|
+
if (!receipt?.transactionHash || receipt.transactionHash === action.txHash) return action;
|
|
10
|
+
const txHash = (0, viem_utils.isHex)(receipt.transactionHash, { strict: true }) ? receipt.transactionHash : void 0;
|
|
11
|
+
return statusManager.updateAction(step, action.type, "PENDING", {
|
|
12
|
+
txHash,
|
|
13
|
+
txLink: receipt.transactionLink || (txHash ? `${fromChain.metamask.blockExplorerUrls[0]}tx/${txHash}` : void 0)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.updateActionWithReceipt = updateActionWithReceipt;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=updateActionWithReceipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateActionWithReceipt.js","names":[],"sources":["../../../../../src/core/tasks/helpers/updateActionWithReceipt.ts"],"sourcesContent":["import type {\n ExecutionAction,\n ExtendedChain,\n LiFiStepExtended,\n StatusManager,\n} from '@lifi/sdk'\nimport type { TransactionReceipt } from 'viem'\nimport { isHex } from 'viem/utils'\nimport type { WalletCallReceipt } from '../../../types.js'\n\n/**\n * Update action to PENDING with txHash/txLink from a transaction receipt when the receipt hash differs from current action.\n * Returns the updated action or the same action if no update.\n */\nexport function updateActionWithReceipt(\n statusManager: StatusManager,\n step: LiFiStepExtended,\n fromChain: ExtendedChain,\n receipt: TransactionReceipt | WalletCallReceipt | undefined,\n action: ExecutionAction\n): ExecutionAction {\n // Update pending action if the transaction hash from the receipt is different.\n // This might happen if the transaction was replaced or we used taskId instead of txHash.\n if (!receipt?.transactionHash || receipt.transactionHash === action.txHash) {\n return action\n }\n // Validate if transaction hash is a valid hex string that can be used on-chain\n // Some custom integrations may return non-hex identifiers to support custom status tracking\n const txHash = isHex(receipt.transactionHash, { strict: true })\n ? receipt.transactionHash\n : undefined\n return statusManager.updateAction(step, action.type, 'PENDING', {\n txHash,\n txLink:\n (receipt as WalletCallReceipt).transactionLink ||\n (txHash\n ? `${fromChain.metamask.blockExplorerUrls[0]}tx/${txHash}`\n : undefined),\n })\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,wBACd,eACA,MACA,WACA,SACA,QACiB;CAGjB,IAAI,CAAC,SAAS,mBAAmB,QAAQ,oBAAoB,OAAO,QAClE,OAAO;CAIT,MAAM,UAAA,GAAA,WAAA,MAAA,CAAe,QAAQ,iBAAiB,EAAE,QAAQ,KAAK,CAAC,IAC1D,QAAQ,kBACR,KAAA;CACJ,OAAO,cAAc,aAAa,MAAM,OAAO,MAAM,WAAW;EAC9D;EACA,QACG,QAA8B,oBAC9B,SACG,GAAG,UAAU,SAAS,kBAAkB,GAAG,KAAK,WAChD,KAAA;CACR,CAAC;AACH"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ExecuteStepRetryError, ExecuteStepRetryParams, ExecutionAction, LiFiStep, SDKError } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/parseEthereumErrors.d.ts
|
|
4
|
+
declare const parseEthereumErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
5
|
+
declare const isAtomicReadyWalletRejectedUpgradeError: (e: any) => boolean;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { isAtomicReadyWalletRejectedUpgradeError, parseEthereumErrors };
|
|
8
|
+
//# sourceMappingURL=parseEthereumErrors.d.ts.map
|