@lifi/sdk-provider-ethereum 4.2.11 → 4.3.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.
Files changed (582) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/dist/cjs/EthereumProvider.d.ts +1 -4
  3. package/dist/cjs/EthereumProvider.js +1 -2
  4. package/dist/cjs/actions/checkPermitSupport.d.ts +1 -4
  5. package/dist/cjs/actions/checkPermitSupport.js +5 -6
  6. package/dist/cjs/actions/checkPermitSupport.js.map +1 -1
  7. package/dist/cjs/actions/constants.d.ts +1 -4
  8. package/dist/cjs/actions/constants.js +1 -2
  9. package/dist/cjs/actions/getAccountCode.d.ts +1 -4
  10. package/dist/cjs/actions/getAccountCode.js +1 -2
  11. package/dist/cjs/actions/getAllowance.d.ts +2 -5
  12. package/dist/cjs/actions/getAllowance.js +6 -7
  13. package/dist/cjs/actions/getAllowance.js.map +1 -1
  14. package/dist/cjs/actions/getEthereumBalance.d.ts +1 -4
  15. package/dist/cjs/actions/getEthereumBalance.js +1 -2
  16. package/dist/cjs/actions/getMaxPriorityFeePerGas.d.ts +1 -4
  17. package/dist/cjs/actions/getMaxPriorityFeePerGas.js +3 -4
  18. package/dist/cjs/actions/getMaxPriorityFeePerGas.js.map +1 -1
  19. package/dist/cjs/actions/getMulticallAddress.d.ts +1 -4
  20. package/dist/cjs/actions/getMulticallAddress.js +1 -2
  21. package/dist/cjs/actions/isBatchingSupported.d.ts +1 -4
  22. package/dist/cjs/actions/isBatchingSupported.js +1 -2
  23. package/dist/cjs/actions/isSafeSignature.d.ts +2 -5
  24. package/dist/cjs/actions/isSafeSignature.js +3 -3
  25. package/dist/cjs/actions/isSafeSignature.js.map +1 -1
  26. package/dist/cjs/actions/isSafeWallet.d.ts +1 -4
  27. package/dist/cjs/actions/isSafeWallet.js +2 -3
  28. package/dist/cjs/actions/isSmartContractWallet.d.ts +1 -4
  29. package/dist/cjs/actions/isSmartContractWallet.js +1 -2
  30. package/dist/cjs/actions/resolveENSAddress.d.ts +1 -4
  31. package/dist/cjs/actions/resolveENSAddress.js +1 -2
  32. package/dist/cjs/actions/resolveEthereumAddress.d.ts +1 -4
  33. package/dist/cjs/actions/resolveEthereumAddress.js +1 -2
  34. package/dist/cjs/actions/resolveTransactionHash.d.ts +1 -4
  35. package/dist/cjs/actions/resolveTransactionHash.js +7 -4
  36. package/dist/cjs/actions/resolveTransactionHash.js.map +1 -1
  37. package/dist/cjs/actions/resolveUNSAddress.d.ts +1 -4
  38. package/dist/cjs/actions/resolveUNSAddress.js +2 -3
  39. package/dist/cjs/actions/setAllowance.d.ts +3 -6
  40. package/dist/cjs/actions/setAllowance.js +10 -7
  41. package/dist/cjs/actions/setAllowance.js.map +1 -1
  42. package/dist/cjs/actions/waitForBatchTransactionReceipt.d.ts +1 -4
  43. package/dist/cjs/actions/waitForBatchTransactionReceipt.js +1 -2
  44. package/dist/cjs/actions/waitForRelayedTransactionReceipt.d.ts +2 -5
  45. package/dist/cjs/actions/waitForRelayedTransactionReceipt.js +50 -12
  46. package/dist/cjs/actions/waitForRelayedTransactionReceipt.js.map +1 -1
  47. package/dist/cjs/actions/waitForSafeTransactionExecution.d.ts +1 -4
  48. package/dist/cjs/actions/waitForSafeTransactionExecution.js +2 -3
  49. package/dist/cjs/actions/waitForTransactionReceipt.d.ts +1 -4
  50. package/dist/cjs/actions/waitForTransactionReceipt.js +1 -2
  51. package/dist/cjs/client/publicClient.d.ts +1 -4
  52. package/dist/cjs/client/publicClient.js +1 -2
  53. package/dist/cjs/client/safeClient.d.ts +1 -4
  54. package/dist/cjs/client/safeClient.js +1 -2
  55. package/dist/cjs/client/types.d.ts +1 -4
  56. package/dist/cjs/core/EthereumStepExecutor.d.ts +1 -4
  57. package/dist/cjs/core/EthereumStepExecutor.js +4 -3
  58. package/dist/cjs/core/EthereumStepExecutor.js.map +1 -1
  59. package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +1 -4
  60. package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js +5 -3
  61. package/dist/cjs/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -1
  62. package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +1 -4
  63. package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js +1 -2
  64. package/dist/cjs/core/tasks/EthereumBatchedWaitForTransactionTask.js.map +1 -1
  65. package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts +17 -0
  66. package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js +33 -0
  67. package/dist/cjs/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js.map +1 -0
  68. package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -4
  69. package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js +3 -4
  70. package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.js.map +1 -1
  71. package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +1 -4
  72. package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +3 -3
  73. package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
  74. package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +1 -4
  75. package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +2 -3
  76. package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +1 -4
  77. package/dist/cjs/core/tasks/EthereumNativePermitTask.js +5 -6
  78. package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -1
  79. package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.d.ts +1 -4
  80. package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js +1 -2
  81. package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.d.ts +1 -4
  82. package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +7 -6
  83. package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
  84. package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +1 -4
  85. package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +3 -4
  86. package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +1 -4
  87. package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js +2 -3
  88. package/dist/cjs/core/tasks/EthereumRelayedWaitForTransactionTask.js.map +1 -1
  89. package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +1 -4
  90. package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js +6 -6
  91. package/dist/cjs/core/tasks/EthereumResetAllowanceTask.js.map +1 -1
  92. package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +1 -4
  93. package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +7 -7
  94. package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
  95. package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.d.ts +1 -4
  96. package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js +2 -3
  97. package/dist/cjs/core/tasks/EthereumSignAndExecuteTask.js.map +1 -1
  98. package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +1 -4
  99. package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +6 -6
  100. package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
  101. package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +1 -4
  102. package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js +1 -2
  103. package/dist/cjs/core/tasks/EthereumStandardWaitForTransactionTask.js.map +1 -1
  104. package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +1 -4
  105. package/dist/cjs/core/tasks/EthereumWaitForTransactionStatusTask.js +1 -2
  106. package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.d.ts +1 -4
  107. package/dist/cjs/core/tasks/EthereumWaitForTransactionTask.js +2 -3
  108. package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -4
  109. package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js +3 -4
  110. package/dist/cjs/core/tasks/helpers/estimateTransactionRequest.js.map +1 -1
  111. package/dist/cjs/core/tasks/helpers/findSignedNativePermit.d.ts +1 -4
  112. package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js +2 -3
  113. package/dist/cjs/core/tasks/helpers/getApprovalAmount.d.ts +1 -4
  114. package/dist/cjs/core/tasks/helpers/getApprovalAmount.js +2 -3
  115. package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +1 -4
  116. package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +6 -4
  117. package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
  118. package/dist/cjs/core/tasks/helpers/getTxLink.d.ts +1 -4
  119. package/dist/cjs/core/tasks/helpers/getTxLink.js +1 -2
  120. package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +10 -5
  121. package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +11 -20
  122. package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -1
  123. package/dist/cjs/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts +8 -0
  124. package/dist/cjs/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js +16 -0
  125. package/dist/cjs/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js.map +1 -0
  126. package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +1 -4
  127. package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js +1 -2
  128. package/dist/cjs/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts +1 -4
  129. package/dist/cjs/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.js +1 -2
  130. package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +1 -4
  131. package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js +1 -2
  132. package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.d.ts +1 -4
  133. package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js +1 -2
  134. package/dist/cjs/core/tasks/helpers/resolveAllowanceSpender.d.ts +1 -4
  135. package/dist/cjs/core/tasks/helpers/resolveAllowanceSpender.js +1 -2
  136. package/dist/cjs/core/tasks/helpers/resolvePermit2Support.d.ts +1 -4
  137. package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js +1 -2
  138. package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.d.ts +1 -4
  139. package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js +2 -2
  140. package/dist/cjs/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -1
  141. package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -4
  142. package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +3 -4
  143. package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
  144. package/dist/cjs/core/tasks/helpers/signTypedDataEntries.d.ts +1 -4
  145. package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js +1 -2
  146. package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js.map +1 -1
  147. package/dist/cjs/core/tasks/helpers/switchChain.d.ts +1 -4
  148. package/dist/cjs/core/tasks/helpers/switchChain.js +1 -2
  149. package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.d.ts +1 -4
  150. package/dist/cjs/core/tasks/helpers/updateActionWithReceipt.js +1 -2
  151. package/dist/cjs/errors/parseEthereumErrors.d.ts +1 -4
  152. package/dist/cjs/errors/parseEthereumErrors.js +3 -3
  153. package/dist/cjs/errors/parseEthereumErrors.js.map +1 -1
  154. package/dist/cjs/hyperliquid/agentWallet.d.ts +1 -4
  155. package/dist/cjs/hyperliquid/agentWallet.js +1 -2
  156. package/dist/cjs/hyperliquid/isHyperliquidAgentStep.d.ts +1 -4
  157. package/dist/cjs/hyperliquid/isHyperliquidAgentStep.js +1 -2
  158. package/dist/cjs/index.d.ts +2 -2
  159. package/dist/cjs/index.js +8 -8
  160. package/dist/cjs/permits/acceptsRawEcdsaSignature.d.ts +1 -4
  161. package/dist/cjs/permits/acceptsRawEcdsaSignature.js +1 -2
  162. package/dist/cjs/permits/allowanceTransfer.d.ts +1 -4
  163. package/dist/cjs/permits/allowanceTransfer.js +1 -2
  164. package/dist/cjs/permits/allowanceTransfer.js.map +1 -1
  165. package/dist/cjs/permits/canAccountUseNativePermits.d.ts +1 -4
  166. package/dist/cjs/permits/canAccountUseNativePermits.js +1 -2
  167. package/dist/cjs/permits/canAccountUsePermit2.d.ts +1 -4
  168. package/dist/cjs/permits/canAccountUsePermit2.js +1 -2
  169. package/dist/cjs/permits/constants.d.ts +1 -4
  170. package/dist/cjs/permits/constants.js +1 -2
  171. package/dist/cjs/permits/domain.d.ts +1 -4
  172. package/dist/cjs/permits/domain.js +1 -2
  173. package/dist/cjs/permits/encodeNativePermitData.d.ts +1 -4
  174. package/dist/cjs/permits/encodeNativePermitData.js +1 -2
  175. package/dist/cjs/permits/encodePermit2Data.d.ts +1 -4
  176. package/dist/cjs/permits/encodePermit2Data.js +1 -2
  177. package/dist/cjs/permits/getNativePermit.d.ts +1 -4
  178. package/dist/cjs/permits/getNativePermit.js +6 -7
  179. package/dist/cjs/permits/getNativePermit.js.map +1 -1
  180. package/dist/cjs/permits/getPermitTransferFromValues.d.ts +1 -4
  181. package/dist/cjs/permits/getPermitTransferFromValues.js +2 -3
  182. package/dist/cjs/permits/getPermitTransferFromValues.js.map +1 -1
  183. package/dist/cjs/permits/invariant.d.ts +1 -4
  184. package/dist/cjs/permits/invariant.js +1 -2
  185. package/dist/cjs/permits/isDelegationDesignatorCode.d.ts +1 -4
  186. package/dist/cjs/permits/isDelegationDesignatorCode.js +1 -2
  187. package/dist/cjs/permits/isNativePermitValid.d.ts +1 -4
  188. package/dist/cjs/permits/isNativePermitValid.js +2 -3
  189. package/dist/cjs/permits/isNativePermitValid.js.map +1 -1
  190. package/dist/cjs/permits/signPermit2Message.d.ts +1 -4
  191. package/dist/cjs/permits/signPermit2Message.js +1 -2
  192. package/dist/cjs/permits/signPermit2Message.js.map +1 -1
  193. package/dist/cjs/permits/signatureTransfer.d.ts +1 -4
  194. package/dist/cjs/permits/signatureTransfer.js +1 -2
  195. package/dist/cjs/permits/signatureTransfer.js.map +1 -1
  196. package/dist/cjs/permits/types.d.ts +1 -4
  197. package/dist/cjs/types.d.ts +7 -4
  198. package/dist/cjs/types.js +1 -2
  199. package/dist/cjs/types.js.map +1 -1
  200. package/dist/cjs/utils/abi.d.ts +1 -4
  201. package/dist/cjs/utils/abi.js +1 -2
  202. package/dist/cjs/utils/convertExtendedChain.d.ts +1 -4
  203. package/dist/cjs/utils/convertExtendedChain.js +1 -2
  204. package/dist/cjs/utils/getActionWithFallback.d.ts +2 -4
  205. package/dist/cjs/utils/getActionWithFallback.js +3 -4
  206. package/dist/cjs/utils/getActionWithFallback.js.map +1 -1
  207. package/dist/cjs/utils/getDomainChainId.d.ts +1 -4
  208. package/dist/cjs/utils/getDomainChainId.js +1 -2
  209. package/dist/cjs/utils/getSafeApiKey.d.ts +1 -4
  210. package/dist/cjs/utils/getSafeApiKey.js +1 -2
  211. package/dist/cjs/utils/getSendChain.d.ts +2 -0
  212. package/dist/cjs/utils/getSendChain.js +6 -0
  213. package/dist/cjs/utils/getSendChain.js.map +1 -0
  214. package/dist/cjs/utils/getTypedDataLane.d.ts +1 -4
  215. package/dist/cjs/utils/getTypedDataLane.js +1 -2
  216. package/dist/cjs/utils/isContractCallStep.d.ts +1 -4
  217. package/dist/cjs/utils/isContractCallStep.js +1 -2
  218. package/dist/cjs/utils/isExtendedChain.d.ts +1 -4
  219. package/dist/cjs/utils/isExtendedChain.js +1 -2
  220. package/dist/cjs/utils/isGaslessStep.d.ts +8 -4
  221. package/dist/cjs/utils/isGaslessStep.js +8 -2
  222. package/dist/cjs/utils/isGaslessStep.js.map +1 -1
  223. package/dist/cjs/utils/isValidSignature.d.ts +1 -4
  224. package/dist/cjs/utils/isValidSignature.js +1 -2
  225. package/dist/cjs/utils/isZeroAddress.d.ts +1 -4
  226. package/dist/cjs/utils/isZeroAddress.js +1 -2
  227. package/dist/cjs/utils/median.d.ts +1 -4
  228. package/dist/cjs/utils/median.js +1 -2
  229. package/dist/cjs/version.d.ts +1 -4
  230. package/dist/cjs/version.js +2 -3
  231. package/dist/cjs/version.js.map +1 -1
  232. package/dist/esm/EthereumProvider.d.ts +0 -2
  233. package/dist/esm/EthereumProvider.d.ts.map +1 -1
  234. package/dist/esm/EthereumProvider.js +1 -2
  235. package/dist/esm/actions/checkPermitSupport.d.ts +0 -2
  236. package/dist/esm/actions/checkPermitSupport.d.ts.map +1 -1
  237. package/dist/esm/actions/checkPermitSupport.js +5 -6
  238. package/dist/esm/actions/checkPermitSupport.js.map +1 -1
  239. package/dist/esm/actions/constants.d.ts +0 -2
  240. package/dist/esm/actions/constants.d.ts.map +1 -1
  241. package/dist/esm/actions/constants.js +1 -2
  242. package/dist/esm/actions/getAccountCode.d.ts +0 -2
  243. package/dist/esm/actions/getAccountCode.d.ts.map +1 -1
  244. package/dist/esm/actions/getAccountCode.js +1 -2
  245. package/dist/esm/actions/getAllowance.d.ts +1 -3
  246. package/dist/esm/actions/getAllowance.d.ts.map +1 -1
  247. package/dist/esm/actions/getAllowance.js +6 -7
  248. package/dist/esm/actions/getAllowance.js.map +1 -1
  249. package/dist/esm/actions/getEthereumBalance.d.ts +0 -2
  250. package/dist/esm/actions/getEthereumBalance.d.ts.map +1 -1
  251. package/dist/esm/actions/getEthereumBalance.js +1 -2
  252. package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts +1 -3
  253. package/dist/esm/actions/getMaxPriorityFeePerGas.d.ts.map +1 -1
  254. package/dist/esm/actions/getMaxPriorityFeePerGas.js +3 -4
  255. package/dist/esm/actions/getMaxPriorityFeePerGas.js.map +1 -1
  256. package/dist/esm/actions/getMulticallAddress.d.ts +0 -2
  257. package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -1
  258. package/dist/esm/actions/getMulticallAddress.js +1 -2
  259. package/dist/esm/actions/isBatchingSupported.d.ts +0 -2
  260. package/dist/esm/actions/isBatchingSupported.d.ts.map +1 -1
  261. package/dist/esm/actions/isBatchingSupported.js +1 -2
  262. package/dist/esm/actions/isSafeSignature.d.ts +1 -3
  263. package/dist/esm/actions/isSafeSignature.d.ts.map +1 -1
  264. package/dist/esm/actions/isSafeSignature.js +3 -3
  265. package/dist/esm/actions/isSafeSignature.js.map +1 -1
  266. package/dist/esm/actions/isSafeWallet.d.ts +0 -2
  267. package/dist/esm/actions/isSafeWallet.d.ts.map +1 -1
  268. package/dist/esm/actions/isSafeWallet.js +2 -3
  269. package/dist/esm/actions/isSmartContractWallet.d.ts +0 -2
  270. package/dist/esm/actions/isSmartContractWallet.d.ts.map +1 -1
  271. package/dist/esm/actions/isSmartContractWallet.js +1 -2
  272. package/dist/esm/actions/resolveENSAddress.d.ts +0 -2
  273. package/dist/esm/actions/resolveENSAddress.d.ts.map +1 -1
  274. package/dist/esm/actions/resolveENSAddress.js +1 -2
  275. package/dist/esm/actions/resolveEthereumAddress.d.ts +0 -2
  276. package/dist/esm/actions/resolveEthereumAddress.d.ts.map +1 -1
  277. package/dist/esm/actions/resolveEthereumAddress.js +1 -2
  278. package/dist/esm/actions/resolveTransactionHash.d.ts +0 -2
  279. package/dist/esm/actions/resolveTransactionHash.d.ts.map +1 -1
  280. package/dist/esm/actions/resolveTransactionHash.js +7 -4
  281. package/dist/esm/actions/resolveTransactionHash.js.map +1 -1
  282. package/dist/esm/actions/resolveUNSAddress.d.ts +0 -2
  283. package/dist/esm/actions/resolveUNSAddress.d.ts.map +1 -1
  284. package/dist/esm/actions/resolveUNSAddress.js +2 -3
  285. package/dist/esm/actions/setAllowance.d.ts +2 -4
  286. package/dist/esm/actions/setAllowance.d.ts.map +1 -1
  287. package/dist/esm/actions/setAllowance.js +10 -7
  288. package/dist/esm/actions/setAllowance.js.map +1 -1
  289. package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts +0 -2
  290. package/dist/esm/actions/waitForBatchTransactionReceipt.d.ts.map +1 -1
  291. package/dist/esm/actions/waitForBatchTransactionReceipt.js +1 -2
  292. package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts +1 -3
  293. package/dist/esm/actions/waitForRelayedTransactionReceipt.d.ts.map +1 -1
  294. package/dist/esm/actions/waitForRelayedTransactionReceipt.js +51 -13
  295. package/dist/esm/actions/waitForRelayedTransactionReceipt.js.map +1 -1
  296. package/dist/esm/actions/waitForSafeTransactionExecution.d.ts +0 -2
  297. package/dist/esm/actions/waitForSafeTransactionExecution.d.ts.map +1 -1
  298. package/dist/esm/actions/waitForSafeTransactionExecution.js +2 -3
  299. package/dist/esm/actions/waitForTransactionReceipt.d.ts +0 -2
  300. package/dist/esm/actions/waitForTransactionReceipt.d.ts.map +1 -1
  301. package/dist/esm/actions/waitForTransactionReceipt.js +1 -2
  302. package/dist/esm/client/publicClient.d.ts +0 -2
  303. package/dist/esm/client/publicClient.d.ts.map +1 -1
  304. package/dist/esm/client/publicClient.js +1 -2
  305. package/dist/esm/client/safeClient.d.ts +0 -2
  306. package/dist/esm/client/safeClient.d.ts.map +1 -1
  307. package/dist/esm/client/safeClient.js +1 -2
  308. package/dist/esm/client/types.d.ts +0 -2
  309. package/dist/esm/client/types.d.ts.map +1 -1
  310. package/dist/esm/core/EthereumStepExecutor.d.ts +0 -2
  311. package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -1
  312. package/dist/esm/core/EthereumStepExecutor.js +4 -3
  313. package/dist/esm/core/EthereumStepExecutor.js.map +1 -1
  314. package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts +0 -2
  315. package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.d.ts.map +1 -1
  316. package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js +5 -3
  317. package/dist/esm/core/tasks/EthereumBatchedSignAndExecuteTask.js.map +1 -1
  318. package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts +0 -2
  319. package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.d.ts.map +1 -1
  320. package/dist/esm/core/tasks/EthereumBatchedWaitForTransactionTask.js +1 -2
  321. package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts +18 -0
  322. package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.d.ts.map +1 -0
  323. package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js +32 -0
  324. package/dist/esm/core/tasks/EthereumCheckAllowanceAfterPrepareTask.js.map +1 -0
  325. package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +0 -2
  326. package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -1
  327. package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js +3 -4
  328. package/dist/esm/core/tasks/EthereumCheckAllowanceTask.js.map +1 -1
  329. package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +0 -2
  330. package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts.map +1 -1
  331. package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +4 -4
  332. package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
  333. package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +0 -2
  334. package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -1
  335. package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +2 -3
  336. package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +0 -2
  337. package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -1
  338. package/dist/esm/core/tasks/EthereumNativePermitTask.js +5 -6
  339. package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -1
  340. package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts +0 -2
  341. package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts.map +1 -1
  342. package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js +1 -2
  343. package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts +0 -2
  344. package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -1
  345. package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +8 -7
  346. package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
  347. package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts +0 -2
  348. package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -1
  349. package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +3 -4
  350. package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts +0 -2
  351. package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.d.ts.map +1 -1
  352. package/dist/esm/core/tasks/EthereumRelayedWaitForTransactionTask.js +2 -3
  353. package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +0 -2
  354. package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -1
  355. package/dist/esm/core/tasks/EthereumResetAllowanceTask.js +6 -6
  356. package/dist/esm/core/tasks/EthereumResetAllowanceTask.js.map +1 -1
  357. package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +0 -2
  358. package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -1
  359. package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +7 -7
  360. package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
  361. package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts +0 -2
  362. package/dist/esm/core/tasks/EthereumSignAndExecuteTask.d.ts.map +1 -1
  363. package/dist/esm/core/tasks/EthereumSignAndExecuteTask.js +2 -3
  364. package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts +0 -2
  365. package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -1
  366. package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +6 -6
  367. package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
  368. package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts +0 -2
  369. package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.d.ts.map +1 -1
  370. package/dist/esm/core/tasks/EthereumStandardWaitForTransactionTask.js +1 -2
  371. package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts +0 -2
  372. package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.d.ts.map +1 -1
  373. package/dist/esm/core/tasks/EthereumWaitForTransactionStatusTask.js +1 -2
  374. package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts +0 -2
  375. package/dist/esm/core/tasks/EthereumWaitForTransactionTask.d.ts.map +1 -1
  376. package/dist/esm/core/tasks/EthereumWaitForTransactionTask.js +2 -3
  377. package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts +1 -3
  378. package/dist/esm/core/tasks/helpers/estimateTransactionRequest.d.ts.map +1 -1
  379. package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js +3 -4
  380. package/dist/esm/core/tasks/helpers/estimateTransactionRequest.js.map +1 -1
  381. package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts +0 -2
  382. package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts.map +1 -1
  383. package/dist/esm/core/tasks/helpers/findSignedNativePermit.js +2 -3
  384. package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts +0 -2
  385. package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts.map +1 -1
  386. package/dist/esm/core/tasks/helpers/getApprovalAmount.js +2 -3
  387. package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +0 -2
  388. package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -1
  389. package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +6 -4
  390. package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
  391. package/dist/esm/core/tasks/helpers/getTxLink.d.ts +0 -2
  392. package/dist/esm/core/tasks/helpers/getTxLink.d.ts.map +1 -1
  393. package/dist/esm/core/tasks/helpers/getTxLink.js +1 -2
  394. package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +10 -4
  395. package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -1
  396. package/dist/esm/core/tasks/helpers/getUpdatedStep.js +12 -21
  397. package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -1
  398. package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts +9 -0
  399. package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.d.ts.map +1 -0
  400. package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js +15 -0
  401. package/dist/esm/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.js.map +1 -0
  402. package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +0 -2
  403. package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts.map +1 -1
  404. package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js +1 -2
  405. package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts +0 -2
  406. package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.d.ts.map +1 -1
  407. package/dist/esm/core/tasks/helpers/isAllowancePreparedForAnotherStrategy.js +1 -2
  408. package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +0 -2
  409. package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts.map +1 -1
  410. package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js +1 -2
  411. package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts +0 -2
  412. package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts.map +1 -1
  413. package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js +1 -2
  414. package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.d.ts +0 -2
  415. package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.d.ts.map +1 -1
  416. package/dist/esm/core/tasks/helpers/resolveAllowanceSpender.js +1 -2
  417. package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts +0 -2
  418. package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts.map +1 -1
  419. package/dist/esm/core/tasks/helpers/resolvePermit2Support.js +1 -2
  420. package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts +0 -2
  421. package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.d.ts.map +1 -1
  422. package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js +3 -3
  423. package/dist/esm/core/tasks/helpers/shouldCheckForAllowance.js.map +1 -1
  424. package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +0 -2
  425. package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -1
  426. package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +3 -4
  427. package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts +0 -2
  428. package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts.map +1 -1
  429. package/dist/esm/core/tasks/helpers/signTypedDataEntries.js +1 -2
  430. package/dist/esm/core/tasks/helpers/switchChain.d.ts +0 -2
  431. package/dist/esm/core/tasks/helpers/switchChain.d.ts.map +1 -1
  432. package/dist/esm/core/tasks/helpers/switchChain.js +1 -2
  433. package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts +0 -2
  434. package/dist/esm/core/tasks/helpers/updateActionWithReceipt.d.ts.map +1 -1
  435. package/dist/esm/core/tasks/helpers/updateActionWithReceipt.js +1 -2
  436. package/dist/esm/errors/parseEthereumErrors.d.ts +0 -2
  437. package/dist/esm/errors/parseEthereumErrors.d.ts.map +1 -1
  438. package/dist/esm/errors/parseEthereumErrors.js +4 -4
  439. package/dist/esm/errors/parseEthereumErrors.js.map +1 -1
  440. package/dist/esm/hyperliquid/agentWallet.d.ts +0 -2
  441. package/dist/esm/hyperliquid/agentWallet.d.ts.map +1 -1
  442. package/dist/esm/hyperliquid/agentWallet.js +1 -2
  443. package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts +0 -2
  444. package/dist/esm/hyperliquid/isHyperliquidAgentStep.d.ts.map +1 -1
  445. package/dist/esm/hyperliquid/isHyperliquidAgentStep.js +1 -2
  446. package/dist/esm/index.d.ts +2 -2
  447. package/dist/esm/index.js +8 -8
  448. package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts +0 -2
  449. package/dist/esm/permits/acceptsRawEcdsaSignature.d.ts.map +1 -1
  450. package/dist/esm/permits/acceptsRawEcdsaSignature.js +1 -2
  451. package/dist/esm/permits/allowanceTransfer.d.ts +0 -2
  452. package/dist/esm/permits/allowanceTransfer.d.ts.map +1 -1
  453. package/dist/esm/permits/allowanceTransfer.js +1 -2
  454. package/dist/esm/permits/allowanceTransfer.js.map +1 -1
  455. package/dist/esm/permits/canAccountUseNativePermits.d.ts +0 -2
  456. package/dist/esm/permits/canAccountUseNativePermits.d.ts.map +1 -1
  457. package/dist/esm/permits/canAccountUseNativePermits.js +1 -2
  458. package/dist/esm/permits/canAccountUsePermit2.d.ts +0 -2
  459. package/dist/esm/permits/canAccountUsePermit2.d.ts.map +1 -1
  460. package/dist/esm/permits/canAccountUsePermit2.js +1 -2
  461. package/dist/esm/permits/constants.d.ts +0 -2
  462. package/dist/esm/permits/constants.d.ts.map +1 -1
  463. package/dist/esm/permits/constants.js +1 -2
  464. package/dist/esm/permits/domain.d.ts +0 -2
  465. package/dist/esm/permits/domain.d.ts.map +1 -1
  466. package/dist/esm/permits/domain.js +1 -2
  467. package/dist/esm/permits/encodeNativePermitData.d.ts +0 -2
  468. package/dist/esm/permits/encodeNativePermitData.d.ts.map +1 -1
  469. package/dist/esm/permits/encodeNativePermitData.js +1 -2
  470. package/dist/esm/permits/encodePermit2Data.d.ts +0 -2
  471. package/dist/esm/permits/encodePermit2Data.d.ts.map +1 -1
  472. package/dist/esm/permits/encodePermit2Data.js +1 -2
  473. package/dist/esm/permits/getNativePermit.d.ts +0 -2
  474. package/dist/esm/permits/getNativePermit.d.ts.map +1 -1
  475. package/dist/esm/permits/getNativePermit.js +6 -7
  476. package/dist/esm/permits/getNativePermit.js.map +1 -1
  477. package/dist/esm/permits/getPermitTransferFromValues.d.ts +0 -2
  478. package/dist/esm/permits/getPermitTransferFromValues.d.ts.map +1 -1
  479. package/dist/esm/permits/getPermitTransferFromValues.js +2 -3
  480. package/dist/esm/permits/getPermitTransferFromValues.js.map +1 -1
  481. package/dist/esm/permits/invariant.d.ts +0 -2
  482. package/dist/esm/permits/invariant.d.ts.map +1 -1
  483. package/dist/esm/permits/invariant.js +1 -2
  484. package/dist/esm/permits/isDelegationDesignatorCode.d.ts +0 -2
  485. package/dist/esm/permits/isDelegationDesignatorCode.d.ts.map +1 -1
  486. package/dist/esm/permits/isDelegationDesignatorCode.js +1 -2
  487. package/dist/esm/permits/isNativePermitValid.d.ts +0 -2
  488. package/dist/esm/permits/isNativePermitValid.d.ts.map +1 -1
  489. package/dist/esm/permits/isNativePermitValid.js +2 -3
  490. package/dist/esm/permits/isNativePermitValid.js.map +1 -1
  491. package/dist/esm/permits/signPermit2Message.d.ts +0 -2
  492. package/dist/esm/permits/signPermit2Message.d.ts.map +1 -1
  493. package/dist/esm/permits/signPermit2Message.js +1 -2
  494. package/dist/esm/permits/signatureTransfer.d.ts +0 -2
  495. package/dist/esm/permits/signatureTransfer.d.ts.map +1 -1
  496. package/dist/esm/permits/signatureTransfer.js +1 -2
  497. package/dist/esm/permits/types.d.ts +0 -2
  498. package/dist/esm/permits/types.d.ts.map +1 -1
  499. package/dist/esm/types.d.ts +6 -2
  500. package/dist/esm/types.d.ts.map +1 -1
  501. package/dist/esm/types.js +1 -2
  502. package/dist/esm/types.js.map +1 -1
  503. package/dist/esm/utils/abi.d.ts +0 -2
  504. package/dist/esm/utils/abi.d.ts.map +1 -1
  505. package/dist/esm/utils/abi.js +1 -2
  506. package/dist/esm/utils/convertExtendedChain.d.ts +0 -2
  507. package/dist/esm/utils/convertExtendedChain.d.ts.map +1 -1
  508. package/dist/esm/utils/convertExtendedChain.js +1 -2
  509. package/dist/esm/utils/getActionWithFallback.d.ts +2 -3
  510. package/dist/esm/utils/getActionWithFallback.d.ts.map +1 -1
  511. package/dist/esm/utils/getActionWithFallback.js +3 -4
  512. package/dist/esm/utils/getActionWithFallback.js.map +1 -1
  513. package/dist/esm/utils/getDomainChainId.d.ts +0 -2
  514. package/dist/esm/utils/getDomainChainId.d.ts.map +1 -1
  515. package/dist/esm/utils/getDomainChainId.js +1 -2
  516. package/dist/esm/utils/getSafeApiKey.d.ts +0 -2
  517. package/dist/esm/utils/getSafeApiKey.d.ts.map +1 -1
  518. package/dist/esm/utils/getSafeApiKey.js +1 -2
  519. package/dist/esm/utils/getSendChain.d.ts +3 -0
  520. package/dist/esm/utils/getSendChain.d.ts.map +1 -0
  521. package/dist/esm/utils/getSendChain.js +5 -0
  522. package/dist/esm/utils/getSendChain.js.map +1 -0
  523. package/dist/esm/utils/getTypedDataLane.d.ts +0 -2
  524. package/dist/esm/utils/getTypedDataLane.d.ts.map +1 -1
  525. package/dist/esm/utils/getTypedDataLane.js +1 -2
  526. package/dist/esm/utils/isContractCallStep.d.ts +0 -2
  527. package/dist/esm/utils/isContractCallStep.d.ts.map +1 -1
  528. package/dist/esm/utils/isContractCallStep.js +1 -2
  529. package/dist/esm/utils/isExtendedChain.d.ts +0 -2
  530. package/dist/esm/utils/isExtendedChain.d.ts.map +1 -1
  531. package/dist/esm/utils/isExtendedChain.js +1 -2
  532. package/dist/esm/utils/isGaslessStep.d.ts +7 -2
  533. package/dist/esm/utils/isGaslessStep.d.ts.map +1 -1
  534. package/dist/esm/utils/isGaslessStep.js +8 -2
  535. package/dist/esm/utils/isGaslessStep.js.map +1 -1
  536. package/dist/esm/utils/isValidSignature.d.ts +0 -2
  537. package/dist/esm/utils/isValidSignature.d.ts.map +1 -1
  538. package/dist/esm/utils/isValidSignature.js +1 -2
  539. package/dist/esm/utils/isZeroAddress.d.ts +0 -2
  540. package/dist/esm/utils/isZeroAddress.d.ts.map +1 -1
  541. package/dist/esm/utils/isZeroAddress.js +1 -2
  542. package/dist/esm/utils/median.d.ts +0 -2
  543. package/dist/esm/utils/median.d.ts.map +1 -1
  544. package/dist/esm/utils/median.js +1 -2
  545. package/dist/esm/version.d.ts +1 -3
  546. package/dist/esm/version.d.ts.map +1 -1
  547. package/dist/esm/version.js +2 -3
  548. package/dist/esm/version.js.map +1 -1
  549. package/package.json +3 -3
  550. package/src/actions/checkPermitSupport.ts +4 -2
  551. package/src/actions/getAllowance.ts +8 -4
  552. package/src/actions/getMaxPriorityFeePerGas.ts +4 -2
  553. package/src/actions/isSafeSignature.ts +3 -3
  554. package/src/actions/resolveTransactionHash.ts +10 -3
  555. package/src/actions/setAllowance.ts +31 -6
  556. package/src/actions/waitForRelayedTransactionReceipt.ts +129 -24
  557. package/src/core/EthereumStepExecutor.ts +2 -0
  558. package/src/core/tasks/EthereumBatchedSignAndExecuteTask.ts +4 -0
  559. package/src/core/tasks/EthereumCheckAllowanceAfterPrepareTask.ts +34 -0
  560. package/src/core/tasks/EthereumCheckAllowanceTask.ts +3 -2
  561. package/src/core/tasks/EthereumCheckBalanceTask.ts +11 -1
  562. package/src/core/tasks/EthereumNativePermitTask.ts +2 -1
  563. package/src/core/tasks/EthereumPrepareTransactionTask.ts +29 -3
  564. package/src/core/tasks/EthereumResetAllowanceTask.ts +4 -2
  565. package/src/core/tasks/EthereumSetAllowanceTask.ts +4 -2
  566. package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +4 -2
  567. package/src/core/tasks/helpers/estimateTransactionRequest.ts +4 -2
  568. package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +12 -3
  569. package/src/core/tasks/helpers/getUpdatedStep.ts +26 -25
  570. package/src/core/tasks/helpers/hasApprovalAddressAppearedAtPrepare.ts +29 -0
  571. package/src/core/tasks/helpers/shouldCheckForAllowance.ts +8 -0
  572. package/src/errors/parseEthereumErrors.ts +11 -2
  573. package/src/index.ts +0 -1
  574. package/src/permits/allowanceTransfer.ts +1 -1
  575. package/src/permits/getNativePermit.ts +9 -5
  576. package/src/permits/getPermitTransferFromValues.ts +2 -1
  577. package/src/permits/isNativePermitValid.ts +1 -1
  578. package/src/types.ts +7 -2
  579. package/src/utils/getActionWithFallback.ts +3 -2
  580. package/src/utils/getSendChain.ts +6 -0
  581. package/src/utils/isGaslessStep.ts +7 -0
  582. package/src/version.ts +1 -1
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_client_publicClient = require("../client/publicClient.js");
3
3
  let _lifi_sdk = require("@lifi/sdk");
