@lifi/sdk-provider-ethereum 4.0.14 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +24 -8
- package/dist/cjs/EthereumProvider.d.ts +1 -2
- package/dist/cjs/EthereumProvider.js +5 -0
- package/dist/cjs/EthereumProvider.js.map +1 -1
- package/dist/cjs/actions/checkPermitSupport.d.ts +1 -2
- package/dist/cjs/actions/constants.d.ts +6 -7
- package/dist/cjs/actions/getAccountCode.d.ts +1 -2
- package/dist/cjs/actions/getAllowance.d.ts +4 -5
- package/dist/cjs/actions/getEthereumBalance.d.ts +1 -2
- package/dist/cjs/actions/getMaxPriorityFeePerGas.d.ts +1 -2
- package/dist/cjs/actions/getMulticallAddress.d.ts +1 -2
- package/dist/cjs/actions/isBatchingSupported.d.ts +1 -2
- package/dist/cjs/actions/isSafeSignature.d.ts +2 -3
- package/dist/cjs/actions/isSafeWallet.d.ts +1 -2
- package/dist/cjs/actions/isSmartContractWallet.d.ts +1 -2
- package/dist/cjs/actions/resolveENSAddress.d.ts +1 -2
- package/dist/cjs/actions/resolveEthereumAddress.d.ts +1 -2
- package/dist/cjs/actions/resolveTransactionHash.d.ts +1 -2
- package/dist/cjs/actions/resolveUNSAddress.d.ts +1 -2
- package/dist/cjs/actions/setAllowance.d.ts +3 -4
- package/dist/cjs/actions/waitForBatchTransactionReceipt.d.ts +1 -2
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.d.ts +1 -2
- package/dist/cjs/actions/waitForSafeTransactionExecution.d.ts +2 -3
- package/dist/cjs/actions/waitForTransactionReceipt.d.ts +1 -2
- package/dist/cjs/client/publicClient.d.ts +1 -2
- package/dist/cjs/client/safeClient.d.ts +3 -4
- package/dist/cjs/client/types.d.ts +3 -4
- package/dist/cjs/core/EthereumStepExecutor.d.ts +1 -2
- package/dist/cjs/core/EthereumStepExecutor.js +2 -0
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +3 -4
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +6 -5
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +11 -29
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js +2 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js +33 -0
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +6 -4
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +14 -27
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +2 -3
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +3 -4
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +1 -2
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js +15 -0
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.d.ts +6 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.js +16 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +7 -2
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +12 -4
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/getTxLink.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +3 -3
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +4 -4
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js +17 -0
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +6 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js +29 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.d.ts +11 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js +22 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js +2 -1
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +3 -3
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js +37 -0
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/switchChain.d.ts +1 -2
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.d.ts +1 -2
- package/dist/cjs/errors/parseEthereumErrors.d.ts +2 -3
- package/dist/cjs/hyperliquid/agentWallet.d.ts +2 -3
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.d.ts +4 -5
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +1 -3
- package/dist/cjs/permits/acceptsRawEcdsaSignature.d.ts +1 -2
- package/dist/cjs/permits/allowanceTransfer.d.ts +12 -13
- package/dist/cjs/permits/canAccountUseNativePermits.d.ts +1 -2
- package/dist/cjs/permits/canAccountUsePermit2.d.ts +1 -2
- package/dist/cjs/permits/constants.d.ts +20 -21
- package/dist/cjs/permits/domain.d.ts +1 -2
- package/dist/cjs/permits/encodeNativePermitData.d.ts +1 -2
- package/dist/cjs/permits/encodePermit2Data.d.ts +1 -2
- package/dist/cjs/permits/getNativePermit.d.ts +1 -2
- package/dist/cjs/permits/getPermitTransferFromValues.d.ts +1 -2
- package/dist/cjs/permits/invariant.d.ts +1 -2
- package/dist/cjs/permits/isDelegationDesignatorCode.d.ts +1 -2
- package/dist/cjs/permits/isNativePermitValid.d.ts +1 -2
- package/dist/cjs/permits/signPermit2Message.d.ts +1 -2
- package/dist/cjs/permits/signatureTransfer.d.ts +11 -12
- package/dist/cjs/permits/types.d.ts +3 -4
- package/dist/cjs/types.d.ts +13 -14
- package/dist/cjs/utils/abi.d.ts +6 -7
- package/dist/cjs/utils/convertExtendedChain.d.ts +1 -2
- package/dist/cjs/utils/getActionWithFallback.d.ts +1 -2
- package/dist/cjs/utils/getDomainChainId.d.ts +1 -2
- package/dist/cjs/utils/getSafeApiKey.d.ts +1 -2
- package/dist/cjs/utils/getTypedDataLane.d.ts +15 -0
- package/dist/cjs/utils/getTypedDataLane.js +33 -0
- package/dist/cjs/utils/getTypedDataLane.js.map +1 -0
- package/dist/cjs/utils/isContractCallStep.d.ts +1 -2
- package/dist/cjs/utils/isExtendedChain.d.ts +1 -2
- package/dist/cjs/utils/isGaslessStep.d.ts +4 -3
- package/dist/cjs/utils/isGaslessStep.js +7 -1
- package/dist/cjs/utils/isGaslessStep.js.map +1 -1
- package/dist/cjs/utils/isValidSignature.d.ts +2 -3
- package/dist/cjs/utils/isZeroAddress.d.ts +3 -4
- package/dist/cjs/utils/median.d.ts +1 -2
- package/dist/cjs/version.d.ts +2 -3
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/EthereumProvider.d.ts +1 -2
- package/dist/esm/EthereumProvider.d.ts.map +1 -1
- package/dist/esm/EthereumProvider.js +5 -0
- package/dist/esm/EthereumProvider.js.map +1 -1
- package/dist/esm/actions/checkPermitSupport.d.ts +1 -2
- package/dist/esm/actions/checkPermitSupport.d.ts.map +1 -1
- package/dist/esm/actions/constants.d.ts +6 -7
- package/dist/esm/actions/constants.d.ts.map +1 -1
- package/dist/esm/actions/getAccountCode.d.ts +1 -2
- package/dist/esm/actions/getAccountCode.d.ts.map +1 -1
- package/dist/esm/actions/getAllowance.d.ts +4 -5
- package/dist/esm/actions/getAllowance.d.ts.map +1 -1
- package/dist/esm/actions/getEthereumBalance.d.ts +1 -2
- package/dist/esm/actions/getEthereumBalance.d.ts.map +1 -1
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts +1 -2
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/esm/actions/getMulticallAddress.d.ts +1 -2
- package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -1
- package/dist/esm/actions/isBatchingSupported.d.ts +1 -2
- package/dist/esm/actions/isBatchingSupported.d.ts.map +1 -1
- package/dist/esm/actions/isSafeSignature.d.ts +2 -3
- package/dist/esm/actions/isSafeSignature.d.ts.map +1 -1
- package/dist/esm/actions/isSafeWallet.d.ts +1 -2
- package/dist/esm/actions/isSafeWallet.d.ts.map +1 -1
- package/dist/esm/actions/isSmartContractWallet.d.ts +1 -2
- package/dist/esm/actions/isSmartContractWallet.d.ts.map +1 -1
- package/dist/esm/actions/resolveENSAddress.d.ts +1 -2
- package/dist/esm/actions/resolveENSAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveEthereumAddress.d.ts +1 -2
- package/dist/esm/actions/resolveEthereumAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveTransactionHash.d.ts +1 -2
- package/dist/esm/actions/resolveTransactionHash.d.ts.map +1 -1
- package/dist/esm/actions/resolveUNSAddress.d.ts +1 -2
- package/dist/esm/actions/resolveUNSAddress.d.ts.map +1 -1
- package/dist/esm/actions/setAllowance.d.ts +3 -4
- package/dist/esm/actions/setAllowance.d.ts.map +1 -1
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts +1 -2
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts +1 -2
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts +2 -3
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts.map +1 -1
- package/dist/esm/actions/waitForTransactionReceipt.d.ts +1 -2
- package/dist/esm/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/esm/client/publicClient.d.ts +1 -2
- package/dist/esm/client/publicClient.d.ts.map +1 -1
- package/dist/esm/client/safeClient.d.ts +3 -4
- package/dist/esm/client/safeClient.d.ts.map +1 -1
- package/dist/esm/client/types.d.ts +3 -4
- package/dist/esm/client/types.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.d.ts +1 -2
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.js +2 -0
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +3 -4
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +6 -5
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +11 -29
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.js +2 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js +32 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +6 -4
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +14 -27
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +2 -3
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +3 -4
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts +1 -2
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.js +14 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts +6 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.js +15 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +7 -2
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +12 -4
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +3 -3
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js +4 -4
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js +15 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js.map +1 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +6 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js +28 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js.map +1 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts +11 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js +21 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js.map +1 -0
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.js +2 -1
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.js.map +1 -1
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +3 -3
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.js +36 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.js.map +1 -0
- package/dist/esm/core/tasks/helpers/switchChain.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/switchChain.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts +1 -2
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts.map +1 -1
- package/dist/esm/errors/parseEthereumErrors.d.ts +2 -3
- package/dist/esm/errors/parseEthereumErrors.d.ts.map +1 -1
- package/dist/esm/hyperliquid/agentWallet.d.ts +2 -3
- package/dist/esm/hyperliquid/agentWallet.d.ts.map +1 -1
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts +4 -5
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +2 -3
- package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts +1 -2
- package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts.map +1 -1
- package/dist/esm/permits/allowanceTransfer.d.ts +12 -13
- package/dist/esm/permits/allowanceTransfer.d.ts.map +1 -1
- package/dist/esm/permits/canAccountUseNativePermits.d.ts +1 -2
- package/dist/esm/permits/canAccountUseNativePermits.d.ts.map +1 -1
- package/dist/esm/permits/canAccountUsePermit2.d.ts +1 -2
- package/dist/esm/permits/canAccountUsePermit2.d.ts.map +1 -1
- package/dist/esm/permits/constants.d.ts +20 -21
- package/dist/esm/permits/constants.d.ts.map +1 -1
- package/dist/esm/permits/domain.d.ts +1 -2
- package/dist/esm/permits/domain.d.ts.map +1 -1
- package/dist/esm/permits/encodeNativePermitData.d.ts +1 -2
- package/dist/esm/permits/encodeNativePermitData.d.ts.map +1 -1
- package/dist/esm/permits/encodePermit2Data.d.ts +1 -2
- package/dist/esm/permits/encodePermit2Data.d.ts.map +1 -1
- package/dist/esm/permits/getNativePermit.d.ts +1 -2
- package/dist/esm/permits/getNativePermit.d.ts.map +1 -1
- package/dist/esm/permits/getPermitTransferFromValues.d.ts +1 -2
- package/dist/esm/permits/getPermitTransferFromValues.d.ts.map +1 -1
- package/dist/esm/permits/invariant.d.ts +1 -2
- package/dist/esm/permits/invariant.d.ts.map +1 -1
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts +1 -2
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts.map +1 -1
- package/dist/esm/permits/isNativePermitValid.d.ts +1 -2
- package/dist/esm/permits/isNativePermitValid.d.ts.map +1 -1
- package/dist/esm/permits/signPermit2Message.d.ts +1 -2
- package/dist/esm/permits/signPermit2Message.d.ts.map +1 -1
- package/dist/esm/permits/signatureTransfer.d.ts +11 -12
- package/dist/esm/permits/signatureTransfer.d.ts.map +1 -1
- package/dist/esm/permits/types.d.ts +3 -4
- package/dist/esm/permits/types.d.ts.map +1 -1
- package/dist/esm/types.d.ts +13 -14
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/abi.d.ts +6 -7
- package/dist/esm/utils/abi.d.ts.map +1 -1
- package/dist/esm/utils/convertExtendedChain.d.ts +1 -2
- package/dist/esm/utils/convertExtendedChain.d.ts.map +1 -1
- package/dist/esm/utils/getActionWithFallback.d.ts +1 -2
- package/dist/esm/utils/getActionWithFallback.d.ts.map +1 -1
- package/dist/esm/utils/getDomainChainId.d.ts +1 -2
- package/dist/esm/utils/getDomainChainId.d.ts.map +1 -1
- package/dist/esm/utils/getSafeApiKey.d.ts +1 -2
- package/dist/esm/utils/getSafeApiKey.d.ts.map +1 -1
- package/dist/esm/utils/getTypedDataLane.d.ts +15 -0
- package/dist/esm/utils/getTypedDataLane.d.ts.map +1 -0
- package/dist/esm/utils/getTypedDataLane.js +28 -0
- package/dist/esm/utils/getTypedDataLane.js.map +1 -0
- package/dist/esm/utils/isContractCallStep.d.ts +1 -2
- package/dist/esm/utils/isContractCallStep.d.ts.map +1 -1
- package/dist/esm/utils/isExtendedChain.d.ts +1 -2
- package/dist/esm/utils/isExtendedChain.d.ts.map +1 -1
- package/dist/esm/utils/isGaslessStep.d.ts +4 -3
- package/dist/esm/utils/isGaslessStep.d.ts.map +1 -1
- package/dist/esm/utils/isGaslessStep.js +7 -2
- package/dist/esm/utils/isGaslessStep.js.map +1 -1
- package/dist/esm/utils/isValidSignature.d.ts +2 -3
- package/dist/esm/utils/isValidSignature.d.ts.map +1 -1
- package/dist/esm/utils/isZeroAddress.d.ts +3 -4
- package/dist/esm/utils/isZeroAddress.d.ts.map +1 -1
- package/dist/esm/utils/median.d.ts +1 -2
- package/dist/esm/utils/median.d.ts.map +1 -1
- package/dist/esm/version.d.ts +2 -3
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +3 -3
- package/src/EthereumProvider.ts +6 -0
- package/src/core/EthereumStepExecutor.ts +2 -0
- package/src/core/tasks/EthereumCheckBalanceTask.ts +6 -7
- package/src/core/tasks/EthereumCheckPermitsTask.ts +31 -63
- package/src/core/tasks/EthereumNativePermitTask.ts +5 -0
- package/src/core/tasks/EthereumPermit2AllowanceTask.ts +53 -0
- package/src/core/tasks/EthereumPrepareTransactionTask.ts +11 -2
- package/src/core/tasks/EthereumRelayedSignAndExecuteTask.ts +25 -47
- package/src/core/tasks/EthereumSetAllowanceTask.ts +2 -3
- package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +2 -9
- package/src/core/tasks/helpers/findSignedNativePermit.ts +23 -0
- package/src/core/tasks/helpers/getApprovalAmount.ts +30 -0
- package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +31 -5
- package/src/core/tasks/helpers/getUpdatedStep.ts +7 -2
- package/src/core/tasks/helpers/hasPermit2AllowanceInFlight.ts +31 -0
- package/src/core/tasks/helpers/isTypedDataAlreadySigned.ts +56 -0
- package/src/core/tasks/helpers/preservePermit2Allowances.ts +44 -0
- package/src/core/tasks/helpers/resolvePermit2Support.ts +3 -1
- package/src/core/tasks/helpers/signHyperliquidTypedData.ts +3 -3
- package/src/core/tasks/helpers/signTypedDataEntries.ts +70 -0
- package/src/index.ts +0 -1
- package/src/utils/getTypedDataLane.ts +76 -0
- package/src/utils/isGaslessStep.ts +22 -9
- package/src/version.ts +1 -1
- package/dist/cjs/utils/isRelayerStep.d.ts +0 -7
- package/dist/cjs/utils/isRelayerStep.js +0 -9
- package/dist/cjs/utils/isRelayerStep.js.map +0 -1
- package/dist/esm/utils/isRelayerStep.d.ts +0 -7
- package/dist/esm/utils/isRelayerStep.d.ts.map +0 -1
- package/dist/esm/utils/isRelayerStep.js +0 -8
- package/dist/esm/utils/isRelayerStep.js.map +0 -1
- package/src/utils/isRelayerStep.ts +0 -8
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isGaslessTypedData } from "./isGaslessStep.js";
|
|
2
|
+
//#region src/utils/getTypedDataLane.ts
|
|
3
|
+
function getTypedDataLane(typedData, chain) {
|
|
4
|
+
if (typedData.primaryType === "Permit") return "native-permit";
|
|
5
|
+
if (isGaslessTypedData(typedData, chain)) return "relayer-message";
|
|
6
|
+
if (typedData.primaryType === "PermitSingle") return "permit2-allowance";
|
|
7
|
+
return "relayer-message";
|
|
8
|
+
}
|
|
9
|
+
/** Whether the step carries a Permit2 allowance the SDK signs for a caller's own spender. */
|
|
10
|
+
function hasPermit2Allowance(step, chain) {
|
|
11
|
+
return !!step.typedData?.some((typedData) => getTypedDataLane(typedData, chain) === "permit2-allowance");
|
|
12
|
+
}
|
|
13
|
+
/** The step's typed-data entries that belong to `lane`. */
|
|
14
|
+
function getTypedDataInLane(step, lane, chain) {
|
|
15
|
+
return step.typedData?.filter((typedData) => getTypedDataLane(typedData, chain) === lane) ?? [];
|
|
16
|
+
}
|
|
17
|
+
/** Whether the step still carries typed data a relayer must sign and submit. */
|
|
18
|
+
function hasRelayerMessage(step, chain) {
|
|
19
|
+
return !!step.typedData?.some((typedData) => getTypedDataLane(typedData, chain) === "relayer-message");
|
|
20
|
+
}
|
|
21
|
+
/** Whether the step carries a Permit2 allowance and nothing a relayer must sign. */
|
|
22
|
+
function isPermit2AllowanceLane(step, chain) {
|
|
23
|
+
return hasPermit2Allowance(step, chain) && !hasRelayerMessage(step, chain);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getTypedDataInLane, getTypedDataLane, hasPermit2Allowance, hasRelayerMessage, isPermit2AllowanceLane };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=getTypedDataLane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTypedDataLane.js","names":[],"sources":["../../../src/utils/getTypedDataLane.ts"],"sourcesContent":["import type {\n ExtendedChain,\n LiFiStep,\n LiFiStepExtended,\n TypedData,\n} from '@lifi/sdk'\nimport { isGaslessTypedData } from './isGaslessStep.js'\n\n/** Which execution lane one `step.typedData` entry belongs to. */\nexport type TypedDataLane =\n | 'native-permit'\n | 'permit2-allowance'\n | 'relayer-message'\n\n// `chain` is required, and nothing else enforces it: `chain?` compiles and\n// every test still passes, but a relayer message then classifies as\n// `permit2-allowance` and gets signed inline. Do NOT relax it.\nexport function getTypedDataLane(\n typedData: TypedData,\n chain: ExtendedChain\n): TypedDataLane {\n // A native `Permit` is classified BEFORE the gasless rule: LI.FI's relayer\n // signs a permit whose spender is `chain.permit2`, and calling that a relayer\n // message makes a gasless step ask the user to fund an approval.\n if (typedData.primaryType === 'Permit') {\n return 'native-permit'\n }\n if (isGaslessTypedData(typedData, chain)) {\n return 'relayer-message'\n }\n if (typedData.primaryType === 'PermitSingle') {\n return 'permit2-allowance'\n }\n return 'relayer-message'\n}\n\n/** Whether the step carries a Permit2 allowance the SDK signs for a caller's own spender. */\nexport function hasPermit2Allowance(\n step: LiFiStepExtended | LiFiStep,\n chain: ExtendedChain\n): boolean {\n return !!step.typedData?.some(\n (typedData) => getTypedDataLane(typedData, chain) === 'permit2-allowance'\n )\n}\n\n/** The step's typed-data entries that belong to `lane`. */\nexport function getTypedDataInLane(\n step: LiFiStepExtended | LiFiStep,\n lane: TypedDataLane,\n chain: ExtendedChain\n): TypedData[] {\n return (\n step.typedData?.filter(\n (typedData) => getTypedDataLane(typedData, chain) === lane\n ) ?? []\n )\n}\n\n/** Whether the step still carries typed data a relayer must sign and submit. */\nexport function hasRelayerMessage(\n step: LiFiStepExtended | LiFiStep,\n chain: ExtendedChain\n): boolean {\n return !!step.typedData?.some(\n (typedData) => getTypedDataLane(typedData, chain) === 'relayer-message'\n )\n}\n\n/** Whether the step carries a Permit2 allowance and nothing a relayer must sign. */\nexport function isPermit2AllowanceLane(\n step: LiFiStepExtended | LiFiStep,\n chain: ExtendedChain\n): boolean {\n return hasPermit2Allowance(step, chain) && !hasRelayerMessage(step, chain)\n}\n"],"mappings":";;AAiBA,SAAgB,iBACd,WACA,OACe;CAIf,IAAI,UAAU,gBAAgB,UAC5B,OAAO;CAET,IAAI,mBAAmB,WAAW,KAAK,GACrC,OAAO;CAET,IAAI,UAAU,gBAAgB,gBAC5B,OAAO;CAET,OAAO;AACT;;AAGA,SAAgB,oBACd,MACA,OACS;CACT,OAAO,CAAC,CAAC,KAAK,WAAW,MACtB,cAAc,iBAAiB,WAAW,KAAK,MAAM,mBACxD;AACF;;AAGA,SAAgB,mBACd,MACA,MACA,OACa;CACb,OACE,KAAK,WAAW,QACb,cAAc,iBAAiB,WAAW,KAAK,MAAM,IACxD,KAAK,CAAC;AAEV;;AAGA,SAAgB,kBACd,MACA,OACS;CACT,OAAO,CAAC,CAAC,KAAK,WAAW,MACtB,cAAc,iBAAiB,WAAW,KAAK,MAAM,iBACxD;AACF;;AAGA,SAAgB,uBACd,MACA,OACS;CACT,OAAO,oBAAoB,MAAM,KAAK,KAAK,CAAC,kBAAkB,MAAM,KAAK;AAC3E"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LiFiStep, LiFiStepExtended } from "@lifi/sdk";
|
|
2
2
|
//#region src/utils/isContractCallStep.d.ts
|
|
3
|
-
declare function isContractCallStep(step: LiFiStepExtended | LiFiStep): boolean;
|
|
3
|
+
export declare function isContractCallStep(step: LiFiStepExtended | LiFiStep): boolean;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isContractCallStep };
|
|
6
5
|
//# sourceMappingURL=isContractCallStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isContractCallStep.d.ts","names":[],"sources":["../../../src/utils/isContractCallStep.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"isContractCallStep.d.ts","names":[],"sources":["../../../src/utils/isContractCallStep.ts"],"mappings":";;wBAEgB,mBAAmB,MAAM,mBAAmB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExtendedChain } from "@lifi/sdk";
|
|
2
2
|
//#region src/utils/isExtendedChain.d.ts
|
|
3
|
-
declare function isExtendedChain(chain: any): chain is ExtendedChain;
|
|
3
|
+
export declare function isExtendedChain(chain: any): chain is ExtendedChain;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isExtendedChain };
|
|
6
5
|
//# sourceMappingURL=isExtendedChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isExtendedChain.d.ts","names":[],"sources":["../../../src/utils/isExtendedChain.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"isExtendedChain.d.ts","names":[],"sources":["../../../src/utils/isExtendedChain.ts"],"mappings":";;wBAEgB,gBAAgB,aAAa,SAAS"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RelayerStep } from "../types.js";
|
|
2
|
-
import { ExtendedChain, LiFiStep, LiFiStepExtended } from "@lifi/sdk";
|
|
2
|
+
import { ExtendedChain, LiFiStep, LiFiStepExtended, TypedData } from "@lifi/sdk";
|
|
3
3
|
//#region src/utils/isGaslessStep.d.ts
|
|
4
|
-
|
|
4
|
+
/** Whether one typed-data entry is one a relayer must sign and submit. */
|
|
5
|
+
export declare function isGaslessTypedData(typedData: TypedData, chain?: ExtendedChain): boolean;
|
|
6
|
+
export declare function isGaslessStep(step: LiFiStepExtended | LiFiStep, chain?: ExtendedChain): step is RelayerStep;
|
|
5
7
|
//#endregion
|
|
6
|
-
export { isGaslessStep };
|
|
7
8
|
//# sourceMappingURL=isGaslessStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isGaslessStep.d.ts","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isGaslessStep.d.ts","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"mappings":";;;;wBASgB,mBACd,WAAW,WACX,QAAQ;wBAWM,cACd,MAAM,mBAAmB,UACzB,QAAQ,gBACP,QAAQ"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
//#region src/utils/isGaslessStep.ts
|
|
2
|
+
/** Whether one typed-data entry is one a relayer must sign and submit. */
|
|
3
|
+
function isGaslessTypedData(typedData, chain) {
|
|
4
|
+
const spender = typedData.message?.spender;
|
|
5
|
+
return typedData.primaryType === "PermitWitnessTransferFrom" || !!chain?.permit2 && typeof spender === "string" && spender.toLowerCase() === chain.permit2.toLowerCase();
|
|
6
|
+
}
|
|
2
7
|
function isGaslessStep(step, chain) {
|
|
3
|
-
return !!step.typedData?.some((
|
|
8
|
+
return !!step.typedData?.some((typedData) => isGaslessTypedData(typedData, chain));
|
|
4
9
|
}
|
|
5
10
|
//#endregion
|
|
6
|
-
export { isGaslessStep };
|
|
11
|
+
export { isGaslessStep, isGaslessTypedData };
|
|
7
12
|
|
|
8
13
|
//# sourceMappingURL=isGaslessStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isGaslessStep.js","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"isGaslessStep.js","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"sourcesContent":["import type {\n ExtendedChain,\n LiFiStep,\n LiFiStepExtended,\n TypedData,\n} from '@lifi/sdk'\nimport type { RelayerStep } from '../types.js'\n\n/** Whether one typed-data entry is one a relayer must sign and submit. */\nexport function isGaslessTypedData(\n typedData: TypedData,\n chain?: ExtendedChain\n): boolean {\n const spender = typedData.message?.spender\n return (\n typedData.primaryType === 'PermitWitnessTransferFrom' ||\n (!!chain?.permit2 &&\n typeof spender === 'string' &&\n spender.toLowerCase() === chain.permit2.toLowerCase())\n )\n}\n\nexport function isGaslessStep(\n step: LiFiStepExtended | LiFiStep,\n chain?: ExtendedChain\n): step is RelayerStep {\n return !!step.typedData?.some((typedData) =>\n isGaslessTypedData(typedData, chain)\n )\n}\n"],"mappings":";;AASA,SAAgB,mBACd,WACA,OACS;CACT,MAAM,UAAU,UAAU,SAAS;CACnC,OACE,UAAU,gBAAgB,+BACzB,CAAC,CAAC,OAAO,WACR,OAAO,YAAY,YACnB,QAAQ,YAAY,MAAM,MAAM,QAAQ,YAAY;AAE1D;AAEA,SAAgB,cACd,MACA,OACqB;CACrB,OAAO,CAAC,CAAC,KAAK,WAAW,MAAM,cAC7B,mBAAmB,WAAW,KAAK,CACrC;AACF"}
|
|
@@ -7,8 +7,7 @@ import { Hex } from "viem";
|
|
|
7
7
|
* Signature length is intentionally not validated: 65-byte, EIP-2098 compact
|
|
8
8
|
* and arbitrary-length smart account (ERC-1271) signatures are all valid.
|
|
9
9
|
*/
|
|
10
|
-
declare function isValidSignature(signature: Hex | null | undefined): signature is Hex;
|
|
11
|
-
declare function assertValidSignature(signature: Hex | null | undefined): asserts signature is Hex;
|
|
10
|
+
export declare function isValidSignature(signature: Hex | null | undefined): signature is Hex;
|
|
11
|
+
export declare function assertValidSignature(signature: Hex | null | undefined): asserts signature is Hex;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { assertValidSignature, isValidSignature };
|
|
14
13
|
//# sourceMappingURL=isValidSignature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidSignature.d.ts","names":[],"sources":["../../../src/utils/isValidSignature.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"isValidSignature.d.ts","names":[],"sources":["../../../src/utils/isValidSignature.ts"],"mappings":";;;;;;;;;wBAUgB,iBACd,WAAW,yBACV,aAAa;wBAIA,qBACd,WAAW,iCACF,aAAa"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//#region src/utils/isZeroAddress.d.ts
|
|
2
|
-
declare const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
3
|
-
declare const AlternativeAddressZero = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
4
|
-
declare const isZeroAddress: (address: string) => boolean;
|
|
2
|
+
export declare const AddressZero = "0x0000000000000000000000000000000000000000";
|
|
3
|
+
export declare const AlternativeAddressZero = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
4
|
+
export declare const isZeroAddress: (address: string) => boolean;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { AddressZero, AlternativeAddressZero, isZeroAddress };
|
|
7
6
|
//# sourceMappingURL=isZeroAddress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isZeroAddress.d.ts","names":[],"sources":["../../../src/utils/isZeroAddress.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"isZeroAddress.d.ts","names":[],"sources":["../../../src/utils/isZeroAddress.ts"],"mappings":";qBAAa;qBACA;qBAGA,gBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"median.d.ts","names":[],"sources":["../../../src/utils/median.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"median.d.ts","names":[],"sources":["../../../src/utils/median.ts"],"mappings":";qBAAa,SAAU"}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/version.d.ts
|
|
2
|
-
declare const name = "@lifi/sdk-provider-ethereum";
|
|
3
|
-
declare const version = "4.0
|
|
2
|
+
export declare const name = "@lifi/sdk-provider-ethereum";
|
|
3
|
+
export declare const version = "4.2.0";
|
|
4
4
|
//#endregion
|
|
5
|
-
export { name, version };
|
|
6
5
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";qBAAa;qBACA"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.0
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.2.0'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-ethereum",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "LI.FI Ethereum SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@lifi/sdk": "4.
|
|
32
|
-
"viem": "^2.56.
|
|
31
|
+
"@lifi/sdk": "4.8.0",
|
|
32
|
+
"viem": "^2.56.8"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
package/src/EthereumProvider.ts
CHANGED
|
@@ -5,6 +5,11 @@ import { resolveEthereumAddress } from './actions/resolveEthereumAddress.js'
|
|
|
5
5
|
import { EthereumStepExecutor } from './core/EthereumStepExecutor.js'
|
|
6
6
|
import type { EthereumProviderOptions, EthereumSDKProvider } from './types.js'
|
|
7
7
|
|
|
8
|
+
/** The wallet format without the checksum: a pasted address keeps its case. */
|
|
9
|
+
function isEthereumTokenAddress(address: string): boolean {
|
|
10
|
+
return isAddress(address, { strict: false })
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
export function EthereumProvider(
|
|
9
14
|
options?: EthereumProviderOptions
|
|
10
15
|
): EthereumSDKProvider {
|
|
@@ -17,6 +22,7 @@ export function EthereumProvider(
|
|
|
17
22
|
return _options
|
|
18
23
|
},
|
|
19
24
|
isAddress,
|
|
25
|
+
isTokenAddress: isEthereumTokenAddress,
|
|
20
26
|
resolveAddress: resolveEthereumAddress,
|
|
21
27
|
getBalance: getEthereumBalance,
|
|
22
28
|
getWalletClient: _options.getWalletClient,
|
|
@@ -24,6 +24,7 @@ import { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.j
|
|
|
24
24
|
import { EthereumCheckBalanceTask } from './tasks/EthereumCheckBalanceTask.js'
|
|
25
25
|
import { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'
|
|
26
26
|
import { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'
|
|
27
|
+
import { EthereumPermit2AllowanceTask } from './tasks/EthereumPermit2AllowanceTask.js'
|
|
27
28
|
import { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'
|
|
28
29
|
import { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'
|
|
29
30
|
import { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'
|
|
@@ -143,6 +144,7 @@ export class EthereumStepExecutor extends BaseStepExecutor {
|
|
|
143
144
|
new EthereumResetAllowanceTask(),
|
|
144
145
|
new EthereumSetAllowanceTask(),
|
|
145
146
|
new EthereumCheckBalanceTask(),
|
|
147
|
+
new EthereumPermit2AllowanceTask(),
|
|
146
148
|
new EthereumPrepareTransactionTask(),
|
|
147
149
|
new EthereumSignAndExecuteTask(),
|
|
148
150
|
new EthereumWaitForTransactionTask(),
|
|
@@ -3,13 +3,13 @@ import type { Address } from 'viem'
|
|
|
3
3
|
import { getAccountCode } from '../../actions/getAccountCode.js'
|
|
4
4
|
import { isSmartContractWalletCode } from '../../actions/isSmartContractWallet.js'
|
|
5
5
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
6
|
-
import {
|
|
6
|
+
import { isPermit2AllowanceLane } from '../../utils/getTypedDataLane.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Skips the outer-tx gas check for steps where the wallet doesn't fund it:
|
|
10
10
|
* smart-contract wallets (Safe Apps, 4337, 7579, …) where the
|
|
11
|
-
* executor / bundler / paymaster pays, and
|
|
12
|
-
* and non-included native fees are still verified.
|
|
11
|
+
* executor / bundler / paymaster pays, and typed-data steps the user does not
|
|
12
|
+
* fund. Source amount and non-included native fees are still verified.
|
|
13
13
|
*
|
|
14
14
|
* Skip-bias is intentional: a wrong skip is caught by the wallet rejecting
|
|
15
15
|
* the tx; a wrong enforce blocks a tx that would have succeeded.
|
|
@@ -18,11 +18,10 @@ export class EthereumCheckBalanceTask extends CheckBalanceTask {
|
|
|
18
18
|
protected override async getCheckBalanceOptions(
|
|
19
19
|
context: EthereumStepExecutorContext
|
|
20
20
|
): Promise<CheckBalanceOptions> {
|
|
21
|
-
const { client, step } = context
|
|
21
|
+
const { client, step, fromChain } = context
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (isRelayerStep(step)) {
|
|
23
|
+
const userFundsTransaction = isPermit2AllowanceLane(step, fromChain)
|
|
24
|
+
if (step.typedData?.length && !userFundsTransaction) {
|
|
26
25
|
return { walletPaysGas: false }
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseStepExecutionTask,
|
|
3
|
-
type SignedTypedData,
|
|
4
|
-
type TaskResult,
|
|
5
|
-
} from '@lifi/sdk'
|
|
6
|
-
import { signTypedData } from 'viem/actions'
|
|
7
|
-
import { getAction } from 'viem/utils'
|
|
1
|
+
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
8
2
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
9
3
|
import { getDomainChainId } from '../../utils/getDomainChainId.js'
|
|
10
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getTypedDataInLane,
|
|
6
|
+
getTypedDataLane,
|
|
7
|
+
isPermit2AllowanceLane,
|
|
8
|
+
} from '../../utils/getTypedDataLane.js'
|
|
9
|
+
import { signTypedDataEntries } from './helpers/signTypedDataEntries.js'
|
|
11
10
|
|
|
12
11
|
export class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
13
12
|
override async shouldRun(
|
|
14
13
|
context: EthereumStepExecutorContext
|
|
15
14
|
): Promise<boolean> {
|
|
16
|
-
const { step, disableMessageSigning } = context
|
|
15
|
+
const { step, fromChain, disableMessageSigning } = context
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
(
|
|
17
|
+
return (
|
|
18
|
+
!!step.typedData?.some(
|
|
19
|
+
(typedData) =>
|
|
20
|
+
getTypedDataLane(typedData, fromChain) === 'native-permit'
|
|
21
|
+
) && !disableMessageSigning
|
|
20
22
|
)
|
|
21
|
-
|
|
22
|
-
return !!permitTypedData?.length && !disableMessageSigning
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
26
|
-
const {
|
|
27
|
-
step,
|
|
28
|
-
statusManager,
|
|
29
|
-
allowUserInteraction,
|
|
30
|
-
checkClient,
|
|
31
|
-
signedTypedData: currentSignedTypedData,
|
|
32
|
-
} = context
|
|
26
|
+
const { step, fromChain, statusManager } = context
|
|
33
27
|
|
|
34
28
|
const action = statusManager.initializeAction({
|
|
35
29
|
step,
|
|
@@ -38,59 +32,33 @@ export class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
|
38
32
|
status: 'STARTED',
|
|
39
33
|
})
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
const permitTypedData =
|
|
43
|
-
step.typedData?.filter(
|
|
44
|
-
(typedData) => typedData.primaryType === 'Permit'
|
|
45
|
-
) ?? []
|
|
46
|
-
|
|
47
|
-
const signedTypedData = [...currentSignedTypedData]
|
|
48
|
-
for (const typedData of permitTypedData) {
|
|
49
|
-
statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')
|
|
35
|
+
const permitTypedData = getTypedDataInLane(step, 'native-permit', fromChain)
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// Switch to the permit's chain if needed
|
|
59
|
-
const permitClient = await checkClient(step, typedDataChainId)
|
|
60
|
-
if (!permitClient) {
|
|
61
|
-
return { status: 'PAUSED' }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const signature = await getAction(
|
|
65
|
-
permitClient,
|
|
66
|
-
signTypedData,
|
|
67
|
-
'signTypedData'
|
|
68
|
-
)({
|
|
69
|
-
account: permitClient.account!,
|
|
70
|
-
domain: typedData.domain,
|
|
71
|
-
types: typedData.types,
|
|
72
|
-
primaryType: typedData.primaryType,
|
|
73
|
-
message: typedData.message,
|
|
74
|
-
})
|
|
75
|
-
assertValidSignature(signature)
|
|
76
|
-
const signedPermit: SignedTypedData = {
|
|
77
|
-
...typedData,
|
|
78
|
-
signature,
|
|
79
|
-
}
|
|
80
|
-
signedTypedData.push(signedPermit)
|
|
37
|
+
const result = await signTypedDataEntries(
|
|
38
|
+
context,
|
|
39
|
+
permitTypedData,
|
|
40
|
+
action.type
|
|
41
|
+
)
|
|
42
|
+
if (result.status === 'PAUSED') {
|
|
43
|
+
return { status: 'PAUSED' }
|
|
81
44
|
}
|
|
45
|
+
const { signedTypedData } = result
|
|
82
46
|
|
|
83
|
-
// Check if there's a signed permit for the source transaction chain
|
|
84
47
|
const matchingPermit = signedTypedData.find(
|
|
85
|
-
(
|
|
86
|
-
|
|
48
|
+
(entry) =>
|
|
49
|
+
entry.primaryType === 'Permit' &&
|
|
50
|
+
getDomainChainId(entry.domain) === step.action.fromChainId
|
|
87
51
|
)
|
|
88
52
|
|
|
89
53
|
statusManager.updateAction(step, action.type, 'DONE')
|
|
90
54
|
|
|
91
55
|
return {
|
|
92
56
|
status: 'COMPLETED',
|
|
93
|
-
context: {
|
|
57
|
+
context: {
|
|
58
|
+
signedTypedData,
|
|
59
|
+
hasMatchingPermit:
|
|
60
|
+
!!matchingPermit && !isPermit2AllowanceLane(step, fromChain),
|
|
61
|
+
},
|
|
94
62
|
}
|
|
95
63
|
}
|
|
96
64
|
}
|
|
@@ -10,6 +10,7 @@ import { getNativePermit } from '../../permits/getNativePermit.js'
|
|
|
10
10
|
import { isNativePermitValid } from '../../permits/isNativePermitValid.js'
|
|
11
11
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
12
12
|
import { getActionWithFallback } from '../../utils/getActionWithFallback.js'
|
|
13
|
+
import { isPermit2AllowanceLane } from '../../utils/getTypedDataLane.js'
|
|
13
14
|
import { isValidSignature } from '../../utils/isValidSignature.js'
|
|
14
15
|
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
15
16
|
|
|
@@ -29,6 +30,10 @@ export class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
|
29
30
|
return false
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
if (isPermit2AllowanceLane(step, fromChain)) {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const executionStrategy = await getEthereumExecutionStrategy(context)
|
|
33
38
|
const batchingSupported = executionStrategy === 'batched'
|
|
34
39
|
// Check if proxy contract is available and message signing is not disabled, also not available for atomic batch
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
2
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
3
|
+
import {
|
|
4
|
+
getTypedDataInLane,
|
|
5
|
+
isPermit2AllowanceLane,
|
|
6
|
+
} from '../../utils/getTypedDataLane.js'
|
|
7
|
+
import { signTypedDataEntries } from './helpers/signTypedDataEntries.js'
|
|
8
|
+
|
|
9
|
+
/** Signs the Permit2 allowances a caller attached to its own step, before prepare. */
|
|
10
|
+
export class EthereumPermit2AllowanceTask extends BaseStepExecutionTask {
|
|
11
|
+
override async shouldRun(
|
|
12
|
+
context: EthereumStepExecutorContext
|
|
13
|
+
): Promise<boolean> {
|
|
14
|
+
const { step, fromChain, disableMessageSigning } = context
|
|
15
|
+
|
|
16
|
+
return isPermit2AllowanceLane(step, fromChain) && !disableMessageSigning
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
20
|
+
const { step, fromChain, statusManager } = context
|
|
21
|
+
|
|
22
|
+
const action = statusManager.initializeAction({
|
|
23
|
+
step,
|
|
24
|
+
type: 'PERMIT',
|
|
25
|
+
chainId: step.action.fromChainId,
|
|
26
|
+
status: 'STARTED',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const allowanceTypedData = getTypedDataInLane(
|
|
30
|
+
step,
|
|
31
|
+
'permit2-allowance',
|
|
32
|
+
fromChain
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// `ACTION_REQUIRED`, not `MESSAGE_REQUIRED`: the widget maps no `PERMIT`
|
|
36
|
+
// text for it. Pinned by `emits exactly STARTED, ACTION_REQUIRED and DONE`.
|
|
37
|
+
const result = await signTypedDataEntries(
|
|
38
|
+
context,
|
|
39
|
+
allowanceTypedData,
|
|
40
|
+
action.type
|
|
41
|
+
)
|
|
42
|
+
if (result.status === 'PAUSED') {
|
|
43
|
+
return { status: 'PAUSED' }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
status: 'COMPLETED',
|
|
50
|
+
context: { signedTypedData: result.signedTypedData },
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -10,6 +10,7 @@ import { getMaxPriorityFeePerGas } from '../../actions/getMaxPriorityFeePerGas.j
|
|
|
10
10
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
11
11
|
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
12
12
|
import { getUpdatedStep } from './helpers/getUpdatedStep.js'
|
|
13
|
+
import { preservePermit2Allowances } from './helpers/preservePermit2Allowances.js'
|
|
13
14
|
|
|
14
15
|
export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
15
16
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
@@ -23,6 +24,7 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
23
24
|
isBridgeExecution,
|
|
24
25
|
signedTypedData,
|
|
25
26
|
ethereumClient,
|
|
27
|
+
fromChain,
|
|
26
28
|
} = context
|
|
27
29
|
|
|
28
30
|
const action = statusManager.findAction(
|
|
@@ -41,6 +43,7 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
41
43
|
const updatedStep = await getUpdatedStep(
|
|
42
44
|
client,
|
|
43
45
|
step,
|
|
46
|
+
fromChain,
|
|
44
47
|
executionOptions,
|
|
45
48
|
signedTypedData
|
|
46
49
|
)
|
|
@@ -53,13 +56,19 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
53
56
|
executionOptions
|
|
54
57
|
)
|
|
55
58
|
|
|
59
|
+
const answeredTypedData = updatedStep.typedData ?? step.typedData
|
|
60
|
+
|
|
56
61
|
Object.assign(step, {
|
|
57
62
|
...comparedStep,
|
|
58
63
|
execution: step.execution,
|
|
59
|
-
typedData:
|
|
64
|
+
typedData: preservePermit2Allowances(
|
|
65
|
+
step,
|
|
66
|
+
updatedStep.typedData,
|
|
67
|
+
fromChain
|
|
68
|
+
),
|
|
60
69
|
})
|
|
61
70
|
|
|
62
|
-
if (!step.transactionRequest && !
|
|
71
|
+
if (!step.transactionRequest && !answeredTypedData?.length) {
|
|
63
72
|
throw new TransactionError(
|
|
64
73
|
LiFiErrorCode.TransactionUnprepared,
|
|
65
74
|
'Unable to prepare transaction. Transaction request is not found.'
|