@account-kit/signer 4.0.0-beta.9 → 4.0.1

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 (46) hide show
  1. package/dist/esm/base.d.ts +5 -2
  2. package/dist/esm/base.js +94 -20
  3. package/dist/esm/base.js.map +1 -1
  4. package/dist/esm/client/base.d.ts +2 -1
  5. package/dist/esm/client/base.js +1 -1
  6. package/dist/esm/client/base.js.map +1 -1
  7. package/dist/esm/client/index.d.ts +3 -2
  8. package/dist/esm/client/index.js +7 -5
  9. package/dist/esm/client/index.js.map +1 -1
  10. package/dist/esm/client/types.d.ts +4 -1
  11. package/dist/esm/client/types.js.map +1 -1
  12. package/dist/esm/metrics.d.ts +17 -0
  13. package/dist/esm/metrics.js +7 -0
  14. package/dist/esm/metrics.js.map +1 -0
  15. package/dist/esm/session/manager.js +8 -1
  16. package/dist/esm/session/manager.js.map +1 -1
  17. package/dist/esm/types.d.ts +3 -1
  18. package/dist/esm/types.js +3 -1
  19. package/dist/esm/types.js.map +1 -1
  20. package/dist/esm/version.d.ts +1 -1
  21. package/dist/esm/version.js +1 -1
  22. package/dist/esm/version.js.map +1 -1
  23. package/dist/types/base.d.ts +5 -2
  24. package/dist/types/base.d.ts.map +1 -1
  25. package/dist/types/client/base.d.ts +2 -1
  26. package/dist/types/client/base.d.ts.map +1 -1
  27. package/dist/types/client/index.d.ts +3 -2
  28. package/dist/types/client/index.d.ts.map +1 -1
  29. package/dist/types/client/types.d.ts +4 -1
  30. package/dist/types/client/types.d.ts.map +1 -1
  31. package/dist/types/metrics.d.ts +18 -0
  32. package/dist/types/metrics.d.ts.map +1 -0
  33. package/dist/types/session/manager.d.ts.map +1 -1
  34. package/dist/types/types.d.ts +3 -1
  35. package/dist/types/types.d.ts.map +1 -1
  36. package/dist/types/version.d.ts +1 -1
  37. package/dist/types/version.d.ts.map +1 -1
  38. package/package.json +5 -5
  39. package/src/base.ts +165 -59
  40. package/src/client/base.ts +4 -2
  41. package/src/client/index.ts +9 -4
  42. package/src/client/types.ts +5 -1
  43. package/src/metrics.ts +23 -0
  44. package/src/session/manager.ts +11 -2
  45. package/src/types.ts +3 -1
  46. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC;CAC7D,GAAG,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AAG9C,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC,GACD;IACE,IAAI,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AAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;IAChE,SAAS,EAAE,WAAW,CAAC;IACvB,mBAAmB,EAAE,WAAW,CAAC;CAClC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export type SignerEventsSchema = [
2
+ {
3
+ EventName: "signer_authnticate";
4
+ EventData: {
5
+ authType: "email" | "passkey_anon" | "passkey_email" | "oauthReturn";
6
+ provider?: never;
7
+ } | {
8
+ authType: "oauth";
9
+ provider: string;
10
+ };
11
+ },
12
+ {
13
+ EventName: "signer_sign_message";
14
+ EventData: undefined;
15
+ }
16
+ ];
17
+ export declare const SignerLogger: import("@account-kit/logging").EventLogger<SignerEventsSchema>;
18
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG;IAC/B;QACE,SAAS,EAAE,oBAAoB,CAAC;QAChC,SAAS,EACL;YACE,QAAQ,EAAE,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;YACrE,QAAQ,CAAC,EAAE,KAAK,CAAC;SAClB,GACD;YAAE,QAAQ,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;KAC7C;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE,SAAS,CAAC;KACtB;CACF,CAAC;AAEF,eAAO,MAAM,YAAY,gEAGvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/session/manager.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,g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AC;AAE5C,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,kBAAkB,QAAiB,CAAC;AAEjD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAarC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAW9E,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,YAAY,CAAqC;IACzD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,OAAO,CAAC,KAAK,CAAQ;gBAET,MAAM,EAAE,oBAAoB;IA8BjC,cAAc,QAAa,QAAQ,IAAI,GAAG,IAAI,CAAC,CA6CpD;IAEK,YAAY,aAEjB;IAEK,mBAAmB,YAAa;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,UAMtD;IAEK,mBAAmB,QAAO;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CASvD;IAEF,EAAE,uIAOA;IAEF,OAAO,CAAC,UAAU,CAoBhB;IAEF,OAAO,CAAC,UAAU,CAWhB;IAEK,UAAU;IAYjB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,sBAAsB,CAgD5B;IAEF,OAAO,CAAC,2BAA2B,CAsBjC;CACH"}
@@ -10,7 +10,9 @@ export declare enum AlchemySignerStatus {
10
10
  INITIALIZING = "INITIALIZING",
11
11
  CONNECTED = "CONNECTED",
12
12
  DISCONNECTED = "DISCONNECTED",
13
- AUTHENTICATING = "AUTHENTICATING",
13
+ AUTHENTICATING_PASSKEY = "AUTHENTICATING_PASSKEY",
14
+ AUTHENTICATING_EMAIL = "AUTHENTICATING_EMAIL",
15
+ AUTHENTICATING_OAUTH = "AUTHENTICATING_OAUTH",
14
16
  AWAITING_EMAIL_AUTH = "AWAITING_EMAIL_AUTH"
15
17
  }
