permissionless 0.2.13 → 0.2.15

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 (82) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  3. package/_cjs/accounts/index.js +3 -1
  4. package/_cjs/accounts/index.js.map +1 -1
  5. package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  6. package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/nexus/toNexusSmartAccount.js +198 -0
  8. package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  9. package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -9
  10. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  11. package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  13. package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
  14. package/_cjs/actions/erc7579/isModuleInstalled.js +8 -13
  15. package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
  16. package/_cjs/utils/encodeInstallModule.js +9 -6
  17. package/_cjs/utils/encodeInstallModule.js.map +1 -1
  18. package/_cjs/utils/encodeUninstallModule.js +9 -6
  19. package/_cjs/utils/encodeUninstallModule.js.map +1 -1
  20. package/_cjs/utils/toOwner.js.map +1 -1
  21. package/_esm/accounts/biconomy/toBiconomySmartAccount.js +2 -7
  22. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  23. package/_esm/accounts/index.js +2 -1
  24. package/_esm/accounts/index.js.map +1 -1
  25. package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  26. package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
  27. package/_esm/accounts/nexus/toNexusSmartAccount.js +201 -0
  28. package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  29. package/_esm/accounts/safe/toSafeSmartAccount.js +1 -9
  30. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  31. package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  32. package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  33. package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
  34. package/_esm/actions/erc7579/isModuleInstalled.js +8 -13
  35. package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
  36. package/_esm/utils/encodeInstallModule.js +9 -6
  37. package/_esm/utils/encodeInstallModule.js.map +1 -1
  38. package/_esm/utils/encodeUninstallModule.js +9 -6
  39. package/_esm/utils/encodeUninstallModule.js.map +1 -1
  40. package/_esm/utils/toOwner.js.map +1 -1
  41. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +5 -9
  42. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  43. package/_types/accounts/index.d.ts +2 -1
  44. package/_types/accounts/index.d.ts.map +1 -1
  45. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +3 -2
  46. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
  47. package/_types/accounts/light/toLightSmartAccount.d.ts +3 -2
  48. package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
  49. package/_types/accounts/nexus/toNexusSmartAccount.d.ts +27 -0
  50. package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -0
  51. package/_types/accounts/safe/toSafeSmartAccount.d.ts +3 -2
  52. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  53. package/_types/accounts/simple/toSimpleSmartAccount.d.ts +3 -2
  54. package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
  55. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +3 -2
  56. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
  57. package/_types/accounts/trust/toTrustSmartAccount.d.ts +3 -2
  58. package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
  59. package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
  60. package/_types/utils/encodeInstallModule.d.ts.map +1 -1
  61. package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
  62. package/_types/utils/toOwner.d.ts +6 -3
  63. package/_types/utils/toOwner.d.ts.map +1 -1
  64. package/accounts/biconomy/toBiconomySmartAccount.ts +4 -11
  65. package/accounts/index.ts +11 -0
  66. package/accounts/kernel/toEcdsaKernelSmartAccount.ts +2 -3
  67. package/accounts/light/toLightSmartAccount.ts +2 -3
  68. package/accounts/nexus/toNexusSmartAccount.ts +330 -0
  69. package/accounts/safe/toSafeSmartAccount.ts +3 -14
  70. package/accounts/simple/toSimpleSmartAccount.ts +2 -3
  71. package/accounts/thirdweb/toThirdwebSmartAccount.ts +2 -3
  72. package/accounts/trust/toTrustSmartAccount.ts +2 -3
  73. package/actions/erc7579/installModule.test.ts +4 -4
  74. package/actions/erc7579/installModules.test.ts +4 -4
  75. package/actions/erc7579/isModuleInstalled.test.ts +2 -2
  76. package/actions/erc7579/isModuleInstalled.ts +8 -13
  77. package/actions/erc7579/uninstallModule.test.ts +2 -2
  78. package/actions/erc7579/uninstallModules.test.ts +2 -2
  79. package/package.json +1 -1
  80. package/utils/encodeInstallModule.ts +9 -6
  81. package/utils/encodeUninstallModule.ts +9 -6
  82. package/utils/toOwner.ts +7 -12
@@ -1,5 +1,6 @@
1
- import { type Account, type Address, type Assign, type Chain, type Client, type EIP1193Provider, type LocalAccount, type OneOf, type Transport, type WalletClient } from "viem";
1
+ import { type Account, type Address, type Assign, type Chain, type Client, type LocalAccount, type OneOf, type Transport, type WalletClient } from "viem";
2
2
  import { type SmartAccount, type SmartAccountImplementation, entryPoint06Abi } from "viem/account-abstraction";
