@account-kit/signer 4.0.0-alpha.5 → 4.0.0-alpha.6

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 (44) hide show
  1. package/dist/cjs/base.js.map +1 -1
  2. package/dist/cjs/client/base.d.ts +1 -1
  3. package/dist/cjs/client/base.js.map +1 -1
  4. package/dist/cjs/client/index.js.map +1 -1
  5. package/dist/cjs/index.d.ts +5 -4
  6. package/dist/cjs/index.js +9 -7
  7. package/dist/cjs/index.js.map +1 -1
  8. package/dist/cjs/signer.d.ts +1 -1
  9. package/dist/cjs/signer.js +5 -5
  10. package/dist/cjs/signer.js.map +1 -1
  11. package/dist/cjs/version.d.ts +1 -1
  12. package/dist/cjs/version.js +1 -1
  13. package/dist/cjs/version.js.map +1 -1
  14. package/dist/esm/base.js.map +1 -1
  15. package/dist/esm/client/base.d.ts +1 -1
  16. package/dist/esm/client/base.js.map +1 -1
  17. package/dist/esm/client/index.js.map +1 -1
  18. package/dist/esm/index.d.ts +5 -4
  19. package/dist/esm/index.js +3 -2
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/signer.d.ts +1 -1
  22. package/dist/esm/signer.js +5 -5
  23. package/dist/esm/signer.js.map +1 -1
  24. package/dist/esm/version.d.ts +1 -1
  25. package/dist/esm/version.js +1 -1
  26. package/dist/esm/version.js.map +1 -1
  27. package/dist/types/base.d.ts +248 -14
  28. package/dist/types/base.d.ts.map +1 -1
  29. package/dist/types/client/base.d.ts +52 -6
  30. package/dist/types/client/base.d.ts.map +1 -1
  31. package/dist/types/client/index.d.ts +158 -0
  32. package/dist/types/client/index.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +5 -4
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/signer.d.ts +22 -1
  36. package/dist/types/signer.d.ts.map +1 -1
  37. package/dist/types/version.d.ts +1 -1
  38. package/package.json +4 -3
  39. package/src/base.ts +250 -16
  40. package/src/client/base.ts +53 -6
  41. package/src/client/index.ts +159 -1
  42. package/src/index.ts +5 -6
  43. package/src/signer.ts +27 -6
  44. package/src/version.ts +1 -1
