@lit-protocol/vincent-e2e-test-utils 3.0.0 → 3.0.2-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 (258) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/CHANGELOG.md +20 -0
  3. package/dist/package.json +3 -7
  4. package/dist/src/index.d.ts +3 -2
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +8 -16
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.d.ts +3 -0
  9. package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.d.ts.map +1 -0
  10. package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.js +32 -0
  11. package/dist/src/lib/setup/app-registration/areAbilitiesAndPoliciesEqual.js.map +1 -0
  12. package/dist/src/lib/setup/app-registration/handleAppRegistration.d.ts +14 -0
  13. package/dist/src/lib/setup/app-registration/handleAppRegistration.d.ts.map +1 -0
  14. package/dist/src/lib/setup/app-registration/handleAppRegistration.js +43 -0
  15. package/dist/src/lib/setup/app-registration/handleAppRegistration.js.map +1 -0
  16. package/dist/src/lib/setup/app-registration/registerNewApp.d.ts +17 -0
  17. package/dist/src/lib/setup/app-registration/registerNewApp.d.ts.map +1 -0
  18. package/dist/src/lib/setup/app-registration/registerNewApp.js +46 -0
  19. package/dist/src/lib/setup/app-registration/registerNewApp.js.map +1 -0
  20. package/dist/src/lib/setup/app-registration/registerNewAppVersion.d.ts +16 -0
  21. package/dist/src/lib/setup/app-registration/registerNewAppVersion.d.ts.map +1 -0
  22. package/dist/src/lib/setup/app-registration/registerNewAppVersion.js +68 -0
  23. package/dist/src/lib/setup/app-registration/registerNewAppVersion.js.map +1 -0
  24. package/dist/src/lib/setup/app-setup.d.ts +19 -0
  25. package/dist/src/lib/setup/app-setup.d.ts.map +1 -0
  26. package/dist/src/lib/setup/app-setup.js +37 -0
  27. package/dist/src/lib/setup/app-setup.js.map +1 -0
  28. package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.d.ts +10 -0
  29. package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.d.ts.map +1 -0
  30. package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.js +17 -0
  31. package/dist/src/lib/setup/blockchain/installAppUsingUserEoa.js.map +1 -0
  32. package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.d.ts +12 -0
  33. package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.d.ts.map +1 -0
  34. package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.js +23 -0
  35. package/dist/src/lib/setup/blockchain/registerNewAppVersionOnChain.js.map +1 -0
  36. package/dist/src/lib/setup/getEnv.d.ts +2 -0
  37. package/dist/src/lib/setup/getEnv.d.ts.map +1 -0
  38. package/dist/src/lib/setup/getEnv.js +16 -0
  39. package/dist/src/lib/setup/getEnv.js.map +1 -0
  40. package/dist/src/lib/setup/index.d.ts +9 -0
  41. package/dist/src/lib/setup/index.d.ts.map +1 -0
  42. package/dist/src/lib/setup/index.js +18 -0
  43. package/dist/src/lib/setup/index.js.map +1 -0
  44. package/dist/src/lib/setup/setupAgentSmartAccount.d.ts +19 -0
  45. package/dist/src/lib/setup/setupAgentSmartAccount.d.ts.map +1 -0
  46. package/dist/src/lib/setup/setupAgentSmartAccount.js +100 -0
  47. package/dist/src/lib/setup/setupAgentSmartAccount.js.map +1 -0
  48. package/dist/src/lib/setup/smart-account/createPermissionApproval.d.ts +11 -0
  49. package/dist/src/lib/setup/smart-account/createPermissionApproval.d.ts.map +1 -0
  50. package/dist/src/lib/setup/smart-account/createPermissionApproval.js +45 -0
  51. package/dist/src/lib/setup/smart-account/createPermissionApproval.js.map +1 -0
  52. package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.d.ts +16 -0
  53. package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.d.ts.map +1 -0
  54. package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.js +128 -0
  55. package/dist/src/lib/setup/smart-account/deploySmartAccountToChain.js.map +1 -0
  56. package/dist/src/lib/setup/smart-account/deriveAgentAddress.d.ts +23 -0
  57. package/dist/src/lib/setup/smart-account/deriveAgentAddress.d.ts.map +1 -0
  58. package/dist/src/lib/setup/smart-account/deriveAgentAddress.js +36 -0
  59. package/dist/src/lib/setup/smart-account/deriveAgentAddress.js.map +1 -0
  60. package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.d.ts +12 -0
  61. package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.d.ts.map +1 -0
  62. package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.js +82 -0
  63. package/dist/src/lib/setup/smart-account/vincentViemPkpSigner.js.map +1 -0
  64. package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.d.ts +10 -0
  65. package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.d.ts.map +1 -0
  66. package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.js +34 -0
  67. package/dist/src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.js.map +1 -0
  68. package/dist/src/lib/setup/types.d.ts +92 -0
  69. package/dist/src/lib/setup/types.d.ts.map +1 -0
  70. package/dist/src/lib/{types.js.map → setup/types.js.map} +1 -1
  71. package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.d.ts +32 -0
  72. package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.d.ts.map +1 -0
  73. package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.js +58 -0
  74. package/dist/src/lib/setup/vincent-api/completeAppInstallationViaVincentApi.js.map +1 -0
  75. package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.d.ts +4 -0
  76. package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.d.ts.map +1 -0
  77. package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.js +28 -0
  78. package/dist/src/lib/setup/vincent-api/generateAppManagerJwt.js.map +1 -0
  79. package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.d.ts +31 -0
  80. package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.d.ts.map +1 -0
  81. package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.js +31 -0
  82. package/dist/src/lib/setup/vincent-api/installAppViaVincentApi.js.map +1 -0
  83. package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.d.ts +9 -0
  84. package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.d.ts.map +1 -0
  85. package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.js +27 -0
  86. package/dist/src/lib/setup/vincent-api/registerAppVersionWithVincentApi.js.map +1 -0
  87. package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.d.ts +8 -0
  88. package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.d.ts.map +1 -0
  89. package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.js +30 -0
  90. package/dist/src/lib/setup/vincent-api/registerAppWithVincentApi.js.map +1 -0
  91. package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.d.ts +7 -0
  92. package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.d.ts.map +1 -0
  93. package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.js +25 -0
  94. package/dist/src/lib/setup/vincent-api/setActiveVersionWithVincentApi.js.map +1 -0
  95. package/dist/src/lib/setup/wallets/ensureWalletHasTokens.d.ts +14 -0
  96. package/dist/src/lib/setup/wallets/ensureWalletHasTokens.d.ts.map +1 -0
  97. package/dist/src/lib/setup/wallets/ensureWalletHasTokens.js +27 -0
  98. package/dist/src/lib/setup/wallets/ensureWalletHasTokens.js.map +1 -0
  99. package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.d.ts +15 -0
  100. package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.d.ts.map +1 -0
  101. package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.js +63 -0
  102. package/dist/src/lib/setup/wallets/ensureWalletHasUnexpiredCapacityCredit.js.map +1 -0
  103. package/dist/src/lib/setup/wallets/setupWallets.d.ts +48 -0
  104. package/dist/src/lib/setup/wallets/setupWallets.d.ts.map +1 -0
  105. package/dist/src/lib/setup/wallets/setupWallets.js +159 -0
  106. package/dist/src/lib/setup/wallets/setupWallets.js.map +1 -0
  107. package/dist/src/lib/setupVincentDevelopmentEnv.d.ts +3 -0
  108. package/dist/src/lib/setupVincentDevelopmentEnv.d.ts.map +1 -0
  109. package/dist/src/lib/setupVincentDevelopmentEnv.js +64 -0
  110. package/dist/src/lib/setupVincentDevelopmentEnv.js.map +1 -0
  111. package/package.json +4 -8
  112. package/dist/src/lib/appManager/ensure-funded.d.ts +0 -2
  113. package/dist/src/lib/appManager/ensure-funded.d.ts.map +0 -1
  114. package/dist/src/lib/appManager/ensure-funded.js +0 -11
  115. package/dist/src/lib/appManager/ensure-funded.js.map +0 -1
  116. package/dist/src/lib/appManager/index.d.ts +0 -5
  117. package/dist/src/lib/appManager/index.d.ts.map +0 -1
  118. package/dist/src/lib/appManager/index.js +0 -12
  119. package/dist/src/lib/appManager/index.js.map +0 -1
  120. package/dist/src/lib/appManager/register-new-app-version.d.ts +0 -28
  121. package/dist/src/lib/appManager/register-new-app-version.d.ts.map +0 -1
  122. package/dist/src/lib/appManager/register-new-app-version.js +0 -82
  123. package/dist/src/lib/appManager/register-new-app-version.js.map +0 -1
  124. package/dist/src/lib/appManager/register-new-app.d.ts +0 -13
  125. package/dist/src/lib/appManager/register-new-app.d.ts.map +0 -1
  126. package/dist/src/lib/appManager/register-new-app.js +0 -25
  127. package/dist/src/lib/appManager/register-new-app.js.map +0 -1
  128. package/dist/src/lib/appManager/remove-delegatee-from-app.d.ts +0 -7
  129. package/dist/src/lib/appManager/remove-delegatee-from-app.d.ts.map +0 -1
  130. package/dist/src/lib/appManager/remove-delegatee-from-app.js +0 -26
  131. package/dist/src/lib/appManager/remove-delegatee-from-app.js.map +0 -1
  132. package/dist/src/lib/chain.d.ts +0 -13
  133. package/dist/src/lib/chain.d.ts.map +0 -1
  134. package/dist/src/lib/chain.js +0 -30
  135. package/dist/src/lib/chain.js.map +0 -1
  136. package/dist/src/lib/create-random-vincent-wallets.d.ts +0 -7
  137. package/dist/src/lib/create-random-vincent-wallets.d.ts.map +0 -1
  138. package/dist/src/lib/create-random-vincent-wallets.js +0 -12
  139. package/dist/src/lib/create-random-vincent-wallets.js.map +0 -1
  140. package/dist/src/lib/delegatee/ensure-funded.d.ts +0 -2
  141. package/dist/src/lib/delegatee/ensure-funded.d.ts.map +0 -1
  142. package/dist/src/lib/delegatee/ensure-funded.js +0 -11
  143. package/dist/src/lib/delegatee/ensure-funded.js.map +0 -1
  144. package/dist/src/lib/delegatee/get-app-info.d.ts +0 -5
  145. package/dist/src/lib/delegatee/get-app-info.d.ts.map +0 -1
  146. package/dist/src/lib/delegatee/get-app-info.js +0 -19
  147. package/dist/src/lib/delegatee/get-app-info.js.map +0 -1
  148. package/dist/src/lib/delegatee/index.d.ts +0 -3
  149. package/dist/src/lib/delegatee/index.d.ts.map +0 -1
  150. package/dist/src/lib/delegatee/index.js +0 -8
  151. package/dist/src/lib/delegatee/index.js.map +0 -1
  152. package/dist/src/lib/delegator/add-permission-for-abilities.d.ts +0 -4
  153. package/dist/src/lib/delegator/add-permission-for-abilities.d.ts.map +0 -1
  154. package/dist/src/lib/delegator/add-permission-for-abilities.js +0 -21
  155. package/dist/src/lib/delegator/add-permission-for-abilities.js.map +0 -1
  156. package/dist/src/lib/delegator/agent-pkp.d.ts +0 -20
  157. package/dist/src/lib/delegator/agent-pkp.d.ts.map +0 -1
  158. package/dist/src/lib/delegator/agent-pkp.js +0 -96
  159. package/dist/src/lib/delegator/agent-pkp.js.map +0 -1
  160. package/dist/src/lib/delegator/get-platform-user-pkp-wallet.d.ts +0 -8
  161. package/dist/src/lib/delegator/get-platform-user-pkp-wallet.d.ts.map +0 -1
  162. package/dist/src/lib/delegator/get-platform-user-pkp-wallet.js +0 -77
  163. package/dist/src/lib/delegator/get-platform-user-pkp-wallet.js.map +0 -1
  164. package/dist/src/lib/delegator/index.d.ts +0 -7
  165. package/dist/src/lib/delegator/index.d.ts.map +0 -1
  166. package/dist/src/lib/delegator/index.js +0 -20
  167. package/dist/src/lib/delegator/index.js.map +0 -1
  168. package/dist/src/lib/delegator/permit-vincent-app-version.d.ts +0 -19
  169. package/dist/src/lib/delegator/permit-vincent-app-version.d.ts.map +0 -1
  170. package/dist/src/lib/delegator/permit-vincent-app-version.js +0 -45
  171. package/dist/src/lib/delegator/permit-vincent-app-version.js.map +0 -1
  172. package/dist/src/lib/delegator/platform-user-pkp.d.ts +0 -10
  173. package/dist/src/lib/delegator/platform-user-pkp.d.ts.map +0 -1
  174. package/dist/src/lib/delegator/platform-user-pkp.js +0 -48
  175. package/dist/src/lib/delegator/platform-user-pkp.js.map +0 -1
  176. package/dist/src/lib/ensure-capacity-credit.d.ts +0 -4
  177. package/dist/src/lib/ensure-capacity-credit.d.ts.map +0 -1
  178. package/dist/src/lib/ensure-capacity-credit.js +0 -57
  179. package/dist/src/lib/ensure-capacity-credit.js.map +0 -1
  180. package/dist/src/lib/env.d.ts +0 -30
  181. package/dist/src/lib/env.d.ts.map +0 -1
  182. package/dist/src/lib/env.js +0 -58
  183. package/dist/src/lib/env.js.map +0 -1
  184. package/dist/src/lib/environment/crossmint.d.ts +0 -3
  185. package/dist/src/lib/environment/crossmint.d.ts.map +0 -1
  186. package/dist/src/lib/environment/crossmint.js +0 -23
  187. package/dist/src/lib/environment/crossmint.js.map +0 -1
  188. package/dist/src/lib/environment/safe.d.ts +0 -567
  189. package/dist/src/lib/environment/safe.d.ts.map +0 -1
  190. package/dist/src/lib/environment/safe.js +0 -41
  191. package/dist/src/lib/environment/safe.js.map +0 -1
  192. package/dist/src/lib/environment/zerodev.d.ts +0 -49
  193. package/dist/src/lib/environment/zerodev.d.ts.map +0 -1
  194. package/dist/src/lib/environment/zerodev.js +0 -32
  195. package/dist/src/lib/environment/zerodev.js.map +0 -1
  196. package/dist/src/lib/funder/check-funder-balance.d.ts +0 -3
  197. package/dist/src/lib/funder/check-funder-balance.d.ts.map +0 -1
  198. package/dist/src/lib/funder/check-funder-balance.js +0 -19
  199. package/dist/src/lib/funder/check-funder-balance.js.map +0 -1
  200. package/dist/src/lib/funder/ensure-wallet-has-test-tokens.d.ts +0 -5
  201. package/dist/src/lib/funder/ensure-wallet-has-test-tokens.d.ts.map +0 -1
  202. package/dist/src/lib/funder/ensure-wallet-has-test-tokens.js +0 -35
  203. package/dist/src/lib/funder/ensure-wallet-has-test-tokens.js.map +0 -1
  204. package/dist/src/lib/funder/index.d.ts +0 -5
  205. package/dist/src/lib/funder/index.d.ts.map +0 -1
  206. package/dist/src/lib/funder/index.js +0 -10
  207. package/dist/src/lib/funder/index.js.map +0 -1
  208. package/dist/src/lib/index.d.ts +0 -18
  209. package/dist/src/lib/index.d.ts.map +0 -1
  210. package/dist/src/lib/index.js +0 -31
  211. package/dist/src/lib/index.js.map +0 -1
  212. package/dist/src/lib/litContractsClient/LitContractsInstance.d.ts +0 -14
  213. package/dist/src/lib/litContractsClient/LitContractsInstance.d.ts.map +0 -1
  214. package/dist/src/lib/litContractsClient/LitContractsInstance.js +0 -48
  215. package/dist/src/lib/litContractsClient/LitContractsInstance.js.map +0 -1
  216. package/dist/src/lib/litContractsClient/get-lit-contract-client.d.ts +0 -7
  217. package/dist/src/lib/litContractsClient/get-lit-contract-client.d.ts.map +0 -1
  218. package/dist/src/lib/litContractsClient/get-lit-contract-client.js +0 -19
  219. package/dist/src/lib/litContractsClient/get-lit-contract-client.js.map +0 -1
  220. package/dist/src/lib/litContractsClient/index.d.ts +0 -3
  221. package/dist/src/lib/litContractsClient/index.d.ts.map +0 -1
  222. package/dist/src/lib/litContractsClient/index.js +0 -8
  223. package/dist/src/lib/litContractsClient/index.js.map +0 -1
  224. package/dist/src/lib/mint-new-pkp.d.ts +0 -16
  225. package/dist/src/lib/mint-new-pkp.d.ts.map +0 -1
  226. package/dist/src/lib/mint-new-pkp.js +0 -40
  227. package/dist/src/lib/mint-new-pkp.js.map +0 -1
  228. package/dist/src/lib/setup-vincent-development-environment.d.ts +0 -81
  229. package/dist/src/lib/setup-vincent-development-environment.d.ts.map +0 -1
  230. package/dist/src/lib/setup-vincent-development-environment.js +0 -185
  231. package/dist/src/lib/setup-vincent-development-environment.js.map +0 -1
  232. package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.d.ts +0 -3
  233. package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.d.ts.map +0 -1
  234. package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.js +0 -96
  235. package/dist/src/lib/smartAccount/crossmint/setup-crossmint-account.js.map +0 -1
  236. package/dist/src/lib/smartAccount/index.d.ts +0 -5
  237. package/dist/src/lib/smartAccount/index.d.ts.map +0 -1
  238. package/dist/src/lib/smartAccount/index.js +0 -10
  239. package/dist/src/lib/smartAccount/index.js.map +0 -1
  240. package/dist/src/lib/smartAccount/safe/setup-safe-account.d.ts +0 -15
  241. package/dist/src/lib/smartAccount/safe/setup-safe-account.d.ts.map +0 -1
  242. package/dist/src/lib/smartAccount/safe/setup-safe-account.js +0 -92
  243. package/dist/src/lib/smartAccount/safe/setup-safe-account.js.map +0 -1
  244. package/dist/src/lib/smartAccount/types.d.ts +0 -30
  245. package/dist/src/lib/smartAccount/types.d.ts.map +0 -1
  246. package/dist/src/lib/smartAccount/types.js.map +0 -1
  247. package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.d.ts +0 -3
  248. package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.d.ts.map +0 -1
  249. package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.js +0 -24
  250. package/dist/src/lib/smartAccount/zerodev/get-permission-empty-validator.js.map +0 -1
  251. package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.d.ts +0 -18
  252. package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.d.ts.map +0 -1
  253. package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.js +0 -112
  254. package/dist/src/lib/smartAccount/zerodev/setup-zerodev-account.js.map +0 -1
  255. package/dist/src/lib/types.d.ts +0 -17
  256. package/dist/src/lib/types.d.ts.map +0 -1
  257. package/dist/src/lib/types.js +0 -3
  258. /package/dist/src/lib/{smartAccount → setup}/types.js +0 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnv = exports.ensureWalletHasTokens = exports.createPermissionApproval = exports.deploySmartAccountToChain = exports.setupAgentSmartAccount = exports.setupVincentApp = exports.setupWallets = void 0;