4
4
  let viem_ens = require("viem/ens");
5
- //#region src/actions/resolveENSAddress.ts
5
+ // src/actions/resolveENSAddress.ts
6
6
  const resolveENSAddress = async (client, name) => {
7
7
  try {
8
8
  const viemClient = await require_client_publicClient.getPublicClient(client, _lifi_sdk.ChainId.ETH);
@@ -11,7 +11,6 @@ const resolveENSAddress = async (client, name) => {
11
11
  return;
12
12
  }
13
13
  };
14
- //#endregion
15
14
  exports.resolveENSAddress = resolveENSAddress;
16
15
 
17
16
  //# sourceMappingURL=resolveENSAddress.js.map
@@ -1,5 +1,2 @@
1
1
  import { ChainId, CoinKey, SDKClient } from "@lifi/sdk";
2
- //#region src/actions/resolveEthereumAddress.d.ts
3
- export declare function resolveEthereumAddress(name: string, client: SDKClient, chainId?: ChainId, token?: CoinKey): Promise<string | undefined>;
4
- //#endregion
5
- //# sourceMappingURL=resolveEthereumAddress.d.ts.map
2
+ export declare function resolveEthereumAddress(name: string, client: SDKClient, chainId?: ChainId, token?: CoinKey): Promise<string | undefined>;
@@ -2,11 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_actions_resolveENSAddress = require("./resolveENSAddress.js");
3
3
  const require_actions_resolveUNSAddress = require("./resolveUNSAddress.js");
4
4
  let _lifi_sdk = require("@lifi/sdk");
5
- //#region src/actions/resolveEthereumAddress.ts
5
+ // src/actions/resolveEthereumAddress.ts
6
6
  async function resolveEthereumAddress(name, client, chainId, token) {
7
7
  return await require_actions_resolveENSAddress.resolveENSAddress(client, name) || await require_actions_resolveUNSAddress.resolveUNSAddress(client, name, _lifi_sdk.ChainType.EVM, chainId, token);
8
8
  }
9
- //#endregion
10
9
  exports.resolveEthereumAddress = resolveEthereumAddress;
11
10
 
12
11
  //# sourceMappingURL=resolveEthereumAddress.js.map
@@ -1,6 +1,3 @@
1
1
  import { SDKClient } from "@lifi/sdk";
2
2
  import { Client, Hash } from "viem";
3
- //#region src/actions/resolveTransactionHash.d.ts
4
- export declare const resolveTransactionHash: (client: SDKClient, viemClient: Client, txHashOrSignature: Hash, chainId: number) => Promise<Hash>;
5
- //#endregion
6
- //# sourceMappingURL=resolveTransactionHash.d.ts.map
3
+ export declare const resolveTransactionHash: (client: SDKClient, viemClient: Client, txHashOrSignature: Hash, chainId: number) => Promise<Hash>;
@@ -2,15 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_actions_isSafeSignature = require("./isSafeSignature.js");
3
3
  const require_actions_waitForSafeTransactionExecution = require("./waitForSafeTransactionExecution.js");
4
4
  let _lifi_sdk = require("@lifi/sdk");
5
- //#region src/actions/resolveTransactionHash.ts
5
+ let viem = require("viem");
6
+ // src/actions/resolveTransactionHash.ts
6
7
  const resolveTransactionHash = async (client, viemClient, txHashOrSignature, chainId) => {
7
8
  if (!await require_actions_isSafeSignature.isSafeSignature(client, {
8
9
  hash: txHashOrSignature,
9
10
  chainId,
10
11
  address: viemClient.account?.address
11
- })) return txHashOrSignature;
12
+ })) {
13
+ if (!(0, viem.isHex)(txHashOrSignature) || txHashOrSignature.length < 66) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "The wallet did not return a transaction hash. The wallet may have sent the transaction. Before you try again, check the activity in your wallet.");
14
+ return txHashOrSignature;
15
+ }
12
16
  const safeAddress = viemClient.account?.address;