@@ -31,7 +31,20 @@ export declare abstract class BaseSignerClient<TExportWalletParams = unknown> {
31
31
  constructor(params: BaseSignerClientParams);
32
32
  protected get user(): User | undefined;
33
33
  protected set user(user: User | undefined);
34
+ /**
35
+ * Sets the stamper of the TurnkeyClient.
36
+ *
37
+ * @param {TurnkeyClient["stamper"]} stamper the stamper function to set for the TurnkeyClient
38
+ */
34
39
  protected setStamper(stamper: TurnkeyClient["stamper"]): void;
40
+ /**
41
+ * Exports wallet credentials based on the specified type, either as a SEED_PHRASE or PRIVATE_KEY.
42
+ *
43
+ * @param {object} params The parameters for exporting the wallet
44
+ * @param {ExportWalletStamper} params.exportStamper The stamper used for exporting the wallet
45
+ * @param {"SEED_PHRASE" | "PRIVATE_KEY"} params.exportAs Specifies the format for exporting the wallet, either as a SEED_PHRASE or PRIVATE_KEY
46
+ * @returns {Promise<boolean>} A promise that resolves to true if the export is successful
47
+ */
35
48
  protected exportWalletInner(params: {
36
49
  exportStamper: ExportWalletStamper;
37
50
  exportAs: "SEED_PHRASE" | "PRIVATE_KEY";
@@ -53,13 +66,33 @@ export declare abstract class BaseSignerClient<TExportWalletParams = unknown> {
53
66
  /**
54
67
  * Listen to events emitted by the client
55
68
  *
56
- * @param event the event you want to listen to
57
- * @param listener the callback function to execute when an event is fired
58
- * @returns a function that will remove the listener when called
69
+ * @param {AlchemySignerClientEvent} event the event you want to listen to
70
+ * @param {AlchemySignerClientEvents[AlchemySignerClientEvent]} listener the callback function to execute when an event is fired
71
+ * @returns {() => void} a function that will remove the listener when called
59
72
  */
60
73
  on: <E extends keyof AlchemySignerClientEvents>(event: E, listener: AlchemySignerClientEvents[E]) => () => EventEmitter<AlchemySignerClientEvents, any>;
74
+ /**
75
+ * Handles the creation of authenticators using WebAuthn attestation and the provided options. Requires the user to be authenticated.
76
+ *
77
+ * @param {CredentialCreationOptions} options The options used to create the WebAuthn attestation
78
+ * @returns {Promise<string[]>} A promise that resolves to an array of authenticator IDs
79
+ * @throws {NotAuthenticatedError} If the user is not authenticated
80
+ */
61
81
  addPasskey: (options: CredentialCreationOptions) => Promise<string[]>;
82
+ /**
83
+ * Retrieves the current user or fetches the user information if not already available.
84
+ *
85
+ * @param {string} [orgId] optional organization ID, defaults to the user's organization ID
86
+ * @returns {Promise<User>} A promise that resolves to the user object
87
+ * @throws {Error} if no organization ID is provided when there is no current user
88
+ */
62
89
  whoami: (orgId?: string | undefined) => Promise<User>;
90
+ /**
91
+ * Looks up information based on an email address.
92
+ *
93
+ * @param {string} email the email address to look up
94
+ * @returns {Promise<any>} the result of the lookup request
95
+ */
63
96
  lookupUserByEmail: (email: string) => Promise<{
64
97
  orgId: string | null;
65
98
  }>;
@@ -68,11 +101,24 @@ export declare abstract class BaseSignerClient<TExportWalletParams = unknown> {
68
101
  * For SignMessage or SignTypedData, the caller should hash the message before calling this method and pass
69
102
  * that result here.
70
103
  *
71
- * @param msg the hex representation of the bytes to sign
72
- * @returns the signature over the raw hex
104
+ * @param {Hex} msg the hex representation of the bytes to sign
105
+ * @returns {Promise<Hex>} the signature over the raw hex
106
+ */
107
+ signRawMessage: (msg: Hex) => Promise<Hex>;
108
+ /**
109
+ * Returns the current user or null if no user is set.
110
+ *
111
+ * @returns {User | null} the current user object or null if no user is available
73
112
  */
74
- signRawMessage: (msg: Hex) => Promise<`0x${string}`>;
75
113
  getUser: () => User | null;
114
+ /**
115
+ * Sends a POST request to the given signer route with the specified body and returns the response.
116
+ * Not intended to be used directly, use the specific methods instead on the client instead.
117
+ *
118
+ * @param {SignerRoutes} route The route to which the request should be sent
119
+ * @param {SignerBody<R>} body The request body containing the data to be sent
120
+ * @returns {Promise<SignerResponse<R>>} A promise that resolves to the response from the signer
121
+ */
76
122
  request: <R extends "/v1/signup" | "/v1/whoami" | "/v1/auth" | "/v1/lookup" | "/v1/sign-payload">(route: R, body: SignerBody<R>) => Promise<SignerResponse<R>>;
77
123
  private exportAsSeedPhrase;
78
124
  private exportAsPrivateKey;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/client/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAGhC,OAAO,KAAK,EAEV,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,UAAU,EACV,cAAc,EAEd,cAAc,EACd,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAClC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG;IAC3D,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,8BAAsB,gBAAgB,CAAC,mBAAmB,GAAG,OAAO;IAClE,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAEhE;;;;OAIG;gB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,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;aAE3D,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjE,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CACvC,OAAO,EAAE,yBAAyB,EAClC,WAAW,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC,4BAA4B,CAAC;IAMxC;;;;;;OAMG;IACI,EAAE,sJAOP;IAEF;;;;;;OAMG;IACI,UAAU,YAAmB,yBAAyB,uBA+B3D;IAEF;;;;;;OAMG;IACI,MAAM,kCAAqC,QAAQ,IAAI,CAAC,CAgC7D;IAEF;;;;;OAKG;IACI,iBAAiB,UAAiB,MAAM;;OAE7C;IAEF;;;;;;;OAOG;IACI,cAAc,QAAe,GAAG,KAAG,QAAQ,GAAG,CAAC,CAsBpD;IAEF;;;;OAIG;IACI,OAAO,QAAO,IAAI,GAAG,IAAI,CAE9B;IAEF;;;;;;;OAOG;IACI,OAAO,wJA4BZ;IAKF,OAAO,CAAC,kBAAkB,CAmDxB;IAEF,OAAO,CAAC,kBAAkB,CA4BxB;IAGF,SAAS,CAAC,sBAAsB,0uCAKpB,QACR,WAAW,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC,CACvD,CAAC,UAAU,CAAC,kBACG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAsCtB;CAEH"}
@@ -121,17 +121,175 @@ export declare class AlchemySignerWebClient extends BaseSignerClient<ExportWalle
121
121
  private iframeStamper;
122
122
  private webauthnStamper;
123
123
  iframeContainerId: string;
124
+ /**
125
+ * Initializes a new instance with the given parameters, setting up the connection, iframe configuration, and WebAuthn stamper.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
130
+ *
131
+ * const client = new AlchemySignerWebClient({
132
+ * connection: {
133
+ * apiKey: "your-api-key",
134
+ * },
135
+ * iframeConfig: {
136
+ * iframeContainerId: "signer-iframe-container",
137
+ * },
138
+ * });
139
+ * ```
140
+ *
141
+ * @param {AlchemySignerClientParams} params the parameters required to initialize the client
142
+ * @param {ConnectionConfig} params.connection The connection details needed to connect to the service
143
+ * @param {{ iframeElementId?: string; iframeContainerId: string }} params.iframeConfig The configuration details for setting up the iframe stamper
144
+ * @param {string} params.rpId The relying party ID, defaulting to the current hostname if not provided
145
+ * @param {string} params.rootOrgId The root organization ID
146
+ */
124
147
  constructor(params: AlchemySignerClientParams);
148
+ /**
149
+ * Authenticates the user by either email or passkey account creation flow. Emits events during the process.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
154
+ *
155
+ * const client = new AlchemySignerWebClient({
156
+ * connection: {
157
+ * apiKey: "your-api-key",
158
+ * },
159
+ * iframeConfig: {
160
+ * iframeContainerId: "signer-iframe-container",
161
+ * },
162
+ * });
163
+ *
164
+ * const account = await client.createAccount({ type: "email", email: "you@mail.com" });
165
+ * ```
166
+ *
167
+ * @param {CreateAccountParams} params The parameters for creating an account, including the type (email or passkey) and additional details.
168
+ * @returns {Promise<SignupResponse>} A promise that resolves with the response object containing the account creation result.
169
+ */
125
170
  createAccount: (params: CreateAccountParams) => Promise<import("./types.js").SignupResponse>;
171
+ /**
172
+ * Begin authenticating a user with their email and an expiration time for the authentication request. Initializes the iframe stamper to get the target public key.
173
+ * This method sends an email to the user to complete their login
174
+ *
175
+ * @example
176
+ * ```ts
177
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
178
+ *
179
+ * const client = new AlchemySignerWebClient({
180
+ * connection: {
181
+ * apiKey: "your-api-key",
182
+ * },
183
+ * iframeConfig: {
184
+ * iframeContainerId: "signer-iframe-container",
185
+ * },
186
+ * });
187
+ *
188
+ * const account = await client.initEmailAuth({ email: "you@mail.com" });
189
+ * ```
190
+ *
191
+ * @param {Omit<EmailAuthParams, "targetPublicKey">} params The parameters for email authentication, excluding the target public key
192
+ * @returns {Promise<any>} The response from the authentication request
193
+ */
126
194
  initEmailAuth: (params: Omit<EmailAuthParams, "targetPublicKey">) => Promise<{
127
195
  orgId: string;
128
196
  }>;
197
+ /**
198
+ * Completes email auth for the user by injecting a credential bundle and retrieving the user information based on the provided organization ID. Emits events during the process.
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
203
+ *
204
+ * const client = new AlchemySignerWebClient({
205
+ * connection: {
206
+ * apiKey: "your-api-key",
207
+ * },
208
+ * iframeConfig: {
209
+ * iframeContainerId: "signer-iframe-container",
210
+ * },
211
+ * });
212
+ *
213
+ * const account = await client.completeEmailAuth({ orgId: "user-org-id", bundle: "bundle-from-email" });
214
+ * ```
215
+ *
216
+ * @param {{ bundle: string; orgId: string }} config The configuration object for the authentication function containing the credential bundle to inject and the organization id associated with the user
217
+ * @returns {Promise<User>} A promise that resolves to the authenticated user information
218
+ */
129
219
  completeEmailAuth: ({ bundle, orgId, }: {
130
220
  bundle: string;
131
221
  orgId: string;
132
222
  }) => Promise<User>;
223
+ /**
224
+ * Asynchronously handles the authentication process using WebAuthn Stamper. If a user is provided, sets the user and returns it. Otherwise, retrieves the current user and initializes the WebAuthn stamper.
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
229
+ *
230
+ * const client = new AlchemySignerWebClient({
231
+ * connection: {
232
+ * apiKey: "your-api-key",
233
+ * },
234
+ * iframeConfig: {
235
+ * iframeContainerId: "signer-iframe-container",
236
+ * },
237
+ * });
238
+ *
239
+ * const account = await client.lookupUserWithPasskey();
240
+ * ```
241
+ *
242
+ * @param {User} [user] An optional user object to authenticate
243
+ * @returns {Promise<User>} A promise that resolves to the authenticated user object
244
+ */
133
245
  lookupUserWithPasskey: (user?: User | undefined) => Promise<User>;
246
+ /**
247
+ * Initiates the export of a wallet by creating an iframe stamper and calling the appropriate export function.
248
+ * The export can be based on a seed phrase or a private key.
249
+ *
250
+ * @example
251
+ * ```ts
252
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
253
+ *
254
+ * const client = new AlchemySignerWebClient({
255
+ * connection: {
256
+ * apiKey: "your-api-key",
257
+ * },
258
+ * iframeConfig: {
259
+ * iframeContainerId: "signer-iframe-container",
260
+ * },
261
+ * });
262
+ *
263
+ * const account = await client.exportWallet({
264
+ * iframeContainerId: "export-iframe-container",
265
+ * });
266
+ * ```
267
+ *
268
+ * @param {ExportWalletParams} config The parameters for exporting the wallet
269
+ * @param {string} config.iframeContainerId The ID of the container element that will hold the iframe stamper
270
+ * @param {string} [config.iframeElementId] Optional ID for the iframe element
271
+ * @returns {Promise<void>} A promise that resolves when the export process is complete
272
+ */
134
273
  exportWallet: ({ iframeContainerId, iframeElementId, }: ExportWalletParams) => Promise<boolean>;
274
+ /**
275
+ * Asynchronous function that clears the user and resets the iframe stamper.
276
+ *
277
+ * @example
278
+ * ```ts
279
+ * import { AlchemySignerWebClient } from "@account-kit/signer";
280
+ *
281
+ * const client = new AlchemySignerWebClient({
282
+ * connection: {
283
+ * apiKey: "your-api-key",
284
+ * },
285
+ * iframeConfig: {
286
+ * iframeContainerId: "signer-iframe-container",
287
+ * },
288
+ * });
289
+ *
290
+ * const account = await client.disconnect();
291
+ * ```
292
+ */
135
293
  disconnect: () => Promise<void>;
136
294
  private initIframeStamper;
137
295
  private initWebauthnStamper;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,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{ AlchemyWebSigner } from "./signer.js";
3
- export type * from "./types.js";
4
- export { AlchemySignerStatus } from "./types.js";
1
+ export { BaseAlchemySigner } from "./base.js";
5
2
  export { BaseSignerClient } from "./client/base.js";
6
3
  export { AlchemySignerWebClient } from "./client/index.js";
7
4
  export type * from "./client/types.js";
8
5
  export { DEFAULT_SESSION_MS } from "./session/manager.js";
6
+ export type * from "./signer.js";
7
+ export { AlchemyWebSigner } from "./signer.js";
8
+ export type * from "./types.js";
9
+ export { AlchemySignerStatus } from "./types.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
@@ -264,6 +264,27 @@ export type AlchemySignerParams = z.input<typeof AlchemySignerParamsSchema>;
264
264
  * A SmartAccountSigner that can be used with any SmartContractAccount
265
265
  */
266
266
  export declare class AlchemyWebSigner extends BaseAlchemySigner<AlchemySignerWebClient> {
267
- constructor(params_: AlchemySignerParams);
267
+ /**
268
+ * Initializes an instance with the provided Alchemy signer parameters after parsing them with a schema.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * import { AlchemyWebSigner } from "@account-kit/signer";
273
+ *
274
+ * const signer = new AlchemyWebSigner({
275
+ * client: {
276
+ * connection: {
277
+ * rpcUrl: "/api/rpc",
278
+ * },
279
+ * iframeConfig: {
280
+ * iframeContainerId: "alchemy-signer-iframe-container",
281
+ * },
282
+ * },
283
+ * });
284
+ * ```
285
+ *
286
+ * @param {AlchemySignerParams} params The parameters for the Alchemy signer, including the client and session configuration
287
+ */
288
+ constructor(params: AlchemySignerParams);
268
289
  }
269
290
  //# sourceMappingURL=signer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAEL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAG3E,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC;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C;IAChB,SAAS,EAAE,KAAK,CAAC;CAClB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,iCAAiC,CAAC;CAClD,CAAC;AAEN,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAYtC;;eAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EANC,CAAC;AAEL,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB,CAAC,sBAAsB,CAAC;IAC7E;;;;;;;;;;;;;;;;;;;;OAoBG;gBACS,MAAM,EAAE,mBAAmB;CAexC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.0.0-alpha.5";
1
+ export declare const VERSION = "4.0.0-alpha.6";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/signer",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-alpha.6",
4
4
  "description": "Core interfaces and clients for interfacing with the Alchemy Signer API",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
35
35
  "build:esm": "tsc --project tsconfig.build.json --module es2020 --outDir ./dist/esm --removeComments && echo > ./dist/esm/package.json '{\"type\":\"module\"}'",
36
36
  "build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
37
+ "docs:gen": "npx ak-docgen generate --in ./src/index.ts --out ../../site/pages/reference/account-kit/signer",
37
38
  "clean": "rm -rf ./dist",
38
39
  "test": "vitest --passWithNoTests",
39
40
  "test:run": "vitest run --passWithNoTests",
@@ -49,7 +50,7 @@
49
50
  "vitest": "^0.31.0"
50
51
  },
51
52
  "dependencies": {
52
- "@aa-sdk/core": "^4.0.0-alpha.5",
53
+ "@aa-sdk/core": "^4.0.0-alpha.6",
53
54
  "@turnkey/http": "^2.6.2",
54
55
  "@turnkey/iframe-stamper": "^1.0.0",
55
56
  "@turnkey/viem": "^0.4.8",
@@ -75,5 +76,5 @@
75
76
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
76
77
  },
77
78
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
78
- "gitHead": "674bcb173cab611f7738ddc804a48846ea19f958"
79
+ "gitHead": "2c35ec701f526c77ea5e00e2e6f147156c7ac0e4"
79
80
  }