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