@account-kit/smart-contracts 4.0.0-alpha.5 → 4.0.0-alpha.7

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 (98) hide show
  1. package/dist/cjs/src/index.d.ts +1 -1
  2. package/dist/cjs/src/index.js +2 -2
  3. package/dist/cjs/src/index.js.map +1 -1
  4. package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
  5. package/dist/cjs/src/light-account/accounts/account.js +3 -2
  6. package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
  7. package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
  8. package/dist/cjs/src/light-account/accounts/base.js +8 -8
  9. package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
  10. package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
  11. package/dist/cjs/src/light-account/accounts/multiOwner.js +3 -2
  12. package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
  13. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  14. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  15. package/dist/cjs/src/light-account/types.d.ts +23 -31
  16. package/dist/cjs/src/light-account/types.js.map +1 -1
  17. package/dist/cjs/src/light-account/utils.d.ts +7 -10
  18. package/dist/cjs/src/light-account/utils.js +59 -88
  19. package/dist/cjs/src/light-account/utils.js.map +1 -1
  20. package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
  21. package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  22. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  23. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  24. package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
  25. package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
  26. package/dist/cjs/src/msca/utils.js.map +1 -1
  27. package/dist/esm/src/index.d.ts +1 -1
  28. package/dist/esm/src/index.js +1 -1
  29. package/dist/esm/src/index.js.map +1 -1
  30. package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
  31. package/dist/esm/src/light-account/accounts/account.js +3 -2
  32. package/dist/esm/src/light-account/accounts/account.js.map +1 -1
  33. package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
  34. package/dist/esm/src/light-account/accounts/base.js +8 -8
  35. package/dist/esm/src/light-account/accounts/base.js.map +1 -1
  36. package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
  37. package/dist/esm/src/light-account/accounts/multiOwner.js +4 -3
  38. package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
  39. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  40. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  41. package/dist/esm/src/light-account/types.d.ts +23 -31
  42. package/dist/esm/src/light-account/types.js.map +1 -1
  43. package/dist/esm/src/light-account/utils.d.ts +7 -10
  44. package/dist/esm/src/light-account/utils.js +57 -85
  45. package/dist/esm/src/light-account/utils.js.map +1 -1
  46. package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
  47. package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  48. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  49. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  50. package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
  51. package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
  52. package/dist/esm/src/msca/utils.js.map +1 -1
  53. package/dist/types/src/index.d.ts +1 -1
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/src/light-account/accounts/account.d.ts +5 -6
  56. package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
  57. package/dist/types/src/light-account/accounts/base.d.ts +7 -6
  58. package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
  59. package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
  60. package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
  61. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  62. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
  63. package/dist/types/src/light-account/types.d.ts +23 -118
  64. package/dist/types/src/light-account/types.d.ts.map +1 -1
  65. package/dist/types/src/light-account/utils.d.ts +19 -48
  66. package/dist/types/src/light-account/utils.d.ts.map +1 -1
  67. package/dist/types/src/msca/plugins/multisig/middleware.d.ts +6 -6
  68. package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
  69. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
  70. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
  71. package/dist/types/src/msca/plugins/session-key/permissions.d.ts +147 -1
  72. package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
  73. package/dist/types/src/msca/plugins/session-key/signer.d.ts +71 -1
  74. package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
  75. package/dist/types/src/msca/utils.d.ts +6 -6
  76. package/package.json +6 -5
  77. package/src/index.ts +1 -1
  78. package/src/light-account/accounts/account.ts +24 -45
  79. package/src/light-account/accounts/base.ts +39 -68
  80. package/src/light-account/accounts/multiOwner.ts +29 -43
  81. package/src/light-account/clients/multiOwnerAlchemyClient.ts +1 -1
  82. package/src/light-account/types.ts +31 -188
  83. package/src/light-account/utils.ts +91 -245
  84. package/src/msca/plugins/multisig/middleware.ts +6 -6
  85. package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
  86. package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
  87. package/src/msca/plugins/session-key/permissions.ts +147 -1
  88. package/src/msca/plugins/session-key/signer.ts +71 -1
  89. package/src/msca/utils.ts +6 -6
  90. package/dist/cjs/src/light-account/schema.d.ts +0 -21
  91. package/dist/cjs/src/light-account/schema.js +0 -30
  92. package/dist/cjs/src/light-account/schema.js.map +0 -1
  93. package/dist/esm/src/light-account/schema.d.ts +0 -21
  94. package/dist/esm/src/light-account/schema.js +0 -27
  95. package/dist/esm/src/light-account/schema.js.map +0 -1
  96. package/dist/types/src/light-account/schema.d.ts +0 -22
  97. package/dist/types/src/light-account/schema.d.ts.map +0 -1
  98. package/src/light-account/schema.ts +0 -39
