@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEthereumExecutionStrategy.js","names":[],"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 {
|
|
1
|
+
{"version":3,"file":"getEthereumExecutionStrategy.js","names":[],"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 { isPermit2AllowanceLane } from '../../../utils/getTypedDataLane.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 *\n * `afterPrepare` marks the single call from `EthereumPrepareTransactionTask`.\n * The step has just been re-quoted, so the cached verdict is stale and, for the\n * first time, the absence of a `transactionRequest` is final rather than merely\n * not-yet-known. Both effects come from that one fact, which is why they share\n * a parameter.\n */\nexport async function getEthereumExecutionStrategy(\n context: EthereumStepExecutorContext,\n afterPrepare: 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 (!afterPrepare && executionStrategyContext) {\n return executionStrategyContext\n }\n\n const atomicityNotReady = !!retryParams?.atomicityNotReady\n // Declared by the backend. It is the only signal that reaches the allowance\n // tasks, which run before a `transactionRequest` can exist.\n if (step.executionType === 'message') {\n return 'relayed'\n }\n\n // Typed data the user does not sign for its own send: gasless, `Order`,\n // Hyperliquid. A Permit2 allowance is the one shape excluded, because its signer\n // and its sender are the same person.\n if (step.typedData?.length && !isPermit2AllowanceLane(step, fromChain)) {\n return 'relayed'\n }\n\n // After prepare, missing means never: the step carries typed data and the user\n // has nothing to send, so the relayer is the only lane that can execute it.\n // This is a derivation, not a guess — no other strategy can run such a step.\n //\n // Before prepare the same expression is unsound. A Permit2 allowance that will\n // receive its transaction from `/stepTransaction` is indistinguishable from\n // one that never will, and calling it relayed there costs the step its\n // EIP-5792 batching.\n if (afterPrepare && step.typedData?.length && !step.transactionRequest) {\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":";;;;;;;;;;;;;;AAgBA,eAAsB,6BACpB,SACA,eAAwB,OACQ;CAChC,MAAM,EACJ,MACA,aACA,aACA,QACA,WACA,gBACA,mBAAmB,6BACjB;CAEJ,IAAI,CAAC,gBAAgB,0BACnB,OAAO;CAGT,MAAM,oBAAoB,CAAC,CAAC,aAAa;CAGzC,IAAI,KAAK,kBAAkB,WACzB,OAAO;CAMT,IAAI,KAAK,WAAW,UAAU,CAAC,uBAAuB,MAAM,SAAS,GACnE,OAAO;CAWT,IAAI,gBAAgB,KAAK,WAAW,UAAU,CAAC,KAAK,oBAClD,OAAO;CAGT,IAAI,qBAAqB,KAAK,SAAS,YACrC,OAAO;CAGT,MAAM,gBAAiB,MAAM,YAAY,IAAI,KAAM;CAKnD,OAAO,MAJyB,oBAAoB,QAAQ;EAC1D,QAAQ;EACR,SAAS,UAAU;CACrB,CAAC,IAC0B,YAAY;AACzC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExtendedChain } from "@lifi/sdk";
|
|
2
2
|
import { Hash } from "viem";
|
|
3
3
|
//#region src/core/tasks/helpers/getTxLink.d.ts
|
|
4
|
-
declare const getTxLink: (chain: ExtendedChain, txHash: Hash) => string;
|
|
4
|
+
export declare const getTxLink: (chain: ExtendedChain, txHash: Hash) => string;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { getTxLink };
|
|
7
6
|
//# sourceMappingURL=getTxLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTxLink.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getTxLink.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getTxLink.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getTxLink.ts"],"mappings":";;;qBAGa,YAAa,OAAO,eAAe,QAAQ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExecutionOptions, LiFiStepExtended, SDKClient, SignedTypedData } from "@lifi/sdk";
|
|
1
|
+
import { ExecutionOptions, ExtendedChain, LiFiStepExtended, SDKClient, SignedTypedData } from "@lifi/sdk";
|
|
2
2
|
//#region src/core/tasks/helpers/getUpdatedStep.d.ts
|
|
3
|
-
|
|
3
|
+
/** Re-quotes the step through the endpoint that matches how it will execute. */
|
|
4
|
+
export declare const getUpdatedStep: (client: SDKClient, step: LiFiStepExtended, fromChain: ExtendedChain, executionOptions?: ExecutionOptions, signedTypedData?: SignedTypedData[]) => Promise<LiFiStepExtended>;
|
|
4
5
|
//#endregion
|
|
5
|
-
export { getUpdatedStep };
|
|
6
6
|
//# sourceMappingURL=getUpdatedStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUpdatedStep.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getUpdatedStep.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"mappings":";;;qBAmBa,iBACX,QAAQ,WACR,MAAM,kBACN,WAAW,eACX,mBAAmB,kBACnB,kBAAkB,sBACjB,QAAQ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isGaslessStep } from "../../../utils/isGaslessStep.js";
|
|
2
2
|
import { PatcherMagicNumber } from "../../../permits/constants.js";
|
|
3
3
|
import { isContractCallStep } from "../../../utils/isContractCallStep.js";
|
|
4
|
-
import { isGaslessStep } from "../../../utils/isGaslessStep.js";
|
|
5
4
|
import { LiFiErrorCode, TransactionError, convertQuoteToRoute, getContractCallsQuote, getRelayerQuote, getStepTransaction, patchContractCalls } from "@lifi/sdk";
|
|
6
5
|
//#region src/core/tasks/helpers/getUpdatedStep.ts
|
|
7
|
-
|
|
6
|
+
/** Re-quotes the step through the endpoint that matches how it will execute. */
|
|
7
|
+
const getUpdatedStep = async (client, step, fromChain, executionOptions, signedTypedData) => {
|
|
8
8
|
if (isContractCallStep(step)) return getContractCallUpdatedStep(client, step, executionOptions);
|
|
9
|
-
if (
|
|
9
|
+
if (isGaslessStep(step, fromChain)) return getRelayerUpdatedStep(client, step);
|
|
10
10
|
return getStandardUpdatedStep(client, step, signedTypedData);
|
|
11
11
|
};
|
|
12
12
|
const getContractCallUpdatedStep = async (client, step, executionOptions) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUpdatedStep.js","names":[],"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'\
|
|
1
|
+
{"version":3,"file":"getUpdatedStep.js","names":[],"sources":["../../../../../src/core/tasks/helpers/getUpdatedStep.ts"],"sourcesContent":["import {\n convertQuoteToRoute,\n type ExecutionOptions,\n type ExtendedChain,\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'\n\n/** Re-quotes the step through the endpoint that matches how it will execute. */\nexport const getUpdatedStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n fromChain: ExtendedChain,\n executionOptions?: ExecutionOptions,\n signedTypedData?: SignedTypedData[]\n): Promise<LiFiStepExtended> => {\n if (isContractCallStep(step)) {\n return getContractCallUpdatedStep(client, step, executionOptions)\n }\n // Do NOT substitute `hasRelayerMessage` for `isGaslessStep`: an `Order` retry\n // would fetch a relayer quote instead of `/advanced/stepTransaction`. Pinned\n // by `re-quotes an Order step ...` in `getUpdatedStep.unit.spec.ts`.\n if (isGaslessStep(step, fromChain)) {\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":";;;;;;AAmBA,MAAa,iBAAiB,OAC5B,QACA,MACA,WACA,kBACA,oBAC8B;CAC9B,IAAI,mBAAmB,IAAI,GACzB,OAAO,2BAA2B,QAAQ,MAAM,gBAAgB;CAKlE,IAAI,cAAc,MAAM,SAAS,GAC/B,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,IAAI,iBACR,cAAc,uBACd,8DACF;CAGF,IAAI,oBAAoB,SAAS;EAC/B,MAAM,uBAAuB,MAAM,mBACjC,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,iBAAiB,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,MAAM,sBAAsB,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,GANY,oBAAoB,mBAAmB,EACnD,kCACE,kBAAkB,iCACtB,CAGS,CAAC,CAAC,MAAM;EACf,IAAI,KAAK;CACX;AACF;AAEA,MAAM,wBAAwB,OAC5B,QACA,SAC8B;CAY9B,OAAO;EACL,GAAG,MAZ4B,gBAAgB,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;CACtC,MAAM,SAAS,yBAAyB,SACpC;EAAE,GAAG;EAAU,WAAW;CAAwB,IAClD;CACJ,OAAO,mBAAmB,QAAQ,MAAM;AAC1C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
|
+
//#region src/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts
|
|
3
|
+
/** Whether this execution carries a caller-supplied Permit2 allowance, declared or signed. */
|
|
4
|
+
export declare function hasPermit2AllowanceInFlight(context: EthereumStepExecutorContext): boolean;
|
|
5
|
+
/** `isPermit2AllowanceLane`, for gates that run after prepare may have replaced `step.typedData`. */
|
|
6
|
+
export declare function isPermit2AllowanceLaneInFlight(context: EthereumStepExecutorContext): boolean;
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=hasPermit2AllowanceInFlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasPermit2AllowanceInFlight.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/hasPermit2AllowanceInFlight.ts"],"mappings":";;;wBAQgB,4BACd,SAAS;;wBAcK,+BACd,SAAS"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getTypedDataLane, hasPermit2Allowance, hasRelayerMessage } from "../../../utils/getTypedDataLane.js";
|
|
2
|
+
//#region src/core/tasks/helpers/hasPermit2AllowanceInFlight.ts
|
|
3
|
+
/** Whether this execution carries a caller-supplied Permit2 allowance, declared or signed. */
|
|
4
|
+
function hasPermit2AllowanceInFlight(context) {
|
|
5
|
+
const { step, fromChain, signedTypedData } = context;
|
|
6
|
+
return hasPermit2Allowance(step, fromChain) || signedTypedData.some((typedData) => getTypedDataLane(typedData, fromChain) === "permit2-allowance");
|
|
7
|
+
}
|
|
8
|
+
/** `isPermit2AllowanceLane`, for gates that run after prepare may have replaced `step.typedData`. */
|
|
9
|
+
function isPermit2AllowanceLaneInFlight(context) {
|
|
10
|
+
return hasPermit2AllowanceInFlight(context) && !hasRelayerMessage(context.step, context.fromChain);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { hasPermit2AllowanceInFlight, isPermit2AllowanceLaneInFlight };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=hasPermit2AllowanceInFlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasPermit2AllowanceInFlight.js","names":[],"sources":["../../../../../src/core/tasks/helpers/hasPermit2AllowanceInFlight.ts"],"sourcesContent":["import type { EthereumStepExecutorContext } from '../../../types.js'\nimport {\n getTypedDataLane,\n hasPermit2Allowance,\n hasRelayerMessage,\n} from '../../../utils/getTypedDataLane.js'\n\n/** Whether this execution carries a caller-supplied Permit2 allowance, declared or signed. */\nexport function hasPermit2AllowanceInFlight(\n context: EthereumStepExecutorContext\n): boolean {\n const { step, fromChain, signedTypedData } = context\n\n return (\n hasPermit2Allowance(step, fromChain) ||\n signedTypedData.some(\n (typedData) =>\n getTypedDataLane(typedData, fromChain) === 'permit2-allowance'\n )\n )\n}\n\n/** `isPermit2AllowanceLane`, for gates that run after prepare may have replaced `step.typedData`. */\nexport function isPermit2AllowanceLaneInFlight(\n context: EthereumStepExecutorContext\n): boolean {\n return (\n hasPermit2AllowanceInFlight(context) &&\n !hasRelayerMessage(context.step, context.fromChain)\n )\n}\n"],"mappings":";;;AAQA,SAAgB,4BACd,SACS;CACT,MAAM,EAAE,MAAM,WAAW,oBAAoB;CAE7C,OACE,oBAAoB,MAAM,SAAS,KACnC,gBAAgB,MACb,cACC,iBAAiB,WAAW,SAAS,MAAM,mBAC/C;AAEJ;;AAGA,SAAgB,+BACd,SACS;CACT,OACE,4BAA4B,OAAO,KACnC,CAAC,kBAAkB,QAAQ,MAAM,QAAQ,SAAS;AAEtD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SignedTypedData, TypedData } from "@lifi/sdk";
|
|
2
|
+
//#region src/core/tasks/helpers/isTypedDataAlreadySigned.d.ts
|
|
3
|
+
/** Whether `signedTypedData` already holds a signature for this exact entry. */
|
|
4
|
+
export declare function isTypedDataAlreadySigned(signedTypedData: SignedTypedData[], typedData: TypedData): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
//# sourceMappingURL=isTypedDataAlreadySigned.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTypedDataAlreadySigned.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/isTypedDataAlreadySigned.ts"],"mappings":";;;wBAIgB,yBACd,iBAAiB,mBACjB,WAAW"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isValidSignature } from "../../../utils/isValidSignature.js";
|
|
2
|
+
//#region src/core/tasks/helpers/isTypedDataAlreadySigned.ts
|
|
3
|
+
/** Whether `signedTypedData` already holds a signature for this exact entry. */
|
|
4
|
+
function isTypedDataAlreadySigned(signedTypedData, typedData) {
|
|
5
|
+
if (typedData.primaryType === "Permit") return false;
|
|
6
|
+
return signedTypedData.some((signed) => signed.primaryType === typedData.primaryType && isValidSignature(signed.signature) && isSameValue(signed.domain, typedData.domain) && isSameValue(signed.message, typedData.message));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `domain` and `message` are decoded JSON, so compare them structurally: a
|
|
10
|
+
* round trip through the API rebuilds the objects, and `JSON.stringify` both
|
|
11
|
+
* depends on key order and throws on a `bigint`. Scalars compare by string
|
|
12
|
+
* form, because `1`, `1n` and `'1'` are one EIP-712 value.
|
|
13
|
+
*/
|
|
14
|
+
function isSameValue(a, b) {
|
|
15
|
+
if (a === b) return true;
|
|
16
|
+
if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((item, index) => isSameValue(item, b[index]));
|
|
17
|
+
if (isRecord(a) && isRecord(b)) {
|
|
18
|
+
const keys = Object.keys(a);
|
|
19
|
+
return keys.length === Object.keys(b).length && keys.every((key) => key in b && isSameValue(a[key], b[key]));
|
|
20
|
+
}
|
|
21
|
+
if (a == null || b == null) return false;
|
|
22
|
+
return String(a) === String(b);
|
|
23
|
+
}
|
|
24
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { isTypedDataAlreadySigned };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=isTypedDataAlreadySigned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTypedDataAlreadySigned.js","names":[],"sources":["../../../../../src/core/tasks/helpers/isTypedDataAlreadySigned.ts"],"sourcesContent":["import type { SignedTypedData, TypedData } from '@lifi/sdk'\nimport { isValidSignature } from '../../../utils/isValidSignature.js'\n\n/** Whether `signedTypedData` already holds a signature for this exact entry. */\nexport function isTypedDataAlreadySigned(\n signedTypedData: SignedTypedData[],\n typedData: TypedData\n): boolean {\n // `Permit` stays with `isNativePermitValid`, which also checks the deadline,\n // the amount and the salt. Equality alone would drop those checks.\n if (typedData.primaryType === 'Permit') {\n return false\n }\n\n return signedTypedData.some(\n (signed) =>\n signed.primaryType === typedData.primaryType &&\n isValidSignature(signed.signature) &&\n isSameValue(signed.domain, typedData.domain) &&\n isSameValue(signed.message, typedData.message)\n )\n}\n\n/**\n * `domain` and `message` are decoded JSON, so compare them structurally: a\n * round trip through the API rebuilds the objects, and `JSON.stringify` both\n * depends on key order and throws on a `bigint`. Scalars compare by string\n * form, because `1`, `1n` and `'1'` are one EIP-712 value.\n */\nfunction isSameValue(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true\n }\n if (Array.isArray(a) || Array.isArray(b)) {\n return (\n Array.isArray(a) &&\n Array.isArray(b) &&\n a.length === b.length &&\n a.every((item, index) => isSameValue(item, b[index]))\n )\n }\n if (isRecord(a) && isRecord(b)) {\n const keys = Object.keys(a)\n return (\n keys.length === Object.keys(b).length &&\n keys.every((key) => key in b && isSameValue(a[key], b[key]))\n )\n }\n if (a == null || b == null) {\n return false\n }\n return String(a) === String(b)\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null\n"],"mappings":";;;AAIA,SAAgB,yBACd,iBACA,WACS;CAGT,IAAI,UAAU,gBAAgB,UAC5B,OAAO;CAGT,OAAO,gBAAgB,MACpB,WACC,OAAO,gBAAgB,UAAU,eACjC,iBAAiB,OAAO,SAAS,KACjC,YAAY,OAAO,QAAQ,UAAU,MAAM,KAC3C,YAAY,OAAO,SAAS,UAAU,OAAO,CACjD;AACF;;;;;;;AAQA,SAAS,YAAY,GAAY,GAAqB;CACpD,IAAI,MAAM,GACR,OAAO;CAET,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GACrC,OACE,MAAM,QAAQ,CAAC,KACf,MAAM,QAAQ,CAAC,KACf,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,MAAM,UAAU,YAAY,MAAM,EAAE,MAAM,CAAC;CAGxD,IAAI,SAAS,CAAC,KAAK,SAAS,CAAC,GAAG;EAC9B,MAAM,OAAO,OAAO,KAAK,CAAC;EAC1B,OACE,KAAK,WAAW,OAAO,KAAK,CAAC,CAAC,CAAC,UAC/B,KAAK,OAAO,QAAQ,OAAO,KAAK,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC;CAE/D;CACA,IAAI,KAAK,QAAQ,KAAK,MACpB,OAAO;CAET,OAAO,OAAO,CAAC,MAAM,OAAO,CAAC;AAC/B;AAEA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExtendedChain, LiFiStep, LiFiStepExtended, TypedData } from "@lifi/sdk";
|
|
2
|
+
//#region src/core/tasks/helpers/preservePermit2Allowances.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* `??` keeps the Permit2 allowance only when the answer omits `typedData`. An
|
|
5
|
+
* answer that carries entries of its own — native permits, or `[]` from a
|
|
6
|
+
* third-party backend — would drop it, and `signedTypedData` resets per
|
|
7
|
+
* `executeStep`, so a retry would let the Permit2 proxy hijack the calldata.
|
|
8
|
+
*/
|
|
9
|
+
export declare function preservePermit2Allowances(step: LiFiStepExtended | LiFiStep, updatedTypedData: TypedData[] | undefined, chain: ExtendedChain): TypedData[] | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
//# sourceMappingURL=preservePermit2Allowances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preservePermit2Allowances.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/preservePermit2Allowances.ts"],"mappings":";;;;;;;;wBAkBgB,0BACd,MAAM,mBAAmB,UACzB,kBAAkB,yBAClB,OAAO,gBACN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getTypedDataInLane, getTypedDataLane, isPermit2AllowanceLane } from "../../../utils/getTypedDataLane.js";
|
|
2
|
+
//#region src/core/tasks/helpers/preservePermit2Allowances.ts
|
|
3
|
+
/**
|
|
4
|
+
* `??` keeps the Permit2 allowance only when the answer omits `typedData`. An
|
|
5
|
+
* answer that carries entries of its own — native permits, or `[]` from a
|
|
6
|
+
* third-party backend — would drop it, and `signedTypedData` resets per
|
|
7
|
+
* `executeStep`, so a retry would let the Permit2 proxy hijack the calldata.
|
|
8
|
+
*/
|
|
9
|
+
function preservePermit2Allowances(step, updatedTypedData, chain) {
|
|
10
|
+
if (!updatedTypedData) return step.typedData;
|
|
11
|
+
if (!isPermit2AllowanceLane(step, chain)) return updatedTypedData;
|
|
12
|
+
if (updatedTypedData.some((typedData) => {
|
|
13
|
+
const lane = getTypedDataLane(typedData, chain);
|
|
14
|
+
return lane === "permit2-allowance" || lane === "relayer-message";
|
|
15
|
+
})) return updatedTypedData;
|
|
16
|
+
return [...updatedTypedData, ...getTypedDataInLane(step, "permit2-allowance", chain)];
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { preservePermit2Allowances };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=preservePermit2Allowances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preservePermit2Allowances.js","names":[],"sources":["../../../../../src/core/tasks/helpers/preservePermit2Allowances.ts"],"sourcesContent":["import type {\n ExtendedChain,\n LiFiStep,\n LiFiStepExtended,\n TypedData,\n} from '@lifi/sdk'\nimport {\n getTypedDataInLane,\n getTypedDataLane,\n isPermit2AllowanceLane,\n} from '../../../utils/getTypedDataLane.js'\n\n/**\n * `??` keeps the Permit2 allowance only when the answer omits `typedData`. An\n * answer that carries entries of its own — native permits, or `[]` from a\n * third-party backend — would drop it, and `signedTypedData` resets per\n * `executeStep`, so a retry would let the Permit2 proxy hijack the calldata.\n */\nexport function preservePermit2Allowances(\n step: LiFiStepExtended | LiFiStep,\n updatedTypedData: TypedData[] | undefined,\n chain: ExtendedChain\n): TypedData[] | undefined {\n if (!updatedTypedData) {\n return step.typedData\n }\n\n if (!isPermit2AllowanceLane(step, chain)) {\n return updatedTypedData\n }\n\n const answerDeclaresLane = updatedTypedData.some((typedData) => {\n const lane = getTypedDataLane(typedData, chain)\n return lane === 'permit2-allowance' || lane === 'relayer-message'\n })\n if (answerDeclaresLane) {\n return updatedTypedData\n }\n\n return [\n ...updatedTypedData,\n ...getTypedDataInLane(step, 'permit2-allowance', chain),\n ]\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,0BACd,MACA,kBACA,OACyB;CACzB,IAAI,CAAC,kBACH,OAAO,KAAK;CAGd,IAAI,CAAC,uBAAuB,MAAM,KAAK,GACrC,OAAO;CAOT,IAJ2B,iBAAiB,MAAM,cAAc;EAC9D,MAAM,OAAO,iBAAiB,WAAW,KAAK;EAC9C,OAAO,SAAS,uBAAuB,SAAS;CAClD,CACqB,GACnB,OAAO;CAGT,OAAO,CACL,GAAG,kBACH,GAAG,mBAAmB,MAAM,qBAAqB,KAAK,CACxD;AACF"}
|
|
@@ -21,7 +21,6 @@ import { TransactionMethodType } from "@lifi/sdk";
|
|
|
21
21
|
* one spender while the sign task routes to the other — turning a needless
|
|
22
22
|
* approval into a revert.
|
|
23
23
|
*/
|
|
24
|
-
declare const resolvePermit2Support: (context: EthereumStepExecutorContext, strategy: TransactionMethodType) => Promise<boolean>;
|
|
24
|
+
export declare const resolvePermit2Support: (context: EthereumStepExecutorContext, strategy: TransactionMethodType) => Promise<boolean>;
|
|
25
25
|
//#endregion
|
|
26
|
-
export { resolvePermit2Support };
|
|
27
26
|
//# sourceMappingURL=resolvePermit2Support.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePermit2Support.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/resolvePermit2Support.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resolvePermit2Support.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/resolvePermit2Support.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBAkDa,wBACX,SAAS,6BACT,UAAU,0BACT"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canAccountUsePermit2 } from "../../../permits/canAccountUsePermit2.js";
|
|
2
|
+
import { isPermit2AllowanceLaneInFlight } from "./hasPermit2AllowanceInFlight.js";
|
|
2
3
|
//#region src/core/tasks/helpers/resolvePermit2Support.ts
|
|
3
4
|
/**
|
|
4
5
|
* Cheap, synchronous part of the gate: does the step/chain combination allow
|
|
@@ -6,7 +7,7 @@ import { canAccountUsePermit2 } from "../../../permits/canAccountUsePermit2.js";
|
|
|
6
7
|
*/
|
|
7
8
|
const isPermit2SupportedForStep = (context, strategy) => {
|
|
8
9
|
const { step, fromChain, isFromNativeToken, disableMessageSigning } = context;
|
|
9
|
-
return !!fromChain.permit2 && !!fromChain.permit2Proxy && !isFromNativeToken && !disableMessageSigning && strategy !== "batched" && !!step.estimate.approvalAddress && !step.estimate.skipApproval && !step.estimate.skipPermit;
|
|
10
|
+
return !!fromChain.permit2 && !!fromChain.permit2Proxy && !isFromNativeToken && !disableMessageSigning && strategy !== "batched" && !!step.estimate.approvalAddress && !step.estimate.skipApproval && !step.estimate.skipPermit && !isPermit2AllowanceLaneInFlight(context);
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Whether this step should use the Permit2 signature flow.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePermit2Support.js","names":[],"sources":["../../../../../src/core/tasks/helpers/resolvePermit2Support.ts"],"sourcesContent":["import type { TransactionMethodType } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { canAccountUsePermit2 } from '../../../permits/canAccountUsePermit2.js'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\n\n/**\n * Cheap, synchronous part of the gate: does the step/chain combination allow\n * the Permit2 flow at all? Permit2 should not be available for atomic batch.\n */\nconst isPermit2SupportedForStep = (\n context: EthereumStepExecutorContext,\n strategy: TransactionMethodType\n): boolean => {\n const { step, fromChain, isFromNativeToken, disableMessageSigning } = context\n\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\n/**\n * Whether this step should use the Permit2 signature flow.\n *\n * Beyond the step/chain checks, the `standard` strategy also probes the\n * *signer*: code-bearing accounts send Permit2 down its EIP-1271 path, where\n * acceptance is implementation-specific — see {@link canAccountUsePermit2}.\n * Accounts that fail it fall back to approve + execute.\n *\n * Only `standard` consults the probe. `signPermit2Message` has one call site,\n * `EthereumStandardSignAndExecuteTask`, so that is the only flow where the SDK\n * produces the Permit2 signature itself. A relayed step has no approve +\n * execute fallback, so a verdict cannot rescue a failing account and would\n * break a working one — it must never move the spender off `fromChain.permit2`.\n *\n * The verdict is memoized on `context.permit2SignerSupported`, and a `false`\n * stays sticky, a failed lookup included. `TaskPipeline` threads one context\n * through every task, so a mid-run flip would let the allowance tasks approve\n * one spender while the sign task routes to the other — turning a needless\n * approval into a revert.\n */\nexport const resolvePermit2Support = async (\n context: EthereumStepExecutorContext,\n strategy: TransactionMethodType\n): Promise<boolean> => {\n if (!isPermit2SupportedForStep(context, strategy)) {\n return false\n }\n\n // Only `standard` consults the probe; `batched` is excluded above.\n if (strategy !== 'standard') {\n return true\n }\n\n const { client, step, fromChain, ethereumClient } = context\n const address = (step.action.fromAddress ??\n ethereumClient.account?.address) as Address | undefined\n if (!address) {\n return false\n }\n\n // Caching the promise is safe: `canAccountUsePermit2` never rejects.\n context.permit2SignerSupported ??= canAccountUsePermit2(client, {\n chainId: fromChain.id,\n address,\n })\n\n return context.permit2SignerSupported\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvePermit2Support.js","names":[],"sources":["../../../../../src/core/tasks/helpers/resolvePermit2Support.ts"],"sourcesContent":["import type { TransactionMethodType } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { canAccountUsePermit2 } from '../../../permits/canAccountUsePermit2.js'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\nimport { isPermit2AllowanceLaneInFlight } from './hasPermit2AllowanceInFlight.js'\n\n/**\n * Cheap, synchronous part of the gate: does the step/chain combination allow\n * the Permit2 flow at all? Permit2 should not be available for atomic batch.\n */\nconst isPermit2SupportedForStep = (\n context: EthereumStepExecutorContext,\n strategy: TransactionMethodType\n): boolean => {\n const { step, fromChain, isFromNativeToken, disableMessageSigning } = context\n\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 !isPermit2AllowanceLaneInFlight(context)\n )\n}\n\n/**\n * Whether this step should use the Permit2 signature flow.\n *\n * Beyond the step/chain checks, the `standard` strategy also probes the\n * *signer*: code-bearing accounts send Permit2 down its EIP-1271 path, where\n * acceptance is implementation-specific — see {@link canAccountUsePermit2}.\n * Accounts that fail it fall back to approve + execute.\n *\n * Only `standard` consults the probe. `signPermit2Message` has one call site,\n * `EthereumStandardSignAndExecuteTask`, so that is the only flow where the SDK\n * produces the Permit2 signature itself. A relayed step has no approve +\n * execute fallback, so a verdict cannot rescue a failing account and would\n * break a working one — it must never move the spender off `fromChain.permit2`.\n *\n * The verdict is memoized on `context.permit2SignerSupported`, and a `false`\n * stays sticky, a failed lookup included. `TaskPipeline` threads one context\n * through every task, so a mid-run flip would let the allowance tasks approve\n * one spender while the sign task routes to the other — turning a needless\n * approval into a revert.\n */\nexport const resolvePermit2Support = async (\n context: EthereumStepExecutorContext,\n strategy: TransactionMethodType\n): Promise<boolean> => {\n if (!isPermit2SupportedForStep(context, strategy)) {\n return false\n }\n\n // Only `standard` consults the probe; `batched` is excluded above.\n if (strategy !== 'standard') {\n return true\n }\n\n const { client, step, fromChain, ethereumClient } = context\n const address = (step.action.fromAddress ??\n ethereumClient.account?.address) as Address | undefined\n if (!address) {\n return false\n }\n\n // Caching the promise is safe: `canAccountUsePermit2` never rejects.\n context.permit2SignerSupported ??= canAccountUsePermit2(client, {\n chainId: fromChain.id,\n address,\n })\n\n return context.permit2SignerSupported\n}\n"],"mappings":";;;;;;;AAUA,MAAM,6BACJ,SACA,aACY;CACZ,MAAM,EAAE,MAAM,WAAW,mBAAmB,0BAA0B;CAEtE,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,cACf,CAAC,+BAA+B,OAAO;AAE3C;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB,OACnC,SACA,aACqB;CACrB,IAAI,CAAC,0BAA0B,SAAS,QAAQ,GAC9C,OAAO;CAIT,IAAI,aAAa,YACf,OAAO;CAGT,MAAM,EAAE,QAAQ,MAAM,WAAW,mBAAmB;CACpD,MAAM,UAAW,KAAK,OAAO,eAC3B,eAAe,SAAS;CAC1B,IAAI,CAAC,SACH,OAAO;CAIT,QAAQ,2BAA2B,qBAAqB,QAAQ;EAC9D,SAAS,UAAU;EACnB;CACF,CAAC;CAED,OAAO,QAAQ;AACjB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LiFiStepExtended, StatusManager } from "@lifi/sdk";
|
|
2
2
|
//#region src/core/tasks/helpers/shouldCheckForAllowance.d.ts
|
|
3
|
-
declare const shouldCheckForAllowance: (step: LiFiStepExtended, isBridgeExecution: boolean, isFromNativeToken: boolean, statusManager: StatusManager) => boolean;
|
|
3
|
+
export declare const shouldCheckForAllowance: (step: LiFiStepExtended, isBridgeExecution: boolean, isFromNativeToken: boolean, statusManager: StatusManager) => boolean;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { shouldCheckForAllowance };
|
|
6
5
|
//# sourceMappingURL=shouldCheckForAllowance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shouldCheckForAllowance.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/shouldCheckForAllowance.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"shouldCheckForAllowance.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/shouldCheckForAllowance.ts"],"mappings":";;qBAEa,0BACX,MAAM,kBACN,4BACA,4BACA,eAAe"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
2
|
import { SignedTypedData, TypedData } from "@lifi/sdk";
|
|
3
3
|
//#region src/core/tasks/helpers/signHyperliquidTypedData.d.ts
|
|
4
|
-
declare const signHyperliquidTypedData: (context: EthereumStepExecutorContext,
|
|
4
|
+
export declare const signHyperliquidTypedData: (context: EthereumStepExecutorContext, allowanceTypedData: TypedData[]) => Promise<SignedTypedData[] | undefined>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { signHyperliquidTypedData };
|
|
7
6
|
//# sourceMappingURL=signHyperliquidTypedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signHyperliquidTypedData.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/signHyperliquidTypedData.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"signHyperliquidTypedData.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/signHyperliquidTypedData.ts"],"mappings":";;;qBAaa,2BACX,SAAS,6BACT,oBAAoB,gBACnB,QAAQ"}
|
|
@@ -5,15 +5,15 @@ import { getOrCreateAgentWallet } from "../../../hyperliquid/agentWallet.js";
|
|
|
5
5
|
import { signTypedData } from "viem/actions";
|
|
6
6
|
import { getAction } from "viem/utils";
|
|
7
7
|
//#region src/core/tasks/helpers/signHyperliquidTypedData.ts
|
|
8
|
-
const signHyperliquidTypedData = async (context,
|
|
8
|
+
const signHyperliquidTypedData = async (context, allowanceTypedData) => {
|
|
9
9
|
const { step, fromChain, client, allowUserInteraction, checkClient, ethereumClient, getStorage } = context;
|
|
10
10
|
if (!allowUserInteraction) return;
|
|
11
11
|
const signedResults = [];
|
|
12
12
|
const ownerAddress = ethereumClient.account.address;
|
|
13
13
|
const storage = getStorage(client);
|
|
14
|
-
const existingAgentAddress =
|
|
14
|
+
const existingAgentAddress = allowanceTypedData.find(isApproveAgentMessage)?.message.agentAddress;
|
|
15
15
|
const { account: agentAccount, needsApproval, expiresAt } = await getOrCreateAgentWallet(storage, ownerAddress, existingAgentAddress);
|
|
16
|
-
for (const typedData of
|
|
16
|
+
for (const typedData of allowanceTypedData) if (isApproveAgentMessage(typedData)) {
|
|
17
17
|
if (!needsApproval) continue;
|
|
18
18
|
const message = {
|
|
19
19
|
...typedData.message,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signHyperliquidTypedData.js","names":[],"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'\nimport { assertValidSignature } from '../../../utils/isValidSignature.js'\n\nexport const signHyperliquidTypedData = async (\n context: EthereumStepExecutorContext,\n
|
|
1
|
+
{"version":3,"file":"signHyperliquidTypedData.js","names":[],"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'\nimport { assertValidSignature } from '../../../utils/isValidSignature.js'\n\nexport const signHyperliquidTypedData = async (\n context: EthereumStepExecutorContext,\n allowanceTypedData: 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 = allowanceTypedData.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 allowanceTypedData) {\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 assertValidSignature(signature)\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 assertValidSignature(signature)\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":";;;;;;;AAaA,MAAa,2BAA2B,OACtC,SACA,uBAC2C;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,mBAAmB,KAAK,qBACL,CAAC,EAAE,QAAQ;CAIrD,MAAM,EACJ,SAAS,cACT,eACA,cACE,MAAM,uBAAuB,SAAS,cAAc,oBAAoB;CAE5E,KAAK,MAAM,aAAa,oBACtB,IAAI,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,MAFtC,iBAAiB,UAAU,MAAM,KAAK,UAAU,EAEY;EAC9D,IAAI,CAAC,eACH;EAGF,MAAM,YAAY,MAAM,UACtB,eACA,eACA,eACF,CAAC,CAAC;GACA,SAAS,cAAc;GACvB,aAAa,UAAU;GACvB,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB;EACF,CAAC;EACD,qBAAqB,SAAS;EAC9B,cAAc,KAAK;GAAE,GAAG;GAAW;GAAS;EAAU,CAAC;CACzD,OAAO,IAAI,2BAA2B,SAAS,GAAG;EAIhD,MAAM,gBAAgB,MAAM,YAAY,MAFtC,iBAAiB,UAAU,MAAM,KAAK,UAAU,EAEY;EAC9D,IAAI,CAAC,eACH;EAGF,MAAM,YAAY,MAAM,UACtB,eACA,eACA,eACF,CAAC,CAAC;GACA,SAAS,cAAc;GACvB,aAAa,UAAU;GACvB,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB,SAAS,UAAU;EACrB,CAAC;EACD,qBAAqB,SAAS;EAC9B,cAAc,KAAK;GAAE,GAAG;GAAW;EAAU,CAAC;CAChD,OAAO,IAAI,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,13 @@
|
|
|
1
|
+
import { EthereumStepExecutorContext } from "../../../types.js";
|
|
2
|
+
import { ExecutionActionStatus, ExecutionActionType, SignedTypedData, TypedData } from "@lifi/sdk";
|
|
3
|
+
//#region src/core/tasks/helpers/signTypedDataEntries.d.ts
|
|
4
|
+
export type SignTypedDataEntriesResult = {
|
|
5
|
+
status: "PAUSED";
|
|
6
|
+
} | {
|
|
7
|
+
status: "COMPLETED";
|
|
8
|
+
signedTypedData: SignedTypedData[];
|
|
9
|
+
};
|
|
10
|
+
/** Signs the entries in order, switching chains per entry, and appends the signatures. */
|
|
11
|
+
export declare function signTypedDataEntries(context: EthereumStepExecutorContext, entries: TypedData[], actionType: ExecutionActionType, actionStatus?: ExecutionActionStatus): Promise<SignTypedDataEntriesResult>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=signTypedDataEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedDataEntries.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/signTypedDataEntries.ts"],"mappings":";;;YAYY;EACN;;EACA;EAAqB,iBAAiB;;;wBAGtB,qBACpB,SAAS,6BACT,SAAS,aACT,YAAY,qBACZ,eAAc,wBACb,QAAQ"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getDomainChainId } from "../../../utils/getDomainChainId.js";
|
|
2
|
+
import { assertValidSignature } from "../../../utils/isValidSignature.js";
|
|
3
|
+
import { signTypedData } from "viem/actions";
|
|
4
|
+
import { getAction } from "viem/utils";
|
|
5
|
+
//#region src/core/tasks/helpers/signTypedDataEntries.ts
|
|
6
|
+
/** Signs the entries in order, switching chains per entry, and appends the signatures. */
|
|
7
|
+
async function signTypedDataEntries(context, entries, actionType, actionStatus = "ACTION_REQUIRED") {
|
|
8
|
+
const { step, statusManager, allowUserInteraction, checkClient, signedTypedData: currentSignedTypedData } = context;
|
|
9
|
+
const signedTypedData = [...currentSignedTypedData];
|
|
10
|
+
if (entries.length) statusManager.updateAction(step, actionType, actionStatus);
|
|
11
|
+
for (const typedData of entries) {
|
|
12
|
+
if (!allowUserInteraction) return { status: "PAUSED" };
|
|
13
|
+
const client = await checkClient(step, getDomainChainId(typedData.domain) || step.action.fromChainId);
|
|
14
|
+
if (!client) return { status: "PAUSED" };
|
|
15
|
+
const signature = await getAction(client, signTypedData, "signTypedData")({
|
|
16
|
+
account: client.account,
|
|
17
|
+
domain: typedData.domain,
|
|
18
|
+
types: typedData.types,
|
|
19
|
+
primaryType: typedData.primaryType,
|
|
20
|
+
message: typedData.message
|
|
21
|
+
});
|
|
22
|
+
assertValidSignature(signature);
|
|
23
|
+
signedTypedData.push({
|
|
24
|
+
...typedData,
|
|
25
|
+
signature
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
status: "COMPLETED",
|
|
30
|
+
signedTypedData
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { signTypedDataEntries };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=signTypedDataEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedDataEntries.js","names":[],"sources":["../../../../../src/core/tasks/helpers/signTypedDataEntries.ts"],"sourcesContent":["import type {\n ExecutionActionStatus,\n ExecutionActionType,\n SignedTypedData,\n TypedData,\n} from '@lifi/sdk'\nimport { signTypedData } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport type { EthereumStepExecutorContext } from '../../../types.js'\nimport { getDomainChainId } from '../../../utils/getDomainChainId.js'\nimport { assertValidSignature } from '../../../utils/isValidSignature.js'\n\nexport type SignTypedDataEntriesResult =\n | { status: 'PAUSED' }\n | { status: 'COMPLETED'; signedTypedData: SignedTypedData[] }\n\n/** Signs the entries in order, switching chains per entry, and appends the signatures. */\nexport async function signTypedDataEntries(\n context: EthereumStepExecutorContext,\n entries: TypedData[],\n actionType: ExecutionActionType,\n actionStatus: ExecutionActionStatus = 'ACTION_REQUIRED'\n): Promise<SignTypedDataEntriesResult> {\n const {\n step,\n statusManager,\n allowUserInteraction,\n checkClient,\n signedTypedData: currentSignedTypedData,\n } = context\n\n const signedTypedData = [...currentSignedTypedData]\n\n // Announced once for the round, not once per entry. Relay-from-Hyperliquid\n // carries two messages, and main told the consumer `MESSAGE_REQUIRED` once.\n if (entries.length) {\n statusManager.updateAction(step, actionType, actionStatus)\n }\n\n for (const typedData of entries) {\n if (!allowUserInteraction) {\n return { status: 'PAUSED' }\n }\n\n const typedDataChainId =\n getDomainChainId(typedData.domain) || step.action.fromChainId\n\n const client = await checkClient(step, typedDataChainId)\n if (!client) {\n return { status: 'PAUSED' }\n }\n\n const signature = await getAction(\n client,\n signTypedData,\n 'signTypedData'\n )({\n account: client.account!,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n })\n assertValidSignature(signature)\n\n signedTypedData.push({ ...typedData, signature })\n }\n\n return { status: 'COMPLETED', signedTypedData }\n}\n"],"mappings":";;;;;;AAiBA,eAAsB,qBACpB,SACA,SACA,YACA,eAAsC,mBACD;CACrC,MAAM,EACJ,MACA,eACA,sBACA,aACA,iBAAiB,2BACf;CAEJ,MAAM,kBAAkB,CAAC,GAAG,sBAAsB;CAIlD,IAAI,QAAQ,QACV,cAAc,aAAa,MAAM,YAAY,YAAY;CAG3D,KAAK,MAAM,aAAa,SAAS;EAC/B,IAAI,CAAC,sBACH,OAAO,EAAE,QAAQ,SAAS;EAM5B,MAAM,SAAS,MAAM,YAAY,MAF/B,iBAAiB,UAAU,MAAM,KAAK,KAAK,OAAO,WAEG;EACvD,IAAI,CAAC,QACH,OAAO,EAAE,QAAQ,SAAS;EAG5B,MAAM,YAAY,MAAM,UACtB,QACA,eACA,eACF,CAAC,CAAC;GACA,SAAS,OAAO;GAChB,QAAQ,UAAU;GAClB,OAAO,UAAU;GACjB,aAAa,UAAU;GACvB,SAAS,UAAU;EACrB,CAAC;EACD,qBAAqB,SAAS;EAE9B,gBAAgB,KAAK;GAAE,GAAG;GAAW;EAAU,CAAC;CAClD;CAEA,OAAO;EAAE,QAAQ;EAAa;CAAgB;AAChD"}
|
|
@@ -16,7 +16,6 @@ import { Client } from "viem";
|
|
|
16
16
|
* @param switchChainCallback The callback to switch the chain
|
|
17
17
|
* @returns New connector client
|
|
18
18
|
*/
|
|
19
|
-
declare const switchChain: (client: Client, targetChainId: number, allowUserInteraction: boolean, switchChainCallback?: (chainId: number) => Promise<Client | undefined>) => Promise<Client | undefined>;
|
|
19
|
+
export declare const switchChain: (client: Client, targetChainId: number, allowUserInteraction: boolean, switchChainCallback?: (chainId: number) => Promise<Client | undefined>) => Promise<Client | undefined>;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { switchChain };
|
|
22
21
|
//# sourceMappingURL=switchChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchChain.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/switchChain.ts"],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"switchChain.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/switchChain.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAqBa,cACX,QAAQ,QACR,uBACA,+BACA,uBAAuB,oBAAoB,QAAQ,wBAClD,QAAQ"}
|
|
@@ -6,7 +6,6 @@ import { TransactionReceipt } from "viem";
|
|
|
6
6
|
* Update action to PENDING with txHash/txLink from a transaction receipt when the receipt hash differs from current action.
|
|
7
7
|
* Returns the updated action or the same action if no update.
|
|
8
8
|
*/
|
|
9
|
-
declare function updateActionWithReceipt(statusManager: StatusManager, step: LiFiStepExtended, fromChain: ExtendedChain, receipt: TransactionReceipt | WalletCallReceipt$1 | undefined, action: ExecutionAction): ExecutionAction;
|
|
9
|
+
export declare function updateActionWithReceipt(statusManager: StatusManager, step: LiFiStepExtended, fromChain: ExtendedChain, receipt: TransactionReceipt | WalletCallReceipt$1 | undefined, action: ExecutionAction): ExecutionAction;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { updateActionWithReceipt };
|
|
12
11
|
//# sourceMappingURL=updateActionWithReceipt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateActionWithReceipt.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/updateActionWithReceipt.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"updateActionWithReceipt.d.ts","names":[],"sources":["../../../../../src/core/tasks/helpers/updateActionWithReceipt.ts"],"mappings":";;;;;;;;wBAcgB,wBACd,eAAe,eACf,MAAM,kBACN,WAAW,eACX,SAAS,qBAAqB,iCAC9B,QAAQ,kBACP"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExecuteStepRetryError, ExecuteStepRetryParams, ExecutionAction, LiFiStep, SDKError } from "@lifi/sdk";
|
|
2
2
|
//#region src/errors/parseEthereumErrors.d.ts
|
|
3
|
-
declare const parseEthereumErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
4
|
-
declare const isAtomicReadyWalletRejectedUpgradeError: (e: any) => boolean;
|
|
3
|
+
export declare const parseEthereumErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
4
|
+
export declare const isAtomicReadyWalletRejectedUpgradeError: (e: any) => boolean;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { isAtomicReadyWalletRejectedUpgradeError, parseEthereumErrors };
|
|
7
6
|
//# sourceMappingURL=parseEthereumErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseEthereumErrors.d.ts","names":[],"sources":["../../../src/errors/parseEthereumErrors.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"parseEthereumErrors.d.ts","names":[],"sources":["../../../src/errors/parseEthereumErrors.ts"],"mappings":";;qBAea,sBACX,GAAG,OACH,OAAO,UACP,SAAS,iBACT,cAAc,2BACb,QAAQ,WAAW;qBA0GT,0CAA2C"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SDKStorage } from "@lifi/sdk";
|
|
2
2
|
import { LocalAccount } from "viem";
|
|
3
3
|
//#region src/hyperliquid/agentWallet.d.ts
|
|
4
|
-
interface AgentWalletResult {
|
|
4
|
+
export interface AgentWalletResult {
|
|
5
5
|
account: LocalAccount;
|
|
6
6
|
needsApproval: boolean;
|
|
7
7
|
expiresAt: number;
|
|
8
8
|
}
|
|
9
|
-
declare function getOrCreateAgentWallet(storage: SDKStorage, ownerAddress: string, existingAgentAddress?: string, keyPrefix?: string): Promise<AgentWalletResult>;
|
|
9
|
+
export declare function getOrCreateAgentWallet(storage: SDKStorage, ownerAddress: string, existingAgentAddress?: string, keyPrefix?: string): Promise<AgentWalletResult>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { AgentWalletResult, getOrCreateAgentWallet };
|
|
12
11
|
//# sourceMappingURL=agentWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentWallet.d.ts","names":[],"sources":["../../../src/hyperliquid/agentWallet.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"agentWallet.d.ts","names":[],"sources":["../../../src/hyperliquid/agentWallet.ts"],"mappings":";;;iBAoBiB;EACf,SAAS;EACT;EACA;;wBAqGoB,uBACpB,SAAS,YACT,sBACA,+BACA,qBACC,QAAQ"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { LiFiStep, LiFiStepExtended, TypedData } from "@lifi/sdk";
|
|
2
2
|
//#region src/hyperliquid/isHyperliquidAgentStep.d.ts
|
|
3
|
-
declare function isHyperliquidAgentStep(step: LiFiStepExtended | LiFiStep): boolean;
|
|
4
|
-
declare function isApproveAgentMessage(typedData: TypedData): boolean;
|
|
5
|
-
declare function isApproveBuilderFeeMessage(typedData: TypedData): boolean;
|
|
6
|
-
declare function isHyperliquidOrderMessage(typedData: TypedData): boolean;
|
|
3
|
+
export declare function isHyperliquidAgentStep(step: LiFiStepExtended | LiFiStep): boolean;
|
|
4
|
+
export declare function isApproveAgentMessage(typedData: TypedData): boolean;
|
|
5
|
+
export declare function isApproveBuilderFeeMessage(typedData: TypedData): boolean;
|
|
6
|
+
export declare function isHyperliquidOrderMessage(typedData: TypedData): boolean;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { isApproveAgentMessage, isApproveBuilderFeeMessage, isHyperliquidAgentStep, isHyperliquidOrderMessage };
|
|
9
8
|
//# sourceMappingURL=isHyperliquidAgentStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isHyperliquidAgentStep.d.ts","names":[],"sources":["../../../src/hyperliquid/isHyperliquidAgentStep.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"isHyperliquidAgentStep.d.ts","names":[],"sources":["../../../src/hyperliquid/isHyperliquidAgentStep.ts"],"mappings":";;wBAEgB,uBACd,MAAM,mBAAmB;wBAUX,sBAAsB,WAAW;wBAIjC,2BAA2B,WAAW;wBAItC,0BAA0B,WAAW"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -12,6 +12,5 @@ import { convertExtendedChain } from "./utils/convertExtendedChain.js";
|
|
|
12
12
|
import { isContractCallStep } from "./utils/isContractCallStep.js";
|
|
13
13
|
import { isExtendedChain } from "./utils/isExtendedChain.js";
|
|
14
14
|
import { isGaslessStep } from "./utils/isGaslessStep.js";
|
|
15
|
-
import { isRelayerStep } from "./utils/isRelayerStep.js";
|
|
16
15
|
import { isZeroAddress } from "./utils/isZeroAddress.js";
|
|
17
|
-
export { EthereumProvider, type EthereumProviderOptions, type EthereumSDKProvider, PatcherMagicNumber, type WalletCallReceipt, checkPermitSupport, convertExtendedChain, getNativePermit, getTokenAllowance, getTokenAllowanceMulticall, isBatchingSupported, isContractCallStep, isDelegationDesignatorCode, isEthereumProvider, isExtendedChain, isGaslessStep, isHyperliquidAgentStep, isHyperliquidOrderMessage,
|
|
16
|
+
export { EthereumProvider, type EthereumProviderOptions, type EthereumSDKProvider, PatcherMagicNumber, type WalletCallReceipt, checkPermitSupport, convertExtendedChain, getNativePermit, getTokenAllowance, getTokenAllowanceMulticall, isBatchingSupported, isContractCallStep, isDelegationDesignatorCode, isEthereumProvider, isExtendedChain, isGaslessStep, isHyperliquidAgentStep, isHyperliquidOrderMessage, isZeroAddress, revokeTokenApproval, setAllowance, setTokenAllowance };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { isZeroAddress } from "./utils/isZeroAddress.js";
|
|
2
2
|
import { getTokenAllowance, getTokenAllowanceMulticall } from "./actions/getAllowance.js";
|
|
3
3
|
import { isBatchingSupported } from "./actions/isBatchingSupported.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isGaslessStep } from "./utils/isGaslessStep.js";
|
|
5
5
|
import { isDelegationDesignatorCode } from "./permits/isDelegationDesignatorCode.js";
|
|
6
6
|
import { PatcherMagicNumber } from "./permits/constants.js";
|
|
7
7
|
import { getNativePermit } from "./permits/getNativePermit.js";
|
|
8
8
|
import { isContractCallStep } from "./utils/isContractCallStep.js";
|
|
9
|
-
import { isGaslessStep } from "./utils/isGaslessStep.js";
|
|
10
9
|
import { isEthereumProvider } from "./types.js";
|
|
11
10
|
import { revokeTokenApproval, setAllowance, setTokenAllowance } from "./actions/setAllowance.js";
|
|
12
11
|
import { isHyperliquidAgentStep, isHyperliquidOrderMessage } from "./hyperliquid/isHyperliquidAgentStep.js";
|
|
@@ -14,4 +13,4 @@ import { convertExtendedChain } from "./utils/convertExtendedChain.js";
|
|
|
14
13
|
import { EthereumProvider } from "./EthereumProvider.js";
|
|
15
14
|
import { checkPermitSupport } from "./actions/checkPermitSupport.js";
|
|
16
15
|
import { isExtendedChain } from "./utils/isExtendedChain.js";
|
|
17
|
-
export { EthereumProvider, PatcherMagicNumber, checkPermitSupport, convertExtendedChain, getNativePermit, getTokenAllowance, getTokenAllowanceMulticall, isBatchingSupported, isContractCallStep, isDelegationDesignatorCode, isEthereumProvider, isExtendedChain, isGaslessStep, isHyperliquidAgentStep, isHyperliquidOrderMessage,
|
|
16
|
+
export { EthereumProvider, PatcherMagicNumber, checkPermitSupport, convertExtendedChain, getNativePermit, getTokenAllowance, getTokenAllowanceMulticall, isBatchingSupported, isContractCallStep, isDelegationDesignatorCode, isEthereumProvider, isExtendedChain, isGaslessStep, isHyperliquidAgentStep, isHyperliquidOrderMessage, isZeroAddress, revokeTokenApproval, setAllowance, setTokenAllowance };
|
|
@@ -12,7 +12,6 @@ import { Address } from "viem";
|
|
|
12
12
|
* accounts that have code; a code-less address returns empty data and would read
|
|
13
13
|
* as incapable.
|
|
14
14
|
*/
|
|
15
|
-
declare const acceptsRawEcdsaSignature: (client: SDKClient, chainId: number, address: Address) => Promise<boolean>;
|
|
15
|
+
export declare const acceptsRawEcdsaSignature: (client: SDKClient, chainId: number, address: Address) => Promise<boolean>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { acceptsRawEcdsaSignature };
|
|
18
17
|
//# sourceMappingURL=acceptsRawEcdsaSignature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptsRawEcdsaSignature.d.ts","names":[],"sources":["../../../src/permits/acceptsRawEcdsaSignature.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"acceptsRawEcdsaSignature.d.ts","names":[],"sources":["../../../src/permits/acceptsRawEcdsaSignature.ts"],"mappings":";;;;;;;;;;;;;;qBAwCa,2BACX,QAAQ,WACR,iBACA,SAAS,YACR"}
|