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