@account-kit/signer 4.35.0 → 4.35.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 (42) hide show
  1. package/dist/esm/base.d.ts +2 -2
  2. package/dist/esm/base.js.map +1 -1
  3. package/dist/esm/client/base.d.ts +4 -292
  4. package/dist/esm/client/base.js.map +1 -1
  5. package/dist/esm/client/index.d.ts +14 -26
  6. package/dist/esm/client/index.js.map +1 -1
  7. package/dist/esm/client/types.js.map +1 -1
  8. package/dist/esm/errors.js.map +1 -1
  9. package/dist/esm/metrics.js.map +1 -1
  10. package/dist/esm/oauth.js.map +1 -1
  11. package/dist/esm/session/manager.d.ts +2 -2
  12. package/dist/esm/session/manager.js.map +1 -1
  13. package/dist/esm/signer.d.ts +25 -117
  14. package/dist/esm/signer.js.map +1 -1
  15. package/dist/esm/solanaSigner.js.map +1 -1
  16. package/dist/esm/version.d.ts +1 -1
  17. package/dist/esm/version.js +1 -1
  18. package/dist/esm/version.js.map +1 -1
  19. package/dist/types/base.d.ts +2 -2
  20. package/dist/types/base.d.ts.map +1 -1
  21. package/dist/types/client/base.d.ts +4 -292
  22. package/dist/types/client/base.d.ts.map +1 -1
  23. package/dist/types/client/index.d.ts +14 -26
  24. package/dist/types/client/index.d.ts.map +1 -1
  25. package/dist/types/session/manager.d.ts +2 -2
  26. package/dist/types/session/manager.d.ts.map +1 -1
  27. package/dist/types/signer.d.ts +25 -117
  28. package/dist/types/signer.d.ts.map +1 -1
  29. package/dist/types/utils/base64UrlEncode.d.ts.map +1 -1
  30. package/dist/types/version.d.ts +1 -1
  31. package/package.json +6 -8
  32. package/src/base.ts +49 -49
  33. package/src/client/base.ts +37 -38
  34. package/src/client/index.ts +10 -10
  35. package/src/client/types.ts +1 -1
  36. package/src/errors.ts +1 -1
  37. package/src/metrics.ts +1 -1
  38. package/src/oauth.ts +1 -1
  39. package/src/session/manager.ts +15 -12
  40. package/src/signer.ts +1 -1
  41. package/src/solanaSigner.ts +15 -15
  42. package/src/version.ts +1 -1
@@ -82,7 +82,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
82
82
  this.connectionConfig = ConnectionConfigSchema.parse(connection);
83
83
  this.turnkeyClient = new TurnkeyClient(
84
84
  { baseUrl: "https://api.turnkey.com" },
85
- stamper
85
+ stamper,
86
86
  );
87
87
  }
88
88
 
@@ -145,11 +145,11 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
145
145
  // #region ABSTRACT METHODS
146
146
 
147
147
  public abstract createAccount(
148
- params: CreateAccountParams
148
+ params: CreateAccountParams,
149
149
  ): Promise<SignupResponse>;
150
150
 
151
151
  public abstract initEmailAuth(
152
- params: Omit<EmailAuthParams, "targetPublicKey">
152
+ params: Omit<EmailAuthParams, "targetPublicKey">,
153
153
  ): Promise<{ orgId: string; otpId?: string; multiFactors?: MfaFactor[] }>;
154
154
 
155
155
  public abstract completeAuthWithBundle(params: {
@@ -161,15 +161,15 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
161
161
  }): Promise<User>;
162
162
 
163
163
  public abstract oauthWithRedirect(
164
- args: Extract<OauthParams, { mode: "redirect" }>
164
+ args: Extract<OauthParams, { mode: "redirect" }>,
165
165
  ): Promise<User>;
166
166
 
167
167
  public abstract oauthWithPopup(
168
- args: Extract<OauthParams, { mode: "popup" }>
168
+ args: Extract<OauthParams, { mode: "popup" }>,
169
169
  ): Promise<User | AuthLinkingPrompt>;
170
170
 
171
171
  public abstract submitOtpCode(
172
- args: Omit<OtpParams, "targetPublicKey">
172
+ args: Omit<OtpParams, "targetPublicKey">,
173
173
  ): Promise<SubmitOtpCodeResponse>;
