@account-kit/wallet-client 4.83.2 → 4.84.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 (83) hide show
  1. package/dist/esm/client/actions/getCallsStatus.d.ts +2 -2
  2. package/dist/esm/client/actions/getCallsStatus.js +2 -2
  3. package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
  4. package/dist/esm/client/actions/grantPermissions.d.ts +1 -1
  5. package/dist/esm/client/actions/grantPermissions.js +1 -5
  6. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  7. package/dist/esm/client/actions/listAccounts.d.ts +4 -8
  8. package/dist/esm/client/actions/listAccounts.js +6 -27
  9. package/dist/esm/client/actions/listAccounts.js.map +1 -1
  10. package/dist/esm/client/actions/requestAccount.d.ts +3 -6
  11. package/dist/esm/client/actions/requestAccount.js +5 -31
  12. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  13. package/dist/esm/client/actions/sendCalls.d.ts +4 -4
  14. package/dist/esm/client/actions/sendCalls.js +4 -8
  15. package/dist/esm/client/actions/sendCalls.js.map +1 -1
  16. package/dist/esm/client/actions/sendPreparedCalls.d.ts +1 -1
  17. package/dist/esm/client/actions/sendPreparedCalls.js +1 -1
  18. package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
  19. package/dist/esm/client/actions/signMessage.d.ts +1 -1
  20. package/dist/esm/client/actions/signMessage.js +1 -1
  21. package/dist/esm/client/actions/signMessage.js.map +1 -1
  22. package/dist/esm/client/actions/signPreparedCalls.d.ts +1 -1
  23. package/dist/esm/client/actions/signPreparedCalls.js +2 -5
  24. package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
  25. package/dist/esm/client/actions/signSignatureRequest.d.ts +34 -9
  26. package/dist/esm/client/actions/signSignatureRequest.js +2 -30
  27. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  28. package/dist/esm/client/actions/signTypedData.d.ts +1 -1
  29. package/dist/esm/client/actions/signTypedData.js +1 -1
  30. package/dist/esm/client/actions/signTypedData.js.map +1 -1
  31. package/dist/esm/client/decorator.js +1 -13
  32. package/dist/esm/client/decorator.js.map +1 -1
  33. package/dist/esm/client/index.d.ts +2 -8
  34. package/dist/esm/client/index.js.map +1 -1
  35. package/dist/esm/internal/account.d.ts +1 -1
  36. package/dist/esm/internal/account.js +1 -19
  37. package/dist/esm/internal/account.js.map +1 -1
  38. package/dist/esm/utils.d.ts +0 -6
  39. package/dist/esm/utils.js +1 -14
  40. package/dist/esm/utils.js.map +1 -1
  41. package/dist/esm/version.d.ts +1 -1
  42. package/dist/esm/version.js +1 -1
  43. package/dist/esm/version.js.map +1 -1
  44. package/dist/types/client/actions/getCallsStatus.d.ts +2 -2
  45. package/dist/types/client/actions/grantPermissions.d.ts +1 -1
  46. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  47. package/dist/types/client/actions/listAccounts.d.ts +4 -8
  48. package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
  49. package/dist/types/client/actions/requestAccount.d.ts +3 -6
  50. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  51. package/dist/types/client/actions/sendCalls.d.ts +4 -4
  52. package/dist/types/client/actions/sendCalls.d.ts.map +1 -1
  53. package/dist/types/client/actions/sendPreparedCalls.d.ts +1 -1
  54. package/dist/types/client/actions/signMessage.d.ts +1 -1
  55. package/dist/types/client/actions/signPreparedCalls.d.ts +1 -1
  56. package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
  57. package/dist/types/client/actions/signSignatureRequest.d.ts +34 -9
  58. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  59. package/dist/types/client/actions/signTypedData.d.ts +1 -1
  60. package/dist/types/client/decorator.d.ts.map +1 -1
  61. package/dist/types/client/index.d.ts +2 -8
  62. package/dist/types/client/index.d.ts.map +1 -1
  63. package/dist/types/internal/account.d.ts +1 -1
  64. package/dist/types/internal/account.d.ts.map +1 -1
  65. package/dist/types/utils.d.ts +0 -6
  66. package/dist/types/utils.d.ts.map +1 -1
  67. package/dist/types/version.d.ts +1 -1
  68. package/package.json +6 -6
  69. package/src/client/actions/getCallsStatus.ts +2 -2
  70. package/src/client/actions/grantPermissions.ts +1 -8
  71. package/src/client/actions/listAccounts.ts +7 -35
  72. package/src/client/actions/requestAccount.ts +8 -51
  73. package/src/client/actions/sendCalls.ts +4 -10
  74. package/src/client/actions/sendPreparedCalls.ts +1 -1
  75. package/src/client/actions/signMessage.ts +1 -1
  76. package/src/client/actions/signPreparedCalls.ts +2 -7
  77. package/src/client/actions/signSignatureRequest.ts +5 -75
  78. package/src/client/actions/signTypedData.ts +1 -1
  79. package/src/client/decorator.ts +1 -19
  80. package/src/client/index.ts +2 -9
  81. package/src/internal/account.ts +2 -26
  82. package/src/utils.ts +1 -25
  83. package/src/version.ts +1 -1