@@ -43,14 +43,160 @@ export declare class SessionKeyPermissionsBuilder {
43
43
  private _erc20TokenSpendLimits;
44
44
  private _gasSpendLimit?;
45
45
  private _requiredPaymaster?;
46
+ /**
47
+ * Sets the access control type for the contract and returns the current instance for method chaining.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
52
+ *
53
+ * const builder = new SessionKeyPermissionsBuilder();
54
+ * builder.setContractAccessControlType(SessionKeyAccessListType.ALLOWLIST);
55
+ * ```
56
+ *
57
+ * @param {SessionKeyAccessListType} aclType The access control type for the session key
58
+ * @returns {SessionKeyPermissionsBuilder} The current instance for method chaining
59
+ */
46
60
  setContractAccessControlType(aclType: SessionKeyAccessListType): this;
61
+ /**
62
+ * Adds a contract access entry to the internal list of contract address access entries.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
67
+ *
68
+ * const builder = new SessionKeyPermissionsBuilder();
69
+ * builder.addContractAddressAccessEntry({
70
+ * contractAddress: "0x1234",
71
+ * isOnList: true,
72
+ * checkSelectors: true,
73
+ * });
74
+ * ```
75
+ *
76
+ * @param {ContractAccessEntry} entry the contract access entry to be added
77
+ * @returns {SessionKeyPermissionsBuilder} the instance of the current class for chaining
78
+ */
47
79
  addContractAddressAccessEntry(entry: ContractAccessEntry): this;
80
+ /**
81
+ * Adds a contract method entry to the `_contractMethodAccessEntrys` array.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
86
+ *
87
+ * const builder = new SessionKeyPermissionsBuilder();
88
+ * builder.addContractAddressAccessEntry({
89
+ * contractAddress: "0x1234",
90
+ * methodSelector: "0x45678",
91
+ * isOnList: true,
92
+ * });
93
+ * ```
94
+ *
95
+ * @param {ContractMethodEntry} entry The contract method entry to be added
96
+ * @returns {SessionKeyPermissionsBuilder} The instance of the class for method chaining
97
+ */
48
98
  addContractFunctionAccessEntry(entry: ContractMethodEntry): this;
99
+ /**
100
+ * Sets the time range for an object and returns the object itself for chaining.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
105
+ *
106
+ * const builder = new SessionKeyPermissionsBuilder();
107
+ * builder.setTimeRange({
108
+ * validFrom: Date.now(),
109
+ * validUntil: Date.now() + (15 * 60 * 1000),
110
+ * });
111
+ * ```
112
+ *
113
+ * @param {TimeRange} timeRange The time range to be set
114
+ * @returns {SessionKeyPermissionsBuilder} The current object for method chaining
115
+ */
49
116
  setTimeRange(timeRange: TimeRange): this;
117
+ /**
118
+ * Sets the native token spend limit and returns the instance for chaining.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
123
+ *
124
+ * const builder = new SessionKeyPermissionsBuilder();
125
+ * builder.setNativeTokenSpendLimit({
126
+ * spendLimit: 1000000000000000000n,
127
+ * refreshInterval: 3600,
128
+ * });
129
+ * ```
130
+ *
131
+ * @param {NativeTokenLimit} limit The limit to set for native token spending
132
+ * @returns {SessionKeyPermissionsBuilder} The instance for chaining
133
+ */
50
134
  setNativeTokenSpendLimit(limit: NativeTokenLimit): this;
135
+ /**
136
+ * Adds an ERC20 token spend limit to the list of limits and returns the updated object.
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
141
+ *
142
+ * const builder = new SessionKeyPermissionsBuilder();
143
+ * builder.addErc20TokenSpendLimit({
144
+ * tokenAddress: "0x1234",
145
+ * spendLimit: 1000000000000000000n,
146
+ * refreshInterval: 3600,
147
+ * });
148
+ * ```
149
+ *
150
+ * @param {Erc20TokenLimit} limit The ERC20 token spend limit to be added
151
+ * @returns {object} The updated object with the new ERC20 token spend limit
152
+ */
51
153
  addErc20TokenSpendLimit(limit: Erc20TokenLimit): this;
52
- setGasSpendLimit(limit: GasSpendLimit): this;
154
+ /**
155
+ * Sets the gas spend limit and returns the current instance for method chaining.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
160
+ *
161
+ * const builder = new SessionKeyPermissionsBuilder();
162
+ * builder.setGasSpendLimit({
163
+ * spendLimit: 1000000000000000000n,
164
+ * refreshInterval: 3600,
165
+ * });
166
+ * ```
167
+ *
168
+ * @param {GasSpendLimit} limit - The gas spend limit to be set
169
+ * @returns {SessionKeyPermissionsBuilder} The current instance for chaining
170
+ */ setGasSpendLimit(limit: GasSpendLimit): this;
171
+ /**
172
+ * Sets the required paymaster address.
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
177
+ *
178
+ * const builder = new SessionKeyPermissionsBuilder();
179
+ * builder.setRequiredPaymaster("0x1234");
180
+ * ```
181
+ *
182
+ * @param {Address} paymaster the address of the paymaster to be set
183
+ * @returns {SessionKeyPermissionsBuilder} the current instance for method chaining
184
+ */
53
185
  setRequiredPaymaster(paymaster: Address): this;
186
+ /**
187
+ * Encodes various function calls into an array of hexadecimal strings based on the provided permissions and limits.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
192
+ *
193
+ * const builder = new SessionKeyPermissionsBuilder();
194
+ * builder.setRequiredPaymaster("0x1234");
195
+ * const encoded = builder.encode();
196
+ * ```
197
+ *
198
+ * @returns {Hex[]} An array of encoded hexadecimal strings representing the function calls for setting access control, permissions, and limits.
199
+ */
54
200
  encode(): Hex[];
55
201
  private encodeIfDefined;
56
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../../../src/msca/plugins/session-key/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAGlE,oBAAY,wBAAwB;IAClC,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,gBAAgB,IAAI;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAEhC,eAAe,EAAE,OAAO,CAAC;IAEzB,QAAQ,EAAE,OAAO,CAAC;IAElB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAEhC,eAAe,EAAE,OAAO,CAAC;IAEzB,cAAc,EAAE,GAAG,CAAC;IAEpB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IAGnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAGnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG;IAI1B,UAAU,EAAE,MAAM,CAAC;IAGnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,0BAA0B,CACG;IACrC,OAAO,CAAC,4BAA4B,CAA6B;IACjE,OA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S,EAAE,OAAO;IAK9C;;;;;;;;;;;;;OAaG;IACI,MAAM,IAAI,GAAG,EAAE;IA0EtB,OAAO,CAAC,eAAe;CAKxB"}
@@ -23,9 +23,71 @@ export declare class SessionKeySigner implements SmartAccountSigner<LocalAccount
23
23
  inner: LocalAccountSigner<PrivateKeyAccount>;
24
24
  private storageType;
25
25
  private storageKey;
26
+ /**
27
+ * Initializes a new instance of a session key signer with the provided configuration. This will set the `signerType`, `storageKey`, and `storageType`. It will also manage the session key, either fetching it from storage or generating a new one if it doesn't exist.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
32
+ *
33
+ * const signer = new SessionKeySigner();
34
+ * ```
35
+ *
36
+ * @param {SessionKeySignerConfig} config_ the configuration for initializing the session key signer
37
+ */
26
38
  constructor(config_?: SessionKeySignerConfig);
39
+ /**
40
+ * An async function that retrieves the address using the inner object's `getAddress` method.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
45
+ *
46
+ * const signer = new SessionKeySigner();
47
+ * const sessionKeyAddress = await signer.getAddress();
48
+ * ```
49
+ *
50
+ * @returns {Promise<string>} A promise that resolves to the address as a string
51
+ */
27
52
  getAddress: () => Promise<`0x${string}`>;
53
+ /**
54
+ * Signs a message using the inner signer.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
59
+ *
60
+ * const signer = new SessionKeySigner();
61
+ * const sessionKeyAddress = await signer.signMessage("hello");
62
+ * ```
63
+ *
64
+ * @param {SignableMessage} msg The message to sign
65
+ * @returns {Promise<Hex>} A promise that resolves to the signed message
66
+ */
28
67
  signMessage: (msg: SignableMessage) => Promise<`0x${string}`>;
68
+ /**
69
+ * Signs the provided typed data using the inner signer.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
74
+ *
75
+ * const signer = new SessionKeySigner();
76
+ * console.log(await signer.signTypedData({
77
+ * types: {
78
+ * "Message": [{ name: "content", type: "string" }]
79
+ * },
80
+ * primaryType: "Message",
81
+ * message: { content: "Hello" },
82
+ * }));
83
+ * ```
84
+ *
85
+ * @template TTypedData - The typed data type, which extends `TypedData` or a record of unknown keys to unknown values.
86
+ * @template TPrimaryType - The primary type of the typed data.
87
+ *
88
+ * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters containing the typed data definition and primary type.
89
+ * @returns {Promise<string>} A promise that resolves to the signed typed data as a string.
90
+ */
29
91
  signTypedData: <const TTypedData extends {
30
92
  [x: string]: readonly import("viem").TypedDataParameter[];
31
93
  [x: `string[${string}]`]: undefined;
@@ -237,7 +299,15 @@ export declare class SessionKeySigner implements SmartAccountSigner<LocalAccount
237
299
  /**
238
300
  * Generates a new private key and stores it in the storage.
239
301
  *
240
- * @returns The public address of the new key.
302
+ * @example
303
+ * ```ts
304
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
305
+ *
306
+ * const signer = new SessionKeySigner();
307
+ * const newSessionKey = signer.generateNewKey();
308
+ * ```
309
+ *
310
+ * @returns {Address} The public address of the new key.
241
311
  */
242
312
  generateNewKey: () => `0x${string}`;
243
313
  }
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../../../../src/msca/plugins/session-key/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAEV,iBAAiB,EACjB,eAAe,EAEf,mBAAmB,EACpB,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;;;;;EAMjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,eAAO,MAAM,2BAA2B,wBAAwB,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,gBACX,YAAW,kBAAkB,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAEpE,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,WAAW,CAAgD;IACnE,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;;;;;;;OAWG;gBACS,OAAO,GAAE,sBAA2B;IA2BhD;;;;;;;;;;;;OAYG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAEtC;IAEF;;;;;;;;;;;;;OAaG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAI3D;IAEF;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8HAOX;IAEF;;;;;;;;;;;;OAYG;IACH,cAAc,sBASZ;CACH"}
@@ -2,18 +2,18 @@ import { type GetAccountParameter, type SmartAccountClient, type SmartAccountSig
2
2
  import type { Address, Chain, Transport } from "viem";
3
3
  import { type MultiOwnerModularAccount } from "./account/multiOwnerAccount.js";
4
4
  /**
5
- * Utility method returning the default multi sig msca factory address given a {@link Chain} object
5
+ * Utility method returning the default multi sig msca factory address given a chain
6
6
  *
7
- * @param chain a {@link Chain} object
8
- * @returns a {@link Address} for the given chain
7
+ * @param {Chain} chain the chain object for which to get the address
8
+ * @returns {Address} the address for the given chain
9
9
  * @throws if the chain doesn't have an address currently deployed
10
10
  */
11
11
  export declare const getDefaultMultisigModularAccountFactoryAddress: (chain: Chain) => Address;
12
12
  /**
13
- * Utility method returning the default multi owner msca factory address given a {@link Chain} object
13
+ * Utility method returning the default multi owner msca factory address given a chain
14
14
  *
15
- * @param chain - a {@link Chain} object
16
- * @returns a {@link Address} for the given chain
15
+ * @param {Chain} chain the chain object for which to get the address
16
+ * @returns {Address} the address for the given chain
17
17
  * @throws if the chain doesn't have an address currently deployed
18
18
  */
19
19
  export declare const getDefaultMultiOwnerModularAccountFactoryAddress: (chain: Chain) => Address;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/smart-contracts",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-alpha.7",
4
4
  "description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -40,13 +40,14 @@
40
40
  "build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
41
41
  "build:esm": "tsc --project tsconfig.build.json --module es2020 --outDir ./dist/esm --removeComments && echo > ./dist/esm/package.json '{\"type\":\"module\"}'",
42
42
  "build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
43
+ "docs:gen": "npx ak-docgen generate --in ./src/index.ts --out ../../site/pages/reference/account-kit/smart-contracts",
43
44
  "clean": "rm -rf ./dist",
44
45
  "test": "vitest",
45
46
  "test:run": "vitest run",
46
47
  "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
47
48
  },
48
49
  "devDependencies": {
49
- "@account-kit/plugingen": "^4.0.0-alpha.5",
50
+ "@account-kit/plugingen": "^4.0.0-alpha.7",
50
51
  "@wagmi/cli": "^1.5.2",
51
52
  "change-case": "^5.1.2",
52
53
  "dedent": "^1.5.1",
@@ -67,10 +68,10 @@
67
68
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
68
69
  },
69
70
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
70
- "gitHead": "674bcb173cab611f7738ddc804a48846ea19f958",
71
+ "gitHead": "94b858bcbaee13eb056edbddfda0ac598547b037",
71
72
  "dependencies": {
72
- "@aa-sdk/core": "^4.0.0-alpha.5",
73
- "@account-kit/infra": "^4.0.0-alpha.5",
73
+ "@aa-sdk/core": "^4.0.0-alpha.7",
74
+ "@account-kit/infra": "^4.0.0-alpha.7",
74
75
  "viem": "2.8.6"
75
76
  },
76
77
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ export {
24
24
  LightAccountUnsupported1271Impls,
25
25
  defaultLightAccountVersion,
26
26
  getDefaultLightAccountFactoryAddress,
27
- getLightAccountVersionDef,
27
+ getLightAccountVersionForAccount,
28
28
  } from "./light-account/utils.js";
29
29
 
30
30
  //multi-owner-light-account exports
@@ -18,8 +18,8 @@ import { LightAccountAbi_v2 } from "../abis/LightAccountAbi_v2.js";
18
18
  import { LightAccountFactoryAbi_v1 } from "../abis/LightAccountFactoryAbi_v1.js";
19
19
  import { LightAccountFactoryAbi_v2 } from "../abis/LightAccountFactoryAbi_v2.js";
20
20
  import type {
21
- GetEntryPointForLightAccountVersion,
22
- GetLightAccountVersion,
21
+ LightAccountEntryPointVersion,
22
+ LightAccountVersion,
23
23
  } from "../types.js";
24
24
  import {
25
25
  AccountVersionRegistry,
@@ -35,17 +35,8 @@ import {
35
35
 
36
36
  export type LightAccount<
37
37
  TSigner extends SmartAccountSigner = SmartAccountSigner,
38
- TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">,
39
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
40
- "LightAccount",
41
- TLightAccountVersion
42
- > = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>
43
- > = LightAccountBase<
44
- TSigner,
45
- "LightAccount",
46
- TLightAccountVersion,
47
- TEntryPointVersion
48
- > & {
38
+ TLightAccountVersion extends LightAccountVersion<"LightAccount"> = LightAccountVersion<"LightAccount">
39
+ > = LightAccountBase<TSigner, "LightAccount", TLightAccountVersion> & {
49
40
  encodeTransferOwnership: (newOwner: Address) => Hex;
50
41
  getOwnerAddress: () => Promise<Address>;
51
42
  };
@@ -54,55 +45,41 @@ export type LightAccount<
54
45
  export type CreateLightAccountParams<
55
46
  TTransport extends Transport = Transport,
56
47
  TSigner extends SmartAccountSigner = SmartAccountSigner,
57
- TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">,
58
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
59
- "LightAccount",
60
- TLightAccountVersion
61
- > = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>
48
+ TLightAccountVersion extends LightAccountVersion<"LightAccount"> = LightAccountVersion<"LightAccount">
62
49
  > = Omit<
63
50
  CreateLightAccountBaseParams<
64
- TTransport,
65
- TSigner,
66
51
  "LightAccount",
67
52
  TLightAccountVersion,
68
- TEntryPointVersion
53
+ TTransport,
54
+ TSigner
69
55
  >,
70
- "getAccountInitCode" | "entryPoint" | "version" | "abi" | "accountAddress"
56
+ | "getAccountInitCode"
57
+ | "entryPoint"
58
+ | "version"
59
+ | "abi"
60
+ | "accountAddress"
61
+ | "type"
71
62
  > & {
72
63
  salt?: bigint;
73
64
  initCode?: Hex;
74
65
  accountAddress?: Address;
75
66
  factoryAddress?: Address;
76
67
  version?: TLightAccountVersion;
77
- entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;
68
+ entryPoint?: EntryPointDef<
69
+ LightAccountEntryPointVersion<"LightAccount", TLightAccountVersion>,
70
+ Chain
71
+ >;
78
72
  };
79
73
  // [!endregion CreateLightAccountParams]
80
74
 
81
75
  export async function createLightAccount<
82
76
  TTransport extends Transport = Transport,
83
77
  TSigner extends SmartAccountSigner = SmartAccountSigner,
84
- TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = "v1.1.0"
78
+ TLightAccountVersion extends LightAccountVersion<"LightAccount"> = "v2.0.0"
85
79
  >(
86
80
  config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>
87
81
  ): Promise<LightAccount<TSigner, TLightAccountVersion>>;
88
82
 
89
- export async function createLightAccount<
90
- TTransport extends Transport = Transport,
91
- TSigner extends SmartAccountSigner = SmartAccountSigner,
92
- TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">,
93
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
94
- "LightAccount",
95
- TLightAccountVersion
96
- > = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>
97
- >(
98
- config: CreateLightAccountParams<
99
- TTransport,
100
- TSigner,
101
- TLightAccountVersion,
102
- TEntryPointVersion
103
- >
104
- ): Promise<LightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>>;
105
-
106
83
  /**
107
84
  * Creates a light account based on the provided parameters such as transport, chain, signer, init code, and more. Ensures that an account is configured and returned with various capabilities, such as transferring ownership and retrieving the owner's address.
108
85
  *
@@ -128,7 +105,7 @@ export async function createLightAccount({
128
105
  chain,
129
106
  signer,
130
107
  initCode,
131
- version = defaultLightAccountVersion("LightAccount"),
108
+ version = defaultLightAccountVersion(),
132
109
  entryPoint = getEntryPoint(chain, {
133
110
  version: AccountVersionRegistry["LightAccount"][version]
134
111
  .entryPointVersion as any,
@@ -176,15 +153,17 @@ export async function createLightAccount({
176
153
  });
177
154
 
178
155
  const account = await createLightAccountBase<
156
+ "LightAccount",
157
+ LightAccountVersion<"LightAccount">,
179
158
  Transport,
180
- SmartAccountSigner,
181
- "LightAccount"
159
+ SmartAccountSigner
182
160
  >({
183
161
  transport,
184
162
  chain,
185
163
  signer,
186
164
  abi: accountAbi,
187
- version: AccountVersionRegistry["LightAccount"][version],
165
+ type: "LightAccount",
166
+ version,
188
167
  entryPoint,
189
168
  accountAddress: address,
190
169
  getAccountInitCode,
@@ -23,11 +23,9 @@ import {
23
23
  type Transport,
24
24
  } from "viem";
25
25
  import type {
26
- AccountVersionDef,
27
- GetEntryPointForLightAccountVersion,
28
- GetLightAccountVersion,
26
+ LightAccountEntryPointVersion,
29
27
  LightAccountType,
30
- LightAccountVersionDef,
28
+ LightAccountVersion,
31
29
  } from "../types.js";
32
30
  import { AccountVersionRegistry } from "../utils.js";
33
31
 
@@ -40,91 +38,60 @@ enum SignatureType {
40
38
  export type LightAccountBase<
41
39
  TSigner extends SmartAccountSigner = SmartAccountSigner,
42
40
  TLightAccountType extends LightAccountType = LightAccountType,
43
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
44
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
45
- TLightAccountType,
46
- TLightAccountVersion
47
- > = GetEntryPointForLightAccountVersion<
48
- TLightAccountType,
49
- TLightAccountVersion
50
- >
41
+ TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>
51
42
  > = SmartContractAccountWithSigner<
52
43
  TLightAccountType,
53
44
  TSigner,
54
- TEntryPointVersion
45
+ LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>
55
46
  > & {
56
47
  getLightAccountVersion: () => TLightAccountVersion;
57
48
  };
58
49
 
59
50
  //#region CreateLightAccountBaseParams
60
51
  export type CreateLightAccountBaseParams<
52
+ TLightAccountType extends LightAccountType,
53
+ TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,
61
54
  TTransport extends Transport = Transport,
62
- TSigner extends SmartAccountSigner = SmartAccountSigner,
63
- TLightAccountType extends LightAccountType = LightAccountType,
64
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
65
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
66
- TLightAccountType,
67
- TLightAccountVersion
68
- > = GetEntryPointForLightAccountVersion<
69
- TLightAccountType,
70
- TLightAccountVersion
71
- >
55
+ TSigner extends SmartAccountSigner = SmartAccountSigner
72
56
  > = Pick<
73
- ToSmartContractAccountParams<
74
- TLightAccountType,
75
- TTransport,
76
- Chain,
77
- TEntryPointVersion
78
- >,
57
+ ToSmartContractAccountParams<TLightAccountType, TTransport, Chain>,
79
58
  "transport" | "chain" | "getAccountInitCode"
80
59
  > & {
81
60
  abi: Abi;
82
61
  signer: TSigner;
83
62
  accountAddress: Address;
84
- version: LightAccountVersionDef<TLightAccountType, TLightAccountVersion>;
85
- entryPoint: EntryPointDef<TEntryPointVersion, Chain>;
63
+ type: TLightAccountType;
64
+ version: TLightAccountVersion;
65
+ entryPoint: EntryPointDef<
66
+ LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>,
67
+ Chain
68
+ >;
86
69
  };
87
70
  //#endregion CreateLightAccountBaseParams
88
71
 
89
72
  export async function createLightAccountBase<
73
+ TLightAccountType extends LightAccountType,
74
+ TLightAccountVersion extends LightAccountVersion<TLightAccountType>,
90
75
  TTransport extends Transport = Transport,
91
- TSigner extends SmartAccountSigner = SmartAccountSigner,
92
- TLightAccountType extends LightAccountType = LightAccountType,
93
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
94
- TEntryPointVersion extends GetEntryPointForLightAccountVersion<
95
- TLightAccountType,
96
- TLightAccountVersion
97
- > = GetEntryPointForLightAccountVersion<
98
- TLightAccountType,
99
- TLightAccountVersion
100
- >
101
- >(
102
- config: CreateLightAccountBaseParams<
103
- TTransport,
104
- TSigner,
105
- TLightAccountType,
106
- TLightAccountVersion,
107
- TEntryPointVersion
108
- >
109
- ): Promise<
110
- LightAccountBase<
111
- TSigner,
112
- TLightAccountType,
113
- TLightAccountVersion,
114
- TEntryPointVersion
115
- >
116
- >;
117
-
118
- export async function createLightAccountBase({
76
+ TSigner extends SmartAccountSigner = SmartAccountSigner
77
+ >({
119
78
  transport,
120
79
  chain,
121
80
  signer,
122
81
  abi,
123
- version: { version, type },
82
+ version,
83
+ type,
124
84
  entryPoint,
125
85
  accountAddress,
126
86
  getAccountInitCode,
127
- }: CreateLightAccountBaseParams): Promise<LightAccountBase> {
87
+ }: CreateLightAccountBaseParams<
88
+ TLightAccountType,
89
+ TLightAccountVersion,
90
+ TTransport,
91
+ TSigner
92
+ >): Promise<
93
+ LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion>
94
+ > {
128
95
  const client = createBundlerClient({
129
96
  transport,
130
97
  chain,
@@ -149,7 +116,9 @@ export async function createLightAccountBase({
149
116
 
150
117
  const implementationAddresses = Object.values(
151
118
  AccountVersionRegistry[type]
152
- ).map((x: AccountVersionDef) => x.address[chain.id].impl);
119
+ ).map(
120
+ (x) => x.addresses.overrides?.[chain.id]?.impl ?? x.addresses.default.impl
121
+ );
153
122
 
154
123
  // only upgrade undeployed accounts (storage 0) or deployed light accounts, error otherwise
155
124
  if (
@@ -157,7 +126,9 @@ export async function createLightAccountBase({
157
126
  !implementationAddresses.some((x) => x === trim(storage))
158
127
  ) {
159
128
  throw new Error(
160
- `could not determine if smart account implementation is ${type} ${version}`
129
+ `could not determine if smart account implementation is ${type} ${String(
130
+ version
131
+ )}`
161
132
  );
162
133
  }
163
134
 
@@ -234,7 +205,7 @@ export async function createLightAccountBase({
234
205
  case "v1.0.1":
235
206
  return signer.signMessage(message);
236
207
  case "v1.0.2":
237
- throw new Error(`${type} ${version} doesn't support 1271`);
208
+ throw new Error(`${type} ${String(version)} doesn't support 1271`);
238
209
  case "v1.1.0":
239
210
  return signWith1271WrapperV1(hashMessage(message));
240
211
  case "v2.0.0":
@@ -242,7 +213,7 @@ export async function createLightAccountBase({
242
213
  // TODO: handle case where signer is an SCA.
243
214
  return concat([SignatureType.EOA, signature]);
244
215
  default:
245
- throw new Error(`Unknown version ${type} of ${version}`);
216
+ throw new Error(`Unknown version ${type} of ${String(version)}`);
246
217
  }
247
218
  },
248
219
  async signTypedData(params) {
@@ -253,7 +224,7 @@ export async function createLightAccountBase({
253
224
  );
254
225
  case "v1.0.2":
255
226
  throw new Error(
256
- `Version ${version} of LightAccount doesn't support 1271`
227
+ `Version ${String(version)} of LightAccount doesn't support 1271`
257
228
  );
258
229
  case "v1.1.0":
259
230
  return signWith1271WrapperV1(hashTypedData(params));
@@ -262,7 +233,7 @@ export async function createLightAccountBase({
262
233
  // TODO: handle case where signer is an SCA.
263
234
  return concat([SignatureType.EOA, signature]);
264
235
  default:
265
- throw new Error(`Unknown version ${version} of LightAccount`);
236
+ throw new Error(`Unknown version ${String(version)} of LightAccount`);
266
237
  }
267
238
  },
268
239
  getDummySignature: (): Hex => {
@@ -276,7 +247,7 @@ export async function createLightAccountBase({
276
247
  case "v2.0.0":
277
248
  return concat([SignatureType.EOA, signature]);
278
249
  default:
279
- throw new Error(`Unknown version ${type} of ${version}`);
250
+ throw new Error(`Unknown version ${type} of ${String(version)}`);
280
251
  }
281
252
  },
282
253
  encodeUpgradeToAndCall,