174
174
 
175
175
  public abstract disconnect(): Promise<void>;
@@ -184,7 +184,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
184
184
 
185
185
  protected abstract getWebAuthnAttestation(
186
186
  options: CredentialCreationOptions,
187
- userDetails?: { username: string }
187
+ userDetails?: { username: string },
188
188
  ): Promise<GetWebAuthnAttestationResult>;
189
189
 
190
190
  // #endregion
@@ -200,7 +200,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
200
200
  */
201
201
  public on = <E extends AlchemySignerClientEvent>(
202
202
  event: E,
203
- listener: AlchemySignerClientEvents[E]
203
+ listener: AlchemySignerClientEvents[E],
204
204
  ) => {
205
205
  this.eventEmitter.on(event, listener as any);
206
206
 
@@ -218,9 +218,8 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
218
218
  if (!this.user) {
219
219
  throw new NotAuthenticatedError();
220
220
  }
221
- const { attestation, challenge } = await this.getWebAuthnAttestation(
222
- options
223
- );
221
+ const { attestation, challenge } =
222
+ await this.getWebAuthnAttestation(options);
224
223
 
225
224
  const { activity } = await this.turnkeyClient.createAuthenticators({
226
225
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
@@ -241,7 +240,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
241
240
  const { authenticatorIds } = await this.pollActivityCompletion(
242
241
  activity,
243
242
  this.user.orgId,
244
- "createAuthenticatorsResult"
243
+ "createAuthenticatorsResult",
245
244
  );
246
245
 
247
246
  return authenticatorIds;
@@ -263,7 +262,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
263
262
  });
264
263
  return {
265
264
  isPasskeyAdded: resp.authenticators.some((it) =>
266
- it.authenticatorName.startsWith("passkey-")
265
+ it.authenticatorName.startsWith("passkey-"),
267
266
  ),
268
267
  };
269
268
  };
@@ -276,7 +275,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
276
275
  * @returns {Promise<void>} A Promise that resolves when the OAuth provider is added.
277
276
  */
