@alchemy/wallet-apis 5.0.0-beta.2 → 5.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/actions/signPreparedCalls.d.ts +2 -0
  3. package/dist/esm/actions/signPreparedCalls.js +13 -0
  4. package/dist/esm/actions/signPreparedCalls.js.map +1 -1
  5. package/dist/esm/actions/undelegateAccount.d.ts +40 -0
  6. package/dist/esm/actions/undelegateAccount.js +82 -0
  7. package/dist/esm/actions/undelegateAccount.js.map +1 -0
  8. package/dist/esm/decorators/smartWalletActions.d.ts +2 -0
  9. package/dist/esm/decorators/smartWalletActions.js +2 -0
  10. package/dist/esm/decorators/smartWalletActions.js.map +1 -1
  11. package/dist/esm/exports/index.d.ts +2 -0
  12. package/dist/esm/exports/index.js +1 -0
  13. package/dist/esm/exports/index.js.map +1 -1
  14. package/dist/esm/version.d.ts +1 -1
  15. package/dist/esm/version.js +1 -1
  16. package/dist/esm/version.js.map +1 -1
  17. package/dist/types/actions/signPreparedCalls.d.ts +2 -0
  18. package/dist/types/actions/signPreparedCalls.d.ts.map +1 -1
  19. package/dist/types/actions/undelegateAccount.d.ts +41 -0
  20. package/dist/types/actions/undelegateAccount.d.ts.map +1 -0
  21. package/dist/types/decorators/smartWalletActions.d.ts +2 -0
  22. package/dist/types/decorators/smartWalletActions.d.ts.map +1 -1
  23. package/dist/types/exports/index.d.ts +2 -0
  24. package/dist/types/exports/index.d.ts.map +1 -1
  25. package/dist/types/version.d.ts +1 -1
  26. package/dist/types/version.d.ts.map +1 -1
  27. package/package.json +7 -6
  28. package/src/actions/signPreparedCalls.ts +14 -1
  29. package/src/actions/undelegateAccount.ts +125 -0
  30. package/src/decorators/smartWalletActions.ts +9 -0
  31. package/src/exports/index.ts +2 -0
  32. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ High-level viem-style client for Alchemy's Smart Wallet APIs. Provides EIP-7702
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @alchemy/wallet-apis @alchemy/common viem
8
+ npm install @alchemy/wallet-apis viem
9
9
  ```
10
10
 
11
11
  ## Key Exports
@@ -18,6 +18,8 @@ export type SignPreparedCallsResult = {
18
18
  type: "user-operation-v060";
19
19
  }>> | Signed<Extract<PrepareCallsResult, {
20
20
  type: "user-operation-v070";
21
+ }>> | Signed<Extract<PrepareCallsResult, {
22
+ type: "authorization";
21
23
  }>>;
22
24
  /**
23
25
  * Signs prepared calls using the provided signer.
@@ -74,6 +74,19 @@ export async function signPreparedCalls(client, params) {
74
74
  LOGGER.debug("signPreparedCalls:single-userOp:ok");
75
75
  return res;
76
76
  }
77
+ else if (params.type === "authorization") {
78
+ const { signatureRequest: _signatureRequest, ...rest } = params;
79
+ const signature = await signSignatureRequest(client, {
80
+ type: "eip7702Auth",
81
+ data: {
82
+ ...rest.data,
83
+ chainId: params.chainId,
84
+ },
85
+ });
86
+ const res = { ...rest, signature };
87
+ LOGGER.debug("signPreparedCalls:single-authorization:ok");
88
+ return res;
89
+ }
77
90
  else if (params.type === "paymaster-permit") {
78
91
  LOGGER.warn("signPreparedCalls:invalid-call-type", { type: params.type });
79
92
  throw new BaseError(`Invalid call type ${params.type} for signing prepared calls`);
@@ -1 +1 @@
1
- {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../src/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA+BtC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAA+B;IAE/B,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,EAAE,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AAC,IAAI,KAAK,eAAe;gBAC3B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC;gBAC7B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAChC,CACF;SACF,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,OAAO,GAAG,CAAC;IACb,CAAC;SAAM,IACL,MAAM,CAAC,IAAI,KAAK,qBAAqB;QACrC,MAAM,CAAC,IAAI,KAAK,qBAAqB,EACrC,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACnD,OAAO,GAAG,CAAC;IACb,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1E,MAAM,IAAI,SAAS,CACjB,qBAAqB,MAAM,CAAC,IAAI,6BAA6B,CAC9D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,wCAAwC,EAAE;YACpD,IAAI,EAAG,MAA6B,CAAC,IAAI;SAC1C,CAAC,CAAC;QACH,OAAO,WAAW,CAChB,MAAM,EACN,2BAA2B,MAAM,6BAA6B,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { assertNever, BaseError } from \"@alchemy/common\";\nimport type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestResult,\n} from \"./signSignatureRequest.js\";\nimport type { Prettify } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport { LOGGER } from \"../logger.js\";\n\nexport type SignPreparedCallsParams = Prettify<PrepareCallsResult>;\n\n/** Replace signatureRequest/feePayment with the actual signature produced by signPreparedCalls. */\ntype Signed<T> = T extends { signatureRequest?: unknown }\n ? Prettify<\n Omit<T, \"signatureRequest\" | \"feePayment\"> & {\n signature: SignSignatureRequestResult;\n }\n >\n : never;\n\nexport type SignPreparedCallsResult =\n | {\n type: \"array\";\n data: Signed<\n Extract<PrepareCallsResult, { type: \"array\" }>[\"data\"][number]\n >[];\n }\n | Signed<Extract<PrepareCallsResult, { type: \"user-operation-v060\" }>>\n | Signed<Extract<PrepareCallsResult, { type: \"user-operation-v070\" }>>;\n\n// Decoded types derived from PrepareCallsResult (numbers/bigints, not hex strings)\ntype ArrayCallData = Extract<\n PrepareCallsResult,\n { type: \"array\" }\n>[\"data\"][number];\ntype AuthorizationCall = Extract<ArrayCallData, { type: \"authorization\" }>;\ntype UserOpCall = Exclude<ArrayCallData, { type: \"authorization\" }>;\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {InnerWalletApiClient} client - The wallet client to use for signing\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n *\n * @example\n * ```ts\n * // Prepare a user operation call.\n * const preparedCalls = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * });\n *\n * // Sign the prepared calls.\n * const signedCalls = await client.signPreparedCalls(preparedCalls);\n *\n * // Send the signed calls.\n * const result = await client.sendPreparedCalls(signedCalls);\n * ```\n */\nexport async function signPreparedCalls(\n client: InnerWalletApiClient,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n LOGGER.debug(\"signPreparedCalls:start\", { type: params.type });\n\n const signAuthorizationCall = async (call: AuthorizationCall) => {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n\n const signature = await signSignatureRequest(client, {\n type: \"eip7702Auth\",\n data: {\n ...rest.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n };\n\n const signUserOperationCall = async (call: UserOpCall) => {\n const { signatureRequest, ...rest } = call;\n\n if (!signatureRequest) {\n LOGGER.warn(\"signPreparedCalls:missing-signatureRequest\", {\n type: call.type,\n });\n throw new BaseError(\n \"Signature request is required for signing user operation calls. Ensure `onlyEstimation` is set to `false` when calling `prepareCalls`.\",\n );\n }\n\n const signature = await signSignatureRequest(client, signatureRequest);\n const res = {\n ...rest,\n signature,\n } as const;\n LOGGER.debug(\"signPreparedCalls:userOp:ok\");\n return res;\n };\n\n if (params.type === \"array\") {\n const res = {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map((call) =>\n call.type === \"authorization\"\n ? signAuthorizationCall(call)\n : signUserOperationCall(call),\n ),\n ),\n };\n LOGGER.debug(\"signPreparedCalls:array:ok\", { count: res.data.length });\n return res;\n } else if (\n params.type === \"user-operation-v060\" ||\n params.type === \"user-operation-v070\"\n ) {\n const res = await signUserOperationCall(params);\n LOGGER.debug(\"signPreparedCalls:single-userOp:ok\");\n return res;\n } else if (params.type === \"paymaster-permit\") {\n LOGGER.warn(\"signPreparedCalls:invalid-call-type\", { type: params.type });\n throw new BaseError(\n `Invalid call type ${params.type} for signing prepared calls`,\n );\n } else {\n LOGGER.warn(\"signPreparedCalls:unexpected-call-type\", {\n type: (params as { type?: unknown }).type,\n });\n return assertNever(\n params,\n `Unexpected call type in ${params} for signing prepared calls`,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../src/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAgCtC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MA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AI,SAAS,CACjB,qBAAqB,MAAM,CAAC,IAAI,6BAA6B,CAC9D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,wCAAwC,EAAE;YACpD,IAAI,EAAG,MAA6B,CAAC,IAAI;SAC1C,CAAC,CAAC;QACH,OAAO,WAAW,CAChB,MAAM,EACN,2BAA2B,MAAM,6BAA6B,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { assertNever, BaseError } from \"@alchemy/common\";\nimport type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestResult,\n} from \"./signSignatureRequest.js\";\nimport type { Prettify } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport { LOGGER } from \"../logger.js\";\n\nexport type SignPreparedCallsParams = Prettify<PrepareCallsResult>;\n\n/** Replace signatureRequest/feePayment with the actual signature produced by signPreparedCalls. */\ntype Signed<T> = T extends { signatureRequest?: unknown }\n ? Prettify<\n Omit<T, \"signatureRequest\" | \"feePayment\"> & {\n signature: SignSignatureRequestResult;\n }\n >\n : never;\n\nexport type SignPreparedCallsResult =\n | {\n type: \"array\";\n data: Signed<\n Extract<PrepareCallsResult, { type: \"array\" }>[\"data\"][number]\n >[];\n }\n | Signed<Extract<PrepareCallsResult, { type: \"user-operation-v060\" }>>\n | Signed<Extract<PrepareCallsResult, { type: \"user-operation-v070\" }>>\n | Signed<Extract<PrepareCallsResult, { type: \"authorization\" }>>;\n\n// Decoded types derived from PrepareCallsResult (numbers/bigints, not hex strings)\ntype ArrayCallData = Extract<\n PrepareCallsResult,\n { type: \"array\" }\n>[\"data\"][number];\ntype AuthorizationCall = Extract<ArrayCallData, { type: \"authorization\" }>;\ntype UserOpCall = Exclude<ArrayCallData, { type: \"authorization\" }>;\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {InnerWalletApiClient} client - The wallet client to use for signing\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n *\n * @example\n * ```ts\n * // Prepare a user operation call.\n * const preparedCalls = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * });\n *\n * // Sign the prepared calls.\n * const signedCalls = await client.signPreparedCalls(preparedCalls);\n *\n * // Send the signed calls.\n * const result = await client.sendPreparedCalls(signedCalls);\n * ```\n */\nexport async function signPreparedCalls(\n client: InnerWalletApiClient,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n LOGGER.debug(\"signPreparedCalls:start\", { type: params.type });\n\n const signAuthorizationCall = async (call: AuthorizationCall) => {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n\n const signature = await signSignatureRequest(client, {\n type: \"eip7702Auth\",\n data: {\n ...rest.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n };\n\n const signUserOperationCall = async (call: UserOpCall) => {\n const { signatureRequest, ...rest } = call;\n\n if (!signatureRequest) {\n LOGGER.warn(\"signPreparedCalls:missing-signatureRequest\", {\n type: call.type,\n });\n throw new BaseError(\n \"Signature request is required for signing user operation calls. Ensure `onlyEstimation` is set to `false` when calling `prepareCalls`.\",\n );\n }\n\n const signature = await signSignatureRequest(client, signatureRequest);\n const res = {\n ...rest,\n signature,\n } as const;\n LOGGER.debug(\"signPreparedCalls:userOp:ok\");\n return res;\n };\n\n if (params.type === \"array\") {\n const res = {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map((call) =>\n call.type === \"authorization\"\n ? signAuthorizationCall(call)\n : signUserOperationCall(call),\n ),\n ),\n };\n LOGGER.debug(\"signPreparedCalls:array:ok\", { count: res.data.length });\n return res;\n } else if (\n params.type === \"user-operation-v060\" ||\n params.type === \"user-operation-v070\"\n ) {\n const res = await signUserOperationCall(params);\n LOGGER.debug(\"signPreparedCalls:single-userOp:ok\");\n return res;\n } else if (params.type === \"authorization\") {\n const { signatureRequest: _signatureRequest, ...rest } = params;\n const signature = await signSignatureRequest(client, {\n type: \"eip7702Auth\",\n data: {\n ...rest.data,\n chainId: params.chainId,\n },\n });\n const res = { ...rest, signature };\n LOGGER.debug(\"signPreparedCalls:single-authorization:ok\");\n return res;\n } else if (params.type === \"paymaster-permit\") {\n LOGGER.warn(\"signPreparedCalls:invalid-call-type\", { type: params.type });\n throw new BaseError(\n `Invalid call type ${params.type} for signing prepared calls`,\n );\n } else {\n LOGGER.warn(\"signPreparedCalls:unexpected-call-type\", {\n type: (params as { type?: unknown }).type,\n });\n return assertNever(\n params,\n `Unexpected call type in ${params} for signing prepared calls`,\n );\n }\n}\n"]}
@@ -0,0 +1,40 @@
1
+ import type { Prettify } from "viem";
2
+ import type { InnerWalletApiClient } from "../types.js";
3
+ import { type AccountParam } from "../utils/resolve.js";
4
+ import { wallet_sendPreparedCalls as SendMethodSchema } from "@alchemy/wallet-api-types/rpc";
5
+ import { type MethodResponse } from "../utils/schema.js";
6
+ type SendPreparedCallsResponse = MethodResponse<typeof SendMethodSchema>;
7
+ export type UndelegateAccountParams = Prettify<{
8
+ account?: AccountParam;
9
+ chainId?: number;
10
+ capabilities?: {
11
+ paymaster?: {
12
+ policyId: string;
13
+ };
14
+ };
15
+ }>;
16
+ export type UndelegateAccountResult = Prettify<SendPreparedCallsResponse>;
17
+ /**
18
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
19
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
20
+ *
21
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
22
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
23
+ *
24
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
25
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
26
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
27
+ * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
28
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
29
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
30
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
31
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const result = await client.undelegateAccount();
36
+ * const status = await client.waitForCallsStatus({ id: result.id });
37
+ * ```
38
+ */
39
+ export declare function undelegateAccount(client: InnerWalletApiClient, params?: UndelegateAccountParams): Promise<UndelegateAccountResult>;
40
+ export {};
@@ -0,0 +1,82 @@
1
+ import { LOGGER } from "../logger.js";
2
+ import { resolveAddress } from "../utils/resolve.js";
3
+ import { wallet_prepareCalls as PrepareMethodSchema, wallet_sendPreparedCalls as SendMethodSchema, } from "@alchemy/wallet-api-types/rpc";
4
+ import { methodSchema, encode, decode, } from "../utils/schema.js";
5
+ import { signSignatureRequest } from "./signSignatureRequest.js";
6
+ import { BaseError } from "@alchemy/common";
7
+ import { mergeClientCapabilities } from "../utils/capabilities.js";
8
+ const prepareSchema = methodSchema(PrepareMethodSchema);
9
+ const sendSchema = methodSchema(SendMethodSchema);
10
+ /**
11
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
12
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
13
+ *
14
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
15
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
16
+ *
17
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
18
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
19
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
20
+ * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
21
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
22
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
23
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
24
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const result = await client.undelegateAccount();
29
+ * const status = await client.waitForCallsStatus({ id: result.id });
30
+ * ```
31
+ */
32
+ export async function undelegateAccount(client, params) {
33
+ const from = params?.account
34
+ ? resolveAddress(params.account)
35
+ : client.account.address;
36
+ const chainId = params?.chainId ?? client.chain.id;
37
+ const capabilities = mergeClientCapabilities(client, params?.capabilities);
38
+ LOGGER.info("undelegateAccount:start", { account: from, chainId });
39
+ // Step 1: Prepare — wallet_prepareCalls with zero-address delegation, no calls
40
+ const prepareRpcParams = encode(prepareSchema.request, {
41
+ from,
42
+ chainId,
43
+ capabilities: {
44
+ ...capabilities,
45
+ eip7702Auth: {
46
+ delegation: "0x0000000000000000000000000000000000000000",
47
+ },
48
+ },
49
+ });
50
+ const prepareRpcResp = await client.request({
51
+ method: "wallet_prepareCalls",
52
+ params: [prepareRpcParams],
53
+ });
54
+ const prepared = decode(prepareSchema.response, prepareRpcResp);
55
+ if (prepared.type !== "authorization") {
56
+ throw new BaseError(`Unexpected response type from wallet_prepareCalls: expected "authorization", got "${prepared.type}"`);
57
+ }
58
+ LOGGER.debug("undelegateAccount:prepared");
59
+ // Step 2: Sign the authorization
60
+ const signature = await signSignatureRequest(client, {
61
+ type: "eip7702Auth",
62
+ data: {
63
+ ...prepared.data,
64
+ chainId: prepared.chainId,
65
+ },
66
+ });
67
+ LOGGER.debug("undelegateAccount:signed");
68
+ // Step 3: Send — wallet_sendPreparedCalls with the signed authorization
69
+ const { signatureRequest: _, ...rest } = prepared;
70
+ const sendRpcParams = encode(sendSchema.request, {
71
+ ...rest,
72
+ signature,
73
+ });
74
+ const sendRpcResp = await client.request({
75
+ method: "wallet_sendPreparedCalls",
76
+ params: [sendRpcParams],
77
+ });
78
+ const result = decode(sendSchema.response, sendRpcResp);
79
+ LOGGER.info("undelegateAccount:done", { id: result.id });
80
+ return result;
81
+ }
82
+ //# sourceMappingURL=undelegateAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undelegateAccount.js","sourceRoot":"","sources":["../../../src/actions/undelegateAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACL,mBAAmB,IAAI,mBAAmB,EAC1C,wBAAwB,IAAI,gBAAgB,GAC7C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,GAEP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,aAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AACxD,MAAM,UAAU,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAgBlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAAgC;IAEhC,MAAM,IAAI,GAAG,MAAM,EAAE,OAAO;QAC1B,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAE3B,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAEnD,MAAM,YAAY,GAAG,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAE3E,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,OAAO,EAAE,IA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AAC;KACxB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Prettify } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport { LOGGER } from \"../logger.js\";\nimport { resolveAddress, type AccountParam } from \"../utils/resolve.js\";\nimport {\n wallet_prepareCalls as PrepareMethodSchema,\n wallet_sendPreparedCalls as SendMethodSchema,\n} from \"@alchemy/wallet-api-types/rpc\";\nimport {\n methodSchema,\n encode,\n decode,\n type MethodResponse,\n} from \"../utils/schema.js\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\nimport { BaseError } from \"@alchemy/common\";\nimport { mergeClientCapabilities } from \"../utils/capabilities.js\";\n\nconst prepareSchema = methodSchema(PrepareMethodSchema);\nconst sendSchema = methodSchema(SendMethodSchema);\n\ntype SendPreparedCallsResponse = MethodResponse<typeof SendMethodSchema>;\n\nexport type UndelegateAccountParams = Prettify<{\n account?: AccountParam;\n chainId?: number;\n capabilities?: {\n paymaster?: {\n policyId: string;\n };\n };\n}>;\n\nexport type UndelegateAccountResult = Prettify<SendPreparedCallsResponse>;\n\n/**\n * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.\n * Gas is sponsored by Alchemy (requires Enterprise plan).\n *\n * A BSO (Bundler Sponsorship Override) policy ID must be provided either via\n * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {UndelegateAccountParams} params - Parameters for undelegating the account\n * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).\n * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.\n * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.\n * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.\n * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.\n * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.\n *\n * @example\n * ```ts\n * const result = await client.undelegateAccount();\n * const status = await client.waitForCallsStatus({ id: result.id });\n * ```\n */\nexport async function undelegateAccount(\n client: InnerWalletApiClient,\n params?: UndelegateAccountParams,\n): Promise<UndelegateAccountResult> {\n const from = params?.account\n ? resolveAddress(params.account)\n : client.account.address;\n\n const chainId = params?.chainId ?? client.chain.id;\n\n const capabilities = mergeClientCapabilities(client, params?.capabilities);\n\n LOGGER.info(\"undelegateAccount:start\", { account: from, chainId });\n\n // Step 1: Prepare — wallet_prepareCalls with zero-address delegation, no calls\n const prepareRpcParams = encode(prepareSchema.request, {\n from,\n chainId,\n capabilities: {\n ...capabilities,\n eip7702Auth: {\n delegation: \"0x0000000000000000000000000000000000000000\",\n },\n },\n });\n\n const prepareRpcResp = await client.request({\n method: \"wallet_prepareCalls\",\n params: [prepareRpcParams],\n });\n\n const prepared = decode(prepareSchema.response, prepareRpcResp);\n\n if (prepared.type !== \"authorization\") {\n throw new BaseError(\n `Unexpected response type from wallet_prepareCalls: expected \"authorization\", got \"${prepared.type}\"`,\n );\n }\n\n LOGGER.debug(\"undelegateAccount:prepared\");\n\n // Step 2: Sign the authorization\n const signature = await signSignatureRequest(client, {\n type: \"eip7702Auth\",\n data: {\n ...prepared.data,\n chainId: prepared.chainId,\n },\n });\n\n LOGGER.debug(\"undelegateAccount:signed\");\n\n // Step 3: Send — wallet_sendPreparedCalls with the signed authorization\n const { signatureRequest: _, ...rest } = prepared;\n const sendRpcParams = encode(sendSchema.request, {\n ...rest,\n signature,\n });\n\n const sendRpcResp = await client.request({\n method: \"wallet_sendPreparedCalls\",\n params: [sendRpcParams],\n });\n\n const result = decode(sendSchema.response, sendRpcResp);\n LOGGER.info(\"undelegateAccount:done\", { id: result.id });\n return result;\n}\n"]}
@@ -10,6 +10,7 @@ import { type SignMessageParams } from "../actions/signMessage.js";
10
10
  import { type SignTypedDataParams } from "../actions/signTypedData.js";