13
- if (!safeAddress || !txHashOrSignature) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Safe address or signature not available for transaction tracking.");
17
+ if (!safeAddress) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Safe address not available for transaction tracking.");
14
18
  return await require_actions_waitForSafeTransactionExecution.waitForSafeTransactionExecution(client, {
15
19
  chainId,
16
20
  safeAddress,
@@ -18,7 +22,6 @@ const resolveTransactionHash = async (client, viemClient, txHashOrSignature, cha
18
22
  pollingInterval: 5e3
19
23
  });
20
24
  };
21
- //#endregion
22
25
  exports.resolveTransactionHash = resolveTransactionHash;
23
26
 
24
27
  //# sourceMappingURL=resolveTransactionHash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveTransactionHash.js","names":["isSafeSignature","TransactionError","LiFiErrorCode","waitForSafeTransactionExecution"],"sources":["../../../src/actions/resolveTransactionHash.ts"],"sourcesContent":["import { LiFiErrorCode, type SDKClient, TransactionError } from '@lifi/sdk'\nimport type { Client, Hash } from 'viem'\nimport { isSafeSignature } from './isSafeSignature.js'\nimport { waitForSafeTransactionExecution } from './waitForSafeTransactionExecution.js'\n\nexport const resolveTransactionHash = async (\n client: SDKClient,\n viemClient: Client,\n txHashOrSignature: Hash,\n chainId: number\n): Promise<Hash> => {\n const isSignature = await isSafeSignature(client, {\n hash: txHashOrSignature,\n chainId,\n address: viemClient.account?.address,\n })\n\n if (!isSignature) {\n return txHashOrSignature\n }\n\n const safeAddress = viemClient.account?.address\n if (!safeAddress || !txHashOrSignature) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Safe address or signature not available for transaction tracking.'\n )\n }\n\n return await waitForSafeTransactionExecution(client, {\n chainId,\n safeAddress,\n signature: txHashOrSignature,\n pollingInterval: 5_000,\n })\n}\n"],"mappings":";;;;;AAKA,MAAa,yBAAyB,OACpC,QACA,YACA,mBACA,YACkB;CAOlB,IAAI,CAAC,MANqBA,gCAAAA,gBAAgB,QAAQ;EAChD,MAAM;EACN;EACA,SAAS,WAAW,SAAS;CAC/B,CAAC,GAGC,OAAO;CAGT,MAAM,cAAc,WAAW,SAAS;CACxC,IAAI,CAAC,eAAe,CAAC,mBACnB,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,mBACd,mEACF;CAGF,OAAO,MAAMC,gDAAAA,gCAAgC,QAAQ;EACnD;EACA;EACA,WAAW;EACX,iBAAiB;CACnB,CAAC;AACH"}