278
277
  public addOauthProvider = async (
279
- params: AddOauthProviderParams
278
+ params: AddOauthProviderParams,
280
279
  ): Promise<void> => {
281
280
  if (!this.user) {
282
281
  throw new NotAuthenticatedError();
@@ -304,7 +303,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
304
303
  */
305
304
  public whoami = async (
306
305
  orgId = this.user?.orgId,
307
- idToken?: string
306
+ idToken?: string,
308
307
  ): Promise<User> => {
309
308
  if (this.user) {
310
309
  return this.user;
@@ -376,7 +375,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
376
375
  public stampGetOrganization = async (): Promise<TSignedRequest> => {
377
376
  if (!this.user) {
378
377
  throw new Error(
379
- "User must be authenticated to stamp a get organization request"
378
+ "User must be authenticated to stamp a get organization request",
380
379
  );
381
380
  }
382
381
 
@@ -396,7 +395,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
396
395
  * @throws {Error} If there is no authenticated user or the API key creation fails.
397
396
  */
398
397
  public experimental_createApiKey = async (
399
- params: experimental_CreateApiKeyParams
398
+ params: experimental_CreateApiKeyParams,
400
399
  ): Promise<void> => {
401
400
  if (!this.user) {
402
401
  throw new Error("User must be authenticated to create api key");
@@ -443,7 +442,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
443
442
  */
444
443
  public signRawMessage = async (
445
444
  msg: Hex,
446
- mode: "SOLANA" | "ETHEREUM" = "ETHEREUM"
445
+ mode: "SOLANA" | "ETHEREUM" = "ETHEREUM",
447
446
  ): Promise<Hex> => {
448
447
  if (!this.user) {
449
448
  throw new NotAuthenticatedError();
@@ -496,7 +495,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
496
495
  */
497
496
  public request = async <R extends SignerRoutes>(
498
497
  route: R,
499
- body: SignerBody<R>
498
+ body: SignerBody<R>,
500
499
  ): Promise<SignerResponse<R>> => {
501
500
  const url = this.connectionConfig.rpcUrl ?? "https://api.g.alchemy.com";
502
501
 
@@ -589,7 +588,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
589
588
  });
590
589
  default:
591
590
  throw new Error(
592
- `Unsupported MFA factor type: ${params.multiFactorType}`
591
+ `Unsupported MFA factor type: ${params.multiFactorType}`,
593
592
  );
594
593
  }
595
594
  };
@@ -602,7 +601,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
602
601
  * @throws {NotAuthenticatedError} If no user is authenticated
603
602
  */
604
603
  public verifyMfa = async (
605
- params: VerifyMfaParams
604
+ params: VerifyMfaParams,
606
605
  ): Promise<{ multiFactors: MfaFactor[] }> => {
607
606
  if (!this.user) {
608
607
  throw new NotAuthenticatedError();
@@ -635,7 +634,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
635
634
  * @throws {NotAuthenticatedError} If no user is authenticated
636
635
  */
637
636
  public removeMfa = async (
638
- params: RemoveMfaParams
637
+ params: RemoveMfaParams,
639
638
  ): Promise<{ multiFactors: MfaFactor[] }> => {
640
639
  if (!this.user) {
641
640
  throw new NotAuthenticatedError();
@@ -667,7 +666,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
667
666
  * @throws {Error} If no credential bundle is returned from the server
668
667
  */
669
668
  public validateMultiFactors = async (
670
- params: ValidateMultiFactorsParams
669
+ params: ValidateMultiFactorsParams,
671
670
  ): Promise<{ bundle: string }> => {
672
671
  // Send the encryptedPayload plus TOTP codes, etc:
673
672
  const response = await this.request("/v1/auth-validate-multi-factors", {
@@ -678,7 +677,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
678
677
  // The server is expected to return the *decrypted* payload in `response.payload.credentialBundle`
679
678
  if (!response.payload || !response.payload.credentialBundle) {
680
679
  throw new Error(
681
- "Request to validateMultiFactors did not return a credential bundle"
680
+ "Request to validateMultiFactors did not return a credential bundle",
682
681
  );
683
682
  }
684
683
 
@@ -704,17 +703,17 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
704
703
  this.turnkeyClient.getWalletAccounts({
705
704
  organizationId: this.user!.orgId,
706
705
  walletId,
707
- })
708
- )
706
+ }),
707
+ ),
709
708
  ).then((x) => x.flatMap((x) => x.accounts));
710
709
 
711
710
  const walletAccount = walletAccounts.find(
712
- (x) => x.address === this.user!.address
711
+ (x) => x.address === this.user!.address,
713
712
  );
714
713
 
715
714
  if (!walletAccount) {
716
715
  throw new Error(
717
- `Could not find wallet associated with ${this.user.address}`
716
+ `Could not find wallet associated with ${this.user.address}`,
718
717
  );
719
718
  }
720
719
 
@@ -731,7 +730,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
731
730
  const { exportBundle } = await this.pollActivityCompletion(
732
731
  activity,
733
732
  this.user.orgId,
734
- "exportWalletResult"
733
+ "exportWalletResult",
735
734
  );
736
735
 
737
736
  const result = await stamper.injectWalletExportBundle(exportBundle);
@@ -761,7 +760,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
761
760
  const { exportBundle } = await this.pollActivityCompletion(
762
761
  activity,
763
762
  this.user.orgId,
764
- "exportWalletAccountResult"
763
+ "exportWalletAccountResult",
765
764
  );
766
765
 
767
766
  const result = await stamper.injectKeyExportBundle(exportBundle);
@@ -807,7 +806,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
807
806
  * @returns {Promise<string>} returns the Oauth provider's url
808
807
  */
809
808
  protected getOauthProviderUrl = async (
810
- args: GetOauthProviderUrlArgs
809
+ args: GetOauthProviderUrlArgs,
811
810
  ): Promise<string> => {
812
811
  const {
813
812
  oauthParams,
@@ -839,7 +838,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
839
838
  const authProvider = authProviders.find(
840
839
  (provider) =>
841
840
  provider.id === authProviderId &&
842
- !!provider.isCustomProvider === !!isCustomProvider
841
+ !!provider.isCustomProvider === !!isCustomProvider,
843
842
  );
844
843
 
845
844
  if (!authProvider) {
@@ -879,7 +878,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
879
878
  openerOrigin: mode === "popup" ? window.location.origin : undefined,
880
879
  };
881
880
  const state = base64UrlEncode(
882
- new TextEncoder().encode(JSON.stringify(stateObject))
881
+ new TextEncoder().encode(JSON.stringify(stateObject)),
883
882
  );
884
883
  const authUrl = new URL(authEndpoint);
885
884
  const params: Record<string, string> = {
@@ -911,7 +910,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
911
910
  };
912
911
 
913
912
  private getOauthConfigForMode = async (
914
- mode: OauthMode
913
+ mode: OauthMode,
915
914
  ): Promise<OauthConfig> => {
916
915
  if (this.oauthConfig) {
917
916
  return this.oauthConfig;
@@ -919,7 +918,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
919
918
  return this.initOauth();
920
919
  } else {
921
920
  throw new Error(
922
- "enablePopupOauth must be set in configuration or signer.preparePopupOauth must be called before using popup-based OAuth login"
921
+ "enablePopupOauth must be set in configuration or signer.preparePopupOauth must be called before using popup-based OAuth login",
923
922
  );
924
923
  }
925
924
  };
@@ -928,13 +927,13 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
928
927
  protected pollActivityCompletion = async <
929
928
  T extends keyof Awaited<
930
929
  ReturnType<(typeof this.turnkeyClient)["getActivity"]>
931
- >["activity"]["result"]
930
+ >["activity"]["result"],
932
931
  >(
933
932
  activity: Awaited<
934
933
  ReturnType<(typeof this.turnkeyClient)["getActivity"]>
935
934
  >["activity"],
936
935
  organizationId: string,
937
- resultKey: T
936
+ resultKey: T,
938
937
  ): Promise<
939
938
  NonNullable<
940
939
  Awaited<
@@ -963,7 +962,7 @@ export abstract class BaseSignerClient<TExportWalletParams = unknown> {
963
962
  status === "ACTIVITY_STATUS_CONSENSUS_NEEDED"
964
963
  ) {
965
964
  throw new Error(
966
- `Failed to get activity with with id ${id} (status: ${status})`
965
+ `Failed to get activity with with id ${id} (status: ${status})`,
967
966
  );
968
967
  }
969
968
 
@@ -149,7 +149,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
149
149
  // Passkey account creation flow
150
150
  const { attestation, challenge } = await this.getWebAuthnAttestation(
151
151
  params.creationOpts,
152
- { username: "email" in params ? params.email : params.username }
152
+ { username: "email" in params ? params.email : params.username },
153
153
  );
154
154
 
155
155
  const result = await this.request("/v1/signup", {
@@ -196,7 +196,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
196
196
  * @returns {Promise<any>} The response from the authentication request
197
197
  */
198
198
  public override initEmailAuth = async (
199
- params: Omit<EmailAuthParams, "targetPublicKey">
199
+ params: Omit<EmailAuthParams, "targetPublicKey">,
200
200
  ) => {
201
201
  this.eventEmitter.emit("authenticating", { type: "otp" });
202
202
  const { email, emailMode, expirationSeconds } = params;
@@ -250,7 +250,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
250
250
  * @returns {Promise<{ bundle: string }>} A promise that resolves to an object containing the credential bundle.
251
251
  */
252
252
  public override async submitOtpCode(
253
- args: Omit<OtpParams, "targetPublicKey">
253
+ args: Omit<OtpParams, "targetPublicKey">,
254
254
  ): Promise<SubmitOtpCodeResponse> {
255
255
  this.eventEmitter.emit("authenticating", { type: "otpVerify" });
256
256
  const targetPublicKey = await this.initIframeStamper();
@@ -281,7 +281,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
281
281
 
282
282
  // Otherwise, it's truly an error:
283
283
  throw new Error(
284
- "Failed to submit OTP code. Server did not return required fields."
284
+ "Failed to submit OTP code. Server did not return required fields.",
285
285
  );
286
286
  }
287
287
 
@@ -366,7 +366,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
366
366
  * @returns {Promise<User>} A promise that resolves to the authenticated user object
367
367
  */
368
368
  public override lookupUserWithPasskey = async (
369
- user: User | undefined = undefined
369
+ user: User | undefined = undefined,
370
370
  ) => {
371
371
  this.eventEmitter.emit("authenticating", { type: "passkey" });
372
372
  await this.initWebauthnStamper(user);
@@ -487,7 +487,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
487
487
  * @returns {Promise<never>} A promise that will never resolve, only reject if the redirection fails
488
488
  */
489
489
  public override oauthWithRedirect = async (
490
- args: Extract<AuthParams, { type: "oauth"; mode: "redirect" }>
490
+ args: Extract<AuthParams, { type: "oauth"; mode: "redirect" }>,
491
491
  ): Promise<never> => {
492
492
  const turnkeyPublicKey = await this.initIframeStamper();
493
493
 
@@ -500,7 +500,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
500
500
 
501
501
  window.location.href = providerUrl;
502
502
  return new Promise((_, reject) =>
503
- setTimeout(() => reject("Failed to redirect to OAuth provider"), 1000)
503
+ setTimeout(() => reject("Failed to redirect to OAuth provider"), 1000),
504
504
  );
505
505
  };
506
506
 
@@ -531,7 +531,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
531
531
  * @returns {Promise<User>} A promise that resolves to a `User` object containing the authenticated user information
532
532
  */
533
533
  public override oauthWithPopup = async (
534
- args: Extract<AuthParams, { type: "oauth"; mode: "popup" }>
534
+ args: Extract<AuthParams, { type: "oauth"; mode: "popup" }>,
535
535
  ): Promise<User | AuthLinkingPrompt> => {
536
536
  const turnkeyPublicKey = await this.initIframeStamper();
537
537
  const oauthParams = args;
@@ -543,7 +543,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
543
543
  const popup = window.open(
544
544
  providerUrl,
545
545
  "_blank",
546
- "popup,width=500,height=600"
546
+ "popup,width=500,height=600",
547
547
  );
548
548
  const eventEmitter = this.eventEmitter;
549
549
  return new Promise((resolve, reject) => {
@@ -672,7 +672,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
672
672
  options?: CredentialCreationOptionOverrides,
673
673
  userDetails: { username: string } = {
674
674
  username: this.user?.email ?? "anonymous",
675
- }
675
+ },
676
676
  ) => {
677
677
  const challenge = generateRandomBuffer();
678
678
  const authenticatorUserId = generateRandomBuffer();
@@ -243,7 +243,7 @@ export type SignerEndpoints = [
243
243
  };
244
244
  multiFactors: MfaFactor[];
245
245
  };
246
- }
246
+ },
247
247
  ];
248
248
 
249
249
  export type AuthenticatingEventMetadata = {
package/src/errors.ts CHANGED
@@ -10,7 +10,7 @@ export class NotAuthenticatedError extends BaseError {
10
10
  ].join("\n"),
11
11
  {
12
12
  docsPath: "/signers/alchemy-signer/introduction.html",
13
- }
13
+ },
14
14
  );
15
15
  }
16
16
  }
package/src/metrics.ts CHANGED
@@ -19,7 +19,7 @@ export type SignerEventsSchema = [
19
19
  {
20
20
  EventName: "signer_sign_message";
21
21
  EventData: undefined;
22
- }
22
+ },
23
23
  ];
24
24
 
25
25
  export const SignerLogger = createLogger<SignerEventsSchema>({
package/src/oauth.ts CHANGED
@@ -33,7 +33,7 @@ const DEFAULT_PROVIDER_CUSTOMIZATION: Record<
33
33
  * @returns {AuthProviderCustomization | undefined} default customization parameters
34
34
  */
35
35
  export function getDefaultProviderCustomization(
36
- knownAuthProviderId: KnownAuthProvider
36
+ knownAuthProviderId: KnownAuthProvider,
37
37
  ): AuthProviderCustomization | undefined {
38
38
  return DEFAULT_PROVIDER_CUSTOMIZATION[knownAuthProviderId];
39
39
  }
@@ -27,7 +27,7 @@ export const SessionManagerParamsSchema = z.object({
27
27
  .number()
28
28
  .default(DEFAULT_SESSION_MS)
29
29
  .describe(
30
- "The time in milliseconds that a session should last before expiring [default: 15 minutes]"
30
+ "The time in milliseconds that a session should last before expiring [default: 15 minutes]",
31
31
  ),
32
32
  client: z.custom<BaseSignerClient>(),
33
33
  });
@@ -81,8 +81,8 @@ export class SessionManager {
81
81
  persist(this.getInitialState, {
82
82
  name: this.sessionKey,
83
83
  storage: createJSONStorage<SessionState>(() => storage),
84
- })
85
- )
84
+ }),
85
+ ),
86
86
  );
87
87
 
88
88
  this.registerEventListeners();
@@ -138,7 +138,7 @@ export class SessionManager {
138
138
  default:
139
139
  assertNever(
140
140
  existingSession,
141
- `Unknown session type: ${(existingSession as any).type}`
141
+ `Unknown session type: ${(existingSession as any).type}`,
142
142
  );
143
143
  }
144
144
  };
@@ -156,7 +156,7 @@ export class SessionManager {
156
156
  // temporary session must be placed in localStorage so that it can be accessed across tabs
157
157
  localStorage.setItem(
158
158
  `${this.sessionKey}:temporary`,
159
- JSON.stringify(session)
159
+ JSON.stringify(session),
160
160
  );
161
161
  };
162
162
 
@@ -173,7 +173,7 @@ export class SessionManager {
173
173
 
174
174
  on = <E extends keyof SessionManagerEvents>(
175
175
  event: E,
176
- listener: SessionManagerEvents[E]
176
+ listener: SessionManagerEvents[E],
177
177
  ) => {
178
178
  this.eventEmitter.on(event, listener as any);
179
179
 
@@ -211,7 +211,7 @@ export class SessionManager {
211
211
  Extract<Session, { type: "email" | "oauth" | "otp" }>,
212
212
  "expirationDateMs"
213
213
  >
214
- | Omit<Extract<Session, { type: "passkey" }>, "expirationDateMs">
214
+ | Omit<Extract<Session, { type: "passkey" }>, "expirationDateMs">,
215
215
  ) => {
216
216
  const session = {
217
217
  ...session_,
@@ -250,7 +250,7 @@ export class SessionManager {
250
250
  } else if (session == null && prevSession != null) {
251
251
  this.eventEmitter.emit("disconnected");
252
252
  }
253
- }
253
+ },
254
254
  );
255
255
 
256
256
  // Helper type to ensure that a listener is either defined or explicitly
@@ -325,10 +325,13 @@ export class SessionManager {
325
325
  clearTimeout(this.clearSessionHandle);
326
326
  }
327
327
 
328
- this.clearSessionHandle = setTimeout(() => {
329
- this.client.disconnect();
330
- this.clearSession();
331
- }, Math.min(session.expirationDateMs - Date.now(), Math.pow(2, 31) - 1));
328
+ this.clearSessionHandle = setTimeout(
329
+ () => {
330
+ this.client.disconnect();
331
+ this.clearSession();
332
+ },
333
+ Math.min(session.expirationDateMs - Date.now(), Math.pow(2, 31) - 1),
334
+ );
332
335
  };
333
336
 
334
337
  private setSessionWithUserAndBundle = ({
package/src/signer.ts CHANGED
@@ -276,7 +276,7 @@ function installReplaceStateFilter(qpToRemove: string[]) {
276
276
  * as the input whose values are the values of the query params.
277
277
  */
278
278
  function getAndRemoveQueryParams<T extends Record<string, string>>(
279
- keys: T
279
+ keys: T,
280
280
  ): { [K in keyof T]: string | undefined } {
281
281
  const url = new URL(window.location.href);
282
282
  const result: Record<string, string | undefined> = {};
@@ -38,7 +38,7 @@ export class SolanaSigner {
38
38
  * @returns {Promise<Transaction | VersionedTransaction >} The transaction with the signature added
39
39
  */
40
40
  async addSignature(
41
- transaction: Transaction | VersionedTransaction
41
+ transaction: Transaction | VersionedTransaction,
42
42
  ): Promise<Transaction | VersionedTransaction> {
43
43
  const user = this.alchemyClient.getUser();
44
44
  if (!user) {
@@ -53,12 +53,12 @@ export class SolanaSigner {
53
53
  const messageToSign = this.getMessageToSign(transaction);
54
54
  const signature = await this.alchemyClient.signRawMessage(
55
55
  messageToSign,
56
- "SOLANA"
56
+ "SOLANA",
57
57
  );
58
58
 
59
59
  transaction.addSignature(
60
60
  fromKey,
61
- Buffer.from(toBytes(this.formatSignatureForSolana(signature)))
61
+ Buffer.from(toBytes(this.formatSignatureForSolana(signature))),
62
62
  );
63
63
  return transaction;
64
64
  }
@@ -82,7 +82,7 @@ export class SolanaSigner {
82
82
  const messageToSign = toHex(message);
83
83
  const signature = await this.alchemyClient.signRawMessage(
84
84
  messageToSign,
85
- "SOLANA"
85
+ "SOLANA",
86
86
  );
87
87
 
88
88
  return toBytes(this.formatSignatureForSolana(signature));
@@ -91,16 +91,16 @@ export class SolanaSigner {
91
91
  async createTransaction(
92
92
  instructions: TransactionInstruction[],
93
93
  connection: Connection,
94
- version?: "versioned"
94
+ version?: "versioned",
95
95
  ): Promise<VersionedTransaction>;
96
96
  async createTransaction(
97
97
  instructions: TransactionInstruction[],
98
98
  connection: Connection,
99
- version?: "legacy"
99
+ version?: "legacy",
100
100
  ): Promise<Transaction>;
101
101
  async createTransaction(
102
102
  instructions: TransactionInstruction[],
103
- connection: Connection
103
+ connection: Connection,
104
104
  ): Promise<VersionedTransaction>;
105
105
 
106
106
  /**
@@ -114,7 +114,7 @@ export class SolanaSigner {
114
114
  async createTransaction(
115
115
  instructions: TransactionInstruction[],
116
116
  connection: Connection,
117
- version?: string
117
+ version?: string,
118
118
  ): Promise<Transaction | VersionedTransaction> {
119
119
  const blockhash = (await connection.getLatestBlockhash()).blockhash;
120
120
 
@@ -124,7 +124,7 @@ export class SolanaSigner {
124
124
  // Legacy transaction
125
125
  transferTransaction = instructions.reduce(
126
126
  (tx, instruction) => tx.add(instruction),
127
- new Transaction()
127
+ new Transaction(),
128
128
  );
129
129
 
130
130
  // Get a recent block hash
@@ -157,7 +157,7 @@ export class SolanaSigner {
157
157
  async addSponsorship(
158
158
  instructions: TransactionInstruction[],
159
159
  connection: Connection,
160
- policyId: string
160
+ policyId: string,
161
161
  ): Promise<VersionedTransaction> {
162
162
  const { blockhash } = await connection.getLatestBlockhash({
163
163
  commitment: "finalized",
@@ -170,7 +170,7 @@ export class SolanaSigner {
170
170
  }).compileToV0Message();
171
171
  const versionedTransaction = new VersionedTransaction(message);
172
172
  const serializedTransaction = Buffer.from(
173
- versionedTransaction.serialize()
173
+ versionedTransaction.serialize(),
174
174
  ).toString("base64");
175
175
  const body = JSON.stringify({
176
176
  id: crypto?.randomUUID() ?? Math.floor(Math.random() * 1000000),
@@ -195,17 +195,17 @@ export class SolanaSigner {
195
195
  const response = await fetch(
196
196
  // TODO: Use the connection??
197
197
  connection.rpcEndpoint,
198
- options
198
+ options,
199
199
  );
200
200
  const jsonResponse = await response.json();
201
201
  if (!jsonResponse?.result?.serializedTransaction)
202
202
  throw new Error(
203
203
  `Response doesn't include the serializedTransaction ${JSON.stringify(
204
- jsonResponse
205
- )}`
204
+ jsonResponse,
205
+ )}`,
206
206
  );
207
207
  return VersionedTransaction.deserialize(
208
- decodeBase64(jsonResponse.result.serializedTransaction)
208
+ decodeBase64(jsonResponse.result.serializedTransaction),
209
209
  );
210
210
  }
211
211
 
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.35.0";
3
+ export const VERSION = "4.35.1";