3
+ import { type EthereumProvider } from "../../utils/toOwner";
3
4
  /**
4
5
  * Default addresses for Trust Smart Account
5
6
  */
@@ -9,7 +10,7 @@ export declare const TRUST_ADDRESSES: {
9
10
  };
10
11
  export type ToTrustSmartAccountParameters = {
11
12
  client: Client;
12
- owner: OneOf<EIP1193Provider | WalletClient<Transport, Chain | undefined, Account> | LocalAccount>;
13
+ owner: OneOf<EthereumProvider | WalletClient<Transport, Chain | undefined, Account> | LocalAccount>;
13
14
  factoryAddress?: Address;
14
15
  entryPoint: {
15
16
  address: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"toTrustSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/trust/toTrustSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AA8BjC;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE;IAC1B,iCAAiC,EAAE,OAAO,CAAA;IAC1C,cAAc,EAAE,OAAO,CAAA;CAK1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CACN,eAAe,GACf,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB,CAAA;IACD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE;QACR,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,KAAK,CAAA;KACjB,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAChD,0BAA0B,CACtB,OAAO,eAAe,EACtB,KAAK,CAMR,EACD;IAAE,IAAI,EAAE,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAC5D,CAAA;AAED,MAAM,MAAM,6BAA6B,GACrC,YAAY,CAAC,+BAA+B,CAAC,CAAA;AAEjD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACrC,UAAU,EAAE,6BAA6B,GAC1C,OAAO,CAAC,6BAA6B,CAAC,CAkHxC"}
1
+ {"version":3,"file":"toTrustSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/trust/toTrustSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAIb,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAE/B,eAAe,EAIlB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,qBAAqB,CAAA;AA2BpE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE;IAC1B,iCAAiC,EAAE,OAAO,CAAA;IAC1C,cAAc,EAAE,OAAO,CAAA;CAK1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CACN,gBAAgB,GAChB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB,CAAA;IACD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE;QACR,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,KAAK,CAAA;KACjB,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAChD,0BAA0B,CACtB,OAAO,eAAe,EACtB,KAAK,CAMR,EACD;IAAE,IAAI,EAAE,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAC5D,CAAA;AAED,MAAM,MAAM,6BAA6B,GACrC,YAAY,CAAC,+BAA+B,CAAC,CAAA;AAEjD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACrC,UAAU,EAAE,6BAA6B,GAC1C,OAAO,CAAC,6BAA6B,CAAC,CAkHxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isModuleInstalled.d.ts","sourceRoot":"","sources":["../../../actions/erc7579/isModuleInstalled.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,SAAS,EAIjB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,kBAAkB,CAAA;AAErE,MAAM,MAAM,2BAA2B,CACnC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACC;IACI,iBAAiB,EAAE,GAAG,CAAA;CACzB,GACD;IACI,OAAO,EAAE,GAAG,CAAA;CACf,CACN,CAAA;AAEL,wBAAsB,iBAAiB,CACnC,aAAa,SAAS,YAAY,GAAG,SAAS,EAE9C,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,aAAa,CAAC,EAC3D,UAAU,EAAE,2BAA2B,CAAC,aAAa,CAAC,GACvD,OAAO,CAAC,OAAO,CAAC,CAgGlB"}
1
+ {"version":3,"file":"isModuleInstalled.d.ts","sourceRoot":"","sources":["../../../actions/erc7579/isModuleInstalled.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,SAAS,EAIjB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,kBAAkB,CAAA;AAErE,MAAM,MAAM,2BAA2B,CACnC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACC;IACI,iBAAiB,EAAE,GAAG,CAAA;CACzB,GACD;IACI,OAAO,EAAE,GAAG,CAAA;CACf,CACN,CAAA;AAEL,wBAAsB,iBAAiB,CACnC,aAAa,SAAS,YAAY,GAAG,SAAS,EAE9C,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,aAAa,CAAC,EAC3D,UAAU,EAAE,2BAA2B,CAAC,aAAa,CAAC,GACvD,OAAO,CAAC,OAAO,CAAC,CA2FlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"encodeInstallModule.d.ts","sourceRoot":"","sources":["../../utils/encodeInstallModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,KAAK,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,UAAU,EAElB,MAAM,mCAAmC,CAAA;AAG1C,MAAM,MAAM,4BAA4B,GAAG;IACvC,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACH;IACI,OAAO,EAAE,GAAG,CAAA;CACf,GACD;IACI,QAAQ,EAAE,GAAG,CAAA;CAChB,CACN,CAAA;AAED,MAAM,MAAM,6BAA6B,CACrC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,OAAO,EAAE,4BAA4B,EAAE,GAAG,4BAA4B,CAAA;CACzE,CAAA;AAED,wBAAgB,mBAAmB,CAC/B,aAAa,SAAS,YAAY,GAAG,SAAS,EAChD,UAAU,EAAE,6BAA6B,CAAC,aAAa,CAAC;;;;IA+CzD"}
1
+ {"version":3,"file":"encodeInstallModule.d.ts","sourceRoot":"","sources":["../../utils/encodeInstallModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,KAAK,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,UAAU,EAElB,MAAM,mCAAmC,CAAA;AAG1C,MAAM,MAAM,4BAA4B,GAAG;IACvC,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACH;IACI,OAAO,EAAE,GAAG,CAAA;CACf,GACD;IACI,QAAQ,EAAE,GAAG,CAAA;CAChB,CACN,CAAA;AAED,MAAM,MAAM,6BAA6B,CACrC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,OAAO,EAAE,4BAA4B,EAAE,GAAG,4BAA4B,CAAA;CACzE,CAAA;AAED,wBAAgB,mBAAmB,CAC/B,aAAa,SAAS,YAAY,GAAG,SAAS,EAChD,UAAU,EAAE,6BAA6B,CAAC,aAAa,CAAC;;;;IAkDzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"encodeUninstallModule.d.ts","sourceRoot":"","sources":["../../utils/encodeUninstallModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,KAAK,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,UAAU,EAElB,MAAM,mCAAmC,CAAA;AAG1C,MAAM,MAAM,8BAA8B,GAAG;IACzC,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACH;IACI,OAAO,EAAE,GAAG,CAAA;CACf,GACD;IACI,UAAU,EAAE,GAAG,CAAA;CAClB,CACN,CAAA;AAED,MAAM,MAAM,+BAA+B,CACvC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,OAAO,EAAE,8BAA8B,EAAE,GAAG,8BAA8B,CAAA;CAC7E,CAAA;AAED,wBAAgB,qBAAqB,CACjC,aAAa,SAAS,YAAY,GAAG,SAAS,EAChD,UAAU,EAAE,+BAA+B,CAAC,aAAa,CAAC;;;;IA+C3D"}
1
+ {"version":3,"file":"encodeUninstallModule.d.ts","sourceRoot":"","sources":["../../utils/encodeUninstallModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,KAAK,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACR,wBAAwB,EACxB,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,UAAU,EAElB,MAAM,mCAAmC,CAAA;AAG1C,MAAM,MAAM,8BAA8B,GAAG;IACzC,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CACH;IACI,OAAO,EAAE,GAAG,CAAA;CACf,GACD;IACI,UAAU,EAAE,GAAG,CAAA;CAClB,CACN,CAAA;AAED,MAAM,MAAM,+BAA+B,CACvC,aAAa,SAAS,YAAY,GAAG,SAAS,IAC9C,wBAAwB,CAAC,aAAa,CAAC,GAAG;IAC1C,OAAO,EAAE,8BAA8B,EAAE,GAAG,8BAA8B,CAAA;CAC7E,CAAA;AAED,wBAAgB,qBAAqB,CACjC,aAAa,SAAS,YAAY,GAAG,SAAS,EAChD,UAAU,EAAE,+BAA+B,CAAC,aAAa,CAAC;;;;IAkD3D"}
@@ -1,6 +1,9 @@
1
- import { type Account, type Address, type Chain, type EIP1193Provider, type LocalAccount, type OneOf, type Transport, type WalletClient } from "viem";
2
- export declare function toOwner({ owner, address }: {
3
- owner: OneOf<EIP1193Provider | WalletClient<Transport, Chain | undefined, Account> | LocalAccount>;
1
+ import { type Account, type Address, type Chain, type LocalAccount, type OneOf, type Transport, type WalletClient } from "viem";
2
+ export type EthereumProvider = {
3
+ request(...args: any): Promise<any>;
4
+ };
5
+ export declare function toOwner<provider extends EthereumProvider>({ owner, address }: {
6
+ owner: OneOf<provider | WalletClient<Transport, Chain | undefined, Account> | LocalAccount>;
4
7
  address?: Address;
5
8
  }): Promise<LocalAccount>;
6
9
  //# sourceMappingURL=toOwner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toOwner.d.ts","sourceRoot":"","sources":["../../utils/toOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,eAAe,EAGpB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAMb,wBAAsB,OAAO,CAAC,EAC1B,KAAK,EACL,OAAO,EACV,EAAE;IACC,KAAK,EAAE,KAAK,CACN,eAAe,GACf,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6DxB"}
1
+ {"version":3,"file":"toOwner.d.ts","sourceRoot":"","sources":["../../utils/toOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGpB,MAAM,MAAM,CAAA;AAMb,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,CAAA;AAEtE,wBAAsB,OAAO,CAAC,QAAQ,SAAS,gBAAgB,EAAE,EAC7D,KAAK,EACL,OAAO,EACV,EAAE;IACC,KAAK,EAAE,KAAK,CACN,QAAQ,GACR,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,CAAC,GACnD,YAAY,CACjB,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyDxB"}
@@ -2,7 +2,6 @@ import type {
2
2
  Account,
3
3
  Assign,
4
4
  Chain,
5
- EIP1193Provider,
6
5
  OneOf,
7
6
  Prettify,
8
7
  Transport,
@@ -31,7 +30,7 @@ import {
31
30
  } from "viem/account-abstraction"
32
31
  import { signMessage } from "viem/actions"
33
32
  import { getAccountNonce } from "../../actions/public/getAccountNonce"
34
- import { toOwner } from "../../utils/toOwner"
33
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
35
34
  import { BiconomyAbi, FactoryAbi } from "./abi/BiconomySmartAccountAbi"
36
35
 
37
36
  const BICONOMY_PROXY_CREATION_CODE =
@@ -95,7 +94,7 @@ export type ToBiconomySmartAccountParameters = Prettify<{
95
94
  client: Client
96
95
  owners: [
97
96
  OneOf<
98
- | EIP1193Provider
97
+ | EthereumProvider
99
98
  | WalletClient<Transport, Chain | undefined, Account>
100
99
  | LocalAccount
101
100
  >
@@ -176,15 +175,9 @@ const getAccountAddress = async ({
176
175
  }
177
176
 
178
177
  /**
179
- * Build a Biconomy modular smart account from a private key, that use the ECDSA signer behind the scene
180
- * @param client
181
- * @param privateKey
182
- * @param entryPoint
183
- * @param index
184
- * @param factoryAddress
185
- * @param ecdsaModuleAddress
178
+ * @deprecated Biconomy Smart Account is deprecated. Please use toNexusSmartAccount instead.
179
+ * @see toNexusSmartAccount
186
180
  */
187
-
188
181
  export async function toBiconomySmartAccount(
189
182
  parameters: ToBiconomySmartAccountParameters
190
183
  ): Promise<ToBiconomySmartAccountReturnType> {
package/accounts/index.ts CHANGED
@@ -43,6 +43,13 @@ import {
43
43
  toBiconomySmartAccount
44
44
  } from "./biconomy/toBiconomySmartAccount"
45
45
 
46
+ import {
47
+ type NexusSmartAccountImplementation,
48
+ type ToNexusSmartAccountParameters,
49
+ type ToNexusSmartAccountReturnType,
50
+ toNexusSmartAccount
51
+ } from "./nexus/toNexusSmartAccount"
52
+
46
53
  import {
47
54
  type ThirdwebSmartAccountImplementation,
48
55
  type ToThirdwebSmartAccountParameters,
@@ -74,6 +81,10 @@ export {
74
81
  type SafeVersion,
75
82
  type KernelVersion,
76
83
  toEcdsaKernelSmartAccount,
84
+ type NexusSmartAccountImplementation,
85
+ type ToNexusSmartAccountParameters,
86
+ type ToNexusSmartAccountReturnType,
87
+ toNexusSmartAccount,
77
88
  type ToBiconomySmartAccountReturnType,
78
89
  type ToBiconomySmartAccountParameters,
79
90
  type BiconomySmartAccountImplementation,
@@ -2,7 +2,6 @@ import type {
2
2
  Account,
3
3
  Assign,
4
4
  Chain,
5
- EIP1193Provider,
6
5
  OneOf,
7
6
  Transport,
8
7
  WalletClient
@@ -32,7 +31,7 @@ import { signMessage as _signMessage, getChainId } from "viem/actions"
32
31
  import { getAction } from "viem/utils"
33
32
  import { getAccountNonce } from "../../actions/public/getAccountNonce"
34
33
  import { getSenderAddress } from "../../actions/public/getSenderAddress"
35
- import { toOwner } from "../../utils/toOwner"
34
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
36
35
  import { KernelInitAbi } from "./abi/KernelAccountAbi"
37
36
  import { KernelV3InitAbi, KernelV3_1AccountAbi } from "./abi/KernelV3AccountAbi"
38
37
  import { KernelV3MetaFactoryDeployWithFactoryAbi } from "./abi/KernelV3MetaFactoryAbi"
@@ -305,7 +304,7 @@ export type ToEcdsaKernelSmartAccountParameters<
305
304
  client: Client
306
305
  owners: [
307
306
  OneOf<
308
- | EIP1193Provider
307
+ | EthereumProvider
309
308
  | WalletClient<Transport, Chain | undefined, Account>
310
309
  | LocalAccount
311
310
  >
@@ -4,7 +4,6 @@ import {
4
4
  type Assign,
5
5
  type Chain,
6
6
  type Client,
7
- type EIP1193Provider,
8
7
  type Hex,
9
8
  type LocalAccount,
10
9
  type OneOf,
@@ -29,7 +28,7 @@ import { getChainId, signMessage } from "viem/actions"
29
28
  import { getAction } from "viem/utils"
30
29
  import { getAccountNonce } from "../../actions/public/getAccountNonce"
31
30
  import { getSenderAddress } from "../../actions/public/getSenderAddress"
32
- import { toOwner } from "../../utils/toOwner"
31
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
33
32
 
34
33
  const getAccountInitCode = async (
35
34
  owner: Address,
@@ -81,7 +80,7 @@ export type ToLightSmartAccountParameters<
81
80
  version: entryPointVersion
82
81
  }
83
82
  owner: OneOf<
84
- | EIP1193Provider
83
+ | EthereumProvider
85
84
  | WalletClient<Transport, Chain | undefined, Account>
86
85
  | LocalAccount
87
86
  >
@@ -0,0 +1,330 @@
1
+ import type {
2
+ Account,
3
+ Assign,
4
+ Chain,
5
+ OneOf,
6
+ Prettify,
7
+ Transport,
8
+ TypedDataDefinition,
9
+ WalletClient
10
+ } from "viem"
11
+ import {
12
+ type Address,
13
+ type Client,
14
+ type Hex,
15
+ type LocalAccount,
16
+ concat,
17
+ concatHex,
18
+ domainSeparator,
19
+ encodeAbiParameters,
20
+ encodeFunctionData,
21
+ encodePacked,
22
+ getTypesForEIP712Domain,
23
+ hashMessage,
24
+ hashTypedData,
25
+ keccak256,
26
+ stringToHex,
27
+ toHex,
28
+ validateTypedData
29
+ } from "viem"
30
+ import {
31
+ type SmartAccount,
32
+ type SmartAccountImplementation,
33
+ entryPoint07Abi,
34
+ entryPoint07Address,
35
+ getUserOperationHash,
36
+ toSmartAccount
37
+ } from "viem/account-abstraction"
38
+ import { getChainId, readContract } from "viem/actions"
39
+ import { getAction } from "viem/utils"
40
+ import { getAccountNonce } from "../../actions/public/getAccountNonce"
41
+ import { encode7579Calls } from "../../utils"
42
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
43
+
44
+ const wrapMessageHash = (
45
+ messageHash: Hex,
46
+ {
47
+ accountAddress,
48
+ version,
49
+ chainId
50
+ }: {
51
+ accountAddress: Address
52
+ version: "1.0.0"
53
+ chainId: number
54
+ }
55
+ ) => {
56
+ const _domainSeparator = domainSeparator({
57
+ domain: {
58
+ name: "Nexus",
59
+ version: version,
60
+ chainId,
61
+ verifyingContract: accountAddress
62
+ }
63
+ })
64
+ const parentStructHash = keccak256(
65
+ encodeAbiParameters(
66
+ [{ type: "bytes32" }, { type: "bytes32" }],
67
+ [
68
+ keccak256(stringToHex("PersonalSign(bytes prefixed)")),
69
+ messageHash
70
+ ]
71
+ )
72
+ )
73
+ return keccak256(concatHex(["0x1901", _domainSeparator, parentStructHash]))
74
+ }
75
+
76
+ /**
77
+ * The account creation ABI for Biconomy Smart Account (from the biconomy SmartAccountFactory)
78
+ */
79
+
80
+ /**
81
+ * Default addresses for Biconomy Smart Account
82
+ */
83
+ const BICONOMY_ADDRESSES: {
84
+ K1_VALIDATOR_FACTORY_ADDRESS: Address
85
+ K1_VALIDATOR_ADDRESS: Address
86
+ } = {
87
+ K1_VALIDATOR_FACTORY_ADDRESS: "0x00000bb19a3579F4D779215dEf97AFbd0e30DB55",
88
+ K1_VALIDATOR_ADDRESS: "0x00000004171351c442B202678c48D8AB5B321E8f"
89
+ }
90
+
91
+ export type ToNexusSmartAccountParameters = Prettify<{
92
+ client: Client
93
+ owners: [
94
+ OneOf<
95
+ | EthereumProvider
96
+ | WalletClient<Transport, Chain | undefined, Account>
97
+ | LocalAccount
98
+ >
99
+ ]
100
+ version: "1.0.0"
101
+ address?: Address | undefined
102
+ entryPoint?: {
103
+ address: Address
104
+ version: "0.7"
105
+ }
106
+ index?: bigint
107
+ factoryAddress?: Address
108
+ validatorAddress?: Address
109
+ attesters?: Address[]
110
+ threshold?: number
111
+ }>
112
+
113
+ export type NexusSmartAccountImplementation = Assign<
114
+ SmartAccountImplementation<typeof entryPoint07Abi, "0.7">,
115
+ { sign: NonNullable<SmartAccountImplementation["sign"]> }
116
+ >
117
+
118
+ export type ToNexusSmartAccountReturnType = Prettify<
119
+ SmartAccount<NexusSmartAccountImplementation>
120
+ >
121
+
122
+ export async function toNexusSmartAccount(
123
+ parameters: ToNexusSmartAccountParameters
124
+ ): Promise<ToNexusSmartAccountReturnType> {
125
+ const {
126
+ owners,
127
+ client,
128
+ index = 0n,
129
+ address,
130
+ version,
131
+ factoryAddress = BICONOMY_ADDRESSES.K1_VALIDATOR_FACTORY_ADDRESS,
132
+ validatorAddress = BICONOMY_ADDRESSES.K1_VALIDATOR_ADDRESS,
133
+ attesters = [],
134
+ threshold = 0
135
+ } = parameters
136
+
137
+ const localOwner = await toOwner({ owner: owners[0] })
138
+
139
+ const entryPoint = {
140
+ address: parameters.entryPoint?.address ?? entryPoint07Address,
141
+ abi: entryPoint07Abi,
142
+ version: parameters.entryPoint?.version ?? "0.7"
143
+ }
144
+
145
+ let accountAddress: Address | undefined = address
146
+
147
+ const getFactoryArgs = async () => {
148
+ return {
149
+ factory: factoryAddress,
150
+ factoryData: encodeFunctionData({
151
+ abi: [
152
+ {
153
+ name: "createAccount",
154
+ type: "function",
155
+ stateMutability: "nonpayable",
156
+ inputs: [
157
+ { type: "address", name: "eoaOwner" },
158
+ { type: "uint256", name: "index" },
159
+ { type: "address[]", name: "attesters" },
160
+ { type: "uint8", name: "threshold" }
161
+ ],
162
+ outputs: [{ type: "address" }]
163
+ }
164
+ ],
165
+ functionName: "createAccount",
166
+ args: [localOwner.address, index, attesters, threshold]
167
+ })
168
+ }
169
+ }
170
+
171
+ let chainId: number
172
+ const getMemoizedChainId = async () => {
173
+ if (chainId) return chainId
174
+ chainId = client.chain
175
+ ? client.chain.id
176
+ : await getAction(client, getChainId, "getChainId")({})
177
+ return chainId
178
+ }
179
+
180
+ return toSmartAccount({
181
+ client,
182
+ entryPoint,
183
+ getFactoryArgs,
184
+ async getAddress() {
185
+ if (accountAddress) return accountAddress
186
+
187
+ accountAddress = await readContract(client, {
188
+ address: factoryAddress,
189
+ abi: [
190
+ {
191
+ name: "computeAccountAddress",
192
+ type: "function",
193
+ stateMutability: "view",
194
+ inputs: [
195
+ { type: "address", name: "eoaOwner" },
196
+ { type: "uint256", name: "index" },
197
+ { type: "address[]", name: "attesters" },
198
+ { type: "uint8", name: "threshold" }
199
+ ],
200
+ outputs: [{ type: "address" }]
201
+ }
202
+ ],
203
+ functionName: "computeAccountAddress",
204
+ args: [localOwner.address, index, attesters, threshold]
205
+ })
206
+
207
+ return accountAddress
208
+ },
209
+ async getNonce(args) {
210
+ const TIMESTAMP_ADJUSTMENT = 16777215n // max value for size 3
211
+ const defaultedKey = (args?.key ?? 0n) % TIMESTAMP_ADJUSTMENT
212
+ const defaultedValidationMode = "0x00"
213
+ const key = concat([
214
+ toHex(defaultedKey, { size: 3 }),
215
+ defaultedValidationMode,
216
+ validatorAddress
217
+ ])
218
+
219
+ const address = await this.getAddress()
220
+
221
+ return getAccountNonce(client, {
222
+ address,
223
+ entryPointAddress: entryPoint.address,
224
+ key: BigInt(key)
225
+ })
226
+ },
227
+ encodeCalls: async (calls) => {
228
+ return encode7579Calls({
229
+ mode: {
230
+ type: calls.length > 1 ? "batchcall" : "call",
231
+ revertOnError: false,
232
+ selector: "0x",
233
+ context: "0x"
234
+ },
235
+ callData: calls
236
+ })
237
+ },
238
+ async getStubSignature() {
239
+ const dynamicPart = validatorAddress.substring(2).padEnd(40, "0")
240
+ return `0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${dynamicPart}000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000` as Hex
241
+ },
242
+ async sign({ hash }) {
243
+ return this.signMessage({ message: hash })
244
+ },
245
+ async signMessage({ message }) {
246
+ const wrappedMessageHash = wrapMessageHash(hashMessage(message), {
247
+ version,
248
+ accountAddress: await this.getAddress(),
249
+ chainId: await getMemoizedChainId()
250
+ })
251
+
252
+ const signature = await localOwner.signMessage({
253
+ message: {
254
+ raw: wrappedMessageHash
255
+ }
256
+ })
257
+
258
+ return encodePacked(
259
+ ["address", "bytes"],
260
+ [validatorAddress, signature]
261
+ )
262
+ },
263
+ async signTypedData(typedData) {
264
+ const {
265
+ message,
266
+ primaryType,
267
+ types: _types,
268
+ domain
269
+ } = typedData as TypedDataDefinition
270
+
271
+ const types = {
272
+ EIP712Domain: getTypesForEIP712Domain({
273
+ domain: domain
274
+ }),
275
+ ..._types
276
+ }
277
+
278
+ validateTypedData({
279
+ domain,
280
+ message,
281
+ primaryType,
282
+ types
283
+ })
284
+
285
+ const typedHash = hashTypedData({
286
+ message,
287
+ primaryType,
288
+ types,
289
+ domain
290
+ })
291
+
292
+ const wrappedMessageHash = wrapMessageHash(typedHash, {
293
+ version,
294
+ accountAddress: await this.getAddress(),
295
+ chainId: await getMemoizedChainId()
296
+ })
297
+
298
+ const signature = await localOwner.signMessage({
299
+ message: {
300
+ raw: wrappedMessageHash
301
+ }
302
+ })
303
+
304
+ return encodePacked(
305
+ ["address", "bytes"],
306
+ [validatorAddress, signature]
307
+ )
308
+ },
309
+ async signUserOperation(parameters) {
310
+ const { chainId = await getMemoizedChainId(), ...userOperation } =
311
+ parameters
312
+
313
+ if (!chainId) throw new Error("Chain id not found")
314
+
315
+ const hash = getUserOperationHash({
316
+ userOperation: {
317
+ ...userOperation,
318
+ sender: userOperation.sender ?? (await this.getAddress()),
319
+ signature: "0x"
320
+ },
321
+ entryPointAddress: entryPoint.address,
322
+ entryPointVersion: entryPoint.version,
323
+ chainId: chainId
324
+ })
325
+ return await localOwner.signMessage({
326
+ message: { raw: hash as Hex }
327
+ })
328
+ }
329
+ })
330
+ }
@@ -4,7 +4,6 @@ import {
4
4
  type Assign,
5
5
  type Chain,
6
6
  type Client,
7
- type EIP1193Provider,
8
7
  type Hex,
9
8
  type LocalAccount,
10
9
  type OneOf,
@@ -42,6 +41,7 @@ import { getAction } from "viem/utils"
42
41
  import { getAccountNonce } from "../../actions/public/getAccountNonce"
43
42
  import { isSmartAccountDeployed, toOwner } from "../../utils"
44
43
  import { encode7579Calls } from "../../utils/encode7579Calls"
44
+ import type { EthereumProvider } from "../../utils/toOwner"
45
45
 
46
46
  export type SafeVersion = "1.4.1"
47
47
 
@@ -940,7 +940,7 @@ export type ToSafeSmartAccountParameters<
940
940
  client: Client
941
941
  owners: [
942
942
  OneOf<
943
- | EIP1193Provider
943
+ | EthereumProvider
944
944
  | WalletClient<Transport, Chain | undefined, Account>
945
945
  | LocalAccount
946
946
  >
@@ -1439,12 +1439,9 @@ export async function toSafeSmartAccount<
1439
1439
  entryPoint: entryPoint.address
1440
1440
  }
1441
1441
 
1442
- let isDeployed = false
1443
-
1444
1442
  if ("initCode" in userOperation) {
1445
1443
  message.paymasterAndData =
1446
1444
  userOperation.paymasterAndData ?? "0x"
1447
- isDeployed = userOperation.initCode === "0x"
1448
1445
  }
1449
1446
 
1450
1447
  if ("factory" in userOperation) {
@@ -1458,14 +1455,6 @@ export async function toSafeSmartAccount<
1458
1455
  ...userOperation,
1459
1456
  sender: userOperation.sender ?? (await this.getAddress())
1460
1457
  })
1461
- isDeployed = !userOperation.factory
1462
- }
1463
-
1464
- let verifyingContract = safe4337ModuleAddress
1465
-
1466
- if (erc7579LaunchpadAddress && !isDeployed) {
1467
- verifyingContract =
1468
- userOperation.sender ?? (await this.getAddress())
1469
1458
  }
1470
1459
 
1471
1460
  const signatures = [
@@ -1475,7 +1464,7 @@ export async function toSafeSmartAccount<
1475
1464
  account: localOwner,
1476
1465
  domain: {
1477
1466
  chainId,
1478
- verifyingContract
1467
+ verifyingContract: safe4337ModuleAddress
1479
1468
  },
1480
1469
  types:
1481
1470
  entryPoint.version === "0.6"
@@ -4,7 +4,6 @@ import {
4
4
  type Assign,
5
5
  type Chain,
6
6
  type Client,
7
- type EIP1193Provider,
8
7
  type Hex,
9
8
  type LocalAccount,
10
9
  type OneOf,
@@ -26,7 +25,7 @@ import { getChainId, signMessage } from "viem/actions"
26
25
  import { getAction } from "viem/utils"
27
26
  import { getAccountNonce } from "../../actions/public/getAccountNonce"
28
27
  import { getSenderAddress } from "../../actions/public/getSenderAddress"
29
- import { toOwner } from "../../utils/toOwner"
28
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
30
29
 
31
30
  const getAccountInitCode = async (
32
31
  owner: Address,
@@ -71,7 +70,7 @@ export type ToSimpleSmartAccountParameters<
71
70
  > = {
72
71
  client: Client
73
72
  owner: OneOf<
74
- | EIP1193Provider
73
+ | EthereumProvider
75
74
  | WalletClient<Transport, Chain | undefined, Account>
76
75
  | LocalAccount
77
76
  >
@@ -4,7 +4,6 @@ import type {
4
4
  Assign,
5
5
  Chain,
6
6
  Client,
7
- EIP1193Provider,
8
7
  LocalAccount,
9
8
  OneOf,
10
9
  Transport,
@@ -25,7 +24,7 @@ import {
25
24
  toSmartAccount
26
25
  } from "viem/account-abstraction"
27
26
  import { getAction, toHex } from "viem/utils"
28
- import { toOwner } from "../../utils/toOwner"
27
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
29
28
  import { encodeCallData } from "./utils/encodeCallData"
30
29
  import { getAccountAddress } from "./utils/getAccountAddress"
31
30
  import { getFactoryData } from "./utils/getFactoryData"
@@ -49,7 +48,7 @@ export type ToThirdwebSmartAccountParameters<
49
48
  > = {
50
49
  client: Client
51
50
  owner: OneOf<
52
- | EIP1193Provider
51
+ | EthereumProvider
53
52
  | WalletClient<Transport, Chain | undefined, Account>
54
53
  | LocalAccount
55
54
  >
@@ -4,7 +4,6 @@ import {
4
4
  type Assign,
5
5
  type Chain,
6
6
  type Client,
7
- type EIP1193Provider,
8
7
  type Hex,
9
8
  type LocalAccount,
10
9
  type OneOf,
@@ -27,7 +26,7 @@ import {
27
26
  } from "viem/account-abstraction"
28
27
  import { getAction } from "viem/utils"
29
28
  import { getSenderAddress } from "../../actions/public/getSenderAddress"
30
- import { toOwner } from "../../utils/toOwner"
29
+ import { type EthereumProvider, toOwner } from "../../utils/toOwner"
31
30
  import { encodeCallData } from "./utils/encodeCallData"
32
31
  import { getFactoryData } from "./utils/getFactoryData"
33
32
 
@@ -69,7 +68,7 @@ export const TRUST_ADDRESSES: {
69
68
  export type ToTrustSmartAccountParameters = {
70
69
  client: Client
71
70
  owner: OneOf<
72
- | EIP1193Provider
71
+ | EthereumProvider
73
72
  | WalletClient<Transport, Chain | undefined, Account>
74
73
  | LocalAccount
75
74
  >