1
+ {"version":3,"file":"resolveTransactionHash.js","names":["isSafeSignature","isHex","TransactionError","LiFiErrorCode","waitForSafeTransactionExecution"],"sources":["../../../src/actions/resolveTransactionHash.ts"],"sourcesContent":["import { LiFiErrorCode, type SDKClient, TransactionError } from '@lifi/sdk'\nimport { type Client, type Hash, isHex } from 'viem'\nimport { isSafeSignature } from './isSafeSignature.js'\nimport { waitForSafeTransactionExecution } from './waitForSafeTransactionExecution.js'\n\nexport const resolveTransactionHash = async (\n client: SDKClient,\n viemClient: Client,\n txHashOrSignature: Hash,\n chainId: number\n): Promise<Hash> => {\n const isSignature = await isSafeSignature(client, {\n hash: txHashOrSignature,\n chainId,\n address: viemClient.account?.address,\n })\n\n if (!isSignature) {\n // Unchecked wallet answer; longer hex can be a Safe signature the lookup missed.\n if (!isHex(txHashOrSignature) || txHashOrSignature.length < 66) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'The wallet did not return a transaction hash. The wallet may have sent the transaction. Before you try again, check the activity in your wallet.'\n )\n }\n return txHashOrSignature\n }\n\n const safeAddress = viemClient.account?.address\n if (!safeAddress) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Safe address not available for transaction tracking.'\n )\n }\n\n return await waitForSafeTransactionExecution(client, {\n chainId,\n safeAddress,\n signature: txHashOrSignature,\n pollingInterval: 5_000,\n })\n}\n"],"mappings":";;;;;;AAKA,MAAa,yBAAyB,OACpC,QACA,YACA,mBACA,YACkB;CAOlB,IAAI,CAAC,MANqBA,gCAAAA,gBAAgB,QAAQ;EAChD,MAAM;EACN;EACA,SAAS,WAAW,SAAS;CAC/B,CAAC,GAEiB;EAEhB,IAAI,EAAA,GAACC,KAAAA,MAAAA,CAAM,iBAAiB,KAAK,kBAAkB,SAAS,IAC1D,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,mBACd,kJACF;EAEF,OAAO;CACT;CAEA,MAAM,cAAc,WAAW,SAAS;CACxC,IAAI,CAAC,aACH,MAAM,IAAID,UAAAA,iBACRC,UAAAA,cAAc,mBACd,sDACF;CAGF,OAAO,MAAMC,gDAAAA,gCAAgC,QAAQ;EACnD;EACA;EACA,WAAW;EACX,iBAAiB;CACnB,CAAC;AACH"}
@@ -1,5 +1,2 @@
1
1
  import { ChainId, ChainType, CoinKey, SDKClient } from "@lifi/sdk";
2
- //#region src/actions/resolveUNSAddress.d.ts
3
- export declare const resolveUNSAddress: (client: SDKClient, name: string, chainType: ChainType, chain?: ChainId, token?: CoinKey) => Promise<string | undefined>;
4
- //#endregion
5
- //# sourceMappingURL=resolveUNSAddress.d.ts.map
2
+ export declare const resolveUNSAddress: (client: SDKClient, name: string, chainType: ChainType, chain?: ChainId, token?: CoinKey) => Promise<string | undefined>;
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_actions_constants = require("./constants.js");
3
2
  const require_client_publicClient = require("../client/publicClient.js");
3
+ const require_actions_constants = require("./constants.js");
4
4
  let _lifi_sdk = require("@lifi/sdk");
5
5
  let viem_actions = require("viem/actions");
6
6
  let viem_ens = require("viem/ens");
7
7
  let viem_utils = require("viem/utils");