11
11
  import { type GrantPermissionsParams, type GrantPermissionsResult } from "../actions/grantPermissions.js";
12
12
  import { type GetCapabilitiesParams, type GetCapabilitiesResult } from "../actions/getCapabilities.js";
13
+ import { type UndelegateAccountParams, type UndelegateAccountResult } from "../actions/undelegateAccount.js";
13
14
  import type { InnerWalletApiClient } from "../types.js";
14
15
  import { type GetCallsStatusParameters, type GetCallsStatusReturnType, type WaitForCallsStatusParameters, type WaitForCallsStatusReturnType } from "viem/actions";
15
16
  export type SmartWalletActions = {
@@ -26,6 +27,7 @@ export type SmartWalletActions = {
26
27
  getCallsStatus: (params: GetCallsStatusParameters) => Promise<GetCallsStatusReturnType>;
27
28
  waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>;
28
29
  getCapabilities: (params?: GetCapabilitiesParams | undefined) => Promise<GetCapabilitiesResult>;
30
+ undelegateAccount: (params?: UndelegateAccountParams) => Promise<UndelegateAccountResult>;
29
31
  };
30
32
  /**
31
33
  * Decorator that adds smart wallet actions to a wallet API client.
@@ -10,6 +10,7 @@ import { signMessage } from "../actions/signMessage.js";
10
10
  import { signTypedData, } from "../actions/signTypedData.js";
11
11
  import { grantPermissions, } from "../actions/grantPermissions.js";
12
12
  import { getCapabilities, } from "../actions/getCapabilities.js";
13
+ import { undelegateAccount, } from "../actions/undelegateAccount.js";
13
14
  import { getCallsStatus, waitForCallsStatus, } from "viem/actions";
14
15
  /**
15
16
  * Decorator that adds smart wallet actions to a wallet API client.
@@ -31,6 +32,7 @@ export const smartWalletActions = (client) => ({
31
32
  signTypedData: (params) => signTypedData(client, params),
32
33
  grantPermissions: (params) => grantPermissions(client, params),
33
34
  getCapabilities: (params) => getCapabilities(client, params),
35
+ undelegateAccount: (params) => undelegateAccount(client, params),
34
36
  // Viem methods.
35
37
  getCallsStatus: (params) => getCallsStatus(client, params),
36
38
  waitForCallsStatus: (params) => waitForCallsStatus(client, params),
@@ -1 +1 @@
1
- {"version":3,"file":"smartWalletActions.js","sourceRoot":"","sources":["../../../src/decorators/smartWalletActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,MAAM,CAAC;AAChC,OAAO,EACL,cAAc,GAGf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,YAAY,GAGb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,SAAS,GAGV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,GAGb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,GAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,GAGlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AAChF,OAAO,EACL,aAAa,GAEd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,kBAAkB,GAKnB,MAAM,cAAc,CAAC;AAkCtB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAA4B,EACR,EAAE,CAAC,CAAC;IACxB,mBAAmB;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1D,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;IACtD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;IACtD,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAChD,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;IACtE,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;IACpD,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;IACxD,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC;IAC9D,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;IAC5D,gBAAgB;IAChB,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1D,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import { type Hex } from \"viem\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"../actions/requestAccount.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"../actions/prepareCalls.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"../actions/sendPreparedCalls.js\";\nimport {\n sendCalls,\n type SendCallsParams,\n type SendCallsResult,\n} from \"../actions/sendCalls.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"../actions/listAccounts.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"../actions/signSignatureRequest.js\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"../actions/signPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"../actions/signMessage.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"../actions/signTypedData.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"../actions/grantPermissions.js\";\nimport {\n getCapabilities,\n type GetCapabilitiesParams,\n type GetCapabilitiesResult,\n} from \"../actions/getCapabilities.js\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport {\n getCallsStatus,\n waitForCallsStatus,\n type GetCallsStatusParameters,\n type GetCallsStatusReturnType,\n type WaitForCallsStatusParameters,\n type WaitForCallsStatusReturnType,\n} from \"viem/actions\";\n\nexport type SmartWalletActions = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (params: PrepareCallsParams) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n sendCalls: (params: SendCallsParams) => Promise<SendCallsResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\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,\n ) => Promise<GrantPermissionsResult>;\n getCallsStatus: (\n params: GetCallsStatusParameters,\n ) => Promise<GetCallsStatusReturnType>;\n waitForCallsStatus: (\n params: WaitForCallsStatusParameters,\n ) => Promise<WaitForCallsStatusReturnType>;\n getCapabilities: (\n params?: GetCapabilitiesParams | undefined,\n ) => Promise<GetCapabilitiesResult>;\n};\n\n/**\n * Decorator that adds smart wallet actions to a wallet API client.\n * Provides both Alchemy-specific methods and standard viem wallet actions.\n *\n * @param {InnerWalletApiClient} client The wallet API client instance\n * @returns {SmartWalletActions} An object containing smart wallet action methods\n */\nexport const smartWalletActions = (\n client: InnerWalletApiClient,\n): SmartWalletActions => ({\n // Alchemy methods.\n requestAccount: (params) => requestAccount(client, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n sendCalls: (params) => sendCalls(client, params),\n signSignatureRequest: (params) => signSignatureRequest(client, params),\n signPreparedCalls: (params) => signPreparedCalls(client, params),\n signMessage: (params) => signMessage(client, params),\n signTypedData: (params) => signTypedData(client, params),\n grantPermissions: (params) => grantPermissions(client, params),\n getCapabilities: (params) => getCapabilities(client, params),\n // Viem methods.\n getCallsStatus: (params) => getCallsStatus(client, params),\n waitForCallsStatus: (params) => waitForCallsStatus(client, params),\n});\n"]}
1
+ {"version":3,"file":"smartWalletActions.js","sourceRoot":"","sources":["../../../src/decorators/smartWalletActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,MAAM,CAAC;AAChC,OAAO,EACL,cAAc,GAGf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,YAAY,GAGb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,SAAS,GAGV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,GAGb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,GAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,GAGlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AAChF,OAAO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9D,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;IAC5D,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChE,gBAAgB;IAChB,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1D,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import { type Hex } from \"viem\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"../actions/requestAccount.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"../actions/prepareCalls.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"../actions/sendPreparedCalls.js\";\nimport {\n sendCalls,\n type SendCallsParams,\n type SendCallsResult,\n} from \"../actions/sendCalls.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"../actions/listAccounts.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"../actions/signSignatureRequest.js\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"../actions/signPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"../actions/signMessage.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"../actions/signTypedData.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"../actions/grantPermissions.js\";\nimport {\n getCapabilities,\n type GetCapabilitiesParams,\n type GetCapabilitiesResult,\n} from \"../actions/getCapabilities.js\";\nimport {\n undelegateAccount,\n type UndelegateAccountParams,\n type UndelegateAccountResult,\n} from \"../actions/undelegateAccount.js\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport {\n getCallsStatus,\n waitForCallsStatus,\n type GetCallsStatusParameters,\n type GetCallsStatusReturnType,\n type WaitForCallsStatusParameters,\n type WaitForCallsStatusReturnType,\n} from \"viem/actions\";\n\nexport type SmartWalletActions = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (params: PrepareCallsParams) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n sendCalls: (params: SendCallsParams) => Promise<SendCallsResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\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,\n ) => Promise<GrantPermissionsResult>;\n getCallsStatus: (\n params: GetCallsStatusParameters,\n ) => Promise<GetCallsStatusReturnType>;\n waitForCallsStatus: (\n params: WaitForCallsStatusParameters,\n ) => Promise<WaitForCallsStatusReturnType>;\n getCapabilities: (\n params?: GetCapabilitiesParams | undefined,\n ) => Promise<GetCapabilitiesResult>;\n undelegateAccount: (\n params?: UndelegateAccountParams,\n ) => Promise<UndelegateAccountResult>;\n};\n\n/**\n * Decorator that adds smart wallet actions to a wallet API client.\n * Provides both Alchemy-specific methods and standard viem wallet actions.\n *\n * @param {InnerWalletApiClient} client The wallet API client instance\n * @returns {SmartWalletActions} An object containing smart wallet action methods\n */\nexport const smartWalletActions = (\n client: InnerWalletApiClient,\n): SmartWalletActions => ({\n // Alchemy methods.\n requestAccount: (params) => requestAccount(client, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n sendCalls: (params) => sendCalls(client, params),\n signSignatureRequest: (params) => signSignatureRequest(client, params),\n signPreparedCalls: (params) => signPreparedCalls(client, params),\n signMessage: (params) => signMessage(client, params),\n signTypedData: (params) => signTypedData(client, params),\n grantPermissions: (params) => grantPermissions(client, params),\n getCapabilities: (params) => getCapabilities(client, params),\n undelegateAccount: (params) => undelegateAccount(client, params),\n // Viem methods.\n getCallsStatus: (params) => getCallsStatus(client, params),\n waitForCallsStatus: (params) => waitForCallsStatus(client, params),\n});\n"]}
@@ -24,6 +24,8 @@ export type * from "../actions/signSignatureRequest.js";
24
24
  export { signSignatureRequest } from "../actions/signSignatureRequest.js";
25
25
  export type * from "../actions/signTypedData.js";
26
26
  export { signTypedData } from "../actions/signTypedData.js";
27
+ export type * from "../actions/undelegateAccount.js";
28
+ export { undelegateAccount } from "../actions/undelegateAccount.js";
27
29
  export type * from "../decorators/smartWalletActions.js";
28
30
  export { smartWalletActions } from "../decorators/smartWalletActions.js";
29
31
  export type { BaseWalletClient, SignerClient, SmartWalletClient, } from "../types.js";
@@ -11,6 +11,7 @@ export { signMessage } from "../actions/signMessage.js";
11
11
  export { signPreparedCalls } from "../actions/signPreparedCalls.js";
12
12
  export { signSignatureRequest } from "../actions/signSignatureRequest.js";
13
13
  export { signTypedData } from "../actions/signTypedData.js";
14
+ export { undelegateAccount } from "../actions/undelegateAccount.js";
14
15
  export { smartWalletActions } from "../decorators/smartWalletActions.js";
15
16
  export { createSmartWalletClient } from "../client.js";
16
17
  export { alchemyWalletTransport } from "../transport.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AASzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAIvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Actions.\nexport type * from \"../actions/formatSign.js\";\nexport { formatSign } from \"../actions/formatSign.js\";\nexport type * from \"../actions/getCapabilities.js\";\nexport { getCapabilities } from \"../actions/getCapabilities.js\";\nexport type * from \"../actions/grantPermissions.js\";\nexport { grantPermissions } from \"../actions/grantPermissions.js\";\nexport type * from \"../actions/listAccounts.js\";\nexport { listAccounts } from \"../actions/listAccounts.js\";\nexport type * from \"../actions/prepareCalls.js\";\nexport { prepareCalls } from \"../actions/prepareCalls.js\";\nexport type * from \"../actions/prepareSign.js\";\nexport { prepareSign } from \"../actions/prepareSign.js\";\nexport type * from \"../actions/requestAccount.js\";\nexport { requestAccount } from \"../actions/requestAccount.js\";\nexport type * from \"../actions/sendCalls.js\";\nexport { sendCalls } from \"../actions/sendCalls.js\";\nexport type * from \"../actions/sendPreparedCalls.js\";\nexport { sendPreparedCalls } from \"../actions/sendPreparedCalls.js\";\nexport type * from \"../actions/signMessage.js\";\nexport { signMessage } from \"../actions/signMessage.js\";\nexport type * from \"../actions/signPreparedCalls.js\";\nexport { signPreparedCalls } from \"../actions/signPreparedCalls.js\";\nexport type * from \"../actions/signSignatureRequest.js\";\nexport { signSignatureRequest } from \"../actions/signSignatureRequest.js\";\nexport type * from \"../actions/signTypedData.js\";\nexport { signTypedData } from \"../actions/signTypedData.js\";\n\n// Decorators.\nexport type * from \"../decorators/smartWalletActions.js\";\nexport { smartWalletActions } from \"../decorators/smartWalletActions.js\";\n\n// Client.\nexport type {\n BaseWalletClient,\n SignerClient,\n SmartWalletClient,\n} from \"../types.js\";\nexport type * from \"../client.js\";\nexport { createSmartWalletClient } from \"../client.js\";\n\n// Transport.\nexport type * from \"../transport.js\";\nexport { alchemyWalletTransport } from \"../transport.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AASzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAIvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Actions.\nexport type * from \"../actions/formatSign.js\";\nexport { formatSign } from \"../actions/formatSign.js\";\nexport type * from \"../actions/getCapabilities.js\";\nexport { getCapabilities } from \"../actions/getCapabilities.js\";\nexport type * from \"../actions/grantPermissions.js\";\nexport { grantPermissions } from \"../actions/grantPermissions.js\";\nexport type * from \"../actions/listAccounts.js\";\nexport { listAccounts } from \"../actions/listAccounts.js\";\nexport type * from \"../actions/prepareCalls.js\";\nexport { prepareCalls } from \"../actions/prepareCalls.js\";\nexport type * from \"../actions/prepareSign.js\";\nexport { prepareSign } from \"../actions/prepareSign.js\";\nexport type * from \"../actions/requestAccount.js\";\nexport { requestAccount } from \"../actions/requestAccount.js\";\nexport type * from \"../actions/sendCalls.js\";\nexport { sendCalls } from \"../actions/sendCalls.js\";\nexport type * from \"../actions/sendPreparedCalls.js\";\nexport { sendPreparedCalls } from \"../actions/sendPreparedCalls.js\";\nexport type * from \"../actions/signMessage.js\";\nexport { signMessage } from \"../actions/signMessage.js\";\nexport type * from \"../actions/signPreparedCalls.js\";\nexport { signPreparedCalls } from \"../actions/signPreparedCalls.js\";\nexport type * from \"../actions/signSignatureRequest.js\";\nexport { signSignatureRequest } from \"../actions/signSignatureRequest.js\";\nexport type * from \"../actions/signTypedData.js\";\nexport { signTypedData } from \"../actions/signTypedData.js\";\nexport type * from \"../actions/undelegateAccount.js\";\nexport { undelegateAccount } from \"../actions/undelegateAccount.js\";\n\n// Decorators.\nexport type * from \"../decorators/smartWalletActions.js\";\nexport { smartWalletActions } from \"../decorators/smartWalletActions.js\";\n\n// Client.\nexport type {\n BaseWalletClient,\n SignerClient,\n SmartWalletClient,\n} from \"../types.js\";\nexport type * from \"../client.js\";\nexport { createSmartWalletClient } from \"../client.js\";\n\n// Transport.\nexport type * from \"../transport.js\";\nexport { alchemyWalletTransport } from \"../transport.js\";\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "5.0.0-beta.1";
1
+ export declare const VERSION = "5.0.0-beta.19";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "5.0.0-beta.1";
3
+ export const VERSION = "5.0.0-beta.19";
4
4
  //# sourceMappingURL=version.js.map
@@ -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,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.1\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.19\";\n"]}
@@ -18,6 +18,8 @@ export type SignPreparedCallsResult = {
18
18
  type: "user-operation-v060";
19
19
  }>> | Signed<Extract<PrepareCallsResult, {
20
20
  type: "user-operation-v070";
21
+ }>> | Signed<Extract<PrepareCallsResult, {
22
+ type: "authorization";
21
23
  }>>;
22
24
  /**
23
25
  * Signs prepared calls using the provided signer.
@@ -1 +1 @@
1
- {"version":3,"file":"signPreparedCalls.d.ts","sourceRoot":"","sources":["../../../src/actions/signPreparedCalls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,C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AK,0BAA0B,EAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAEnE,mGAAmG;AACnG,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACrD,QAAQ,CACN,IAAI,CAAC,CAAC,EAAE,kBAAkB,GAAG,YAAY,CAAC,GAAG;IAC3C,SAAS,EAAE,0BAA0B,CAAC;CACvC,CACF,GACD,KAAK,CAAC;AAEV,MAAM,MAAM,uBAAuB,GAC/B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CACV,OAAO,CAAC,kBAAkB,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAC/D,EAAE,CAAC;CACL,GACD,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,CAAC,CAAC,GACpE,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,CAAC,CAAC,GACpE,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,CAAC,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAsFlC"}
@@ -0,0 +1,41 @@
1
+ import type { Prettify } from "viem";
2
+ import type { InnerWalletApiClient } from "../types.js";
3
+ import { type AccountParam } from "../utils/resolve.js";
4
+ import { wallet_sendPreparedCalls as SendMethodSchema } from "@alchemy/wallet-api-types/rpc";
5
+ import { type MethodResponse } from "../utils/schema.js";
6
+ type SendPreparedCallsResponse = MethodResponse<typeof SendMethodSchema>;
7
+ export type UndelegateAccountParams = Prettify<{
8
+ account?: AccountParam;
9
+ chainId?: number;
10
+ capabilities?: {
11
+ paymaster?: {
12
+ policyId: string;
13
+ };
14
+ };
15
+ }>;
16
+ export type UndelegateAccountResult = Prettify<SendPreparedCallsResponse>;
17
+ /**
18
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
19
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
20
+ *
21
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
22
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
23
+ *
24
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
25
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
26
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
27
+ * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
28
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
29
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
30
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
31
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const result = await client.undelegateAccount();
36
+ * const status = await client.waitForCallsStatus({ id: result.id });
37
+ * ```
38
+ */
39
+ export declare function undelegateAccount(client: InnerWalletApiClient, params?: UndelegateAccountParams): Promise<UndelegateAccountResult>;
40
+ export {};
41
+ //# sourceMappingURL=undelegateAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undelegateAccount.d.ts","sourceRoot":"","sources":["../../../src/actions/undelegateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAEL,wBAAwB,IAAI,gBAAgB,EAC7C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAQ5B,KAAK,yBAAyB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE;QACb,SAAS,CAAC,EAAE;YACV,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAgElC"}
@@ -10,6 +10,7 @@ import { type SignMessageParams } from "../actions/signMessage.js";
10
10
  import { type SignTypedDataParams } from "../actions/signTypedData.js";
11
11
  import { type GrantPermissionsParams, type GrantPermissionsResult } from "../actions/grantPermissions.js";
12
12
  import { type GetCapabilitiesParams, type GetCapabilitiesResult } from "../actions/getCapabilities.js";
13
+ import { type UndelegateAccountParams, type UndelegateAccountResult } from "../actions/undelegateAccount.js";
13
14
  import type { InnerWalletApiClient } from "../types.js";
14
15
  import { type GetCallsStatusParameters, type GetCallsStatusReturnType, type WaitForCallsStatusParameters, type WaitForCallsStatusReturnType } from "viem/actions";
15
16
  export type SmartWalletActions = {
@@ -26,6 +27,7 @@ export type SmartWalletActions = {
26
27
  getCallsStatus: (params: GetCallsStatusParameters) => Promise<GetCallsStatusReturnType>;
27
28
  waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>;
28
29
  getCapabilities: (params?: GetCapabilitiesParams | undefined) => Promise<GetCapabilitiesResult>;
30
+ undelegateAccount: (params?: UndelegateAccountParams) => Promise<UndelegateAccountResult>;
29
31
  };
30
32
  /**
31
33
  * Decorator that adds smart wallet actions to a wallet API client.
@@ -1 +1 @@
1
- {"version":3,"file":"smartWalletActions.d.ts","sourceRoot":"","sources":["../../../src/decorators/smartWalletActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,g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AO,CAAC,wBAAwB,CAAC,CAAC;IACvC,kBAAkB,EAAE,CAClB,MAAM,EAAE,4BAA4B,KACjC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,eAAe,EAAE,CACf,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,KACvC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,iBAAiB,EAAE,CACjB,MAAM,CAAC,EAAE,uBAAuB,KAC7B,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,oBAAoB,KAC3B,kBAiBD,CAAC"}
@@ -24,6 +24,8 @@ export type * from "../actions/signSignatureRequest.js";
24
24
  export { signSignatureRequest } from "../actions/signSignatureRequest.js";
25
25
  export type * from "../actions/signTypedData.js";
26
26
  export { signTypedData } from "../actions/signTypedData.js";
27
+ export type * from "../actions/undelegateAccount.js";
28
+ export { undelegateAccount } from "../actions/undelegateAccount.js";
27
29
  export type * from "../decorators/smartWalletActions.js";
28
30
  export { smartWalletActions } from "../decorators/smartWalletActions.js";
29
31
  export type { BaseWalletClient, SignerClient, SmartWalletClient, } from "../types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AACA,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,mBAAmB,+BAA+B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,mBAAmB,gCAAgC,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA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sB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.0.0-beta.1";
1
+ export declare const VERSION = "5.0.0-beta.19";
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,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/wallet-apis",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.20",
4
4
  "description": "Alchemy Wallet APIs",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "scripts": {
43
43
  "prebuild": "tsx ./inject-version.ts",
44
- "build": "yarn clean && yarn build:esm && yarn build:types",
44
+ "build": "pnpm run clean && pnpm run build:esm && pnpm run build:types",
45
45
  "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm",
46
46
  "build:types": "tsc --project tsconfig.build.json --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
47
47
  "clean": "rm -rf ./dist",
@@ -50,12 +50,13 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/deep-equal": "^1.0.4",
53
- "typescript-template": "*",
53
+ "abitype": "^1.0.0",
54
+ "typescript-template": "workspace:*",
54
55
  "viem": "^2.45.0"
55
56
  },
56
57
  "dependencies": {
57
- "@alchemy/common": "^5.0.0-beta.2",
58
- "@alchemy/wallet-api-types": "0.1.0-alpha.26",
58
+ "@alchemy/common": "5.0.0-beta.20",
59
+ "@alchemy/wallet-api-types": "^0.1.0-alpha.27",
59
60
  "deep-equal": "^2.2.3",
60
61
  "ox": "^0.11.1",
61
62
  "typebox": "^1.0.81"
@@ -75,5 +76,5 @@
75
76
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
76
77
  },
77
78
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
78
- "gitHead": "9042002b7414ac2ae8a6251ee4cf96555b091eca"
79
+ "gitHead": "e8b35b489e1f129877c618752b35b4fb05149a55"
79
80
  }
@@ -27,7 +27,8 @@ export type SignPreparedCallsResult =
27
27
  >[];
28
28
  }
29
29
  | Signed<Extract<PrepareCallsResult, { type: "user-operation-v060" }>>
30
- | Signed<Extract<PrepareCallsResult, { type: "user-operation-v070" }>>;
30
+ | Signed<Extract<PrepareCallsResult, { type: "user-operation-v070" }>>
31
+ | Signed<Extract<PrepareCallsResult, { type: "authorization" }>>;
31
32
 
32
33
  // Decoded types derived from PrepareCallsResult (numbers/bigints, not hex strings)
33
34
  type ArrayCallData = Extract<
@@ -125,6 +126,18 @@ export async function signPreparedCalls(
125
126
  const res = await signUserOperationCall(params);
126
127
  LOGGER.debug("signPreparedCalls:single-userOp:ok");
127
128
  return res;
129
+ } else if (params.type === "authorization") {
130
+ const { signatureRequest: _signatureRequest, ...rest } = params;
131
+ const signature = await signSignatureRequest(client, {
132
+ type: "eip7702Auth",
133
+ data: {
134
+ ...rest.data,
135
+ chainId: params.chainId,
136
+ },
137
+ });
138
+ const res = { ...rest, signature };
139
+ LOGGER.debug("signPreparedCalls:single-authorization:ok");
140
+ return res;
128
141
  } else if (params.type === "paymaster-permit") {
129
142
  LOGGER.warn("signPreparedCalls:invalid-call-type", { type: params.type });
130
143
  throw new BaseError(
@@ -0,0 +1,125 @@
1
+ import type { Prettify } from "viem";
2
+ import type { InnerWalletApiClient } from "../types.js";
3
+ import { LOGGER } from "../logger.js";
4
+ import { resolveAddress, type AccountParam } from "../utils/resolve.js";
5
+ import {
6
+ wallet_prepareCalls as PrepareMethodSchema,
7
+ wallet_sendPreparedCalls as SendMethodSchema,
8
+ } from "@alchemy/wallet-api-types/rpc";
9
+ import {
10
+ methodSchema,
11
+ encode,
12
+ decode,
13
+ type MethodResponse,
14
+ } from "../utils/schema.js";
15
+ import { signSignatureRequest } from "./signSignatureRequest.js";
16
+ import { BaseError } from "@alchemy/common";
17
+ import { mergeClientCapabilities } from "../utils/capabilities.js";
18
+
19
+ const prepareSchema = methodSchema(PrepareMethodSchema);
20
+ const sendSchema = methodSchema(SendMethodSchema);
21
+
22
+ type SendPreparedCallsResponse = MethodResponse<typeof SendMethodSchema>;
23
+
24
+ export type UndelegateAccountParams = Prettify<{
25
+ account?: AccountParam;
26
+ chainId?: number;
27
+ capabilities?: {
28
+ paymaster?: {
29
+ policyId: string;
30
+ };
31
+ };
32
+ }>;
33
+
34
+ export type UndelegateAccountResult = Prettify<SendPreparedCallsResponse>;
35
+
36
+ /**
37
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
38
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
39
+ *
40
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
41
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
42
+ *
43
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
44
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
45
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
46
+ * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
47
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
48
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
49
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
50
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const result = await client.undelegateAccount();
55
+ * const status = await client.waitForCallsStatus({ id: result.id });
56
+ * ```
57
+ */
58
+ export async function undelegateAccount(
59
+ client: InnerWalletApiClient,
60
+ params?: UndelegateAccountParams,
61
+ ): Promise<UndelegateAccountResult> {
62
+ const from = params?.account
63
+ ? resolveAddress(params.account)
64
+ : client.account.address;
65
+
66
+ const chainId = params?.chainId ?? client.chain.id;
67
+
68
+ const capabilities = mergeClientCapabilities(client, params?.capabilities);
69
+
70
+ LOGGER.info("undelegateAccount:start", { account: from, chainId });
71
+
72
+ // Step 1: Prepare — wallet_prepareCalls with zero-address delegation, no calls
73
+ const prepareRpcParams = encode(prepareSchema.request, {
74
+ from,
75
+ chainId,
76
+ capabilities: {
77
+ ...capabilities,
78
+ eip7702Auth: {
79
+ delegation: "0x0000000000000000000000000000000000000000",
80
+ },
81
+ },
82
+ });
83
+
84
+ const prepareRpcResp = await client.request({
85
+ method: "wallet_prepareCalls",
86
+ params: [prepareRpcParams],
87
+ });
88
+
89
+ const prepared = decode(prepareSchema.response, prepareRpcResp);
90
+
91
+ if (prepared.type !== "authorization") {
92
+ throw new BaseError(
93
+ `Unexpected response type from wallet_prepareCalls: expected "authorization", got "${prepared.type}"`,
94
+ );
95
+ }
96
+
97
+ LOGGER.debug("undelegateAccount:prepared");
98
+
99
+ // Step 2: Sign the authorization
100
+ const signature = await signSignatureRequest(client, {
101
+ type: "eip7702Auth",
102
+ data: {
103
+ ...prepared.data,
104
+ chainId: prepared.chainId,
105
+ },
106
+ });
107
+
108
+ LOGGER.debug("undelegateAccount:signed");
109
+
110
+ // Step 3: Send — wallet_sendPreparedCalls with the signed authorization
111
+ const { signatureRequest: _, ...rest } = prepared;
112
+ const sendRpcParams = encode(sendSchema.request, {
113
+ ...rest,
114
+ signature,
115
+ });
116
+
117
+ const sendRpcResp = await client.request({
118
+ method: "wallet_sendPreparedCalls",
119
+ params: [sendRpcParams],
120
+ });
121
+
122
+ const result = decode(sendSchema.response, sendRpcResp);
123
+ LOGGER.info("undelegateAccount:done", { id: result.id });
124
+ return result;
125
+ }
@@ -49,6 +49,11 @@ import {
49
49
  type GetCapabilitiesParams,
50
50
  type GetCapabilitiesResult,
51
51
  } from "../actions/getCapabilities.js";
52
+ import {
53
+ undelegateAccount,
54
+ type UndelegateAccountParams,
55
+ type UndelegateAccountResult,
56
+ } from "../actions/undelegateAccount.js";
52
57
  import type { InnerWalletApiClient } from "../types.js";
53
58
  import {
54
59
  getCallsStatus,
@@ -89,6 +94,9 @@ export type SmartWalletActions = {
89
94
  getCapabilities: (
90
95
  params?: GetCapabilitiesParams | undefined,
91
96
  ) => Promise<GetCapabilitiesResult>;
97
+ undelegateAccount: (
98
+ params?: UndelegateAccountParams,
99
+ ) => Promise<UndelegateAccountResult>;
92
100
  };
93
101
 
94
102
  /**
@@ -113,6 +121,7 @@ export const smartWalletActions = (
113
121
  signTypedData: (params) => signTypedData(client, params),
114
122
  grantPermissions: (params) => grantPermissions(client, params),
115
123
  getCapabilities: (params) => getCapabilities(client, params),
124
+ undelegateAccount: (params) => undelegateAccount(client, params),
116
125
  // Viem methods.
117
126
  getCallsStatus: (params) => getCallsStatus(client, params),
118
127
  waitForCallsStatus: (params) => waitForCallsStatus(client, params),
@@ -25,6 +25,8 @@ export type * from "../actions/signSignatureRequest.js";
25
25
  export { signSignatureRequest } from "../actions/signSignatureRequest.js";
26
26
  export type * from "../actions/signTypedData.js";
27
27
  export { signTypedData } from "../actions/signTypedData.js";
28
+ export type * from "../actions/undelegateAccount.js";
29
+ export { undelegateAccount } from "../actions/undelegateAccount.js";
28
30
 
29
31
  // Decorators.
30
32
  export type * from "../decorators/smartWalletActions.js";
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "5.0.0-beta.2";
3
+ export const VERSION = "5.0.0-beta.20";