@safe-global/protocol-kit 5.2.1 → 6.0.0-alpha.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 (355) hide show
  1. package/dist/cjs/src/index.cjs +7534 -0
  2. package/dist/cjs/test-utils/index.cjs +4118 -0
  3. package/dist/esm/src/index.mjs +7639 -0
  4. package/dist/esm/test-utils/index.mjs +4217 -0
  5. package/dist/src/Safe.d.ts +3 -2
  6. package/dist/src/Safe.d.ts.map +1 -0
  7. package/dist/src/SafeProvider.d.ts +1 -0
  8. package/dist/src/SafeProvider.d.ts.map +1 -0
  9. package/dist/src/contracts/BaseContract.d.ts +1 -0
  10. package/dist/src/contracts/BaseContract.d.ts.map +1 -0
  11. package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.d.ts +1 -0
  12. package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.d.ts.map +1 -0
  13. package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.d.ts +1 -0
  14. package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.d.ts.map +1 -0
  15. package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.d.ts +1 -0
  16. package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.d.ts.map +1 -0
  17. package/dist/src/contracts/CreateCall/CreateCallBaseContract.d.ts +1 -0
  18. package/dist/src/contracts/CreateCall/CreateCallBaseContract.d.ts.map +1 -0
  19. package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.d.ts +1 -0
  20. package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.d.ts.map +1 -0
  21. package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.d.ts +1 -0
  22. package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.d.ts.map +1 -0
  23. package/dist/src/contracts/MultiSend/MultiSendBaseContract.d.ts +1 -0
  24. package/dist/src/contracts/MultiSend/MultiSendBaseContract.d.ts.map +1 -0
  25. package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.d.ts +1 -0
  26. package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.d.ts.map +1 -0
  27. package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.d.ts +1 -0
  28. package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.d.ts.map +1 -0
  29. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.d.ts +1 -0
  30. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.d.ts.map +1 -0
  31. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.d.ts +1 -0
  32. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.d.ts.map +1 -0
  33. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.d.ts +1 -0
  34. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.d.ts.map +1 -0
  35. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.d.ts +1 -0
  36. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.d.ts.map +1 -0
  37. package/dist/src/contracts/Safe/SafeBaseContract.d.ts +1 -0
  38. package/dist/src/contracts/Safe/SafeBaseContract.d.ts.map +1 -0
  39. package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.d.ts +1 -0
  40. package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.d.ts.map +1 -0
  41. package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.d.ts +1 -0
  42. package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.d.ts.map +1 -0
  43. package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.d.ts +1 -0
  44. package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.d.ts.map +1 -0
  45. package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.d.ts +1 -0
  46. package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.d.ts.map +1 -0
  47. package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.d.ts +1 -0
  48. package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.d.ts.map +1 -0
  49. package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.d.ts +1 -0
  50. package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.d.ts.map +1 -0
  51. package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.d.ts +1 -0
  52. package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.d.ts.map +1 -0
  53. package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.d.ts +1 -0
  54. package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.d.ts.map +1 -0
  55. package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.d.ts +1 -0
  56. package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.d.ts.map +1 -0
  57. package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.d.ts +1 -0
  58. package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.d.ts.map +1 -0
  59. package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.d.ts +1 -0
  60. package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.d.ts.map +1 -0
  61. package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.d.ts +1 -0
  62. package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.d.ts.map +1 -0
  63. package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.d.ts +1 -0
  64. package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.d.ts.map +1 -0
  65. package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.d.ts +1 -0
  66. package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.d.ts.map +1 -0
  67. package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.d.ts +1 -0
  68. package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.d.ts.map +1 -0
  69. package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.d.ts +1 -0
  70. package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.d.ts.map +1 -0
  71. package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.d.ts +1 -0
  72. package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.d.ts.map +1 -0
  73. package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.d.ts +1 -0
  74. package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.d.ts.map +1 -0
  75. package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.d.ts +1 -0
  76. package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.d.ts.map +1 -0
  77. package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.d.ts +1 -0
  78. package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.d.ts.map +1 -0
  79. package/dist/src/contracts/config.d.ts +1 -0
  80. package/dist/src/contracts/config.d.ts.map +1 -0
  81. package/dist/src/contracts/constants.d.ts +1 -0
  82. package/dist/src/contracts/constants.d.ts.map +1 -0
  83. package/dist/src/contracts/contractInstances.d.ts +1 -0
  84. package/dist/src/contracts/contractInstances.d.ts.map +1 -0
  85. package/dist/src/contracts/index.d.ts +1 -0
  86. package/dist/src/contracts/index.d.ts.map +1 -0
  87. package/dist/src/contracts/safeDeploymentContracts.d.ts +1 -0
  88. package/dist/src/contracts/safeDeploymentContracts.d.ts.map +1 -0
  89. package/dist/src/contracts/utils.d.ts +1 -0
  90. package/dist/src/contracts/utils.d.ts.map +1 -0
  91. package/dist/src/index.d.ts +1 -0
  92. package/dist/src/index.d.ts.map +1 -0
  93. package/dist/src/managers/contractManager.d.ts +1 -0
  94. package/dist/src/managers/contractManager.d.ts.map +1 -0
  95. package/dist/src/managers/fallbackHandlerManager.d.ts +1 -0
  96. package/dist/src/managers/fallbackHandlerManager.d.ts.map +1 -0
  97. package/dist/src/managers/guardManager.d.ts +1 -0
  98. package/dist/src/managers/guardManager.d.ts.map +1 -0
  99. package/dist/src/managers/moduleManager.d.ts +1 -0
  100. package/dist/src/managers/moduleManager.d.ts.map +1 -0
  101. package/dist/src/managers/ownerManager.d.ts +1 -0
  102. package/dist/src/managers/ownerManager.d.ts.map +1 -0
  103. package/dist/src/types/contracts.d.ts +1 -0
  104. package/dist/src/types/contracts.d.ts.map +1 -0
  105. package/dist/src/types/index.d.ts +1 -1
  106. package/dist/src/types/index.d.ts.map +1 -0
  107. package/dist/src/types/passkeys.d.ts +1 -0
  108. package/dist/src/types/passkeys.d.ts.map +1 -0
  109. package/dist/src/types/safeConfig.d.ts +1 -0
  110. package/dist/src/types/safeConfig.d.ts.map +1 -0
  111. package/dist/src/types/safeProvider.d.ts +1 -0
  112. package/dist/src/types/safeProvider.d.ts.map +1 -0
  113. package/dist/src/types/transactions.d.ts +1 -0
  114. package/dist/src/types/transactions.d.ts.map +1 -0
  115. package/dist/src/utils/address.d.ts +1 -0
  116. package/dist/src/utils/address.d.ts.map +1 -0
  117. package/dist/src/utils/block.d.ts +1 -0
  118. package/dist/src/utils/block.d.ts.map +1 -0
  119. package/dist/src/utils/constants.d.ts +1 -0
  120. package/dist/src/utils/constants.d.ts.map +1 -0
  121. package/dist/src/utils/eip-3770/config.d.ts +1 -0
  122. package/dist/src/utils/eip-3770/config.d.ts.map +1 -0
  123. package/dist/src/utils/eip-3770/index.d.ts +1 -0
  124. package/dist/src/utils/eip-3770/index.d.ts.map +1 -0
  125. package/dist/src/utils/eip-712/encode.d.ts +1 -0
  126. package/dist/src/utils/eip-712/encode.d.ts.map +1 -0
  127. package/dist/src/utils/eip-712/index.d.ts +1 -0
  128. package/dist/src/utils/eip-712/index.d.ts.map +1 -0
  129. package/dist/src/utils/erc-20/index.d.ts +1 -0
  130. package/dist/src/utils/erc-20/index.d.ts.map +1 -0
  131. package/dist/src/utils/getProtocolKitVersion.d.ts +1 -0
  132. package/dist/src/utils/getProtocolKitVersion.d.ts.map +1 -0
  133. package/dist/src/utils/index.d.ts +1 -0
  134. package/dist/src/utils/index.d.ts.map +1 -0
  135. package/dist/src/utils/memoized.d.ts +1 -0
  136. package/dist/src/utils/memoized.d.ts.map +1 -0
  137. package/dist/src/utils/messages/SafeMessage.d.ts +1 -0
  138. package/dist/src/utils/messages/SafeMessage.d.ts.map +1 -0
  139. package/dist/src/utils/on-chain-tracking/generateOnChainIdentifier.d.ts +1 -0
  140. package/dist/src/utils/on-chain-tracking/generateOnChainIdentifier.d.ts.map +1 -0
  141. package/dist/src/utils/passkeys/PasskeyClient.d.ts +1 -0
  142. package/dist/src/utils/passkeys/PasskeyClient.d.ts.map +1 -0
  143. package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.d.ts +1 -0
  144. package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.d.ts.map +1 -0
  145. package/dist/src/utils/passkeys/extractPasskeyData.d.ts +1 -0
  146. package/dist/src/utils/passkeys/extractPasskeyData.d.ts.map +1 -0
  147. package/dist/src/utils/passkeys/getPasskeyOwnerAddress.d.ts +1 -0
  148. package/dist/src/utils/passkeys/getPasskeyOwnerAddress.d.ts.map +1 -0
  149. package/dist/src/utils/passkeys/index.d.ts +1 -0
  150. package/dist/src/utils/passkeys/index.d.ts.map +1 -0
  151. package/dist/src/utils/passkeys/isSharedSigner.d.ts +1 -0
  152. package/dist/src/utils/passkeys/isSharedSigner.d.ts.map +1 -0
  153. package/dist/src/utils/provider.d.ts +1 -0
  154. package/dist/src/utils/provider.d.ts.map +1 -0
  155. package/dist/src/utils/safeVersions.d.ts +1 -0
  156. package/dist/src/utils/safeVersions.d.ts.map +1 -0
  157. package/dist/src/utils/signatures/SafeSignature.d.ts +1 -0
  158. package/dist/src/utils/signatures/SafeSignature.d.ts.map +1 -0
  159. package/dist/src/utils/signatures/index.d.ts +1 -0
  160. package/dist/src/utils/signatures/index.d.ts.map +1 -0
  161. package/dist/src/utils/signatures/utils.d.ts +2 -2
  162. package/dist/src/utils/signatures/utils.d.ts.map +1 -0
  163. package/dist/src/utils/transactions/SafeTransaction.d.ts +1 -0
  164. package/dist/src/utils/transactions/SafeTransaction.d.ts.map +1 -0
  165. package/dist/src/utils/transactions/gas.d.ts +1 -0
  166. package/dist/src/utils/transactions/gas.d.ts.map +1 -0
  167. package/dist/src/utils/transactions/index.d.ts +1 -0
  168. package/dist/src/utils/transactions/index.d.ts.map +1 -0
  169. package/dist/src/utils/transactions/types.d.ts +1 -0
  170. package/dist/src/utils/transactions/types.d.ts.map +1 -0
  171. package/dist/src/utils/transactions/utils.d.ts +1 -0
  172. package/dist/src/utils/transactions/utils.d.ts.map +1 -0
  173. package/dist/src/utils/types.d.ts +1 -0
  174. package/dist/src/utils/types.d.ts.map +1 -0
  175. package/dist/test-utils/index.d.ts +3 -0
  176. package/dist/test-utils/index.d.ts.map +1 -0
  177. package/dist/test-utils/passkeys.d.ts +25 -0
  178. package/dist/test-utils/passkeys.d.ts.map +1 -0
  179. package/dist/test-utils/webauthnShim.d.ts +150 -0
  180. package/dist/test-utils/webauthnShim.d.ts.map +1 -0
  181. package/dist/tsconfig.build.tsbuildinfo +1 -1
  182. package/package.json +22 -6
  183. package/dist/src/Safe.js +0 -1409
  184. package/dist/src/Safe.js.map +0 -1
  185. package/dist/src/SafeProvider.js +0 -265
  186. package/dist/src/SafeProvider.js.map +0 -1
  187. package/dist/src/contracts/BaseContract.js +0 -163
  188. package/dist/src/contracts/BaseContract.js.map +0 -1
  189. package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.js +0 -40
  190. package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.js.map +0 -1
  191. package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.js +0 -33
  192. package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.js.map +0 -1
  193. package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.js +0 -33
  194. package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.js.map +0 -1
  195. package/dist/src/contracts/CreateCall/CreateCallBaseContract.js +0 -40
  196. package/dist/src/contracts/CreateCall/CreateCallBaseContract.js.map +0 -1
  197. package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.js +0 -56
  198. package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.js.map +0 -1
  199. package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.js +0 -56
  200. package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.js.map +0 -1
  201. package/dist/src/contracts/MultiSend/MultiSendBaseContract.js +0 -40
  202. package/dist/src/contracts/MultiSend/MultiSendBaseContract.js.map +0 -1
  203. package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.js +0 -40
  204. package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.js.map +0 -1
  205. package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.js +0 -33
  206. package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.js.map +0 -1
  207. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.js +0 -33
  208. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.js.map +0 -1
  209. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.js +0 -33
  210. package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.js.map +0 -1
  211. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.js +0 -33
  212. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.js.map +0 -1
  213. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.js +0 -33
  214. package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.js.map +0 -1
  215. package/dist/src/contracts/Safe/SafeBaseContract.js +0 -47
  216. package/dist/src/contracts/Safe/SafeBaseContract.js.map +0 -1
  217. package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.js +0 -276
  218. package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.js.map +0 -1
  219. package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.js +0 -248
  220. package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.js.map +0 -1
  221. package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.js +0 -253
  222. package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.js.map +0 -1
  223. package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.js +0 -267
  224. package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.js.map +0 -1
  225. package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.js +0 -267
  226. package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.js.map +0 -1
  227. package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.js +0 -43
  228. package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.js.map +0 -1
  229. package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.js +0 -63
  230. package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.js.map +0 -1
  231. package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.js +0 -79
  232. package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.js.map +0 -1
  233. package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.js +0 -79
  234. package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.js.map +0 -1
  235. package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.js +0 -72
  236. package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.js.map +0 -1
  237. package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.js +0 -39
  238. package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.js.map +0 -1
  239. package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.js +0 -59
  240. package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.js.map +0 -1
  241. package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.js +0 -39
  242. package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.js.map +0 -1
  243. package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.js +0 -52
  244. package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.js.map +0 -1
  245. package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.js +0 -40
  246. package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.js.map +0 -1
  247. package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.js +0 -49
  248. package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.js.map +0 -1
  249. package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.js +0 -49
  250. package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.js.map +0 -1
  251. package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.js +0 -40
  252. package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.js.map +0 -1
  253. package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.js +0 -42
  254. package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.js.map +0 -1
  255. package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.js +0 -42
  256. package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.js.map +0 -1
  257. package/dist/src/contracts/config.js +0 -130
  258. package/dist/src/contracts/config.js.map +0 -1
  259. package/dist/src/contracts/constants.js +0 -8
  260. package/dist/src/contracts/constants.js.map +0 -1
  261. package/dist/src/contracts/contractInstances.js +0 -222
  262. package/dist/src/contracts/contractInstances.js.map +0 -1
  263. package/dist/src/contracts/index.js +0 -19
  264. package/dist/src/contracts/index.js.map +0 -1
  265. package/dist/src/contracts/safeDeploymentContracts.js +0 -95
  266. package/dist/src/contracts/safeDeploymentContracts.js.map +0 -1
  267. package/dist/src/contracts/utils.js +0 -324
  268. package/dist/src/contracts/utils.js.map +0 -1
  269. package/dist/src/index.js +0 -93
  270. package/dist/src/index.js.map +0 -1
  271. package/dist/src/managers/contractManager.js +0 -90
  272. package/dist/src/managers/contractManager.js.map +0 -1
  273. package/dist/src/managers/fallbackHandlerManager.js +0 -73
  274. package/dist/src/managers/fallbackHandlerManager.js.map +0 -1
  275. package/dist/src/managers/guardManager.js +0 -73
  276. package/dist/src/managers/guardManager.js.map +0 -1
  277. package/dist/src/managers/moduleManager.js +0 -88
  278. package/dist/src/managers/moduleManager.js.map +0 -1
  279. package/dist/src/managers/ownerManager.js +0 -124
  280. package/dist/src/managers/ownerManager.js.map +0 -1
  281. package/dist/src/types/contracts.js +0 -3
  282. package/dist/src/types/contracts.js.map +0 -1
  283. package/dist/src/types/index.js +0 -23
  284. package/dist/src/types/index.js.map +0 -1
  285. package/dist/src/types/passkeys.js +0 -3
  286. package/dist/src/types/passkeys.js.map +0 -1
  287. package/dist/src/types/safeConfig.js +0 -3
  288. package/dist/src/types/safeConfig.js.map +0 -1
  289. package/dist/src/types/safeProvider.js +0 -3
  290. package/dist/src/types/safeProvider.js.map +0 -1
  291. package/dist/src/types/signing.d.ts +0 -8
  292. package/dist/src/types/signing.js +0 -12
  293. package/dist/src/types/signing.js.map +0 -1
  294. package/dist/src/types/transactions.js +0 -3
  295. package/dist/src/types/transactions.js.map +0 -1
  296. package/dist/src/utils/address.js +0 -21
  297. package/dist/src/utils/address.js.map +0 -1
  298. package/dist/src/utils/block.js +0 -14
  299. package/dist/src/utils/block.js.map +0 -1
  300. package/dist/src/utils/constants.js +0 -8
  301. package/dist/src/utils/constants.js.map +0 -1
  302. package/dist/src/utils/eip-3770/config.js +0 -371
  303. package/dist/src/utils/eip-3770/config.js.map +0 -1
  304. package/dist/src/utils/eip-3770/index.js +0 -47
  305. package/dist/src/utils/eip-3770/index.js.map +0 -1
  306. package/dist/src/utils/eip-712/encode.js +0 -127
  307. package/dist/src/utils/eip-712/encode.js.map +0 -1
  308. package/dist/src/utils/eip-712/index.js +0 -105
  309. package/dist/src/utils/eip-712/index.js.map +0 -1
  310. package/dist/src/utils/erc-20/index.js +0 -84
  311. package/dist/src/utils/erc-20/index.js.map +0 -1
  312. package/dist/src/utils/getProtocolKitVersion.js +0 -6
  313. package/dist/src/utils/getProtocolKitVersion.js.map +0 -1
  314. package/dist/src/utils/index.js +0 -24
  315. package/dist/src/utils/index.js.map +0 -1
  316. package/dist/src/utils/memoized.js +0 -41
  317. package/dist/src/utils/memoized.js.map +0 -1
  318. package/dist/src/utils/messages/SafeMessage.js +0 -20
  319. package/dist/src/utils/messages/SafeMessage.js.map +0 -1
  320. package/dist/src/utils/on-chain-tracking/generateOnChainIdentifier.js +0 -46
  321. package/dist/src/utils/on-chain-tracking/generateOnChainIdentifier.js.map +0 -1
  322. package/dist/src/utils/passkeys/PasskeyClient.js +0 -171
  323. package/dist/src/utils/passkeys/PasskeyClient.js.map +0 -1
  324. package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.js +0 -35
  325. package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.js.map +0 -1
  326. package/dist/src/utils/passkeys/extractPasskeyData.js +0 -232
  327. package/dist/src/utils/passkeys/extractPasskeyData.js.map +0 -1
  328. package/dist/src/utils/passkeys/getPasskeyOwnerAddress.js +0 -31
  329. package/dist/src/utils/passkeys/getPasskeyOwnerAddress.js.map +0 -1
  330. package/dist/src/utils/passkeys/index.js +0 -20
  331. package/dist/src/utils/passkeys/index.js.map +0 -1
  332. package/dist/src/utils/passkeys/isSharedSigner.js +0 -26
  333. package/dist/src/utils/passkeys/isSharedSigner.js.map +0 -1
  334. package/dist/src/utils/provider.js +0 -12
  335. package/dist/src/utils/provider.js.map +0 -1
  336. package/dist/src/utils/safeVersions.js +0 -54
  337. package/dist/src/utils/safeVersions.js.map +0 -1
  338. package/dist/src/utils/signatures/SafeSignature.js +0 -42
  339. package/dist/src/utils/signatures/SafeSignature.js.map +0 -1
  340. package/dist/src/utils/signatures/index.js +0 -19
  341. package/dist/src/utils/signatures/index.js.map +0 -1
  342. package/dist/src/utils/signatures/utils.js +0 -174
  343. package/dist/src/utils/signatures/utils.js.map +0 -1
  344. package/dist/src/utils/transactions/SafeTransaction.js +0 -20
  345. package/dist/src/utils/transactions/SafeTransaction.js.map +0 -1
  346. package/dist/src/utils/transactions/gas.js +0 -398
  347. package/dist/src/utils/transactions/gas.js.map +0 -1
  348. package/dist/src/utils/transactions/index.js +0 -21
  349. package/dist/src/utils/transactions/index.js.map +0 -1
  350. package/dist/src/utils/transactions/types.js +0 -3
  351. package/dist/src/utils/transactions/types.js.map +0 -1
  352. package/dist/src/utils/transactions/utils.js +0 -217
  353. package/dist/src/utils/transactions/utils.js.map +0 -1
  354. package/dist/src/utils/types.js +0 -66
  355. package/dist/src/utils/types.js.map +0 -1