16
18
  export interface ErrorInfo {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,YAAY,IAAI,IAAI,CAAC;IACrB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;AAE3D,oBAAY,mBAAmB;IAC7B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,mBAAmB,wBAAwB;CAC5C;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,YAAY,IAAI,IAAI,CAAC;IACrB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;AAE3D,oBAAY,mBAAmB;IAC7B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,sBAAsB,2BAA2B;IACjD,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;CAC5C;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.0.0-beta.9";
1
+ export declare const VERSION = "4.0.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/signer",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.1",
4
4
  "description": "Core interfaces and clients for interfacing with the Alchemy Signer API",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -36,8 +36,7 @@
36
36
  "docs:gen": "npx ak-docgen generate --in ./src/index.ts --out ../../site/pages/reference/account-kit/signer",
37
37
  "clean": "rm -rf ./dist",
38
38
  "test": "vitest --passWithNoTests",
39
- "test:run": "vitest run --passWithNoTests",
40
- "test:run-e2e": "vitest run --config vitest.config.e2e.ts --passWithNoTests"
39
+ "test:run": "vitest run --passWithNoTests"
41
40
  },
42
41
  "devDependencies": {
43
42
  "@tanstack/react-query": "^5.28.9",
@@ -49,7 +48,8 @@
49
48
  "vitest": "^2.0.4"
50
49
  },
51
50
  "dependencies": {
52
- "@aa-sdk/core": "^4.0.0-beta.9",
51
+ "@aa-sdk/core": "^4.0.1",
52
+ "@account-kit/logging": "^4.0.1",
53
53
  "@turnkey/http": "^2.6.2",
54
54
  "@turnkey/iframe-stamper": "^1.0.0",
55
55
  "@turnkey/viem": "^0.4.8",
@@ -72,5 +72,5 @@
72
72
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
73
73
  },
74
74
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
75
- "gitHead": "6c5f0ff3863587178909a4df689df3d8379b1851"
75
+ "gitHead": "840465b053f8fa8971715fc8d9ef4401632f87e4"
76
76
  }
package/src/base.ts CHANGED
@@ -4,10 +4,14 @@ import {
4
4
  hashTypedData,
5
5
  keccak256,
6
6
  serializeTransaction,
7
- type CustomSource,
7
+ type GetTransactionType,
8
8
  type Hex,
9
+ type IsNarrowable,
9
10
  type LocalAccount,
11
+ type SerializeTransactionFn,
10
12
  type SignableMessage,
13
+ type TransactionSerializable,
14
+ type TransactionSerialized,
11
15
  type TypedData,
12
16
  type TypedDataDefinition,
13
17
  } from "viem";
