@account-kit/wallet-client 0.1.0-alpha.1 → 0.1.0-alpha.2
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/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
- package/dist/esm/client/actions/createAccount.d.ts +27 -2
- package/dist/esm/client/actions/createAccount.js +25 -0
- package/dist/esm/client/actions/createAccount.js.map +1 -1
- package/dist/esm/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +60 -2
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +26 -2
- package/dist/esm/client/actions/listAccounts.js +24 -0
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +28 -2
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +21 -2
- package/dist/esm/client/actions/requestAccount.js +14 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +22 -2
- package/dist/esm/client/actions/signMessage.js +4 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +35 -2
- package/dist/esm/client/actions/signTypedData.js +3 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +99 -11
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +7 -5
- package/dist/esm/client/decorator.js +1 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +4 -4
- package/dist/esm/client/index.js +29 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -0
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +1 -1
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/internal/decorator.d.ts +2 -0
- package/dist/esm/internal/decorator.js +10 -0
- package/dist/esm/internal/decorator.js.map +1 -0
- package/dist/esm/local/client.d.ts +1 -1
- package/dist/esm/local/client.js +8 -1
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +1 -1
- package/dist/esm/remote/client.js +6 -1
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +1 -1
- package/dist/esm/types.d.ts +15 -4
- package/dist/esm/types.js.map +1 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
- package/dist/types/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +60 -2
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +26 -2
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +28 -2
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +21 -2
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +22 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +35 -2
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +7 -5
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/internal/decorator.d.ts +3 -0
- package/dist/types/internal/decorator.d.ts.map +1 -0
- package/dist/types/local/client.d.ts +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +1 -1
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +1 -1
- package/dist/types/types.d.ts +15 -4
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/capabilities/permissions/mav2.ts +2 -2
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/getCallsStatus.ts +21 -2
- package/src/client/actions/grantPermissions.ts +60 -2
- package/src/client/actions/listAccounts.ts +26 -2
- package/src/client/actions/prepareCalls.ts +28 -2
- package/src/client/actions/requestAccount.ts +40 -5
- package/src/client/actions/sendPreparedCalls.ts +39 -2
- package/src/client/actions/signMessage.ts +24 -4
- package/src/client/actions/signSignatureRequest.ts +31 -0
- package/src/client/actions/signTypedData.ts +39 -3
- package/src/client/client.e2e-test.ts +120 -11
- package/src/client/decorator.ts +10 -12
- package/src/client/index.ts +41 -10
- package/src/exports/index.ts +1 -0
- package/src/exports/internal.ts +1 -1
- package/src/internal/decorator.ts +12 -0
- package/src/local/client.ts +52 -42
- package/src/remote/client.ts +10 -5
- package/src/types.ts +18 -4
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Hex, type JsonRpcAccount, type SignableMessage } from "viem";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
export type SignMessageParams =
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
+
export type SignMessageParams = {
|
|
5
|
+
message: SignableMessage;
|
|
6
|
+
account?: Address;
|
|
7
|
+
};
|
|
5
8
|
export type SignMessageResult = Hex;
|
|
9
|
+
/**
|
|
10
|
+
* Signs a message using the smart account.
|
|
11
|
+
* This method requests the account associated with the signer and uses it to sign the message.
|
|
12
|
+
*
|
|
13
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
15
|
+
* @param {SignableMessage} message - The message to sign
|
|
16
|
+
* @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Sign a simple text message
|
|
20
|
+
* const signature = await client.signMessage("Hello, world!");
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Sign a raw hex message
|
|
24
|
+
* const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
|
|
25
|
+
*/
|
|
6
26
|
export declare function signMessage<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignMessageParams): Promise<SignMessageResult>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {} from "viem";
|
|
2
2
|
import { requestAccount } from "./requestAccount.js";
|
|
3
3
|
export async function signMessage(client, signer, params) {
|
|
4
|
-
const account = await requestAccount(client, signer
|
|
5
|
-
|
|
4
|
+
const account = await requestAccount(client, signer, {
|
|
5
|
+
accountAddress: params.account ?? client.account?.address,
|
|
6
|
+
});
|
|
7
|
+
return account.signMessageWith6492({ message: params.message });
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=signMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAiCrD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA4B,EAC5B,MAA0B,EAC1B,MAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type SignableMessage,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignMessageParams = { message: SignableMessage; account?: Address };\n\nexport type SignMessageResult = Hex;\n\n/**\n * Signs a message using the smart account.\n * This method requests the account associated with the signer and uses it to sign the message.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {SignableMessage} message - The message to sign\n * @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string\n *\n * @example\n * // Sign a simple text message\n * const signature = await client.signMessage(\"Hello, world!\");\n *\n * @example\n * // Sign a raw hex message\n * const signature = await client.signMessage({ raw: \"0x48656c6c6f2c20776f726c6421\" });\n */\nexport async function signMessage<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignMessageParams,\n): Promise<SignMessageResult>;\n\nexport async function signMessage(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignMessageParams,\n): Promise<SignMessageResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signMessageWith6492({ message: params.message });\n}\n"]}
|
|
@@ -7,4 +7,35 @@ export type SignSignatureRequestResult = {
|
|
|
7
7
|
type: "ecdsa";
|
|
8
8
|
signature: Hex;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Signs a signature request using the provided signer.
|
|
12
|
+
* This method handles different types of signature requests including personal_sign and eth_signTypedData_v4.
|
|
13
|
+
*
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer to use for signing the request
|
|
15
|
+
* @param {SignSignatureRequestParams} params - The signature request parameters
|
|
16
|
+
* @param {string} params.type - The type of signature request ('personal_sign' or 'eth_signTypedData_v4')
|
|
17
|
+
* @param {any} params.data - The data to sign, format depends on the signature type
|
|
18
|
+
* @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
|
|
19
|
+
* @returns {string} result.type - The signature type (currently only 'ecdsa' is supported)
|
|
20
|
+
* @returns {Hex} result.signature - The hex-encoded signature
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Sign a personal message
|
|
24
|
+
* const result = await client.signSignatureRequest({
|
|
25
|
+
* type: 'personal_sign',
|
|
26
|
+
* data: 'Hello, world!'
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
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
|
+
*/
|
|
10
41
|
export declare function signSignatureRequest(signer: SmartAccountSigner, params: SignSignatureRequestParams): Promise<SignSignatureRequestResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6C7C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,MAAM,SAAS,GACb,MAAM,CAAC,IAAI,KAAK,eAAe;QAC7B,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAsB;YACtC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;IAEjE,OAAO;QACL,IAAI,EAAE,OAAO;QACb,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { type Hex } from \"viem\";\nimport { TypeSignatureRequest } from \"../../schemas.js\";\nimport { assertNever } from \"../../utils.js\";\n\nexport type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;\n\nexport type SignSignatureRequestResult = {\n type: \"ecdsa\";\n signature: Hex;\n};\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign and eth_signTypedData_v4.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign' or 'eth_signTypedData_v4')\n * @param {any} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n * @returns {string} result.type - The signature type (currently only 'ecdsa' is supported)\n * @returns {Hex} result.signature - The hex-encoded signature\n *\n * @example\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * @example\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n */\nexport function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult>;\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n const signature =\n params.type === \"personal_sign\"\n ? await signer.signMessage(params.data)\n : params.type === \"eth_signTypedData_v4\"\n ? await signer.signTypedData(params.data)\n : assertNever(params, \"Unexpected signature request type\");\n\n return {\n type: \"ecdsa\",\n signature,\n };\n}\n"]}
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Hex, type JsonRpcAccount, type TypedDataDefinition } from "viem";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
export type SignTypedDataParams = TypedDataDefinition
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
+
export type SignTypedDataParams = TypedDataDefinition & {
|
|
5
|
+
account?: Address;
|
|
6
|
+
};
|
|
5
7
|
export type SignTypedDataResult = Hex;
|
|
8
|
+
/**
|
|
9
|
+
* Signs typed data (EIP-712) using the smart account.
|
|
10
|
+
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
11
|
+
*
|
|
12
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
13
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
14
|
+
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
15
|
+
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Sign typed data
|
|
19
|
+
* const signature = await client.signTypedData({
|
|
20
|
+
* domain: {
|
|
21
|
+
* name: 'Example DApp',
|
|
22
|
+
* version: '1',
|
|
23
|
+
* chainId: 1,
|
|
24
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
|
|
25
|
+
* },
|
|
26
|
+
* types: {
|
|
27
|
+
* Person: [
|
|
28
|
+
* { name: 'name', type: 'string' },
|
|
29
|
+
* { name: 'wallet', type: 'address' }
|
|
30
|
+
* ]
|
|
31
|
+
* },
|
|
32
|
+
* primaryType: 'Person',
|
|
33
|
+
* message: {
|
|
34
|
+
* name: 'John Doe',
|
|
35
|
+
* wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
6
39
|
export declare function signTypedData<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {} from "viem";
|
|
2
2
|
import { requestAccount } from "./requestAccount.js";
|
|
3
3
|
export async function signTypedData(client, signer, params) {
|
|
4
|
-
const account = await requestAccount(client, signer
|
|
4
|
+
const account = await requestAccount(client, signer, {
|
|
5
|
+
accountAddress: params.account ?? client.account?.address,
|
|
6
|
+
});
|
|
5
7
|
return account.signTypedDataWith6492(params);
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=signTypedData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAiDrD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n */\nexport async function signTypedData<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult>;\n\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
|
|
@@ -24,6 +24,21 @@ describe("Client E2E Tests", () => {
|
|
|
24
24
|
chain: arbitrumSepolia,
|
|
25
25
|
transport,
|
|
26
26
|
});
|
|
27
|
+
it("should successfully request account with different salt", async () => {
|
|
28
|
+
const account = await client.requestAccount({
|
|
29
|
+
id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
|
|
30
|
+
creationHint: { salt: "0x1" },
|
|
31
|
+
});
|
|
32
|
+
expect(account.address).toMatchInlineSnapshot(`"0x569bCECaC47Ef9706c4b2370f2891bccd4cdE30c"`);
|
|
33
|
+
});
|
|
34
|
+
it("should not cache account if different inputs provided", async () => {
|
|
35
|
+
const account = await client.requestAccount();
|
|
36
|
+
const account2 = await client.requestAccount({
|
|
37
|
+
id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
|
|
38
|
+
creationHint: { salt: "0x1" },
|
|
39
|
+
});
|
|
40
|
+
expect(account.address).not.toEqual(account2.address);
|
|
41
|
+
});
|
|
27
42
|
it("should successfully get a counterfactual address", async () => {
|
|
28
43
|
const account = await client.requestAccount();
|
|
29
44
|
expect(account.address).toMatchInlineSnapshot(`"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58"`);
|
|
@@ -31,14 +46,10 @@ describe("Client E2E Tests", () => {
|
|
|
31
46
|
it("can correctly sign a message", async () => {
|
|
32
47
|
const account = await client.requestAccount();
|
|
33
48
|
const message = "hello world";
|
|
34
|
-
const signature = await client.signMessage(message);
|
|
35
|
-
const publicClient = createPublicClient({
|
|
36
|
-
chain: arbitrumSepolia,
|
|
37
|
-
transport,
|
|
38
|
-
});
|
|
49
|
+
const signature = await client.signMessage({ message });
|
|
39
50
|
const isValid = await publicClient.verifyMessage({
|
|
40
51
|
address: account.address,
|
|
41
|
-
message
|
|
52
|
+
message,
|
|
42
53
|
signature,
|
|
43
54
|
});
|
|
44
55
|
expect(isValid).toBeTrue();
|
|
@@ -53,6 +64,39 @@ describe("Client E2E Tests", () => {
|
|
|
53
64
|
});
|
|
54
65
|
expect(isValid).toBeTrue();
|
|
55
66
|
});
|
|
67
|
+
it("can correctly sign a message with a different account", async () => {
|
|
68
|
+
const account = await client.requestAccount({
|
|
69
|
+
id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
|
|
70
|
+
creationHint: { salt: "0x1" },
|
|
71
|
+
});
|
|
72
|
+
const message = "hello world";
|
|
73
|
+
const signature = await client.signMessage({
|
|
74
|
+
message,
|
|
75
|
+
account: account.address,
|
|
76
|
+
});
|
|
77
|
+
const isValid = await publicClient.verifyMessage({
|
|
78
|
+
address: account.address,
|
|
79
|
+
message,
|
|
80
|
+
signature,
|
|
81
|
+
});
|
|
82
|
+
expect(isValid).toBeTrue();
|
|
83
|
+
});
|
|
84
|
+
it("can correctly sign typed data with a different account", async () => {
|
|
85
|
+
const account = await client.requestAccount({
|
|
86
|
+
id: "2d00c64e-2e55-4925-832e-e288dbf1139e",
|
|
87
|
+
creationHint: { salt: "0x1" },
|
|
88
|
+
});
|
|
89
|
+
const signature = await client.signTypedData({
|
|
90
|
+
...givenTypedData,
|
|
91
|
+
account: account.address,
|
|
92
|
+
});
|
|
93
|
+
const isValid = await publicClient.verifyTypedData({
|
|
94
|
+
...givenTypedData,
|
|
95
|
+
signature,
|
|
96
|
+
address: account.address,
|
|
97
|
+
});
|
|
98
|
+
expect(isValid).toBeTrue();
|
|
99
|
+
});
|
|
56
100
|
it("should successfully send a UO with paymaster", async () => {
|
|
57
101
|
const account = await client.requestAccount();
|
|
58
102
|
const preparedUO = await client.prepareCalls({
|
|
@@ -126,14 +170,25 @@ describe("Client E2E Tests", () => {
|
|
|
126
170
|
const account = await client.requestAccount();
|
|
127
171
|
expect(account.address).toMatchInlineSnapshot(`"0x65b5DE0251f553B2208762a4724303E750294D96"`);
|
|
128
172
|
});
|
|
173
|
+
it("should successfully request account with different salt", async () => {
|
|
174
|
+
const account = await client.requestAccount({
|
|
175
|
+
id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
|
|
176
|
+
creationHint: { salt: "0x1" },
|
|
177
|
+
});
|
|
178
|
+
expect(account.address).toMatchInlineSnapshot(`"0xC9B8271E44f14be83CecfDE1dDb325e9fa15e9Ff"`);
|
|
179
|
+
});
|
|
180
|
+
it("should not cache account if different inputs provided", async () => {
|
|
181
|
+
const account = await client.requestAccount();
|
|
182
|
+
const account2 = await client.requestAccount({
|
|
183
|
+
id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
|
|
184
|
+
creationHint: { salt: "0x1" },
|
|
185
|
+
});
|
|
186
|
+
expect(account.address).not.toEqual(account2.address);
|
|
187
|
+
});
|
|
129
188
|
it("can correctly sign a message", async () => {
|
|
130
189
|
const account = await client.requestAccount();
|
|
131
190
|
const message = "hello world";
|
|
132
|
-
const signature = await client.signMessage(message);
|
|
133
|
-
const publicClient = createPublicClient({
|
|
134
|
-
chain: arbitrumSepolia,
|
|
135
|
-
transport,
|
|
136
|
-
});
|
|
191
|
+
const signature = await client.signMessage({ message });
|
|
137
192
|
const isValid = await publicClient.verifyMessage({
|
|
138
193
|
address: account.address,
|
|
139
194
|
message: "hello world",
|
|
@@ -151,6 +206,39 @@ describe("Client E2E Tests", () => {
|
|
|
151
206
|
});
|
|
152
207
|
expect(isValid).toBeTrue();
|
|
153
208
|
});
|
|
209
|
+
it("can correctly sign a message with a different account", async () => {
|
|
210
|
+
const account = await client.requestAccount({
|
|
211
|
+
id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
|
|
212
|
+
creationHint: { salt: "0x1" },
|
|
213
|
+
});
|
|
214
|
+
const message = "hello world";
|
|
215
|
+
const signature = await client.signMessage({
|
|
216
|
+
message,
|
|
217
|
+
account: account.address,
|
|
218
|
+
});
|
|
219
|
+
const isValid = await publicClient.verifyMessage({
|
|
220
|
+
address: account.address,
|
|
221
|
+
message: "hello world",
|
|
222
|
+
signature,
|
|
223
|
+
});
|
|
224
|
+
expect(isValid).toBeTrue();
|
|
225
|
+
});
|
|
226
|
+
it("can correctly sign typed data with a different account", async () => {
|
|
227
|
+
const account = await client.requestAccount({
|
|
228
|
+
id: "8670d2d8-2781-49e9-a75c-1eb980271ca9",
|
|
229
|
+
creationHint: { salt: "0x1" },
|
|
230
|
+
});
|
|
231
|
+
const signature = await client.signTypedData({
|
|
232
|
+
...givenTypedData,
|
|
233
|
+
account: account.address,
|
|
234
|
+
});
|
|
235
|
+
const isValid = await publicClient.verifyTypedData({
|
|
236
|
+
...givenTypedData,
|
|
237
|
+
signature,
|
|
238
|
+
address: account.address,
|
|
239
|
+
});
|
|
240
|
+
expect(isValid).toBeTrue();
|
|
241
|
+
});
|
|
154
242
|
it("should successfully send a UO with paymaster", async () => {
|
|
155
243
|
const account = await client.requestAccount();
|
|
156
244
|
const preparedUO = await client.prepareCalls({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;SAC1C;QACH,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAqB;SAC1C,CACN,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,MAAM,GAAG,kBAAkB,CAAC,yBAAyB,CACzD,oEAAoE,CACrE,CAAC;QAEF,MAAM,MAAM,GAAG,uBAAuB,CAAC;YACrC,SAAS;YACT,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,OAAO;YACb,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,kBAAkB,CAAC;YACtC,KAAK,EAAE,eAAe;YACtB,S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ACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest.js\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n if (preparedUO.signatureRequest.type !== \"personal_sign\") {\n throw new Error(\"Invalid signature request type\");\n }\n\n const signature = await signer.signMessage(\n preparedUO.signatureRequest.data,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature: {\n type: \"ecdsa\",\n signature,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
|
|
1
|
+
{"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;SAC1C;QACH,CAAC,C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AE,MAAe;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,CAAC;YACV,iBAAiB,EACf,4CAAuD;SAC1D;QACD,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest.js\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0x569bCECaC47Ef9706c4b2370f2891bccd4cdE30c\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n const message = \"hello world\";\n\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message,\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"2d00c64e-2e55-4925-832e-e288dbf1139e\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n if (preparedUO.signatureRequest.type !== \"personal_sign\") {\n throw new Error(\"Invalid signature request type\");\n }\n\n const signature = await signer.signMessage(\n preparedUO.signatureRequest.data,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature: {\n type: \"ecdsa\",\n signature,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"should successfully request account with different salt\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).toMatchInlineSnapshot(\n `\"0xC9B8271E44f14be83CecfDE1dDb325e9fa15e9Ff\"`,\n );\n });\n\n it(\"should not cache account if different inputs provided\", async () => {\n const account = await client.requestAccount();\n const account2 = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n expect(account.address).not.toEqual(account2.address);\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage({ message });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign a message with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n const message = \"hello world\";\n const signature = await client.signMessage({\n message,\n account: account.address,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data with a different account\", async () => {\n const account = await client.requestAccount({\n id: \"8670d2d8-2781-49e9-a75c-1eb980271ca9\",\n creationHint: { salt: \"0x1\" },\n });\n\n const signature = await client.signTypedData({\n ...givenTypedData,\n account: account.address,\n });\n\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import type { Hex, JsonRpcAccount
|
|
3
|
-
import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls";
|
|
4
|
-
import type { InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { Hex, JsonRpcAccount } from "viem";
|
|
3
|
+
import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls.ts";
|
|
4
|
+
import type { InnerWalletApiClient } from "../types.ts";
|
|
5
5
|
import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount.js";
|
|
6
6
|
import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
|
|
7
7
|
import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
|
|
8
8
|
import { type ListAccountsParams, type ListAccountsResult } from "./actions/listAccounts.js";
|
|
9
9
|
import { type PrepareCallsParams, type PrepareCallsResult } from "./actions/prepareCalls.js";
|
|
10
10
|
import { type RequestAccountParams, type RequestAccountResult } from "./actions/requestAccount.js";
|
|
11
|
+
import { type SignMessageParams } from "./actions/signMessage.js";
|
|
11
12
|
import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
|
|
13
|
+
import { type SignTypedDataParams } from "./actions/signTypedData.js";
|
|
12
14
|
export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined> = {
|
|
13
15
|
requestAccount: (params?: RequestAccountParams<TAccount>) => Promise<RequestAccountResult>;
|
|
14
16
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
@@ -17,8 +19,8 @@ export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = Jso
|
|
|
17
19
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
18
20
|
getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
|
|
19
21
|
signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
|
|
20
|
-
signMessage: (params:
|
|
21
|
-
signTypedData: (params:
|
|
22
|
+
signMessage: (params: SignMessageParams) => Promise<Hex>;
|
|
23
|
+
signTypedData: (params: SignTypedDataParams) => Promise<Hex>;
|
|
22
24
|
grantPermissions: (params: GrantPermissionsParams<TAccount>) => Promise<GrantPermissionsResult>;
|
|
23
25
|
};
|
|
24
26
|
export declare function smartWalletClientActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
|
|
@@ -7,7 +7,7 @@ import { requestAccount, } from "./actions/requestAccount.js";
|
|
|
7
7
|
import { sendPreparedCalls } from "./actions/sendPreparedCalls.js";
|
|
8
8
|
import { signMessage } from "./actions/signMessage.js";
|
|
9
9
|
import { signSignatureRequest, } from "./actions/signSignatureRequest.js";
|
|
10
|
-
import { signTypedData } from "./actions/signTypedData.js";
|
|
10
|
+
import { signTypedData, } from "./actions/signTypedData.js";
|
|
11
11
|
export function smartWalletClientActions(client, signer) {
|
|
12
12
|
return {
|
|
13
13
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM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{ Hex, JsonRpcAccount } from \"viem\";\nimport type {\n SendPreparedCallsParams,\n SendPreparedCallsResult,\n} from \"../isomorphic/actions/sendPreparedCalls.ts\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport { sendPreparedCalls } from \"./actions/sendPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\n\nexport type SmartWalletActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams<TAccount>,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount>;\n\nexport function smartWalletClientActions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n createAccount: (params) => createAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type { InnerWalletApiClient } from "../types";
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import type { Address, Chain, IsUndefined, JsonRpcAccount, Prettify } from "viem";
|
|
3
|
+
import type { InnerWalletApiClient } from "../types.ts";
|
|
5
4
|
import { type SmartWalletActions } from "./decorator.js";
|
|
5
|
+
import type { AlchemyTransport } from "@account-kit/infra";
|
|
6
6
|
export type SmartWalletClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Prettify<{
|
|
7
7
|
transport: AlchemyTransport;
|
|
8
8
|
chain: Chain;
|
package/dist/esm/client/index.js
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import {} from "@aa-sdk/core";
|
|
2
|
-
import {} from "@account-kit/infra";
|
|
3
|
-
import {} from "viem";
|
|
4
1
|
import { createLocalClient } from "../local/client.js";
|
|
5
2
|
import { createRemoteClient } from "../remote/client.js";
|
|
6
3
|
import { smartWalletClientActions, } from "./decorator.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a smart wallet client that can be used to interact with a smart account.
|
|
6
|
+
*
|
|
7
|
+
* @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client
|
|
8
|
+
* @param {AlchemyTransport} params.transport - The Alchemy transport to use
|
|
9
|
+
* @param {Chain} params.chain - The chain to use
|
|
10
|
+
* @param {SmartAccountSigner} params.signer - The signer to use for the smart account
|
|
11
|
+
* @param {"local" | "remote"} params.mode - The client's mode (local or remote).
|
|
12
|
+
* @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
|
|
13
|
+
* @param {Address} [params.account] - The smart account address to use (optional)
|
|
14
|
+
* @returns {InnerWalletApiClient & SmartWalletActions} - A viem-compatible client
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
18
|
+
* import { alchemy, arbitrumSepolia } from "@account-kit/infra";
|
|
19
|
+
* import { generatePrivateKey } from "viem/accounts";
|
|
20
|
+
* import { createSmartWalletClient } from "@account-kit/wallet-apis"; // TODO(jh): update this if we change the pkg name to `@account-kit/wallet-client`
|
|
21
|
+
*
|
|
22
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());
|
|
23
|
+
* const transport = alchemy({
|
|
24
|
+
* apiKey: "your-alchemy-api-key",
|
|
25
|
+
* });
|
|
26
|
+
* const client = createSmartWalletClient({
|
|
27
|
+
* transport,
|
|
28
|
+
* chain: arbitrumSepolia,
|
|
29
|
+
* mode: "remote",
|
|
30
|
+
* signer,
|
|
31
|
+
* });
|
|
32
|
+
*/
|
|
7
33
|
export function createSmartWalletClient(params) {
|
|
8
34
|
const { transport, chain, policyId, mode, account, signer } = params;
|
|
9
35
|
const innerClient = mode === "local"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAqCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,WAAW,GACf,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,kBAAkB,CAAC;YACjB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IAET,yCAAyC;IACzC,qDAAqD;IACrD,4JAA4J;IAC5J,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type {\n Address,\n Chain,\n IsUndefined,\n JsonRpcAccount,\n Prettify,\n} from \"viem\";\nimport { createLocalClient } from \"../local/client.js\";\nimport { createRemoteClient } from \"../remote/client.js\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\n\nexport type SmartWalletClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Prettify<\n {\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartAccountSigner;\n mode: \"local\" | \"remote\";\n policyId?: string;\n } & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n })\n>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n params: SmartWalletClientParams<TAccount>,\n): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> = JsonRpcAccount<Address>,\n>(\n params: SmartWalletClientParams<TAccount>,\n): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;\n\n/**\n * Creates a smart wallet client that can be used to interact with a smart account.\n *\n * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client\n * @param {AlchemyTransport} params.transport - The Alchemy transport to use\n * @param {Chain} params.chain - The chain to use\n * @param {SmartAccountSigner} params.signer - The signer to use for the smart account\n * @param {\"local\" | \"remote\"} params.mode - The client's mode (local or remote).\n * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)\n * @param {Address} [params.account] - The smart account address to use (optional)\n * @returns {InnerWalletApiClient & SmartWalletActions} - A viem-compatible client\n *\n * @example\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\n * import { generatePrivateKey } from \"viem/accounts\";\n * import { createSmartWalletClient } from \"@account-kit/wallet-apis\"; // TODO(jh): update this if we change the pkg name to `@account-kit/wallet-client`\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const transport = alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * });\n * const client = createSmartWalletClient({\n * transport,\n * chain: arbitrumSepolia,\n * mode: \"remote\",\n * signer,\n * });\n */\nexport function createSmartWalletClient(\n params: SmartWalletClientParams,\n): InnerWalletApiClient & SmartWalletActions {\n const { transport, chain, policyId, mode, account, signer } = params;\n\n const innerClient =\n mode === \"local\"\n ? createLocalClient({\n transport,\n chain,\n policyId,\n account,\n })\n : createRemoteClient({\n transport,\n chain,\n policyId,\n account,\n });\n\n // TODO: we need to do a few things here:\n // 1. decorate the client with the wallet api actions\n // 2. potentially we might want to make this client async and have it use `requestAccount` so that it can create a SCA client with an account attached to it\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
|
|
@@ -11,3 +11,4 @@ export { requestAccount } from "../client/actions/requestAccount.js";
|
|
|
11
11
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
12
12
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
13
13
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
14
|
+
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
@@ -15,4 +15,5 @@ export { requestAccount } from "../client/actions/requestAccount.js";
|
|
|
15
15
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
16
16
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
17
17
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
18
|
+
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAGtB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories\n// and we shouldn't export * for the sake of tree-shaking\nexport {\n createSmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n type WalletServerViemRpcSchema,\n} from \"../rpc/schema.js\";\n\n// capabilities: TODO: should these actually just have the types exported?\nexport { Capabilities } from \"../capabilities/index.js\";\nexport { PaymasterCapability } from \"../capabilities/paymaster.js\";\nexport {\n PermissionsArray,\n PermissionsCapability,\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions/index.js\";\n\n// client actions\nexport { createAccount } from \"../client/actions/createAccount.js\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAGtB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC","sourcesContent":["// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories\n// and we shouldn't export * for the sake of tree-shaking\nexport {\n createSmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n type WalletServerViemRpcSchema,\n} from \"../rpc/schema.js\";\n\n// capabilities: TODO: should these actually just have the types exported?\nexport { Capabilities } from \"../capabilities/index.js\";\nexport { PaymasterCapability } from \"../capabilities/paymaster.js\";\nexport {\n PermissionsArray,\n PermissionsCapability,\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions/index.js\";\n\n// client actions\nexport { createAccount } from \"../client/actions/createAccount.js\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\nexport { grantPermissions } from \"../client/actions/grantPermissions.js\";\n"]}
|