@@ -0,0 +1,4118 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // test-utils/index.ts
31
+ var test_utils_exports = {};
32
+ __export(test_utils_exports, {
33
+ WebAuthnCredentials: () => WebAuthnCredentials,
34
+ base64UrlEncode: () => base64UrlEncode,
35
+ createMockPasskey: () => createMockPasskey,
36
+ deployPasskeysContract: () => deployPasskeysContract,
37
+ encodeWebAuthnSigningMessage: () => encodeWebAuthnSigningMessage,
38
+ getWebAuthnCredentials: () => getWebAuthnCredentials,
39
+ userVerificationFlag: () => userVerificationFlag
40
+ });
41
+ module.exports = __toCommonJS(test_utils_exports);
42
+
43
+ // test-utils/webauthnShim.ts
44
+ var import_p256 = require("@noble/curves/p256");
45
+ var import_ethers = require("ethers");
46
+ var import_cbor = __toESM(require("cbor"));
47
+ function base64UrlEncode(data) {
48
+ const buffer = typeof data === "string" ? Buffer.from(data.replace(/^0x/, ""), "hex") : Buffer.from(data);
49
+ return buffer.toString("base64url");
50
+ }
51
+ function userVerificationFlag(userVerification = "preferred") {
52
+ switch (userVerification) {
53
+ case "preferred":
54
+ return 1;
55
+ case "required":
56
+ return 4;
57
+ default:
58
+ throw new Error(`user verification requirement ${userVerification} not supported`);
59
+ }
60
+ }
61
+ function b2ab(buf) {
62
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
63
+ }
64
+ function isEqualArray(a, b) {
65
+ if (a.length != b.length) return false;
66
+ for (let i = 0; i < a.length; i++) if (a[i] != b[i]) return false;
67
+ return true;
68
+ }
69
+ function encodeWebAuthnSigningMessage(clientData, authenticatorData) {
70
+ return import_ethers.ethers.getBytes(
71
+ import_ethers.ethers.concat([
72
+ authenticatorData,
73
+ import_ethers.ethers.sha256(import_ethers.ethers.toUtf8Bytes(JSON.stringify(clientData)))
74
+ ])
75
+ );
76
+ }
77
+ var Credential = class {
78
+ constructor(rp, user, pk) {
79
+ this.rp = rp;
80
+ this.user = user;
81
+ this.pk = pk || import_p256.p256.utils.normPrivateKeyToScalar(import_p256.p256.utils.randomPrivateKey());
82
+ this.id = import_ethers.ethers.dataSlice(
83
+ import_ethers.ethers.keccak256(import_ethers.ethers.dataSlice(import_p256.p256.getPublicKey(this.pk, false), 1)),
84
+ 12
85
+ );
86
+ this.rawId = import_ethers.ethers.getBytes(this.id);
87
+ }
88
+ /**
89
+ * Computes the COSE encoded public key for this credential.
90
+ * See <https://datatracker.ietf.org/doc/html/rfc8152>.
91
+ *
92
+ * @returns Hex-encoded COSE-encoded public key
93
+ */
94
+ cosePublicKey() {
95
+ const pubk = import_p256.p256.getPublicKey(this.pk, false);
96
+ const x = pubk.subarray(1, 33);
97
+ const y = pubk.subarray(33, 65);
98
+ const key = /* @__PURE__ */ new Map();
99
+ key.set(-1, 1);
100
+ key.set(-2, b2ab(x));
101
+ key.set(-3, b2ab(y));
102
+ key.set(1, 2);
103
+ key.set(3, -7);
104
+ return import_ethers.ethers.hexlify(import_cbor.default.encode(key));
105
+ }
106
+ };
107
+ var WebAuthnCredentials = class {
108
+ /**
109
+ * Creates a new instance of the WebAuthn credentials.
110
+ * @param privateKey The private key to use for the credentials. If not provided, a random key will be generated.
111
+ */
112
+ constructor(privateKey) {
113
+ this.privateKey = privateKey;
114
+ this.credentials = [];
115
+ }
116
+ /**
117
+ * This is a shim for `navigator.credentials.create` method.
118
+ * See <https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-create>.
119
+ *
120
+ * @param options The public key credential creation options.
121
+ * @returns A public key credential with an attestation response.
122
+ */
123
+ create({
124
+ publicKey
125
+ }) {
126
+ if (!publicKey.pubKeyCredParams.some(({ alg }) => alg === -7)) {
127
+ throw new Error("unsupported signature algorithm(s)");
128
+ }
129
+ const credential = new Credential(publicKey.rp.id, publicKey.user.id, this.privateKey);
130
+ this.credentials.push(credential);
131
+ const clientData = {
132
+ type: "webauthn.create",
133
+ challenge: base64UrlEncode(publicKey.challenge),
134
+ origin: `https://${publicKey.rp.id}`
135
+ };
136
+ const attestationObject = {
137
+ authData: b2ab(
138
+ import_ethers.ethers.getBytes(
139
+ import_ethers.ethers.solidityPacked(
140
+ ["bytes32", "uint8", "uint32", "bytes16", "uint16", "bytes", "bytes"],
141
+ [
142
+ import_ethers.ethers.sha256(import_ethers.ethers.toUtf8Bytes(publicKey.rp.id)),
143
+ 64 + userVerificationFlag(publicKey.userVerification),
144
+ // flags = attested_data + user_present
145
+ 0,
146
+ // signCount
147
+ `0x${"42".repeat(16)}`,
148
+ // aaguid
149
+ import_ethers.ethers.dataLength(credential.id),
150
+ credential.id,
151
+ credential.cosePublicKey()
152
+ ]
153
+ )
154
+ )
155
+ ),
156
+ fmt: "none",
157
+ attStmt: {}
158
+ };
159
+ return {
160
+ id: base64UrlEncode(credential.rawId),
161
+ rawId: credential.rawId.slice(),
162
+ response: {
163
+ clientDataJSON: b2ab(import_ethers.ethers.toUtf8Bytes(JSON.stringify(clientData))),
164
+ attestationObject: b2ab(import_cbor.default.encode(attestationObject)),
165
+ getPublicKey: () => b2ab(import_p256.p256.getPublicKey(credential.pk, false))
166
+ },
167
+ type: "public-key"
168
+ };
169
+ }
170
+ /**
171
+ * This is a shim for `navigator.credentials.get` method.
172
+ * See <https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-get>.
173
+ *
174
+ * @param options The public key credential request options.
175
+ * @returns A public key credential with an assertion response.
176
+ */
177
+ get({
178
+ publicKey
179
+ }) {
180
+ const credential = publicKey.allowCredentials.flatMap(({ id }) => this.credentials.filter((c) => isEqualArray(c.rawId, id))).at(0);
181
+ if (credential === void 0) {
182
+ throw new Error("credential not found");
183
+ }
184
+ const clientData = {
185
+ type: "webauthn.get",
186
+ challenge: base64UrlEncode(publicKey.challenge),
187
+ origin: `https://${credential.rp}`
188
+ };
189
+ const authenticatorData = import_ethers.ethers.solidityPacked(
190
+ ["bytes32", "uint8", "uint32"],
191
+ [
192
+ import_ethers.ethers.sha256(import_ethers.ethers.toUtf8Bytes(credential.rp)),
193
+ userVerificationFlag(publicKey.userVerification),
194
+ // flags = user_present
195
+ 0
196
+ // signCount
197
+ ]
198
+ );
199
+ const message = encodeWebAuthnSigningMessage(clientData, authenticatorData);
200
+ const signature = import_p256.p256.sign(message, credential.pk, {
201
+ lowS: false,
202
+ prehash: true
203
+ });
204
+ return {
205
+ id: base64UrlEncode(credential.rawId),
206
+ rawId: credential.rawId.slice(),
207
+ response: {
208
+ clientDataJSON: b2ab(import_ethers.ethers.toUtf8Bytes(JSON.stringify(clientData))),
209
+ authenticatorData: b2ab(import_ethers.ethers.getBytes(authenticatorData)),
210
+ signature: b2ab(signature.toDERRawBytes(false)),
211
+ userHandle: credential.user
212
+ },
213
+ type: "public-key"
214
+ };
215
+ }
216
+ };
217
+
218
+ // test-utils/passkeys.ts
219
+ var import_viem14 = require("viem");
220
+
221
+ // src/utils/types.ts
222
+ var import_viem = require("viem");
223
+ var allChains = __toESM(require("viem/chains"));
224
+ function asHash(hash) {
225
+ return hash;
226
+ }
227
+ function asHex(hex) {
228
+ return (0, import_viem.isHex)(hex) ? hex : `0x${hex}`;
229
+ }
230
+ function getChainById(chainId) {
231
+ const chain = Object.values(allChains).find((chain2) => chain2.id === Number(chainId));
232
+ if (chain) {
233
+ return chain;
234
+ } else {
235
+ return (0, import_viem.defineChain)({
236
+ id: Number(chainId),
237
+ name: "Custom",
238
+ nativeCurrency: {
239
+ decimals: import_viem.etherUnits.wei,
240
+ name: "Ether",
241
+ symbol: "ETH"
242
+ },
243
+ rpcUrls: {
244
+ default: {
245
+ http: [],
246
+ webSocket: []
247
+ }
248
+ }
249
+ });
250
+ }
251
+ }
252
+
253
+ // src/utils/constants.ts
254
+ var import_viem2 = require("viem");
255
+ var SENTINEL_ADDRESS = "0x0000000000000000000000000000000000000001";
256
+
257
+ // src/utils/address.ts
258
+ function sameString(str1, str2) {
259
+ return !!str1 && !!str2 && str1.toLowerCase() === str2.toLowerCase();
260
+ }
261
+ function isSentinelAddress(address) {
262
+ return sameString(address, SENTINEL_ADDRESS);
263
+ }
264
+
265
+ // src/utils/eip-3770/index.ts
266
+ var import_viem3 = require("viem");
267
+
268
+ // src/utils/eip-3770/config.ts
269
+ var networks = [
270
+ { chainId: 1n, shortName: "eth" },
271
+ { chainId: 3n, shortName: "rop" },
272
+ { chainId: 4n, shortName: "rin" },
273
+ { chainId: 5n, shortName: "gor" },
274
+ { chainId: 10n, shortName: "oeth" },
275
+ { chainId: 11n, shortName: "meta" },
276
+ { chainId: 12n, shortName: "kal" },
277
+ { chainId: 14n, shortName: "flr" },
278
+ { chainId: 16n, shortName: "cflr" },
279
+ { chainId: 18n, shortName: "tst" },
280
+ { chainId: 19n, shortName: "sgb" },
281
+ { chainId: 25n, shortName: "cro" },
282
+ { chainId: 28n, shortName: "bobarinkeby" },
283
+ { chainId: 30n, shortName: "rsk" },
284
+ { chainId: 31n, shortName: "trsk" },
285
+ { chainId: 39n, shortName: "u2u" },
286
+ { chainId: 40n, shortName: "telosevm" },
287
+ { chainId: 41n, shortName: "telosevmtestnet" },
288
+ { chainId: 42n, shortName: "kov" },
289
+ { chainId: 43n, shortName: "pangolin" },
290
+ { chainId: 44n, shortName: "crab" },
291
+ { chainId: 46n, shortName: "darwinia" },
292
+ { chainId: 50n, shortName: "xdc" },
293
+ { chainId: 51n, shortName: "txdc" },
294
+ { chainId: 56n, shortName: "bnb" },
295
+ { chainId: 57n, shortName: "sys" },
296
+ { chainId: 61n, shortName: "etc" },
297
+ { chainId: 63n, shortName: "metc" },
298
+ { chainId: 69n, shortName: "okov" },
299
+ { chainId: 71n, shortName: "cfxtest" },
300
+ { chainId: 81n, shortName: "joc" },
301
+ { chainId: 82n, shortName: "meter" },
302
+ { chainId: 83n, shortName: "meter-test" },
303
+ { chainId: 88n, shortName: "vic" },
304
+ { chainId: 96n, shortName: "bkc" },
305
+ { chainId: 97n, shortName: "bnbt" },
306
+ { chainId: 100n, shortName: "gno" },
307
+ { chainId: 106n, shortName: "vlx" },
308
+ { chainId: 108n, shortName: "tt" },
309
+ { chainId: 109n, shortName: "shibariumecosystem" },
310
+ { chainId: 111n, shortName: "etl" },
311
+ { chainId: 114n, shortName: "c2flr" },
312
+ { chainId: 122n, shortName: "fuse" },
313
+ { chainId: 123n, shortName: "spark" },
314
+ { chainId: 130n, shortName: "unichain" },
315
+ { chainId: 133n, shortName: "HSKT" },
316
+ { chainId: 137n, shortName: "matic" },
317
+ { chainId: 146n, shortName: "sonic" },
318
+ { chainId: 148n, shortName: "shimmerevm" },
319
+ { chainId: 155n, shortName: "tenet-testnet" },
320
+ { chainId: 169n, shortName: "manta" },
321
+ { chainId: 177n, shortName: "hsk" },
322
+ { chainId: 179n, shortName: "abey" },
323
+ { chainId: 181n, shortName: "water" },
324
+ { chainId: 195n, shortName: "tokb" },
325
+ { chainId: 196n, shortName: "okb" },
326
+ { chainId: 204n, shortName: "opbnb" },
327
+ { chainId: 240n, shortName: "zkTCRO" },
328
+ { chainId: 246n, shortName: "ewt" },
329
+ { chainId: 250n, shortName: "ftm" },
330
+ { chainId: 252n, shortName: "fraxtal" },
331
+ { chainId: 255n, shortName: "kroma" },
332
+ { chainId: 274n, shortName: "lachain" },
333
+ { chainId: 280n, shortName: "zksync-goerli" },
334
+ { chainId: 282n, shortName: "zkTCRO" },
335
+ { chainId: 288n, shortName: "boba" },
336
+ { chainId: 291n, shortName: "orderly" },
337
+ { chainId: 300n, shortName: "zksync-sepolia" },
338
+ { chainId: 314n, shortName: "filecoin" },
339
+ { chainId: 321n, shortName: "kcs" },
340
+ { chainId: 322n, shortName: "kcst" },
341
+ { chainId: 324n, shortName: "zksync" },
342
+ { chainId: 336n, shortName: "sdn" },
343
+ { chainId: 338n, shortName: "tcro" },
344
+ { chainId: 360n, shortName: "shape" },
345
+ { chainId: 369n, shortName: "pls" },
346
+ { chainId: 388n, shortName: "zkCRO" },
347
+ { chainId: 418n, shortName: "latestnet" },
348
+ { chainId: 420n, shortName: "ogor" },
349
+ { chainId: 424n, shortName: "PGN" },
350
+ { chainId: 466n, shortName: "appchain" },
351
+ { chainId: 478n, shortName: "formnetwork" },
352
+ { chainId: 480n, shortName: "wc" },
353
+ { chainId: 530n, shortName: "FxCore" },
354
+ { chainId: 570n, shortName: "sys-rollux" },
355
+ { chainId: 588n, shortName: "metis-stardust" },
356
+ { chainId: 592n, shortName: "astr" },
357
+ { chainId: 595n, shortName: "maca" },
358
+ { chainId: 599n, shortName: "metis-goerli" },
359
+ { chainId: 648n, shortName: "ace" },
360
+ { chainId: 686n, shortName: "kar" },
361
+ { chainId: 690n, shortName: "redstone" },
362
+ { chainId: 787n, shortName: "aca" },
363
+ { chainId: 919n, shortName: "modesep" },
364
+ { chainId: 938n, shortName: "haust" },
365
+ { chainId: 943n, shortName: "t4pls" },
366
+ { chainId: 970n, shortName: "ccn" },
367
+ { chainId: 995n, shortName: "5ire" },
368
+ { chainId: 1001n, shortName: "baobab" },
369
+ { chainId: 1008n, shortName: "eun" },
370
+ { chainId: 1030n, shortName: "cfx" },
371
+ { chainId: 1088n, shortName: "metis-andromeda" },
372
+ { chainId: 1101n, shortName: "zkevm" },
373
+ { chainId: 1111n, shortName: "wemix" },
374
+ { chainId: 1112n, shortName: "twemix" },
375
+ { chainId: 1114n, shortName: "tcore2" },
376
+ { chainId: 1115n, shortName: "tcore" },
377
+ { chainId: 1116n, shortName: "core" },
378
+ { chainId: 1125n, shortName: "taker" },
379
+ { chainId: 1135n, shortName: "lisk" },
380
+ { chainId: 1230n, shortName: "UltronTestnet" },
381
+ { chainId: 1231n, shortName: "UltronMainnet" },
382
+ { chainId: 1284n, shortName: "mbeam" },
383
+ { chainId: 1285n, shortName: "mriver" },
384
+ { chainId: 1287n, shortName: "mbase" },
385
+ { chainId: 1294n, shortName: "bobabeam" },
386
+ { chainId: 1329n, shortName: "sei" },
387
+ { chainId: 1337n, shortName: "geth" },
388
+ { chainId: 1442n, shortName: "testnet-zkEVM-mango" },
389
+ { chainId: 1513n, shortName: "Story" },
390
+ { chainId: 1516n, shortName: "story-testnet" },
391
+ { chainId: 1559n, shortName: "tenet" },
392
+ { chainId: 1625n, shortName: "gravity" },
393
+ { chainId: 1663n, shortName: "Gobi" },
394
+ { chainId: 1729n, shortName: "reya" },
395
+ { chainId: 1750n, shortName: "metall2" },
396
+ { chainId: 1807n, shortName: "rana" },
397
+ { chainId: 1811n, shortName: "lif3-testnet" },
398
+ { chainId: 1890n, shortName: "lightlink_phoenix" },
399
+ { chainId: 1891n, shortName: "lightlink_pegasus" },
400
+ { chainId: 1923n, shortName: "swell-l2" },
401
+ { chainId: 1924n, shortName: "swell-l2-testnet" },
402
+ { chainId: 1984n, shortName: "euntest" },
403
+ { chainId: 1998n, shortName: "kyoto-testnet" },
404
+ { chainId: 2000n, shortName: "dc" },
405
+ { chainId: 2001n, shortName: "milkada" },
406
+ { chainId: 2002n, shortName: "milkalgo" },
407
+ { chainId: 2008n, shortName: "cloudwalk_testnet" },
408
+ { chainId: 2019n, shortName: "pmint_test" },
409
+ { chainId: 2020n, shortName: "pmint" },
410
+ { chainId: 2021n, shortName: "edg" },
411
+ { chainId: 2039n, shortName: "aleph" },
412
+ { chainId: 2187n, shortName: "g7" },
413
+ { chainId: 2192n, shortName: "snax" },
414
+ { chainId: 2221n, shortName: "tkava" },
415
+ { chainId: 2222n, shortName: "kava" },
416
+ { chainId: 2331n, shortName: "rss3-testnet" },
417
+ { chainId: 2358n, shortName: "kroma-sepolia" },
418
+ { chainId: 2442n, shortName: "zkevm-testnet-cardona" },
419
+ { chainId: 2810n, shortName: "hmorph" },
420
+ { chainId: 2818n, shortName: "morph" },
421
+ { chainId: 3338n, shortName: "PEAQ" },
422
+ { chainId: 3501n, shortName: "JFIN" },
423
+ { chainId: 3636n, shortName: "BTNX" },
424
+ { chainId: 3737n, shortName: "csb" },
425
+ { chainId: 3776n, shortName: "astrzk" },
426
+ { chainId: 4002n, shortName: "tftm" },
427
+ { chainId: 4061n, shortName: "Nahmii3Mainnet" },
428
+ { chainId: 4062n, shortName: "Nahmii3Testnet" },
429
+ { chainId: 4078n, shortName: "muster" },
430
+ { chainId: 4157n, shortName: "crossfi-testnet" },
431
+ { chainId: 4162n, shortName: "SXR" },
432
+ { chainId: 4202n, shortName: "lisksep" },
433
+ { chainId: 4337n, shortName: "beam" },
434
+ { chainId: 4460n, shortName: "orderlyl2" },
435
+ { chainId: 4653n, shortName: "gold" },
436
+ { chainId: 4661n, shortName: "appchaintestnet" },
437
+ { chainId: 4689n, shortName: "iotex-mainnet" },
438
+ { chainId: 4918n, shortName: "txvm" },
439
+ { chainId: 4919n, shortName: "xvm" },
440
+ { chainId: 5000n, shortName: "mantle" },
441
+ { chainId: 5001n, shortName: "mantle-testnet" },
442
+ { chainId: 5003n, shortName: "mnt-sep" },
443
+ { chainId: 5115n, shortName: "citrea-testnet" },
444
+ { chainId: 5165n, shortName: "ftn" },
445
+ { chainId: 5611n, shortName: "obnbt" },
446
+ { chainId: 5700n, shortName: "tsys" },
447
+ { chainId: 6001n, shortName: "bouncebit-mainnet" },
448
+ { chainId: 6102n, shortName: "cascadia" },
449
+ { chainId: 6321n, shortName: "eaura" },
450
+ { chainId: 6322n, shortName: "aura" },
451
+ { chainId: 6398n, shortName: "connext-sepolia" },
452
+ { chainId: 6688n, shortName: "iris" },
453
+ { chainId: 7000n, shortName: "zetachain-mainnet" },
454
+ { chainId: 7001n, shortName: "zetachain-testnet" },
455
+ { chainId: 7171n, shortName: "bitrock" },
456
+ { chainId: 7200n, shortName: "xsat" },
457
+ { chainId: 7332n, shortName: "EON" },
458
+ { chainId: 7341n, shortName: "shyft" },
459
+ { chainId: 7560n, shortName: "cyeth" },
460
+ { chainId: 7700n, shortName: "canto" },
461
+ { chainId: 7771n, shortName: "tbitrock" },
462
+ { chainId: 8192n, shortName: "tqf" },
463
+ { chainId: 8194n, shortName: "ttqf" },
464
+ { chainId: 8217n, shortName: "cypress" },
465
+ { chainId: 8329n, shortName: "lrz" },
466
+ { chainId: 8453n, shortName: "base" },
467
+ { chainId: 8822n, shortName: "iotaevm" },
468
+ { chainId: 9000n, shortName: "evmos-testnet" },
469
+ { chainId: 9001n, shortName: "evmos" },
470
+ { chainId: 9700n, shortName: "MainnetDev" },
471
+ { chainId: 9728n, shortName: "boba-testnet" },
472
+ { chainId: 10000n, shortName: "smartbch" },
473
+ { chainId: 10001n, shortName: "smartbchtest" },
474
+ { chainId: 10081n, shortName: "joct" },
475
+ { chainId: 10200n, shortName: "chi" },
476
+ { chainId: 10242n, shortName: "aa" },
477
+ { chainId: 10243n, shortName: "aat" },
478
+ { chainId: 10849n, shortName: "lamina1" },
479
+ { chainId: 11011n, shortName: "shapesep" },
480
+ { chainId: 11111n, shortName: "WAGMI" },
481
+ { chainId: 11235n, shortName: "islm" },
482
+ { chainId: 11437n, shortName: "shyftt" },
483
+ { chainId: 11501n, shortName: "bevm" },
484
+ { chainId: 11503n, shortName: "bevm-test" },
485
+ { chainId: 11820n, shortName: "artela-mainnet" },
486
+ { chainId: 11891n, shortName: "Arianee" },
487
+ { chainId: 12324n, shortName: "l3x" },
488
+ { chainId: 12325n, shortName: "l3x-testnet" },
489
+ { chainId: 12357n, shortName: "rei-testnet" },
490
+ { chainId: 12553n, shortName: "rss3" },
491
+ { chainId: 13337n, shortName: "beam-testnet" },
492
+ { chainId: 13371n, shortName: "imx" },
493
+ { chainId: 13473n, shortName: "imx-testnet" },
494
+ { chainId: 13746n, shortName: "g7t" },
495
+ { chainId: 14800n, shortName: "vana-moksha" },
496
+ { chainId: 17000n, shortName: "holesky" },
497
+ { chainId: 17069n, shortName: "garnet" },
498
+ { chainId: 17172n, shortName: "eclipse" },
499
+ { chainId: 18231n, shortName: "unreal-old" },
500
+ { chainId: 18233n, shortName: "unreal" },
501
+ { chainId: 22776n, shortName: "mapo" },
502
+ { chainId: 23294n, shortName: "sapphire" },
503
+ { chainId: 23295n, shortName: "sapphire-testnet" },
504
+ { chainId: 25327n, shortName: "Everclear" },
505
+ { chainId: 28979n, shortName: "kimbonet-testnet" },
506
+ { chainId: 31611n, shortName: "mezo" },
507
+ { chainId: 32769n, shortName: "zil" },
508
+ { chainId: 33101n, shortName: "zil-testnet" },
509
+ { chainId: 33139n, shortName: "apechain" },
510
+ { chainId: 33401n, shortName: "slingshot" },
511
+ { chainId: 34443n, shortName: "mode" },
512
+ { chainId: 35441n, shortName: "q" },
513
+ { chainId: 35443n, shortName: "q-testnet" },
514
+ { chainId: 37111n, shortName: "lens-sepolia" },
515
+ { chainId: 41455n, shortName: "aleph-zero" },
516
+ { chainId: 42161n, shortName: "arb1" },
517
+ { chainId: 42170n, shortName: "arb-nova" },
518
+ { chainId: 42220n, shortName: "celo" },
519
+ { chainId: 42421n, shortName: "rwa" },
520
+ { chainId: 42793n, shortName: "etlk" },
521
+ { chainId: 43111n, shortName: "hemi" },
522
+ { chainId: 43113n, shortName: "fuji" },
523
+ { chainId: 43114n, shortName: "avax" },
524
+ { chainId: 43288n, shortName: "boba-avax" },
525
+ { chainId: 44787n, shortName: "alfa" },
526
+ { chainId: 45000n, shortName: "autobahnnetwork" },
527
+ { chainId: 47763n, shortName: "neox-mainnet" },
528
+ { chainId: 47805n, shortName: "rei" },
529
+ { chainId: 48899n, shortName: "zircuit-testnet" },
530
+ { chainId: 48900n, shortName: "zircuit-mainnet" },
531
+ { chainId: 53457n, shortName: "dodochain" },
532
+ { chainId: 54211n, shortName: "islmt" },
533
+ { chainId: 56288n, shortName: "boba-bnb" },
534
+ { chainId: 57000n, shortName: "tsys-rollux" },
535
+ { chainId: 57054n, shortName: "blaze" },
536
+ { chainId: 57073n, shortName: "ink" },
537
+ { chainId: 58008n, shortName: "sepPGN" },
538
+ { chainId: 59140n, shortName: "linea-goerli" },
539
+ { chainId: 59141n, shortName: "linea-sepolia" },
540
+ { chainId: 59144n, shortName: "linea" },
541
+ { chainId: 60808n, shortName: "bob" },
542
+ { chainId: 61166n, shortName: "treasure" },
543
+ { chainId: 71401n, shortName: "gw-testnet-v1" },
544
+ { chainId: 71402n, shortName: "gw-mainnet-v1" },
545
+ { chainId: 73799n, shortName: "vt" },
546
+ { chainId: 80001n, shortName: "maticmum" },
547
+ { chainId: 80002n, shortName: "polygonamoy" },
548
+ { chainId: 80084n, shortName: "berachainbArtio" },
549
+ { chainId: 80085n, shortName: "berachainArtio" },
550
+ { chainId: 80094n, shortName: "berachain" },
551
+ { chainId: 81457n, shortName: "blastmainnet" },
552
+ { chainId: 83291n, shortName: "lrz-testnet" },
553
+ { chainId: 84531n, shortName: "basegor" },
554
+ { chainId: 84532n, shortName: "basesep" },
555
+ { chainId: 90001n, shortName: "dhobyghaut" },
556
+ { chainId: 97435n, shortName: "sling" },
557
+ { chainId: 98864n, shortName: "plume-devnet" },
558
+ { chainId: 98865n, shortName: "plume" },
559
+ { chainId: 103454n, shortName: "masatest" },
560
+ { chainId: 105105n, shortName: "stratis" },
561
+ { chainId: 111188n, shortName: "re-al" },
562
+ { chainId: 128123n, shortName: "etlt" },
563
+ { chainId: 167000n, shortName: "tko-mainnet" },
564
+ { chainId: 167008n, shortName: "tko-katla" },
565
+ { chainId: 167009n, shortName: "tko-hekla" },
566
+ { chainId: 175188n, shortName: "lpy" },
567
+ { chainId: 200101n, shortName: "milktada" },
568
+ { chainId: 200202n, shortName: "milktalgo" },
569
+ { chainId: 200810n, shortName: "btrt" },
570
+ { chainId: 205205n, shortName: "auroria" },
571
+ { chainId: 314159n, shortName: "filecoin-calibration" },
572
+ { chainId: 328527n, shortName: "nal" },
573
+ { chainId: 333999n, shortName: "olympus" },
574
+ { chainId: 381931n, shortName: "metal" },
575
+ { chainId: 421611n, shortName: "arb-rinkeby" },
576
+ { chainId: 421613n, shortName: "arb-goerli" },
577
+ { chainId: 421614n, shortName: "arb-sep" },
578
+ { chainId: 444444n, shortName: "syndr" },
579
+ { chainId: 490000n, shortName: "ATN" },
580
+ { chainId: 534351n, shortName: "scr-sepolia" },
581
+ { chainId: 534352n, shortName: "scr" },
582
+ { chainId: 534353n, shortName: "scr-alpha" },
583
+ { chainId: 543210n, shortName: "zero-network" },
584
+ { chainId: 555666n, shortName: "eclipset" },
585
+ { chainId: 622277n, shortName: "rth" },
586
+ { chainId: 656476n, shortName: "open-campus-codex" },
587
+ { chainId: 660279n, shortName: "xai" },
588
+ { chainId: 668668n, shortName: "cnw" },
589
+ { chainId: 713715n, shortName: "sei-devnet" },
590
+ { chainId: 743111n, shortName: "hemi-sep" },
591
+ { chainId: 763373n, shortName: "inksepolia" },
592
+ { chainId: 764984n, shortName: "lamina1test" },
593
+ { chainId: 808813n, shortName: "bob-sepolia" },
594
+ { chainId: 810180n, shortName: "zklink-nova" },
595
+ { chainId: 839999n, shortName: "txsat" },
596
+ { chainId: 978657n, shortName: "treasure-ruby" },
597
+ { chainId: 984122n, shortName: "forma" },
598
+ { chainId: 1501869n, shortName: "water9" },
599
+ { chainId: 3441006n, shortName: "mantaSepoliaTestnet" },
600
+ { chainId: 4457845n, shortName: "zero-sepolia" },
601
+ { chainId: 6038361n, shortName: "azkyt" },
602
+ { chainId: 7225878n, shortName: "saakuru" },
603
+ { chainId: 7777777n, shortName: "zora" },
604
+ { chainId: 9999999n, shortName: "fluence" },
605
+ { chainId: 11155111n, shortName: "sep" },
606
+ { chainId: 11155420n, shortName: "opsep" },
607
+ { chainId: 12227332n, shortName: "neox-t4" },
608
+ { chainId: 52164803n, shortName: "fluence-testnet" },
609
+ { chainId: 94204209n, shortName: "polygon-blackberry" },
610
+ { chainId: 111557560n, shortName: "cysep" },
611
+ { chainId: 123420111n, shortName: "opcelestia-raspberry" },
612
+ { chainId: 161221135n, shortName: "plume-testnet" },
613
+ { chainId: 168587773n, shortName: "blastsepolia" },
614
+ { chainId: 222000222n, shortName: "kanazawa" },
615
+ { chainId: 245022926n, shortName: "neonevm-devnet" },
616
+ { chainId: 245022934n, shortName: "neonevm-mainnet" },
617
+ { chainId: 253368190n, shortName: "flame" },
618
+ { chainId: 328527624n, shortName: "nalsep" },
619
+ { chainId: 333000333n, shortName: "meld" },
620
+ { chainId: 476462898n, shortName: "Skopje" },
621
+ { chainId: 666666666n, shortName: "degen-chain" },
622
+ { chainId: 888888888n, shortName: "ancient8" },
623
+ { chainId: 999999999n, shortName: "zsep" },
624
+ { chainId: 1313161554n, shortName: "aurora" },
625
+ { chainId: 1313161555n, shortName: "aurora-testnet" },
626
+ { chainId: 1511670449n, shortName: "GPT" },
627
+ { chainId: 1570754601n, shortName: "hst-test" },
628
+ { chainId: 1666600000n, shortName: "hmy-s0" },
629
+ { chainId: 1666700000n, shortName: "hmy-b-s0" },
630
+ { chainId: 11297108099n, shortName: "tpalm" },
631
+ { chainId: 11297108109n, shortName: "palm" },
632
+ { chainId: 37714555429n, shortName: "xaitestnet" },
633
+ { chainId: 88153591557n, shortName: "arb-blueberry" },
634
+ { chainId: 123420000220n, shortName: "fluence-stage" },
635
+ { chainId: 920637907288165n, shortName: "kkrt-starknet-sepolia" }
636
+ ];
637
+ if (process.env.TEST_NETWORK === "hardhat") {
638
+ networks.push({ shortName: "local", chainId: 31337n });
639
+ }
640
+
641
+ // src/utils/eip-3770/index.ts
642
+ function parseEip3770Address(fullAddress) {
643
+ const parts = fullAddress.split(":");
644
+ const address = parts.length > 1 ? parts[1] : parts[0];
645
+ const prefix = parts.length > 1 ? parts[0] : "";
646
+ return { prefix, address };
647
+ }
648
+ function getEip3770NetworkPrefixFromChainId(chainId) {
649
+ const network = networks.find((network2) => chainId === network2.chainId);
650
+ if (!network) {
651
+ throw new Error("No network prefix supported for the current chainId");
652
+ }
653
+ return network.shortName;
654
+ }
655
+ function isValidEip3770NetworkPrefix(prefix) {
656
+ return networks.some(({ shortName }) => shortName === prefix);
657
+ }
658
+ function validateEip3770NetworkPrefix(prefix, currentChainId) {
659
+ const isCurrentNetworkPrefix = prefix === getEip3770NetworkPrefixFromChainId(currentChainId);
660
+ if (!isValidEip3770NetworkPrefix(prefix) || !isCurrentNetworkPrefix) {
661
+ throw new Error("The network prefix must match the current network");
662
+ }
663
+ }
664
+ function validateEthereumAddress(address) {
665
+ if (!(0, import_viem3.isAddress)(address)) {
666
+ throw new Error(`Invalid Ethereum address ${address}`);
667
+ }
668
+ }
669
+ function validateEip3770Address(fullAddress, currentChainId) {
670
+ const { address, prefix } = parseEip3770Address(fullAddress);
671
+ validateEthereumAddress(address);
672
+ if (prefix) {
673
+ validateEip3770NetworkPrefix(prefix, currentChainId);
674
+ }
675
+ return { address, prefix };
676
+ }
677
+
678
+ // src/utils/eip-712/index.ts
679
+ var import_viem5 = require("viem");
680
+ var import_satisfies = __toESM(require("semver/functions/satisfies.js"));
681
+
682
+ // src/utils/eip-712/encode.ts
683
+ var import_viem4 = require("viem");
684
+ function encodeField({
685
+ types,
686
+ name,
687
+ type,
688
+ value
689
+ }) {
690
+ if (types[type] !== void 0) {
691
+ return [{ type: "bytes32" }, (0, import_viem4.keccak256)(encodeData({ data: value, primaryType: type, types }))];
692
+ }
693
+ if (type === "bytes") {
694
+ const prepend = value.length % 2 ? "0" : "";
695
+ value = `0x${prepend + value.slice(2)}`;
696
+ return [{ type: "bytes32" }, (0, import_viem4.keccak256)(value)];
697
+ }
698
+ if (type === "string") return [{ type: "bytes32" }, (0, import_viem4.keccak256)((0, import_viem4.toHex)(value))];
699
+ if (type.lastIndexOf("]") === type.length - 1) {
700
+ const parsedType = type.slice(0, type.lastIndexOf("["));
701
+ const typeValuePairs = value.map(
702
+ (item) => encodeField({
703
+ name,
704
+ type: parsedType,
705
+ types,
706
+ value: item
707
+ })
708
+ );
709
+ return [
710
+ { type: "bytes32" },
711
+ (0, import_viem4.keccak256)(
712
+ (0, import_viem4.encodeAbiParameters)(
713
+ typeValuePairs.map(([t]) => t),
714
+ typeValuePairs.map(([, v]) => v)
715
+ )
716
+ )
717
+ ];
718
+ }
719
+ return [{ type }, value];
720
+ }
721
+ function findTypeDependencies({
722
+ primaryType: primaryType_,
723
+ types
724
+ }, results = /* @__PURE__ */ new Set()) {
725
+ const match = primaryType_.match(/^\w*/u);
726
+ const primaryType = match?.[0] || "";
727
+ if (results.has(primaryType) || types[primaryType] === void 0) {
728
+ return results;
729
+ }
730
+ results.add(primaryType);
731
+ for (const field of types[primaryType]) {
732
+ findTypeDependencies({ primaryType: field.type, types }, results);
733
+ }
734
+ return results;
735
+ }
736
+ function encodeType({
737
+ primaryType,
738
+ types
739
+ }) {
740
+ let result = "";
741
+ const unsortedDeps = findTypeDependencies({ primaryType, types });
742
+ unsortedDeps.delete(primaryType);
743
+ const deps = [primaryType, ...Array.from(unsortedDeps).sort()];
744
+ for (const type of deps) {
745
+ result += `${type}(${types[type].map(({ name, type: t }) => `${t} ${name}`).join(",")})`;
746
+ }
747
+ return result;
748
+ }
749
+ function hashType({
750
+ primaryType,
751
+ types
752
+ }) {
753
+ const encodedHashType = (0, import_viem4.toHex)(encodeType({ primaryType, types }));
754
+ return (0, import_viem4.keccak256)(encodedHashType);
755
+ }
756
+ function encodeData({
757
+ data,
758
+ primaryType,
759
+ types
760
+ }) {
761
+ const encodedTypes = [{ type: "bytes32" }];
762
+ const encodedValues = [hashType({ primaryType, types })];
763
+ for (const field of types[primaryType]) {
764
+ const [type, value] = encodeField({
765
+ types,
766
+ name: field.name,
767
+ type: field.type,
768
+ value: data[field.name]
769
+ });
770
+ encodedTypes.push(type);
771
+ encodedValues.push(value);
772
+ }
773
+ return (0, import_viem4.encodeAbiParameters)(encodedTypes, encodedValues);
774
+ }
775
+ function hashStruct({
776
+ data,
777
+ primaryType,
778
+ types
779
+ }) {
780
+ const encoded = encodeData({
781
+ data,
782
+ primaryType,
783
+ types
784
+ });
785
+ return (0, import_viem4.keccak256)(encoded);
786
+ }
787
+ function deducePrimaryType(types) {
788
+ return Object.keys(types)[0];
789
+ }
790
+ function hashTypedData(typedData) {
791
+ const data = encodeTypedData(typedData);
792
+ return (0, import_viem4.keccak256)(asHex(data));
793
+ }
794
+ function encodeTypedData(typedData) {
795
+ typedData.primaryType = !typedData?.primaryType ? deducePrimaryType(typedData.types) : typedData?.primaryType;
796
+ const { domain = {}, message, primaryType } = typedData;
797
+ const types = {
798
+ EIP712Domain: (0, import_viem4.getTypesForEIP712Domain)({ domain }),
799
+ ...typedData.types
800
+ };
801
+ (0, import_viem4.validateTypedData)({
802
+ domain,
803
+ message,
804
+ primaryType,
805
+ types
806
+ });
807
+ const parts = ["0x1901"];
808
+ if (domain)
809
+ parts.push(
810
+ (0, import_viem4.hashDomain)({
811
+ domain,
812
+ types
813
+ })
814
+ );
815
+ if (primaryType !== "EIP712Domain")
816
+ parts.push(
817
+ hashStruct({
818
+ data: message,
819
+ primaryType,
820
+ types
821
+ })
822
+ );
823
+ return (0, import_viem4.concat)(parts);
824
+ }
825
+
826
+ // src/utils/eip-712/index.ts
827
+ var EQ_OR_GT_1_3_0 = ">=1.3.0";
828
+ var EIP712_DOMAIN_BEFORE_V130 = [
829
+ {
830
+ type: "address",
831
+ name: "verifyingContract"
832
+ }
833
+ ];
834
+ var EIP712_DOMAIN = [
835
+ {
836
+ type: "uint256",
837
+ name: "chainId"
838
+ },
839
+ {
840
+ type: "address",
841
+ name: "verifyingContract"
842
+ }
843
+ ];
844
+ function getEip712TxTypes(safeVersion) {
845
+ const eip712WithChainId = (0, import_satisfies.default)(safeVersion, EQ_OR_GT_1_3_0);
846
+ return {
847
+ EIP712Domain: eip712WithChainId ? EIP712_DOMAIN : EIP712_DOMAIN_BEFORE_V130,
848
+ SafeTx: [
849
+ { type: "address", name: "to" },
850
+ { type: "uint256", name: "value" },
851
+ { type: "bytes", name: "data" },
852
+ { type: "uint8", name: "operation" },
853
+ { type: "uint256", name: "safeTxGas" },
854
+ { type: "uint256", name: "baseGas" },
855
+ { type: "uint256", name: "gasPrice" },
856
+ { type: "address", name: "gasToken" },
857
+ { type: "address", name: "refundReceiver" },
858
+ { type: "uint256", name: "nonce" }
859
+ ]
860
+ };
861
+ }
862
+ function getEip712MessageTypes(safeVersion) {
863
+ const eip712WithChainId = (0, import_satisfies.default)(safeVersion, EQ_OR_GT_1_3_0);
864
+ return {
865
+ EIP712Domain: eip712WithChainId ? EIP712_DOMAIN : EIP712_DOMAIN_BEFORE_V130,
866
+ SafeMessage: [{ type: "bytes", name: "message" }]
867
+ };
868
+ }
869
+ var hashTypedData2 = (typedData) => {
870
+ return hashTypedData(typedData);
871
+ };
872
+ var hashMessage = (message) => {
873
+ return (0, import_viem5.hashMessage)(message);
874
+ };
875
+ var hashSafeMessage = (message) => {
876
+ return typeof message === "string" ? hashMessage(message) : hashTypedData2(message);
877
+ };
878
+ function generateTypedData({
879
+ safeAddress,
880
+ safeVersion,
881
+ chainId,
882
+ data
883
+ }) {
884
+ const isSafeTransactionDataType = data.hasOwnProperty("to");
885
+ const eip712WithChainId = (0, import_satisfies.default)(safeVersion, EQ_OR_GT_1_3_0);
886
+ let typedData;
887
+ if (isSafeTransactionDataType) {
888
+ const txData = data;
889
+ typedData = {
890
+ types: getEip712TxTypes(safeVersion),
891
+ domain: {
892
+ verifyingContract: safeAddress
893
+ },
894
+ primaryType: "SafeTx",
895
+ message: {
896
+ ...txData,
897
+ value: txData.value,
898
+ safeTxGas: txData.safeTxGas,
899
+ baseGas: txData.baseGas,
900
+ gasPrice: txData.gasPrice,
901
+ nonce: txData.nonce
902
+ }
903
+ };
904
+ } else {
905
+ const message = data;
906
+ typedData = {
907
+ types: getEip712MessageTypes(safeVersion),
908
+ domain: {
909
+ verifyingContract: safeAddress
910
+ },
911
+ primaryType: "SafeMessage",
912
+ message: { message: hashSafeMessage(message) }
913
+ };
914
+ }
915
+ if (eip712WithChainId) {
916
+ typedData.domain.chainId = Number(chainId);
917
+ }
918
+ return typedData;
919
+ }
920
+
921
+ // src/utils/safeVersions.ts
922
+ var import_satisfies2 = __toESM(require("semver/functions/satisfies.js"));
923
+ var SAFE_FEATURES_BY_VERSION = {
924
+ ["SAFE_TX_GAS_OPTIONAL" /* SAFE_TX_GAS_OPTIONAL */]: ">=1.3.0",
925
+ ["SAFE_TX_GUARDS" /* SAFE_TX_GUARDS */]: ">=1.3.0",
926
+ ["SAFE_FALLBACK_HANDLER" /* SAFE_FALLBACK_HANDLER */]: ">=1.1.1",
927
+ ["ETH_SIGN" /* ETH_SIGN */]: ">=1.1.0",
928
+ ["ACCOUNT_ABSTRACTION" /* ACCOUNT_ABSTRACTION */]: ">=1.3.0",
929
+ ["REQUIRED_TXGAS" /* REQUIRED_TXGAS */]: "<=1.2.0",
930
+ ["SIMULATE_AND_REVERT" /* SIMULATE_AND_REVERT */]: ">=1.3.0",
931
+ ["PASSKEY_SIGNER" /* PASSKEY_SIGNER */]: ">=1.3.0",
932
+ ["SAFE_L2_CONTRACTS" /* SAFE_L2_CONTRACTS */]: ">=1.3.0"
933
+ };
934
+ var hasSafeFeature = (feature, version) => {
935
+ if (!(feature in SAFE_FEATURES_BY_VERSION)) {
936
+ return false;
937
+ }
938
+ return (0, import_satisfies2.default)(version, SAFE_FEATURES_BY_VERSION[feature]);
939
+ };
940
+
941
+ // src/utils/signatures/utils.ts
942
+ var import_viem6 = require("viem");
943
+ var import_types_kit = require("@safe-global/types-kit");
944
+ var import_satisfies3 = __toESM(require("semver/functions/satisfies.js"));
945
+
946
+ // src/utils/transactions/gas.ts
947
+ var import_viem12 = require("viem");
948
+ var import_types_kit26 = require("@safe-global/types-kit");
949
+ var import_satisfies5 = __toESM(require("semver/functions/satisfies.js"));
950
+
951
+ // src/contracts/BaseContract.ts
952
+ var import_viem7 = require("viem");
953
+ var import_actions = require("viem/actions");
954
+
955
+ // src/contracts/config.ts
956
+ var import_safe_deployments = require("@safe-global/safe-deployments");
957
+ var import_safe_modules_deployments = require("@safe-global/safe-modules-deployments");
958
+ var DEFAULT_SAFE_VERSION = "1.3.0";
959
+ var safeDeploymentsVersions = {
960
+ "1.4.1": {
961
+ safeSingletonVersion: "1.4.1",
962
+ safeSingletonL2Version: "1.4.1",
963
+ safeProxyFactoryVersion: "1.4.1",
964
+ compatibilityFallbackHandler: "1.4.1",
965
+ multiSendVersion: "1.4.1",
966
+ multiSendCallOnlyVersion: "1.4.1",
967
+ signMessageLibVersion: "1.4.1",
968
+ createCallVersion: "1.4.1",
969
+ simulateTxAccessorVersion: "1.4.1",
970
+ safeWebAuthnSignerFactoryVersion: "0.2.1",
971
+ safeWebAuthnSharedSignerVersion: "0.2.1"
972
+ },
973
+ "1.3.0": {
974
+ safeSingletonVersion: "1.3.0",
975
+ safeSingletonL2Version: "1.3.0",
976
+ safeProxyFactoryVersion: "1.3.0",
977
+ compatibilityFallbackHandler: "1.3.0",
978
+ multiSendVersion: "1.3.0",
979
+ multiSendCallOnlyVersion: "1.3.0",
980
+ signMessageLibVersion: "1.3.0",
981
+ createCallVersion: "1.3.0",
982
+ simulateTxAccessorVersion: "1.3.0",
983
+ safeWebAuthnSignerFactoryVersion: "0.2.1",
984
+ safeWebAuthnSharedSignerVersion: "0.2.1"
985
+ },
986
+ "1.2.0": {
987
+ safeSingletonVersion: "1.2.0",
988
+ safeSingletonL2Version: void 0,
989
+ safeProxyFactoryVersion: "1.1.1",
990
+ compatibilityFallbackHandler: "1.3.0",
991
+ multiSendVersion: "1.1.1",
992
+ multiSendCallOnlyVersion: "1.3.0",
993
+ signMessageLibVersion: "1.3.0",
994
+ createCallVersion: "1.3.0",
995
+ safeWebAuthnSignerFactoryVersion: void 0,
996
+ safeWebAuthnSharedSignerVersion: void 0
997
+ },
998
+ "1.1.1": {
999
+ safeSingletonVersion: "1.1.1",
1000
+ safeSingletonL2Version: void 0,
1001
+ safeProxyFactoryVersion: "1.1.1",
1002
+ compatibilityFallbackHandler: "1.3.0",
1003
+ multiSendVersion: "1.1.1",
1004
+ multiSendCallOnlyVersion: "1.3.0",
1005
+ signMessageLibVersion: "1.3.0",
1006
+ createCallVersion: "1.3.0",
1007
+ safeWebAuthnSignerFactoryVersion: void 0,
1008
+ safeWebAuthnSharedSignerVersion: void 0
1009
+ },
1010
+ "1.0.0": {
1011
+ safeSingletonVersion: "1.0.0",
1012
+ safeSingletonL2Version: void 0,
1013
+ safeProxyFactoryVersion: "1.0.0",
1014
+ compatibilityFallbackHandler: "1.3.0",
1015
+ multiSendVersion: "1.1.1",
1016
+ multiSendCallOnlyVersion: "1.3.0",
1017
+ signMessageLibVersion: "1.3.0",
1018
+ createCallVersion: "1.3.0",
1019
+ safeWebAuthnSignerFactoryVersion: void 0,
1020
+ safeWebAuthnSharedSignerVersion: void 0
1021
+ }
1022
+ };
1023
+ var safeDeploymentsL1ChainIds = [
1024
+ 1n
1025
+ // Ethereum Mainnet
1026
+ ];
1027
+ var contractFunctions = {
1028
+ safeSingletonVersion: import_safe_deployments.getSafeSingletonDeployments,
1029
+ safeSingletonL2Version: import_safe_deployments.getSafeL2SingletonDeployments,
1030
+ safeProxyFactoryVersion: import_safe_deployments.getProxyFactoryDeployments,
1031
+ compatibilityFallbackHandler: import_safe_deployments.getCompatibilityFallbackHandlerDeployments,
1032
+ multiSendVersion: import_safe_deployments.getMultiSendDeployments,
1033
+ multiSendCallOnlyVersion: import_safe_deployments.getMultiSendCallOnlyDeployments,
1034
+ signMessageLibVersion: import_safe_deployments.getSignMessageLibDeployments,
1035
+ createCallVersion: import_safe_deployments.getCreateCallDeployments,
1036
+ simulateTxAccessorVersion: import_safe_deployments.getSimulateTxAccessorDeployments,
1037
+ safeWebAuthnSignerFactoryVersion: import_safe_modules_deployments.getSafeWebAuthnSignerFactoryDeployment,
1038
+ safeWebAuthnSharedSignerVersion: import_safe_modules_deployments.getSafeWebAuthnShareSignerDeployment
1039
+ };
1040
+ function getContractDeployment(safeVersion, chainId, contractName3) {
1041
+ const contractVersion = safeDeploymentsVersions[safeVersion][contractName3];
1042
+ const filters = {
1043
+ version: contractVersion,
1044
+ network: chainId.toString(),
1045
+ released: true
1046
+ };
1047
+ const deployment = contractFunctions[contractName3](filters);
1048
+ return deployment;
1049
+ }
1050
+
1051
+ // src/contracts/BaseContract.ts
1052
+ var BaseContract = class {
1053
+ /**
1054
+ * @constructor
1055
+ * Constructs an instance of BaseContract.
1056
+ *
1057
+ * @param contractName - The contract name.
1058
+ * @param chainId - The chain ID of the contract.
1059
+ * @param safeProvider - An instance of SafeProvider.
1060
+ * @param defaultAbi - The default ABI for the contract. It should be compatible with the specific version of the contract.
1061
+ * @param safeVersion - The version of the Safe contract.
1062
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
1063
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
1064
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
1065
+ */
1066
+ constructor(contractName3, chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType) {
1067
+ this.getAddress = () => {
1068
+ return this.contractAddress;
1069
+ };
1070
+ this.encode = (functionToEncode, args) => {
1071
+ const abi = this.contractAbi;
1072
+ const functionName = functionToEncode;
1073
+ const params = args;
1074
+ return (0, import_viem7.encodeFunctionData)({
1075
+ abi,
1076
+ functionName,
1077
+ args: params
1078
+ });
1079
+ };
1080
+ this.estimateGas = async (functionToEstimate, args, options = {}) => {
1081
+ const contractOptions = this.convertOptions(options);
1082
+ const abi = this.contractAbi;
1083
+ const params = args;
1084
+ return (0, import_actions.estimateContractGas)(this.runner, {
1085
+ abi,
1086
+ functionName: functionToEstimate,
1087
+ address: this.getAddress(),
1088
+ args: params,
1089
+ ...contractOptions
1090
+ });
1091
+ };
1092
+ const deployment = getContractDeployment(safeVersion, chainId, contractName3);
1093
+ const resolvedAddress = customContractAddress ?? this.#resolveAddress(
1094
+ deployment?.networkAddresses[chainId.toString()],
1095
+ deployment,
1096
+ deploymentType
1097
+ );
1098
+ if (!resolvedAddress) {
1099
+ throw new Error(`Invalid ${contractName3.replace("Version", "")} contract address`);
1100
+ }
1101
+ this.chainId = chainId;
1102
+ this.contractName = contractName3;
1103
+ this.safeVersion = safeVersion;
1104
+ this.contractAddress = resolvedAddress;
1105
+ this.contractAbi = customContractAbi || deployment?.abi || // this cast is required because abi is set as any[] in safe-deployments
1106
+ defaultAbi;
1107
+ this.runner = safeProvider.getExternalProvider();
1108
+ this.safeProvider = safeProvider;
1109
+ }
1110
+ #resolveAddress(networkAddresses, deployment, deploymentType) {
1111
+ if (!networkAddresses) {
1112
+ return void 0;
1113
+ }
1114
+ if (deploymentType && deployment && "deployments" in deployment) {
1115
+ const customDeploymentTypeAddress = deployment.deployments[deploymentType]?.address;
1116
+ if (typeof networkAddresses === "string") {
1117
+ return networkAddresses === customDeploymentTypeAddress ? customDeploymentTypeAddress : void 0;
1118
+ }
1119
+ return networkAddresses.find((address) => address === customDeploymentTypeAddress);
1120
+ }
1121
+ if (typeof networkAddresses === "string") {
1122
+ return networkAddresses;
1123
+ }
1124
+ return networkAddresses[0];
1125
+ }
1126
+ async init() {
1127
+ this.wallet = await this.safeProvider.getExternalSigner();
1128
+ }
1129
+ async getTransactionReceipt(hash) {
1130
+ return (0, import_actions.getTransactionReceipt)(this.runner, { hash });
1131
+ }
1132
+ /**
1133
+ * Converts a type of TransactionOptions to a viem transaction type. The viem transaction type creates a clear distinction between the multiple transaction objects (e.g., post-London hard fork) and doesn't allow a union of fields.
1134
+ * See: https://github.com/wevm/viem/blob/viem%402.18.0/src/types/fee.ts and https://github.com/wevm/viem/blob/603227e2588366914fb79a902d23fd9afc353cc6/src/types/transaction.ts#L200
1135
+ *
1136
+ * @param options - Transaction options as expected throughout safe sdk and propagated on the results.
1137
+ *
1138
+ * @returns Options object compatible with Viem
1139
+ */
1140
+ convertOptions(options) {
1141
+ const chain = this.getChain();
1142
+ if (!chain) throw new Error("Invalid chainId");
1143
+ const account = this.getWallet().account;
1144
+ if (!account) throw new Error("Invalid signer");
1145
+ const txOptions = convertTransactionOptions(options);
1146
+ return { chain, ...txOptions, account };
1147
+ }
1148
+ getChain() {
1149
+ return getChainById(this.chainId);
1150
+ }
1151
+ getWallet() {
1152
+ if (!this.wallet) throw new Error("A signer must be set");
1153
+ return this.wallet;
1154
+ }
1155
+ async write(functionName, args, options) {
1156
+ const converted = this.convertOptions(options);
1157
+ return await this.getWallet().writeContract({
1158
+ address: this.contractAddress,
1159
+ abi: this.contractAbi,
1160
+ functionName,
1161
+ args,
1162
+ ...converted
1163
+ });
1164
+ }
1165
+ async read(functionName, args) {
1166
+ return await this.runner.readContract({
1167
+ functionName,
1168
+ abi: this.contractAbi,
1169
+ address: this.contractAddress,
1170
+ args
1171
+ });
1172
+ }
1173
+ };
1174
+ var BaseContract_default = BaseContract;
1175
+
1176
+ // src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts
1177
+ var import_types_kit2 = require("@safe-global/types-kit");
1178
+
1179
+ // src/contracts/utils.ts
1180
+ var import_viem11 = require("viem");
1181
+ var import_actions3 = require("viem/actions");
1182
+
1183
+ // src/utils/block.ts
1184
+ function asBlockId(blockId) {
1185
+ return typeof blockId === "number" ? blockNumber(blockId) : blockTag(blockId);
1186
+ }
1187
+ function blockNumber(blockNumber2) {
1188
+ return { blockNumber: blockNumber2.toNumber() };
1189
+ }
1190
+ function blockTag(blockTag2) {
1191
+ return { blockTag: blockTag2 };
1192
+ }
1193
+
1194
+ // src/SafeProvider.ts
1195
+ var import_viem10 = require("viem");
1196
+ var import_accounts = require("viem/accounts");
1197
+ var import_actions2 = require("viem/actions");
1198
+
1199
+ // src/utils/provider.ts
1200
+ var import_viem9 = require("viem");
1201
+
1202
+ // src/utils/passkeys/extractPasskeyData.ts
1203
+ var import_buffer = require("buffer");
1204
+ var import_safe_modules_deployments2 = require("@safe-global/safe-modules-deployments");
1205
+ async function decodePublicKeyForWeb(publicKey) {
1206
+ const algorithm = {
1207
+ name: "ECDSA",
1208
+ namedCurve: "P-256",
1209
+ hash: { name: "SHA-256" }
1210
+ };
1211
+ const key = await crypto.subtle.importKey("spki", publicKey, algorithm, true, ["verify"]);
1212
+ const { x, y } = await crypto.subtle.exportKey("jwk", key);
1213
+ const isValidCoordinates = !!x && !!y;
1214
+ if (!isValidCoordinates) {
1215
+ throw new Error("Failed to generate passkey Coordinates. crypto.subtle.exportKey() failed");
1216
+ }
1217
+ return {
1218
+ x: "0x" + import_buffer.Buffer.from(x, "base64").toString("hex"),
1219
+ y: "0x" + import_buffer.Buffer.from(y, "base64").toString("hex")
1220
+ };
1221
+ }
1222
+ function getDefaultFCLP256VerifierAddress(chainId) {
1223
+ const FCLP256VerifierDeployment = (0, import_safe_modules_deployments2.getFCLP256VerifierDeployment)({
1224
+ version: "0.2.1",
1225
+ released: true,
1226
+ network: chainId
1227
+ });
1228
+ if (!FCLP256VerifierDeployment) {
1229
+ throw new Error(`Failed to load FCLP256Verifier deployment for chain ID ${chainId}`);
1230
+ }
1231
+ const verifierAddress = FCLP256VerifierDeployment.networkAddresses[chainId];
1232
+ if (!verifierAddress) {
1233
+ throw new Error(`FCLP256Verifier address not found for chain ID ${chainId}`);
1234
+ }
1235
+ return verifierAddress;
1236
+ }
1237
+
1238
+ // src/utils/passkeys/PasskeyClient.ts
1239
+ var import_viem8 = require("viem");
1240
+
1241
+ // src/utils/passkeys/isSharedSigner.ts
1242
+ async function isSharedSigner(passkey, safeWebAuthnSharedSignerContract, safeAddress, owners, chainId) {
1243
+ const sharedSignerContractAddress = safeWebAuthnSharedSignerContract.contractAddress;
1244
+ if (safeAddress && owners.includes(sharedSignerContractAddress)) {
1245
+ const [sharedSignerSlot] = await safeWebAuthnSharedSignerContract.getConfiguration([
1246
+ asHex(safeAddress)
1247
+ ]);
1248
+ const { x, y, verifiers } = sharedSignerSlot;
1249
+ const verifierAddress = passkey.customVerifierAddress || getDefaultFCLP256VerifierAddress(chainId);
1250
+ const isSharedSigner2 = BigInt(passkey.coordinates.x) === x && BigInt(passkey.coordinates.y) === y && BigInt(verifierAddress) === verifiers;
1251
+ return isSharedSigner2;
1252
+ }
1253
+ return false;
1254
+ }
1255
+ var isSharedSigner_default = isSharedSigner;
1256
+
1257
+ // src/utils/passkeys/PasskeyClient.ts
1258
+ var PASSKEY_CLIENT_KEY = "passkeyWallet";
1259
+ var PASSKEY_CLIENT_NAME = "Passkey Wallet Client";
1260
+ var sign = async (passkeyRawId, data, getFn) => {
1261
+ const getCredentials = getFn || navigator.credentials.get.bind(navigator.credentials);
1262
+ const assertion = await getCredentials({
1263
+ publicKey: {
1264
+ challenge: data,
1265
+ allowCredentials: [{ type: "public-key", id: passkeyRawId }],
1266
+ userVerification: "required"
1267
+ }
1268
+ });
1269
+ const assertionResponse = assertion.response;
1270
+ if (!assertionResponse?.authenticatorData) {
1271
+ throw new Error("Failed to sign data with passkey Signer");
1272
+ }
1273
+ const { authenticatorData, signature, clientDataJSON } = assertionResponse;
1274
+ return (0, import_viem8.encodeAbiParameters)((0, import_viem8.parseAbiParameters)("bytes, bytes, uint256[2]"), [
1275
+ (0, import_viem8.toHex)(new Uint8Array(authenticatorData)),
1276
+ extractClientDataFields(clientDataJSON),
1277
+ extractSignature(signature)
1278
+ ]);
1279
+ };
1280
+ var signTransaction = () => {
1281
+ throw new Error("Passkey Signers cannot sign transactions, they can only sign data.");
1282
+ };
1283
+ var signTypedData = () => {
1284
+ throw new Error("Passkey Signers cannot sign signTypedData, they can only sign data.");
1285
+ };
1286
+ var createPasskeyClient = async (passkey, safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract, provider, safeAddress, owners, chainId) => {
1287
+ const { rawId, coordinates, customVerifierAddress } = passkey;
1288
+ const passkeyRawId = (0, import_viem8.hexToBytes)(asHex(rawId));
1289
+ const verifierAddress = customVerifierAddress || getDefaultFCLP256VerifierAddress(chainId);
1290
+ const isPasskeySharedSigner = await isSharedSigner_default(
1291
+ passkey,
1292
+ safeWebAuthnSharedSignerContract,
1293
+ safeAddress,
1294
+ owners,
1295
+ chainId
1296
+ );
1297
+ let signerAddress;
1298
+ if (isPasskeySharedSigner) {
1299
+ signerAddress = safeWebAuthnSharedSignerContract.getAddress();
1300
+ } else {
1301
+ ;
1302
+ [signerAddress] = await safeWebAuthnSignerFactoryContract.getSigner([
1303
+ BigInt(coordinates.x),
1304
+ BigInt(coordinates.y),
1305
+ (0, import_viem8.fromHex)(asHex(verifierAddress), "bigint")
1306
+ ]);
1307
+ }
1308
+ return (0, import_viem8.createClient)({
1309
+ account: signerAddress,
1310
+ name: PASSKEY_CLIENT_NAME,
1311
+ key: PASSKEY_CLIENT_KEY,
1312
+ transport: (0, import_viem8.custom)(provider.transport)
1313
+ }).extend(import_viem8.walletActions).extend(() => ({
1314
+ signMessage({ message }) {
1315
+ if (typeof message === "string") {
1316
+ return sign(passkeyRawId, (0, import_viem8.toBytes)(message), passkey.getFn);
1317
+ }
1318
+ return sign(
1319
+ passkeyRawId,
1320
+ (0, import_viem8.isHex)(message.raw) ? (0, import_viem8.toBytes)(message.raw) : message.raw,
1321
+ passkey.getFn
1322
+ );
1323
+ },
1324
+ signTransaction,
1325
+ signTypedData,
1326
+ encodeConfigure() {
1327
+ return (0, import_viem8.encodeFunctionData)({
1328
+ abi: (0, import_viem8.parseAbi)(["function configure((uint256 x, uint256 y, uint176 verifiers) signer)"]),
1329
+ functionName: "configure",
1330
+ args: [
1331
+ {
1332
+ x: BigInt(passkey.coordinates.x),
1333
+ y: BigInt(passkey.coordinates.y),
1334
+ verifiers: (0, import_viem8.fromHex)(asHex(verifierAddress), "bigint")
1335
+ }
1336
+ ]
1337
+ });
1338
+ },
1339
+ encodeCreateSigner() {
1340
+ return asHex(
1341
+ safeWebAuthnSignerFactoryContract.encode("createSigner", [
1342
+ BigInt(coordinates.x),
1343
+ BigInt(coordinates.y),
1344
+ BigInt(verifierAddress)
1345
+ ])
1346
+ );
1347
+ },
1348
+ createDeployTxRequest() {
1349
+ const passkeySignerDeploymentTransaction = {
1350
+ to: safeWebAuthnSignerFactoryContract.getAddress(),
1351
+ value: "0",
1352
+ data: this.encodeCreateSigner()
1353
+ };
1354
+ return passkeySignerDeploymentTransaction;
1355
+ }
1356
+ }));
1357
+ };
1358
+ function decodeClientDataJSON(clientDataJSON) {
1359
+ const uint8Array = new Uint8Array(clientDataJSON);
1360
+ let result = "";
1361
+ for (let i = 0; i < uint8Array.length; i++) {
1362
+ result += String.fromCharCode(uint8Array[i]);
1363
+ }
1364
+ return result;
1365
+ }
1366
+ function extractClientDataFields(clientDataJSON) {
1367
+ const decodedClientDataJSON = decodeClientDataJSON(clientDataJSON);
1368
+ const match = decodedClientDataJSON.match(
1369
+ /^\{"type":"webauthn.get","challenge":"[A-Za-z0-9\-_]{43}",(.*)\}$/
1370
+ );
1371
+ if (!match) {
1372
+ throw new Error("challenge not found in client data JSON");
1373
+ }
1374
+ const [, fields] = match;
1375
+ return (0, import_viem8.toHex)((0, import_viem8.stringToBytes)(fields));
1376
+ }
1377
+ function extractSignature(signature) {
1378
+ const check = (x) => {
1379
+ if (!x) {
1380
+ throw new Error("invalid signature encoding");
1381
+ }
1382
+ };
1383
+ const view = new DataView(
1384
+ signature instanceof ArrayBuffer ? signature : signature instanceof Uint8Array ? signature.buffer : new Uint8Array(signature).buffer
1385
+ );
1386
+ check(view.getUint8(0) === 48);
1387
+ check(view.getUint8(1) === view.byteLength - 2);
1388
+ const readInt = (offset) => {
1389
+ check(view.getUint8(offset) === 2);
1390
+ const len = view.getUint8(offset + 1);
1391
+ const start = offset + 2;
1392
+ const end = start + len;
1393
+ const n = (0, import_viem8.fromBytes)(new Uint8Array(view.buffer.slice(start, end)), "bigint");
1394
+ check(n < import_viem8.maxUint256);
1395
+ return [n, end];
1396
+ };
1397
+ const [r, sOffset] = readInt(2);
1398
+ const [s] = readInt(sOffset);
1399
+ return [r, s];
1400
+ }
1401
+
1402
+ // src/utils/provider.ts
1403
+ var isEip1193Provider = (provider) => typeof provider !== "string";
1404
+ var isPrivateKey = (signer) => typeof signer === "string" && !(0, import_viem9.isAddress)(signer);
1405
+ var isSignerPasskeyClient = (signer) => !!signer && signer.key === PASSKEY_CLIENT_KEY;
1406
+
1407
+ // src/SafeProvider.ts
1408
+ var SafeProvider = class _SafeProvider {
1409
+ #chain;
1410
+ #externalProvider;
1411
+ constructor({
1412
+ provider,
1413
+ signer
1414
+ }) {
1415
+ this.#externalProvider = (0, import_viem10.createPublicClient)({
1416
+ transport: isEip1193Provider(provider) ? (0, import_viem10.custom)(provider) : (0, import_viem10.http)(provider)
1417
+ });
1418
+ this.provider = provider;
1419
+ this.signer = signer;
1420
+ this.#chain = void 0;
1421
+ }
1422
+ getExternalProvider() {
1423
+ return this.#externalProvider;
1424
+ }
1425
+ static async init({
1426
+ provider,
1427
+ signer,
1428
+ safeVersion = DEFAULT_SAFE_VERSION,
1429
+ contractNetworks,
1430
+ safeAddress,
1431
+ owners
1432
+ }) {
1433
+ const isPasskeySigner = signer && typeof signer !== "string";
1434
+ if (isPasskeySigner) {
1435
+ if (!hasSafeFeature("PASSKEY_SIGNER" /* PASSKEY_SIGNER */, safeVersion)) {
1436
+ throw new Error(
1437
+ "Current version of the Safe does not support the Passkey signer functionality"
1438
+ );
1439
+ }
1440
+ const safeProvider = new _SafeProvider({
1441
+ provider
1442
+ });
1443
+ const chainId = await safeProvider.getChainId();
1444
+ const customContracts = contractNetworks?.[chainId.toString()];
1445
+ let passkeySigner;
1446
+ if (!isSignerPasskeyClient(signer)) {
1447
+ const safeWebAuthnSignerFactoryContract = await getSafeWebAuthnSignerFactoryContract({
1448
+ safeProvider,
1449
+ safeVersion,
1450
+ customContracts
1451
+ });
1452
+ const safeWebAuthnSharedSignerContract = await getSafeWebAuthnSharedSignerContract({
1453
+ safeProvider,
1454
+ safeVersion,
1455
+ customContracts
1456
+ });
1457
+ passkeySigner = await createPasskeyClient(
1458
+ signer,
1459
+ safeWebAuthnSignerFactoryContract,
1460
+ safeWebAuthnSharedSignerContract,
1461
+ safeProvider.getExternalProvider(),
1462
+ safeAddress || "",
1463
+ owners || [],
1464
+ chainId.toString()
1465
+ );
1466
+ } else {
1467
+ passkeySigner = signer;
1468
+ }
1469
+ return new _SafeProvider({
1470
+ provider,
1471
+ signer: passkeySigner
1472
+ });
1473
+ } else {
1474
+ return new _SafeProvider({
1475
+ provider,
1476
+ signer
1477
+ });
1478
+ }
1479
+ }
1480
+ async getExternalSigner() {
1481
+ const { transport, chain = await this.#getChain() } = this.getExternalProvider();
1482
+ if (isSignerPasskeyClient(this.signer)) {
1483
+ return this.signer;
1484
+ }
1485
+ if (isPrivateKey(this.signer)) {
1486
+ const account = (0, import_accounts.privateKeyToAccount)(asHex(this.signer));
1487
+ return (0, import_viem10.createWalletClient)({
1488
+ account,
1489
+ chain,
1490
+ transport: (0, import_viem10.custom)(transport)
1491
+ });
1492
+ }
1493
+ if (this.signer && typeof this.signer === "string") {
1494
+ return (0, import_viem10.createWalletClient)({
1495
+ account: this.signer,
1496
+ chain,
1497
+ transport: (0, import_viem10.custom)(transport)
1498
+ });
1499
+ }
1500
+ try {
1501
+ const wallet = (0, import_viem10.createWalletClient)({
1502
+ chain,
1503
+ transport: (0, import_viem10.custom)(transport)
1504
+ });
1505
+ const [address] = await wallet.getAddresses();
1506
+ if (address) {
1507
+ const client = (0, import_viem10.createClient)({
1508
+ account: address,
1509
+ transport: (0, import_viem10.custom)(transport),
1510
+ chain: wallet.chain,
1511
+ rpcSchema: (0, import_viem10.rpcSchema)()
1512
+ }).extend(import_viem10.walletActions).extend(import_viem10.publicActions);
1513
+ return client;
1514
+ }
1515
+ } catch {
1516
+ }
1517
+ return void 0;
1518
+ }
1519
+ async isPasskeySigner() {
1520
+ return isSignerPasskeyClient(this.signer);
1521
+ }
1522
+ isAddress(address) {
1523
+ return (0, import_viem10.isAddress)(address);
1524
+ }
1525
+ async getEip3770Address(fullAddress) {
1526
+ const chainId = await this.getChainId();
1527
+ return validateEip3770Address(fullAddress, chainId);
1528
+ }
1529
+ async getBalance(address, blockTag2) {
1530
+ return (0, import_actions2.getBalance)(this.#externalProvider, {
1531
+ address,
1532
+ ...asBlockId(blockTag2)
1533
+ });
1534
+ }
1535
+ async getNonce(address, blockTag2) {
1536
+ return (0, import_actions2.getTransactionCount)(this.#externalProvider, {
1537
+ address,
1538
+ ...asBlockId(blockTag2)
1539
+ });
1540
+ }
1541
+ async getChainId() {
1542
+ const res = (await this.#getChain()).id;
1543
+ return BigInt(res);
1544
+ }
1545
+ getChecksummedAddress(address) {
1546
+ return (0, import_viem10.getAddress)(address);
1547
+ }
1548
+ async getContractCode(address, blockTag2) {
1549
+ const res = await (0, import_actions2.getCode)(this.#externalProvider, {
1550
+ address,
1551
+ ...asBlockId(blockTag2)
1552
+ });
1553
+ return res ?? "0x";
1554
+ }
1555
+ async isContractDeployed(address, blockTag2) {
1556
+ const contractCode = await (0, import_actions2.getCode)(this.#externalProvider, {
1557
+ address,
1558
+ ...asBlockId(blockTag2)
1559
+ });
1560
+ return !!contractCode;
1561
+ }
1562
+ async getStorageAt(address, position) {
1563
+ const content = await (0, import_actions2.getStorageAt)(this.#externalProvider, {
1564
+ address,
1565
+ slot: asHex(position)
1566
+ });
1567
+ const decodedContent = this.decodeParameters("address", asHex(content));
1568
+ return decodedContent[0];
1569
+ }
1570
+ async getTransaction(transactionHash) {
1571
+ return (0, import_actions2.getTransaction)(this.#externalProvider, {
1572
+ hash: asHash(transactionHash)
1573
+ });
1574
+ }
1575
+ async getSignerAddress() {
1576
+ const externalSigner = await this.getExternalSigner();
1577
+ return externalSigner ? (0, import_viem10.getAddress)(externalSigner.account.address) : void 0;
1578
+ }
1579
+ async signMessage(message) {
1580
+ const signer = await this.getExternalSigner();
1581
+ const account = await this.getSignerAddress();
1582
+ if (!signer || !account) {
1583
+ throw new Error("SafeProvider must be initialized with a signer to use this method");
1584
+ }
1585
+ if (sameString(signer.account.address, account)) {
1586
+ return await signer?.signMessage({
1587
+ message: { raw: (0, import_viem10.toBytes)(message) }
1588
+ });
1589
+ } else {
1590
+ return await signer?.signMessage({
1591
+ account,
1592
+ message: { raw: (0, import_viem10.toBytes)(message) }
1593
+ });
1594
+ }
1595
+ }
1596
+ async signTypedData(safeEIP712Args) {
1597
+ const signer = await this.getExternalSigner();
1598
+ if (!signer) {
1599
+ throw new Error("SafeProvider must be initialized with a signer to use this method");
1600
+ }
1601
+ if (isTypedDataSigner(signer)) {
1602
+ const typedData = generateTypedData(safeEIP712Args);
1603
+ const { chainId, verifyingContract } = typedData.domain;
1604
+ const chain = chainId ? Number(chainId) : void 0;
1605
+ const domain = { verifyingContract, chainId: chain };
1606
+ const signature = await signer.signTypedData({
1607
+ domain,
1608
+ types: typedData.primaryType === "SafeMessage" ? { SafeMessage: typedData.types.SafeMessage } : { SafeTx: typedData.types.SafeTx },
1609
+ primaryType: typedData.primaryType,
1610
+ message: typedData.message
1611
+ });
1612
+ return signature;
1613
+ }
1614
+ throw new Error("The current signer does not implement EIP-712 to sign typed data");
1615
+ }
1616
+ async estimateGas(transaction) {
1617
+ const converted = toEstimateGasParameters(transaction);
1618
+ return (await (0, import_actions2.estimateGas)(this.#externalProvider, converted)).toString();
1619
+ }
1620
+ async call(transaction, blockTag2) {
1621
+ const converted = toTransactionRequest(transaction);
1622
+ const { data } = await (0, import_actions2.call)(this.#externalProvider, {
1623
+ ...converted,
1624
+ ...asBlockId(blockTag2)
1625
+ });
1626
+ return data ?? "0x";
1627
+ }
1628
+ async readContract(args) {
1629
+ return (0, import_actions2.readContract)(this.#externalProvider, args);
1630
+ }
1631
+ // TODO: fix anys
1632
+ encodeParameters(types, values) {
1633
+ return (0, import_viem10.encodeAbiParameters)((0, import_viem10.parseAbiParameters)(types), values);
1634
+ }
1635
+ decodeParameters(types, values) {
1636
+ return (0, import_viem10.decodeAbiParameters)((0, import_viem10.parseAbiParameters)(types), asHex(values));
1637
+ }
1638
+ async #getChain() {
1639
+ if (this.#chain) return this.#chain;
1640
+ const chain = getChainById(BigInt(await this.#externalProvider.getChainId()));
1641
+ if (!chain) throw new Error("Invalid chainId");
1642
+ this.#chain = chain;
1643
+ return this.#chain;
1644
+ }
1645
+ };
1646
+ var SafeProvider_default = SafeProvider;
1647
+
1648
+ // src/utils/memoized.ts
1649
+ function createMemoizedFunction(callback, cache = {}) {
1650
+ const replacer = createSafeContractSerializerReplacer();
1651
+ return (...args) => {
1652
+ const key = JSON.stringify(args, replacer);
1653
+ cache[key] = cache[key] || callback(...args);
1654
+ return cache[key];
1655
+ };
1656
+ }
1657
+ function createSafeContractSerializerReplacer() {
1658
+ const seen = /* @__PURE__ */ new Set();
1659
+ return (_, value) => {
1660
+ if (typeof value === "bigint") {
1661
+ return value.toString();
1662
+ }
1663
+ if (value instanceof SafeProvider_default && value !== null) {
1664
+ if (seen.has(value)) {
1665
+ return void 0;
1666
+ }
1667
+ seen.add(value);
1668
+ return {
1669
+ $safeProvider: {
1670
+ provider: typeof value.provider === "object" ? "EIP1193Provider" : value.provider,
1671
+ signer: value.signer
1672
+ }
1673
+ };
1674
+ }
1675
+ return value;
1676
+ };
1677
+ }
1678
+
1679
+ // src/contracts/utils.ts
1680
+ var import_satisfies4 = __toESM(require("semver/functions/satisfies.js"));
1681
+ var memoizedGetCompatibilityFallbackHandlerContract = createMemoizedFunction(
1682
+ getCompatibilityFallbackHandlerContract
1683
+ );
1684
+ var memoizedGetProxyFactoryContract = createMemoizedFunction(
1685
+ ({
1686
+ safeProvider,
1687
+ safeVersion,
1688
+ customContracts,
1689
+ deploymentType
1690
+ }) => getSafeProxyFactoryContract({ safeProvider, safeVersion, customContracts, deploymentType })
1691
+ );
1692
+ var memoizedGetProxyCreationCode = createMemoizedFunction(
1693
+ async ({
1694
+ safeProvider,
1695
+ safeVersion,
1696
+ customContracts,
1697
+ chainId,
1698
+ deploymentType
1699
+ }) => {
1700
+ const safeProxyFactoryContract = await memoizedGetProxyFactoryContract({
1701
+ safeProvider,
1702
+ safeVersion,
1703
+ customContracts,
1704
+ chainId,
1705
+ deploymentType
1706
+ });
1707
+ return safeProxyFactoryContract.proxyCreationCode();
1708
+ }
1709
+ );
1710
+ var memoizedGetSafeContract = createMemoizedFunction(
1711
+ ({
1712
+ safeProvider,
1713
+ safeVersion,
1714
+ isL1SafeSingleton,
1715
+ customContracts,
1716
+ deploymentType
1717
+ }) => getSafeContract({
1718
+ safeProvider,
1719
+ safeVersion,
1720
+ isL1SafeSingleton,
1721
+ customContracts,
1722
+ deploymentType
1723
+ })
1724
+ );
1725
+ function toTxResult(runner, hash, options) {
1726
+ return {
1727
+ hash,
1728
+ options,
1729
+ transactionResponse: {
1730
+ wait: async () => (0, import_actions3.waitForTransactionReceipt)(runner, { hash })
1731
+ }
1732
+ };
1733
+ }
1734
+ function isTypedDataSigner(signer) {
1735
+ const isPasskeySigner = !!signer?.passkeyRawId;
1736
+ return signer.signTypedData !== void 0 || !isPasskeySigner;
1737
+ }
1738
+
1739
+ // src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts
1740
+ var import_types_kit3 = require("@safe-global/types-kit");
1741
+
1742
+ // src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts
1743
+ var import_types_kit4 = require("@safe-global/types-kit");
1744
+
1745
+ // src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts
1746
+ var import_types_kit5 = require("@safe-global/types-kit");
1747
+
1748
+ // src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts
1749
+ var import_types_kit6 = require("@safe-global/types-kit");
1750
+
1751
+ // src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts
1752
+ var import_types_kit7 = require("@safe-global/types-kit");
1753
+
1754
+ // src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts
1755
+ var import_types_kit8 = require("@safe-global/types-kit");
1756
+
1757
+ // src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts
1758
+ var import_types_kit9 = require("@safe-global/types-kit");
1759
+
1760
+ // src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts
1761
+ var import_types_kit10 = require("@safe-global/types-kit");
1762
+
1763
+ // src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts
1764
+ var import_actions4 = require("viem/actions");
1765
+
1766
+ // src/contracts/Safe/SafeBaseContract.ts
1767
+ var SafeBaseContract = class extends BaseContract_default {
1768
+ /**
1769
+ * @constructor
1770
+ * Constructs an instance of SafeBaseContract.
1771
+ *
1772
+ * @param chainId - The chain ID of the contract.
1773
+ * @param safeProvider - An instance of SafeProvider.
1774
+ * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the Safe contract.
1775
+ * @param safeVersion - The version of the Safe contract.
1776
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
1777
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
1778
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
1779
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
1780
+ */
1781
+ constructor(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton = safeDeploymentsL1ChainIds.includes(chainId), customContractAddress, customContractAbi, deploymentType) {
1782
+ const isL1Contract = isL1SafeSingleton || !hasSafeFeature("SAFE_L2_CONTRACTS" /* SAFE_L2_CONTRACTS */, safeVersion);
1783
+ const contractName3 = isL1Contract ? "safeSingletonVersion" : "safeSingletonL2Version";
1784
+ super(
1785
+ contractName3,
1786
+ chainId,
1787
+ safeProvider,
1788
+ defaultAbi,
1789
+ safeVersion,
1790
+ customContractAddress,
1791
+ customContractAbi,
1792
+ deploymentType
1793
+ );
1794
+ this.contractName = contractName3;
1795
+ }
1796
+ };
1797
+ var SafeBaseContract_default = SafeBaseContract;
1798
+
1799
+ // src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts
1800
+ var import_types_kit11 = require("@safe-global/types-kit");
1801
+ var SafeContract_v1_0_0 = class extends SafeBaseContract_default {
1802
+ /**
1803
+ * Constructs an instance of SafeContract_v1_0_0
1804
+ *
1805
+ * @param chainId - The chain ID where the contract resides.
1806
+ * @param safeProvider - An instance of SafeProvider.
1807
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
1808
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
1809
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used.
1810
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
1811
+ */
1812
+ constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) {
1813
+ const safeVersion = "1.0.0";
1814
+ const defaultAbi = import_types_kit11.safe_1_0_0_ContractArtifacts.abi;
1815
+ super(
1816
+ chainId,
1817
+ safeProvider,
1818
+ defaultAbi,
1819
+ safeVersion,
1820
+ isL1SafeSingleton,
1821
+ customContractAddress,
1822
+ customContractAbi,
1823
+ deploymentType
1824
+ );
1825
+ /* ----- Specific v1.0.0 properties ----- */
1826
+ this.DOMAIN_SEPARATOR_TYPEHASH = async () => {
1827
+ return [await this.read("DOMAIN_SEPARATOR_TYPEHASH")];
1828
+ };
1829
+ this.SENTINEL_MODULES = async () => {
1830
+ return [await this.read("SENTINEL_MODULES")];
1831
+ };
1832
+ this.SENTINEL_OWNERS = async () => {
1833
+ return [await this.read("SENTINEL_OWNERS")];
1834
+ };
1835
+ this.SAFE_MSG_TYPEHASH = async () => {
1836
+ return [await this.read("SAFE_MSG_TYPEHASH")];
1837
+ };
1838
+ this.SAFE_TX_TYPEHASH = async () => {
1839
+ return [await this.read("SAFE_TX_TYPEHASH")];
1840
+ };
1841
+ /* ----- End of specific v1.0.0 properties ----- */
1842
+ /**
1843
+ * @returns Array[contractName]
1844
+ */
1845
+ this.NAME = async () => {
1846
+ return [await this.read("NAME")];
1847
+ };
1848
+ /**
1849
+ * @returns Array[safeContractVersion]
1850
+ */
1851
+ this.VERSION = async () => {
1852
+ return [await this.read("VERSION")];
1853
+ };
1854
+ /**
1855
+ * @param args - Array[owner, txHash]
1856
+ * @returns Array[approvedHashes]
1857
+ */
1858
+ this.approvedHashes = async (args) => {
1859
+ return [await this.read("approvedHashes", args)];
1860
+ };
1861
+ /**
1862
+ * @returns Array[domainSeparator]
1863
+ */
1864
+ this.domainSeparator = async () => {
1865
+ return [await this.read("domainSeparator")];
1866
+ };
1867
+ /**
1868
+ * Returns array of modules.
1869
+ * @returns Array[Array[modules]]
1870
+ */
1871
+ this.getModules = async () => {
1872
+ return [await this.read("getModules")];
1873
+ };
1874
+ /**
1875
+ * Returns the list of Safe owner accounts.
1876
+ * @returns Array[Array[owners]]
1877
+ */
1878
+ this.getOwners = async () => {
1879
+ return [await this.read("getOwners")];
1880
+ };
1881
+ /**
1882
+ * Returns the Safe threshold.
1883
+ * @returns Array[threshold]
1884
+ */
1885
+ this.getThreshold = async () => {
1886
+ return [await this.read("getThreshold")];
1887
+ };
1888
+ /**
1889
+ * Checks if a specific address is an owner of the current Safe.
1890
+ * @param args - Array[address]
1891
+ * @returns Array[isOwner]
1892
+ */
1893
+ this.isOwner = async (args) => {
1894
+ return [await this.read("isOwner", args)];
1895
+ };
1896
+ /**
1897
+ * Returns the Safe nonce.
1898
+ * @returns Array[nonce]
1899
+ */
1900
+ this.nonce = async () => {
1901
+ return [await this.read("nonce")];
1902
+ };
1903
+ /**
1904
+ * @param args - Array[messageHash]
1905
+ * @returns Array[signedMessages]
1906
+ */
1907
+ this.signedMessages = async (args) => {
1908
+ return [await this.read("signedMessages", args)];
1909
+ };
1910
+ /**
1911
+ * Returns hash of a message that can be signed by owners.
1912
+ * @param args - Array[message]
1913
+ * @returns Array[messageHash]
1914
+ */
1915
+ this.getMessageHash = async (args) => {
1916
+ return [await this.read("getMessageHash", args)];
1917
+ };
1918
+ /**
1919
+ * Returns the bytes that are hashed to be signed by owners.
1920
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
1921
+ * @returns Array[encodedData]
1922
+ */
1923
+ this.encodeTransactionData = async (args) => {
1924
+ return [await this.read("encodeTransactionData", args)];
1925
+ };
1926
+ /**
1927
+ * Returns hash to be signed by owners.
1928
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
1929
+ * @returns Array[transactionHash]
1930
+ */
1931
+ this.getTransactionHash = async (args) => {
1932
+ return [await this.read("getTransactionHash", args)];
1933
+ };
1934
+ }
1935
+ /**
1936
+ * Marks a hash as approved. This can be used to validate a hash that is used by a signature.
1937
+ * @param hash - The hash that should be marked as approved for signatures that are verified by this contract.
1938
+ * @param options - Optional transaction options.
1939
+ * @returns Transaction result.
1940
+ */
1941
+ async approveHash(hash, options) {
1942
+ const gasLimit = options?.gasLimit || await this.estimateGas("approveHash", [asHash(hash)], options);
1943
+ return toTxResult(
1944
+ this.runner,
1945
+ await this.write("approveHash", [asHash(hash)], { ...options, gasLimit }),
1946
+ options
1947
+ );
1948
+ }
1949
+ /**
1950
+ * Executes a transaction.
1951
+ * @param safeTransaction - The Safe transaction to execute.
1952
+ * @param options - Transaction options.
1953
+ * @returns Transaction result.
1954
+ */
1955
+ async execTransaction(safeTransaction, options) {
1956
+ const gasLimit = options?.gasLimit || await this.estimateGas(
1957
+ "execTransaction",
1958
+ [
1959
+ safeTransaction.data.to,
1960
+ BigInt(safeTransaction.data.value),
1961
+ asHex(safeTransaction.data.data),
1962
+ safeTransaction.data.operation,
1963
+ BigInt(safeTransaction.data.safeTxGas),
1964
+ BigInt(safeTransaction.data.baseGas),
1965
+ BigInt(safeTransaction.data.gasPrice),
1966
+ safeTransaction.data.gasToken,
1967
+ safeTransaction.data.refundReceiver,
1968
+ asHex(safeTransaction.encodedSignatures())
1969
+ ],
1970
+ options
1971
+ );
1972
+ const args = [
1973
+ safeTransaction.data.to,
1974
+ BigInt(safeTransaction.data.value),
1975
+ asHex(safeTransaction.data.data),
1976
+ safeTransaction.data.operation,
1977
+ BigInt(safeTransaction.data.safeTxGas),
1978
+ BigInt(safeTransaction.data.baseGas),
1979
+ BigInt(safeTransaction.data.gasPrice),
1980
+ safeTransaction.data.gasToken,
1981
+ safeTransaction.data.refundReceiver,
1982
+ asHex(safeTransaction.encodedSignatures())
1983
+ ];
1984
+ return toTxResult(
1985
+ this.runner,
1986
+ await this.write("execTransaction", args, { ...options, gasLimit }),
1987
+ options
1988
+ );
1989
+ }
1990
+ async getModulesPaginated([start, pageSize]) {
1991
+ if (pageSize <= 0) throw new Error("Invalid page size for fetching paginated modules");
1992
+ const size = Number(pageSize);
1993
+ const [array] = await this.getModules();
1994
+ if (isSentinelAddress(start)) {
1995
+ const next = pageSize < array.length ? array[size] : SENTINEL_ADDRESS;
1996
+ return [array.slice(0, size), next];
1997
+ } else {
1998
+ const moduleIndex = array.findIndex((module2) => sameString(module2, start));
1999
+ if (moduleIndex === -1) {
2000
+ return [[], SENTINEL_ADDRESS];
2001
+ }
2002
+ const nextElementIndex = moduleIndex + 1;
2003
+ const nextPageAddress = nextElementIndex + size < array.length ? array[nextElementIndex + size] : SENTINEL_ADDRESS;
2004
+ return [array.slice(moduleIndex + 1, nextElementIndex + size), nextPageAddress];
2005
+ }
2006
+ }
2007
+ /**
2008
+ * Checks if a specific Safe module is enabled for the current Safe.
2009
+ * @param moduleAddress - The module address to check.
2010
+ * @returns True, if the module with the given address is enabled.
2011
+ */
2012
+ async isModuleEnabled([moduleAddress]) {
2013
+ const [modules] = await this.getModules();
2014
+ const isModuleEnabled = modules.some(
2015
+ (enabledModuleAddress) => sameString(enabledModuleAddress, moduleAddress)
2016
+ );
2017
+ return [isModuleEnabled];
2018
+ }
2019
+ /**
2020
+ * Checks whether a given Safe transaction can be executed successfully with no errors.
2021
+ * @param safeTransaction - The Safe transaction to check.
2022
+ * @param options - Optional transaction options.
2023
+ * @returns True, if the given transactions is valid.
2024
+ */
2025
+ async isValidTransaction(safeTransaction, options = {}) {
2026
+ try {
2027
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2028
+ "execTransaction",
2029
+ [
2030
+ safeTransaction.data.to,
2031
+ BigInt(safeTransaction.data.value),
2032
+ asHex(safeTransaction.data.data),
2033
+ safeTransaction.data.operation,
2034
+ BigInt(safeTransaction.data.safeTxGas),
2035
+ BigInt(safeTransaction.data.baseGas),
2036
+ BigInt(safeTransaction.data.gasPrice),
2037
+ safeTransaction.data.gasToken,
2038
+ safeTransaction.data.refundReceiver,
2039
+ asHex(safeTransaction.encodedSignatures())
2040
+ ],
2041
+ options
2042
+ );
2043
+ const converted = this.convertOptions({ ...options, gasLimit });
2044
+ const txResult = await (0, import_actions4.simulateContract)(this.runner, {
2045
+ address: this.contractAddress,
2046
+ functionName: "execTransaction",
2047
+ abi: this.contractAbi,
2048
+ args: [
2049
+ safeTransaction.data.to,
2050
+ BigInt(safeTransaction.data.value),
2051
+ asHex(safeTransaction.data.data),
2052
+ safeTransaction.data.operation,
2053
+ BigInt(safeTransaction.data.safeTxGas),
2054
+ BigInt(safeTransaction.data.baseGas),
2055
+ BigInt(safeTransaction.data.gasPrice),
2056
+ safeTransaction.data.gasToken,
2057
+ safeTransaction.data.refundReceiver,
2058
+ asHex(safeTransaction.encodedSignatures())
2059
+ ],
2060
+ ...converted
2061
+ });
2062
+ return txResult.result;
2063
+ } catch (error) {
2064
+ return false;
2065
+ }
2066
+ }
2067
+ /**
2068
+ * returns the nonce of the Safe contract.
2069
+ *
2070
+ * @returns {Promise<bigint>} A promise that resolves to the nonce of the Safe contract.
2071
+ */
2072
+ async getNonce() {
2073
+ const [nonce] = await this.nonce();
2074
+ return nonce;
2075
+ }
2076
+ };
2077
+ var SafeContract_v1_0_0_default = SafeContract_v1_0_0;
2078
+
2079
+ // src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts
2080
+ var import_actions5 = require("viem/actions");
2081
+ var import_types_kit12 = require("@safe-global/types-kit");
2082
+ var SafeContract_v1_1_1 = class extends SafeBaseContract_default {
2083
+ /**
2084
+ * Constructs an instance of SafeContract_v1_1_1
2085
+ *
2086
+ * @param chainId - The chain ID where the contract resides.
2087
+ * @param safeProvider - An instance of SafeProvider.
2088
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
2089
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
2090
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used.
2091
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
2092
+ */
2093
+ constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) {
2094
+ const safeVersion = "1.1.1";
2095
+ const defaultAbi = import_types_kit12.safe_1_1_1_ContractArtifacts.abi;
2096
+ super(
2097
+ chainId,
2098
+ safeProvider,
2099
+ defaultAbi,
2100
+ safeVersion,
2101
+ isL1SafeSingleton,
2102
+ customContractAddress,
2103
+ customContractAbi,
2104
+ deploymentType
2105
+ );
2106
+ /**
2107
+ * @returns Array[contractName]
2108
+ */
2109
+ this.NAME = async () => {
2110
+ return [await this.read("NAME")];
2111
+ };
2112
+ /**
2113
+ * @returns Array[safeContractVersion]
2114
+ */
2115
+ this.VERSION = async () => {
2116
+ return [await this.read("VERSION")];
2117
+ };
2118
+ /**
2119
+ * @param args - Array[owner, txHash]
2120
+ * @returns Array[approvedHashes]
2121
+ */
2122
+ this.approvedHashes = async (args) => {
2123
+ return [await this.read("approvedHashes", args)];
2124
+ };
2125
+ /**
2126
+ * @returns Array[domainSeparator]
2127
+ */
2128
+ this.domainSeparator = async () => {
2129
+ return [await this.read("domainSeparator")];
2130
+ };
2131
+ /**
2132
+ * Returns array of first 10 modules.
2133
+ * @returns Array[Array[modules]]
2134
+ */
2135
+ this.getModules = async () => {
2136
+ return [await this.read("getModules")];
2137
+ };
2138
+ /**
2139
+ * Returns array of modules.
2140
+ * @param args - Array[start, pageSize]
2141
+ * @returns Array[Array[modules], next]
2142
+ */
2143
+ this.getModulesPaginated = async (args) => {
2144
+ const [array, next] = await this.read("getModulesPaginated", args);
2145
+ return [array, next];
2146
+ };
2147
+ /**
2148
+ * Returns the list of Safe owner accounts.
2149
+ * @returns Array[Array[owners]]
2150
+ */
2151
+ this.getOwners = async () => {
2152
+ return [await this.read("getOwners")];
2153
+ };
2154
+ /**
2155
+ * Returns the Safe threshold.
2156
+ * @returns Array[threshold]
2157
+ */
2158
+ this.getThreshold = async () => {
2159
+ return [await this.read("getThreshold")];
2160
+ };
2161
+ /**
2162
+ * Checks if a specific address is an owner of the current Safe.
2163
+ * @param args - Array[address]
2164
+ * @returns Array[isOwner]
2165
+ */
2166
+ this.isOwner = async (args) => {
2167
+ return [await this.read("isOwner", args)];
2168
+ };
2169
+ /**
2170
+ * Returns the Safe nonce.
2171
+ * @returns Array[nonce]
2172
+ */
2173
+ this.nonce = async () => {
2174
+ return [await this.read("nonce")];
2175
+ };
2176
+ /**
2177
+ * @param args - Array[messageHash]
2178
+ * @returns Array[signedMessages]
2179
+ */
2180
+ this.signedMessages = async (args) => {
2181
+ return [await this.read("signedMessages", args)];
2182
+ };
2183
+ /**
2184
+ * Returns hash of a message that can be signed by owners.
2185
+ * @param args - Array[message]
2186
+ * @returns Array[messageHash]
2187
+ */
2188
+ this.getMessageHash = async (args) => {
2189
+ return [await this.read("getMessageHash", args)];
2190
+ };
2191
+ /**
2192
+ * Returns the bytes that are hashed to be signed by owners.
2193
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2194
+ * @returns Array[encodedData]
2195
+ */
2196
+ this.encodeTransactionData = async (args) => {
2197
+ return [await this.read("encodeTransactionData", args)];
2198
+ };
2199
+ /**
2200
+ * Returns hash to be signed by owners.
2201
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2202
+ * @returns Array[transactionHash]
2203
+ */
2204
+ this.getTransactionHash = async (args) => {
2205
+ return [await this.read("getTransactionHash", args)];
2206
+ };
2207
+ }
2208
+ /**
2209
+ * Marks a hash as approved. This can be used to validate a hash that is used by a signature.
2210
+ * @param hash - The hash that should be marked as approved for signatures that are verified by this contract.
2211
+ * @param options - Optional transaction options.
2212
+ * @returns Transaction result.
2213
+ */
2214
+ async approveHash(hash, options) {
2215
+ const gasLimit = options?.gasLimit || await this.estimateGas("approveHash", [asHash(hash)], options);
2216
+ return toTxResult(
2217
+ this.runner,
2218
+ await this.write("approveHash", [asHash(hash)], { ...options, gasLimit }),
2219
+ options
2220
+ );
2221
+ }
2222
+ /**
2223
+ * Executes a transaction.
2224
+ * @param safeTransaction - The Safe transaction to execute.
2225
+ * @param options - Transaction options.
2226
+ * @returns Transaction result.
2227
+ */
2228
+ async execTransaction(safeTransaction, options) {
2229
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2230
+ "execTransaction",
2231
+ [
2232
+ safeTransaction.data.to,
2233
+ BigInt(safeTransaction.data.value),
2234
+ asHex(safeTransaction.data.data),
2235
+ safeTransaction.data.operation,
2236
+ BigInt(safeTransaction.data.safeTxGas),
2237
+ BigInt(safeTransaction.data.baseGas),
2238
+ BigInt(safeTransaction.data.gasPrice),
2239
+ safeTransaction.data.gasToken,
2240
+ safeTransaction.data.refundReceiver,
2241
+ asHex(safeTransaction.encodedSignatures())
2242
+ ],
2243
+ options
2244
+ );
2245
+ const args = [
2246
+ safeTransaction.data.to,
2247
+ BigInt(safeTransaction.data.value),
2248
+ asHex(safeTransaction.data.data),
2249
+ safeTransaction.data.operation,
2250
+ BigInt(safeTransaction.data.safeTxGas),
2251
+ BigInt(safeTransaction.data.baseGas),
2252
+ BigInt(safeTransaction.data.gasPrice),
2253
+ safeTransaction.data.gasToken,
2254
+ safeTransaction.data.refundReceiver,
2255
+ asHex(safeTransaction.encodedSignatures())
2256
+ ];
2257
+ return toTxResult(
2258
+ this.runner,
2259
+ await this.write("execTransaction", args, { ...options, gasLimit }),
2260
+ options
2261
+ );
2262
+ }
2263
+ /**
2264
+ * Checks if a specific Safe module is enabled for the current Safe.
2265
+ * @param moduleAddress - The module address to check.
2266
+ * @returns True, if the module with the given address is enabled.
2267
+ */
2268
+ async isModuleEnabled([moduleAddress]) {
2269
+ const [modules] = await this.getModules();
2270
+ const isModuleEnabled = modules.some(
2271
+ (enabledModuleAddress) => sameString(enabledModuleAddress, moduleAddress)
2272
+ );
2273
+ return [isModuleEnabled];
2274
+ }
2275
+ /**
2276
+ * Checks whether a given Safe transaction can be executed successfully with no errors.
2277
+ * @param safeTransaction - The Safe transaction to check.
2278
+ * @param options - Optional transaction options.
2279
+ * @returns True, if the given transactions is valid.
2280
+ */
2281
+ async isValidTransaction(safeTransaction, options = {}) {
2282
+ try {
2283
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2284
+ "execTransaction",
2285
+ [
2286
+ safeTransaction.data.to,
2287
+ BigInt(safeTransaction.data.value),
2288
+ asHex(safeTransaction.data.data),
2289
+ safeTransaction.data.operation,
2290
+ BigInt(safeTransaction.data.safeTxGas),
2291
+ BigInt(safeTransaction.data.baseGas),
2292
+ BigInt(safeTransaction.data.gasPrice),
2293
+ safeTransaction.data.gasToken,
2294
+ safeTransaction.data.refundReceiver,
2295
+ asHex(safeTransaction.encodedSignatures())
2296
+ ],
2297
+ options
2298
+ );
2299
+ const converted = this.convertOptions({ ...options, gasLimit });
2300
+ const txResult = await (0, import_actions5.simulateContract)(this.runner, {
2301
+ address: this.contractAddress,
2302
+ functionName: "execTransaction",
2303
+ abi: this.contractAbi,
2304
+ args: [
2305
+ safeTransaction.data.to,
2306
+ BigInt(safeTransaction.data.value),
2307
+ asHex(safeTransaction.data.data),
2308
+ safeTransaction.data.operation,
2309
+ BigInt(safeTransaction.data.safeTxGas),
2310
+ BigInt(safeTransaction.data.baseGas),
2311
+ BigInt(safeTransaction.data.gasPrice),
2312
+ safeTransaction.data.gasToken,
2313
+ safeTransaction.data.refundReceiver,
2314
+ asHex(safeTransaction.encodedSignatures())
2315
+ ],
2316
+ ...converted
2317
+ });
2318
+ return txResult.result;
2319
+ } catch (error) {
2320
+ return false;
2321
+ }
2322
+ }
2323
+ /**
2324
+ * returns the nonce of the Safe contract.
2325
+ *
2326
+ * @returns {Promise<bigint>} A promise that resolves to the nonce of the Safe contract.
2327
+ */
2328
+ async getNonce() {
2329
+ const [nonce] = await this.nonce();
2330
+ return nonce;
2331
+ }
2332
+ };
2333
+ var SafeContract_v1_1_1_default = SafeContract_v1_1_1;
2334
+
2335
+ // src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts
2336
+ var import_actions6 = require("viem/actions");
2337
+ var import_types_kit13 = require("@safe-global/types-kit");
2338
+ var SafeContract_v1_2_0 = class extends SafeBaseContract_default {
2339
+ /**
2340
+ * Constructs an instance of SafeContract_v1_2_0
2341
+ *
2342
+ * @param chainId - The chain ID where the contract resides.
2343
+ * @param safeProvider - An instance of SafeProvider.
2344
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
2345
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
2346
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used.
2347
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
2348
+ */
2349
+ constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) {
2350
+ const safeVersion = "1.2.0";
2351
+ const defaultAbi = import_types_kit13.safe_1_2_0_ContractArtifacts.abi;
2352
+ super(
2353
+ chainId,
2354
+ safeProvider,
2355
+ defaultAbi,
2356
+ safeVersion,
2357
+ isL1SafeSingleton,
2358
+ customContractAddress,
2359
+ customContractAbi,
2360
+ deploymentType
2361
+ );
2362
+ /**
2363
+ * @returns Array[contractName]
2364
+ */
2365
+ this.NAME = async () => {
2366
+ return [await this.read("NAME")];
2367
+ };
2368
+ /**
2369
+ * @returns Array[safeContractVersion]
2370
+ */
2371
+ this.VERSION = async () => {
2372
+ return [await this.read("VERSION")];
2373
+ };
2374
+ /**
2375
+ * @param args - Array[owner, txHash]
2376
+ * @returns Array[approvedHashes]
2377
+ */
2378
+ this.approvedHashes = async (args) => {
2379
+ return [await this.read("approvedHashes", args)];
2380
+ };
2381
+ /**
2382
+ * @returns Array[domainSeparator]
2383
+ */
2384
+ this.domainSeparator = async () => {
2385
+ return [await this.read("domainSeparator")];
2386
+ };
2387
+ /**
2388
+ * Returns array of first 10 modules.
2389
+ * @returns Array[Array[modules]]
2390
+ */
2391
+ this.getModules = async () => {
2392
+ return [await this.read("getModules")];
2393
+ };
2394
+ /**
2395
+ * Returns array of modules.
2396
+ * @param args - Array[start, pageSize]
2397
+ * @returns Array[Array[modules], next]
2398
+ */
2399
+ this.getModulesPaginated = async (args) => {
2400
+ const [array, next] = await this.read("getModulesPaginated", args);
2401
+ return [array, next];
2402
+ };
2403
+ /**
2404
+ * Returns the list of Safe owner accounts.
2405
+ * @returns Array[Array[owners]]
2406
+ */
2407
+ this.getOwners = async () => {
2408
+ return [await this.read("getOwners")];
2409
+ };
2410
+ /**
2411
+ * Returns the Safe threshold.
2412
+ * @returns Array[threshold]
2413
+ */
2414
+ this.getThreshold = async () => {
2415
+ return [await this.read("getThreshold")];
2416
+ };
2417
+ /**
2418
+ * Checks if a specific Safe module is enabled for the current Safe.
2419
+ * @param args - Array[moduleAddress]
2420
+ * @returns Array[isEnabled]
2421
+ */
2422
+ this.isModuleEnabled = async (args) => {
2423
+ return [await this.read("isModuleEnabled", args)];
2424
+ };
2425
+ /**
2426
+ * Checks if a specific address is an owner of the current Safe.
2427
+ * @param args - Array[address]
2428
+ * @returns Array[isOwner]
2429
+ */
2430
+ this.isOwner = async (args) => {
2431
+ return [await this.read("isOwner", args)];
2432
+ };
2433
+ /**
2434
+ * Returns the Safe nonce.
2435
+ * @returns Array[nonce]
2436
+ */
2437
+ this.nonce = async () => {
2438
+ return [await this.read("nonce")];
2439
+ };
2440
+ /**
2441
+ * @param args - Array[messageHash]
2442
+ * @returns Array[signedMessages]
2443
+ */
2444
+ this.signedMessages = async (args) => {
2445
+ return [await this.read("signedMessages", args)];
2446
+ };
2447
+ /**
2448
+ * @param args - Array[message]
2449
+ * @returns Array[messageHash]
2450
+ */
2451
+ this.getMessageHash = async (args) => {
2452
+ return [await this.read("getMessageHash", args)];
2453
+ };
2454
+ /**
2455
+ * Encodes the data for a transaction to the Safe contract.
2456
+ *
2457
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2458
+ * @returns Array[encodedData]
2459
+ */
2460
+ this.encodeTransactionData = async (args) => {
2461
+ return [await this.read("encodeTransactionData", args)];
2462
+ };
2463
+ /**
2464
+ * Returns hash to be signed by owners.
2465
+ *
2466
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2467
+ * @returns Array[transactionHash]
2468
+ */
2469
+ this.getTransactionHash = async (args) => {
2470
+ return [await this.read("getTransactionHash", args)];
2471
+ };
2472
+ }
2473
+ /**
2474
+ * Marks a hash as approved. This can be used to validate a hash that is used by a signature.
2475
+ * @param hash - The hash that should be marked as approved for signatures that are verified by this contract.
2476
+ * @param options - Optional transaction options.
2477
+ * @returns Transaction result.
2478
+ */
2479
+ async approveHash(hash, options) {
2480
+ const gasLimit = options?.gasLimit || await this.estimateGas("approveHash", [asHash(hash)], options);
2481
+ return toTxResult(
2482
+ this.runner,
2483
+ await this.write("approveHash", [asHash(hash)], { ...options, gasLimit }),
2484
+ options
2485
+ );
2486
+ }
2487
+ /**
2488
+ * Executes a transaction.
2489
+ * @param safeTransaction - The Safe transaction to execute.
2490
+ * @param options - Transaction options.
2491
+ * @returns Transaction result.
2492
+ */
2493
+ async execTransaction(safeTransaction, options) {
2494
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2495
+ "execTransaction",
2496
+ [
2497
+ safeTransaction.data.to,
2498
+ BigInt(safeTransaction.data.value),
2499
+ asHex(safeTransaction.data.data),
2500
+ safeTransaction.data.operation,
2501
+ BigInt(safeTransaction.data.safeTxGas),
2502
+ BigInt(safeTransaction.data.baseGas),
2503
+ BigInt(safeTransaction.data.gasPrice),
2504
+ safeTransaction.data.gasToken,
2505
+ safeTransaction.data.refundReceiver,
2506
+ asHex(safeTransaction.encodedSignatures())
2507
+ ],
2508
+ options
2509
+ );
2510
+ const args = [
2511
+ safeTransaction.data.to,
2512
+ BigInt(safeTransaction.data.value),
2513
+ asHex(safeTransaction.data.data),
2514
+ safeTransaction.data.operation,
2515
+ BigInt(safeTransaction.data.safeTxGas),
2516
+ BigInt(safeTransaction.data.baseGas),
2517
+ BigInt(safeTransaction.data.gasPrice),
2518
+ safeTransaction.data.gasToken,
2519
+ safeTransaction.data.refundReceiver,
2520
+ asHex(safeTransaction.encodedSignatures())
2521
+ ];
2522
+ return toTxResult(
2523
+ this.runner,
2524
+ await this.write("execTransaction", args, { ...options, gasLimit }),
2525
+ options
2526
+ );
2527
+ }
2528
+ /**
2529
+ * Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract)
2530
+ * @returns Array[chainId]
2531
+ */
2532
+ async getChainId() {
2533
+ return [await Promise.resolve(this.chainId)];
2534
+ }
2535
+ /**
2536
+ * Checks whether a given Safe transaction can be executed successfully with no errors.
2537
+ * @param safeTransaction - The Safe transaction to check.
2538
+ * @param options - Optional transaction options.
2539
+ * @returns True, if the given transactions is valid.
2540
+ */
2541
+ async isValidTransaction(safeTransaction, options = {}) {
2542
+ try {
2543
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2544
+ "execTransaction",
2545
+ [
2546
+ safeTransaction.data.to,
2547
+ BigInt(safeTransaction.data.value),
2548
+ asHex(safeTransaction.data.data),
2549
+ safeTransaction.data.operation,
2550
+ BigInt(safeTransaction.data.safeTxGas),
2551
+ BigInt(safeTransaction.data.baseGas),
2552
+ BigInt(safeTransaction.data.gasPrice),
2553
+ safeTransaction.data.gasToken,
2554
+ safeTransaction.data.refundReceiver,
2555
+ asHex(safeTransaction.encodedSignatures())
2556
+ ],
2557
+ options
2558
+ );
2559
+ const converted = this.convertOptions({ ...options, gasLimit });
2560
+ const txResult = await (0, import_actions6.simulateContract)(this.runner, {
2561
+ address: this.contractAddress,
2562
+ functionName: "execTransaction",
2563
+ abi: this.contractAbi,
2564
+ args: [
2565
+ safeTransaction.data.to,
2566
+ BigInt(safeTransaction.data.value),
2567
+ asHex(safeTransaction.data.data),
2568
+ safeTransaction.data.operation,
2569
+ BigInt(safeTransaction.data.safeTxGas),
2570
+ BigInt(safeTransaction.data.baseGas),
2571
+ BigInt(safeTransaction.data.gasPrice),
2572
+ safeTransaction.data.gasToken,
2573
+ safeTransaction.data.refundReceiver,
2574
+ asHex(safeTransaction.encodedSignatures())
2575
+ ],
2576
+ ...converted
2577
+ });
2578
+ return txResult.result;
2579
+ } catch (error) {
2580
+ return false;
2581
+ }
2582
+ }
2583
+ /**
2584
+ * returns the nonce of the Safe contract.
2585
+ *
2586
+ * @returns {Promise<bigint>} A promise that resolves to the nonce of the Safe contract.
2587
+ */
2588
+ async getNonce() {
2589
+ const [nonce] = await this.nonce();
2590
+ return nonce;
2591
+ }
2592
+ };
2593
+ var SafeContract_v1_2_0_default = SafeContract_v1_2_0;
2594
+
2595
+ // src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts
2596
+ var import_actions7 = require("viem/actions");
2597
+ var import_types_kit14 = require("@safe-global/types-kit");
2598
+ var SafeContract_v1_3_0 = class extends SafeBaseContract_default {
2599
+ /**
2600
+ * Constructs an instance of SafeContract_v1_3_0
2601
+ *
2602
+ * @param chainId - The chain ID where the contract resides.
2603
+ * @param safeProvider - An instance of SafeProvider.
2604
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
2605
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
2606
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used.
2607
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
2608
+ */
2609
+ constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) {
2610
+ const safeVersion = "1.3.0";
2611
+ const defaultAbi = import_types_kit14.safe_1_3_0_ContractArtifacts.abi;
2612
+ super(
2613
+ chainId,
2614
+ safeProvider,
2615
+ defaultAbi,
2616
+ safeVersion,
2617
+ isL1SafeSingleton,
2618
+ customContractAddress,
2619
+ customContractAbi,
2620
+ deploymentType
2621
+ );
2622
+ /**
2623
+ * @returns Array[safeContractVersion]
2624
+ */
2625
+ this.VERSION = async () => {
2626
+ return [await this.read("VERSION")];
2627
+ };
2628
+ /**
2629
+ * @param args - Array[owner, txHash]
2630
+ * @returns Array[approvedHashes]
2631
+ */
2632
+ this.approvedHashes = async (args) => {
2633
+ return [await this.read("approvedHashes", args)];
2634
+ };
2635
+ /**
2636
+ * Checks whether the signature provided is valid for the provided data, hash and number of required signatures.
2637
+ * Will revert otherwise.
2638
+ * @param args - Array[dataHash, data, signatures, requiredSignatures]
2639
+ * @returns Empty array
2640
+ */
2641
+ this.checkNSignatures = async (args) => {
2642
+ await this.read("checkNSignatures", args);
2643
+ return [];
2644
+ };
2645
+ /**
2646
+ * Checks whether the signature provided is valid for the provided data and hash. Will revert otherwise.
2647
+ * @param args - Array[dataHash, data, signatures]
2648
+ * @returns Empty array
2649
+ */
2650
+ this.checkSignatures = async (args) => {
2651
+ await this.read("checkSignatures", args);
2652
+ return [];
2653
+ };
2654
+ /**
2655
+ * @returns Array[domainSeparator]
2656
+ */
2657
+ this.domainSeparator = async () => {
2658
+ return [await this.read("domainSeparator")];
2659
+ };
2660
+ /**
2661
+ * Encodes the data for a transaction to the Safe contract.
2662
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2663
+ * @returns Array[encodedData]
2664
+ */
2665
+ this.encodeTransactionData = async (args) => {
2666
+ return [await this.read("encodeTransactionData", args)];
2667
+ };
2668
+ /**
2669
+ * Returns array of modules.
2670
+ * @param args - Array[start, pageSize]
2671
+ * @returns Array[Array[modules], next]
2672
+ */
2673
+ this.getModulesPaginated = async (args) => {
2674
+ const [array, next] = await this.read("getModulesPaginated", args);
2675
+ return [array, next];
2676
+ };
2677
+ /**
2678
+ * Returns the list of Safe owner accounts.
2679
+ * @returns Array[Array[owners]]
2680
+ */
2681
+ this.getOwners = async () => {
2682
+ return [await this.read("getOwners")];
2683
+ };
2684
+ /**
2685
+ * Reads `length` bytes of storage in the currents contract
2686
+ * @param args - Array[offset, length]
2687
+ * @returns Array[storage]
2688
+ */
2689
+ this.getStorageAt = async (args) => {
2690
+ return [await this.read("getStorageAt", args)];
2691
+ };
2692
+ /**
2693
+ * Returns the Safe threshold.
2694
+ * @returns Array[threshold]
2695
+ */
2696
+ this.getThreshold = async () => {
2697
+ return [await this.read("getThreshold")];
2698
+ };
2699
+ /**
2700
+ * Returns hash to be signed by owners.
2701
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2702
+ * @returns Array[transactionHash]
2703
+ */
2704
+ this.getTransactionHash = async (args) => {
2705
+ return [await this.read("getTransactionHash", args)];
2706
+ };
2707
+ /**
2708
+ * Checks if a specific Safe module is enabled for the current Safe.
2709
+ * @param args - Array[moduleAddress]
2710
+ * @returns Array[isEnabled]
2711
+ */
2712
+ this.isModuleEnabled = async (args) => {
2713
+ return [await this.read("isModuleEnabled", args)];
2714
+ };
2715
+ /**
2716
+ * Checks if a specific address is an owner of the current Safe.
2717
+ * @param args - Array[address]
2718
+ * @returns Array[isOwner]
2719
+ */
2720
+ this.isOwner = async (args) => {
2721
+ return [await this.read("isOwner", args)];
2722
+ };
2723
+ /**
2724
+ * Returns the Safe nonce.
2725
+ * @returns Array[nonce]
2726
+ */
2727
+ this.nonce = async () => {
2728
+ return [await this.read("nonce")];
2729
+ };
2730
+ /**
2731
+ * @param args - Array[messageHash]
2732
+ * @returns Array[signedMessages]
2733
+ */
2734
+ this.signedMessages = async (args) => {
2735
+ return [await this.read("signedMessages", args)];
2736
+ };
2737
+ }
2738
+ /**
2739
+ * Checks whether a given Safe transaction can be executed successfully with no errors.
2740
+ * @param safeTransaction - The Safe transaction to check.
2741
+ * @param options - Optional transaction options.
2742
+ * @returns True, if the given transactions is valid.
2743
+ */
2744
+ async isValidTransaction(safeTransaction, options = {}) {
2745
+ try {
2746
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2747
+ "execTransaction",
2748
+ [
2749
+ safeTransaction.data.to,
2750
+ BigInt(safeTransaction.data.value),
2751
+ asHex(safeTransaction.data.data),
2752
+ safeTransaction.data.operation,
2753
+ BigInt(safeTransaction.data.safeTxGas),
2754
+ BigInt(safeTransaction.data.baseGas),
2755
+ BigInt(safeTransaction.data.gasPrice),
2756
+ safeTransaction.data.gasToken,
2757
+ safeTransaction.data.refundReceiver,
2758
+ asHex(safeTransaction.encodedSignatures())
2759
+ ],
2760
+ options
2761
+ );
2762
+ const converted = this.convertOptions({ ...options, gasLimit });
2763
+ const txResult = await (0, import_actions7.simulateContract)(this.runner, {
2764
+ address: this.contractAddress,
2765
+ functionName: "execTransaction",
2766
+ abi: this.contractAbi,
2767
+ args: [
2768
+ safeTransaction.data.to,
2769
+ BigInt(safeTransaction.data.value),
2770
+ asHex(safeTransaction.data.data),
2771
+ safeTransaction.data.operation,
2772
+ BigInt(safeTransaction.data.safeTxGas),
2773
+ BigInt(safeTransaction.data.baseGas),
2774
+ BigInt(safeTransaction.data.gasPrice),
2775
+ safeTransaction.data.gasToken,
2776
+ safeTransaction.data.refundReceiver,
2777
+ asHex(safeTransaction.encodedSignatures())
2778
+ ],
2779
+ ...converted
2780
+ });
2781
+ return txResult.result;
2782
+ } catch (error) {
2783
+ return false;
2784
+ }
2785
+ }
2786
+ /**
2787
+ * Executes a transaction.
2788
+ * @param safeTransaction - The Safe transaction to execute.
2789
+ * @param options - Transaction options.
2790
+ * @returns Transaction result.
2791
+ */
2792
+ async execTransaction(safeTransaction, options) {
2793
+ const gasLimit = options?.gasLimit || await this.estimateGas(
2794
+ "execTransaction",
2795
+ [
2796
+ safeTransaction.data.to,
2797
+ BigInt(safeTransaction.data.value),
2798
+ asHex(safeTransaction.data.data),
2799
+ safeTransaction.data.operation,
2800
+ BigInt(safeTransaction.data.safeTxGas),
2801
+ BigInt(safeTransaction.data.baseGas),
2802
+ BigInt(safeTransaction.data.gasPrice),
2803
+ safeTransaction.data.gasToken,
2804
+ safeTransaction.data.refundReceiver,
2805
+ asHex(safeTransaction.encodedSignatures())
2806
+ ],
2807
+ options
2808
+ );
2809
+ const args = [
2810
+ safeTransaction.data.to,
2811
+ BigInt(safeTransaction.data.value),
2812
+ asHex(safeTransaction.data.data),
2813
+ safeTransaction.data.operation,
2814
+ BigInt(safeTransaction.data.safeTxGas),
2815
+ BigInt(safeTransaction.data.baseGas),
2816
+ BigInt(safeTransaction.data.gasPrice),
2817
+ safeTransaction.data.gasToken,
2818
+ safeTransaction.data.refundReceiver,
2819
+ asHex(safeTransaction.encodedSignatures())
2820
+ ];
2821
+ return toTxResult(
2822
+ this.runner,
2823
+ await this.write("execTransaction", args, { ...options, gasLimit }),
2824
+ options
2825
+ );
2826
+ }
2827
+ /**
2828
+ * Returns array of first 10 modules.
2829
+ * @returns Array[modules]
2830
+ */
2831
+ async getModules() {
2832
+ const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]);
2833
+ return [modules.map((module2) => module2)];
2834
+ }
2835
+ /**
2836
+ * Marks a hash as approved. This can be used to validate a hash that is used by a signature.
2837
+ * @param hash - The hash that should be marked as approved for signatures that are verified by this contract.
2838
+ * @param options - Optional transaction options.
2839
+ * @returns Transaction result.
2840
+ */
2841
+ async approveHash(hash, options) {
2842
+ const gasLimit = options?.gasLimit || await this.estimateGas("approveHash", [asHash(hash)], options);
2843
+ return toTxResult(
2844
+ this.runner,
2845
+ await this.write("approveHash", [asHash(hash)], { ...options, gasLimit }),
2846
+ options
2847
+ );
2848
+ }
2849
+ /**
2850
+ * Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract)
2851
+ * @returns Array[chainId]
2852
+ */
2853
+ async getChainId() {
2854
+ return [await Promise.resolve(this.chainId)];
2855
+ }
2856
+ /**
2857
+ * returns the nonce of the Safe contract.
2858
+ *
2859
+ * @returns {Promise<bigint>} A promise that resolves to the nonce of the Safe contract.
2860
+ */
2861
+ async getNonce() {
2862
+ const [nonce] = await this.nonce();
2863
+ return nonce;
2864
+ }
2865
+ };
2866
+ var SafeContract_v1_3_0_default = SafeContract_v1_3_0;
2867
+
2868
+ // src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts
2869
+ var import_actions8 = require("viem/actions");
2870
+ var import_types_kit15 = require("@safe-global/types-kit");
2871
+ var SafeContract_v1_4_1 = class extends SafeBaseContract_default {
2872
+ /**
2873
+ * Constructs an instance of SafeContract_v1_4_1
2874
+ *
2875
+ * @param chainId - The chain ID where the contract resides.
2876
+ * @param safeProvider - An instance of SafeProvider.
2877
+ * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
2878
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
2879
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used.
2880
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
2881
+ */
2882
+ constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) {
2883
+ const safeVersion = "1.4.1";
2884
+ const defaultAbi = import_types_kit15.safe_1_4_1_ContractArtifacts.abi;
2885
+ super(
2886
+ chainId,
2887
+ safeProvider,
2888
+ defaultAbi,
2889
+ safeVersion,
2890
+ isL1SafeSingleton,
2891
+ customContractAddress,
2892
+ customContractAbi,
2893
+ deploymentType
2894
+ );
2895
+ /**
2896
+ * @returns Array[safeContractVersion]
2897
+ */
2898
+ this.VERSION = async () => {
2899
+ return [await this.read("VERSION")];
2900
+ };
2901
+ /**
2902
+ * @param args - Array[owner, txHash]
2903
+ * @returns Array[approvedHashes]
2904
+ */
2905
+ this.approvedHashes = async (args) => {
2906
+ return [await this.read("approvedHashes", args)];
2907
+ };
2908
+ /**
2909
+ * Checks whether the signature provided is valid for the provided data, hash and number of required signatures.
2910
+ * Will revert otherwise.
2911
+ * @param args - Array[dataHash, data, signatures, requiredSignatures]
2912
+ * @returns Empty array
2913
+ */
2914
+ this.checkNSignatures = async (args) => {
2915
+ await this.read("checkNSignatures", args);
2916
+ return [];
2917
+ };
2918
+ /**
2919
+ * Checks whether the signature provided is valid for the provided data and hash. Will revert otherwise.
2920
+ * @param args - Array[dataHash, data, signatures]
2921
+ * @returns Empty array
2922
+ */
2923
+ this.checkSignatures = async (args) => {
2924
+ await this.read("checkSignatures", args);
2925
+ return [];
2926
+ };
2927
+ /**
2928
+ * @returns Array[domainSeparator]
2929
+ */
2930
+ this.domainSeparator = async () => {
2931
+ return [await this.read("domainSeparator")];
2932
+ };
2933
+ /**
2934
+ * Encodes the data for a transaction to the Safe contract.
2935
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2936
+ * @returns Array[encodedData]
2937
+ */
2938
+ this.encodeTransactionData = async (args) => {
2939
+ return [await this.read("encodeTransactionData", args)];
2940
+ };
2941
+ /**
2942
+ * Returns array of modules.
2943
+ * @param args - Array[start, pageSize]
2944
+ * @returns Array[Array[modules], next]
2945
+ */
2946
+ this.getModulesPaginated = async (args) => {
2947
+ const [array, next] = await this.read("getModulesPaginated", args);
2948
+ return [array, next];
2949
+ };
2950
+ /**
2951
+ * Returns the list of Safe owner accounts.
2952
+ * @returns Array[Array[owners]]
2953
+ */
2954
+ this.getOwners = async () => {
2955
+ return [await this.read("getOwners")];
2956
+ };
2957
+ /**
2958
+ * Reads `length` bytes of storage in the currents contract
2959
+ * @param args - Array[offset, length]
2960
+ * @returns Array[storage]
2961
+ */
2962
+ this.getStorageAt = async (args) => {
2963
+ return [await this.read("getStorageAt", args)];
2964
+ };
2965
+ /**
2966
+ * Returns the Safe threshold.
2967
+ * @returns Array[threshold]
2968
+ */
2969
+ this.getThreshold = async () => {
2970
+ return [await this.read("getThreshold")];
2971
+ };
2972
+ /**
2973
+ * Returns hash to be signed by owners.
2974
+ * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce]
2975
+ * @returns Array[transactionHash]
2976
+ */
2977
+ this.getTransactionHash = async (args) => {
2978
+ return [await this.read("getTransactionHash", args)];
2979
+ };
2980
+ /**
2981
+ * Checks if a specific Safe module is enabled for the current Safe.
2982
+ * @param args - Array[moduleAddress]
2983
+ * @returns Array[isEnabled]
2984
+ */
2985
+ this.isModuleEnabled = async (args) => {
2986
+ return [await this.read("isModuleEnabled", args)];
2987
+ };
2988
+ /**
2989
+ * Checks if a specific address is an owner of the current Safe.
2990
+ * @param args - Array[address]
2991
+ * @returns Array[isOwner]
2992
+ */
2993
+ this.isOwner = async (args) => {
2994
+ return [await this.read("isOwner", args)];
2995
+ };
2996
+ /**
2997
+ * Returns the Safe nonce.
2998
+ * @returns Array[nonce]
2999
+ */
3000
+ this.nonce = async () => {
3001
+ return [await this.read("nonce")];
3002
+ };
3003
+ /**
3004
+ * @param args - Array[messageHash]
3005
+ * @returns Array[signedMessages]
3006
+ */
3007
+ this.signedMessages = async (args) => {
3008
+ return [await this.read("signedMessages", args)];
3009
+ };
3010
+ }
3011
+ /**
3012
+ * Checks whether a given Safe transaction can be executed successfully with no errors.
3013
+ * @param safeTransaction - The Safe transaction to check.
3014
+ * @param options - Optional transaction options.
3015
+ * @returns True, if the given transactions is valid.
3016
+ */
3017
+ async isValidTransaction(safeTransaction, options = {}) {
3018
+ try {
3019
+ const gasLimit = options?.gasLimit || await this.estimateGas(
3020
+ "execTransaction",
3021
+ [
3022
+ safeTransaction.data.to,
3023
+ BigInt(safeTransaction.data.value),
3024
+ asHex(safeTransaction.data.data),
3025
+ safeTransaction.data.operation,
3026
+ BigInt(safeTransaction.data.safeTxGas),
3027
+ BigInt(safeTransaction.data.baseGas),
3028
+ BigInt(safeTransaction.data.gasPrice),
3029
+ safeTransaction.data.gasToken,
3030
+ safeTransaction.data.refundReceiver,
3031
+ asHex(safeTransaction.encodedSignatures())
3032
+ ],
3033
+ options
3034
+ );
3035
+ const converted = this.convertOptions({ ...options, gasLimit });
3036
+ const txResult = await (0, import_actions8.simulateContract)(this.runner, {
3037
+ address: this.contractAddress,
3038
+ functionName: "execTransaction",
3039
+ abi: this.contractAbi,
3040
+ args: [
3041
+ safeTransaction.data.to,
3042
+ BigInt(safeTransaction.data.value),
3043
+ asHex(safeTransaction.data.data),
3044
+ safeTransaction.data.operation,
3045
+ BigInt(safeTransaction.data.safeTxGas),
3046
+ BigInt(safeTransaction.data.baseGas),
3047
+ BigInt(safeTransaction.data.gasPrice),
3048
+ safeTransaction.data.gasToken,
3049
+ safeTransaction.data.refundReceiver,
3050
+ asHex(safeTransaction.encodedSignatures())
3051
+ ],
3052
+ ...converted
3053
+ });
3054
+ return txResult.result;
3055
+ } catch (error) {
3056
+ return false;
3057
+ }
3058
+ }
3059
+ /**
3060
+ * Executes a transaction.
3061
+ * @param safeTransaction - The Safe transaction to execute.
3062
+ * @param options - Transaction options.
3063
+ * @returns Transaction result.
3064
+ */
3065
+ async execTransaction(safeTransaction, options) {
3066
+ const gasLimit = options?.gasLimit || await this.estimateGas(
3067
+ "execTransaction",
3068
+ [
3069
+ safeTransaction.data.to,
3070
+ BigInt(safeTransaction.data.value),
3071
+ asHex(safeTransaction.data.data),
3072
+ safeTransaction.data.operation,
3073
+ BigInt(safeTransaction.data.safeTxGas),
3074
+ BigInt(safeTransaction.data.baseGas),
3075
+ BigInt(safeTransaction.data.gasPrice),
3076
+ safeTransaction.data.gasToken,
3077
+ safeTransaction.data.refundReceiver,
3078
+ asHex(safeTransaction.encodedSignatures())
3079
+ ],
3080
+ options
3081
+ );
3082
+ const args = [
3083
+ safeTransaction.data.to,
3084
+ BigInt(safeTransaction.data.value),
3085
+ asHex(safeTransaction.data.data),
3086
+ safeTransaction.data.operation,
3087
+ BigInt(safeTransaction.data.safeTxGas),
3088
+ BigInt(safeTransaction.data.baseGas),
3089
+ BigInt(safeTransaction.data.gasPrice),
3090
+ safeTransaction.data.gasToken,
3091
+ safeTransaction.data.refundReceiver,
3092
+ asHex(safeTransaction.encodedSignatures())
3093
+ ];
3094
+ return toTxResult(
3095
+ this.runner,
3096
+ await this.write("execTransaction", args, { ...options, gasLimit }),
3097
+ options
3098
+ );
3099
+ }
3100
+ /**
3101
+ * Returns array of first 10 modules.
3102
+ * @returns Array[modules]
3103
+ */
3104
+ async getModules() {
3105
+ const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]);
3106
+ return [modules.map((module2) => module2)];
3107
+ }
3108
+ /**
3109
+ * Marks a hash as approved. This can be used to validate a hash that is used by a signature.
3110
+ * @param hash - The hash that should be marked as approved for signatures that are verified by this contract.
3111
+ * @param options - Optional transaction options.
3112
+ * @returns Transaction result.
3113
+ */
3114
+ async approveHash(hash, options) {
3115
+ const gasLimit = options?.gasLimit || await this.estimateGas("approveHash", [asHash(hash)], options);
3116
+ return toTxResult(
3117
+ this.runner,
3118
+ await this.write("approveHash", [asHash(hash)], { ...options, gasLimit }),
3119
+ options
3120
+ );
3121
+ }
3122
+ /**
3123
+ * Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract)
3124
+ * @returns Array[chainId]
3125
+ */
3126
+ async getChainId() {
3127
+ return [await Promise.resolve(this.chainId)];
3128
+ }
3129
+ /**
3130
+ * returns the nonce of the Safe contract.
3131
+ *
3132
+ * @returns {Promise<bigint>} A promise that resolves to the nonce of the Safe contract.
3133
+ */
3134
+ async getNonce() {
3135
+ const [nonce] = await this.nonce();
3136
+ return nonce;
3137
+ }
3138
+ };
3139
+ var SafeContract_v1_4_1_default = SafeContract_v1_4_1;
3140
+
3141
+ // src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts
3142
+ var SafeProxyFactoryBaseContract = class extends BaseContract_default {
3143
+ /**
3144
+ * @constructor
3145
+ * Constructs an instance of SafeProxyFactoryBaseContract.
3146
+ *
3147
+ * @param chainId - The chain ID of the contract.
3148
+ * @param safeProvider - An instance of SafeProvider.
3149
+ * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract.
3150
+ * @param safeVersion - The version of the Safe contract.
3151
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3152
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
3153
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3154
+ */
3155
+ constructor(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3156
+ const contractName3 = "safeProxyFactoryVersion";
3157
+ super(
3158
+ contractName3,
3159
+ chainId,
3160
+ safeProvider,
3161
+ defaultAbi,
3162
+ safeVersion,
3163
+ customContractAddress,
3164
+ customContractAbi,
3165
+ deploymentType
3166
+ );
3167
+ this.contractName = contractName3;
3168
+ }
3169
+ };
3170
+ var SafeProxyFactoryBaseContract_default = SafeProxyFactoryBaseContract;
3171
+
3172
+ // src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts
3173
+ var import_types_kit16 = require("@safe-global/types-kit");
3174
+ var SafeProxyFactoryContract_v1_0_0 = class extends SafeProxyFactoryBaseContract_default {
3175
+ /**
3176
+ * Constructs an instance of SafeProxyFactoryContract_v1_0_0
3177
+ *
3178
+ * @param chainId - The chain ID where the contract resides.
3179
+ * @param safeProvider - An instance of SafeProvider.
3180
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3181
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used.
3182
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3183
+ */
3184
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3185
+ const safeVersion = "1.0.0";
3186
+ const defaultAbi = import_types_kit16.safeProxyFactory_1_0_0_ContractArtifacts.abi;
3187
+ super(
3188
+ chainId,
3189
+ safeProvider,
3190
+ defaultAbi,
3191
+ safeVersion,
3192
+ customContractAddress,
3193
+ customContractAbi,
3194
+ deploymentType
3195
+ );
3196
+ /**
3197
+ * Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
3198
+ * @returns Array[creationCode]
3199
+ */
3200
+ this.proxyCreationCode = async () => {
3201
+ return [await this.read("proxyCreationCode")];
3202
+ };
3203
+ /**
3204
+ * Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
3205
+ * @returns Array[runtimeCode]
3206
+ */
3207
+ this.proxyRuntimeCode = async () => {
3208
+ return [await this.read("proxyRuntimeCode")];
3209
+ };
3210
+ /**
3211
+ * Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
3212
+ * @param args - Array[masterCopy, data]
3213
+ * @returns Array[proxyAddress]
3214
+ */
3215
+ this.createProxy = async (args) => {
3216
+ return [await this.write("createProxy", args)];
3217
+ };
3218
+ /**
3219
+ * Allows to create new proxy contract and execute a message call to the new proxy within one transaction.
3220
+ * @param args - Array[masterCopy, initializer, saltNonce]
3221
+ * @returns Array[proxyAddress]
3222
+ */
3223
+ this.createProxyWithNonce = async (args) => {
3224
+ return [await this.write("createProxyWithNonce", args)];
3225
+ };
3226
+ }
3227
+ };
3228
+ var SafeProxyFactoryContract_v1_0_0_default = SafeProxyFactoryContract_v1_0_0;
3229
+
3230
+ // src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts
3231
+ var import_types_kit17 = require("@safe-global/types-kit");
3232
+ var SafeProxyFactoryContract_v1_1_1 = class extends SafeProxyFactoryBaseContract_default {
3233
+ /**
3234
+ * Constructs an instance of SafeProxyFactoryContract_v1_1_1
3235
+ *
3236
+ * @param chainId - The chain ID where the contract resides.
3237
+ * @param safeProvider - An instance of SafeProvider.
3238
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3239
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used.
3240
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3241
+ */
3242
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3243
+ const safeVersion = "1.1.1";
3244
+ const defaultAbi = import_types_kit17.safeProxyFactory_1_1_1_ContractArtifacts.abi;
3245
+ super(
3246
+ chainId,
3247
+ safeProvider,
3248
+ defaultAbi,
3249
+ safeVersion,
3250
+ customContractAddress,
3251
+ customContractAbi,
3252
+ deploymentType
3253
+ );
3254
+ /**
3255
+ * Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
3256
+ * @returns Array[creationCode]
3257
+ */
3258
+ this.proxyCreationCode = async () => {
3259
+ return [await this.read("proxyCreationCode")];
3260
+ };
3261
+ /**
3262
+ * Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
3263
+ * @returns Array[runtimeCode]
3264
+ */
3265
+ this.proxyRuntimeCode = async () => {
3266
+ return [await this.read("proxyRuntimeCode")];
3267
+ };
3268
+ /**
3269
+ * Allows to get the address for a new proxy contact created via `createProxyWithNonce`.
3270
+ * @param args - Array[masterCopy, initializer, saltNonceBigInt]
3271
+ * @returns Array[proxyAddress]
3272
+ */
3273
+ this.calculateCreateProxyWithNonceAddress = async (args) => {
3274
+ return [await this.write("calculateCreateProxyWithNonceAddress", args)];
3275
+ };
3276
+ /**
3277
+ * Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
3278
+ * @param args - Array[masterCopy, data]
3279
+ * @returns Array[proxyAddress]
3280
+ */
3281
+ this.createProxy = async (args) => {
3282
+ return [await this.write("createProxy", args)];
3283
+ };
3284
+ /**
3285
+ * Allows to create new proxy contract, execute a message call to the new proxy and call a specified callback within one transaction.
3286
+ * @param args - Array[masterCopy, initializer, saltNonce, callback]
3287
+ * @returns Array[proxyAddress]
3288
+ */
3289
+ this.createProxyWithCallback = async (args) => {
3290
+ return [await this.write("createProxyWithCallback", args)];
3291
+ };
3292
+ /**
3293
+ * Allows to create new proxy contract and execute a message call to the new proxy within one transaction.
3294
+ * @param args - Array[masterCopy, initializer, saltNonce]
3295
+ * @returns Array[proxyAddress]
3296
+ */
3297
+ this.createProxyWithNonce = async (args) => {
3298
+ return [await this.write("createProxyWithNonce", args)];
3299
+ };
3300
+ }
3301
+ };
3302
+ var SafeProxyFactoryContract_v1_1_1_default = SafeProxyFactoryContract_v1_1_1;
3303
+
3304
+ // src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts
3305
+ var import_types_kit18 = require("@safe-global/types-kit");
3306
+ var SafeProxyFactoryContract_v1_3_0 = class extends SafeProxyFactoryBaseContract_default {
3307
+ /**
3308
+ * Constructs an instance of SafeProxyFactoryContract_v1_3_0
3309
+ *
3310
+ * @param chainId - The chain ID where the contract resides.
3311
+ * @param safeProvider - An instance of SafeProvider.
3312
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3313
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used.
3314
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3315
+ */
3316
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3317
+ const safeVersion = "1.3.0";
3318
+ const defaultAbi = import_types_kit18.safeProxyFactory_1_3_0_ContractArtifacts.abi;
3319
+ super(
3320
+ chainId,
3321
+ safeProvider,
3322
+ defaultAbi,
3323
+ safeVersion,
3324
+ customContractAddress,
3325
+ customContractAbi,
3326
+ deploymentType
3327
+ );
3328
+ /**
3329
+ * Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
3330
+ * @returns Array[creationCode]
3331
+ */
3332
+ this.proxyCreationCode = async () => {
3333
+ return [await this.read("proxyCreationCode")];
3334
+ };
3335
+ /**
3336
+ * Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
3337
+ * @returns Array[runtimeCode]
3338
+ */
3339
+ this.proxyRuntimeCode = async () => {
3340
+ return [await this.read("proxyRuntimeCode")];
3341
+ };
3342
+ /**
3343
+ * Allows to get the address for a new proxy contact created via `createProxyWithNonce`.
3344
+ * @param args - Array[singleton, initializer, saltNonce]
3345
+ * @returns Array[proxyAddress]
3346
+ */
3347
+ this.calculateCreateProxyWithNonceAddress = async (args) => {
3348
+ return [await this.write("calculateCreateProxyWithNonceAddress", args)];
3349
+ };
3350
+ /**
3351
+ * Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
3352
+ * @param args - Array[singleton, data]
3353
+ * @returns Array[proxyAddress]
3354
+ */
3355
+ this.createProxy = async (args) => {
3356
+ return [await this.write("createProxy", args)];
3357
+ };
3358
+ /**
3359
+ * Allows to create new proxy contract, execute a message call to the new proxy and call a specified callback within one transaction.
3360
+ * @param args - Array[singleton, initializer, saltNonce, callback]
3361
+ * @returns Array[proxyAddress]
3362
+ */
3363
+ this.createProxyWithCallback = async (args) => {
3364
+ return [await this.write("createProxyWithCallback", args)];
3365
+ };
3366
+ /**
3367
+ * Allows to create new proxy contract and execute a message call to the new proxy within one transaction.
3368
+ * @param args - Array[singleton, initializer, saltNonce]
3369
+ * @returns Array[proxyAddress]
3370
+ */
3371
+ this.createProxyWithNonce = async (args) => {
3372
+ return [await this.write("createProxyWithNonce", args)];
3373
+ };
3374
+ }
3375
+ };
3376
+ var SafeProxyFactoryContract_v1_3_0_default = SafeProxyFactoryContract_v1_3_0;
3377
+
3378
+ // src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts
3379
+ var import_types_kit19 = require("@safe-global/types-kit");
3380
+ var SafeProxyFactoryContract_v1_4_1 = class extends SafeProxyFactoryBaseContract_default {
3381
+ /**
3382
+ * Constructs an instance of SafeProxyFactoryContract_v1_4_1
3383
+ *
3384
+ * @param chainId - The chain ID where the contract resides.
3385
+ * @param safeProvider - An instance of SafeProvider.
3386
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3387
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used.
3388
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3389
+ */
3390
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3391
+ const safeVersion = "1.4.1";
3392
+ const defaultAbi = import_types_kit19.safeProxyFactory_1_4_1_ContractArtifacts.abi;
3393
+ super(
3394
+ chainId,
3395
+ safeProvider,
3396
+ defaultAbi,
3397
+ safeVersion,
3398
+ customContractAddress,
3399
+ customContractAbi,
3400
+ deploymentType
3401
+ );
3402
+ /**
3403
+ * Returns the ID of the chain the contract is currently deployed on.
3404
+ * @returns Array[chainId]
3405
+ */
3406
+ this.getChainId = async () => {
3407
+ return [await this.read("getChainId")];
3408
+ };
3409
+ /**
3410
+ * Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
3411
+ * @returns Array[creationCode]
3412
+ */
3413
+ this.proxyCreationCode = async () => {
3414
+ return [await this.read("proxyCreationCode")];
3415
+ };
3416
+ /**
3417
+ * Deploys a new chain-specific proxy with singleton and salt. Optionally executes an initializer call to a new proxy.
3418
+ * @param args - Array[singleton, initializer, saltNonce]
3419
+ * @returns Array[proxy]
3420
+ */
3421
+ this.createChainSpecificProxyWithNonce = async (args) => {
3422
+ return [await this.write("createChainSpecificProxyWithNonce", args)];
3423
+ };
3424
+ /**
3425
+ * Deploy a new proxy with singleton and salt.
3426
+ * Optionally executes an initializer call to a new proxy and calls a specified callback address.
3427
+ * @param args - Array[singleton, initializer, saltNonce, callback]
3428
+ * @returns Array[proxy]
3429
+ */
3430
+ this.createProxyWithCallback = async (args) => {
3431
+ return [await this.write("createProxyWithCallback", args)];
3432
+ };
3433
+ /**
3434
+ * Deploys a new proxy with singleton and salt. Optionally executes an initializer call to a new proxy.
3435
+ * @param args - Array[singleton, initializer, saltNonce]
3436
+ * @returns Array[proxy]
3437
+ */
3438
+ this.createProxyWithNonce = async (args) => {
3439
+ return [await this.write("createProxyWithNonce", args)];
3440
+ };
3441
+ }
3442
+ };
3443
+ var SafeProxyFactoryContract_v1_4_1_default = SafeProxyFactoryContract_v1_4_1;
3444
+
3445
+ // src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts
3446
+ var import_types_kit20 = require("@safe-global/types-kit");
3447
+
3448
+ // src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts
3449
+ var import_types_kit21 = require("@safe-global/types-kit");
3450
+
3451
+ // src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts
3452
+ var CompatibilityFallbackHandlerBaseContract = class extends BaseContract_default {
3453
+ /**
3454
+ * @constructor
3455
+ * Constructs an instance of CompatibilityFallbackHandlerBaseContract.
3456
+ *
3457
+ * @param chainId - The chain ID of the contract.
3458
+ * @param safeProvider - An instance of SafeProvider.
3459
+ * @param defaultAbi - The default ABI for the CompatibilityFallbackHandler contract. It should be compatible with the specific version of the contract.
3460
+ * @param safeVersion - The version of the Safe contract.
3461
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3462
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
3463
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3464
+ */
3465
+ constructor(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3466
+ const contractName3 = "compatibilityFallbackHandler";
3467
+ super(
3468
+ contractName3,
3469
+ chainId,
3470
+ safeProvider,
3471
+ defaultAbi,
3472
+ safeVersion,
3473
+ customContractAddress,
3474
+ customContractAbi,
3475
+ deploymentType
3476
+ );
3477
+ this.contractName = contractName3;
3478
+ }
3479
+ };
3480
+ var CompatibilityFallbackHandlerBaseContract_default = CompatibilityFallbackHandlerBaseContract;
3481
+
3482
+ // src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts
3483
+ var import_types_kit22 = require("@safe-global/types-kit");
3484
+ var CompatibilityFallbackHandlerContract_v1_3_0 = class extends CompatibilityFallbackHandlerBaseContract_default {
3485
+ /**
3486
+ * Constructs an instance of CompatibilityFallbackHandlerContract_v1_3_0
3487
+ *
3488
+ * @param chainId - The chain ID where the contract resides.
3489
+ * @param safeProvider - An instance of SafeProvider.
3490
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion.
3491
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used.
3492
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3493
+ */
3494
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3495
+ const safeVersion = "1.3.0";
3496
+ const defaultAbi = import_types_kit22.compatibilityFallbackHandler_1_3_0_ContractArtifacts.abi;
3497
+ super(
3498
+ chainId,
3499
+ safeProvider,
3500
+ defaultAbi,
3501
+ safeVersion,
3502
+ customContractAddress,
3503
+ customContractAbi,
3504
+ deploymentType
3505
+ );
3506
+ }
3507
+ };
3508
+ var CompatibilityFallbackHandlerContract_v1_3_0_default = CompatibilityFallbackHandlerContract_v1_3_0;
3509
+
3510
+ // src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts
3511
+ var import_types_kit23 = require("@safe-global/types-kit");
3512
+ var CompatibilityFallbackHandlerContract_v1_4_1 = class extends CompatibilityFallbackHandlerBaseContract_default {
3513
+ /**
3514
+ * Constructs an instance of CompatibilityFallbackHandlerContract_v1_4_1
3515
+ *
3516
+ * @param chainId - The chain ID where the contract resides.
3517
+ * @param safeProvider - An instance of SafeProvider.
3518
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion.
3519
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used.
3520
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3521
+ */
3522
+ constructor(chainId, safeProvider, customContractAddress, customContractAbi, deploymentType) {
3523
+ const safeVersion = "1.4.1";
3524
+ const defaultAbi = import_types_kit23.compatibilityFallbackHandler_1_4_1_ContractArtifacts.abi;
3525
+ super(
3526
+ chainId,
3527
+ safeProvider,
3528
+ defaultAbi,
3529
+ safeVersion,
3530
+ customContractAddress,
3531
+ customContractAbi,
3532
+ deploymentType
3533
+ );
3534
+ }
3535
+ };
3536
+ var CompatibilityFallbackHandlerContract_v1_4_1_default = CompatibilityFallbackHandlerContract_v1_4_1;
3537
+
3538
+ // src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.ts
3539
+ var SafeWebAuthnSignerFactoryBaseContract = class extends BaseContract_default {
3540
+ /**
3541
+ * @constructor
3542
+ * Constructs an instance of SafeWebAuthnSignerFactoryBaseContract.
3543
+ *
3544
+ * @param chainId - The chain ID of the contract.
3545
+ * @param safeProvider - An instance of SafeProvider.
3546
+ * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract.
3547
+ * @param safeVersion - The version of the Safe contract.
3548
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3549
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
3550
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3551
+ */
3552
+ constructor(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3553
+ const contractName3 = "safeWebAuthnSignerFactoryVersion";
3554
+ super(
3555
+ contractName3,
3556
+ chainId,
3557
+ safeProvider,
3558
+ defaultAbi,
3559
+ safeVersion,
3560
+ customContractAddress,
3561
+ customContractAbi,
3562
+ deploymentType
3563
+ );
3564
+ this.contractName = contractName3;
3565
+ }
3566
+ };
3567
+ var SafeWebAuthnSignerFactoryBaseContract_default = SafeWebAuthnSignerFactoryBaseContract;
3568
+
3569
+ // src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.ts
3570
+ var import_types_kit24 = require("@safe-global/types-kit");
3571
+ var SafeWebAuthnSignerFactoryContract_v0_2_1 = class extends SafeWebAuthnSignerFactoryBaseContract_default {
3572
+ /**
3573
+ * Constructs an instance of SafeWebAuthnSignerFactoryContract_v0_2_1
3574
+ *
3575
+ * @param chainId - The chain ID where the contract resides.
3576
+ * @param safeProvider - An instance of SafeProvider.
3577
+ * @param safeVersion - The version of the Safe contract.
3578
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3579
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 0.2.1 is used.
3580
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3581
+ */
3582
+ constructor(chainId, safeProvider, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3583
+ const defaultAbi = import_types_kit24.SafeWebAuthnSignerFactory_0_2_1_ContractArtifacts.abi;
3584
+ super(
3585
+ chainId,
3586
+ safeProvider,
3587
+ defaultAbi,
3588
+ safeVersion,
3589
+ customContractAddress,
3590
+ customContractAbi,
3591
+ deploymentType
3592
+ );
3593
+ /**
3594
+ * Returns the address of the Signer.
3595
+ * @param args - Array[x, y, verifiers]
3596
+ * @returns Array[signer]
3597
+ */
3598
+ this.getSigner = async (args) => {
3599
+ return [await this.read("getSigner", args)];
3600
+ };
3601
+ /**
3602
+ * Returns the address of the Signer and deploy the signer contract if its not deployed yet.
3603
+ * @param args - Array[x, y, verifiers]
3604
+ * @returns Array[signer]
3605
+ */
3606
+ this.createSigner = async (args) => {
3607
+ return [await this.write("createSigner", args)];
3608
+ };
3609
+ this.isValidSignatureForSigner = async (args) => {
3610
+ return [await this.read("isValidSignatureForSigner", args)];
3611
+ };
3612
+ }
3613
+ };
3614
+ var SafeWebAuthnSignerFactoryContract_v0_2_1_default = SafeWebAuthnSignerFactoryContract_v0_2_1;
3615
+
3616
+ // src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.ts
3617
+ var SafeWebAuthnSharedSignerBaseContract = class extends BaseContract_default {
3618
+ /**
3619
+ * @constructor
3620
+ * Constructs an instance of SafeWebAuthnSharedSignerBaseContract.
3621
+ *
3622
+ * @param chainId - The chain ID of the contract.
3623
+ * @param safeProvider - An instance of SafeProvider.
3624
+ * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract.
3625
+ * @param safeVersion - The version of the Safe contract.
3626
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3627
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used.
3628
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3629
+ */
3630
+ constructor(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3631
+ const contractName3 = "safeWebAuthnSharedSignerVersion";
3632
+ super(
3633
+ contractName3,
3634
+ chainId,
3635
+ safeProvider,
3636
+ defaultAbi,
3637
+ safeVersion,
3638
+ customContractAddress,
3639
+ customContractAbi,
3640
+ deploymentType
3641
+ );
3642
+ this.contractName = contractName3;
3643
+ }
3644
+ };
3645
+ var SafeWebAuthnSharedSignerBaseContract_default = SafeWebAuthnSharedSignerBaseContract;
3646
+
3647
+ // src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.ts
3648
+ var import_types_kit25 = require("@safe-global/types-kit");
3649
+ var SafeWebAuthnSharedSignerContract_v0_2_1 = class extends SafeWebAuthnSharedSignerBaseContract_default {
3650
+ /**
3651
+ * Constructs an instance of SafeWebAuthnSharedSignerContract_v0_2_1
3652
+ *
3653
+ * @param chainId - The chain ID where the contract resides.
3654
+ * @param safeProvider - An instance of SafeProvider.
3655
+ * @param safeVersion - The version of the Safe contract.
3656
+ * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
3657
+ * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 0.2.1 is used.
3658
+ * @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
3659
+ */
3660
+ constructor(chainId, safeProvider, safeVersion, customContractAddress, customContractAbi, deploymentType) {
3661
+ const defaultAbi = import_types_kit25.SafeWebAuthnSharedSigner_0_2_1_ContractArtifacts.abi;
3662
+ super(
3663
+ chainId,
3664
+ safeProvider,
3665
+ defaultAbi,
3666
+ safeVersion,
3667
+ customContractAddress,
3668
+ customContractAbi,
3669
+ deploymentType
3670
+ );
3671
+ /**
3672
+ * Return the signer configuration for the specified account.
3673
+ * @param args - Array[address]
3674
+ * @returns Array[signer]
3675
+ */
3676
+ this.getConfiguration = async (args) => {
3677
+ return [await this.read("getConfiguration", args)];
3678
+ };
3679
+ /**
3680
+ * Sets the signer configuration for the calling account.
3681
+ * @param args - Array[signer]
3682
+ * @returns Array[]
3683
+ */
3684
+ this.configure = async (args) => {
3685
+ await this.write("configure", args);
3686
+ return [];
3687
+ };
3688
+ this.isValidSignature = async (args) => {
3689
+ return [await this.read("isValidSignature", args)];
3690
+ };
3691
+ /**
3692
+ * @returns The starting storage slot on the account containing the signer data.
3693
+ */
3694
+ this.SIGNER_SLOT = async () => {
3695
+ return [await this.read("SIGNER_SLOT")];
3696
+ };
3697
+ }
3698
+ };
3699
+ var SafeWebAuthnSharedSignerContract_v0_2_1_default = SafeWebAuthnSharedSignerContract_v0_2_1;
3700
+
3701
+ // src/contracts/contractInstances.ts
3702
+ async function getSafeContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, isL1SafeSingleton, deploymentType) {
3703
+ const chainId = await safeProvider.getChainId();
3704
+ let safeContractInstance;
3705
+ switch (safeVersion) {
3706
+ case "1.4.1":
3707
+ safeContractInstance = new SafeContract_v1_4_1_default(
3708
+ chainId,
3709
+ safeProvider,
3710
+ isL1SafeSingleton,
3711
+ contractAddress,
3712
+ customContractAbi,
3713
+ deploymentType
3714
+ );
3715
+ break;
3716
+ case "1.3.0":
3717
+ safeContractInstance = new SafeContract_v1_3_0_default(
3718
+ chainId,
3719
+ safeProvider,
3720
+ isL1SafeSingleton,
3721
+ contractAddress,
3722
+ customContractAbi,
3723
+ deploymentType
3724
+ );
3725
+ break;
3726
+ case "1.2.0":
3727
+ safeContractInstance = new SafeContract_v1_2_0_default(
3728
+ chainId,
3729
+ safeProvider,
3730
+ isL1SafeSingleton,
3731
+ contractAddress,
3732
+ customContractAbi,
3733
+ deploymentType
3734
+ );
3735
+ break;
3736
+ case "1.1.1":
3737
+ safeContractInstance = new SafeContract_v1_1_1_default(
3738
+ chainId,
3739
+ safeProvider,
3740
+ isL1SafeSingleton,
3741
+ contractAddress,
3742
+ customContractAbi,
3743
+ deploymentType
3744
+ );
3745
+ break;
3746
+ case "1.0.0":
3747
+ safeContractInstance = new SafeContract_v1_0_0_default(
3748
+ chainId,
3749
+ safeProvider,
3750
+ isL1SafeSingleton,
3751
+ contractAddress,
3752
+ customContractAbi,
3753
+ deploymentType
3754
+ );
3755
+ break;
3756
+ default:
3757
+ throw new Error("Invalid Safe version");
3758
+ }
3759
+ await safeContractInstance.init();
3760
+ return safeContractInstance;
3761
+ }
3762
+ async function getCompatibilityFallbackHandlerContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, deploymentType) {
3763
+ const chainId = await safeProvider.getChainId();
3764
+ let compatibilityFallbackHandlerInstance;
3765
+ switch (safeVersion) {
3766
+ case "1.4.1":
3767
+ compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_4_1_default(
3768
+ chainId,
3769
+ safeProvider,
3770
+ contractAddress,
3771
+ customContractAbi,
3772
+ deploymentType
3773
+ );
3774
+ break;
3775
+ case "1.3.0":
3776
+ case "1.2.0":
3777
+ case "1.1.1":
3778
+ compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_3_0_default(
3779
+ chainId,
3780
+ safeProvider,
3781
+ contractAddress,
3782
+ customContractAbi,
3783
+ deploymentType
3784
+ );
3785
+ break;
3786
+ default:
3787
+ throw new Error("Invalid Safe version");
3788
+ }
3789
+ await compatibilityFallbackHandlerInstance.init();
3790
+ return compatibilityFallbackHandlerInstance;
3791
+ }
3792
+ async function getSafeProxyFactoryContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, deploymentType) {
3793
+ const chainId = await safeProvider.getChainId();
3794
+ let safeProxyFactoryContractInstance;
3795
+ switch (safeVersion) {
3796
+ case "1.4.1":
3797
+ safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_4_1_default(
3798
+ chainId,
3799
+ safeProvider,
3800
+ contractAddress,
3801
+ customContractAbi,
3802
+ deploymentType
3803
+ );
3804
+ break;
3805
+ case "1.3.0":
3806
+ safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_3_0_default(
3807
+ chainId,
3808
+ safeProvider,
3809
+ contractAddress,
3810
+ customContractAbi,
3811
+ deploymentType
3812
+ );
3813
+ break;
3814
+ case "1.2.0":
3815
+ case "1.1.1":
3816
+ safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_1_1_default(
3817
+ chainId,
3818
+ safeProvider,
3819
+ contractAddress,
3820
+ customContractAbi,
3821
+ deploymentType
3822
+ );
3823
+ break;
3824
+ case "1.0.0":
3825
+ safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_0_0_default(
3826
+ chainId,
3827
+ safeProvider,
3828
+ contractAddress,
3829
+ customContractAbi,
3830
+ deploymentType
3831
+ );
3832
+ break;
3833
+ default:
3834
+ throw new Error("Invalid Safe version");
3835
+ }
3836
+ await safeProxyFactoryContractInstance.init();
3837
+ return safeProxyFactoryContractInstance;
3838
+ }
3839
+ async function getSafeWebAuthnSignerFactoryContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, deploymentType) {
3840
+ const chainId = await safeProvider.getChainId();
3841
+ switch (safeVersion) {
3842
+ case "1.4.1":
3843
+ case "1.3.0":
3844
+ const safeWebAuthnSignerFactoryContractInstance = new SafeWebAuthnSignerFactoryContract_v0_2_1_default(
3845
+ chainId,
3846
+ safeProvider,
3847
+ safeVersion,
3848
+ contractAddress,
3849
+ customContractAbi,
3850
+ deploymentType
3851
+ );
3852
+ await safeWebAuthnSignerFactoryContractInstance.init();
3853
+ return safeWebAuthnSignerFactoryContractInstance;
3854
+ default:
3855
+ throw new Error("Invalid Safe version");
3856
+ }
3857
+ }
3858
+ async function getSafeWebAuthnSharedSignerContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, deploymentType) {
3859
+ const chainId = await safeProvider.getChainId();
3860
+ switch (safeVersion) {
3861
+ case "1.4.1":
3862
+ case "1.3.0":
3863
+ const safeWebAuthnSharedSignerContractInstance = new SafeWebAuthnSharedSignerContract_v0_2_1_default(
3864
+ chainId,
3865
+ safeProvider,
3866
+ safeVersion,
3867
+ contractAddress,
3868
+ customContractAbi,
3869
+ deploymentType
3870
+ );
3871
+ await safeWebAuthnSharedSignerContractInstance.init();
3872
+ return safeWebAuthnSharedSignerContractInstance;
3873
+ default:
3874
+ throw new Error("Invalid Safe version");
3875
+ }
3876
+ }
3877
+
3878
+ // src/contracts/safeDeploymentContracts.ts
3879
+ async function getSafeContract({
3880
+ safeProvider,
3881
+ safeVersion,
3882
+ customSafeAddress,
3883
+ isL1SafeSingleton,
3884
+ customContracts,
3885
+ deploymentType
3886
+ }) {
3887
+ const safeContract = await getSafeContractInstance(
3888
+ safeVersion,
3889
+ safeProvider,
3890
+ customSafeAddress ?? customContracts?.safeSingletonAddress,
3891
+ customContracts?.safeSingletonAbi,
3892
+ isL1SafeSingleton,
3893
+ deploymentType
3894
+ );
3895
+ const isContractDeployed = await safeProvider.isContractDeployed(safeContract.getAddress());
3896
+ if (!isContractDeployed) {
3897
+ throw new Error("SafeProxy contract is not deployed on the current network");
3898
+ }
3899
+ return safeContract;
3900
+ }
3901
+ async function getSafeProxyFactoryContract({
3902
+ safeProvider,
3903
+ safeVersion,
3904
+ customContracts,
3905
+ deploymentType
3906
+ }) {
3907
+ const safeProxyFactoryContract = await getSafeProxyFactoryContractInstance(
3908
+ safeVersion,
3909
+ safeProvider,
3910
+ customContracts?.safeProxyFactoryAddress,
3911
+ customContracts?.safeProxyFactoryAbi,
3912
+ deploymentType
3913
+ );
3914
+ const isContractDeployed = await safeProvider.isContractDeployed(
3915
+ safeProxyFactoryContract.getAddress()
3916
+ );
3917
+ if (!isContractDeployed) {
3918
+ throw new Error("SafeProxyFactory contract is not deployed on the current network");
3919
+ }
3920
+ return safeProxyFactoryContract;
3921
+ }
3922
+ async function getCompatibilityFallbackHandlerContract({
3923
+ safeProvider,
3924
+ safeVersion,
3925
+ customContracts,
3926
+ deploymentType
3927
+ }) {
3928
+ const fallbackHandlerContract = await getCompatibilityFallbackHandlerContractInstance(
3929
+ safeVersion,
3930
+ safeProvider,
3931
+ customContracts?.fallbackHandlerAddress,
3932
+ customContracts?.fallbackHandlerAbi,
3933
+ deploymentType
3934
+ );
3935
+ const isContractDeployed = await safeProvider.isContractDeployed(
3936
+ fallbackHandlerContract.getAddress()
3937
+ );
3938
+ if (!isContractDeployed) {
3939
+ throw new Error("CompatibilityFallbackHandler contract is not deployed on the current network");
3940
+ }
3941
+ return fallbackHandlerContract;
3942
+ }
3943
+ async function getSafeWebAuthnSignerFactoryContract({
3944
+ safeProvider,
3945
+ safeVersion,
3946
+ customContracts,
3947
+ deploymentType
3948
+ }) {
3949
+ const safeWebAuthnSignerFactoryContract = await getSafeWebAuthnSignerFactoryContractInstance(
3950
+ safeVersion,
3951
+ safeProvider,
3952
+ customContracts?.safeWebAuthnSignerFactoryAddress,
3953
+ customContracts?.safeWebAuthnSignerFactoryAbi,
3954
+ deploymentType
3955
+ );
3956
+ const isContractDeployed = await safeProvider.isContractDeployed(
3957
+ safeWebAuthnSignerFactoryContract.getAddress()
3958
+ );
3959
+ if (!isContractDeployed) {
3960
+ throw new Error("safeWebAuthnSignerFactory contract is not deployed on the current network");
3961
+ }
3962
+ return safeWebAuthnSignerFactoryContract;
3963
+ }
3964
+ async function getSafeWebAuthnSharedSignerContract({
3965
+ safeProvider,
3966
+ safeVersion,
3967
+ customContracts,
3968
+ deploymentType
3969
+ }) {
3970
+ const safeWebAuthnSharedSignerContract = await getSafeWebAuthnSharedSignerContractInstance(
3971
+ safeVersion,
3972
+ safeProvider,
3973
+ customContracts?.safeWebAuthnSharedSignerAddress,
3974
+ customContracts?.safeWebAuthnSharedSignerAbi,
3975
+ deploymentType
3976
+ );
3977
+ const isContractDeployed = await safeProvider.isContractDeployed(
3978
+ safeWebAuthnSharedSignerContract.getAddress()
3979
+ );
3980
+ if (!isContractDeployed) {
3981
+ throw new Error("safeWebAuthnSharedSigner contract is not deployed on the current network");
3982
+ }
3983
+ return safeWebAuthnSharedSignerContract;
3984
+ }
3985
+
3986
+ // src/utils/transactions/gas.ts
3987
+ var CALL_DATA_BYTE_GAS_COST = 16;
3988
+ var ECRECOVER_GAS_COST = 6e3;
3989
+ var GAS_COST_PER_SIGNATURE = 1 * CALL_DATA_BYTE_GAS_COST + 2 * 32 * CALL_DATA_BYTE_GAS_COST + ECRECOVER_GAS_COST;
3990
+
3991
+ // src/utils/transactions/utils.ts
3992
+ var import_types_kit27 = require("@safe-global/types-kit");
3993
+ var import_satisfies6 = __toESM(require("semver/functions/satisfies.js"));
3994
+ var import_viem13 = require("viem");
3995
+ var import_actions9 = require("viem/actions");
3996
+ function toEstimateGasParameters(tx) {
3997
+ const params = isLegacyTransaction(tx) ? createLegacyTxOptions(tx) : createTxOptions(tx);
3998
+ if (tx.value) {
3999
+ params.value = BigInt(tx.value);
4000
+ }
4001
+ if (tx.to) {
4002
+ params.to = tx.to;
4003
+ }
4004
+ if (tx.data) {
4005
+ params.data = asHex(tx.data);
4006
+ }
4007
+ return params;
4008
+ }
4009
+ function toTransactionRequest(tx) {
4010
+ const params = isLegacyTransaction(tx) ? createLegacyTxOptions(tx) : createTxOptions(tx);
4011
+ if (tx.to) {
4012
+ params.to = tx.to;
4013
+ }
4014
+ if (tx.data) {
4015
+ params.data = asHex(tx.data);
4016
+ }
4017
+ return params;
4018
+ }
4019
+ function convertTransactionOptions(options) {
4020
+ return isLegacyTransaction(options) ? createLegacyTxOptions(options) : createTxOptions(options);
4021
+ }
4022
+ function isLegacyTransaction(options) {
4023
+ return !!options?.gasPrice;
4024
+ }
4025
+ function createLegacyTxOptions(options) {
4026
+ const converted = {};
4027
+ if (options?.from) {
4028
+ converted.account = options.from;
4029
+ }
4030
+ if (options?.gasLimit) {
4031
+ converted.gas = BigInt(options.gasLimit);
4032
+ }
4033
+ if (options?.gasPrice) {
4034
+ converted.gasPrice = BigInt(options.gasPrice);
4035
+ }
4036
+ if (options?.nonce) {
4037
+ converted.nonce = options.nonce;
4038
+ }
4039
+ return converted;
4040
+ }
4041
+ function createTxOptions(options) {
4042
+ const converted = {};
4043
+ if (options?.from) {
4044
+ converted.account = options.from;
4045
+ }
4046
+ if (options?.gasLimit) {
4047
+ converted.gas = BigInt(options.gasLimit);
4048
+ }
4049
+ if (options?.maxFeePerGas) {
4050
+ converted.maxFeePerGas = BigInt(options.maxFeePerGas);
4051
+ }
4052
+ if (options?.maxPriorityFeePerGas) {
4053
+ converted.maxPriorityFeePerGas = BigInt(options.maxPriorityFeePerGas);
4054
+ }
4055
+ if (options?.nonce) {
4056
+ converted.nonce = options.nonce;
4057
+ }
4058
+ return converted;
4059
+ }
4060
+
4061
+ // test-utils/passkeys.ts
4062
+ var singleInstance;
4063
+ function getWebAuthnCredentials() {
4064
+ if (!singleInstance) {
4065
+ singleInstance = new WebAuthnCredentials();
4066
+ }
4067
+ return singleInstance;
4068
+ }
4069
+ async function deployPasskeysContract(passkeys, signer) {
4070
+ const toDeploy = passkeys.map(async (client) => {
4071
+ const { data, to, value } = client.createDeployTxRequest();
4072
+ const createPasskeySignerTransaction = {
4073
+ to,
4074
+ value: BigInt(value),
4075
+ data: asHex(data)
4076
+ };
4077
+ return await signer.sendTransaction(createPasskeySignerTransaction);
4078
+ });
4079
+ return Promise.all(toDeploy);
4080
+ }
4081
+ async function createMockPasskey(name, webAuthnCredentials) {
4082
+ const credentialsInstance = webAuthnCredentials ?? getWebAuthnCredentials();
4083
+ const passkeyCredential = credentialsInstance.create({
4084
+ publicKey: {
4085
+ rp: {
4086
+ name: "Safe",
4087
+ id: "safe.global"
4088
+ },
4089
+ user: {
4090
+ id: (0, import_viem14.toBytes)((0, import_viem14.keccak256)((0, import_viem14.toBytes)(name))),
4091
+ name,
4092
+ displayName: name
4093
+ },
4094
+ challenge: (0, import_viem14.toBytes)(Date.now()),
4095
+ pubKeyCredParams: [{ type: "public-key", alg: -7 }]
4096
+ }
4097
+ });
4098
+ const algorithm = {
4099
+ name: "ECDSA",
4100
+ namedCurve: "P-256",
4101
+ hash: { name: "SHA-256" }
4102
+ };
4103
+ const key = await crypto.subtle.importKey(
4104
+ "raw",
4105
+ passkeyCredential.response.getPublicKey(),
4106
+ algorithm,
4107
+ true,
4108
+ ["verify"]
4109
+ );
4110
+ const exportedPublicKey = await crypto.subtle.exportKey("spki", key);
4111
+ const rawId = Buffer.from(passkeyCredential.rawId).toString("hex");
4112
+ const coordinates = await decodePublicKeyForWeb(exportedPublicKey);
4113
+ const passkey = {
4114
+ rawId,
4115
+ coordinates
4116
+ };
4117
+ return passkey;
4118
+ }