4
+ var setupWallets_1 = require("./wallets/setupWallets");
5
+ Object.defineProperty(exports, "setupWallets", { enumerable: true, get: function () { return setupWallets_1.setupWallets; } });
6
+ var app_setup_1 = require("./app-setup");
7
+ Object.defineProperty(exports, "setupVincentApp", { enumerable: true, get: function () { return app_setup_1.setupVincentApp; } });
8
+ var setupAgentSmartAccount_1 = require("./setupAgentSmartAccount");
9
+ Object.defineProperty(exports, "setupAgentSmartAccount", { enumerable: true, get: function () { return setupAgentSmartAccount_1.setupAgentSmartAccount; } });
10
+ var deploySmartAccountToChain_1 = require("./smart-account/deploySmartAccountToChain");
11
+ Object.defineProperty(exports, "deploySmartAccountToChain", { enumerable: true, get: function () { return deploySmartAccountToChain_1.deploySmartAccountToChain; } });
12
+ var createPermissionApproval_1 = require("./smart-account/createPermissionApproval");
13
+ Object.defineProperty(exports, "createPermissionApproval", { enumerable: true, get: function () { return createPermissionApproval_1.createPermissionApproval; } });
14
+ var ensureWalletHasTokens_1 = require("./wallets/ensureWalletHasTokens");
15
+ Object.defineProperty(exports, "ensureWalletHasTokens", { enumerable: true, get: function () { return ensureWalletHasTokens_1.ensureWalletHasTokens; } });
16
+ var getEnv_1 = require("./getEnv");
17
+ Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return getEnv_1.getEnv; } });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/setup/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,uFAAsF;AAA7E,sIAAA,yBAAyB,OAAA;AAClC,qFAAoF;AAA3E,oIAAA,wBAAwB,OAAA;AACjC,yEAAwE;AAA/D,8HAAA,qBAAqB,OAAA;AAE9B,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
@@ -0,0 +1,19 @@
1
+ import type { Address, Chain } from 'viem';
2
+ export interface AgentSmartAccountInfo {
3
+ agentSignerAddress: Address;
4
+ agentSmartAccountAddress: Address;
5
+ deploymentTxHash?: string;
6
+ }
7
+ export interface setupAgentSmartAccountParams {
8
+ vincentRegistryRpcUrl: string;
9
+ vincentApiUrl: string;
10
+ vincentRegistryChain: Chain;
11
+ zerodevProjectId: string;
12
+ userEoaPrivateKey: `0x${string}`;
13
+ vincentAppId: number;
14
+ funderPrivateKey: `0x${string}`;
15
+ fundAmountBeforeDeployment?: bigint;
16
+ sponsorGasForAppInstallation?: boolean;
17
+ }
18
+ export declare function setupAgentSmartAccount({ vincentRegistryRpcUrl, vincentApiUrl, vincentRegistryChain, zerodevProjectId, userEoaPrivateKey, vincentAppId, funderPrivateKey, fundAmountBeforeDeployment, sponsorGasForAppInstallation, }: setupAgentSmartAccountParams): Promise<AgentSmartAccountInfo>;
19
+ //# sourceMappingURL=setupAgentSmartAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupAgentSmartAccount.d.ts","sourceRoot":"","sources":["../../../../src/lib/setup/setupAgentSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAa3C,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,wBAAwB,EAAE,OAAO,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,4BAA4B;IAC3C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,KAAK,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IAChC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,4BAAoC,GACrC,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkG/D"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupAgentSmartAccount = setupAgentSmartAccount;
4
+ const viem_1 = require("viem");
5
+ const accounts_1 = require("viem/accounts");
6
+ const vincent_contracts_sdk_1 = require("@lit-protocol/vincent-contracts-sdk");
7
+ const installAppViaVincentApi_1 = require("./vincent-api/installAppViaVincentApi");
8
+ const completeAppInstallationViaVincentApi_1 = require("./vincent-api/completeAppInstallationViaVincentApi");
9
+ const installAppUsingUserEoa_1 = require("./blockchain/installAppUsingUserEoa");
10
+ const deploySmartAccountToChain_1 = require("./smart-account/deploySmartAccountToChain");
11
+ async function setupAgentSmartAccount({ vincentRegistryRpcUrl, vincentApiUrl, vincentRegistryChain, zerodevProjectId, userEoaPrivateKey, vincentAppId, funderPrivateKey, fundAmountBeforeDeployment, sponsorGasForAppInstallation = false, }) {
12
+ console.log('=== Setting up agent smart account ===');
13
+ const vincentRegistryPublicClient = (0, viem_1.createPublicClient)({
14
+ chain: vincentRegistryChain,
15
+ transport: (0, viem_1.http)(vincentRegistryRpcUrl),
16
+ });
17
+ const userEoaAccount = (0, accounts_1.privateKeyToAccount)(userEoaPrivateKey);
18
+ const userEoaWalletClient = (0, viem_1.createWalletClient)({
19
+ account: userEoaAccount,
20
+ chain: vincentRegistryChain,
21
+ transport: (0, viem_1.http)(vincentRegistryRpcUrl),
22
+ });
23
+ // Step 1: Install app via registry API to create PKP (or retrieve existing PKP if already installed)
24
+ const installData = await (0, installAppViaVincentApi_1.installAppViaVincentApi)({
25
+ vincentApiUrl,
26
+ appId: vincentAppId,
27
+ userEoaAddress: userEoaAccount.address,
28
+ sponsorGas: sponsorGasForAppInstallation,
29
+ });
30
+ const installDataTable = {};
31
+ for (const [key, value] of Object.entries(installData))
32
+ installDataTable[key] = value;
33
+ console.table(installDataTable);
34
+ // Step 2: Deploy the smart account with EOA validator only
35
+ const { smartAccountAddress: deployedAddress, deploymentTxHash } = await (0, deploySmartAccountToChain_1.deploySmartAccountToChain)({
36
+ userEoaPrivateKey,
37
+ accountIndexHash: (0, vincent_contracts_sdk_1.deriveSmartAccountIndex)(vincentAppId).toString(),
38
+ targetChain: vincentRegistryChain,
39
+ targetChainRpcUrl: vincentRegistryRpcUrl,
40
+ zerodevProjectId,
41
+ funderPrivateKey,
42
+ fundAmountBeforeDeployment,
43
+ });
44
+ // Verify the deployed address matches what the API returned
45
+ if (deployedAddress.toLowerCase() !== installData.agentSmartAccountAddress.toLowerCase()) {
46
+ throw new Error(`Smart account address mismatch! Deployed: ${deployedAddress}, API: ${installData.agentSmartAccountAddress}`);
47
+ }
48
+ // Step 3: Complete app installation by submitting the permitAppVersion transaction (if not already permitted)
49
+ let permitTxHash;
50
+ if (installData.alreadyInstalled) {
51
+ console.log('=== App already permitted, skipping installation transaction ===');
52
+ }
53
+ else {
54
+ // App is not yet permitted on-chain, submit the permit transaction
55
+ if ((0, installAppViaVincentApi_1.isInstallAppResponseSponsored)(installData)) {
56
+ // Gas-sponsored mode: Sign EIP-712 typed data and submit via Gelato relay
57
+ permitTxHash = await (0, completeAppInstallationViaVincentApi_1.completeAppInstallationViaVincentApi)({
58
+ vincentApiUrl,
59
+ userEoaPrivateKey,
60
+ appId: vincentAppId,
61
+ appInstallationDataToSign: installData.appInstallationDataToSign,
62
+ });
63
+ }
64
+ else if ('rawTransaction' in installData) {
65
+ // Direct mode: Submit transaction from user's EOA (user pays gas)
66
+ permitTxHash = await (0, installAppUsingUserEoa_1.installAppUsingUserEoa)({
67
+ userEoaWalletClient,
68
+ vincentRegistryPublicClient,
69
+ transactionData: {
70
+ to: installData.rawTransaction.to,
71
+ data: installData.rawTransaction.data,
72
+ },
73
+ });
74
+ }
75
+ else {
76
+ throw new Error('Invalid install response: missing transaction data');
77
+ }
78
+ // Wait for the permit transaction to be confirmed
79
+ await vincentRegistryPublicClient.waitForTransactionReceipt({
80
+ hash: permitTxHash,
81
+ confirmations: 2,
82
+ });
83
+ }
84
+ // Summary
85
+ console.table({
86
+ 'PKP Signer Address': installData.agentSignerAddress,
87
+ 'Smart Account Address': installData.agentSmartAccountAddress,
88
+ ...(permitTxHash
89
+ ? { 'Permit Transaction Hash': permitTxHash }
90
+ : { 'Permit Status': 'Already permitted, skipped' }),
91
+ 'Smart Account Deployment Status': deploymentTxHash ? 'Newly Deployed' : 'Already Deployed',
92
+ ...(deploymentTxHash ? { 'Smart Account Deployment Transaction Hash': deploymentTxHash } : {}),
93
+ });
94
+ return {
95
+ agentSmartAccountAddress: installData.agentSmartAccountAddress,
96
+ agentSignerAddress: installData.agentSignerAddress,
97
+ deploymentTxHash,
98
+ };
99
+ }
100
+ //# sourceMappingURL=setupAgentSmartAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupAgentSmartAccount.js","sourceRoot":"","s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,oDAAoD,CAAC,CAAC;QACxE,CAAC;QAED,kDAAkD;QAClD,MAAM,2BAA2B,CAAC,yBAAyB,CAAC;YAC1D,IAAI,EAAE,YAA6B;YACnC,aAAa,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,UAAU;IACV,OAAO,CAAC,KAAK,CAAC;QACZ,oBAAoB,EAAE,WAAW,CAAC,kBAAkB;QACpD,uBAAuB,EAAE,WAAW,CAAC,wBAAwB;QAC7D,GAAG,CAAC,YAAY;YACd,CAAC,CAAC,EAAE,yBAAyB,EAAE,YAAY,EAAE;YAC7C,CAAC,CAAC,EAAE,eAAe,EAAE,4BAA4B,EAAE,CAAC;QACtD,iCAAiC,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,kBAAkB;QAC3F,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,2CAA2C,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/F,CAAC,CAAC;IAEH,OAAO;QACL,wBAAwB,EAAE,WAAW,CAAC,wBAAmC;QACzE,kBAAkB,EAAE,WAAW,CAAC,kBAA6B;QAC7D,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Address, Chain } from 'viem';
2
+ export type CreatePermissionApprovalParams = {
3
+ userEoaPrivateKey: `0x${string}`;
4
+ sessionKeyAddress: Address;
5
+ accountIndexHash: string;
6
+ targetChain: Chain;
7
+ targetChainRpcUrl: string;
8
+ smartAccountAddress: Address;
9
+ };
10
+ export declare function createPermissionApproval({ userEoaPrivateKey, sessionKeyAddress, accountIndexHash, targetChain, targetChainRpcUrl, smartAccountAddress, }: CreatePermissionApprovalParams): Promise<string>;
11
+ //# sourceMappingURL=createPermissionApproval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPermissionApproval.d.ts","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/createPermissionApproval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAU3C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,wBAAsB,wBAAwB,CAAC,EAC7C,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClD"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPermissionApproval = createPermissionApproval;
4
+ const viem_1 = require("viem");
5
+ const accounts_1 = require("viem/accounts");
6
+ const sdk_1 = require("@zerodev/sdk");
7
+ const ecdsa_validator_1 = require("@zerodev/ecdsa-validator");
8
+ const permissions_1 = require("@zerodev/permissions");
9
+ const signers_1 = require("@zerodev/permissions/signers");
10
+ const policies_1 = require("@zerodev/permissions/policies");
11
+ const constants_1 = require("@zerodev/sdk/constants");
12
+ async function createPermissionApproval({ userEoaPrivateKey, sessionKeyAddress, accountIndexHash, targetChain, targetChainRpcUrl, smartAccountAddress, }) {
13
+ const publicClient = (0, viem_1.createPublicClient)({
14
+ chain: targetChain,
15
+ transport: (0, viem_1.http)(targetChainRpcUrl),
16
+ });
17
+ const userEoaAccount = (0, accounts_1.privateKeyToAccount)(userEoaPrivateKey);
18
+ const ecdsaValidator = await (0, ecdsa_validator_1.signerToEcdsaValidator)(publicClient, {
19
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
20
+ signer: userEoaAccount,
21
+ kernelVersion: constants_1.KERNEL_V3_3,
22
+ });
23
+ const emptySessionKeyAccount = (0, sdk_1.addressToEmptyAccount)(sessionKeyAddress);
24
+ const emptySessionKeySigner = await (0, signers_1.toECDSASigner)({
25
+ signer: emptySessionKeyAccount,
26
+ });
27
+ const permissionPlugin = await (0, permissions_1.toPermissionValidator)(publicClient, {
28
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
29
+ signer: emptySessionKeySigner,
30
+ policies: [(0, policies_1.toSudoPolicy)({})],
31
+ kernelVersion: constants_1.KERNEL_V3_3,
32
+ });
33
+ const sessionKeyAccount = await (0, sdk_1.createKernelAccount)(publicClient, {
34
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
35
+ plugins: {
36
+ sudo: ecdsaValidator,
37
+ regular: permissionPlugin,
38
+ },
39
+ kernelVersion: constants_1.KERNEL_V3_3,
40
+ index: BigInt(accountIndexHash),
41
+ address: smartAccountAddress,
42
+ });
43
+ return await (0, permissions_1.serializePermissionAccount)(sessionKeyAccount);
44
+ }
45
+ //# sourceMappingURL=createPermissionApproval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPermissionApproval.js","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/createPermissionApproval.ts"],"names":[],"mappings":";;AAmBA,4DA6CC;AA/DD,+BAAgD;AAChD,4CAAoD;AACpD,sCAA0E;AAC1E,8DAAkE;AAClE,sDAAyF;AACzF,0DAA6D;AAC7D,4DAA6D;AAC7D,sDAAoE;AAW7D,KAAK,UAAU,wBAAwB,CAAC,EAC7C,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACY;IAC/B,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,IAAA,WAAI,EAAC,iBAAiB,CAAC;KACnC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAA,8BAAmB,EAAC,iBAAiB,CAAC,CAAC;IAE9D,MAAM,cAAc,GAAG,MAAM,IAAA,wCAAsB,EAAC,YAAY,EAAE;QAChE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,uBAAW;KAC3B,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAAG,IAAA,2BAAqB,EAAC,iBAAiB,CAAC,CAAC;IACxE,MAAM,qBAAqB,GAAG,MAAM,IAAA,uBAAa,EAAC;QAChD,MAAM,EAAE,sBAAsB;KAC/B,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,MAAM,IAAA,mCAAqB,EAAC,YAAY,EAAE;QACjE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,MAAM,EAAE,qBAAqB;QAC7B,QAAQ,EAAE,CAAC,IAAA,uBAAY,EAAC,EAAE,CAAC,CAAC;QAC5B,aAAa,EAAE,uBAAW;KAC3B,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAmB,EAAC,YAAY,EAAE;QAChE,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,OAAO,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,gBAAgB;SAC1B;QACD,aAAa,EAAE,uBAAW;QAC1B,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAC/B,OAAO,EAAE,mBAAmB;KAC7B,CAAC,CAAC;IAEH,OAAO,MAAM,IAAA,wCAA0B,EAAC,iBAAiB,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Address, Chain } from 'viem';
2
+ export interface SmartAccountInfo {
3
+ smartAccountAddress: Address;
4
+ deploymentTxHash?: `0x${string}`;
5
+ }
6
+ export interface deploySmartAccountToChainParams {
7
+ userEoaPrivateKey: `0x${string}`;
8
+ accountIndexHash: string;
9
+ targetChain: Chain;
10
+ targetChainRpcUrl: string;
11
+ zerodevProjectId: string;
12
+ funderPrivateKey: `0x${string}`;
13
+ fundAmountBeforeDeployment?: bigint;
14
+ }
15
+ export declare function deploySmartAccountToChain({ userEoaPrivateKey, accountIndexHash, targetChain, targetChainRpcUrl, zerodevProjectId, funderPrivateKey, fundAmountBeforeDeployment, }: deploySmartAccountToChainParams): Promise<SmartAccountInfo>;
16
+ //# sourceMappingURL=deploySmartAccountToChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploySmartAccountToChain.d.ts","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/deploySmartAccountToChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAS3C,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,KAAK,MAAM,EAAE,CAAC;IAChC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,GAC3B,EAAE,+BAA+B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyI7D"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deploySmartAccountToChain = deploySmartAccountToChain;
4
+ const viem_1 = require("viem");
5
+ const accounts_1 = require("viem/accounts");
6
+ const sdk_1 = require("@zerodev/sdk");
7
+ const ecdsa_validator_1 = require("@zerodev/ecdsa-validator");
8
+ const constants_1 = require("@zerodev/sdk/constants");
9
+ const ensureWalletHasTokens_1 = require("../wallets/ensureWalletHasTokens");
10
+ async function deploySmartAccountToChain({ userEoaPrivateKey, accountIndexHash, targetChain, targetChainRpcUrl, zerodevProjectId, funderPrivateKey, fundAmountBeforeDeployment, }) {
11
+ console.log(`=== Deploying Smart Account to ${targetChain.name} ===`);
12
+ const publicClient = (0, viem_1.createPublicClient)({
13
+ chain: targetChain,
14
+ transport: (0, viem_1.http)(targetChainRpcUrl),
15
+ });
16
+ const userEoaWalletClient = (0, viem_1.createWalletClient)({
17
+ account: (0, accounts_1.privateKeyToAccount)(userEoaPrivateKey),
18
+ chain: targetChain,
19
+ transport: (0, viem_1.http)(targetChainRpcUrl),
20
+ });
21
+ const funderWalletClient = (0, viem_1.createWalletClient)({
22
+ account: (0, accounts_1.privateKeyToAccount)(funderPrivateKey),
23
+ chain: targetChain,
24
+ transport: (0, viem_1.http)(targetChainRpcUrl),
25
+ });
26
+ const userEoaEcdsaValidator = await (0, ecdsa_validator_1.signerToEcdsaValidator)(publicClient, {
27
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
28
+ signer: userEoaWalletClient,
29
+ kernelVersion: constants_1.KERNEL_V3_3,
30
+ });
31
+ const userEoaKernelAccount = await (0, sdk_1.createKernelAccount)(publicClient, {
32
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
33
+ plugins: {
34
+ sudo: userEoaEcdsaValidator,
35
+ },
36
+ kernelVersion: constants_1.KERNEL_V3_3,
37
+ index: BigInt(accountIndexHash),
38
+ });
39
+ const zerodevRpcUrl = `https://rpc.zerodev.app/api/v3/${zerodevProjectId}/chain/${targetChain.id}`;
40
+ const kernelClient = (0, sdk_1.createKernelAccountClient)({
41
+ account: userEoaKernelAccount,
42
+ chain: targetChain,
43
+ bundlerTransport: (0, viem_1.http)(zerodevRpcUrl),
44
+ client: publicClient,
45
+ });
46
+ // Check if smart account is already deployed on the target chain
47
+ const existingCode = await publicClient.getCode({
48
+ address: userEoaKernelAccount.address,
49
+ });
50
+ const isAlreadyDeployed = existingCode && existingCode !== '0x';
51
+ if (isAlreadyDeployed) {
52
+ console.log(`Smart account already deployed on ${targetChain.name}`);
53
+ console.table({
54
+ Chain: `${targetChain.name} (${targetChain.id})`,
55
+ 'Smart Account Address': userEoaKernelAccount.address,
56
+ Status: 'Already Deployed',
57
+ });
58
+ }
59
+ let deploymentTxHash;
60
+ if (!isAlreadyDeployed) {
61
+ // Step 2: Fund the smart account (if fundAmountBeforeDeployment is provided)
62
+ if (fundAmountBeforeDeployment !== undefined) {
63
+ console.log('Funding smart account...');
64
+ const { currentBalance, fundingTxHash } = await (0, ensureWalletHasTokens_1.ensureWalletHasTokens)({
65
+ address: userEoaKernelAccount.address,
66
+ funderWalletClient,
67
+ publicClient,
68
+ minAmount: fundAmountBeforeDeployment,
69
+ });
70
+ console.table({
71
+ 'Smart Account Address': userEoaKernelAccount.address,
72
+ Balance: (0, viem_1.formatEther)(currentBalance),
73
+ 'Funding Tx Hash': fundingTxHash,
74
+ });
75
+ if (fundingTxHash) {
76
+ console.log('Waiting for funding confirmation...');
77
+ await publicClient.waitForTransactionReceipt({
78
+ hash: fundingTxHash,
79
+ confirmations: 2,
80
+ });
81
+ }
82
+ }
83
+ else {
84
+ console.log('Skipping funding step (fundAmountBeforeDeployment not provided)');
85
+ }
86
+ // Step 3: Deploy the smart account (only if not already deployed)
87
+ console.log('Deploying smart account...');
88
+ // Deploy with a no-op call to avoid potential fallback/receive reverts
89
+ const userOpHash = await kernelClient.sendUserOperation({
90
+ callData: await userEoaKernelAccount.encodeCalls([
91
+ {
92
+ to: '0x0000000000000000000000000000000000000000',
93
+ value: 0n,
94
+ data: '0x',
95
+ },
96
+ ]),
97
+ });
98
+ console.log(`Deployment UserOp Hash: ${userOpHash}`);
99
+ // Wait for the UserOperation to be included in a block
100
+ const receipt = await kernelClient.waitForUserOperationReceipt({
101
+ hash: userOpHash,
102
+ });
103
+ deploymentTxHash = receipt.receipt.transactionHash;
104
+ console.log(`Deployment Tx Hash: ${deploymentTxHash}`);
105
+ await publicClient.waitForTransactionReceipt({
106
+ hash: deploymentTxHash,
107
+ confirmations: 2,
108
+ });
109
+ // Verify deployment
110
+ const deployedCode = await publicClient.getCode({
111
+ address: userEoaKernelAccount.address,
112
+ });
113
+ if (!deployedCode || deployedCode === '0x') {
114
+ throw new Error(`Smart account deployment failed on ${targetChain.name}, code is still empty (0x)`);
115
+ }
116
+ console.log(`Smart account deployed successfully`);
117
+ console.table({
118
+ Chain: `${targetChain.name} (${targetChain.id})`,
119
+ 'Smart Account Address': userEoaKernelAccount.address,
120
+ 'Deployment Tx Hash': deploymentTxHash,
121
+ });
122
+ }
123
+ return {
124
+ smartAccountAddress: userEoaKernelAccount.address,
125
+ deploymentTxHash,
126
+ };
127
+ }
128
+ //# sourceMappingURL=deploySmartAccountToChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploySmartAccountToChain.js","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/deploySmartAccountToChain.ts"],"names":[],"mappings":";;AAwBA,8DAiJC;AAxKD,+BAAiF;AACjF,4CAAoD;AACpD,sCAA8E;AAC9E,8DAAkE;AAClE,sDAAoE;AAEpE,4EAAyE;AAiBlE,KAAK,UAAU,yBAAyB,CAAC,EAC9C,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,GACM;IAChC,OAAO,CAAC,GAAG,CAAC,kCAAkC,WAAW,CAAC,IAAI,MAAM,CAAC,CAAC;IAEtE,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,IAAA,WAAI,EAAC,iBAAiB,CAAC;KACnC,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,IAAA,yBAAkB,EAAC;QAC7C,OAAO,EAAE,IAAA,8BAAmB,EAAC,i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+ /**
3
+ * Derive the agent smart account address for a given EOA address.
4
+ *
5
+ * This uses the ZeroDev SDK to deterministically compute the smart account address
6
+ * based on the EOA address and account index hash.
7
+ *
8
+ * @param eoaAddress - The EOA (Externally Owned Account) address
9
+ * @param accountIndexHash - The account index hash from app registration
10
+ * @param publicClient - Viem public client
11
+ * @returns The derived agent smart account address
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const agentAddress = await deriveAgentAddress(
16
+ * '0x123...',
17
+ * '0xabc...',
18
+ * publicClient,
19
+ * );
20
+ * ```
21
+ */
22
+ export declare function deriveAgentAddress(eoaAddress: Address, accountIndexHash: string, publicClient: any): Promise<Address>;
23
+ //# sourceMappingURL=deriveAgentAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveAgentAddress.d.ts","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/deriveAgentAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,OAAO,EACnB,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,GAAG,GAChB,OAAO,CAAC,OAAO,CAAC,CAUlB"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveAgentAddress = deriveAgentAddress;
4
+ const ecdsa_validator_1 = require("@zerodev/ecdsa-validator");
5
+ const constants_1 = require("@zerodev/sdk/constants");
6
+ /**
7
+ * Derive the agent smart account address for a given EOA address.
8
+ *
9
+ * This uses the ZeroDev SDK to deterministically compute the smart account address
10
+ * based on the EOA address and account index hash.
11
+ *
12
+ * @param eoaAddress - The EOA (Externally Owned Account) address
13
+ * @param accountIndexHash - The account index hash from app registration
14
+ * @param publicClient - Viem public client
15
+ * @returns The derived agent smart account address
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const agentAddress = await deriveAgentAddress(
20
+ * '0x123...',
21
+ * '0xabc...',
22
+ * publicClient,
23
+ * );
24
+ * ```
25
+ */
26
+ async function deriveAgentAddress(eoaAddress, accountIndexHash, publicClient) {
27
+ const agentAddress = await (0, ecdsa_validator_1.getKernelAddressFromECDSA)({
28
+ entryPoint: (0, constants_1.getEntryPoint)('0.7'),
29
+ kernelVersion: constants_1.KERNEL_V3_1,
30
+ eoaAddress,
31
+ index: BigInt(accountIndexHash),
32
+ publicClient: publicClient,
33
+ });
34
+ return agentAddress;
35
+ }
36
+ //# sourceMappingURL=deriveAgentAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveAgentAddress.js","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/deriveAgentAddress.ts"],"names":[],"mappings":";;AAwBA,gDAcC;AArCD,8DAAqE;AACrE,sDAAoE;AAEpE;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,kBAAkB,CACtC,UAAmB,EACnB,gBAAwB,EACxB,YAAiB;IAEjB,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAyB,EAAC;QACnD,UAAU,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;QAChC,aAAa,EAAE,uBAAW;QAC1B,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAC/B,YAAY,EAAE,YAAmB;KAClC,CAAC,CAAC;IAEH,OAAO,YAAuB,CAAC;AACjC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Hex, LocalAccount } from 'viem';
2
+ export interface VincentViemPkpSignerParams {
3
+ privateKey: Hex;
4
+ onSignUserOpHash?: (params: {
5
+ userOpHash: Hex;
6
+ userOp: any;
7
+ }) => Promise<Hex>;
8
+ }
9
+ export declare function createVincentViemPkpSigner(params: VincentViemPkpSignerParams): LocalAccount & {
10
+ setCurrentUserOp: (userOp: any) => void;
11
+ };
12
+ //# sourceMappingURL=vincentViemPkpSigner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincentViemPkpSigner.d.ts","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/vincentViemPkpSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAC;AAI/D,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,GAAG,CAAC;IAChB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/E;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,0BAA0B,GACjC,YAAY,GAAG;IAAE,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;CAAE,CA+F5D"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createVincentViemPkpSigner = createVincentViemPkpSigner;
4
+ const accounts_1 = require("viem/accounts");
5
+ const accounts_2 = require("viem/accounts");
6
+ function createVincentViemPkpSigner(params) {
7
+ const { privateKey, onSignUserOpHash } = params;
8
+ let currentUserOp = null;
9
+ const account = (0, accounts_1.toAccount)({
10
+ address: (0, accounts_1.privateKeyToAddress)(privateKey),
11
+ async signMessage({ message }) {
12
+ console.log('[createVincentViemPkpSigner] signMessage called by ZeroDev');
13
+ console.log('message:', message);
14
+ console.log('message type:', typeof message);
15
+ console.log('currentUserOp status:', currentUserOp ? 'SET' : 'NOT SET');
16
+ let userOpHash;
17
+ if (typeof message === 'object' && 'raw' in message) {
18
+ userOpHash = message.raw;
19
+ console.log('message.raw (UserOp hash):', userOpHash);
20
+ if (currentUserOp) {
21
+ console.log('Full UserOp available for Lit Action:', JSON.stringify(currentUserOp, (key, value) => (typeof value === 'bigint' ? value.toString() : value), 2));
22
+ }
23
+ else {
24
+ throw new Error('[createVincentViemPkpSigner] currentUserOp is null, wrapKernelAccountWithUserOpCapture did not intercept correctly');
25
+ }
26
+ }
27
+ // If callback provided and we have the full UserOp, use it
28
+ if (onSignUserOpHash && userOpHash && currentUserOp) {
29
+ const signature = await onSignUserOpHash({
30
+ userOpHash,
31
+ userOp: currentUserOp,
32
+ });
33
+ // Clear the current UserOp after signing
34
+ currentUserOp = null;
35
+ return signature;
36
+ }
37
+ // Fallback to direct signing with private key
38
+ if (privateKey) {
39
+ const signature = await (0, accounts_2.signMessage)({ message, privateKey });
40
+ currentUserOp = null; // Clear after signing
41
+ return signature;
42
+ }
43
+ throw new Error('signMessage: No privateKey provided');
44
+ },
45
+ async signTransaction(transaction, options) {
46
+ console.log('[createVincentViemPkpSigner] signTransaction called by ZeroDev');
47
+ console.log('transaction:', JSON.stringify(transaction, null, 2));
48
+ console.log('options:', options);
49
+ console.log('currentUserOp status:', currentUserOp ? 'SET' : 'NOT SET');
50
+ if (privateKey) {
51
+ return (0, accounts_2.signTransaction)({
52
+ privateKey,
53
+ transaction,
54
+ serializer: options?.serializer,
55
+ });
56
+ }
57
+ throw new Error('[createVincentViemPkpSigner] signTransaction: No privateKey provided');
58
+ },
59
+ async signTypedData(parameters) {
60
+ console.log('[createVincentViemPkpSigner] signTypedData called by ZeroDev');
61
+ console.log('parameters:', JSON.stringify(parameters, null, 2));
62
+ if (parameters.domain)
63
+ console.log('parameters.domain:', parameters.domain);
64
+ if (parameters.types)
65
+ console.log('parameters.types:', parameters.types);
66
+ if (parameters.primaryType)
67
+ console.log('parameters.primaryType:', parameters.primaryType);
68
+ if (parameters.message)
69
+ console.log('parameters.message:', parameters.message);
70
+ if (privateKey) {
71
+ return (0, accounts_2.signTypedData)({ ...parameters, privateKey });
72
+ }
73
+ throw new Error('[createVincentViemPkpSigner] signTypedData: No privateKey provided');
74
+ },
75
+ });
76
+ // Add method to set the current UserOp before signing
77
+ account.setCurrentUserOp = (userOp) => {
78
+ currentUserOp = userOp;
79
+ };
80
+ return account;
81
+ }
82
+ //# sourceMappingURL=vincentViemPkpSigner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincentViemPkpSigner.js","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/vincentViemPkpSigner.ts"],"names":[],"mappings":";;AASA,gEAiGC;AAzGD,4CAA+D;AAC/D,4CAA4E;AAO5E,SAAgB,0BAA0B,CACxC,MAAkC;IAElC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEhD,IAAI,aAAa,GAAQ,IAAI,CAAC;IAE9B,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC;QACxB,OAAO,EAAE,IAAA,8BAAmB,EAAC,UAAU,CAAC;QAExC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAgC;YACzD,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;YAC1E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,OAAO,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAExE,IAAI,UAA2B,CAAC;YAChC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;gBACpD,UAAU,GAAG,OAAO,CAAC,GAAU,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,UAAU,CAAC,CAAC;gBAEtD,IAAI,aAAa,EAAE,CAAC;oBAClB,OAAO,CAAC,GAAG,CACT,uCAAuC,EACvC,IAAI,CAAC,SAAS,CACZ,aAAa,EACb,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAC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sEAAsE,CAAC,CAAC;QAC1F,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,UAAe;YACjC,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;YAC5E,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAChE,IAAI,UAAU,CAAC,MAAM;gBAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAC5E,IAAI,UAAU,CAAC,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;YACzE,IAAI,UAAU,CAAC,WAAW;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;YAC3F,IAAI,UAAU,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;YAE/E,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,IAAA,wBAAa,EAAC,EAAE,GAAG,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;YACtD,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;KACF,CAA+D,CAAC;IAEjE,sDAAsD;IACtD,OAAO,CAAC,gBAAgB,GAAG,CAAC,MAAW,EAAE,EAAE;QACzC,aAAa,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Wraps a kernel account to intercept UserOp preparation and provide it to the signer.
3
+ *
4
+ * This allows the signer to receive both the UserOp hash AND the full UserOp structure,
5
+ * which is needed for passing to Lit Actions for policy validation.
6
+ */
7
+ export declare function wrapKernelAccountWithUserOpCapture(kernelAccount: any, customSigner: any & {
8
+ setCurrentUserOp: (userOp: any) => void;
9
+ }): any;
10
+ //# sourceMappingURL=wrapKernelAccountWithUserOpCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapKernelAccountWithUserOpCapture.d.ts","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,aAAa,EAAE,GAAG,EAClB,YAAY,EAAE,GAAG,GAAG;IAAE,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;CAAE,OA4BhE"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapKernelAccountWithUserOpCapture = wrapKernelAccountWithUserOpCapture;
4
+ /**
5
+ * Wraps a kernel account to intercept UserOp preparation and provide it to the signer.
6
+ *
7
+ * This allows the signer to receive both the UserOp hash AND the full UserOp structure,
8
+ * which is needed for passing to Lit Actions for policy validation.
9
+ */
10
+ function wrapKernelAccountWithUserOpCapture(kernelAccount, customSigner) {
11
+ return new Proxy(kernelAccount, {
12
+ get(target, prop) {
13
+ const original = target[prop];
14
+ // Intercept signUserOperation - this is where the UserOp is passed!
15
+ if (prop === 'signUserOperation') {
16
+ return async function (userOp) {
17
+ console.log('[wrapKernelAccount] Intercepted signUserOperation');
18
+ console.log('[wrapKernelAccount] UserOp keys:', Object.keys(userOp || {}));
19
+ // Provide the UserOp to the signer BEFORE signing
20
+ customSigner.setCurrentUserOp(userOp);
21
+ // Call the original signUserOperation method
22
+ const result = await original.call(target, userOp);
23
+ return result;
24
+ };
25
+ }
26
+ // Return original property/method
27
+ if (typeof original === 'function') {
28
+ return original.bind(target);
29
+ }
30
+ return original;
31
+ },
32
+ });
33
+ }
34
+ //# sourceMappingURL=wrapKernelAccountWithUserOpCapture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapKernelAccountWithUserOpCapture.js","sourceRoot":"","sources":["../../../../../src/lib/setup/smart-account/wrapKernelAccountWithUserOpCapture.ts"],"names":[],"mappings":";;AAMA,gFA8BC;AApCD;;;;;GAKG;AACH,SAAgB,kCAAkC,CAChD,aAAkB,EAClB,YAA+D;IAE/D,OAAO,IAAI,KAAK,CAAC,aAAa,EAAE;QAC9B,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAE9B,oEAAoE;YACpE,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACjC,OAAO,KAAK,WAAW,MAAW;oBAChC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;oBACjE,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;oBAE3E,kDAAkD;oBAClD,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAEtC,6CAA6C;oBAC7C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBACnD,OAAO,MAAM,CAAC;gBAChB,CAAC,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}