@alchemy/wallet-apis 5.0.0-beta.21 → 5.0.0-beta.22

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.
@@ -1,17 +1,17 @@
1
- import type { Prettify } from "viem";
1
+ import { type Chain, type Prettify } from "viem";
2
2
  import type { InnerWalletApiClient } from "../types.js";
3
3
  import { type AccountParam } from "../utils/resolve.js";
4
- import { type SendPreparedCallsResult } from "./sendPreparedCalls.js";
4
+ import { type SendCallsResult } from "./sendCalls.js";
5
5
  export type UndelegateAccountParams = Prettify<{
6
6
  account?: AccountParam;
7
- chainId?: number;
7
+ chain?: Pick<Chain, "id">;
8
8
  capabilities?: {
9
9
  paymaster?: {
10
10
  policyId: string;
11
11
  };
12
12
  };
13
13
  }>;
14
- export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
14
+ export type UndelegateAccountResult = Prettify<SendCallsResult>;
15
15
  /**
16
16
  * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
17
17
  * Gas is sponsored by Alchemy (requires Enterprise plan).
@@ -22,7 +22,7 @@ export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
22
22
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
23
23
  * @param {UndelegateAccountParams} params - Parameters for undelegating the account
24
24
  * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
25
- * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
25
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
26
26
  * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
27
27
  * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
28
28
  * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
@@ -1,10 +1,7 @@
1
+ import { zeroAddress } from "viem";
1
2
  import { LOGGER } from "../logger.js";
2
3
  import { resolveAddress } from "../utils/resolve.js";
3
- import { prepareCalls } from "./prepareCalls.js";
4
- import { signPreparedCalls } from "./signPreparedCalls.js";
5
- import { sendPreparedCalls, } from "./sendPreparedCalls.js";
6
- import { BaseError } from "@alchemy/common";
7
- import { extractCapabilitiesForSending } from "../utils/capabilities.js";
4
+ import { sendCalls } from "./sendCalls.js";
8
5
  /**
9
6
  * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
10
7
  * Gas is sponsored by Alchemy (requires Enterprise plan).
@@ -15,7 +12,7 @@ import { extractCapabilitiesForSending } from "../utils/capabilities.js";
15
12
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
16
13
  * @param {UndelegateAccountParams} params - Parameters for undelegating the account
17
14
  * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
18
- * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
15
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
19
16
  * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
20
17
  * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
21
18
  * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
@@ -33,33 +30,19 @@ export async function undelegateAccount(client, params) {
33
30
  : client.account.address;
34
31
  LOGGER.info("undelegateAccount:start", {
35
32
  account,
36
- chainId: params?.chainId,
33
+ chain: params?.chain,
37
34
  });
38
- // Step 1: Prepare zero-address delegation means "undelegate"
39
- const prepared = await prepareCalls(client, {
35
+ const result = await sendCalls(client, {
40
36
  calls: [],
41
37
  account,
42
- ...(params?.chainId != null ? { chainId: params.chainId } : {}),
38
+ ...(params?.chain != null ? { chain: params.chain } : {}),
43
39
  capabilities: {
44
40
  ...params?.capabilities,
45
41
  eip7702Auth: {
46
- delegation: "0x0000000000000000000000000000000000000000",
42
+ delegation: zeroAddress,
47
43
  },
48
44
  },
49
45
  });
50
- if (prepared.type !== "authorization") {
51
- throw new BaseError(`Unexpected response type from wallet_prepareCalls: expected "authorization", got "${prepared.type}"`);
52
- }
53
- LOGGER.debug("undelegateAccount:prepared");
54
- // Step 2: Sign
55
- const signedCalls = await signPreparedCalls(client, prepared);
56
- LOGGER.debug("undelegateAccount:signed");
57
- // Step 3: Send
58
- const sendCapabilities = extractCapabilitiesForSending(params?.capabilities);
59
- const result = await sendPreparedCalls(client, {
60
- ...signedCalls,
61
- ...(sendCapabilities != null ? { capabilities: sendCapabilities } : {}),
62
- });
63
46
  LOGGER.info("undelegateAccount:done", { id: result.id });
64
47
  return result;
65
48
  }
@@ -1 +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,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAczE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAAgC;IAEhC,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO;QAC7B,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAE3B,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QACrC,OAAO;QACP,OAAO,EAAE,MAAM,EAAE,OAAO;KACzB,CAAC,CAAC;IAEH,+DAA+D;IAC/D,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE;QAC1C,KAAK,EAAE,EAAE;QACT,OAAO;QACP,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,YAAY,EAAE;YACZ,GAAG,MAAM,EAAE,YAAY;YACvB,WAAW,EAAE;gBACX,UAAU,EAAE,4CAA4C;aACzD;SACF;KACF,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACtC,MAAM,IAAI,SAAS,CACjB,qFAAqF,QAAQ,CAAC,IAAI,GAAG,CACtG,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAE3C,eAAe;IACf,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE9D,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAEzC,eAAe;IACf,MAAM,gBAAgB,GAAG,6BAA6B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE;QAC7C,GAAG,WAAW;QACd,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxE,CAAC,CAAC;IAEH,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 { prepareCalls } from \"./prepareCalls.js\";\nimport { signPreparedCalls } from \"./signPreparedCalls.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsResult,\n} from \"./sendPreparedCalls.js\";\nimport { BaseError } from \"@alchemy/common\";\nimport { extractCapabilitiesForSending } from \"../utils/capabilities.js\";\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<SendPreparedCallsResult>;\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 account = params?.account\n ? resolveAddress(params.account)\n : client.account.address;\n\n LOGGER.info(\"undelegateAccount:start\", {\n account,\n chainId: params?.chainId,\n });\n\n // Step 1: Prepare — zero-address delegation means \"undelegate\"\n const prepared = await prepareCalls(client, {\n calls: [],\n account,\n ...(params?.chainId != null ? { chainId: params.chainId } : {}),\n capabilities: {\n ...params?.capabilities,\n eip7702Auth: {\n delegation: \"0x0000000000000000000000000000000000000000\",\n },\n },\n });\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\n const signedCalls = await signPreparedCalls(client, prepared);\n\n LOGGER.debug(\"undelegateAccount:signed\");\n\n // Step 3: Send\n const sendCapabilities = extractCapabilitiesForSending(params?.capabilities);\n\n const result = await sendPreparedCalls(client, {\n ...signedCalls,\n ...(sendCapabilities != null ? { capabilities: sendCapabilities } : {}),\n });\n\n LOGGER.info(\"undelegateAccount:done\", { id: result.id });\n return result;\n}\n"]}
1
+ {"version":3,"file":"undelegateAccount.js","sourceRoot":"","sources":["../../../src/actions/undelegateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6B,MAAM,MAAM,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAwB,MAAM,gBAAgB,CAAC;AAcjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAAgC;IAEhC,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO;QAC7B,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAE3B,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QACrC,OAAO;QACP,KAAK,EAAE,MAAM,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE;QACrC,KAAK,EAAE,EAAE;QACT,OAAO;QACP,GAAG,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,YAAY,EAAE;YACZ,GAAG,MAAM,EAAE,YAAY;YACvB,WAAW,EAAE;gBACX,UAAU,EAAE,WAAW;aACxB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { zeroAddress, type Chain, type Prettify } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport { LOGGER } from \"../logger.js\";\nimport { resolveAddress, type AccountParam } from \"../utils/resolve.js\";\nimport { sendCalls, type SendCallsResult } from \"./sendCalls.js\";\n\nexport type UndelegateAccountParams = Prettify<{\n account?: AccountParam;\n chain?: Pick<Chain, \"id\">;\n capabilities?: {\n paymaster?: {\n policyId: string;\n };\n };\n}>;\n\nexport type UndelegateAccountResult = Prettify<SendCallsResult>;\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 {object} [params.chain] - The chain. 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 account = params?.account\n ? resolveAddress(params.account)\n : client.account.address;\n\n LOGGER.info(\"undelegateAccount:start\", {\n account,\n chain: params?.chain,\n });\n\n const result = await sendCalls(client, {\n calls: [],\n account,\n ...(params?.chain != null ? { chain: params.chain } : {}),\n capabilities: {\n ...params?.capabilities,\n eip7702Auth: {\n delegation: zeroAddress,\n },\n },\n });\n\n LOGGER.info(\"undelegateAccount:done\", { id: result.id });\n return result;\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "5.0.0-beta.20";
1
+ export declare const VERSION = "5.0.0-beta.21";
@@ -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.20";
3
+ export const VERSION = "5.0.0-beta.21";
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,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.20\";\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.21\";\n"]}
@@ -1,17 +1,17 @@
1
- import type { Prettify } from "viem";
1
+ import { type Chain, type Prettify } from "viem";
2
2
  import type { InnerWalletApiClient } from "../types.js";
3
3
  import { type AccountParam } from "../utils/resolve.js";
4
- import { type SendPreparedCallsResult } from "./sendPreparedCalls.js";
4
+ import { type SendCallsResult } from "./sendCalls.js";
5
5
  export type UndelegateAccountParams = Prettify<{
6
6
  account?: AccountParam;
7
- chainId?: number;
7
+ chain?: Pick<Chain, "id">;
8
8
  capabilities?: {
9
9
  paymaster?: {
10
10
  policyId: string;
11
11
  };
12
12
  };
13
13
  }>;
14
- export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
14
+ export type UndelegateAccountResult = Prettify<SendCallsResult>;
15
15
  /**
16
16
  * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
17
17
  * Gas is sponsored by Alchemy (requires Enterprise plan).
@@ -22,7 +22,7 @@ export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
22
22
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
23
23
  * @param {UndelegateAccountParams} params - Parameters for undelegating the account
24
24
  * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
25
- * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
25
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
26
26
  * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
27
27
  * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
28
28
  * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
@@ -1 +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;AAGxE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAIhC,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,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CA8ClC"}
1
+ {"version":3,"file":"undelegateAccount.d.ts","sourceRoot":"","sources":["../../../src/actions/undelegateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,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,eAAe,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAwBlC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.0.0-beta.20";
1
+ export declare const VERSION = "5.0.0-beta.21";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/wallet-apis",
3
- "version": "5.0.0-beta.21",
3
+ "version": "5.0.0-beta.22",
4
4
  "description": "Alchemy Wallet APIs",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "viem": "^2.45.0"
56
56
  },
57
57
  "dependencies": {
58
- "@alchemy/common": "5.0.0-beta.21",
58
+ "@alchemy/common": "5.0.0-beta.22",
59
59
  "@alchemy/wallet-api-types": "^0.1.0-alpha.27",
60
60
  "deep-equal": "^2.2.3",
61
61
  "ox": "^0.11.1",
@@ -76,5 +76,5 @@
76
76
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
77
77
  },
78
78
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
79
- "gitHead": "f7b6c8132c10a86488ea3ebbe73dce14965fe669"
79
+ "gitHead": "cd83c2c18bd4de73dfbf56cef2516a4e45ef31ba"
80
80
  }
@@ -1,19 +1,12 @@
1
- import type { Prettify } from "viem";
1
+ import { zeroAddress, type Chain, type Prettify } from "viem";
2
2
  import type { InnerWalletApiClient } from "../types.js";
3
3
  import { LOGGER } from "../logger.js";
4
4
  import { resolveAddress, type AccountParam } from "../utils/resolve.js";
5
- import { prepareCalls } from "./prepareCalls.js";
6
- import { signPreparedCalls } from "./signPreparedCalls.js";
7
- import {
8
- sendPreparedCalls,
9
- type SendPreparedCallsResult,
10
- } from "./sendPreparedCalls.js";
11
- import { BaseError } from "@alchemy/common";
12
- import { extractCapabilitiesForSending } from "../utils/capabilities.js";
5
+ import { sendCalls, type SendCallsResult } from "./sendCalls.js";
13
6
 
14
7
  export type UndelegateAccountParams = Prettify<{
15
8
  account?: AccountParam;
16
- chainId?: number;
9
+ chain?: Pick<Chain, "id">;
17
10
  capabilities?: {
18
11
  paymaster?: {
19
12
  policyId: string;
@@ -21,7 +14,7 @@ export type UndelegateAccountParams = Prettify<{
21
14
  };
22
15
  }>;
23
16
 
24
- export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
17
+ export type UndelegateAccountResult = Prettify<SendCallsResult>;
25
18
 
26
19
  /**
27
20
  * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
@@ -33,7 +26,7 @@ export type UndelegateAccountResult = Prettify<SendPreparedCallsResult>;
33
26
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
34
27
  * @param {UndelegateAccountParams} params - Parameters for undelegating the account
35
28
  * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
36
- * @param {number} [params.chainId] - The chain ID. Defaults to the client's chain.
29
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
37
30
  * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
38
31
  * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
39
32
  * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
@@ -55,43 +48,21 @@ export async function undelegateAccount(
55
48
 
56
49
  LOGGER.info("undelegateAccount:start", {
57
50
  account,
58
- chainId: params?.chainId,
51
+ chain: params?.chain,
59
52
  });
60
53
 
61
- // Step 1: Prepare zero-address delegation means "undelegate"
62
- const prepared = await prepareCalls(client, {
54
+ const result = await sendCalls(client, {
63
55
  calls: [],
64
56
  account,
65
- ...(params?.chainId != null ? { chainId: params.chainId } : {}),
57
+ ...(params?.chain != null ? { chain: params.chain } : {}),
66
58
  capabilities: {
67
59
  ...params?.capabilities,
68
60
  eip7702Auth: {
69
- delegation: "0x0000000000000000000000000000000000000000",
61
+ delegation: zeroAddress,
70
62
  },
71
63
  },
72
64
  });
73
65
 
74
- if (prepared.type !== "authorization") {
75
- throw new BaseError(
76
- `Unexpected response type from wallet_prepareCalls: expected "authorization", got "${prepared.type}"`,
77
- );
78
- }
79
-
80
- LOGGER.debug("undelegateAccount:prepared");
81
-
82
- // Step 2: Sign
83
- const signedCalls = await signPreparedCalls(client, prepared);
84
-
85
- LOGGER.debug("undelegateAccount:signed");
86
-
87
- // Step 3: Send
88
- const sendCapabilities = extractCapabilitiesForSending(params?.capabilities);
89
-
90
- const result = await sendPreparedCalls(client, {
91
- ...signedCalls,
92
- ...(sendCapabilities != null ? { capabilities: sendCapabilities } : {}),
93
- });
94
-
95
66
  LOGGER.info("undelegateAccount:done", { id: result.id });
96
67
  return result;
97
68
  }
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.21";
3
+ export const VERSION = "5.0.0-beta.22";