@@ -1,20 +1,16 @@
1
- import type { SmartAccountSigner } from "@aa-sdk/core";
2
1
  import { hexToNumber, serializeSignature } from "viem";
3
- import { assertNever, isWebAuthnSigner } from "../../utils.js";
2
+ import { assertNever } from "../../utils.js";
4
3
  import type {
5
4
  PersonalSignSignatureRequest,
6
5
  TypedDataSignatureRequest,
7
6
  AuthorizationSignatureRequest,
8
7
  Eip7702UnsignedAuth,
9
- UserOpSig,
10
8
  EcdsaSig,
11
- WebauthnSig,
12
9
  } from "@alchemy/wallet-api-types";
13
10
  import { vToYParity } from "ox/Signature";
14
11
  import type { WithoutRawPayload } from "../../types.ts";
15
12
  import { metrics } from "../../metrics.js";
16
- import type { SmartWalletSigner, WebAuthnSigner } from "../index.js";
17
- import { toWebAuthnAccount } from "viem/account-abstraction";
13
+ import type { SmartWalletSigner } from "../index.js";
18
14
 
19
15
  export type SignSignatureRequestParams = WithoutRawPayload<
20
16
  | PersonalSignSignatureRequest
@@ -24,41 +20,13 @@ export type SignSignatureRequestParams = WithoutRawPayload<
24
20
  })
25
21
  >;
26
22
 
27
- export type SignSignatureRequestResult = UserOpSig["signature"];
28
-
29
- // Overload: Always an ECDSA signer, can sign any type of request
30
- export async function signSignatureRequest(
31
- signer: SmartAccountSigner,
32
- params: WithoutRawPayload<
33
- | PersonalSignSignatureRequest
34
- | TypedDataSignatureRequest
35
- | (AuthorizationSignatureRequest & {
36
- data: Eip7702UnsignedAuth;
37
- })
38
- >,
39
- ): Promise<EcdsaSig["signature"]>;
40
-
41
- // Overload: WebAuthn signer, can only sign personal_sign and eth_signTypedData_v4
42
- export async function signSignatureRequest(
43
- signer: WebAuthnSigner,
44
- params: WithoutRawPayload<
45
- PersonalSignSignatureRequest | TypedDataSignatureRequest
46
- >,
47
- ): Promise<WebauthnSig["signature"]>;
48
-
49
- // Overload: Union type of signer, can only sign personal_sign and eth_signTypedData_v4
50
- export async function signSignatureRequest(
51
- signer: SmartAccountSigner | WebAuthnSigner,
52
- params: WithoutRawPayload<
53
- PersonalSignSignatureRequest | TypedDataSignatureRequest
54
- >,
55
- ): Promise<UserOpSig["signature"]>;
23
+ export type SignSignatureRequestResult = EcdsaSig["signature"];
56
24
 
57
25
  /**
58
26
  * Signs a signature request using the provided signer.
59
27
  * This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.
60
28
  *
61
- * @param {SmartAccountSigner | WebAuthnSigner} signer - The signer to use for signing the request
29
+ * @param {SmartAccountSigner} signer - The signer to use for signing the request
62
30
  * @param {SignSignatureRequestParams} params - The signature request parameters
63
31
  * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
64
32
  * @param {SignSignatureRequestParams["data"]} params.data - The data to sign, format depends on the signature type
@@ -84,11 +52,10 @@ export async function signSignatureRequest(
84
52
  * });
85
53
  * ```
86
54
  */
