@lifi/sdk-provider-ethereum 0.0.0-preview-f5cf9f8
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 +8 -0
- package/LICENSE +201 -0
- package/README.md +79 -0
- package/dist/cjs/EthereumProvider.d.ts +7 -0
- package/dist/cjs/EthereumProvider.js +39 -0
- package/dist/cjs/EthereumProvider.js.map +1 -0
- package/dist/cjs/actions/checkPermitSupport.d.ts +35 -0
- package/dist/cjs/actions/checkPermitSupport.js +42 -0
- package/dist/cjs/actions/checkPermitSupport.js.map +1 -0
- package/dist/cjs/actions/constants.d.ts +55 -0
- package/dist/cjs/actions/constants.js +90 -0
- package/dist/cjs/actions/constants.js.map +1 -0
- package/dist/cjs/actions/getAccountCode.d.ts +30 -0
- package/dist/cjs/actions/getAccountCode.js +30 -0
- package/dist/cjs/actions/getAccountCode.js.map +1 -0
- package/dist/cjs/actions/getAllowance.d.ts +27 -0
- package/dist/cjs/actions/getAllowance.js +78 -0
- package/dist/cjs/actions/getAllowance.js.map +1 -0
- package/dist/cjs/actions/getEthereumBalance.d.ts +8 -0
- package/dist/cjs/actions/getEthereumBalance.js +77 -0
- package/dist/cjs/actions/getEthereumBalance.js.map +1 -0
- package/dist/cjs/actions/getMaxPriorityFeePerGas.d.ts +8 -0
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js +18 -0
- package/dist/cjs/actions/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/actions/getMulticallAddress.d.ts +8 -0
- package/dist/cjs/actions/getMulticallAddress.js +10 -0
- package/dist/cjs/actions/getMulticallAddress.js.map +1 -0
- package/dist/cjs/actions/isBatchingSupported.d.ts +16 -0
- package/dist/cjs/actions/isBatchingSupported.js +19 -0
- package/dist/cjs/actions/isBatchingSupported.js.map +1 -0
- package/dist/cjs/actions/isSafeSignature.d.ts +23 -0
- package/dist/cjs/actions/isSafeSignature.js +24 -0
- package/dist/cjs/actions/isSafeSignature.js.map +1 -0
- package/dist/cjs/actions/isSafeWallet.d.ts +23 -0
- package/dist/cjs/actions/isSafeWallet.js +37 -0
- package/dist/cjs/actions/isSafeWallet.js.map +1 -0
- package/dist/cjs/actions/isSmartContractWallet.d.ts +10 -0
- package/dist/cjs/actions/isSmartContractWallet.js +13 -0
- package/dist/cjs/actions/isSmartContractWallet.js.map +1 -0
- package/dist/cjs/actions/resolveENSAddress.d.ts +7 -0
- package/dist/cjs/actions/resolveENSAddress.js +16 -0
- package/dist/cjs/actions/resolveENSAddress.js.map +1 -0
- package/dist/cjs/actions/resolveEthereumAddress.d.ts +7 -0
- package/dist/cjs/actions/resolveEthereumAddress.js +12 -0
- package/dist/cjs/actions/resolveEthereumAddress.js.map +1 -0
- package/dist/cjs/actions/resolveTransactionHash.d.ts +8 -0
- package/dist/cjs/actions/resolveTransactionHash.js +24 -0
- package/dist/cjs/actions/resolveTransactionHash.js.map +1 -0
- package/dist/cjs/actions/resolveUNSAddress.d.ts +7 -0
- package/dist/cjs/actions/resolveUNSAddress.js +67 -0
- package/dist/cjs/actions/resolveUNSAddress.js.map +1 -0
- package/dist/cjs/actions/setAllowance.d.ts +39 -0
- package/dist/cjs/actions/setAllowance.js +74 -0
- package/dist/cjs/actions/setAllowance.js.map +1 -0
- package/dist/cjs/actions/waitForBatchTransactionReceipt.d.ts +9 -0
- package/dist/cjs/actions/waitForBatchTransactionReceipt.js +28 -0
- package/dist/cjs/actions/waitForBatchTransactionReceipt.js.map +1 -0
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.d.ts +9 -0
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js +35 -0
- package/dist/cjs/actions/waitForRelayedTransactionReceipt.js.map +1 -0
- package/dist/cjs/actions/waitForSafeTransactionExecution.d.ts +30 -0
- package/dist/cjs/actions/waitForSafeTransactionExecution.js +54 -0
- package/dist/cjs/actions/waitForSafeTransactionExecution.js.map +1 -0
- package/dist/cjs/actions/waitForTransactionReceipt.d.ts +19 -0
- package/dist/cjs/actions/waitForTransactionReceipt.js +37 -0
- package/dist/cjs/actions/waitForTransactionReceipt.js.map +1 -0
- package/dist/cjs/client/publicClient.d.ts +14 -0
- package/dist/cjs/client/publicClient.js +48 -0
- package/dist/cjs/client/publicClient.js.map +1 -0
- package/dist/cjs/client/safeClient.d.ts +17 -0
- package/dist/cjs/client/safeClient.js +44 -0
- package/dist/cjs/client/safeClient.js.map +1 -0
- package/dist/cjs/client/types.d.ts +22 -0
- package/dist/cjs/client/types.js +0 -0
- package/dist/cjs/core/EthereumStepExecutor.d.ts +25 -0
- package/dist/cjs/core/EthereumStepExecutor.js +87 -0
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js +40 -0
- package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js +24 -0
- package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js +39 -0
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +19 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +32 -0
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +54 -0
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js +70 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +60 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +60 -0
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js +19 -0
- package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js +76 -0
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +80 -0
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js +24 -0
- package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +74 -0
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js +31 -0
- package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js +17 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js +19 -0
- package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js +23 -0
- package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +24 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.js +9 -0
- package/dist/cjs/core/tasks/helpers/getTxLink.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +101 -0
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.js +9 -0
- package/dist/cjs/core/tasks/helpers/isPermit2Supported.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js +11 -0
- package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +68 -0
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/switchChain.d.ts +23 -0
- package/dist/cjs/core/tasks/helpers/switchChain.js +35 -0
- package/dist/cjs/core/tasks/helpers/switchChain.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js +19 -0
- package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js.map +1 -0
- package/dist/cjs/errors/parseEthereumErrors.d.ts +8 -0
- package/dist/cjs/errors/parseEthereumErrors.js +55 -0
- package/dist/cjs/errors/parseEthereumErrors.js.map +1 -0
- package/dist/cjs/hyperliquid/agentWallet.d.ts +13 -0
- package/dist/cjs/hyperliquid/agentWallet.js +90 -0
- package/dist/cjs/hyperliquid/agentWallet.js.map +1 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.d.ts +10 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js +21 -0
- package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js.map +1 -0
- package/dist/cjs/index.d.ts +17 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/permits/allowanceTransfer.d.ts +45 -0
- package/dist/cjs/permits/allowanceTransfer.js +133 -0
- package/dist/cjs/permits/allowanceTransfer.js.map +1 -0
- package/dist/cjs/permits/canAccountUseNativePermits.d.ts +14 -0
- package/dist/cjs/permits/canAccountUseNativePermits.js +25 -0
- package/dist/cjs/permits/canAccountUseNativePermits.js.map +1 -0
- package/dist/cjs/permits/constants.d.ts +83 -0
- package/dist/cjs/permits/constants.js +110 -0
- package/dist/cjs/permits/constants.js.map +1 -0
- package/dist/cjs/permits/domain.d.ts +7 -0
- package/dist/cjs/permits/domain.js +14 -0
- package/dist/cjs/permits/domain.js.map +1 -0
- package/dist/cjs/permits/encodeNativePermitData.d.ts +7 -0
- package/dist/cjs/permits/encodeNativePermitData.js +24 -0
- package/dist/cjs/permits/encodeNativePermitData.js.map +1 -0
- package/dist/cjs/permits/encodePermit2Data.d.ts +7 -0
- package/dist/cjs/permits/encodePermit2Data.js +37 -0
- package/dist/cjs/permits/encodePermit2Data.js.map +1 -0
- package/dist/cjs/permits/getNativePermit.d.ts +32 -0
- package/dist/cjs/permits/getNativePermit.js +243 -0
- package/dist/cjs/permits/getNativePermit.js.map +1 -0
- package/dist/cjs/permits/getPermitTransferFromValues.d.ts +9 -0
- package/dist/cjs/permits/getPermitTransferFromValues.js +26 -0
- package/dist/cjs/permits/getPermitTransferFromValues.js.map +1 -0
- package/dist/cjs/permits/invariant.d.ts +20 -0
- package/dist/cjs/permits/invariant.js +30 -0
- package/dist/cjs/permits/invariant.js.map +1 -0
- package/dist/cjs/permits/isDelegationDesignatorCode.d.ts +26 -0
- package/dist/cjs/permits/isDelegationDesignatorCode.js +28 -0
- package/dist/cjs/permits/isDelegationDesignatorCode.js.map +1 -0
- package/dist/cjs/permits/isNativePermitValid.d.ts +10 -0
- package/dist/cjs/permits/isNativePermitValid.js +20 -0
- package/dist/cjs/permits/isNativePermitValid.js.map +1 -0
- package/dist/cjs/permits/signPermit2Message.d.ts +16 -0
- package/dist/cjs/permits/signPermit2Message.js +43 -0
- package/dist/cjs/permits/signPermit2Message.js.map +1 -0
- package/dist/cjs/permits/signatureTransfer.d.ts +45 -0
- package/dist/cjs/permits/signatureTransfer.js +162 -0
- package/dist/cjs/permits/signatureTransfer.js.map +1 -0
- package/dist/cjs/permits/types.d.ts +22 -0
- package/dist/cjs/permits/types.js +0 -0
- package/dist/cjs/types.d.ts +75 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/abi.d.ts +12 -0
- package/dist/cjs/utils/abi.js +31 -0
- package/dist/cjs/utils/abi.js.map +1 -0
- package/dist/cjs/utils/convertExtendedChain.d.ts +8 -0
- package/dist/cjs/utils/convertExtendedChain.js +23 -0
- package/dist/cjs/utils/convertExtendedChain.js.map +1 -0
- package/dist/cjs/utils/getActionWithFallback.d.ts +24 -0
- package/dist/cjs/utils/getActionWithFallback.js +32 -0
- package/dist/cjs/utils/getActionWithFallback.js.map +1 -0
- package/dist/cjs/utils/getDomainChainId.d.ts +12 -0
- package/dist/cjs/utils/getDomainChainId.js +21 -0
- package/dist/cjs/utils/getDomainChainId.js.map +1 -0
- package/dist/cjs/utils/getSafeApiKey.d.ts +7 -0
- package/dist/cjs/utils/getSafeApiKey.js +12 -0
- package/dist/cjs/utils/getSafeApiKey.js.map +1 -0
- package/dist/cjs/utils/isContractCallStep.d.ts +7 -0
- package/dist/cjs/utils/isContractCallStep.js +9 -0
- package/dist/cjs/utils/isContractCallStep.js.map +1 -0
- package/dist/cjs/utils/isExtendedChain.d.ts +7 -0
- package/dist/cjs/utils/isExtendedChain.js +9 -0
- package/dist/cjs/utils/isExtendedChain.js.map +1 -0
- package/dist/cjs/utils/isGaslessStep.d.ts +8 -0
- package/dist/cjs/utils/isGaslessStep.js +9 -0
- package/dist/cjs/utils/isGaslessStep.js.map +1 -0
- package/dist/cjs/utils/isRelayerStep.d.ts +8 -0
- package/dist/cjs/utils/isRelayerStep.js +9 -0
- package/dist/cjs/utils/isRelayerStep.js.map +1 -0
- package/dist/cjs/utils/isZeroAddress.d.ts +7 -0
- package/dist/cjs/utils/isZeroAddress.js +14 -0
- package/dist/cjs/utils/isZeroAddress.js.map +1 -0
- package/dist/cjs/utils/median.d.ts +5 -0
- package/dist/cjs/utils/median.js +13 -0
- package/dist/cjs/utils/median.js.map +1 -0
- package/dist/cjs/version.d.ts +6 -0
- package/dist/cjs/version.js +9 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/EthereumProvider.d.ts +7 -0
- package/dist/esm/EthereumProvider.d.ts.map +1 -0
- package/dist/esm/EthereumProvider.js +38 -0
- package/dist/esm/EthereumProvider.js.map +1 -0
- package/dist/esm/actions/checkPermitSupport.d.ts +35 -0
- package/dist/esm/actions/checkPermitSupport.d.ts.map +1 -0
- package/dist/esm/actions/checkPermitSupport.js +41 -0
- package/dist/esm/actions/checkPermitSupport.js.map +1 -0
- package/dist/esm/actions/constants.d.ts +55 -0
- package/dist/esm/actions/constants.d.ts.map +1 -0
- package/dist/esm/actions/constants.js +84 -0
- package/dist/esm/actions/constants.js.map +1 -0
- package/dist/esm/actions/getAccountCode.d.ts +30 -0
- package/dist/esm/actions/getAccountCode.d.ts.map +1 -0
- package/dist/esm/actions/getAccountCode.js +29 -0
- package/dist/esm/actions/getAccountCode.js.map +1 -0
- package/dist/esm/actions/getAllowance.d.ts +27 -0
- package/dist/esm/actions/getAllowance.d.ts.map +1 -0
- package/dist/esm/actions/getAllowance.js +74 -0
- package/dist/esm/actions/getAllowance.js.map +1 -0
- package/dist/esm/actions/getEthereumBalance.d.ts +8 -0
- package/dist/esm/actions/getEthereumBalance.d.ts.map +1 -0
- package/dist/esm/actions/getEthereumBalance.js +76 -0
- package/dist/esm/actions/getEthereumBalance.js.map +1 -0
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts +8 -0
- package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/esm/actions/getMaxPriorityFeePerGas.js +17 -0
- package/dist/esm/actions/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/actions/getMulticallAddress.d.ts +8 -0
- package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -0
- package/dist/esm/actions/getMulticallAddress.js +9 -0
- package/dist/esm/actions/getMulticallAddress.js.map +1 -0
- package/dist/esm/actions/isBatchingSupported.d.ts +16 -0
- package/dist/esm/actions/isBatchingSupported.d.ts.map +1 -0
- package/dist/esm/actions/isBatchingSupported.js +18 -0
- package/dist/esm/actions/isBatchingSupported.js.map +1 -0
- package/dist/esm/actions/isSafeSignature.d.ts +23 -0
- package/dist/esm/actions/isSafeSignature.d.ts.map +1 -0
- package/dist/esm/actions/isSafeSignature.js +23 -0
- package/dist/esm/actions/isSafeSignature.js.map +1 -0
- package/dist/esm/actions/isSafeWallet.d.ts +23 -0
- package/dist/esm/actions/isSafeWallet.d.ts.map +1 -0
- package/dist/esm/actions/isSafeWallet.js +37 -0
- package/dist/esm/actions/isSafeWallet.js.map +1 -0
- package/dist/esm/actions/isSmartContractWallet.d.ts +10 -0
- package/dist/esm/actions/isSmartContractWallet.d.ts.map +1 -0
- package/dist/esm/actions/isSmartContractWallet.js +12 -0
- package/dist/esm/actions/isSmartContractWallet.js.map +1 -0
- package/dist/esm/actions/resolveENSAddress.d.ts +7 -0
- package/dist/esm/actions/resolveENSAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveENSAddress.js +15 -0
- package/dist/esm/actions/resolveENSAddress.js.map +1 -0
- package/dist/esm/actions/resolveEthereumAddress.d.ts +7 -0
- package/dist/esm/actions/resolveEthereumAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveEthereumAddress.js +11 -0
- package/dist/esm/actions/resolveEthereumAddress.js.map +1 -0
- package/dist/esm/actions/resolveTransactionHash.d.ts +8 -0
- package/dist/esm/actions/resolveTransactionHash.d.ts.map +1 -0
- package/dist/esm/actions/resolveTransactionHash.js +23 -0
- package/dist/esm/actions/resolveTransactionHash.js.map +1 -0
- package/dist/esm/actions/resolveUNSAddress.d.ts +7 -0
- package/dist/esm/actions/resolveUNSAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveUNSAddress.js +66 -0
- package/dist/esm/actions/resolveUNSAddress.js.map +1 -0
- package/dist/esm/actions/setAllowance.d.ts +39 -0
- package/dist/esm/actions/setAllowance.d.ts.map +1 -0
- package/dist/esm/actions/setAllowance.js +71 -0
- package/dist/esm/actions/setAllowance.js.map +1 -0
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts +9 -0
- package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForBatchTransactionReceipt.js +27 -0
- package/dist/esm/actions/waitForBatchTransactionReceipt.js.map +1 -0
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts +9 -0
- package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js +34 -0
- package/dist/esm/actions/waitForRelayedTransactionReceipt.js.map +1 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts +30 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.d.ts.map +1 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.js +53 -0
- package/dist/esm/actions/waitForSafeTransactionExecution.js.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.d.ts +19 -0
- package/dist/esm/actions/waitForTransactionReceipt.d.ts.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.js +36 -0
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -0
- package/dist/esm/client/publicClient.d.ts +14 -0
- package/dist/esm/client/publicClient.d.ts.map +1 -0
- package/dist/esm/client/publicClient.js +47 -0
- package/dist/esm/client/publicClient.js.map +1 -0
- package/dist/esm/client/safeClient.d.ts +17 -0
- package/dist/esm/client/safeClient.d.ts.map +1 -0
- package/dist/esm/client/safeClient.js +43 -0
- package/dist/esm/client/safeClient.js.map +1 -0
- package/dist/esm/client/types.d.ts +22 -0
- package/dist/esm/client/types.d.ts.map +1 -0
- package/dist/esm/client/types.js +1 -0
- package/dist/esm/core/EthereumStepExecutor.d.ts +25 -0
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/EthereumStepExecutor.js +86 -0
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js +39 -0
- package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js +23 -0
- package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js +38 -0
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +19 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +31 -0
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +53 -0
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js +69 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +59 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +59 -0
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js +18 -0
- package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js +75 -0
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +79 -0
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js +23 -0
- package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +73 -0
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js +30 -0
- package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js +16 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js +18 -0
- package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js +22 -0
- package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +23 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/getTxLink.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getTxLink.js +8 -0
- package/dist/esm/core/tasks/helpers/getTxLink.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js +100 -0
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.js +8 -0
- package/dist/esm/core/tasks/helpers/isPermit2Supported.js.map +1 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js +10 -0
- package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +67 -0
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -0
- package/dist/esm/core/tasks/helpers/switchChain.d.ts +23 -0
- package/dist/esm/core/tasks/helpers/switchChain.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/switchChain.js +34 -0
- package/dist/esm/core/tasks/helpers/switchChain.js.map +1 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js +18 -0
- package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js.map +1 -0
- package/dist/esm/errors/parseEthereumErrors.d.ts +8 -0
- package/dist/esm/errors/parseEthereumErrors.d.ts.map +1 -0
- package/dist/esm/errors/parseEthereumErrors.js +53 -0
- package/dist/esm/errors/parseEthereumErrors.js.map +1 -0
- package/dist/esm/hyperliquid/agentWallet.d.ts +13 -0
- package/dist/esm/hyperliquid/agentWallet.d.ts.map +1 -0
- package/dist/esm/hyperliquid/agentWallet.js +89 -0
- package/dist/esm/hyperliquid/agentWallet.js.map +1 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts +10 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts.map +1 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.js +17 -0
- package/dist/esm/hyperliquid/isHyperliquidAgentStep.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/permits/allowanceTransfer.d.ts +45 -0
- package/dist/esm/permits/allowanceTransfer.d.ts.map +1 -0
- package/dist/esm/permits/allowanceTransfer.js +126 -0
- package/dist/esm/permits/allowanceTransfer.js.map +1 -0
- package/dist/esm/permits/canAccountUseNativePermits.d.ts +14 -0
- package/dist/esm/permits/canAccountUseNativePermits.d.ts.map +1 -0
- package/dist/esm/permits/canAccountUseNativePermits.js +24 -0
- package/dist/esm/permits/canAccountUseNativePermits.js.map +1 -0
- package/dist/esm/permits/constants.d.ts +83 -0
- package/dist/esm/permits/constants.d.ts.map +1 -0
- package/dist/esm/permits/constants.js +90 -0
- package/dist/esm/permits/constants.js.map +1 -0
- package/dist/esm/permits/domain.d.ts +7 -0
- package/dist/esm/permits/domain.d.ts.map +1 -0
- package/dist/esm/permits/domain.js +13 -0
- package/dist/esm/permits/domain.js.map +1 -0
- package/dist/esm/permits/encodeNativePermitData.d.ts +7 -0
- package/dist/esm/permits/encodeNativePermitData.d.ts.map +1 -0
- package/dist/esm/permits/encodeNativePermitData.js +23 -0
- package/dist/esm/permits/encodeNativePermitData.js.map +1 -0
- package/dist/esm/permits/encodePermit2Data.d.ts +7 -0
- package/dist/esm/permits/encodePermit2Data.d.ts.map +1 -0
- package/dist/esm/permits/encodePermit2Data.js +36 -0
- package/dist/esm/permits/encodePermit2Data.js.map +1 -0
- package/dist/esm/permits/getNativePermit.d.ts +32 -0
- package/dist/esm/permits/getNativePermit.d.ts.map +1 -0
- package/dist/esm/permits/getNativePermit.js +242 -0
- package/dist/esm/permits/getNativePermit.js.map +1 -0
- package/dist/esm/permits/getPermitTransferFromValues.d.ts +9 -0
- package/dist/esm/permits/getPermitTransferFromValues.d.ts.map +1 -0
- package/dist/esm/permits/getPermitTransferFromValues.js +25 -0
- package/dist/esm/permits/getPermitTransferFromValues.js.map +1 -0
- package/dist/esm/permits/invariant.d.ts +20 -0
- package/dist/esm/permits/invariant.d.ts.map +1 -0
- package/dist/esm/permits/invariant.js +29 -0
- package/dist/esm/permits/invariant.js.map +1 -0
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts +26 -0
- package/dist/esm/permits/isDelegationDesignatorCode.d.ts.map +1 -0
- package/dist/esm/permits/isDelegationDesignatorCode.js +27 -0
- package/dist/esm/permits/isDelegationDesignatorCode.js.map +1 -0
- package/dist/esm/permits/isNativePermitValid.d.ts +10 -0
- package/dist/esm/permits/isNativePermitValid.d.ts.map +1 -0
- package/dist/esm/permits/isNativePermitValid.js +19 -0
- package/dist/esm/permits/isNativePermitValid.js.map +1 -0
- package/dist/esm/permits/signPermit2Message.d.ts +16 -0
- package/dist/esm/permits/signPermit2Message.d.ts.map +1 -0
- package/dist/esm/permits/signPermit2Message.js +42 -0
- package/dist/esm/permits/signPermit2Message.js.map +1 -0
- package/dist/esm/permits/signatureTransfer.d.ts +45 -0
- package/dist/esm/permits/signatureTransfer.d.ts.map +1 -0
- package/dist/esm/permits/signatureTransfer.js +158 -0
- package/dist/esm/permits/signatureTransfer.js.map +1 -0
- package/dist/esm/permits/types.d.ts +22 -0
- package/dist/esm/permits/types.d.ts.map +1 -0
- package/dist/esm/permits/types.js +1 -0
- package/dist/esm/types.d.ts +75 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/abi.d.ts +12 -0
- package/dist/esm/utils/abi.d.ts.map +1 -0
- package/dist/esm/utils/abi.js +25 -0
- package/dist/esm/utils/abi.js.map +1 -0
- package/dist/esm/utils/convertExtendedChain.d.ts +8 -0
- package/dist/esm/utils/convertExtendedChain.d.ts.map +1 -0
- package/dist/esm/utils/convertExtendedChain.js +22 -0
- package/dist/esm/utils/convertExtendedChain.js.map +1 -0
- package/dist/esm/utils/getActionWithFallback.d.ts +24 -0
- package/dist/esm/utils/getActionWithFallback.d.ts.map +1 -0
- package/dist/esm/utils/getActionWithFallback.js +31 -0
- package/dist/esm/utils/getActionWithFallback.js.map +1 -0
- package/dist/esm/utils/getDomainChainId.d.ts +12 -0
- package/dist/esm/utils/getDomainChainId.d.ts.map +1 -0
- package/dist/esm/utils/getDomainChainId.js +20 -0
- package/dist/esm/utils/getDomainChainId.js.map +1 -0
- package/dist/esm/utils/getSafeApiKey.d.ts +7 -0
- package/dist/esm/utils/getSafeApiKey.d.ts.map +1 -0
- package/dist/esm/utils/getSafeApiKey.js +11 -0
- package/dist/esm/utils/getSafeApiKey.js.map +1 -0
- package/dist/esm/utils/isContractCallStep.d.ts +7 -0
- package/dist/esm/utils/isContractCallStep.d.ts.map +1 -0
- package/dist/esm/utils/isContractCallStep.js +8 -0
- package/dist/esm/utils/isContractCallStep.js.map +1 -0
- package/dist/esm/utils/isExtendedChain.d.ts +7 -0
- package/dist/esm/utils/isExtendedChain.d.ts.map +1 -0
- package/dist/esm/utils/isExtendedChain.js +8 -0
- package/dist/esm/utils/isExtendedChain.js.map +1 -0
- package/dist/esm/utils/isGaslessStep.d.ts +8 -0
- package/dist/esm/utils/isGaslessStep.d.ts.map +1 -0
- package/dist/esm/utils/isGaslessStep.js +8 -0
- package/dist/esm/utils/isGaslessStep.js.map +1 -0
- package/dist/esm/utils/isRelayerStep.d.ts +8 -0
- package/dist/esm/utils/isRelayerStep.d.ts.map +1 -0
- package/dist/esm/utils/isRelayerStep.js +8 -0
- package/dist/esm/utils/isRelayerStep.js.map +1 -0
- package/dist/esm/utils/isZeroAddress.d.ts +7 -0
- package/dist/esm/utils/isZeroAddress.d.ts.map +1 -0
- package/dist/esm/utils/isZeroAddress.js +11 -0
- package/dist/esm/utils/isZeroAddress.js.map +1 -0
- package/dist/esm/utils/median.d.ts +5 -0
- package/dist/esm/utils/median.d.ts.map +1 -0
- package/dist/esm/utils/median.js +12 -0
- package/dist/esm/utils/median.js.map +1 -0
- package/dist/esm/version.d.ts +6 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +7 -0
- package/dist/esm/version.js.map +1 -0
- package/package.json +76 -0
- package/src/EthereumProvider.ts +48 -0
- package/src/actions/checkPermitSupport.ts +84 -0
- package/src/actions/constants.ts +85 -0
- package/src/actions/getAccountCode.ts +41 -0
- package/src/actions/getAllowance.ts +162 -0
- package/src/actions/getEthereumBalance.ts +135 -0
- package/src/actions/getMaxPriorityFeePerGas.ts +42 -0
- package/src/actions/getMulticallAddress.ts +12 -0
- package/src/actions/isBatchingSupported.ts +45 -0
- package/src/actions/isSafeSignature.ts +34 -0
- package/src/actions/isSafeWallet.ts +55 -0
- package/src/actions/isSmartContractWallet.ts +9 -0
- package/src/actions/resolveENSAddress.ts +19 -0
- package/src/actions/resolveEthereumAddress.ts +20 -0
- package/src/actions/resolveTransactionHash.ts +36 -0
- package/src/actions/resolveUNSAddress.ts +128 -0
- package/src/actions/setAllowance.ts +152 -0
- package/src/actions/waitForBatchTransactionReceipt.ts +48 -0
- package/src/actions/waitForRelayedTransactionReceipt.ts +69 -0
- package/src/actions/waitForSafeTransactionExecution.ts +126 -0
- package/src/actions/waitForTransactionReceipt.ts +89 -0
- package/src/client/publicClient.ts +78 -0
- package/src/client/safeClient.ts +112 -0
- package/src/client/types.ts +18 -0
- package/src/core/EthereumStepExecutor.ts +183 -0
- package/src/core/tasks/EthereumBatchedSignAndExecuteTask.ts +76 -0
- package/src/core/tasks/EthereumBatchedWaitForTransactionTask.ts +70 -0
- package/src/core/tasks/EthereumCheckAllowanceTask.ts +72 -0
- package/src/core/tasks/EthereumCheckBalanceTask.ts +50 -0
- package/src/core/tasks/EthereumCheckPermitsTask.ts +94 -0
- package/src/core/tasks/EthereumNativePermitTask.ts +129 -0
- package/src/core/tasks/EthereumPrepareTransactionTask.ts +128 -0
- package/src/core/tasks/EthereumRelayedSignAndExecuteTask.ts +121 -0
- package/src/core/tasks/EthereumRelayedWaitForTransactionTask.ts +48 -0
- package/src/core/tasks/EthereumResetAllowanceTask.ts +131 -0
- package/src/core/tasks/EthereumSetAllowanceTask.ts +132 -0
- package/src/core/tasks/EthereumSignAndExecuteTask.ts +49 -0
- package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +158 -0
- package/src/core/tasks/EthereumStandardWaitForTransactionTask.ts +65 -0
- package/src/core/tasks/EthereumWaitForTransactionStatusTask.ts +33 -0
- package/src/core/tasks/EthereumWaitForTransactionTask.ts +19 -0
- package/src/core/tasks/helpers/estimateTransactionRequest.ts +42 -0
- package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +45 -0
- package/src/core/tasks/helpers/getTxLink.ts +6 -0
- package/src/core/tasks/helpers/getUpdatedStep.ts +160 -0
- package/src/core/tasks/helpers/isPermit2Supported.ts +28 -0
- package/src/core/tasks/helpers/shouldCheckForAllowance.ts +24 -0
- package/src/core/tasks/helpers/signHyperliquidTypedData.ts +110 -0
- package/src/core/tasks/helpers/switchChain.ts +64 -0
- package/src/core/tasks/helpers/updateActionWithReceipt.ts +40 -0
- package/src/errors/parseEthereumErrors.ts +141 -0
- package/src/hyperliquid/agentWallet.ts +157 -0
- package/src/hyperliquid/isHyperliquidAgentStep.ts +24 -0
- package/src/index.ts +32 -0
- package/src/permits/allowanceTransfer.ts +171 -0
- package/src/permits/canAccountUseNativePermits.ts +31 -0
- package/src/permits/constants.ts +90 -0
- package/src/permits/domain.ts +14 -0
- package/src/permits/encodeNativePermitData.ts +19 -0
- package/src/permits/encodePermit2Data.ts +41 -0
- package/src/permits/getNativePermit.ts +522 -0
- package/src/permits/getPermitTransferFromValues.ts +37 -0
- package/src/permits/invariant.ts +51 -0
- package/src/permits/isDelegationDesignatorCode.ts +23 -0
- package/src/permits/isNativePermitValid.ts +57 -0
- package/src/permits/signPermit2Message.ts +84 -0
- package/src/permits/signatureTransfer.ts +226 -0
- package/src/permits/types.ts +20 -0
- package/src/types.ts +113 -0
- package/src/utils/abi.ts +35 -0
- package/src/utils/convertExtendedChain.ts +37 -0
- package/src/utils/getActionWithFallback.ts +61 -0
- package/src/utils/getDomainChainId.ts +23 -0
- package/src/utils/getSafeApiKey.ts +10 -0
- package/src/utils/isContractCallStep.ts +5 -0
- package/src/utils/isExtendedChain.ts +17 -0
- package/src/utils/isGaslessStep.ts +17 -0
- package/src/utils/isRelayerStep.ts +8 -0
- package/src/utils/isZeroAddress.ts +10 -0
- package/src/utils/median.ts +11 -0
- package/src/version.ts +2 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright LI.FI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@lifi/sdk)
|
|
5
|
+
[](https://www.npmjs.com/package/@lifi/sdk)
|
|
6
|
+
[](https://twitter.com/lifiprotocol)
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<h1 align="center">LI.FI SDK</h1>
|
|
11
|
+
|
|
12
|
+
[**LI.FI SDK**](https://docs.li.fi/sdk/overview) provides a powerful toolkit for developers to enable seamless cross-chain and on-chain swaps and bridging within their applications. Our JavaScript/TypeScript SDK can be implemented in front-end or back-end environments, allowing you to build robust UX/UI around our advanced bridge and swap functionalities. LI.FI SDK efficiently manages all communications between our smart routing API and smart contracts and ensures optimal performance, security, and scalability for your cross-chain and on-chain needs.
|
|
13
|
+
|
|
14
|
+
[**LI.FI SDK**](https://docs.li.fi/sdk/overview) features include:
|
|
15
|
+
|
|
16
|
+
- All ecosystems, chains, bridges, exchanges, and solvers that [LI.FI](https://docs.li.fi/introduction/chains) supports
|
|
17
|
+
- Complete functionality covering full-cycle from obtaining routes/quotes to executing transactions
|
|
18
|
+
- Easy tracking of the route and quote execution through the robust event and hooks handling
|
|
19
|
+
- Highly customizable settings to tailor the SDK to your specific needs including configuration of RPCs and options to allow or deny certain chains, tokens, bridges, exchanges, solvers
|
|
20
|
+
- Supports widely adopted industry standards, including [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792), [ERC-2612](https://eips.ethereum.org/EIPS/eip-2612), [EIP-712](https://eips.ethereum.org/EIPS/eip-712), and [Permit2](https://github.com/Uniswap/permit2)
|
|
21
|
+
- SDK ecosystem providers are based on industry-standard libraries ([Viem](https://viem.sh/), [Wallet Standard](https://github.com/wallet-standard/wallet-standard), [Bigmi](https://github.com/lifinance/bigmi))
|
|
22
|
+
- Support for arbitrary contract calls on the destination chain
|
|
23
|
+
- Designed for optimal performance with tree-shaking and dead-code elimination, ensuring minimal bundle sizes and faster page load times in front-end environments
|
|
24
|
+
- Compatibility tested with Node.js and popular front-end tools like Vite
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @lifi/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install --save @lifi/sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Set up the SDK
|
|
41
|
+
|
|
42
|
+
Firstly, create SDK config with your integrator string.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { createConfig } from '@lifi/sdk'
|
|
46
|
+
|
|
47
|
+
createConfig({
|
|
48
|
+
integrator: 'Your dApp/company name',
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Request a Quote
|
|
53
|
+
|
|
54
|
+
Now you can interact with the SDK and for example request a quote.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { ChainId, getQuote } from '@lifi/sdk'
|
|
58
|
+
|
|
59
|
+
const quote = await getQuote({
|
|
60
|
+
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
|
|
61
|
+
fromChain: ChainId.ARB,
|
|
62
|
+
toChain: ChainId.OPT,
|
|
63
|
+
fromToken: '0x0000000000000000000000000000000000000000',
|
|
64
|
+
toToken: '0x0000000000000000000000000000000000000000',
|
|
65
|
+
fromAmount: '1000000000000000000',
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Examples
|
|
70
|
+
|
|
71
|
+
See [examples](/examples) folder in this repository.
|
|
72
|
+
|
|
73
|
+
## Documentation
|
|
74
|
+
|
|
75
|
+
Please checkout the [SDK documentation](https://docs.li.fi/sdk/overview) and our [API reference](https://docs.li.fi/api-reference/introduction) for further information.
|
|
76
|
+
|
|
77
|
+
## Changelog
|
|
78
|
+
|
|
79
|
+
The [changelog](/CHANGELOG.md) is regularly updated to reflect what's changed in each new release.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EthereumProviderOptions, EthereumSDKProvider } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/EthereumProvider.d.ts
|
|
4
|
+
declare function EthereumProvider(options?: EthereumProviderOptions): EthereumSDKProvider;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { EthereumProvider };
|
|
7
|
+
//# sourceMappingURL=EthereumProvider.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_actions_getEthereumBalance = require("./actions/getEthereumBalance.js");
|
|
3
|
+
const require_actions_resolveEthereumAddress = require("./actions/resolveEthereumAddress.js");
|
|
4
|
+
const require_core_EthereumStepExecutor = require("./core/EthereumStepExecutor.js");
|
|
5
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
6
|
+
let viem = require("viem");
|
|
7
|
+
//#region src/EthereumProvider.ts
|
|
8
|
+
function EthereumProvider(options) {
|
|
9
|
+
const _options = options ?? {};
|
|
10
|
+
return {
|
|
11
|
+
get type() {
|
|
12
|
+
return _lifi_sdk.ChainType.EVM;
|
|
13
|
+
},
|
|
14
|
+
get options() {
|
|
15
|
+
return _options;
|
|
16
|
+
},
|
|
17
|
+
isAddress: viem.isAddress,
|
|
18
|
+
resolveAddress: require_actions_resolveEthereumAddress.resolveEthereumAddress,
|
|
19
|
+
getBalance: require_actions_getEthereumBalance.getEthereumBalance,
|
|
20
|
+
getWalletClient: _options.getWalletClient,
|
|
21
|
+
async getStepExecutor(options) {
|
|
22
|
+
if (!_options.getWalletClient) throw new Error("Client is not provided.");
|
|
23
|
+
return new require_core_EthereumStepExecutor.EthereumStepExecutor({
|
|
24
|
+
client: await _options.getWalletClient(),
|
|
25
|
+
switchChain: _options.switchChain,
|
|
26
|
+
disableMessageSigning: _options.disableMessageSigning,
|
|
27
|
+
routeId: options.routeId,
|
|
28
|
+
executionOptions: { ...options.executionOptions }
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
setOptions(options) {
|
|
32
|
+
Object.assign(_options, options);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.EthereumProvider = EthereumProvider;
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=EthereumProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumProvider.js","names":["ChainType","resolveEthereumAddress","getEthereumBalance","EthereumStepExecutor"],"sources":["../../src/EthereumProvider.ts"],"sourcesContent":["import { ChainType, type StepExecutorOptions } from '@lifi/sdk'\nimport { isAddress } from 'viem'\nimport { getEthereumBalance } from './actions/getEthereumBalance.js'\nimport { resolveEthereumAddress } from './actions/resolveEthereumAddress.js'\nimport { EthereumStepExecutor } from './core/EthereumStepExecutor.js'\nimport type { EthereumProviderOptions, EthereumSDKProvider } from './types.js'\n\nexport function EthereumProvider(\n options?: EthereumProviderOptions\n): EthereumSDKProvider {\n const _options: EthereumProviderOptions = options ?? {}\n return {\n get type() {\n return ChainType.EVM\n },\n get options() {\n return _options\n },\n isAddress,\n resolveAddress: resolveEthereumAddress,\n getBalance: getEthereumBalance,\n getWalletClient: _options.getWalletClient,\n async getStepExecutor(\n options: StepExecutorOptions\n ): Promise<EthereumStepExecutor> {\n if (!_options.getWalletClient) {\n throw new Error('Client is not provided.')\n }\n\n const walletClient = await _options.getWalletClient()\n\n const executor = new EthereumStepExecutor({\n client: walletClient,\n switchChain: _options.switchChain,\n disableMessageSigning: _options.disableMessageSigning,\n routeId: options.routeId,\n executionOptions: {\n ...options.executionOptions,\n },\n })\n\n return executor\n },\n setOptions(options: EthereumProviderOptions) {\n Object.assign(_options, options)\n },\n }\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,iBACd,SACqB;CACrB,MAAM,WAAoC,WAAW,CAAC;CACtD,OAAO;EACL,IAAI,OAAO;GACT,OAAOA,UAAAA,UAAU;EACnB;EACA,IAAI,UAAU;GACZ,OAAO;EACT;EACA,WAAA,KAAA;EACA,gBAAgBC,uCAAAA;EAChB,YAAYC,mCAAAA;EACZ,iBAAiB,SAAS;EAC1B,MAAM,gBACJ,SAC+B;GAC/B,IAAI,CAAC,SAAS,iBACZ,MAAM,IAAI,MAAM,yBAAyB;GAe3C,OAAO,IAVcC,kCAAAA,qBAAqB;IACxC,QAAQ,MAHiB,SAAS,gBAAgB;IAIlD,aAAa,SAAS;IACtB,uBAAuB,SAAS;IAChC,SAAS,QAAQ;IACjB,kBAAkB,EAChB,GAAG,QAAQ,iBACb;GACF,CAEc;EAChB;EACA,WAAW,SAAkC;GAC3C,OAAO,OAAO,UAAU,OAAO;EACjC;CACF;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ExtendedChain, SDKClient } from "@lifi/sdk";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/checkPermitSupport.d.ts
|
|
5
|
+
type PermitSupport = {
|
|
6
|
+
/** Whether the token supports EIP-2612 native permits */nativePermitSupported: boolean; /** Whether Permit2 is available and has sufficient allowance */
|
|
7
|
+
permit2AllowanceSufficient: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Checks what permit types are supported for a token on a specific chain.
|
|
11
|
+
* Checks in order:
|
|
12
|
+
* 1. Native permit (EIP-2612) support
|
|
13
|
+
* 2. Permit2 availability and allowance
|
|
14
|
+
*
|
|
15
|
+
* @param client - The SDK client
|
|
16
|
+
* @param chain - The chain to check permit support on
|
|
17
|
+
* @param tokenAddress - The token address to check
|
|
18
|
+
* @param ownerAddress - The address that would sign the permit
|
|
19
|
+
* @param amount - The amount to check allowance against for Permit2
|
|
20
|
+
* @returns Object indicating which permit types are supported
|
|
21
|
+
*/
|
|
22
|
+
declare const checkPermitSupport: (client: SDKClient, {
|
|
23
|
+
chain,
|
|
24
|
+
tokenAddress,
|
|
25
|
+
ownerAddress,
|
|
26
|
+
amount
|
|
27
|
+
}: {
|
|
28
|
+
chain: ExtendedChain;
|
|
29
|
+
tokenAddress: Address;
|
|
30
|
+
ownerAddress: Address;
|
|
31
|
+
amount: bigint;
|
|
32
|
+
}) => Promise<PermitSupport>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { checkPermitSupport };
|
|
35
|
+
//# sourceMappingURL=checkPermitSupport.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_client_publicClient = require("../client/publicClient.js");
|
|
3
|
+
const require_utils_getActionWithFallback = require("../utils/getActionWithFallback.js");
|
|
4
|
+
const require_actions_getAllowance = require("./getAllowance.js");
|
|
5
|
+
const require_permits_getNativePermit = require("../permits/getNativePermit.js");
|
|
6
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
7
|
+
//#region src/actions/checkPermitSupport.ts
|
|
8
|
+
/**
|
|
9
|
+
* Checks what permit types are supported for a token on a specific chain.
|
|
10
|
+
* Checks in order:
|
|
11
|
+
* 1. Native permit (EIP-2612) support
|
|
12
|
+
* 2. Permit2 availability and allowance
|
|
13
|
+
*
|
|
14
|
+
* @param client - The SDK client
|
|
15
|
+
* @param chain - The chain to check permit support on
|
|
16
|
+
* @param tokenAddress - The token address to check
|
|
17
|
+
* @param ownerAddress - The address that would sign the permit
|
|
18
|
+
* @param amount - The amount to check allowance against for Permit2
|
|
19
|
+
* @returns Object indicating which permit types are supported
|
|
20
|
+
*/
|
|
21
|
+
const checkPermitSupport = async (client, { chain, tokenAddress, ownerAddress, amount }) => {
|
|
22
|
+
let viemClient = await client.getProvider(_lifi_sdk.ChainType.EVM)?.getWalletClient?.();
|
|
23
|
+
if (!viemClient) viemClient = await require_client_publicClient.getPublicClient(client, chain.id);
|
|
24
|
+
const nativePermit = await require_utils_getActionWithFallback.getActionWithFallback(client, viemClient, require_permits_getNativePermit.getNativePermit, "getNativePermit", {
|
|
25
|
+
client,
|
|
26
|
+
viemClient,
|
|
27
|
+
chainId: chain.id,
|
|
28
|
+
tokenAddress,
|
|
29
|
+
spenderAddress: chain.permit2Proxy,
|
|
30
|
+
amount
|
|
31
|
+
});
|
|
32
|
+
let permit2Allowance;
|
|
33
|
+
if (chain.permit2) permit2Allowance = await require_actions_getAllowance.getAllowance(client, viemClient, tokenAddress, ownerAddress, chain.permit2);
|
|
34
|
+
return {
|
|
35
|
+
nativePermitSupported: !!nativePermit,
|
|
36
|
+
permit2AllowanceSufficient: !!permit2Allowance && permit2Allowance >= amount
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.checkPermitSupport = checkPermitSupport;
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=checkPermitSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkPermitSupport.js","names":["ChainType","getPublicClient","getActionWithFallback","getNativePermit","getAllowance"],"sources":["../../../src/actions/checkPermitSupport.ts"],"sourcesContent":["import { ChainType, type ExtendedChain, type SDKClient } from '@lifi/sdk'\nimport type { Address } from 'viem'\nimport { getPublicClient } from '../client/publicClient.js'\nimport { getNativePermit } from '../permits/getNativePermit.js'\nimport type { EthereumSDKProvider } from '../types.js'\nimport { getActionWithFallback } from '../utils/getActionWithFallback.js'\nimport { getAllowance } from './getAllowance.js'\n\ntype PermitSupport = {\n /** Whether the token supports EIP-2612 native permits */\n nativePermitSupported: boolean\n /** Whether Permit2 is available and has sufficient allowance */\n permit2AllowanceSufficient: boolean\n}\n\n/**\n * Checks what permit types are supported for a token on a specific chain.\n * Checks in order:\n * 1. Native permit (EIP-2612) support\n * 2. Permit2 availability and allowance\n *\n * @param client - The SDK client\n * @param chain - The chain to check permit support on\n * @param tokenAddress - The token address to check\n * @param ownerAddress - The address that would sign the permit\n * @param amount - The amount to check allowance against for Permit2\n * @returns Object indicating which permit types are supported\n */\nexport const checkPermitSupport = async (\n client: SDKClient,\n {\n chain,\n tokenAddress,\n ownerAddress,\n amount,\n }: {\n chain: ExtendedChain\n tokenAddress: Address\n ownerAddress: Address\n amount: bigint\n }\n): Promise<PermitSupport> => {\n const provider = client.getProvider(ChainType.EVM) as\n | EthereumSDKProvider\n | undefined\n let viemClient = await provider?.getWalletClient?.()\n\n if (!viemClient) {\n viemClient = await getPublicClient(client, chain.id)\n }\n\n const nativePermit = await getActionWithFallback(\n client,\n viemClient,\n getNativePermit,\n 'getNativePermit',\n {\n client,\n viemClient,\n chainId: chain.id,\n tokenAddress,\n spenderAddress: chain.permit2Proxy as Address,\n amount,\n }\n )\n\n let permit2Allowance: bigint | undefined\n // Check Permit2 allowance if available on chain\n if (chain.permit2) {\n permit2Allowance = await getAllowance(\n client,\n viemClient,\n tokenAddress,\n ownerAddress,\n chain.permit2 as Address\n )\n }\n\n return {\n nativePermitSupported: !!nativePermit,\n permit2AllowanceSufficient:\n !!permit2Allowance && permit2Allowance >= amount,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,qBAAqB,OAChC,QACA,EACE,OACA,cACA,cACA,aAOyB;CAI3B,IAAI,aAAa,MAHA,OAAO,YAAYA,UAAAA,UAAU,GAGhB,GAAG,kBAAkB;CAEnD,IAAI,CAAC,YACH,aAAa,MAAMC,4BAAAA,gBAAgB,QAAQ,MAAM,EAAE;CAGrD,MAAM,eAAe,MAAMC,oCAAAA,sBACzB,QACA,YACAC,gCAAAA,iBACA,mBACA;EACE;EACA;EACA,SAAS,MAAM;EACf;EACA,gBAAgB,MAAM;EACtB;CACF,CACF;CAEA,IAAI;CAEJ,IAAI,MAAM,SACR,mBAAmB,MAAMC,6BAAAA,aACvB,QACA,YACA,cACA,cACA,MAAM,OACR;CAGF,OAAO;EACL,uBAAuB,CAAC,CAAC;EACzB,4BACE,CAAC,CAAC,oBAAoB,oBAAoB;CAC9C;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChainId, ChainType } from "@lifi/sdk";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/constants.d.ts
|
|
5
|
+
declare const UNS_PROXY_READER_ADDRESSES: Record<number, Address>;
|
|
6
|
+
declare const getUNSProxyAddress: (chainId: number) => Address | undefined;
|
|
7
|
+
declare const UNSProxyReaderABI: readonly [{
|
|
8
|
+
readonly constant: true;
|
|
9
|
+
readonly inputs: readonly [{
|
|
10
|
+
readonly internalType: "string[]";
|
|
11
|
+
readonly name: "keys";
|
|
12
|
+
readonly type: "string[]";
|
|
13
|
+
}, {
|
|
14
|
+
readonly internalType: "uint256";
|
|
15
|
+
readonly name: "tokenId";
|
|
16
|
+
readonly type: "uint256";
|
|
17
|
+
}];
|
|
18
|
+
readonly name: "getData";
|
|
19
|
+
readonly outputs: readonly [{
|
|
20
|
+
readonly internalType: "address";
|
|
21
|
+
readonly name: "resolver";
|
|
22
|
+
readonly type: "address";
|
|
23
|
+
}, {
|
|
24
|
+
readonly internalType: "address";
|
|
25
|
+
readonly name: "owner";
|
|
26
|
+
readonly type: "address";
|
|
27
|
+
}, {
|
|
28
|
+
readonly internalType: "string[]";
|
|
29
|
+
readonly name: "values";
|
|
30
|
+
readonly type: "string[]";
|
|
31
|
+
}];
|
|
32
|
+
readonly payable: false;
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
}, {
|
|
36
|
+
readonly inputs: readonly [{
|
|
37
|
+
readonly internalType: "uint256";
|
|
38
|
+
readonly name: "tokenId";
|
|
39
|
+
readonly type: "uint256";
|
|
40
|
+
}];
|
|
41
|
+
readonly name: "exists";
|
|
42
|
+
readonly outputs: readonly [{
|
|
43
|
+
readonly internalType: "bool";
|
|
44
|
+
readonly name: "";
|
|
45
|
+
readonly type: "bool";
|
|
46
|
+
}];
|
|
47
|
+
readonly stateMutability: "view";
|
|
48
|
+
readonly type: "function";
|
|
49
|
+
}];
|
|
50
|
+
declare const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string>;
|
|
51
|
+
declare const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>>;
|
|
52
|
+
declare const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { CHAIN_ID_UNS_CHAIN_MAP, CHAIN_TYPE_FAMILY_MAP, CHAIN_TYPE_UNS_CHAIN_MAP, UNSProxyReaderABI, UNS_PROXY_READER_ADDRESSES, getUNSProxyAddress };
|
|
55
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
3
|
+
//#region src/actions/constants.ts
|
|
4
|
+
const UNS_PROXY_READER_ADDRESSES = {
|
|
5
|
+
[_lifi_sdk.ChainId.ETH]: "0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B",
|
|
6
|
+
[_lifi_sdk.ChainId.POL]: "0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091"
|
|
7
|
+
};
|
|
8
|
+
const getUNSProxyAddress = (chainId) => UNS_PROXY_READER_ADDRESSES[chainId];
|
|
9
|
+
const UNSProxyReaderABI = [{
|
|
10
|
+
constant: true,
|
|
11
|
+
inputs: [{
|
|
12
|
+
internalType: "string[]",
|
|
13
|
+
name: "keys",
|
|
14
|
+
type: "string[]"
|
|
15
|
+
}, {
|
|
16
|
+
internalType: "uint256",
|
|
17
|
+
name: "tokenId",
|
|
18
|
+
type: "uint256"
|
|
19
|
+
}],
|
|
20
|
+
name: "getData",
|
|
21
|
+
outputs: [
|
|
22
|
+
{
|
|
23
|
+
internalType: "address",
|
|
24
|
+
name: "resolver",
|
|
25
|
+
type: "address"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
internalType: "address",
|
|
29
|
+
name: "owner",
|
|
30
|
+
type: "address"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
internalType: "string[]",
|
|
34
|
+
name: "values",
|
|
35
|
+
type: "string[]"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
payable: false,
|
|
39
|
+
stateMutability: "view",
|
|
40
|
+
type: "function"
|
|
41
|
+
}, {
|
|
42
|
+
inputs: [{
|
|
43
|
+
internalType: "uint256",
|
|
44
|
+
name: "tokenId",
|
|
45
|
+
type: "uint256"
|
|
46
|
+
}],
|
|
47
|
+
name: "exists",
|
|
48
|
+
outputs: [{
|
|
49
|
+
internalType: "bool",
|
|
50
|
+
name: "",
|
|
51
|
+
type: "bool"
|
|
52
|
+
}],
|
|
53
|
+
stateMutability: "view",
|
|
54
|
+
type: "function"
|
|
55
|
+
}];
|
|
56
|
+
const CHAIN_TYPE_UNS_CHAIN_MAP = {
|
|
57
|
+
[_lifi_sdk.ChainType.EVM]: "ETH",
|
|
58
|
+
[_lifi_sdk.ChainType.MVM]: "SUI",
|
|
59
|
+
[_lifi_sdk.ChainType.SVM]: "SOL",
|
|
60
|
+
[_lifi_sdk.ChainType.UTXO]: "BTC",
|
|
61
|
+
[_lifi_sdk.ChainType.TVM]: "TRON",
|
|
62
|
+
[_lifi_sdk.ChainType.STL]: "XLM"
|
|
63
|
+
};
|
|
64
|
+
const CHAIN_ID_UNS_CHAIN_MAP = {
|
|
65
|
+
[_lifi_sdk.ChainId.ETH]: "ETH",
|
|
66
|
+
[_lifi_sdk.ChainId.BTC]: "BTC",
|
|
67
|
+
[_lifi_sdk.ChainId.SUI]: "SUI",
|
|
68
|
+
[_lifi_sdk.ChainId.SOL]: "SOL",
|
|
69
|
+
[_lifi_sdk.ChainId.BAS]: "BASE",
|
|
70
|
+
[_lifi_sdk.ChainId.POL]: "MATIC",
|
|
71
|
+
[_lifi_sdk.ChainId.ARB]: "ARB1",
|
|
72
|
+
[_lifi_sdk.ChainId.AVA]: "AVAX"
|
|
73
|
+
};
|
|
74
|
+
const CHAIN_TYPE_FAMILY_MAP = {
|
|
75
|
+
[_lifi_sdk.ChainType.EVM]: "EVM",
|
|
76
|
+
[_lifi_sdk.ChainType.UTXO]: "BTC",
|
|
77
|
+
[_lifi_sdk.ChainType.SVM]: "SOL",
|
|
78
|
+
[_lifi_sdk.ChainType.MVM]: "SUI",
|
|
79
|
+
[_lifi_sdk.ChainType.TVM]: "TRON",
|
|
80
|
+
[_lifi_sdk.ChainType.STL]: "XLM"
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.CHAIN_ID_UNS_CHAIN_MAP = CHAIN_ID_UNS_CHAIN_MAP;
|
|
84
|
+
exports.CHAIN_TYPE_FAMILY_MAP = CHAIN_TYPE_FAMILY_MAP;
|
|
85
|
+
exports.CHAIN_TYPE_UNS_CHAIN_MAP = CHAIN_TYPE_UNS_CHAIN_MAP;
|
|
86
|
+
exports.UNSProxyReaderABI = UNSProxyReaderABI;
|
|
87
|
+
exports.UNS_PROXY_READER_ADDRESSES = UNS_PROXY_READER_ADDRESSES;
|
|
88
|
+
exports.getUNSProxyAddress = getUNSProxyAddress;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["ChainId","ChainType"],"sources":["../../../src/actions/constants.ts"],"sourcesContent":["import { ChainId, ChainType } from '@lifi/sdk'\nimport type { Address } from 'viem'\n\nexport const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {\n [ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',\n [ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',\n} as const\n\nexport const getUNSProxyAddress = (chainId: number): Address | undefined =>\n UNS_PROXY_READER_ADDRESSES[chainId]\n\nexport const UNSProxyReaderABI = [\n {\n constant: true,\n inputs: [\n {\n internalType: 'string[]',\n name: 'keys',\n type: 'string[]',\n },\n {\n internalType: 'uint256',\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n name: 'getData',\n outputs: [\n {\n internalType: 'address',\n name: 'resolver',\n type: 'address',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'string[]',\n name: 'values',\n type: 'string[]',\n },\n ],\n payable: false,\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],\n name: 'exists',\n outputs: [{ internalType: 'bool', name: '', type: 'bool' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n\nexport const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'ETH',\n [ChainType.MVM]: 'SUI',\n [ChainType.SVM]: 'SOL',\n [ChainType.UTXO]: 'BTC',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n\nexport const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {\n [ChainId.ETH]: 'ETH',\n [ChainId.BTC]: 'BTC',\n [ChainId.SUI]: 'SUI',\n [ChainId.SOL]: 'SOL',\n [ChainId.BAS]: 'BASE',\n [ChainId.POL]: 'MATIC',\n [ChainId.ARB]: 'ARB1',\n [ChainId.AVA]: 'AVAX',\n}\n\nexport const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'EVM',\n [ChainType.UTXO]: 'BTC',\n [ChainType.SVM]: 'SOL',\n [ChainType.MVM]: 'SUI',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n"],"mappings":";;;AAGA,MAAa,6BAAsD;EAChEA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;AACjB;AAEA,MAAa,sBAAsB,YACjC,2BAA2B;AAE7B,MAAa,oBAAoB,CAC/B;CACE,UAAU;CACV,QAAQ,CACN;EACE,cAAc;EACd,MAAM;EACN,MAAM;CACR,GACA;EACE,cAAc;EACd,MAAM;EACN,MAAM;CACR,CACF;CACA,MAAM;CACN,SAAS;EACP;GACE,cAAc;GACd,MAAM;GACN,MAAM;EACR;EACA;GACE,cAAc;GACd,MAAM;GACN,MAAM;EACR;EACA;GACE,cAAc;GACd,MAAM;GACN,MAAM;EACR;CACF;CACA,SAAS;CACT,iBAAiB;CACjB,MAAM;AACR,GACA;CACE,QAAQ,CAAC;EAAE,cAAc;EAAW,MAAM;EAAW,MAAM;CAAU,CAAC;CACtE,MAAM;CACN,SAAS,CAAC;EAAE,cAAc;EAAQ,MAAM;EAAI,MAAM;CAAO,CAAC;CAC1D,iBAAiB;CACjB,MAAM;AACR,CACF;AAEA,MAAa,2BAAsD;EAChEC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;AACnB;AAEA,MAAa,yBAA2D;EACrED,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;AACjB;AAEA,MAAa,wBAAmD;EAC7DC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;AACnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SDKClient } from "@lifi/sdk";
|
|
2
|
+
import { Address, Hex } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/getAccountCode.d.ts
|
|
5
|
+
type GetAccountCodeParams = {
|
|
6
|
+
client: SDKClient;
|
|
7
|
+
chainId: number;
|
|
8
|
+
address: Address;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Shared `eth_getCode` fetcher. Deliberately uncached across executions so
|
|
12
|
+
* a wallet re-delegate / upgrade / un-delegate in another tab is never
|
|
13
|
+
* served stale; `withDedupe` only collapses concurrent in-flight callers.
|
|
14
|
+
*
|
|
15
|
+
* Always queries the SDK's per-chain public client (never the wallet
|
|
16
|
+
* client) so cross-chain steps and post-chain-switch flows read from the
|
|
17
|
+
* chain the step actually executes on.
|
|
18
|
+
*
|
|
19
|
+
* Returns `undefined` on RPC failure. Each caller MUST classify that
|
|
20
|
+
* explicitly (e.g. "treat as EOA" vs. "treat as not-permittable") — there
|
|
21
|
+
* is no single safe default.
|
|
22
|
+
*/
|
|
23
|
+
declare const getAccountCode: ({
|
|
24
|
+
client,
|
|
25
|
+
chainId,
|
|
26
|
+
address
|
|
27
|
+
}: GetAccountCodeParams) => Promise<Hex | undefined>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { getAccountCode };
|
|
30
|
+
//# sourceMappingURL=getAccountCode.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_client_publicClient = require("../client/publicClient.js");
|
|
3
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
4
|
+
let viem_actions = require("viem/actions");
|
|
5
|
+
let viem_utils = require("viem/utils");
|
|
6
|
+
//#region src/actions/getAccountCode.ts
|
|
7
|
+
/**
|
|
8
|
+
* Shared `eth_getCode` fetcher. Deliberately uncached across executions so
|
|
9
|
+
* a wallet re-delegate / upgrade / un-delegate in another tab is never
|
|
10
|
+
* served stale; `withDedupe` only collapses concurrent in-flight callers.
|
|
11
|
+
*
|
|
12
|
+
* Always queries the SDK's per-chain public client (never the wallet
|
|
13
|
+
* client) so cross-chain steps and post-chain-switch flows read from the
|
|
14
|
+
* chain the step actually executes on.
|
|
15
|
+
*
|
|
16
|
+
* Returns `undefined` on RPC failure. Each caller MUST classify that
|
|
17
|
+
* explicitly (e.g. "treat as EOA" vs. "treat as not-permittable") — there
|
|
18
|
+
* is no single safe default.
|
|
19
|
+
*/
|
|
20
|
+
const getAccountCode = ({ client, chainId, address }) => (0, _lifi_sdk.withDedupe)(async () => {
|
|
21
|
+
try {
|
|
22
|
+
return await (0, viem_utils.getAction)(await require_client_publicClient.getPublicClient(client, chainId), viem_actions.getCode, "getCode")({ address });
|
|
23
|
+
} catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}, { id: `getAccountCode:${chainId}:${address.toLowerCase()}` });
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.getAccountCode = getAccountCode;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=getAccountCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAccountCode.js","names":["getPublicClient","getCode"],"sources":["../../../src/actions/getAccountCode.ts"],"sourcesContent":["import { type SDKClient, withDedupe } from '@lifi/sdk'\nimport type { Address, Hex } from 'viem'\nimport { getCode } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { getPublicClient } from '../client/publicClient.js'\n\ntype GetAccountCodeParams = {\n client: SDKClient\n chainId: number\n address: Address\n}\n\n/**\n * Shared `eth_getCode` fetcher. Deliberately uncached across executions so\n * a wallet re-delegate / upgrade / un-delegate in another tab is never\n * served stale; `withDedupe` only collapses concurrent in-flight callers.\n *\n * Always queries the SDK's per-chain public client (never the wallet\n * client) so cross-chain steps and post-chain-switch flows read from the\n * chain the step actually executes on.\n *\n * Returns `undefined` on RPC failure. Each caller MUST classify that\n * explicitly (e.g. \"treat as EOA\" vs. \"treat as not-permittable\") — there\n * is no single safe default.\n */\nexport const getAccountCode = ({\n client,\n chainId,\n address,\n}: GetAccountCodeParams): Promise<Hex | undefined> =>\n withDedupe(\n async () => {\n try {\n const publicClient = await getPublicClient(client, chainId)\n return await getAction(publicClient, getCode, 'getCode')({ address })\n } catch {\n return undefined\n }\n },\n { id: `getAccountCode:${chainId}:${address.toLowerCase()}` }\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,MAAa,kBAAkB,EAC7B,QACA,SACA,eAAA,GAAA,UAAA,YAGE,YAAY;CACV,IAAI;EAEF,OAAO,OAAA,GAAA,WAAA,WAAgB,MADIA,4BAAAA,gBAAgB,QAAQ,OAAO,GACrBC,aAAAA,SAAS,SAAS,EAAE,EAAE,QAAQ,CAAC;CACtE,QAAQ;EACN;CACF;AACF,GACA,EAAE,IAAI,kBAAkB,QAAQ,GAAG,QAAQ,YAAY,IAAI,CAC7D"}
|