@@ -18,6 +22,7 @@ import { createStore } from "zustand/vanilla";
18
22
  import type { BaseSignerClient } from "./client/base";
19
23
  import type { OauthConfig, OauthParams, User } from "./client/types";
20
24
  import { NotAuthenticatedError } from "./errors.js";
25
+ import { SignerLogger } from "./metrics.js";
21
26
  import {
22
27
  SessionManager,
23
28
  type SessionManagerParams,
@@ -210,24 +215,80 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
210
215
  * @param {AuthParams} params - undefined if passkey login, otherwise an object with email and bundle to resolve
211
216
  * @returns {Promise<User>} the user that was authenticated
212
217
  */
213
- authenticate: (params: AuthParams) => Promise<User> = async (params) => {
218
+ authenticate: (params: AuthParams) => Promise<User> = SignerLogger.profiled(
219
+ "BaseAlchemySigner.authenticate",
220
+ async (params) => {
221
+ const { type } = params;
222
+ const result = (() => {
223
+ switch (type) {
224
+ case "email":
225
+ return this.authenticateWithEmail(params);
226
+ case "passkey":
227
+ return this.authenticateWithPasskey(params);
228
+ case "oauth":
229
+ return this.authenticateWithOauth(params);
230
+ case "oauthReturn":
231
+ return this.handleOauthReturn(params);
232
+ default:
233
+ assertNever(type, `Unknown auth type: ${type}`);
234
+ }
235
+ })();
236
+
237
+ this.trackAuthenticateType(params);
238
+
239
+ return result.catch((error) => {
240
+ /**
241
+ * 2 things going on here:
242
+ * 1. for oauth flows we expect the status to remain in authenticating
243
+ * 2. we do the ternary, because if we explicitly pass in `undefined` for the status, zustand will set the value of status to `undefined`.
244
+ * However, if we omit it, then it will not override the current value of status.
245
+ */
246
+ this.store.setState({
247
+ error: toErrorInfo(error),
248
+ ...(type === "oauthReturn" || type === "oauth"
249
+ ? {}
250
+ : { status: AlchemySignerStatus.DISCONNECTED }),
251
+ });
252
+ throw error;
253
+ });
254
+ }
255
+ );
256
+
257
+ private trackAuthenticateType = (params: AuthParams) => {
214
258
  const { type } = params;
215
- try {
216
- switch (type) {
217
- case "email":
218
- return this.authenticateWithEmail(params);
219
- case "passkey":
220
- return this.authenticateWithPasskey(params);
221
- case "oauth":
222
- return this.authenticateWithOauth(params);
223
- case "oauthReturn":
224
- return this.handleOauthReturn(params);
225
- default:
226
- assertNever(type, `Unknown auth type: ${type}`);
259
+ switch (type) {
260
+ case "email": {
261
+ // we just want to track the start of email auth
262
+ if ("bundle" in params) return;
263
+ SignerLogger.trackEvent({
264
+ name: "signer_authnticate",
265
+ data: { authType: "email" },
266
+ });
267
+ return;
268
+ }
269
+ case "passkey": {
270
+ const isAnon = !("email" in params) && params.createNew == null;
271
+ SignerLogger.trackEvent({
272
+ name: "signer_authnticate",
273
+ data: {
274
+ authType: isAnon ? "passkey_anon" : "passkey_email",
275
+ },
276
+ });
277
+ return;
227
278
  }
228
- } catch (error) {
229
- this.store.setState({ error: toErrorInfo(error) });
230
- throw error;
279
+ case "oauth":
280
+ SignerLogger.trackEvent({
281
+ name: "signer_authnticate",
282
+ data: {
283
+ authType: "oauth",
284
+ provider: params.authProviderId,
285
+ },
286
+ });
287
+ break;
288
+ case "oauthReturn":
289
+ break;
290
+ default:
291
+ assertNever(type, `Unknown auth type: ${type}`);
231
292
  }
232
293
  };
233
294
 
@@ -299,11 +360,14 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
299
360
  *
300
361
  * @returns {Promise<string>} A promise that resolves to the address of the current user.
301
362
  */
302
- getAddress: () => Promise<`0x${string}`> = async () => {
303
- const { address } = await this.inner.whoami();
363
+ getAddress: () => Promise<`0x${string}`> = SignerLogger.profiled(
364
+ "BaseAlchemySigner.getAddress",
365
+ async () => {
366
+ const { address } = await this.inner.whoami();
304
367
 
305
- return address;
306
- };
368
+ return address;
369
+ }
370
+ );
307
371
 
308
372
  /**
309
373
  * Signs a raw message after hashing it.
@@ -329,13 +393,18 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
329
393
  * @param {string} msg the message to be hashed and then signed
330
394
  * @returns {Promise<string>} a promise that resolves to the signed message
331
395
  */
332
- signMessage: (msg: SignableMessage) => Promise<`0x${string}`> = async (
333
- msg
334
- ) => {
335
- const messageHash = hashMessage(msg);
396
+ signMessage: (msg: SignableMessage) => Promise<`0x${string}`> =
397
+ SignerLogger.profiled("BaseAlchemySigner.signMessage", async (msg) => {
398
+ const messageHash = hashMessage(msg);
336
399
 
337
- return this.inner.signRawMessage(messageHash);
338
- };
400
+ const result = await this.inner.signRawMessage(messageHash);
401
+
402
+ SignerLogger.trackEvent({
403
+ name: "signer_sign_message",
404
+ });
405
+
406
+ return result;
407
+ });
339
408
 
340
409
  /**
341
410
  * Signs a typed message by first hashing it and then signing the hashed message using the `signRawMessage` method.
@@ -371,11 +440,14 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
371
440
  TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData
372
441
  >(
373
442
  params: TypedDataDefinition<TTypedData, TPrimaryType>
374
- ) => Promise<Hex> = async (params) => {
375
- const messageHash = hashTypedData(params);
443
+ ) => Promise<Hex> = SignerLogger.profiled(
444
+ "BaseAlchemySigner.signTypedData",
445
+ async (params) => {
446
+ const messageHash = hashTypedData(params);
376
447
 
377
- return this.inner.signRawMessage(messageHash);
378
- };
448
+ return this.inner.signRawMessage(messageHash);
449
+ }
450
+ );
379
451
 
380
452
  /**
381
453
  * Serializes a transaction, signs it with a raw message, and then returns the serialized transaction with the signature.
@@ -407,21 +479,41 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
407
479
  * @param {() => Hex} [args.serializer] an optional serializer function. If not provided, the default `serializeTransaction` function will be used
408
480
  * @returns {Promise<string>} a promise that resolves to the serialized transaction with the signature
409
481
  */
410
- signTransaction: CustomSource["signTransaction"] = async (tx, args) => {
411
- const serializeFn = args?.serializer ?? serializeTransaction;
412
- const serializedTx = serializeFn(tx);
413
- const signatureHex = await this.inner.signRawMessage(
414
- keccak256(serializedTx)
415
- );
482
+ signTransaction: <
483
+ serializer extends SerializeTransactionFn<TransactionSerializable> = SerializeTransactionFn<TransactionSerializable>,
484
+ transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]
485
+ >(
486
+ transaction: transaction,
487
+ options?:
488
+ | {
489
+ serializer?: serializer | undefined;
490
+ }
491
+ | undefined
492
+ ) => Promise<
493
+ IsNarrowable<
494
+ TransactionSerialized<GetTransactionType<transaction>>,
495
+ Hex
496
+ > extends true
497
+ ? TransactionSerialized<GetTransactionType<transaction>>
498
+ : Hex
499
+ > = SignerLogger.profiled(
500
+ "BaseAlchemySigner.signTransaction",
501
+ async (tx, args) => {
502
+ const serializeFn = args?.serializer ?? serializeTransaction;
503
+ const serializedTx = serializeFn(tx);
504
+ const signatureHex = await this.inner.signRawMessage(
505
+ keccak256(serializedTx)
506
+ );
416
507
 
417
- const signature = {
418
- r: takeBytes(signatureHex, { count: 32 }),
419
- s: takeBytes(signatureHex, { count: 32, offset: 32 }),
420
- v: BigInt(takeBytes(signatureHex, { count: 1, offset: 64 })),
421
- };
508
+ const signature = {
509
+ r: takeBytes(signatureHex, { count: 32 }),
510
+ s: takeBytes(signatureHex, { count: 32, offset: 32 }),
511
+ v: BigInt(takeBytes(signatureHex, { count: 1, offset: 64 })),
512
+ };
422
513
 
423
- return serializeFn(tx, signature);
424
- };
514
+ return serializeFn(tx, signature);
515
+ }
516
+ );
425
517
 
426
518
  /**
427
519
  * Unauthenticated call to look up a user's organizationId by email
@@ -447,19 +539,18 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
447
539
  * @param {string} email the email to lookup
448
540
  * @returns {Promise<{orgId: string}>} the organization id for the user if they exist
449
541
  */
450
- getUser: (email: string) => Promise<{ orgId: string } | null> = async (
451
- email
452
- ) => {
453
- const result = await this.inner.lookupUserByEmail(email);
542
+ getUser: (email: string) => Promise<{ orgId: string } | null> =
543
+ SignerLogger.profiled("BaseAlchemySigner.getUser", async (email) => {
544
+ const result = await this.inner.lookupUserByEmail(email);
454
545
 
455
- if (result.orgId == null) {
456
- return null;
457
- }
546
+ if (result.orgId == null) {
547
+ return null;
548
+ }
458
549
 
459
- return {
460
- orgId: result.orgId,
461
- };
462
- };
550
+ return {
551
+ orgId: result.orgId,
552
+ };
553
+ });
463
554
 
464
555
  /**
465
556
  * Adds a passkey to the user's account
@@ -486,9 +577,9 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
486
577
  * @returns {Promise<string[]>} an array of the authenticator ids added to the user
487
578
  */
488
579
  addPasskey: (params?: CredentialCreationOptions) => Promise<string[]> =
489
- async (params) => {
580
+ SignerLogger.profiled("BaseAlchemySigner.addPasskey", async (params) => {
490
581
  return this.inner.addPasskey(params ?? {});
491
- };
582
+ });
492
583
 
493
584
  /**
494
585
  * Used to export the wallet for a given user
@@ -621,6 +712,7 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
621
712
  bundle: params.bundle,
622
713
  orgId: temporarySession.orgId,
623
714
  connectedEventName: "connectedEmail",
715
+ authenticatingType: "email",
624
716
  });
625
717
 
626
718
  return user;
@@ -690,6 +782,7 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
690
782
  bundle,
691
783
  orgId,
692
784
  connectedEventName: "connectedOauth",
785
+ authenticatingType: "oauth",
693
786
  idToken,
694
787
  });
695
788
 
@@ -718,9 +811,22 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
718
811
  }));
719
812
  });
720
813
 
721
- this.inner.on("authenticating", () => {
814
+ this.inner.on("authenticating", ({ type }) => {
815
+ const status = (() => {
816
+ switch (type) {
817
+ case "email":
818
+ return AlchemySignerStatus.AUTHENTICATING_EMAIL;
819
+ case "passkey":
820
+ return AlchemySignerStatus.AUTHENTICATING_PASSKEY;
821
+ case "oauth":
822
+ return AlchemySignerStatus.AUTHENTICATING_OAUTH;
823
+ default:
824
+ assertNever(type, "unhandled authenticating type");
825
+ }
826
+ })();
827
+
722
828
  this.store.setState({
723
- status: AlchemySignerStatus.AUTHENTICATING,
829
+ status,
724
830
  error: null,
725
831
  });
726
832
  });
@@ -1,12 +1,15 @@
1
1
  import { ConnectionConfigSchema, type ConnectionConfig } from "@aa-sdk/core";
2
2
  import { TurnkeyClient, type TSignedRequest } from "@turnkey/http";
3
3
  import EventEmitter from "eventemitter3";
4
+ import { jwtDecode } from "jwt-decode";
4
5
  import type { Hex } from "viem";
5
6
  import { NotAuthenticatedError } from "../errors.js";
6
7
  import { base64UrlEncode } from "../utils/base64UrlEncode.js";
8
+ import { assertNever } from "../utils/typeAssertions.js";
7
9
  import type {
8
10
  AlchemySignerClientEvent,
9
11
  AlchemySignerClientEvents,
12
+ AuthenticatingEventMetadata,
10
13
  CreateAccountParams,
11
14
  EmailAuthParams,
12
15
  GetWebAuthnAttestationResult,
@@ -18,8 +21,6 @@ import type {
18
21
  SignupResponse,
19
22
  User,
20
23
  } from "./types.js";
21
- import { assertNever } from "../utils/typeAssertions.js";
22
- import { jwtDecode } from "jwt-decode";
23
24
 
24
25
  export interface BaseSignerClientParams {
25
26
  stamper: TurnkeyClient["stamper"];
@@ -131,6 +132,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
131
132
  bundle: string;
132
133
  orgId: string;
133
134
  connectedEventName: keyof AlchemySignerClientEvents;
135
+ authenticatingType: AuthenticatingEventMetadata["type"];
134
136
  idToken?: string;
135
137
  }): Promise<User>;
136
138
 
@@ -10,6 +10,7 @@ import { generateRandomBuffer } from "../utils/generateRandomBuffer.js";
10
10
  import { BaseSignerClient } from "./base.js";
11
11
  import type {
12
12
  AlchemySignerClientEvents,
13
+ AuthenticatingEventMetadata,
13
14
  CreateAccountParams,
14
15
  CredentialCreationOptionOverrides,
15
16
  EmailAuthParams,
@@ -135,8 +136,8 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
135
136
  * @returns {Promise<SignupResponse>} A promise that resolves with the response object containing the account creation result.
136
137
  */
137
138
  public override createAccount = async (params: CreateAccountParams) => {
138
- this.eventEmitter.emit("authenticating");
139
139
  if (params.type === "email") {
140
+ this.eventEmitter.emit("authenticating", { type: "email" });
140
141
  const { email, expirationSeconds } = params;
141
142
  const publicKey = await this.initIframeStamper();
142
143
 
@@ -150,6 +151,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
150
151
  return response;
151
152
  }
152
153
 
154
+ this.eventEmitter.emit("authenticating", { type: "passkey" });
153
155
  // Passkey account creation flow
154
156
  const { attestation, challenge } = await this.getWebAuthnAttestation(
155
157
  params.creationOpts,
@@ -202,7 +204,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
202
204
  public override initEmailAuth = async (
203
205
  params: Omit<EmailAuthParams, "targetPublicKey">
204
206
  ) => {
205
- this.eventEmitter.emit("authenticating");
207
+ this.eventEmitter.emit("authenticating", { type: "email" });
206
208
  const { email, expirationSeconds } = params;
207
209
  const publicKey = await this.initIframeStamper();
208
210
 
@@ -248,13 +250,15 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
248
250
  orgId,
249
251
  connectedEventName,
250
252
  idToken,
253
+ authenticatingType,
251
254
  }: {
252
255
  bundle: string;
253
256
  orgId: string;
254
257
  connectedEventName: keyof AlchemySignerClientEvents;
258
+ authenticatingType: AuthenticatingEventMetadata["type"];
255
259
  idToken?: string;
256
260
  }): Promise<User> => {
257
- this.eventEmitter.emit("authenticating");
261
+ this.eventEmitter.emit("authenticating", { type: authenticatingType });
258
262
  await this.initIframeStamper();
259
263
 
260
264
  const result = await this.iframeStamper.injectCredentialBundle(bundle);
@@ -295,7 +299,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
295
299
  public override lookupUserWithPasskey = async (
296
300
  user: User | undefined = undefined
297
301
  ) => {
298
- this.eventEmitter.emit("authenticating");
302
+ this.eventEmitter.emit("authenticating", { type: "passkey" });
299
303
  await this.initWebauthnStamper(user);
300
304
  if (user) {
301
305
  this.user = user;
@@ -476,6 +480,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
476
480
  orgId,
477
481
  connectedEventName: "connectedOauth",
478
482
  idToken,
483
+ authenticatingType: "oauth",
479
484
  }).then(resolve, reject);
480
485
  } else if (alchemyError) {
481
486
  cleanup();
@@ -136,9 +136,13 @@ export type SignerEndpoints = [
136
136
  }
137
137
  ];
138
138
 
139
+ export type AuthenticatingEventMetadata = {
140
+ type: "email" | "passkey" | "oauth";
141
+ };
142
+
139
143
  export type AlchemySignerClientEvents = {
140
144
  connected(user: User): void;
141
- authenticating(): void;
145
+ authenticating(data: AuthenticatingEventMetadata): void;
142
146
  connectedEmail(user: User, bundle: string): void;
143
147
  connectedPasskey(user: User): void;
144
148
  connectedOauth(user: User, bundle: string): void;
package/src/metrics.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { createLogger } from "@account-kit/logging";
2
+ import { VERSION } from "./version.js";
3
+
4
+ export type SignerEventsSchema = [
5
+ {
6
+ EventName: "signer_authnticate";
7
+ EventData:
8
+ | {
9
+ authType: "email" | "passkey_anon" | "passkey_email" | "oauthReturn";
10
+ provider?: never;
11
+ }
12
+ | { authType: "oauth"; provider: string };
13
+ },
14
+ {
15
+ EventName: "signer_sign_message";
16
+ EventData: undefined;
17
+ }
18
+ ];
19
+
20
+ export const SignerLogger = createLogger<SignerEventsSchema>({
21
+ package: "@account-kit/signer",
22
+ version: VERSION,
23
+ });
@@ -8,8 +8,8 @@ import {
8
8
  import { createStore, type Mutate, type StoreApi } from "zustand/vanilla";
9
9
  import type { BaseSignerClient } from "../client/base";
10
10
  import type { User } from "../client/types";
11
- import type { Session, SessionManagerEvents } from "./types";
12
11
  import { assertNever } from "../utils/typeAssertions.js";
12
+ import type { Session, SessionManagerEvents } from "./types";
13
13
 
14
14
  export const DEFAULT_SESSION_MS = 15 * 60 * 1000; // 15 minutes
15
15
 
@@ -93,6 +93,7 @@ export class SessionManager {
93
93
  .completeAuthWithBundle({
94
94
  bundle: existingSession.bundle,
95
95
  orgId: existingSession.user.orgId,
96
+ authenticatingType: existingSession.type,
96
97
  connectedEventName,
97
98
  })
98
99
  .catch((e) => {
@@ -244,8 +245,16 @@ export class SessionManager {
244
245
 
245
246
  // sync local state if persisted state has changed from another tab
246
247
  window.addEventListener("focus", () => {
248
+ const oldSession = this.store.getState().session;
247
249
  this.store.persist.rehydrate();
248
- this.initialize();
250
+ const newSession = this.store.getState().session;
251
+ if (
252
+ oldSession?.user.orgId !== newSession?.user.orgId ||
253
+ oldSession?.user.userId !== newSession?.user.userId
254
+ ) {
255
+ // Initialize if the user has changed.
256
+ this.initialize();
257
+ }
249
258
  });
250
259
  };
251
260
 
package/src/types.ts CHANGED
@@ -13,7 +13,9 @@ export enum AlchemySignerStatus {
13
13
  INITIALIZING = "INITIALIZING",
14
14
  CONNECTED = "CONNECTED",
15
15
  DISCONNECTED = "DISCONNECTED",
16
- AUTHENTICATING = "AUTHENTICATING",
16
+ AUTHENTICATING_PASSKEY = "AUTHENTICATING_PASSKEY",
17
+ AUTHENTICATING_EMAIL = "AUTHENTICATING_EMAIL",
18
+ AUTHENTICATING_OAUTH = "AUTHENTICATING_OAUTH",
17
19
  AWAITING_EMAIL_AUTH = "AWAITING_EMAIL_AUTH",
18
20
  }
19
21
 
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.0.0-beta.8";
3
+ export const VERSION = "4.0.1";