87
-
88
55
  export async function signSignatureRequest(
89
56
  signer: SmartWalletSigner,
90
57
  params: SignSignatureRequestParams,
91
- ): Promise<SignSignatureRequestResult> {
58
+ ): Promise<EcdsaSig["signature"]> {
92
59
  metrics.trackEvent({
93
60
  name: "sign_signature_request",
94
61
  data: {
@@ -98,55 +65,18 @@ export async function signSignatureRequest(
98
65
 
99
66
  switch (params.type) {
100
67
  case "personal_sign": {
101
- if (isWebAuthnSigner(signer)) {
102
- const webAuthnAccount = toWebAuthnAccount({ ...signer });
103
-
104
- const { signature, webauthn: metadata } =
105
- await webAuthnAccount.signMessage({
106
- message: params.data,
107
- });
108
-
109
- return {
110
- type: "webauthn-p256",
111
- data: {
112
- signature,
113
- metadata,
114
- },
115
- };
116
- }
117
-
118
68
  return {
119
69
  type: "secp256k1",
120
70
  data: await signer.signMessage(params.data),
121
71
  };
122
72
  }
123
73
  case "eth_signTypedData_v4": {
124
- if (isWebAuthnSigner(signer)) {
125
- const webAuthnAccount = toWebAuthnAccount({ ...signer });
126
-
127
- const { signature, webauthn: metadata } =
128
- await webAuthnAccount.signTypedData(params.data);
129
-
130
- return {
131
- type: "webauthn-p256",
132
- data: {
133
- signature,
134
- metadata,
135
- },
136
- };
137
- }
138
74
  return {
139
75
  type: "secp256k1",
140
76
  data: await signer.signTypedData(params.data),
141
77
  };
142
78
  }
143
79
  case "eip7702Auth": {
144
- if (isWebAuthnSigner(signer)) {
145
- throw new Error(
146
- "WebAuthn account cannot sign EIP-7702 authorization requests",
147
- );
148
- }
149
-
150
80
  if (!signer.signAuthorization) {
151
81
  throw new Error("Signer does not implement signAuthorization");
152
82
  }
@@ -15,7 +15,7 @@ export type SignTypedDataResult = Hex;
15
15
  * This method requests the account associated with the signer and uses it to sign the typed data.
16
16
  *
17
17
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
18
- * @param {SmartAccountSigner | WebAuthnSigner} signer - The signer of the smart account
18
+ * @param {SmartAccountSigner} signer - The signer of the smart account
19
19
  * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
20
20
  * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
21
21
  *
@@ -56,24 +56,6 @@ import {
56
56
  type SendCallsResult,
57
57
  } from "./actions/sendCalls.js";
58
58
  import type { SmartWalletSigner } from "./index.js";
59
- import { isWebAuthnSigner } from "../utils.js";
60
-
61
- async function signSignatureRequestSafe(
62
- signer: SmartWalletSigner,
63
- params: SignSignatureRequestParams,
64
- ): Promise<SignSignatureRequestResult> {
65
- if (params.type === "eip7702Auth") {
66
- if (isWebAuthnSigner(signer)) {
67
- throw new Error(
68
- "WebAuthn signer cannot sign EIP-7702 authorization requests",
69
- );
70
- }
71
- // We must split up the call to signSignatureRequest across two conditionals for the TS compiler to
72
- // correctly infer which overload to use.
73
- return signSignatureRequest(signer, params);
74
- }
75
- return signSignatureRequest(signer, params);
76
- }
77
59
 
78
60
  export type SmartWalletActions<
79
61
  TAccount extends Address | undefined = Address | undefined,
@@ -122,7 +104,7 @@ export function smartWalletClientActions<
122
104
  sendCalls: (params) => sendCalls(client, signer, params),
123
105
  getCallsStatus: (params) => getCallsStatus(client, params),
124
106
  waitForCallsStatus: (params) => waitForCallsStatus(client, params),
125
- signSignatureRequest: (params) => signSignatureRequestSafe(signer, params),
107
+ signSignatureRequest: (params) => signSignatureRequest(signer, params),
126
108
  signPreparedCalls: (params) => signPreparedCalls(signer, params),
127
109
  signMessage: (params) => signMessage(client, signer, params),
128
110
  signTypedData: (params) => signTypedData(client, signer, params),
@@ -21,15 +21,8 @@ import type {
21
21
  } from "@alchemy/wallet-api-types/rpc";
22
22
  import { internalStateDecorator } from "../internal/decorator.js";
23
23
  import { metrics } from "../metrics.js";
24
- import type { ToWebAuthnAccountParameters } from "viem/account-abstraction";
25
24
 
26
- export type WebAuthnSigner = {
27
- credential: ToWebAuthnAccountParameters["credential"];
28
- getFn?: ToWebAuthnAccountParameters["getFn"] | undefined;
29
- rpId?: ToWebAuthnAccountParameters["rpId"] | undefined;
30
- };
31
-
32
- export type SmartWalletSigner = SmartAccountSigner<any> | WebAuthnSigner;
25
+ export type SmartWalletSigner = SmartAccountSigner<any>;
33
26
 
34
27
  export type SmartWalletClientParams<
35
28
  TAccount extends Address | undefined = Address | undefined,
@@ -55,7 +48,7 @@ export type SmartWalletClient<
55
48
  * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
56
49
  * @param {AlchemyTransport} params.transport - The Alchemy transport to use
57
50
  * @param {Chain} params.chain - The chain to use
58
- * @param {SmartAccountSigner | WebAuthnSigner} params.signer - The signer to use for the smart account
51
+ * @param {SmartAccountSigner} params.signer - The signer to use for the smart account
59
52
  * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
60
53
  * @param {Address} [params.account] - The smart account address to use (optional)
61
54
  * @returns {SmartWalletClient} - A viem-compatible client
@@ -1,7 +1,4 @@
1
- import {
2
- InvalidSignerTypeError,
3
- type SmartContractAccount,
4
- } from "@aa-sdk/core";
1
+ import type { SmartContractAccount } from "@aa-sdk/core";
5
2
  import {
6
3
  createModularAccountV2,
7
4
  createLightAccount,
@@ -17,7 +14,7 @@ import {
17
14
  } from "viem";
18
15
  import type { SerializedInitcode } from "@alchemy/wallet-api-types";
19
16
  import { InternalError, InvalidRequestError } from "ox/RpcResponse";
20
- import { assertNever, isWebAuthnSigner } from "../utils.js";
17
+ import { assertNever } from "../utils.js";
21
18
  import { metrics } from "../metrics.js";
22
19
  import type { SmartWalletSigner } from "../client/index.js";
23
20
 
@@ -59,10 +56,6 @@ export async function createAccount(
59
56
  throw new Error("7702 mode currently only supports ModularAccountV2");
60
57
  }
61
58
 
62
- if (isWebAuthnSigner(signer)) {
63
- throw new InvalidSignerTypeError("WebAuthn");
64
- }
65
-
66
59
  return createModularAccountV2({
67
60
  ...accountParams,
68
61
  signer,
@@ -92,23 +85,6 @@ export async function createAccount(
92
85
  },
93
86
  });
94
87
 
95
- // WebAuthn accounts must use a different signer type, so they are handled separately.
96
- if (factoryType === "MAv2.0.0-ma-webauthn") {
97
- if (!isWebAuthnSigner(signer)) {
98
- throw new InvalidSignerTypeError(signer.signerType);
99
- }
100
-
101
- return createModularAccountV2({
102
- ...commonParams,
103
- ...signer,
104
- mode: "webauthn",
105
- });
106
- }
107
-
108
- if (isWebAuthnSigner(signer)) {
109
- throw new InvalidSignerTypeError("WebAuthn");
110
- }
111
-
112
88
  // Return the account created based on the factory type
113
89
  switch (factoryType) {
114
90
  case "MAv2.0.0-sma-b":
package/src/utils.ts CHANGED
@@ -1,8 +1,4 @@
1
- import { isHex, sliceHex, toHex, type Hex } from "viem";
2
- import type { SmartAccountSigner } from "@aa-sdk/core";
3
- import type { WebAuthnPublicKey } from "@alchemy/wallet-api-types";
4
- import type { ToWebAuthnAccountParameters } from "viem/account-abstraction";
5
- import type { WebAuthnSigner } from "./client";
1
+ import { isHex, toHex, type Hex } from "viem";
6
2
 
7
3
  export type Expect<T extends true> = T;
8
4
 
@@ -29,23 +25,3 @@ export const castToHex = (val: string | number | bigint | Hex): Hex => {
29
25
  }
30
26
  return toHex(val);
31
27
  };
32
-
33
- export function isWebAuthnSigner(
34
- signer: SmartAccountSigner | WebAuthnSigner,
35
- ): signer is WebAuthnSigner {
36
- return "credential" in signer;
37
- }
38
-
39
- export function credentialToWebAuthnPublicKey(
40
- credential: ToWebAuthnAccountParameters["credential"],
41
- ): WebAuthnPublicKey {
42
- const { x, y } = {
43
- x: sliceHex(credential.publicKey, 0, 32, { strict: true }),
44
- y: sliceHex(credential.publicKey, 32, 64, { strict: true }),
45
- };
46
-
47
- return {
48
- x,
49
- y,
50
- };
51
- }
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.83.2";
3
+ export const VERSION = "4.84.0";