@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
@@ -70,46 +70,192 @@ export class SessionKeyPermissionsBuilder {
70
70
  private _gasSpendLimit?: GasSpendLimit;
71
71
  private _requiredPaymaster?: Address;
72
72
 
73
+ /**
74
+ * Sets the access control type for the contract and returns the current instance for method chaining.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
79
+ *
80
+ * const builder = new SessionKeyPermissionsBuilder();
81
+ * builder.setContractAccessControlType(SessionKeyAccessListType.ALLOWLIST);
82
+ * ```
83
+ *
84
+ * @param {SessionKeyAccessListType} aclType The access control type for the session key
85
+ * @returns {SessionKeyPermissionsBuilder} The current instance for method chaining
86
+ */
73
87
  public setContractAccessControlType(aclType: SessionKeyAccessListType) {
74
88
  this._contractAccessControlType = aclType;
75
89
  return this;
76
90
  }
77
91
 
92
+ /**
93
+ * Adds a contract access entry to the internal list of contract address access entries.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
98
+ *
99
+ * const builder = new SessionKeyPermissionsBuilder();
100
+ * builder.addContractAddressAccessEntry({
101
+ * contractAddress: "0x1234",
102
+ * isOnList: true,
103
+ * checkSelectors: true,
104
+ * });
105
+ * ```
106
+ *
107
+ * @param {ContractAccessEntry} entry the contract access entry to be added
108
+ * @returns {SessionKeyPermissionsBuilder} the instance of the current class for chaining
109
+ */
78
110
  public addContractAddressAccessEntry(entry: ContractAccessEntry) {
79
111
  this._contractAddressAccessEntrys.push(entry);
80
112
  return this;
81
113
  }
82
114
 
115
+ /**
116
+ * Adds a contract method entry to the `_contractMethodAccessEntrys` array.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
121
+ *
122
+ * const builder = new SessionKeyPermissionsBuilder();
123
+ * builder.addContractAddressAccessEntry({
124
+ * contractAddress: "0x1234",
125
+ * methodSelector: "0x45678",
126
+ * isOnList: true,
127
+ * });
128
+ * ```
129
+ *
130
+ * @param {ContractMethodEntry} entry The contract method entry to be added
131
+ * @returns {SessionKeyPermissionsBuilder} The instance of the class for method chaining
132
+ */
83
133
  public addContractFunctionAccessEntry(entry: ContractMethodEntry) {
84
134
  this._contractMethodAccessEntrys.push(entry);
85
135
  return this;
86
136
  }
87
137
 
138
+ /**
139
+ * Sets the time range for an object and returns the object itself for chaining.
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
144
+ *
145
+ * const builder = new SessionKeyPermissionsBuilder();
146
+ * builder.setTimeRange({
147
+ * validFrom: Date.now(),
148
+ * validUntil: Date.now() + (15 * 60 * 1000),
149
+ * });
150
+ * ```
151
+ *
152
+ * @param {TimeRange} timeRange The time range to be set
153
+ * @returns {SessionKeyPermissionsBuilder} The current object for method chaining
154
+ */
88
155
  public setTimeRange(timeRange: TimeRange) {
89
156
  this._timeRange = timeRange;
90
157
  return this;
91
158
  }
92
159
 
160
+ /**
161
+ * Sets the native token spend limit and returns the instance for chaining.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
166
+ *
167
+ * const builder = new SessionKeyPermissionsBuilder();
168
+ * builder.setNativeTokenSpendLimit({
169
+ * spendLimit: 1000000000000000000n,
170
+ * refreshInterval: 3600,
171
+ * });
172
+ * ```
173
+ *
174
+ * @param {NativeTokenLimit} limit The limit to set for native token spending
175
+ * @returns {SessionKeyPermissionsBuilder} The instance for chaining
176
+ */
93
177
  public setNativeTokenSpendLimit(limit: NativeTokenLimit) {
94
178
  this._nativeTokenSpendLimit = limit;
95
179
  return this;
96
180
  }
97
181
 
182
+ /**
183
+ * Adds an ERC20 token spend limit to the list of limits and returns the updated object.
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
188
+ *
189
+ * const builder = new SessionKeyPermissionsBuilder();
190
+ * builder.addErc20TokenSpendLimit({
191
+ * tokenAddress: "0x1234",
192
+ * spendLimit: 1000000000000000000n,
193
+ * refreshInterval: 3600,
194
+ * });
195
+ * ```
196
+ *
197
+ * @param {Erc20TokenLimit} limit The ERC20 token spend limit to be added
198
+ * @returns {object} The updated object with the new ERC20 token spend limit
199
+ */
98
200
  public addErc20TokenSpendLimit(limit: Erc20TokenLimit) {
99
201
  this._erc20TokenSpendLimits.push(limit);
100
202
  return this;
101
203
  }
102
204
 
103
- public setGasSpendLimit(limit: GasSpendLimit) {
205
+ /**
206
+ * Sets the gas spend limit and returns the current instance for method chaining.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
211
+ *
212
+ * const builder = new SessionKeyPermissionsBuilder();
213
+ * builder.setGasSpendLimit({
214
+ * spendLimit: 1000000000000000000n,
215
+ * refreshInterval: 3600,
216
+ * });
217
+ * ```
218
+ *
219
+ * @param {GasSpendLimit} limit - The gas spend limit to be set
220
+ * @returns {SessionKeyPermissionsBuilder} The current instance for chaining
221
+ */ public setGasSpendLimit(limit: GasSpendLimit) {
104
222
  this._gasSpendLimit = limit;
105
223
  return this;
106
224
  }
107
225
 
226
+ /**
227
+ * Sets the required paymaster address.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
232
+ *
233
+ * const builder = new SessionKeyPermissionsBuilder();
234
+ * builder.setRequiredPaymaster("0x1234");
235
+ * ```
236
+ *
237
+ * @param {Address} paymaster the address of the paymaster to be set
238
+ * @returns {SessionKeyPermissionsBuilder} the current instance for method chaining
239
+ */
108
240
  public setRequiredPaymaster(paymaster: Address) {
109
241
  this._requiredPaymaster = paymaster;
110
242
  return this;
111
243
  }
112
244
 
245
+ /**
246
+ * Encodes various function calls into an array of hexadecimal strings based on the provided permissions and limits.
247
+ *
248
+ * @example
249
+ * ```ts
250
+ * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts";
251
+ *
252
+ * const builder = new SessionKeyPermissionsBuilder();
253
+ * builder.setRequiredPaymaster("0x1234");
254
+ * const encoded = builder.encode();
255
+ * ```
256
+ *
257
+ * @returns {Hex[]} An array of encoded hexadecimal strings representing the function calls for setting access control, permissions, and limits.
258
+ */
113
259
  public encode(): Hex[] {
114
260
  return [
115
261
  encodeFunctionData({
@@ -33,6 +33,18 @@ export class SessionKeySigner
33
33
  private storageType: "local-storage" | "session-storage" | Storage;
34
34
  private storageKey: string;
35
35
 
36
+ /**
37
+ * 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.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
42
+ *
43
+ * const signer = new SessionKeySigner();
44
+ * ```
45
+ *
46
+ * @param {SessionKeySignerConfig} config_ the configuration for initializing the session key signer
47
+ */
36
48
  constructor(config_: SessionKeySignerConfig = {}) {
37
49
  const config = SessionKeySignerSchema.parse(config_);
38
50
  this.signerType = `${SESSION_KEY_SIGNER_TYPE_PFX}`;
@@ -60,16 +72,66 @@ export class SessionKeySigner
60
72
  this.inner = LocalAccountSigner.privateKeyToAccountSigner(sessionKey);
61
73
  }
62
74
 
75
+ /**
76
+ * An async function that retrieves the address using the inner object's `getAddress` method.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
81
+ *
82
+ * const signer = new SessionKeySigner();
83
+ * const sessionKeyAddress = await signer.getAddress();
84
+ * ```
85
+ *
86
+ * @returns {Promise<string>} A promise that resolves to the address as a string
87
+ */
63
88
  getAddress: () => Promise<`0x${string}`> = async () => {
64
89
  return this.inner.getAddress();
65
90
  };
66
91
 
92
+ /**
93
+ * Signs a message using the inner signer.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
98
+ *
99
+ * const signer = new SessionKeySigner();
100
+ * const sessionKeyAddress = await signer.signMessage("hello");
101
+ * ```
102
+ *
103
+ * @param {SignableMessage} msg The message to sign
104
+ * @returns {Promise<Hex>} A promise that resolves to the signed message
105
+ */
67
106
  signMessage: (msg: SignableMessage) => Promise<`0x${string}`> = async (
68
107
  msg
69
108
  ) => {
70
109
  return this.inner.signMessage(msg);
71
110
  };
72
111
 
112
+ /**
113
+ * Signs the provided typed data using the inner signer.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
118
+ *
119
+ * const signer = new SessionKeySigner();
120
+ * console.log(await signer.signTypedData({
121
+ * types: {
122
+ * "Message": [{ name: "content", type: "string" }]
123
+ * },
124
+ * primaryType: "Message",
125
+ * message: { content: "Hello" },
126
+ * }));
127
+ * ```
128
+ *
129
+ * @template TTypedData - The typed data type, which extends `TypedData` or a record of unknown keys to unknown values.
130
+ * @template TPrimaryType - The primary type of the typed data.
131
+ *
132
+ * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters containing the typed data definition and primary type.
133
+ * @returns {Promise<string>} A promise that resolves to the signed typed data as a string.
134
+ */
73
135
  signTypedData = async <
74
136
  const TTypedData extends TypedData | { [key: string]: unknown },
75
137
  TPrimaryType extends string = string
@@ -82,7 +144,15 @@ export class SessionKeySigner
82
144
  /**
83
145
  * Generates a new private key and stores it in the storage.
84
146
  *
85
- * @returns The public address of the new key.
147
+ * @example
148
+ * ```ts
149
+ * import { SessionKeySigner } from "@account-kit/smart-contracts";
150
+ *
151
+ * const signer = new SessionKeySigner();
152
+ * const newSessionKey = signer.generateNewKey();
153
+ * ```
154
+ *
155
+ * @returns {Address} The public address of the new key.
86
156
  */
87
157
  generateNewKey = () => {
88
158
  const storage =
package/src/msca/utils.ts CHANGED
@@ -39,10 +39,10 @@ import {
39
39
  import { MultiOwnerPlugin } from "./plugins/multi-owner/plugin.js";
40
40
 
41
41
  /**
42
- * Utility method returning the default multi sig msca factory address given a {@link Chain} object
42
+ * Utility method returning the default multi sig msca factory address given a chain
43
43
  *
44
- * @param chain a {@link Chain} object
45
- * @returns a {@link Address} for the given chain
44
+ * @param {Chain} chain the chain object for which to get the address
45
+ * @returns {Address} the address for the given chain
46
46
  * @throws if the chain doesn't have an address currently deployed
47
47
  */
48
48
  export const getDefaultMultisigModularAccountFactoryAddress = (
@@ -65,10 +65,10 @@ export const getDefaultMultisigModularAccountFactoryAddress = (
65
65
  };
66
66
 
67
67
  /**
68
- * Utility method returning the default multi owner msca factory address given a {@link Chain} object
68
+ * Utility method returning the default multi owner msca factory address given a chain
69
69
  *
70
- * @param chain - a {@link Chain} object
71
- * @returns a {@link Address} for the given chain
70
+ * @param {Chain} chain the chain object for which to get the address
71
+ * @returns {Address} the address for the given chain
72
72
  * @throws if the chain doesn't have an address currently deployed
73
73
  */
74
74
  export const getDefaultMultiOwnerModularAccountFactoryAddress = (
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import type { LightAccountVersion } from "./types.js";
3
- export declare const LightAccountFactoryConfigSchema: z.ZodObject<{
4
- signer: z.ZodType<import("@aa-sdk/core").SmartAccountSigner<any>, z.ZodTypeDef, import("@aa-sdk/core").SmartAccountSigner<any>>;
5
- accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
6
- initCode: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
7
- factoryAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
8
- version: z.ZodOptional<z.ZodEffects<z.ZodString, LightAccountVersion, string>>;
9
- }, "strip", z.ZodTypeAny, {
10
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
11
- accountAddress?: `0x${string}` | undefined;
12
- initCode?: `0x${string}` | undefined;
13
- factoryAddress?: `0x${string}` | undefined;
14
- version?: LightAccountVersion | undefined;
15
- }, {
16
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
17
- accountAddress?: string | undefined;
18
- initCode?: string | undefined;
19
- factoryAddress?: string | undefined;
20
- version?: string | undefined;
21
- }>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LightAccountFactoryConfigSchema = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- const zod_1 = require("abitype/zod");
6
- const viem_1 = require("viem");
7
- const zod_2 = require("zod");
8
- const utils_js_1 = require("./utils.js");
9
- const isLightAccountVersion = (x) => {
10
- if (typeof x === "string" &&
11
- Object.keys(Object.values(utils_js_1.AccountVersionRegistry).flat()).includes(x)) {
12
- return true;
13
- }
14
- return false;
15
- };
16
- exports.LightAccountFactoryConfigSchema = zod_2.z.object({
17
- signer: core_1.SignerSchema,
18
- accountAddress: zod_1.Address.optional().describe("Optional override for the account address."),
19
- initCode: zod_2.z
20
- .string()
21
- .refine(viem_1.isHex, "initCode must be a valid hex.")
22
- .optional()
23
- .describe("Optional override for the account init code."),
24
- factoryAddress: zod_1.Address.optional().describe("Optional override for the factory address which deploys the smart account."),
25
- version: zod_2.z
26
- .string()
27
- .refine(isLightAccountVersion, "Version must be a valid Light Account version.")
28
- .optional(),
29
- });
30
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/light-account/schema.ts"],"names":[],"mappings":";;;AAAA,uCAA4C;AAC5C,qCAAsC;AACtC,+BAA6B;AAC7B,6BAAwB;AAExB,yCAAoD;AAEpD,MAAM,qBAAqB,GAAG,CAAC,CAAU,EAA4B,EAAE;IACrE,IACE,OAAO,CAAC,KAAK,QAAQ;QACrB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iCAAsB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EACrE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEW,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,mBAAY;IACpB,cAAc,EAAE,aAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzC,4CAA4C,CAC7C;IACD,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,MAAM,CAAC,YAAK,EAAE,+BAA+B,CAAC;SAC9C,QAAQ,EAAE;SACV,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,cAAc,EAAE,aAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzC,4EAA4E,CAC7E;IACD,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,MAAM,CACL,qBAAqB,EACrB,gDAAgD,CACjD;SACA,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["import { SignerSchema } from \"@aa-sdk/core\";\nimport { Address } from \"abitype/zod\";\nimport { isHex } from \"viem\";\nimport { z } from \"zod\";\nimport type { LightAccountVersion } from \"./types.js\";\nimport { AccountVersionRegistry } from \"./utils.js\";\n\nconst isLightAccountVersion = (x: unknown): x is LightAccountVersion => {\n if (\n typeof x === \"string\" &&\n Object.keys(Object.values(AccountVersionRegistry).flat()).includes(x)\n ) {\n return true;\n }\n\n return false;\n};\n\nexport const LightAccountFactoryConfigSchema = z.object({\n signer: SignerSchema,\n accountAddress: Address.optional().describe(\n \"Optional override for the account address.\"\n ),\n initCode: z\n .string()\n .refine(isHex, \"initCode must be a valid hex.\")\n .optional()\n .describe(\"Optional override for the account init code.\"),\n factoryAddress: Address.optional().describe(\n \"Optional override for the factory address which deploys the smart account.\"\n ),\n version: z\n .string()\n .refine<LightAccountVersion>(\n isLightAccountVersion,\n \"Version must be a valid Light Account version.\"\n )\n .optional(),\n});\n"]}
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import type { LightAccountVersion } from "./types.js";
3
- export declare const LightAccountFactoryConfigSchema: z.ZodObject<{
4
- signer: z.ZodType<import("@aa-sdk/core").SmartAccountSigner<any>, z.ZodTypeDef, import("@aa-sdk/core").SmartAccountSigner<any>>;
5
- accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
6
- initCode: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
7
- factoryAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
8
- version: z.ZodOptional<z.ZodEffects<z.ZodString, LightAccountVersion, string>>;
9
- }, "strip", z.ZodTypeAny, {
10
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
11
- accountAddress?: `0x${string}` | undefined;
12
- initCode?: `0x${string}` | undefined;
13
- factoryAddress?: `0x${string}` | undefined;
14
- version?: LightAccountVersion | undefined;
15
- }, {
16
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
17
- accountAddress?: string | undefined;
18
- initCode?: string | undefined;
19
- factoryAddress?: string | undefined;
20
- version?: string | undefined;
21
- }>;
@@ -1,27 +0,0 @@
1
- import { SignerSchema } from "@aa-sdk/core";
2
- import { Address } from "abitype/zod";
3
- import { isHex } from "viem";
4
- import { z } from "zod";
5
- import { AccountVersionRegistry } from "./utils.js";
6
- const isLightAccountVersion = (x) => {
7
- if (typeof x === "string" &&
8
- Object.keys(Object.values(AccountVersionRegistry).flat()).includes(x)) {
9
- return true;
10
- }
11
- return false;
12
- };
13
- export const LightAccountFactoryConfigSchema = z.object({
14
- signer: SignerSchema,
15
- accountAddress: Address.optional().describe("Optional override for the account address."),
16
- initCode: z
17
- .string()
18
- .refine(isHex, "initCode must be a valid hex.")
19
- .optional()
20
- .describe("Optional override for the account init code."),
21
- factoryAddress: Address.optional().describe("Optional override for the factory address which deploys the smart account."),
22
- version: z
23
- .string()
24
- .refine(isLightAccountVersion, "Version must be a valid Light Account version.")
25
- .optional(),
26
- });
27
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/light-account/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,qBAAqB,GAAG,CAAC,CAAU,EAA4B,EAAE;IACrE,IACE,OAAO,CAAC,KAAK,QAAQ;QACrB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EACrE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,YAAY;IACpB,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzC,4CAA4C,CAC7C;IACD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,MAAM,CAAC,KAAK,EAAE,+BAA+B,CAAC;SAC9C,QAAQ,EAAE;SACV,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzC,4EAA4E,CAC7E;IACD,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,MAAM,CACL,qBAAqB,EACrB,gDAAgD,CACjD;SACA,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["import { SignerSchema } from \"@aa-sdk/core\";\nimport { Address } from \"abitype/zod\";\nimport { isHex } from \"viem\";\nimport { z } from \"zod\";\nimport type { LightAccountVersion } from \"./types.js\";\nimport { AccountVersionRegistry } from \"./utils.js\";\n\nconst isLightAccountVersion = (x: unknown): x is LightAccountVersion => {\n if (\n typeof x === \"string\" &&\n Object.keys(Object.values(AccountVersionRegistry).flat()).includes(x)\n ) {\n return true;\n }\n\n return false;\n};\n\nexport const LightAccountFactoryConfigSchema = z.object({\n signer: SignerSchema,\n accountAddress: Address.optional().describe(\n \"Optional override for the account address.\"\n ),\n initCode: z\n .string()\n .refine(isHex, \"initCode must be a valid hex.\")\n .optional()\n .describe(\"Optional override for the account init code.\"),\n factoryAddress: Address.optional().describe(\n \"Optional override for the factory address which deploys the smart account.\"\n ),\n version: z\n .string()\n .refine<LightAccountVersion>(\n isLightAccountVersion,\n \"Version must be a valid Light Account version.\"\n )\n .optional(),\n});\n"]}
@@ -1,22 +0,0 @@
1
- import { z } from "zod";
2
- import type { LightAccountVersion } from "./types.js";
3
- export declare const LightAccountFactoryConfigSchema: z.ZodObject<{
4
- signer: z.ZodType<import("@aa-sdk/core").SmartAccountSigner<any>, z.ZodTypeDef, import("@aa-sdk/core").SmartAccountSigner<any>>;
5
- accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
6
- initCode: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
7
- factoryAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
8
- version: z.ZodOptional<z.ZodEffects<z.ZodString, LightAccountVersion, string>>;
9
- }, "strip", z.ZodTypeAny, {
10
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
11
- accountAddress?: `0x${string}` | undefined;
12
- initCode?: `0x${string}` | undefined;
13
- factoryAddress?: `0x${string}` | undefined;
14
- version?: LightAccountVersion | undefined;
15
- }, {
16
- signer: import("@aa-sdk/core").SmartAccountSigner<any>;
17
- accountAddress?: string | undefined;
18
- initCode?: string | undefined;
19
- factoryAddress?: string | undefined;
20
- version?: string | undefined;
21
- }>;
22
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/light-account/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AActD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;EAoB1C,CAAC"}
@@ -1,39 +0,0 @@
1
- import { SignerSchema } from "@aa-sdk/core";
2
- import { Address } from "abitype/zod";
3
- import { isHex } from "viem";
4
- import { z } from "zod";
5
- import type { LightAccountVersion } from "./types.js";
6
- import { AccountVersionRegistry } from "./utils.js";
7
-
8
- const isLightAccountVersion = (x: unknown): x is LightAccountVersion => {
9
- if (
10
- typeof x === "string" &&
11
- Object.keys(Object.values(AccountVersionRegistry).flat()).includes(x)
12
- ) {
13
- return true;
14
- }
15
-
16
- return false;
17
- };
18
-
19
- export const LightAccountFactoryConfigSchema = z.object({
20
- signer: SignerSchema,
21
- accountAddress: Address.optional().describe(
22
- "Optional override for the account address."
23
- ),
24
- initCode: z
25
- .string()
26
- .refine(isHex, "initCode must be a valid hex.")
27
- .optional()
28
- .describe("Optional override for the account init code."),
29
- factoryAddress: Address.optional().describe(
30
- "Optional override for the factory address which deploys the smart account."
31
- ),
32
- version: z
33
- .string()
34
- .refine<LightAccountVersion>(
35
- isLightAccountVersion,
36
- "Version must be a valid Light Account version."
37
- )
38
- .optional(),
39
- });