@account-kit/wallet-client 4.75.5-alpha.0 → 4.77.0
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.
- package/dist/esm/client/actions/grantPermissions.d.ts +3 -3
- package/dist/esm/client/actions/grantPermissions.js +28 -3
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +11 -7
- package/dist/esm/client/actions/listAccounts.js +27 -4
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +8 -4
- package/dist/esm/client/actions/requestAccount.js +38 -6
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendCalls.d.ts +3 -3
- package/dist/esm/client/actions/sendCalls.js +5 -2
- package/dist/esm/client/actions/sendCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +3 -3
- package/dist/esm/client/actions/signMessage.js +1 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +3 -3
- package/dist/esm/client/actions/signPreparedCalls.js +5 -2
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +8 -37
- package/dist/esm/client/actions/signSignatureRequest.js +30 -2
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +3 -3
- package/dist/esm/client/actions/signTypedData.js +1 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/actions/waitForCallsStatus.d.ts +1 -1
- package/dist/esm/client/decorator.d.ts +2 -2
- package/dist/esm/client/decorator.js +13 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +9 -2
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/internal/account.d.ts +3 -2
- package/dist/esm/internal/account.js +28 -3
- package/dist/esm/internal/account.js.map +1 -1
- package/dist/esm/utils.d.ts +6 -0
- package/dist/esm/utils.js +14 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +3 -3
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +11 -7
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +8 -4
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendCalls.d.ts +3 -3
- package/dist/types/client/actions/sendCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +3 -3
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +3 -3
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +8 -37
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +3 -3
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/actions/waitForCallsStatus.d.ts +1 -1
- package/dist/types/client/decorator.d.ts +2 -2
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +9 -2
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/internal/account.d.ts +3 -2
- package/dist/types/internal/account.d.ts.map +1 -1
- package/dist/types/utils.d.ts +6 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client/actions/grantPermissions.ts +33 -4
- package/src/client/actions/listAccounts.ts +38 -8
- package/src/client/actions/requestAccount.ts +59 -12
- package/src/client/actions/sendCalls.ts +9 -3
- package/src/client/actions/signMessage.ts +3 -3
- package/src/client/actions/signPreparedCalls.ts +10 -4
- package/src/client/actions/signSignatureRequest.ts +75 -8
- package/src/client/actions/signTypedData.ts +3 -3
- package/src/client/decorator.ts +21 -3
- package/src/client/index.ts +11 -2
- package/src/internal/account.ts +38 -5
- package/src/utils.ts +25 -1
- package/src/version.ts +1 -1
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
2
2
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
3
|
import type { Address } from "viem";
|
|
4
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
5
|
+
import type { WebAuthnPublicKey } from "@alchemy/wallet-api-types";
|
|
5
6
|
type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
6
7
|
Request: {
|
|
7
8
|
method: "wallet_listAccounts";
|
|
8
9
|
};
|
|
9
10
|
}>;
|
|
10
|
-
export type ListAccountsParams = Omit<RpcSchema["Request"]["params"][0], "signerAddress"> & {
|
|
11
|
-
signerAddress
|
|
12
|
-
}
|
|
11
|
+
export type ListAccountsParams = Omit<RpcSchema["Request"]["params"][0], "signerAddress" | "signerPublicKey"> & ({
|
|
12
|
+
signerAddress: Address;
|
|
13
|
+
} | {
|
|
14
|
+
signerPublicKey: WebAuthnPublicKey;
|
|
15
|
+
} | {});
|
|
13
16
|
export type ListAccountsResult = RpcSchema["ReturnType"];
|
|
14
17
|
/**
|
|
15
18
|
* Lists all smart accounts for a given signer using the wallet API client.
|
|
16
19
|
*
|
|
17
20
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
18
|
-
* @param {SmartAccountSigner} signer - The signer for which to list accounts
|
|
21
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer for which to list accounts
|
|
19
22
|
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
20
|
-
* @param {
|
|
23
|
+
* @param {Address} [params.signerAddress] - The address of the signer to list accounts for
|
|
24
|
+
* @param {WebAuthnPublicKey} [params.signerPublicKey] - The public key of the signer to list accounts for
|
|
21
25
|
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
22
26
|
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
23
27
|
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
@@ -38,6 +42,6 @@ export type ListAccountsResult = RpcSchema["ReturnType"];
|
|
|
38
42
|
* });
|
|
39
43
|
* ```
|
|
40
44
|
*/
|
|
41
|
-
export declare function listAccounts(client: InnerWalletApiClient, signer:
|
|
45
|
+
export declare function listAccounts(client: InnerWalletApiClient, signer: SmartWalletSigner, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
42
46
|
export {};
|
|
43
47
|
//# sourceMappingURL=listAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,qBAAqB,CAAC;KAC/B,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACjC,eAAe,GAAG,iBAAiB,CACpC,GACC,CAAC;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,eAAe,EAAE,iBAAiB,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAuC7B"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Address } from "abitype";
|
|
3
3
|
import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
4
4
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
5
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
6
|
+
import { type WebAuthnPublicKey } from "@alchemy/wallet-api-types";
|
|
5
7
|
type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
6
8
|
Request: {
|
|
7
9
|
method: "wallet_requestAccount";
|
|
@@ -9,7 +11,9 @@ type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
|
9
11
|
}>;
|
|
10
12
|
export type RequestAccountParams = Omit<Extract<RpcSchema["Request"]["params"][0], {
|
|
11
13
|
signerAddress: Address;
|
|
12
|
-
}
|
|
14
|
+
} | {
|
|
15
|
+
signerPublicKey: WebAuthnPublicKey;
|
|
16
|
+
}>, "signerAddress" | "signerPublicKey" | "includeCounterfactualInfo"> & {
|
|
13
17
|
accountAddress?: Address;
|
|
14
18
|
};
|
|
15
19
|
export type RequestAccountResult = SmartContractAccount;
|
|
@@ -19,7 +23,7 @@ export type RequestAccountResult = SmartContractAccount;
|
|
|
19
23
|
* If an account already exists, the creationHint will be ignored.
|
|
20
24
|
*
|
|
21
25
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
22
|
-
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
26
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer that will be associated with the account
|
|
23
27
|
* @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account
|
|
24
28
|
* @param {string} [params.id] - Optional identifier for the account. If specified, a new account with this ID will be created even if one already exists for the signer
|
|
25
29
|
* @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists
|
|
@@ -32,6 +36,6 @@ export type RequestAccountResult = SmartContractAccount;
|
|
|
32
36
|
* const account = await client.requestAccount(signer);
|
|
33
37
|
* ```
|
|
34
38
|
*/
|
|
35
|
-
export declare function requestAccount(client: InnerWalletApiClient, signer:
|
|
39
|
+
export declare function requestAccount(client: InnerWalletApiClient, signer: SmartWalletSigner, params?: RequestAccountParams): Promise<RequestAccountResult>;
|
|
36
40
|
export {};
|
|
37
41
|
//# sourceMappingURL=requestAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,uBAAuB,CAAC;KACjC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,OAAO,CACL,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACjC;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,eAAe,EAAE,iBAAiB,CAAA;CAAE,CACpE,EACD,eAAe,GAAG,iBAAiB,GAAG,2BAA2B,CAClE,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CA+E/B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
3
|
import { type PrepareCallsParams } from "./prepareCalls.js";
|
|
4
|
-
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
5
4
|
import { type SendPreparedCallsResult } from "./sendPreparedCalls.js";
|
|
5
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
6
6
|
export type SendCallsParams<TAccount extends Address | undefined = Address | undefined> = PrepareCallsParams<TAccount>;
|
|
7
7
|
export type SendCallsResult = SendPreparedCallsResult;
|
|
8
8
|
/**
|
|
@@ -14,7 +14,7 @@ export type SendCallsResult = SendPreparedCallsResult;
|
|
|
14
14
|
* </Note>
|
|
15
15
|
*
|
|
16
16
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
-
* @param {SmartAccountSigner} signer - The signer to use
|
|
17
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer to use
|
|
18
18
|
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
19
19
|
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
20
20
|
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
@@ -38,5 +38,5 @@ export type SendCallsResult = SendPreparedCallsResult;
|
|
|
38
38
|
* console.log(result.preparedCallIds);
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export declare function sendCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer:
|
|
41
|
+
export declare function sendCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartWalletSigner, params: SendCallsParams<TAccount>): Promise<SendCallsResult>;
|
|
42
42
|
//# sourceMappingURL=sendCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,
|
|
1
|
+
{"version":3,"file":"sendCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,CACzB,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CAqC1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
1
|
import { type Address, type Hex, type SignableMessage } from "viem";
|
|
3
2
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
4
4
|
export type SignMessageParams = {
|
|
5
5
|
message: SignableMessage;
|
|
6
6
|
account?: Address;
|
|
@@ -11,7 +11,7 @@ export type SignMessageResult = Hex;
|
|
|
11
11
|
* This method requests the account associated with the signer and uses it to sign the message.
|
|
12
12
|
*
|
|
13
13
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
-
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
14
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer of the smart account
|
|
15
15
|
* @param {SignMessageParams} params - Parameters for signing the message
|
|
16
16
|
* @param {SignableMessage} params.message - The message to sign using EIP-191. Can be a string, or object with raw bytes.
|
|
17
17
|
* @param {Address} [params.account] - Optional account address to use for signing. If not provided, uses the client's current account.
|
|
@@ -26,5 +26,5 @@ export type SignMessageResult = Hex;
|
|
|
26
26
|
* const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare function signMessage(client: InnerWalletApiClient, signer:
|
|
29
|
+
export declare function signMessage(client: InnerWalletApiClient, signer: SmartWalletSigner, params: SignMessageParams): Promise<SignMessageResult>;
|
|
30
30
|
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAU5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrepareCallsResult } from "./prepareCalls.ts";
|
|
2
|
-
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
3
2
|
import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
4
4
|
type RpcSchema = Extract<WalletServerRpcSchemaType, {
|
|
5
5
|
Request: {
|
|
6
6
|
method: "wallet_sendPreparedCalls";
|
|
@@ -11,10 +11,10 @@ export type SignPreparedCallsResult = RpcSchema["Request"]["params"][0];
|
|
|
11
11
|
/**
|
|
12
12
|
* Signs prepared calls using the provided signer.
|
|
13
13
|
*
|
|
14
|
-
* @param {SmartAccountSigner} signer - The signer to use
|
|
14
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer to use
|
|
15
15
|
* @param {SignPreparedCallsParams} params - The prepared calls with signature requests
|
|
16
16
|
* @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls
|
|
17
17
|
*/
|
|
18
|
-
export declare function signPreparedCalls(signer:
|
|
18
|
+
export declare function signPreparedCalls(signer: SmartWalletSigner, params: SignPreparedCallsParams): Promise<SignPreparedCallsResult>;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=signPreparedCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"signPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAQ/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CACtB,yBAAyB,EACzB;IACE,OAAO,EAAE;QACP,MAAM,EAAE,0BAA0B,CAAC;KACpC,CAAC;CACH,CACF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAwElC"}
|
|
@@ -1,43 +1,14 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import {
|
|
3
|
-
import type { PersonalSignSignatureRequest, TypedDataSignatureRequest, AuthorizationSignatureRequest, Eip7702UnsignedAuth } from "@alchemy/wallet-api-types";
|
|
2
|
+
import type { PersonalSignSignatureRequest, TypedDataSignatureRequest, AuthorizationSignatureRequest, Eip7702UnsignedAuth, UserOpSig, EcdsaSig, WebauthnSig } from "@alchemy/wallet-api-types";
|
|
4
3
|
import type { WithoutRawPayload } from "../../types.ts";
|
|
4
|
+
import type { WebAuthnSigner } from "../index.js";
|
|
5
5
|
export type SignSignatureRequestParams = WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest | (AuthorizationSignatureRequest & {
|
|
6
6
|
data: Eip7702UnsignedAuth;
|
|
7
7
|
})>;
|
|
8
|
-
export type SignSignatureRequestResult =
|
|
9
|
-
|
|
10
|
-
data:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.
|
|
15
|
-
*
|
|
16
|
-
* @param {SmartAccountSigner} signer - The signer to use for signing the request
|
|
17
|
-
* @param {SignSignatureRequestParams} params - The signature request parameters
|
|
18
|
-
* @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
|
|
19
|
-
* @param {SignSignatureRequestParams["data"]} params.data - The data to sign, format depends on the signature type
|
|
20
|
-
* @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // Sign a personal message
|
|
25
|
-
* const result = await client.signSignatureRequest({
|
|
26
|
-
* type: 'personal_sign',
|
|
27
|
-
* data: 'Hello, world!'
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* // Sign typed data (EIP-712)
|
|
31
|
-
* const result = await client.signSignatureRequest({
|
|
32
|
-
* type: 'eth_signTypedData_v4',
|
|
33
|
-
* data: {
|
|
34
|
-
* domain: { ... },
|
|
35
|
-
* types: { ... },
|
|
36
|
-
* primaryType: '...',
|
|
37
|
-
* message: { ... }
|
|
38
|
-
* }
|
|
39
|
-
* });
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function signSignatureRequest(signer: SmartAccountSigner, params: SignSignatureRequestParams): Promise<SignSignatureRequestResult>;
|
|
8
|
+
export type SignSignatureRequestResult = UserOpSig["signature"];
|
|
9
|
+
export declare function signSignatureRequest(signer: SmartAccountSigner, params: WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest | (AuthorizationSignatureRequest & {
|
|
10
|
+
data: Eip7702UnsignedAuth;
|
|
11
|
+
})>): Promise<EcdsaSig["signature"]>;
|
|
12
|
+
export declare function signSignatureRequest(signer: WebAuthnSigner, params: WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest>): Promise<WebauthnSig["signature"]>;
|
|
13
|
+
export declare function signSignatureRequest(signer: SmartAccountSigner | WebAuthnSigner, params: WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest>): Promise<UserOpSig["signature"]>;
|
|
43
14
|
//# sourceMappingURL=signSignatureRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CACtD,4BAA4B,GAC5B,yBAAyB,GACzB,CAAC,6BAA6B,GAAG;IAC/B,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CACL,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;AAGhE,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,iBAAiB,CACrB,4BAA4B,GAC5B,yBAAyB,GACzB,CAAC,6BAA6B,GAAG;IAC/B,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CACL,GACA,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAGlC,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,iBAAiB,CACvB,4BAA4B,GAAG,yBAAyB,CACzD,GACA,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAGrC,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,kBAAkB,GAAG,cAAc,EAC3C,MAAM,EAAE,iBAAiB,CACvB,4BAA4B,GAAG,yBAAyB,CACzD,GACA,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
1
|
import { type Address, type Hex, type TypedDataDefinition } from "viem";
|
|
3
2
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
4
4
|
export type SignTypedDataParams = TypedDataDefinition & {
|
|
5
5
|
account?: Address;
|
|
6
6
|
};
|
|
@@ -10,7 +10,7 @@ export type SignTypedDataResult = Hex;
|
|
|
10
10
|
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
11
11
|
*
|
|
12
12
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
13
|
-
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
13
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer of the smart account
|
|
14
14
|
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
15
15
|
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
16
16
|
*
|
|
@@ -38,5 +38,5 @@ export type SignTypedDataResult = Hex;
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export declare function signTypedData(client: InnerWalletApiClient, signer:
|
|
41
|
+
export declare function signTypedData(client: InnerWalletApiClient, signer: SmartWalletSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
|
|
42
42
|
//# sourceMappingURL=signTypedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,mBAAmB,EAAE,MAAM,MAAM,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAU9B"}
|
|
@@ -15,7 +15,6 @@ import type { InnerWalletApiClient } from "../../types.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function waitForCallsStatus(client: InnerWalletApiClient, params: WaitForCallsStatusParameters): Promise<{
|
|
17
17
|
version: string;
|
|
18
|
-
id: string;
|
|
19
18
|
chainId: number;
|
|
20
19
|
capabilities?: {
|
|
21
20
|
[key: string]: any;
|
|
@@ -23,6 +22,7 @@ export declare function waitForCallsStatus(client: InnerWalletApiClient, params:
|
|
|
23
22
|
[x: string]: any;
|
|
24
23
|
} | undefined;
|
|
25
24
|
atomic: boolean;
|
|
25
|
+
id: string;
|
|
26
26
|
receipts?: import("viem").WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
|
|
27
27
|
statusCode: number;
|
|
28
28
|
status: "pending" | "success" | "failure" | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
1
|
import type { Address, Hex } from "viem";
|
|
3
2
|
import { type WaitForCallsStatusParameters, type WaitForCallsStatusReturnType } from "viem/actions";
|
|
4
3
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
@@ -13,6 +12,7 @@ import { type SignSignatureRequestParams, type SignSignatureRequestResult } from
|
|
|
13
12
|
import { type SignTypedDataParams } from "./actions/signTypedData.js";
|
|
14
13
|
import { type SignPreparedCallsParams, type SignPreparedCallsResult } from "./actions/signPreparedCalls.js";
|
|
15
14
|
import { type SendCallsParams, type SendCallsResult } from "./actions/sendCalls.js";
|
|
15
|
+
import type { SmartWalletSigner } from "./index.js";
|
|
16
16
|
export type SmartWalletActions<TAccount extends Address | undefined = Address | undefined> = {
|
|
17
17
|
requestAccount: (params?: RequestAccountParams) => Promise<RequestAccountResult>;
|
|
18
18
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
@@ -27,5 +27,5 @@ export type SmartWalletActions<TAccount extends Address | undefined = Address |
|
|
|
27
27
|
signTypedData: (params: SignTypedDataParams) => Promise<Hex>;
|
|
28
28
|
grantPermissions: (params: GrantPermissionsParams<TAccount>) => Promise<GrantPermissionsResult>;
|
|
29
29
|
};
|
|
30
|
-
export declare function smartWalletClientActions<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer:
|
|
30
|
+
export declare function smartWalletClientActions<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartWalletSigner): SmartWalletActions<TAccount>;
|
|
31
31
|
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,10 +3,17 @@ import type { AlchemyTransport } from "@account-kit/infra";
|
|
|
3
3
|
import { type Address, type Chain, type Prettify } from "viem";
|
|
4
4
|
import type { InnerWalletApiClientBase } from "../types.ts";
|
|
5
5
|
import { type SmartWalletActions } from "./decorator.js";
|
|
6
|
+
import type { ToWebAuthnAccountParameters } from "viem/account-abstraction";
|
|
7
|
+
export type WebAuthnSigner = {
|
|
8
|
+
credential: ToWebAuthnAccountParameters["credential"];
|
|
9
|
+
getFn?: ToWebAuthnAccountParameters["getFn"] | undefined;
|
|
10
|
+
rpId?: ToWebAuthnAccountParameters["rpId"] | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type SmartWalletSigner = SmartAccountSigner<any> | WebAuthnSigner;
|
|
6
13
|
export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
|
|
7
14
|
transport: AlchemyTransport;
|
|
8
15
|
chain: Chain;
|
|
9
|
-
signer:
|
|
16
|
+
signer: SmartWalletSigner;
|
|
10
17
|
account?: TAccount | Address | undefined;
|
|
11
18
|
} & ({
|
|
12
19
|
policyId?: string;
|
|
@@ -22,7 +29,7 @@ export type SmartWalletClient<TAccount extends Address | undefined = Address | u
|
|
|
22
29
|
* @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
|
|
23
30
|
* @param {AlchemyTransport} params.transport - The Alchemy transport to use
|
|
24
31
|
* @param {Chain} params.chain - The chain to use
|
|
25
|
-
* @param {SmartAccountSigner} params.signer - The signer to use for the smart account
|
|
32
|
+
* @param {SmartAccountSigner | WebAuthnSigner} params.signer - The signer to use for the smart account
|
|
26
33
|
* @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
|
|
27
34
|
* @param {Address} [params.account] - The smart account address to use (optional)
|
|
28
35
|
* @returns {SmartWalletClient} - A viem-compatible client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,QAAQ,EAKd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,QAAQ,EAKd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAQxB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACzD,IAAI,CAAC,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;AAEzE,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,QAAQ,CACV;IACE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1C,GAAG,CACA;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,GACxC;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAC7C,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC3B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import { type Chain, type Transport, type Address } from "viem";
|
|
3
3
|
import type { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
4
|
+
import type { SmartWalletSigner } from "../client/index.js";
|
|
4
5
|
type CreateAccountParams = {
|
|
5
6
|
chain: Chain;
|
|
6
7
|
transport: Transport;
|
|
7
|
-
signer:
|
|
8
|
+
signer: SmartWalletSigner;
|
|
8
9
|
accountAddress: Address;
|
|
9
10
|
counterfactualInfo?: SerializedInitcode;
|
|
10
11
|
delegation?: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/internal/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/internal/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAOtB,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CA+G/B"}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { 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";
|
|
2
6
|
export type Expect<T extends true> = T;
|
|
3
7
|
export declare const assertNever: (_val: never, msg: string) => never;
|
|
4
8
|
/**
|
|
@@ -15,4 +19,6 @@ export declare const assertNever: (_val: never, msg: string) => never;
|
|
|
15
19
|
* ```
|
|
16
20
|
*/
|
|
17
21
|
export declare const castToHex: (val: string | number | bigint | Hex) => Hex;
|
|
22
|
+
export declare function isWebAuthnSigner(signer: SmartAccountSigner | WebAuthnSigner): signer is WebAuthnSigner;
|
|
23
|
+
export declare function credentialToWebAuthnPublicKey(credential: ToWebAuthnAccountParameters["credential"]): WebAuthnPublicKey;
|
|
18
24
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAEvC,eAAO,MAAM,WAAW,GAAI,MAAM,KAAK,EAAE,KAAK,MAAM,KAAG,KAEtD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,KAAG,GAK/D,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GAAG,cAAc,GAC1C,MAAM,IAAI,cAAc,CAE1B;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC,GACpD,iBAAiB,CAUnB"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.77.0";
|
|
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,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/wallet-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.77.0",
|
|
4
4
|
"description": "Wallet Client for Alchemy Account Kit",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"test:e2e": "bun test ./src/**/*.e2e.test.*"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aa-sdk/core": "^4.
|
|
48
|
-
"@account-kit/infra": "^4.
|
|
49
|
-
"@account-kit/smart-contracts": "^4.
|
|
47
|
+
"@aa-sdk/core": "^4.77.0",
|
|
48
|
+
"@account-kit/infra": "^4.77.0",
|
|
49
|
+
"@account-kit/smart-contracts": "^4.77.0",
|
|
50
50
|
"@alchemy/wallet-api-types": "0.1.0-alpha.18",
|
|
51
51
|
"deep-equal": "^2.2.3",
|
|
52
52
|
"ox": "^0.6.12"
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
74
74
|
},
|
|
75
75
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "0aa4229e7b4b5aeea1f4a9642b7abe0a9ff49e75"
|
|
77
77
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountNotFoundError
|
|
1
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
2
2
|
import {
|
|
3
3
|
toHex,
|
|
4
4
|
type Address,
|
|
@@ -6,11 +6,14 @@ import {
|
|
|
6
6
|
type IsUndefined,
|
|
7
7
|
type Prettify,
|
|
8
8
|
concatHex,
|
|
9
|
+
serializeSignature,
|
|
9
10
|
} from "viem";
|
|
10
11
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
11
12
|
import type { WalletServerRpcSchemaType } from "@alchemy/wallet-api-types/rpc";
|
|
12
13
|
import { signSignatureRequest } from "./signSignatureRequest.js";
|
|
13
14
|
import { metrics } from "../../metrics.js";
|
|
15
|
+
import type { SmartWalletSigner } from "../index.js";
|
|
16
|
+
import { isWebAuthnSigner } from "../../utils.js";
|
|
14
17
|
|
|
15
18
|
type RpcSchema = Extract<
|
|
16
19
|
WalletServerRpcSchemaType,
|
|
@@ -39,7 +42,7 @@ export type GrantPermissionsResult = {
|
|
|
39
42
|
* This allows another key to perform operations on behalf of the account.
|
|
40
43
|
*
|
|
41
44
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
42
|
-
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
45
|
+
* @param {SmartAccountSigner | WebAuthnSigner} signer - The signer of the smart account
|
|
43
46
|
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
44
47
|
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
45
48
|
* @param {number} params.expirySec - Unix timestamp when the permissions expire
|
|
@@ -93,7 +96,7 @@ export async function grantPermissions<
|
|
|
93
96
|
TAccount extends Address | undefined = Address | undefined,
|
|
94
97
|
>(
|
|
95
98
|
client: InnerWalletApiClient,
|
|
96
|
-
signer:
|
|
99
|
+
signer: SmartWalletSigner,
|
|
97
100
|
params: GrantPermissionsParams<TAccount>,
|
|
98
101
|
): Promise<GrantPermissionsResult> {
|
|
99
102
|
metrics.trackEvent({
|
|
@@ -105,6 +108,12 @@ export async function grantPermissions<
|
|
|
105
108
|
throw new AccountNotFoundError();
|
|
106
109
|
}
|
|
107
110
|
|
|
111
|
+
if (isWebAuthnSigner(signer)) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
"WebAuthn signer is not currently supported for grantPermissions",
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
108
117
|
const { sessionId, signatureRequest } = await client.request({
|
|
109
118
|
method: "wallet_createSession",
|
|
110
119
|
params: [
|
|
@@ -118,11 +127,31 @@ export async function grantPermissions<
|
|
|
118
127
|
|
|
119
128
|
const signature = await signSignatureRequest(signer, signatureRequest);
|
|
120
129
|
|
|
130
|
+
let signatureHex: Hex;
|
|
131
|
+
if (typeof signature.data === "string") {
|
|
132
|
+
signatureHex = signature.data;
|
|
133
|
+
} else {
|
|
134
|
+
const sigData = signature.data;
|
|
135
|
+
if ("yParity" in sigData) {
|
|
136
|
+
signatureHex = serializeSignature({
|
|
137
|
+
r: sigData.r,
|
|
138
|
+
s: sigData.s,
|
|
139
|
+
yParity: Number(sigData.yParity),
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
signatureHex = serializeSignature({
|
|
143
|
+
r: sigData.r,
|
|
144
|
+
s: sigData.s,
|
|
145
|
+
v: BigInt(sigData.v),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
121
150
|
return {
|
|
122
151
|
context: concatHex([
|
|
123
152
|
"0x00", // remote mode
|
|
124
153
|
sessionId,
|
|
125
|
-
|
|
154
|
+
signatureHex,
|
|
126
155
|
]),
|
|
127
156
|
};
|
|
128
157
|
}
|