@account-kit/wallet-client 4.53.3-alpha.2 → 4.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/actions/sendCalls.d.ts +36 -0
- package/dist/esm/client/actions/sendCalls.js +47 -0
- package/dist/esm/client/actions/sendCalls.js.map +1 -0
- package/dist/esm/client/actions/waitForCallsStatus.d.ts +29 -0
- package/dist/esm/client/actions/waitForCallsStatus.js +22 -0
- package/dist/esm/client/actions/waitForCallsStatus.js.map +1 -0
- package/dist/esm/client/decorator.d.ts +4 -0
- package/dist/esm/client/decorator.js +5 -0
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/exports/index.d.ts +2 -0
- package/dist/esm/exports/index.js +2 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/metrics.d.ts +6 -0
- package/dist/esm/metrics.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/sendCalls.d.ts +37 -0
- package/dist/types/client/actions/sendCalls.d.ts.map +1 -0
- package/dist/types/client/actions/waitForCallsStatus.d.ts +30 -0
- package/dist/types/client/actions/waitForCallsStatus.d.ts.map +1 -0
- package/dist/types/client/decorator.d.ts +4 -0
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +2 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/metrics.d.ts +6 -0
- package/dist/types/metrics.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 +6 -6
- package/src/client/actions/sendCalls.ts +68 -0
- package/src/client/actions/waitForCallsStatus.ts +28 -0
- package/src/client/decorator.ts +16 -0
- package/src/exports/index.ts +2 -0
- package/src/metrics.ts +6 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
|
+
import { type PrepareCallsParams } from "./prepareCalls.js";
|
|
4
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
5
|
+
import { type SendPreparedCallsResult } from "./sendPreparedCalls.js";
|
|
6
|
+
export type SendCallsParams<TAccount extends Address | undefined = Address | undefined> = PrepareCallsParams<TAccount>;
|
|
7
|
+
export type SendCallsResult = SendPreparedCallsResult;
|
|
8
|
+
/**
|
|
9
|
+
* Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
|
|
10
|
+
*
|
|
11
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
12
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
13
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
14
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
15
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
16
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request.
|
|
17
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const result = await client.sendCalls({
|
|
22
|
+
* calls: [{
|
|
23
|
+
* to: "0x1234...",
|
|
24
|
+
* data: "0xabcdef...",
|
|
25
|
+
* value: "0x0"
|
|
26
|
+
* }],
|
|
27
|
+
* capabilities: {
|
|
28
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // The result contains the prepared call IDs
|
|
33
|
+
* console.log(result.preparedCallIds);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner, params: SendCallsParams<TAccount>): Promise<SendCallsResult>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { prepareCalls } from "./prepareCalls.js";
|
|
2
|
+
import { metrics } from "../../metrics.js";
|
|
3
|
+
import { signPreparedCalls } from "./signPreparedCalls.js";
|
|
4
|
+
import { sendPreparedCalls, } from "./sendPreparedCalls.js";
|
|
5
|
+
/**
|
|
6
|
+
* Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
|
|
7
|
+
*
|
|
8
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
9
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
10
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
11
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
12
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
13
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request.
|
|
14
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const result = await client.sendCalls({
|
|
19
|
+
* calls: [{
|
|
20
|
+
* to: "0x1234...",
|
|
21
|
+
* data: "0xabcdef...",
|
|
22
|
+
* value: "0x0"
|
|
23
|
+
* }],
|
|
24
|
+
* capabilities: {
|
|
25
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // The result contains the prepared call IDs
|
|
30
|
+
* console.log(result.preparedCallIds);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export async function sendCalls(client, signer, params) {
|
|
34
|
+
metrics.trackEvent({
|
|
35
|
+
name: "send_calls",
|
|
36
|
+
});
|
|
37
|
+
const calls = await prepareCalls(client, params);
|
|
38
|
+
const signedCalls = await signPreparedCalls(signer, calls);
|
|
39
|
+
return await sendPreparedCalls(client, {
|
|
40
|
+
...signedCalls,
|
|
41
|
+
// The only capability that is supported in sendPreparedCalls is permissions.
|
|
42
|
+
...(params.capabilities?.permissions != null
|
|
43
|
+
? { capabilities: { permissions: params.capabilities.permissions } }
|
|
44
|
+
: {}),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=sendCalls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/sendCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAQhC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAG7B,MAA4B,EAC5B,MAA0B,EAC1B,MAAiC;IAEjC,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,YAAY;KACnB,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjD,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,MAAM,iBAAiB,CAAC,MAAM,EAAE;QACrC,GAAG,WAAW;QACd,6EAA6E;QAC7E,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,IAAI,IAAI;YAC1C,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE;YACpE,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Address } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.js\";\nimport { prepareCalls, type PrepareCallsParams } from \"./prepareCalls.js\";\nimport { metrics } from \"../../metrics.js\";\nimport { signPreparedCalls } from \"./signPreparedCalls.js\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsResult,\n} from \"./sendPreparedCalls.js\";\n\nexport type SendCallsParams<\n TAccount extends Address | undefined = Address | undefined,\n> = PrepareCallsParams<TAccount>;\n\nexport type SendCallsResult = SendPreparedCallsResult;\n\n/**\n * Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer to use\n * @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls\n * @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute\n * @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)\n * @param {object} [params.capabilities] - Optional capabilities to include with the request.\n * @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs.\n *\n * @example\n * ```ts\n * const result = await client.sendCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n *\n * // The result contains the prepared call IDs\n * console.log(result.preparedCallIds);\n * ```\n */\nexport async function sendCalls<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SendCallsParams<TAccount>,\n): Promise<SendCallsResult> {\n metrics.trackEvent({\n name: \"send_calls\",\n });\n\n const calls = await prepareCalls(client, params);\n\n const signedCalls = await signPreparedCalls(signer, calls);\n\n return await sendPreparedCalls(client, {\n ...signedCalls,\n // The only capability that is supported in sendPreparedCalls is permissions.\n ...(params.capabilities?.permissions != null\n ? { capabilities: { permissions: params.capabilities.permissions } }\n : {}),\n });\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { WaitForCallsStatusParameters } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Waits for the status of a prepared call to be updated, returning after the calls are no longer pending.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
7
|
+
* @param {WaitForCallsStatusParameters} params - Parameters for waiting for calls status, including the call ID and options for polling.
|
|
8
|
+
* @returns {Promise<WaitForCallsStatusResult>} A Promise that resolves to the result containing the prepared call status, which includes a transaction receipt after the call is executed.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await client.waitForCallsStatus({ id: "0x1234..." });
|
|
13
|
+
* console.log(result);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitForCallsStatus(client: InnerWalletApiClient, params: WaitForCallsStatusParameters): Promise<{
|
|
17
|
+
version: string;
|
|
18
|
+
id: string;
|
|
19
|
+
chainId: number;
|
|
20
|
+
atomic: boolean;
|
|
21
|
+
receipts?: import("viem").WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
|
|
22
|
+
capabilities?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
} | undefined;
|
|
27
|
+
statusCode: number;
|
|
28
|
+
status: "pending" | "success" | "failure" | undefined;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { waitForCallsStatus as viemWaitForCallsStatus } from "viem/actions";
|
|
2
|
+
import { metrics } from "../../metrics.js";
|
|
3
|
+
/**
|
|
4
|
+
* Waits for the status of a prepared call to be updated, returning after the calls are no longer pending.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
7
|
+
* @param {WaitForCallsStatusParameters} params - Parameters for waiting for calls status, including the call ID and options for polling.
|
|
8
|
+
* @returns {Promise<WaitForCallsStatusResult>} A Promise that resolves to the result containing the prepared call status, which includes a transaction receipt after the call is executed.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await client.waitForCallsStatus({ id: "0x1234..." });
|
|
13
|
+
* console.log(result);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export async function waitForCallsStatus(client, params) {
|
|
17
|
+
metrics.trackEvent({
|
|
18
|
+
name: "wait_for_calls_status",
|
|
19
|
+
});
|
|
20
|
+
return viemWaitForCallsStatus(client, params);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=waitForCallsStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitForCallsStatus.js","sourceRoot":"","sources":["../../../../src/client/actions/waitForCallsStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAA4B,EAC5B,MAAoC;IAEpC,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,uBAAuB;KAC9B,CAAC,CAAC;IAEH,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import type { WaitForCallsStatusParameters } from \"viem\";\nimport { waitForCallsStatus as viemWaitForCallsStatus } from \"viem/actions\";\nimport type { InnerWalletApiClient } from \"../../types.js\";\nimport { metrics } from \"../../metrics.js\";\n\n/**\n * Waits for the status of a prepared call to be updated, returning after the calls are no longer pending.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {WaitForCallsStatusParameters} params - Parameters for waiting for calls status, including the call ID and options for polling.\n * @returns {Promise<WaitForCallsStatusResult>} A Promise that resolves to the result containing the prepared call status, which includes a transaction receipt after the call is executed.\n *\n * @example\n * ```ts\n * const result = await client.waitForCallsStatus({ id: \"0x1234...\" });\n * console.log(result);\n * ```\n */\nexport async function waitForCallsStatus(\n client: InnerWalletApiClient,\n params: WaitForCallsStatusParameters,\n) {\n metrics.trackEvent({\n name: \"wait_for_calls_status\",\n });\n\n return viemWaitForCallsStatus(client, params);\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
+
import { type WaitForCallsStatusParameters, type WaitForCallsStatusReturnType } from "viem/actions";
|
|
3
4
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
4
5
|
import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
|
|
5
6
|
import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
|
|
@@ -11,12 +12,15 @@ import { type SignMessageParams } from "./actions/signMessage.js";
|
|
|
11
12
|
import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
|
|
12
13
|
import { type SignTypedDataParams } from "./actions/signTypedData.js";
|
|
13
14
|
import { type SignPreparedCallsParams, type SignPreparedCallsResult } from "./actions/signPreparedCalls.js";
|
|
15
|
+
import { type SendCallsParams, type SendCallsResult } from "./actions/sendCalls.js";
|
|
14
16
|
export type SmartWalletActions<TAccount extends Address | undefined = Address | undefined> = {
|
|
15
17
|
requestAccount: (params?: RequestAccountParams) => Promise<RequestAccountResult>;
|
|
16
18
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
17
19
|
sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<SendPreparedCallsResult>;
|
|
20
|
+
sendCalls: (params: SendCallsParams<TAccount>) => Promise<SendCallsResult>;
|
|
18
21
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
19
22
|
getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
|
|
23
|
+
waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>;
|
|
20
24
|
signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
|
|
21
25
|
signPreparedCalls: (params: SignPreparedCallsParams) => Promise<SignPreparedCallsResult>;
|
|
22
26
|
signMessage: (params: SignMessageParams) => Promise<Hex>;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
import {} from "viem/actions";
|
|
1
2
|
import { getCallsStatus, } from "./actions/getCallsStatus.js";
|
|
2
3
|
import { grantPermissions, } from "./actions/grantPermissions.js";
|
|
3
4
|
import { listAccounts, } from "./actions/listAccounts.js";
|
|
4
5
|
import { prepareCalls, } from "./actions/prepareCalls.js";
|
|
5
6
|
import { requestAccount, } from "./actions/requestAccount.js";
|
|
6
7
|
import { sendPreparedCalls, } from "./actions/sendPreparedCalls.js";
|
|
8
|
+
import { waitForCallsStatus } from "./actions/waitForCallsStatus.js";
|
|
7
9
|
import { signMessage } from "./actions/signMessage.js";
|
|
8
10
|
import { signSignatureRequest, } from "./actions/signSignatureRequest.js";
|
|
9
11
|
import { signTypedData, } from "./actions/signTypedData.js";
|
|
10
12
|
import { signPreparedCalls, } from "./actions/signPreparedCalls.js";
|
|
13
|
+
import { sendCalls, } from "./actions/sendCalls.js";
|
|
11
14
|
export function smartWalletClientActions(client, signer) {
|
|
12
15
|
return {
|
|
13
16
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
14
17
|
prepareCalls: (params) => prepareCalls(client, params),
|
|
15
18
|
listAccounts: (params) => listAccounts(client, signer, params),
|
|
16
19
|
sendPreparedCalls: (params) => sendPreparedCalls(client, params),
|
|
20
|
+
sendCalls: (params) => sendCalls(client, signer, params),
|
|
17
21
|
getCallsStatus: (params) => getCallsStatus(client, params),
|
|
22
|
+
waitForCallsStatus: (params) => waitForCallsStatus(client, params),
|
|
18
23
|
signSignatureRequest: (params) => signSignatureRequest(signer, params),
|
|
19
24
|
signPreparedCalls: (params) => signPreparedCalls(signer, params),
|
|
20
25
|
signMessage: (params) => signMessage(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":"AAEA,OAAO,EAGN,MAAM,cAAc,CAAC;AAEtB,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,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,GAGrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,SAAS,GAGV,MAAM,wBAAwB,CAAC;AAmChC,MAAM,UAAU,wBAAwB,CAGtC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO;QACL,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAClE,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC9D,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACxD,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1D,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC;QAClE,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;QACtE,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Address, Hex } from \"viem\";\nimport {\n type WaitForCallsStatusParameters,\n type WaitForCallsStatusReturnType,\n} from \"viem/actions\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\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 {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"./actions/sendPreparedCalls.js\";\nimport { waitForCallsStatus } from \"./actions/waitForCallsStatus.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\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"./actions/signPreparedCalls.js\";\nimport {\n sendCalls,\n type SendCallsParams,\n type SendCallsResult,\n} from \"./actions/sendCalls.js\";\n\nexport type SmartWalletActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n sendCalls: (params: SendCallsParams<TAccount>) => Promise<SendCallsResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n waitForCallsStatus: (\n params: WaitForCallsStatusParameters,\n ) => Promise<WaitForCallsStatusReturnType>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signPreparedCalls: (\n params: SignPreparedCallsParams,\n ) => Promise<SignPreparedCallsResult>;\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 Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount> {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, signer, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n sendCalls: (params) => sendCalls(client, signer, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n waitForCallsStatus: (params) => waitForCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signPreparedCalls: (params) => signPreparedCalls(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"]}
|
|
@@ -10,5 +10,7 @@ export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
|
10
10
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
11
11
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
12
12
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
13
|
+
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
14
|
+
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
13
15
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
14
16
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
@@ -13,6 +13,8 @@ export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
|
13
13
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
14
14
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
15
15
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
16
|
+
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
17
|
+
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
16
18
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
17
19
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
18
20
|
//# 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,GAGxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAEtB,MAAM,+BAA+B,CAAC;AAEvC,iBAAiB;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,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,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,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 SmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n} from \"@alchemy/wallet-api-types/rpc\";\n\n// client actions\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { grantPermissions } from \"../client/actions/grantPermissions.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signPreparedCalls } from \"../client/actions/signPreparedCalls.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\nexport { sendPreparedCalls } from \"../client/actions/sendPreparedCalls.js\";\nexport { prepareSign } from \"../client/actions/prepareSign.js\";\nexport { formatSign } from \"../client/actions/formatSign.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAEtB,MAAM,+BAA+B,CAAC;AAEvC,iBAAiB;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,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,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,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 SmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n} from \"@alchemy/wallet-api-types/rpc\";\n\n// client actions\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { grantPermissions } from \"../client/actions/grantPermissions.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signPreparedCalls } from \"../client/actions/signPreparedCalls.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\nexport { sendPreparedCalls } from \"../client/actions/sendPreparedCalls.js\";\nexport { sendCalls } from \"../client/actions/sendCalls.js\";\nexport { waitForCallsStatus } from \"../client/actions/waitForCallsStatus.js\";\nexport { prepareSign } from \"../client/actions/prepareSign.js\";\nexport { formatSign } from \"../client/actions/formatSign.js\";\n"]}
|
package/dist/esm/metrics.d.ts
CHANGED
package/dist/esm/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAkE/D,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAmB;IACpD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC","sourcesContent":["import { createLogger } from \"@account-kit/logging\";\nimport { VERSION } from \"./version.js\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport { SerializedInitcode } from \"@alchemy/wallet-api-types\";\n\nexport type CoreEventsSchema = [\n {\n EventName: \"client_created\";\n EventData: {\n chainId: number;\n };\n },\n {\n EventName: \"account_initialized\";\n EventData: {\n chainId: number;\n factory: StaticDecode<typeof SerializedInitcode>[\"factoryType\"] | \"7702\";\n };\n },\n {\n EventName: \"list_accounts\";\n },\n {\n EventName: \"prepare_sign\";\n },\n {\n EventName: \"format_sign\";\n },\n {\n EventName: \"get_calls_status\";\n },\n {\n EventName: \"grant_permissions\";\n },\n {\n EventName: \"prepare_calls\";\n },\n {\n EventName: \"send_prepared_calls\";\n EventData: {\n type: string;\n };\n },\n {\n EventName: \"send_calls\";\n },\n {\n EventName: \"wait_for_calls_status\";\n },\n {\n EventName: \"sign_message\";\n },\n {\n EventName: \"sign_typed_data\";\n },\n {\n EventName: \"sign_prepared_calls\";\n EventData: {\n type: string;\n };\n },\n {\n EventName: \"sign_signature_request\";\n EventData: {\n type: string;\n };\n },\n];\n\nexport const metrics = createLogger<CoreEventsSchema>({\n package: \"@account-kit/wallet-client\",\n version: VERSION,\n});\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.54.1";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.54.1\";\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
|
+
import { type PrepareCallsParams } from "./prepareCalls.js";
|
|
4
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
5
|
+
import { type SendPreparedCallsResult } from "./sendPreparedCalls.js";
|
|
6
|
+
export type SendCallsParams<TAccount extends Address | undefined = Address | undefined> = PrepareCallsParams<TAccount>;
|
|
7
|
+
export type SendCallsResult = SendPreparedCallsResult;
|
|
8
|
+
/**
|
|
9
|
+
* Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
|
|
10
|
+
*
|
|
11
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
12
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
13
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
14
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
15
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
16
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request.
|
|
17
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const result = await client.sendCalls({
|
|
22
|
+
* calls: [{
|
|
23
|
+
* to: "0x1234...",
|
|
24
|
+
* data: "0xabcdef...",
|
|
25
|
+
* value: "0x0"
|
|
26
|
+
* }],
|
|
27
|
+
* capabilities: {
|
|
28
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // The result contains the prepared call IDs
|
|
33
|
+
* console.log(result.preparedCallIds);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner, params: SendCallsParams<TAccount>): Promise<SendCallsResult>;
|
|
37
|
+
//# sourceMappingURL=sendCalls.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CAgB1B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WaitForCallsStatusParameters } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Waits for the status of a prepared call to be updated, returning after the calls are no longer pending.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
7
|
+
* @param {WaitForCallsStatusParameters} params - Parameters for waiting for calls status, including the call ID and options for polling.
|
|
8
|
+
* @returns {Promise<WaitForCallsStatusResult>} A Promise that resolves to the result containing the prepared call status, which includes a transaction receipt after the call is executed.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await client.waitForCallsStatus({ id: "0x1234..." });
|
|
13
|
+
* console.log(result);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitForCallsStatus(client: InnerWalletApiClient, params: WaitForCallsStatusParameters): Promise<{
|
|
17
|
+
version: string;
|
|
18
|
+
id: string;
|
|
19
|
+
chainId: number;
|
|
20
|
+
atomic: boolean;
|
|
21
|
+
receipts?: import("viem").WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
|
|
22
|
+
capabilities?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
} | undefined;
|
|
27
|
+
statusCode: number;
|
|
28
|
+
status: "pending" | "success" | "failure" | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=waitForCallsStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitForCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/waitForCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,MAAM,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,4BAA4B;;;;;;;;;;;;;GAOrC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
+
import { type WaitForCallsStatusParameters, type WaitForCallsStatusReturnType } from "viem/actions";
|
|
3
4
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
4
5
|
import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
|
|
5
6
|
import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
|
|
@@ -11,12 +12,15 @@ import { type SignMessageParams } from "./actions/signMessage.js";
|
|
|
11
12
|
import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
|
|
12
13
|
import { type SignTypedDataParams } from "./actions/signTypedData.js";
|
|
13
14
|
import { type SignPreparedCallsParams, type SignPreparedCallsResult } from "./actions/signPreparedCalls.js";
|
|
15
|
+
import { type SendCallsParams, type SendCallsResult } from "./actions/sendCalls.js";
|
|
14
16
|
export type SmartWalletActions<TAccount extends Address | undefined = Address | undefined> = {
|
|
15
17
|
requestAccount: (params?: RequestAccountParams) => Promise<RequestAccountResult>;
|
|
16
18
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
17
19
|
sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<SendPreparedCallsResult>;
|
|
20
|
+
sendCalls: (params: SendCallsParams<TAccount>) => Promise<SendCallsResult>;
|
|
18
21
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
19
22
|
getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
|
|
23
|
+
waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>;
|
|
20
24
|
signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
|
|
21
25
|
signPreparedCalls: (params: SignPreparedCallsParams) => Promise<SignPreparedCallsResult>;
|
|
22
26
|
signMessage: (params: SignMessageParams) => Promise<Hex>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EAClC,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,CAC5B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD;IACF,cAAc,EAAE,CACd,MAAM,CAAC,EAAE,oBAAoB,KAC1B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnC,YAAY,EAAE,CACZ,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KACjC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjC,iBAAiB,EAAE,CACjB,MAAM,EAAE,uBAAuB,KAC5B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3E,YAAY,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1E,cAAc,EAAE,CACd,MAAM,EAAE,oBAAoB,KACzB,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnC,kBAAkB,EAAE,CAClB,MAAM,EAAE,4BAA4B,KACjC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,oBAAoB,EAAE,CACpB,MAAM,EAAE,0BAA0B,KAC/B,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACzC,iBAAiB,EAAE,CACjB,MAAM,EAAE,uBAAuB,KAC5B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,WAAW,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,aAAa,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7D,gBAAgB,EAAE,CAChB,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,KACrC,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,GACzB,kBAAkB,CAAC,QAAQ,CAAC,CAe9B"}
|
|
@@ -10,6 +10,8 @@ export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
|
10
10
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
11
11
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
12
12
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
13
|
+
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
14
|
+
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
13
15
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
14
16
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,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,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,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,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/types/metrics.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC7B;QACE,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;SAC1E,CAAC;KACH;IACD;QACE,SAAS,EAAE,eAAe,CAAC;KAC5B;IACD;QACE,SAAS,EAAE,cAAc,CAAC;KAC3B;IACD;QACE,SAAS,EAAE,aAAa,CAAC;KAC1B;IACD;QACE,SAAS,EAAE,kBAAkB,CAAC;KAC/B;IACD;QACE,SAAS,EAAE,mBAAmB,CAAC;KAChC;IACD;QACE,SAAS,EAAE,eAAe,CAAC;KAC5B;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;IACD;QACE,SAAS,EAAE,cAAc,CAAC;KAC3B;IACD;QACE,SAAS,EAAE,iBAAiB,CAAC;KAC9B;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;IACD;QACE,SAAS,EAAE,wBAAwB,CAAC;QACpC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;CACF,CAAC;AAEF,eAAO,MAAM,OAAO,8DAGlB,CAAC"}
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC7B;QACE,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;SAC1E,CAAC;KACH;IACD;QACE,SAAS,EAAE,eAAe,CAAC;KAC5B;IACD;QACE,SAAS,EAAE,cAAc,CAAC;KAC3B;IACD;QACE,SAAS,EAAE,aAAa,CAAC;KAC1B;IACD;QACE,SAAS,EAAE,kBAAkB,CAAC;KAC/B;IACD;QACE,SAAS,EAAE,mBAAmB,CAAC;KAChC;IACD;QACE,SAAS,EAAE,eAAe,CAAC;KAC5B;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;IACD;QACE,SAAS,EAAE,YAAY,CAAC;KACzB;IACD;QACE,SAAS,EAAE,uBAAuB,CAAC;KACpC;IACD;QACE,SAAS,EAAE,cAAc,CAAC;KAC3B;IACD;QACE,SAAS,EAAE,iBAAiB,CAAC;KAC9B;IACD;QACE,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;IACD;QACE,SAAS,EAAE,wBAAwB,CAAC;QACpC,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH;CACF,CAAC;AAEF,eAAO,MAAM,OAAO,8DAGlB,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.54.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
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.54.1",
|
|
4
4
|
"description": "Wallet Client for Alchemy Account Kit",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"test:e2e": "bun test ./src/**/*.e2e.test.*"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@aa-sdk/core": "^4.
|
|
44
|
-
"@account-kit/infra": "^4.
|
|
45
|
-
"@account-kit/smart-contracts": "^4.
|
|
43
|
+
"@aa-sdk/core": "^4.54.1",
|
|
44
|
+
"@account-kit/infra": "^4.54.1",
|
|
45
|
+
"@account-kit/smart-contracts": "^4.54.1",
|
|
46
46
|
"@alchemy/wallet-api-types": "0.1.0-alpha.14",
|
|
47
47
|
"deep-equal": "^2.2.3",
|
|
48
48
|
"ox": "^0.6.12"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"bun-types": "^1.2.18"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"viem": "2.29.2"
|
|
58
|
+
"viem": "^2.29.2"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "44a337cbf1375398d92a74ea527fcf4d9bccdde7"
|
|
73
73
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
3
|
+
import { prepareCalls, type PrepareCallsParams } from "./prepareCalls.js";
|
|
4
|
+
import { metrics } from "../../metrics.js";
|
|
5
|
+
import { signPreparedCalls } from "./signPreparedCalls.js";
|
|
6
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
7
|
+
import {
|
|
8
|
+
sendPreparedCalls,
|
|
9
|
+
type SendPreparedCallsResult,
|
|
10
|
+
} from "./sendPreparedCalls.js";
|
|
11
|
+
|
|
12
|
+
export type SendCallsParams<
|
|
13
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
14
|
+
> = PrepareCallsParams<TAccount>;
|
|
15
|
+
|
|
16
|
+
export type SendCallsResult = SendPreparedCallsResult;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
|
|
20
|
+
*
|
|
21
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
22
|
+
* @param {SmartAccountSigner} signer - The signer to use
|
|
23
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for sending calls
|
|
24
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
25
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
26
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request.
|
|
27
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const result = await client.sendCalls({
|
|
32
|
+
* calls: [{
|
|
33
|
+
* to: "0x1234...",
|
|
34
|
+
* data: "0xabcdef...",
|
|
35
|
+
* value: "0x0"
|
|
36
|
+
* }],
|
|
37
|
+
* capabilities: {
|
|
38
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
39
|
+
* }
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // The result contains the prepared call IDs
|
|
43
|
+
* console.log(result.preparedCallIds);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export async function sendCalls<
|
|
47
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
48
|
+
>(
|
|
49
|
+
client: InnerWalletApiClient,
|
|
50
|
+
signer: SmartAccountSigner,
|
|
51
|
+
params: SendCallsParams<TAccount>,
|
|
52
|
+
): Promise<SendCallsResult> {
|
|
53
|
+
metrics.trackEvent({
|
|
54
|
+
name: "send_calls",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const calls = await prepareCalls(client, params);
|
|
58
|
+
|
|
59
|
+
const signedCalls = await signPreparedCalls(signer, calls);
|
|
60
|
+
|
|
61
|
+
return await sendPreparedCalls(client, {
|
|
62
|
+
...signedCalls,
|
|
63
|
+
// The only capability that is supported in sendPreparedCalls is permissions.
|
|
64
|
+
...(params.capabilities?.permissions != null
|
|
65
|
+
? { capabilities: { permissions: params.capabilities.permissions } }
|
|
66
|
+
: {}),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WaitForCallsStatusParameters } from "viem";
|
|
2
|
+
import { waitForCallsStatus as viemWaitForCallsStatus } from "viem/actions";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.js";
|
|
4
|
+
import { metrics } from "../../metrics.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Waits for the status of a prepared call to be updated, returning after the calls are no longer pending.
|
|
8
|
+
*
|
|
9
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
10
|
+
* @param {WaitForCallsStatusParameters} params - Parameters for waiting for calls status, including the call ID and options for polling.
|
|
11
|
+
* @returns {Promise<WaitForCallsStatusResult>} A Promise that resolves to the result containing the prepared call status, which includes a transaction receipt after the call is executed.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const result = await client.waitForCallsStatus({ id: "0x1234..." });
|
|
16
|
+
* console.log(result);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export async function waitForCallsStatus(
|
|
20
|
+
client: InnerWalletApiClient,
|
|
21
|
+
params: WaitForCallsStatusParameters,
|
|
22
|
+
) {
|
|
23
|
+
metrics.trackEvent({
|
|
24
|
+
name: "wait_for_calls_status",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return viemWaitForCallsStatus(client, params);
|
|
28
|
+
}
|
package/src/client/decorator.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
+
import {
|
|
4
|
+
type WaitForCallsStatusParameters,
|
|
5
|
+
type WaitForCallsStatusReturnType,
|
|
6
|
+
} from "viem/actions";
|
|
3
7
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
4
8
|
import {
|
|
5
9
|
getCallsStatus,
|
|
@@ -31,6 +35,7 @@ import {
|
|
|
31
35
|
type SendPreparedCallsParams,
|
|
32
36
|
type SendPreparedCallsResult,
|
|
33
37
|
} from "./actions/sendPreparedCalls.js";
|
|
38
|
+
import { waitForCallsStatus } from "./actions/waitForCallsStatus.js";
|
|
34
39
|
import { signMessage, type SignMessageParams } from "./actions/signMessage.js";
|
|
35
40
|
import {
|
|
36
41
|
signSignatureRequest,
|
|
@@ -46,6 +51,11 @@ import {
|
|
|
46
51
|
type SignPreparedCallsParams,
|
|
47
52
|
type SignPreparedCallsResult,
|
|
48
53
|
} from "./actions/signPreparedCalls.js";
|
|
54
|
+
import {
|
|
55
|
+
sendCalls,
|
|
56
|
+
type SendCallsParams,
|
|
57
|
+
type SendCallsResult,
|
|
58
|
+
} from "./actions/sendCalls.js";
|
|
49
59
|
|
|
50
60
|
export type SmartWalletActions<
|
|
51
61
|
TAccount extends Address | undefined = Address | undefined,
|
|
@@ -59,10 +69,14 @@ export type SmartWalletActions<
|
|
|
59
69
|
sendPreparedCalls: (
|
|
60
70
|
params: SendPreparedCallsParams,
|
|
61
71
|
) => Promise<SendPreparedCallsResult>;
|
|
72
|
+
sendCalls: (params: SendCallsParams<TAccount>) => Promise<SendCallsResult>;
|
|
62
73
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
63
74
|
getCallsStatus: (
|
|
64
75
|
params: GetCallsStatusParams,
|
|
65
76
|
) => Promise<GetCallsStatusResult>;
|
|
77
|
+
waitForCallsStatus: (
|
|
78
|
+
params: WaitForCallsStatusParameters,
|
|
79
|
+
) => Promise<WaitForCallsStatusReturnType>;
|
|
66
80
|
signSignatureRequest: (
|
|
67
81
|
params: SignSignatureRequestParams,
|
|
68
82
|
) => Promise<SignSignatureRequestResult>;
|
|
@@ -87,7 +101,9 @@ export function smartWalletClientActions<
|
|
|
87
101
|
prepareCalls: (params) => prepareCalls(client, params),
|
|
88
102
|
listAccounts: (params) => listAccounts(client, signer, params),
|
|
89
103
|
sendPreparedCalls: (params) => sendPreparedCalls(client, params),
|
|
104
|
+
sendCalls: (params) => sendCalls(client, signer, params),
|
|
90
105
|
getCallsStatus: (params) => getCallsStatus(client, params),
|
|
106
|
+
waitForCallsStatus: (params) => waitForCallsStatus(client, params),
|
|
91
107
|
signSignatureRequest: (params) => signSignatureRequest(signer, params),
|
|
92
108
|
signPreparedCalls: (params) => signPreparedCalls(signer, params),
|
|
93
109
|
signMessage: (params) => signMessage(client, signer, params),
|
package/src/exports/index.ts
CHANGED
|
@@ -22,5 +22,7 @@ export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
|
22
22
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
23
23
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
24
24
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
25
|
+
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
26
|
+
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
25
27
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
26
28
|
export { formatSign } from "../client/actions/formatSign.js";
|
package/src/metrics.ts
CHANGED
package/src/version.ts
CHANGED