8
- //#region src/actions/resolveUNSAddress.ts
8
+ // src/actions/resolveUNSAddress.ts
9
9
  const resolveUNSAddress = async (client, name, chainType, chain, token) => {
10
10
  try {
11
11
  const L1Client = await require_client_publicClient.getPublicClient(client, _lifi_sdk.ChainId.ETH);
@@ -61,7 +61,6 @@ async function getUnsAddress(client, params) {
61
61
  if (address === "0x" || address === "" || (0, viem_utils.trim)(address) === "0x00") return;
62
62
  return address;
63
63
  }
64
- //#endregion
65
64
  exports.resolveUNSAddress = resolveUNSAddress;
66
65
 
67
66
  //# sourceMappingURL=resolveUNSAddress.js.map
@@ -1,8 +1,7 @@
1
1
  import { ApproveTokenRequest, RevokeApprovalRequest } from "../types.js";
2
2
  import { ExecutionOptions, SDKClient } from "@lifi/sdk";
3
- import { Address, Client, Hash, Hex } from "viem";
4
- //#region src/actions/setAllowance.d.ts
5
- export declare const setAllowance: (client: SDKClient, viemClient: Client, tokenAddress: Address, contractAddress: Address, amount: bigint, executionOptions?: ExecutionOptions, returnPopulatedTransaction?: boolean) => Promise<Hash | Hex>;
3
+ import { Address, Chain, Client, Hash, Hex } from "viem";
4
+ export declare const setAllowance: (client: SDKClient, viemClient: Client, tokenAddress: Address, contractAddress: Address, amount: bigint, executionOptions?: ExecutionOptions, returnPopulatedTransaction?: boolean, chain?: Chain) => Promise<Hash | Hex>;
6
5
  /**
7
6
  * Set approval for a certain token and amount.
8
7
  * @param client - The SDK client
@@ -23,6 +22,4 @@ export declare const setTokenAllowance: (client: SDKClient, { walletClient, toke
23
22
  * @param request.spenderAddress - The address of the spender
24
23
  * @returns Returns Hash or nothing
25
24
  */
26
- export declare const revokeTokenApproval: (client: SDKClient, { walletClient, token, spenderAddress }: RevokeApprovalRequest) => Promise<Hash | void>;
27
- //#endregion
28
- //# sourceMappingURL=setAllowance.d.ts.map
25
+ export declare const revokeTokenApproval: (client: SDKClient, { walletClient, token, spenderAddress }: RevokeApprovalRequest) => Promise<Hash | void>;
@@ -1,13 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_abi = require("../utils/abi.js");
3
+ const require_utils_convertExtendedChain = require("../utils/convertExtendedChain.js");
4
+ const require_utils_getSendChain = require("../utils/getSendChain.js");
3
5
  const require_utils_isZeroAddress = require("../utils/isZeroAddress.js");
4
6
  const require_actions_getAllowance = require("./getAllowance.js");
5
7
  const require_actions_getMaxPriorityFeePerGas = require("./getMaxPriorityFeePerGas.js");
6
8
  let viem = require("viem");
7
9
  let viem_actions = require("viem/actions");
8
10
  let viem_utils = require("viem/utils");
9
- //#region src/actions/setAllowance.ts
10
- const setAllowance = async (client, viemClient, tokenAddress, contractAddress, amount, executionOptions, returnPopulatedTransaction) => {
11
+ // src/actions/setAllowance.ts
12
+ const setAllowance = async (client, viemClient, tokenAddress, contractAddress, amount, executionOptions, returnPopulatedTransaction, chain) => {
11
13
  const data = (0, viem.encodeFunctionData)({
12
14
  abi: require_utils_abi.approveAbi,
13
15
  functionName: "approve",
@@ -17,7 +19,7 @@ const setAllowance = async (client, viemClient, tokenAddress, contractAddress, a
17
19
  let transactionRequest = {
18
20
  to: tokenAddress,
19
21
  data,
20
- maxPriorityFeePerGas: viemClient.account?.type === "local" ? await require_actions_getMaxPriorityFeePerGas.getMaxPriorityFeePerGas(client, viemClient) : void 0
22
+ maxPriorityFeePerGas: viemClient.account?.type === "local" ? await require_actions_getMaxPriorityFeePerGas.getMaxPriorityFeePerGas(client, viemClient, chain?.id ?? viemClient.chain?.id) : void 0
21
23
  };
22
24
  if (executionOptions?.updateTransactionRequestHook) {
23
25
  const customizedTransactionRequest = await executionOptions.updateTransactionRequestHook({
@@ -36,9 +38,11 @@ const setAllowance = async (client, viemClient, tokenAddress, contractAddress, a
36
38
  gas: transactionRequest.gas,
37
39
  gasPrice: transactionRequest.gasPrice,
38
40
  maxFeePerGas: transactionRequest.maxFeePerGas,
39
- maxPriorityFeePerGas: transactionRequest.maxPriorityFeePerGas
41
+ maxPriorityFeePerGas: transactionRequest.maxPriorityFeePerGas,
42
+ ...chain && { chain: require_utils_getSendChain.getSendChain(viemClient, chain) }
40
43
  });
41
44
  };
45
+ const getTokenChain = (client, chainId) => client.getChainById(chainId).then(require_utils_convertExtendedChain.convertExtendedChain, () => void 0);
42
46
  /**
43
47
  * Set approval for a certain token and amount.
44
48
  * @param client - The SDK client
@@ -51,7 +55,7 @@ const setAllowance = async (client, viemClient, tokenAddress, contractAddress, a
51
55
  */
52
56
  const setTokenAllowance = async (client, { walletClient, token, spenderAddress, amount }) => {
53
57
  if (require_utils_isZeroAddress.isZeroAddress(token.address)) return;
54
- if (amount > await require_actions_getAllowance.getAllowance(client, walletClient, token.address, walletClient.account.address, spenderAddress)) return await setAllowance(client, walletClient, token.address, spenderAddress, amount);
58
+ if (amount > await require_actions_getAllowance.getAllowance(client, walletClient, token.address, walletClient.account.address, spenderAddress, token.chainId)) return await setAllowance(client, walletClient, token.address, spenderAddress, amount, void 0, false, await getTokenChain(client, token.chainId));
55
59
  };
56
60
  /**
57
61
  * Revoke approval for a certain token.
@@ -64,9 +68,8 @@ const setTokenAllowance = async (client, { walletClient, token, spenderAddress,
64
68
  */
65
69
  const revokeTokenApproval = async (client, { walletClient, token, spenderAddress }) => {
66
70
  if (require_utils_isZeroAddress.isZeroAddress(token.address)) return;
67
- if (await require_actions_getAllowance.getAllowance(client, walletClient, token.address, walletClient.account.address, spenderAddress) > 0) return await setAllowance(client, walletClient, token.address, spenderAddress, 0n);
71
+ if (await require_actions_getAllowance.getAllowance(client, walletClient, token.address, walletClient.account.address, spenderAddress, token.chainId) > 0) return await setAllowance(client, walletClient, token.address, spenderAddress, 0n, void 0, false, await getTokenChain(client, token.chainId));
68
72
  };
69
- //#endregion
70
73
  exports.revokeTokenApproval = revokeTokenApproval;
71
74
  exports.setAllowance = setAllowance;
72
75
  exports.setTokenAllowance = setTokenAllowance;
@@ -1 +1 @@
1
- {"version":3,"file":"setAllowance.js","names":["encodeFunctionData","approveAbi","getMaxPriorityFeePerGas","getAction","sendTransaction","isZeroAddress","getAllowance"],"sources":["../../../src/actions/setAllowance.ts"],"sourcesContent":["import type {\n ExecutionOptions,\n SDKClient,\n TransactionParameters,\n} from '@lifi/sdk'\nimport type {\n Address,\n Client,\n Hash,\n Hex,\n SendTransactionParameters,\n} from 'viem'\nimport { encodeFunctionData } from 'viem'\nimport { sendTransaction } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport type { ApproveTokenRequest, RevokeApprovalRequest } from '../types.js'\nimport { approveAbi } from '../utils/abi.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { getAllowance } from './getAllowance.js'\nimport { getMaxPriorityFeePerGas } from './getMaxPriorityFeePerGas.js'\n\nexport const setAllowance = async (\n client: SDKClient,\n viemClient: Client,\n tokenAddress: Address,\n contractAddress: Address,\n amount: bigint,\n executionOptions?: ExecutionOptions,\n returnPopulatedTransaction?: boolean\n): Promise<Hash | Hex> => {\n const data = encodeFunctionData({\n abi: approveAbi,\n functionName: 'approve',\n args: [contractAddress, amount],\n })\n\n if (returnPopulatedTransaction) {\n return data\n }\n\n let transactionRequest: TransactionParameters = {\n to: tokenAddress,\n data,\n maxPriorityFeePerGas:\n viemClient.account?.type === 'local'\n ? await getMaxPriorityFeePerGas(client, viemClient)\n : undefined,\n }\n\n if (executionOptions?.updateTransactionRequestHook) {\n const customizedTransactionRequest: TransactionParameters =\n await executionOptions.updateTransactionRequestHook({\n requestType: 'approve',\n ...transactionRequest,\n })\n\n transactionRequest = {\n ...transactionRequest,\n ...customizedTransactionRequest,\n }\n }\n\n return getAction(\n viemClient,\n sendTransaction,\n 'sendTransaction'\n )({\n to: transactionRequest.to,\n account: viemClient.account!,\n data: transactionRequest.data,\n gas: transactionRequest.gas,\n gasPrice: transactionRequest.gasPrice,\n maxFeePerGas: transactionRequest.maxFeePerGas,\n maxPriorityFeePerGas: transactionRequest.maxPriorityFeePerGas,\n } as SendTransactionParameters)\n}\n\n/**\n * Set approval for a certain token and amount.\n * @param client - The SDK client\n * @param request - The approval request\n * @param request.walletClient - The Viem wallet client used to send the transaction\n * @param request.token - The token for which to set the allowance\n * @param request.spenderAddress - The address of the spender\n * @param request.amount - The amount of tokens to approve\n * @returns Returns Hash or nothing\n */\nexport const setTokenAllowance = async (\n client: SDKClient,\n { walletClient, token, spenderAddress, amount }: ApproveTokenRequest\n): Promise<Hash | void> => {\n // native token don't need approval\n if (isZeroAddress(token.address)) {\n return\n }\n const approvedAmount = await getAllowance(\n client,\n walletClient,\n token.address as Address,\n walletClient.account!.address,\n spenderAddress as Address\n )\n\n if (amount > approvedAmount) {\n const approveTx = await setAllowance(\n client,\n walletClient,\n token.address as Address,\n spenderAddress as Address,\n amount\n )\n\n return approveTx\n }\n}\n\n/**\n * Revoke approval for a certain token.\n * @param client - The SDK client\n * @param request - The revoke request\n * @param request.walletClient - The Viem wallet client used to send the transaction\n * @param request.token - The token for which to revoke the allowance\n * @param request.spenderAddress - The address of the spender\n * @returns Returns Hash or nothing\n */\nexport const revokeTokenApproval = async (\n client: SDKClient,\n { walletClient, token, spenderAddress }: RevokeApprovalRequest\n): Promise<Hash | void> => {\n // native token don't need approval\n if (isZeroAddress(token.address)) {\n return\n }\n const approvedAmount = await getAllowance(\n client,\n walletClient,\n token.address as Address,\n walletClient.account!.address,\n spenderAddress as Address\n )\n if (approvedAmount > 0) {\n const approveTx = await setAllowance(\n client,\n walletClient,\n token.address as Address,\n spenderAddress as Address,\n 0n\n )\n\n return approveTx\n }\n}\n"],"mappings":";;;;;;;;;AAqBA,MAAa,eAAe,OAC1B,QACA,YACA,cACA,iBACA,QACA,kBACA,+BACwB;CACxB,MAAM,QAAA,GAAOA,KAAAA,mBAAAA,CAAmB;EAC9B,KAAKC,kBAAAA;EACL,cAAc;EACd,MAAM,CAAC,iBAAiB,MAAM;CAChC,CAAC;CAED,IAAI,4BACF,OAAO;CAGT,IAAI,qBAA4C;EAC9C,IAAI;EACJ;EACA,sBACE,WAAW,SAAS,SAAS,UACzB,MAAMC,wCAAAA,wBAAwB,QAAQ,UAAU,IAChD,KAAA;CACR;CAEA,IAAI,kBAAkB,8BAA8B;EAClD,MAAM,+BACJ,MAAM,iBAAiB,6BAA6B;GAClD,aAAa;GACb,GAAG;EACL,CAAC;EAEH,qBAAqB;GACnB,GAAG;GACH,GAAG;EACL;CACF;CAEA,QAAA,GAAOC,WAAAA,UAAAA,CACL,YACAC,aAAAA,iBACA,iBACF,CAAC,CAAC;EACA,IAAI,mBAAmB;EACvB,SAAS,WAAW;EACpB,MAAM,mBAAmB;EACzB,KAAK,mBAAmB;EACxB,UAAU,mBAAmB;EAC7B,cAAc,mBAAmB;EACjC,sBAAsB,mBAAmB;CAC3C,CAA8B;AAChC;;;;;;;;;;;AAYA,MAAa,oBAAoB,OAC/B,QACA,EAAE,cAAc,OAAO,gBAAgB,aACd;CAEzB,IAAIC,4BAAAA,cAAc,MAAM,OAAO,GAC7B;CAUF,IAAI,SAAS,MARgBC,6BAAAA,aAC3B,QACA,cACA,MAAM,SACN,aAAa,QAAS,SACtB,cACF,GAWE,OAAO,MARiB,aACtB,QACA,cACA,MAAM,SACN,gBACA,MACF;AAIJ;;;;;;;;;;AAWA,MAAa,sBAAsB,OACjC,QACA,EAAE,cAAc,OAAO,qBACE;CAEzB,IAAID,4BAAAA,cAAc,MAAM,OAAO,GAC7B;CASF,IAAI,MAPyBC,6BAAAA,aAC3B,QACA,cACA,MAAM,SACN,aAAa,QAAS,SACtB,cACF,IACqB,GASnB,OAAO,MARiB,aACtB,QACA,cACA,MAAM,SACN,gBACA,EACF;AAIJ"}
1
+ {"version":3,"file":"setAllowance.js","names":["encodeFunctionData","approveAbi","getMaxPriorityFeePerGas","getAction","sendTransaction","getSendChain","convertExtendedChain","isZeroAddress","getAllowance"],"sources":["../../../src/actions/setAllowance.ts"],"sourcesContent":["import type {\n ExecutionOptions,\n SDKClient,\n TransactionParameters,\n} from '@lifi/sdk'\nimport type {\n Address,\n Chain,\n Client,\n Hash,\n Hex,\n SendTransactionParameters,\n} from 'viem'\nimport { encodeFunctionData } from 'viem'\nimport { sendTransaction } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport type { ApproveTokenRequest, RevokeApprovalRequest } from '../types.js'\nimport { approveAbi } from '../utils/abi.js'\nimport { convertExtendedChain } from '../utils/convertExtendedChain.js'\nimport { getSendChain } from '../utils/getSendChain.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { getAllowance } from './getAllowance.js'\nimport { getMaxPriorityFeePerGas } from './getMaxPriorityFeePerGas.js'\n\nexport const setAllowance = async (\n client: SDKClient,\n viemClient: Client,\n tokenAddress: Address,\n contractAddress: Address,\n amount: bigint,\n executionOptions?: ExecutionOptions,\n returnPopulatedTransaction?: boolean,\n // Without it viem uses `viemClient.chain`, which can be stale.\n chain?: Chain\n): Promise<Hash | Hex> => {\n const data = encodeFunctionData({\n abi: approveAbi,\n functionName: 'approve',\n args: [contractAddress, amount],\n })\n\n if (returnPopulatedTransaction) {\n return data\n }\n\n let transactionRequest: TransactionParameters = {\n to: tokenAddress,\n data,\n maxPriorityFeePerGas:\n viemClient.account?.type === 'local'\n ? await getMaxPriorityFeePerGas(\n client,\n viemClient,\n chain?.id ?? viemClient.chain?.id\n )\n : undefined,\n }\n\n if (executionOptions?.updateTransactionRequestHook) {\n const customizedTransactionRequest: TransactionParameters =\n await executionOptions.updateTransactionRequestHook({\n requestType: 'approve',\n ...transactionRequest,\n })\n\n transactionRequest = {\n ...transactionRequest,\n ...customizedTransactionRequest,\n }\n }\n\n return getAction(\n viemClient,\n sendTransaction,\n 'sendTransaction'\n )({\n to: transactionRequest.to,\n account: viemClient.account!,\n data: transactionRequest.data,\n gas: transactionRequest.gas,\n gasPrice: transactionRequest.gasPrice,\n maxFeePerGas: transactionRequest.maxFeePerGas,\n maxPriorityFeePerGas: transactionRequest.maxPriorityFeePerGas,\n ...(chain && { chain: getSendChain(viemClient, chain) }),\n } as SendTransactionParameters)\n}\n\n// Without a known chain, viem keeps `walletClient.chain`, as before.\nconst getTokenChain = (\n client: SDKClient,\n chainId: number\n): Promise<Chain | undefined> =>\n client.getChainById(chainId).then(convertExtendedChain, () => undefined)\n\n/**\n * Set approval for a certain token and amount.\n * @param client - The SDK client\n * @param request - The approval request\n * @param request.walletClient - The Viem wallet client used to send the transaction\n * @param request.token - The token for which to set the allowance\n * @param request.spenderAddress - The address of the spender\n * @param request.amount - The amount of tokens to approve\n * @returns Returns Hash or nothing\n */\nexport const setTokenAllowance = async (\n client: SDKClient,\n { walletClient, token, spenderAddress, amount }: ApproveTokenRequest\n): Promise<Hash | void> => {\n // native token don't need approval\n if (isZeroAddress(token.address)) {\n return\n }\n const approvedAmount = await getAllowance(\n client,\n walletClient,\n token.address as Address,\n walletClient.account!.address,\n spenderAddress as Address,\n token.chainId\n )\n\n if (amount > approvedAmount) {\n const approveTx = await setAllowance(\n client,\n walletClient,\n token.address as Address,\n spenderAddress as Address,\n amount,\n undefined,\n false,\n await getTokenChain(client, token.chainId)\n )\n\n return approveTx\n }\n}\n\n/**\n * Revoke approval for a certain token.\n * @param client - The SDK client\n * @param request - The revoke request\n * @param request.walletClient - The Viem wallet client used to send the transaction\n * @param request.token - The token for which to revoke the allowance\n * @param request.spenderAddress - The address of the spender\n * @returns Returns Hash or nothing\n */\nexport const revokeTokenApproval = async (\n client: SDKClient,\n { walletClient, token, spenderAddress }: RevokeApprovalRequest\n): Promise<Hash | void> => {\n // native token don't need approval\n if (isZeroAddress(token.address)) {\n return\n }\n const approvedAmount = await getAllowance(\n client,\n walletClient,\n token.address as Address,\n walletClient.account!.address,\n spenderAddress as Address,\n token.chainId\n )\n if (approvedAmount > 0) {\n const approveTx = await setAllowance(\n client,\n walletClient,\n token.address as Address,\n spenderAddress as Address,\n 0n,\n undefined,\n false,\n await getTokenChain(client, token.chainId)\n )\n\n return approveTx\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,MAAa,eAAe,OAC1B,QACA,YACA,cACA,iBACA,QACA,kBACA,4BAEA,UACwB;CACxB,MAAM,QAAA,GAAOA,KAAAA,mBAAAA,CAAmB;EAC9B,KAAKC,kBAAAA;EACL,cAAc;EACd,MAAM,CAAC,iBAAiB,MAAM;CAChC,CAAC;CAED,IAAI,4BACF,OAAO;CAGT,IAAI,qBAA4C;EAC9C,IAAI;EACJ;EACA,sBACE,WAAW,SAAS,SAAS,UACzB,MAAMC,wCAAAA,wBACJ,QACA,YACA,OAAO,MAAM,WAAW,OAAO,EACjC,IACA,KAAA;CACR;CAEA,IAAI,kBAAkB,8BAA8B;EAClD,MAAM,+BACJ,MAAM,iBAAiB,6BAA6B;GAClD,aAAa;GACb,GAAG;EACL,CAAC;EAEH,qBAAqB;GACnB,GAAG;GACH,GAAG;EACL;CACF;CAEA,QAAA,GAAOC,WAAAA,UAAAA,CACL,YACAC,aAAAA,iBACA,iBACF,CAAC,CAAC;EACA,IAAI,mBAAmB;EACvB,SAAS,WAAW;EACpB,MAAM,mBAAmB;EACzB,KAAK,mBAAmB;EACxB,UAAU,mBAAmB;EAC7B,cAAc,mBAAmB;EACjC,sBAAsB,mBAAmB;EACzC,GAAI,SAAS,EAAE,OAAOC,2BAAAA,aAAa,YAAY,KAAK,EAAE;CACxD,CAA8B;AAChC;AAGA,MAAM,iBACJ,QACA,YAEA,OAAO,aAAa,OAAO,CAAC,CAAC,KAAKC,mCAAAA,4BAA4B,KAAA,CAAS;;;;;;;;;;;AAYzE,MAAa,oBAAoB,OAC/B,QACA,EAAE,cAAc,OAAO,gBAAgB,aACd;CAEzB,IAAIC,4BAAAA,cAAc,MAAM,OAAO,GAC7B;CAWF,IAAI,SAAS,MATgBC,6BAAAA,aAC3B,QACA,cACA,MAAM,SACN,aAAa,QAAS,SACtB,gBACA,MAAM,OACR,GAcE,OAAO,MAXiB,aACtB,QACA,cACA,MAAM,SACN,gBACA,QACA,KAAA,GACA,OACA,MAAM,cAAc,QAAQ,MAAM,OAAO,CAC3C;AAIJ;;;;;;;;;;AAWA,MAAa,sBAAsB,OACjC,QACA,EAAE,cAAc,OAAO,qBACE;CAEzB,IAAID,4BAAAA,cAAc,MAAM,OAAO,GAC7B;CAUF,IAAI,MARyBC,6BAAAA,aAC3B,QACA,cACA,MAAM,SACN,aAAa,QAAS,SACtB,gBACA,MAAM,OACR,IACqB,GAYnB,OAAO,MAXiB,aACtB,QACA,cACA,MAAM,SACN,gBACA,IACA,KAAA,GACA,OACA,MAAM,cAAc,QAAQ,MAAM,OAAO,CAC3C;AAIJ"}
@@ -1,7 +1,6 @@
1
1
  import { WalletCallReceipt as WalletCallReceipt$1 } from "../types.js";
2
2
  import { Client, Hash } from "viem";
3
3
  import { GetCallsStatusReturnType } from "viem/actions";
4
- //#region src/actions/waitForBatchTransactionReceipt.d.ts
5
4
  /**
6
5
  * Waits until the wallet reports the EIP-5792 call bundle as done or failed.
7
6
  *
@@ -26,6 +25,4 @@ export declare const waitForBatchTransactionReceipt: (client: Client, batchHash:
26
25
  onFailed?: (result: GetCallsStatusReturnType) => void;
27
26
  signedAt?: number;
28
27
  callCount?: number;
29
- }) => Promise<WalletCallReceipt$1>;
30
- //#endregion
31
- //# sourceMappingURL=waitForBatchTransactionReceipt.d.ts.map
28
+ }) => Promise<WalletCallReceipt$1>;
@@ -3,7 +3,7 @@ let _lifi_sdk = require("@lifi/sdk");
3
3
  let viem = require("viem");
4
4
  let viem_actions = require("viem/actions");
5
5
  let viem_utils = require("viem/utils");
6
- //#region src/actions/waitForBatchTransactionReceipt.ts
6
+ // src/actions/waitForBatchTransactionReceipt.ts
7
7
  const DROPPED_BUNDLE_MAX_AGE_MS = 6e5;
8
8
  /**
9
9
  * viem shares one poll between the waits for the same client and id, and
@@ -96,7 +96,6 @@ const waitForBatchTransactionReceipt = async (client, batchHash, { onFailed, sig
96
96
  if (result.statusCode === 500) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Transaction failed.", void 0, { final: true });
97
97
  throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Transaction failed.");
98
98
  };
99
- //#endregion
100
99
  exports.waitForBatchTransactionReceipt = waitForBatchTransactionReceipt;
101
100
 
102
101
  //# sourceMappingURL=waitForBatchTransactionReceipt.js.map
@@ -1,7 +1,6 @@
1
1
  import { WalletCallReceipt as WalletCallReceipt$1 } from "../types.js";
2
2
  import { LiFiStep, SDKClient } from "@lifi/sdk";
3
3
  import { Hash } from "viem";
4
- //#region src/actions/waitForRelayedTransactionReceipt.d.ts
5
4
  /**
6
5
  * Polls the relayer until the relayed transaction is done or has failed.
7
6
  *
@@ -11,9 +10,7 @@ import { Hash } from "viem";
11
10
  * @param timeout - How long to wait for a result in milliseconds. Defaults to 24 hours.
12
11
  * @param signal - Ends the wait: no status request starts after it aborts, and the request in flight and the sleep end at once.
13
12
  * @returns The receipt of the relayed transaction.
14
- * @throws {TransactionError} If the transaction failed, was not found, or no result arrived before the timeout. Only the failed transaction is a final outcome.
13
+ * @throws {TransactionError} If the transaction failed, the status was not found after five status errors in a row, or no result arrived before the timeout. Only the failed transaction is a final outcome.
15
14
  * @throws The abort reason of `signal` once it aborts.
16
15
  */
17
- export declare const waitForRelayedTransactionReceipt: (client: SDKClient, taskId: Hash, step: LiFiStep, timeout?: number, signal?: AbortSignal) => Promise<WalletCallReceipt$1>;
18
- //#endregion
19
- //# sourceMappingURL=waitForRelayedTransactionReceipt.d.ts.map
16
+ export declare const waitForRelayedTransactionReceipt: (client: SDKClient, taskId: Hash, step: LiFiStep, timeout?: number, signal?: AbortSignal) => Promise<WalletCallReceipt$1>;
@@ -1,6 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_client_publicClient = require("../client/publicClient.js");
2
3
  let _lifi_sdk = require("@lifi/sdk");
3
- //#region src/actions/waitForRelayedTransactionReceipt.ts
4
+ let viem_actions = require("viem/actions");
5
+ let viem_utils = require("viem/utils");
6
+ // src/actions/waitForRelayedTransactionReceipt.ts
7
+ /**
8
+ * Status errors in a row that end the wait. A failed request, `NOT_FOUND`, the
9
+ * 422/1004 answer of a failed lookup and a source receipt that cannot be
10
+ * loaded each count; a PENDING answer resets the count, so a long relay does
11
+ * not collect errors over its whole wait.
12
+ */
13
+ const MAX_STATUS_ERRORS = 5;
14
+ /** The on-chain outcome of a source transaction, or `undefined` when its receipt cannot be loaded. */
15
+ const getSourceOutcome = async (client, chainId, hash) => {
16
+ try {
17
+ const publicClient = await require_client_publicClient.getPublicClient(client, chainId);
18
+ return (await (0, viem_utils.getAction)(publicClient, viem_actions.getTransactionReceipt, "getTransactionReceipt")({ hash })).status;
19
+ } catch {
20
+ return;
21
+ }
22
+ };
4
23
  /**
5
24
  * Polls the relayer until the relayed transaction is done or has failed.
6
25
  *
@@ -10,40 +29,59 @@ let _lifi_sdk = require("@lifi/sdk");
10
29
  * @param timeout - How long to wait for a result in milliseconds. Defaults to 24 hours.
11
30
  * @param signal - Ends the wait: no status request starts after it aborts, and the request in flight and the sleep end at once.
12
31
  * @returns The receipt of the relayed transaction.
13
- * @throws {TransactionError} If the transaction failed, was not found, or no result arrived before the timeout. Only the failed transaction is a final outcome.
32
+ * @throws {TransactionError} If the transaction failed, the status was not found after five status errors in a row, or no result arrived before the timeout. Only the failed transaction is a final outcome.
14
33
  * @throws The abort reason of `signal` once it aborts.
15
34
  */
16
35
  const waitForRelayedTransactionReceipt = async (client, taskId, step, timeout = 864e5, signal) => {
17
36
  const startTime = Date.now();
37
+ const isGasless = (0, _lifi_sdk.isGaslessStep)(step);
38
+ const isCrossChain = step.action.fromChainId !== step.action.toChainId;
39
+ let statusErrors = 0;
18
40
  return (0, _lifi_sdk.waitForResult)(async () => {
19
41
  if (Date.now() - startTime > timeout) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Relayed transaction timed out waiting for a result.");
20
- const result = await (0, _lifi_sdk.getRelayedTransactionStatus)(client, {
42
+ const result = await (isGasless ? (0, _lifi_sdk.getStatus)(client, { taskId }, { signal }) : (0, _lifi_sdk.getRelayedTransactionStatus)(client, {
21
43
  taskId,
22
44
  fromChain: step.action.fromChainId,
23
45
  toChain: step.action.toChainId,
24
46
  ...step.tool !== "custom" && { bridge: step.tool }
25
- }, { signal }).catch((e) => {
47
+ }, { signal })).catch((e) => {
26
48
  if (process.env.NODE_ENV === "development" && !signal?.aborted) console.debug("Fetching status from relayer failed.", e);
27
49
  });
50
+ const gaslessStatus = isGasless ? result : void 0;
51
+ const bridgeSource = isCrossChain && gaslessStatus?.sending?.txHash ? {
52
+ status: "success",
53
+ transactionHash: gaslessStatus.sending.txHash,
54
+ transactionLink: gaslessStatus.sending.txLink
55
+ } : void 0;
56
+ const statusError = (error) => {
57
+ statusErrors++;
58
+ if (statusErrors < MAX_STATUS_ERRORS) return;
59
+ throw error;
60
+ };
28
61
  switch (result?.status) {
29
- case "PENDING": return;
62
+ case "PENDING":
63
+ statusErrors = 0;
64
+ return gaslessStatus?.substatus === "WAIT_DESTINATION_TRANSACTION" ? bridgeSource : void 0;
30
65
  case "DONE": {
31
66
  const sending = result?.transactionStatus?.sending || result?.sending;
32
67
  return {
33
68
  status: "success",
34
69
  gasUsed: sending?.gasUsed,
35
- transactionHash: result?.metadata.txHash || sending?.txHash,
70
+ transactionHash: result?.metadata?.txHash || sending?.txHash,
36
71
  transactionLink: sending?.txLink
37
72
  };
38
73
  }
39
- case "FAILED": throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Transaction was reverted.", void 0, { final: true });
40
- default: throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionNotFound, "Transaction not found.");
74
+ case "FAILED":
75
+ if (bridgeSource) {
76
+ const outcome = await getSourceOutcome(client, step.action.fromChainId, bridgeSource.transactionHash);
77
+ if (outcome === "success") return bridgeSource;
78
+ if (outcome === void 0) return statusError(new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "The relayed transaction failed, and its source transaction could not be checked."));
79
+ }
80
+ throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Transaction was reverted.", void 0, { final: true });
81
+ default: return statusError(new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionNotFound, "Transaction not found."));
41
82
  }
42
- }, 5e3, 3, (_, error) => {
43
- return !(error instanceof _lifi_sdk.TransactionError && error.code === _lifi_sdk.LiFiErrorCode.TransactionFailed);
44
- }, signal);
83
+ }, 5e3, void 0, () => false, signal);
45
84
  };
46
- //#endregion
47
85
  exports.waitForRelayedTransactionReceipt = waitForRelayedTransactionReceipt;
48
86
 
49
87
  //# sourceMappingURL=waitForRelayedTransactionReceipt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForRelayedTransactionReceipt.js","names":["waitForResult","TransactionError","LiFiErrorCode","getRelayedTransactionStatus"],"sources":["../../../src/actions/waitForRelayedTransactionReceipt.ts"],"sourcesContent":["import type { SDKClient } from '@lifi/sdk'\nimport {\n type ExtendedTransactionInfo,\n type FullStatusData,\n getRelayedTransactionStatus,\n LiFiErrorCode,\n type LiFiStep,\n TransactionError,\n waitForResult,\n} from '@lifi/sdk'\nimport type { Hash } from 'viem'\nimport type { WalletCallReceipt } from '../types.js'\n\n/**\n * Polls the relayer until the relayed transaction is done or has failed.\n *\n * @param client - {@link SDKClient}\n * @param taskId - The relayer task id.\n * @param step - The step the task belongs to.\n * @param timeout - How long to wait for a result in milliseconds. Defaults to 24 hours.\n * @param signal - Ends the wait: no status request starts after it aborts, and the request in flight and the sleep end at once.\n * @returns The receipt of the relayed transaction.\n * @throws {TransactionError} If the transaction failed, was not found, or no result arrived before the timeout. Only the failed transaction is a final outcome.\n * @throws The abort reason of `signal` once it aborts.\n */\nexport const waitForRelayedTransactionReceipt = async (\n client: SDKClient,\n taskId: Hash,\n step: LiFiStep,\n timeout: number = 3_600_000 * 24,\n signal?: AbortSignal\n): Promise<WalletCallReceipt> => {\n const startTime = Date.now()\n return waitForResult(\n async () => {\n // Without this check, a task that stays PENDING is polled forever:\n // PENDING is not an error, so the retry limit does not apply.\n // TransactionFailed is not retried, so this ends the poll. Not final:\n // the relayer may still execute the task, so the action keeps its task\n // id and a resume waits for it again instead of signing a new one.\n if (Date.now() - startTime > timeout) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Relayed transaction timed out waiting for a result.'\n )\n }\n\n const result = await getRelayedTransactionStatus(\n client,\n {\n taskId,\n fromChain: step.action.fromChainId,\n toChain: step.action.toChainId,\n ...(step.tool !== 'custom' && { bridge: step.tool }),\n },\n { signal }\n ).catch((e) => {\n // A request that the abort ended is no failure of the relayer.\n if (process.env.NODE_ENV === 'development' && !signal?.aborted) {\n console.debug('Fetching status from relayer failed.', e)\n }\n return undefined\n })\n\n switch (result?.status) {\n case 'PENDING':\n return undefined\n case 'DONE': {\n const sending: ExtendedTransactionInfo | undefined =\n (result?.transactionStatus?.sending as ExtendedTransactionInfo) ||\n ((result as unknown as FullStatusData)\n ?.sending as ExtendedTransactionInfo)\n return {\n status: 'success',\n gasUsed: sending?.gasUsed,\n transactionHash: result?.metadata.txHash || sending?.txHash,\n transactionLink: sending?.txLink,\n } as unknown as WalletCallReceipt\n }\n case 'FAILED':\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Transaction was reverted.',\n undefined,\n { final: true }\n )\n default:\n throw new TransactionError(\n LiFiErrorCode.TransactionNotFound,\n 'Transaction not found.'\n )\n }\n },\n 5000,\n 3,\n (_, error) => {\n return !(\n error instanceof TransactionError &&\n error.code === LiFiErrorCode.TransactionFailed\n )\n },\n signal\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,MAAa,mCAAmC,OAC9C,QACA,QACA,MACA,UAAkB,OAClB,WAC+B;CAC/B,MAAM,YAAY,KAAK,IAAI;CAC3B,QAAA,GAAOA,UAAAA,cAAAA,CACL,YAAY;EAMV,IAAI,KAAK,IAAI,IAAI,YAAY,SAC3B,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,mBACd,qDACF;EAGF,MAAM,SAAS,OAAA,GAAMC,UAAAA,4BAAAA,CACnB,QACA;GACE;GACA,WAAW,KAAK,OAAO;GACvB,SAAS,KAAK,OAAO;GACrB,GAAI,KAAK,SAAS,YAAY,EAAE,QAAQ,KAAK,KAAK;EACpD,GACA,EAAE,OAAO,CACX,CAAC,CAAC,OAAO,MAAM;GAEb,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAAQ,SACrD,QAAQ,MAAM,wCAAwC,CAAC;EAG3D,CAAC;EAED,QAAQ,QAAQ,QAAhB;GACE,KAAK,WACH;GACF,KAAK,QAAQ;IACX,MAAM,UACH,QAAQ,mBAAmB,WAC1B,QACE;IACN,OAAO;KACL,QAAQ;KACR,SAAS,SAAS;KAClB,iBAAiB,QAAQ,SAAS,UAAU,SAAS;KACrD,iBAAiB,SAAS;IAC5B;GACF;GACA,KAAK,UACH,MAAM,IAAIF,UAAAA,iBACRC,UAAAA,cAAc,mBACd,6BACA,KAAA,GACA,EAAE,OAAO,KAAK,CAChB;GACF,SACE,MAAM,IAAID,UAAAA,iBACRC,UAAAA,cAAc,qBACd,wBACF;EACJ;CACF,GACA,KACA,IACC,GAAG,UAAU;EACZ,OAAO,EACL,iBAAiBD,UAAAA,oBACjB,MAAM,SAASC,UAAAA,cAAc;CAEjC,GACA,MACF;AACF"}
1
+ {"version":3,"file":"waitForRelayedTransactionReceipt.js","names":["getPublicClient","getAction","getTransactionReceipt","isGaslessStep","waitForResult","TransactionError","LiFiErrorCode","getStatus","getRelayedTransactionStatus"],"sources":["../../../src/actions/waitForRelayedTransactionReceipt.ts"],"sourcesContent":["import type { SDKClient } from '@lifi/sdk'\nimport {\n type ExtendedTransactionInfo,\n type FullStatusData,\n getRelayedTransactionStatus,\n getStatus,\n isGaslessStep,\n LiFiErrorCode,\n type LiFiStep,\n type RelayStatusResponseData,\n TransactionError,\n waitForResult,\n} from '@lifi/sdk'\nimport type { Hash } from 'viem'\nimport { getTransactionReceipt } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { getPublicClient } from '../client/publicClient.js'\nimport type { WalletCallReceipt } from '../types.js'\n\n/**\n * Status errors in a row that end the wait. A failed request, `NOT_FOUND`, the\n * 422/1004 answer of a failed lookup and a source receipt that cannot be\n * loaded each count; a PENDING answer resets the count, so a long relay does\n * not collect errors over its whole wait.\n */\nconst MAX_STATUS_ERRORS = 5\n\n/** The on-chain outcome of a source transaction, or `undefined` when its receipt cannot be loaded. */\nconst getSourceOutcome = async (\n client: SDKClient,\n chainId: number,\n hash: Hash\n): Promise<'success' | 'reverted' | undefined> => {\n try {\n const publicClient = await getPublicClient(client, chainId)\n const receipt = await getAction(\n publicClient,\n getTransactionReceipt,\n 'getTransactionReceipt'\n )({ hash })\n return receipt.status\n } catch {\n return undefined\n }\n}\n\n/**\n * Polls the relayer until the relayed transaction is done or has failed.\n *\n * @param client - {@link SDKClient}\n * @param taskId - The relayer task id.\n * @param step - The step the task belongs to.\n * @param timeout - How long to wait for a result in milliseconds. Defaults to 24 hours.\n * @param signal - Ends the wait: no status request starts after it aborts, and the request in flight and the sleep end at once.\n * @returns The receipt of the relayed transaction.\n * @throws {TransactionError} If the transaction failed, the status was not found after five status errors in a row, or no result arrived before the timeout. Only the failed transaction is a final outcome.\n * @throws The abort reason of `signal` once it aborts.\n */\nexport const waitForRelayedTransactionReceipt = async (\n client: SDKClient,\n taskId: Hash,\n step: LiFiStep,\n timeout: number = 3_600_000 * 24,\n signal?: AbortSignal\n): Promise<WalletCallReceipt> => {\n const startTime = Date.now()\n const isGasless = isGaslessStep(step)\n const isCrossChain = step.action.fromChainId !== step.action.toChainId\n let statusErrors = 0\n return waitForResult(\n async () => {\n // Without this check, a task that stays PENDING is polled forever:\n // PENDING is no status error, so the error limit does not apply. An\n // error the poll throws ends it. Not final:\n // the relayer may still execute the task, so the action keeps its task\n // id and a resume waits for it again instead of signing a new one.\n if (Date.now() - startTime > timeout) {\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Relayed transaction timed out waiting for a result.'\n )\n }\n\n // A gasless task id is a hash like a 1inch `Order` task id, so the step\n // selects the endpoint. The task id alone routes a gasless request: a\n // `bridge` would let a proxy such as the Jumper backend answer it with\n // its own order lookup. The cast is the one `getRelayedTransactionStatus`\n // makes for the Hyperliquid answer of the same endpoint.\n const result = await (\n isGasless\n ? (getStatus(\n client,\n { taskId },\n { signal }\n ) as unknown as Promise<RelayStatusResponseData>)\n : getRelayedTransactionStatus(\n client,\n {\n taskId,\n fromChain: step.action.fromChainId,\n toChain: step.action.toChainId,\n ...(step.tool !== 'custom' && { bridge: step.tool }),\n },\n { signal }\n )\n ).catch((e) => {\n // A request that the abort ended is no failure of the relayer.\n if (process.env.NODE_ENV === 'development' && !signal?.aborted) {\n console.debug('Fetching status from relayer failed.', e)\n }\n return undefined\n })\n\n // A gasless answer is the transfer status of `/v1/status`: it reports\n // the relayed source transaction in `sending` once the relayer sent it.\n // Only a bridge transfer ends the wait at its source; on one chain the\n // relayed transaction is the whole transfer.\n const gaslessStatus = isGasless\n ? (result as unknown as FullStatusData | undefined)\n : undefined\n const bridgeSource =\n isCrossChain && gaslessStatus?.sending?.txHash\n ? ({\n status: 'success',\n transactionHash: gaslessStatus.sending.txHash,\n transactionLink: gaslessStatus.sending.txLink,\n } as unknown as WalletCallReceipt)\n : undefined\n\n const statusError = (error: TransactionError): undefined => {\n statusErrors++\n if (statusErrors < MAX_STATUS_ERRORS) {\n return undefined\n }\n throw error\n }\n\n switch (result?.status) {\n case 'PENDING':\n statusErrors = 0\n // A gasless bridge transfer whose source transaction landed waits for\n // its destination. The source wait ends here, so a later bridge\n // failure reaches the status task, not the FAILED below.\n return gaslessStatus?.substatus === 'WAIT_DESTINATION_TRANSACTION'\n ? bridgeSource\n : undefined\n case 'DONE': {\n const sending: ExtendedTransactionInfo | undefined =\n (result?.transactionStatus?.sending as ExtendedTransactionInfo) ||\n ((result as unknown as FullStatusData)\n ?.sending as ExtendedTransactionInfo)\n return {\n status: 'success',\n gasUsed: sending?.gasUsed,\n transactionHash: result?.metadata?.txHash || sending?.txHash,\n transactionLink: sending?.txLink,\n } as unknown as WalletCallReceipt\n }\n case 'FAILED':\n // FAILED with a hash is mostly a relayed source transaction that\n // reverted and moved nothing, so a resume may sign again. A bridge\n // can also fail after its source landed: the tokens left the wallet,\n // and a resume must not sign and relay a second transfer. The status\n // task follows that transfer, as for any bridge. The source receipt\n // tells the two apart.\n if (bridgeSource) {\n const outcome = await getSourceOutcome(\n client,\n step.action.fromChainId,\n bridgeSource.transactionHash\n )\n if (outcome === 'success') {\n return bridgeSource\n }\n if (outcome === undefined) {\n // The node may not have the receipt yet, so this counts as a\n // status error. Not final: a resume waits for the same task and\n // checks again.\n return statusError(\n new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'The relayed transaction failed, and its source transaction could not be checked.'\n )\n )\n }\n }\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n 'Transaction was reverted.',\n undefined,\n { final: true }\n )\n default:\n return statusError(\n new TransactionError(\n LiFiErrorCode.TransactionNotFound,\n 'Transaction not found.'\n )\n )\n }\n },\n 5000,\n undefined,\n // The poll counts its own status errors, so every error it throws ends\n // the wait.\n () => false,\n signal\n )\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAM,oBAAoB;;AAG1B,MAAM,mBAAmB,OACvB,QACA,SACA,SACgD;CAChD,IAAI;EACF,MAAM,eAAe,MAAMA,4BAAAA,gBAAgB,QAAQ,OAAO;EAM1D,QAAO,OAAA,GALeC,WAAAA,UAAAA,CACpB,cACAC,aAAAA,uBACA,uBACF,CAAC,CAAC,EAAE,KAAK,CAAC,EAAA,CACK;CACjB,QAAQ;EACN;CACF;AACF;;;;;;;;;;;;;AAcA,MAAa,mCAAmC,OAC9C,QACA,QACA,MACA,UAAkB,OAClB,WAC+B;CAC/B,MAAM,YAAY,KAAK,IAAI;CAC3B,MAAM,aAAA,GAAYC,UAAAA,cAAAA,CAAc,IAAI;CACpC,MAAM,eAAe,KAAK,OAAO,gBAAgB,KAAK,OAAO;CAC7D,IAAI,eAAe;CACnB,QAAA,GAAOC,UAAAA,cAAAA,CACL,YAAY;EAMV,IAAI,KAAK,IAAI,IAAI,YAAY,SAC3B,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,mBACd,qDACF;EAQF,MAAM,SAAS,OACb,aAAA,GACKC,UAAAA,UAAAA,CACC,QACA,EAAE,OAAO,GACT,EAAE,OAAO,CACX,KAAA,GACAC,UAAAA,4BAAAA,CACE,QACA;GACE;GACA,WAAW,KAAK,OAAO;GACvB,SAAS,KAAK,OAAO;GACrB,GAAI,KAAK,SAAS,YAAY,EAAE,QAAQ,KAAK,KAAK;EACpD,GACA,EAAE,OAAO,CACX,EAAA,CACJ,OAAO,MAAM;GAEb,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAAQ,SACrD,QAAQ,MAAM,wCAAwC,CAAC;EAG3D,CAAC;EAMD,MAAM,gBAAgB,YACjB,SACD,KAAA;EACJ,MAAM,eACJ,gBAAgB,eAAe,SAAS,SACnC;GACC,QAAQ;GACR,iBAAiB,cAAc,QAAQ;GACvC,iBAAiB,cAAc,QAAQ;EACzC,IACA,KAAA;EAEN,MAAM,eAAe,UAAuC;GAC1D;GACA,IAAI,eAAe,mBACjB;GAEF,MAAM;EACR;EAEA,QAAQ,QAAQ,QAAhB;GACE,KAAK;IACH,eAAe;IAIf,OAAO,eAAe,cAAc,iCAChC,eACA,KAAA;GACN,KAAK,QAAQ;IACX,MAAM,UACH,QAAQ,mBAAmB,WAC1B,QACE;IACN,OAAO;KACL,QAAQ;KACR,SAAS,SAAS;KAClB,iBAAiB,QAAQ,UAAU,UAAU,SAAS;KACtD,iBAAiB,SAAS;IAC5B;GACF;GACA,KAAK;IAOH,IAAI,cAAc;KAChB,MAAM,UAAU,MAAM,iBACpB,QACA,KAAK,OAAO,aACZ,aAAa,eACf;KACA,IAAI,YAAY,WACd,OAAO;KAET,IAAI,YAAY,KAAA,GAId,OAAO,YACL,IAAIH,UAAAA,iBACFC,UAAAA,cAAc,mBACd,kFACF,CACF;IAEJ;IACA,MAAM,IAAID,UAAAA,iBACRC,UAAAA,cAAc,mBACd,6BACA,KAAA,GACA,EAAE,OAAO,KAAK,CAChB;GACF,SACE,OAAO,YACL,IAAID,UAAAA,iBACFC,UAAAA,cAAc,qBACd,wBACF,CACF;EACJ;CACF,GACA,KACA,KAAA,SAGM,OACN,MACF;AACF"}
@@ -1,6 +1,5 @@
1
1
  import { SDKClient } from "@lifi/sdk";
2
2
  import { Address, Hash } from "viem";
3
- //#region src/actions/waitForSafeTransactionExecution.d.ts
4
3
  export interface WaitForSafeTransactionExecutionProps {
5
4
  chainId: number;
6
5
  safeAddress: Address;
@@ -17,6 +16,4 @@ export interface WaitForSafeTransactionExecutionProps {
17
16
  * @returns The on-chain transaction hash once the Safe transaction is executed.
18
17
  * @throws {TransactionError} If the transaction fails, is replaced, or polling times out.
19
18
  */
20
- export declare function waitForSafeTransactionExecution(client: SDKClient, { chainId, safeAddress, signature, pollingInterval, timeout: timeoutMs }: WaitForSafeTransactionExecutionProps): Promise<Hash>;
21
- //#endregion
22
- //# sourceMappingURL=waitForSafeTransactionExecution.d.ts.map
19
+ export declare function waitForSafeTransactionExecution(client: SDKClient, { chainId, safeAddress, signature, pollingInterval, timeout: timeoutMs }: WaitForSafeTransactionExecutionProps): Promise<Hash>;
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils_getSafeApiKey = require("../utils/getSafeApiKey.js");
3
2
  const require_client_safeClient = require("../client/safeClient.js");
3
+ const require_utils_getSafeApiKey = require("../utils/getSafeApiKey.js");
4
4
  let _lifi_sdk = require("@lifi/sdk");
5
- //#region src/actions/waitForSafeTransactionExecution.ts
5
+ // src/actions/waitForSafeTransactionExecution.ts
6
6
  /**
7
7
  * Polls the Safe Transaction Service until the transaction matching the given signature
8
8
  * is executed, then resolves with the on-chain transaction hash.
@@ -49,7 +49,6 @@ async function waitForSafeTransactionExecution(client, { chainId, safeAddress, s
49
49
  throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionFailed, "Safe transaction timed out waiting for execution.");
50
50
  }
51
51
  }
52
- //#endregion
53
52
  exports.waitForSafeTransactionExecution = waitForSafeTransactionExecution;
54
53
 
55
54
  //# sourceMappingURL=waitForSafeTransactionExecution.js.map
@@ -1,6 +1,5 @@
1
1
  import { ChainId, SDKClient } from "@lifi/sdk";
2
2
  import { Chain, Client, Hash, ReplacementReturnType, TransactionReceipt } from "viem";
3
- //#region src/actions/waitForTransactionReceipt.d.ts
4
3
  interface WaitForTransactionReceiptProps {
5
4
  client: Client;
6
5
  chainId: ChainId;
@@ -8,6 +7,4 @@ interface WaitForTransactionReceiptProps {
8
7
  onReplaced?: (response: ReplacementReturnType<Chain | undefined>) => void;
9
8
  }
10
9
  export declare function waitForTransactionReceipt(client: SDKClient, { client: viemClient, chainId, txHash, onReplaced }: WaitForTransactionReceiptProps): Promise<TransactionReceipt | undefined>;
11
- //#endregion
12
- export {};
13
- //# sourceMappingURL=waitForTransactionReceipt.d.ts.map
10
+ export {};
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_client_publicClient = require("../client/publicClient.js");
3
3
  let _lifi_sdk = require("@lifi/sdk");
4
4
  let viem_actions = require("viem/actions");
5
- //#region src/actions/waitForTransactionReceipt.ts
5
+ // src/actions/waitForTransactionReceipt.ts
6
6
  async function waitForTransactionReceipt(client, { client: viemClient, chainId, txHash, onReplaced }) {
7
7
  let { transactionReceipt, replacementReason } = await waitForReceipt(viemClient, txHash, onReplaced);
8
8
  if (!transactionReceipt?.status) {
@@ -31,7 +31,6 @@ async function waitForReceipt(client, txHash, onReplaced) {
31
31
  replacementReason
32
32
  };
33
33
  }
34
- //#endregion
35
34
  exports.waitForTransactionReceipt = waitForTransactionReceipt;
36
35
 
37
36
  //# sourceMappingURL=waitForTransactionReceipt.js.map
@@ -1,12 +1,9 @@
1
1
  import { SDKClient } from "@lifi/sdk";
2
2
  import { Client } from "viem";
3
- //#region src/client/publicClient.d.ts
4
3
  /**
5
4
  * Get an instance of a provider for a specific chain
6
5
  * @param client - The SDK client
7
6
  * @param chainId - Id of the chain the provider is for
8
7
  * @returns The public client for the given chain
9
8
  */
10
- export declare const getPublicClient: (client: SDKClient, chainId: number) => Promise<Client>;
11
- //#endregion
12
- //# sourceMappingURL=publicClient.d.ts.map
9
+ export declare const getPublicClient: (client: SDKClient, chainId: number) => Promise<Client>;
@@ -3,7 +3,7 @@ const require_actions_constants = require("../actions/constants.js");
3
3
  let _lifi_sdk = require("@lifi/sdk");
4
4
  let viem = require("viem");
5
5
  let viem_chains = require("viem/chains");
6
- //#region src/client/publicClient.ts
6
+ // src/client/publicClient.ts
7
7
  const publicClients = /* @__PURE__ */ new Map();
8
8
  /**
9
9
  * Get an instance of a provider for a specific chain
@@ -52,7 +52,6 @@ const buildPublicClient = async (client, chainId) => {
52
52
  batch: { multicall: true }
53
53
  });
54
54
  };
55
- //#endregion
56
55
  exports.getPublicClient = getPublicClient;
57
56
 
58
57
  //# sourceMappingURL=publicClient.js.map
@@ -1,6 +1,5 @@
1
1
  import { SafeInfo, SafeMultisigTransaction, SafeMultisigTransactionList } from "./types.js";
2
2
  import { Address, Hash } from "viem";
3
- //#region src/client/safeClient.d.ts
4
3
  export interface SafeClientInterface {
5
4
  getInfo: (address: Address) => Promise<SafeInfo>;
6
5
  getTransaction: (safeTxHash: Hash) => Promise<SafeMultisigTransaction>;
@@ -10,6 +9,4 @@ export interface SafeClientInterface {
10
9
  }) => Promise<SafeMultisigTransactionList>;
11
10
  }
12
11
  export declare const getSafeClient: (chainId: number, apiKey?: string) => SafeClientInterface;
13
- export type SafeClient = ReturnType<typeof getSafeClient>;
14
- //#endregion
15
- //# sourceMappingURL=safeClient.d.ts.map
12
+ export type SafeClient = ReturnType<typeof getSafeClient>;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _lifi_sdk = require("@lifi/sdk");
3
- //#region src/client/safeClient.ts
3
+ // src/client/safeClient.ts
4
4
  const SAFE_CLIENT_GATEWAY = "https://safe-client.safe.global";
5
5
  const TX_SERVICE_URL_CACHE_TTL = 36e5;
6
6
  const txServiceUrlCache = new _lifi_sdk.LruMap(12);
@@ -38,7 +38,6 @@ const getSafeClient = (chainId, apiKey) => ({
38
38
  return request(chainId, `/api/v1/safes/${safeAddress}/multisig-transactions/${qs ? `?${qs}` : ""}`, apiKey);
39
39
  }
40
40
  });
41
- //#endregion
42
41
  exports.getSafeClient = getSafeClient;
43
42
 
44
43
  //# sourceMappingURL=safeClient.js.map
@@ -1,4 +1,3 @@
1
- //#region src/client/types.d.ts
2
1
  export interface SafeInfo {
3
2
  threshold: number;
4
3
  owners: string[];
@@ -16,6 +15,4 @@ export interface SafeMultisigTransaction {
16
15
  export interface SafeMultisigTransactionList {
17
16
  count: number;
18
17
  results: SafeMultisigTransaction[];
19
- }
20
- //#endregion
21
- //# sourceMappingURL=types.d.ts.map
18
+ }
@@ -1,7 +1,6 @@
1
1
  import { EthereumStepExecutorContext } from "../types.js";
2
2
  import { BaseStepExecutor, ExecuteStepRetryError, ExecuteStepRetryParams, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, StepExecutorOptions, TaskPipeline } from "@lifi/sdk";
3
3
  import { Client } from "viem";
4
- //#region src/core/EthereumStepExecutor.d.ts
5
4
  interface EthereumStepExecutorOptions extends StepExecutorOptions {
6
5
  client: Client;
7
6
  switchChain?: (chainId: number) => Promise<Client | undefined>;
@@ -19,6 +18,4 @@ export declare class EthereumStepExecutor extends BaseStepExecutor {
19
18
  override createContext: (baseContext: StepExecutorBaseContext) => Promise<EthereumStepExecutorContext>;
20
19
  override createPipeline: (context: EthereumStepExecutorContext) => TaskPipeline;
21
20
  }
22
- //#endregion
23
- export {};
24
- //# sourceMappingURL=EthereumStepExecutor.d.ts.map
21
+ export {};