@account-kit/wallet-client 4.64.0 → 4.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/actions/prepareCalls.js +3 -6
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/index.d.ts +2 -2
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/experimental/actions/requestQuoteV0.d.ts +11 -0
- package/dist/esm/experimental/actions/requestQuoteV0.js +24 -0
- package/dist/esm/experimental/actions/requestQuoteV0.js.map +1 -0
- package/dist/esm/experimental/swapActionsDecorator.d.ts +7 -0
- package/dist/esm/experimental/swapActionsDecorator.js +5 -0
- package/dist/esm/experimental/swapActionsDecorator.js.map +1 -0
- package/dist/esm/exports/experimental.d.ts +4 -0
- package/dist/esm/exports/experimental.js +7 -0
- package/dist/esm/exports/experimental.js.map +1 -0
- package/dist/esm/exports/index.d.ts +14 -0
- package/dist/esm/exports/index.js +0 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/internal/capabilities.d.ts +10 -0
- package/dist/esm/internal/capabilities.js +19 -0
- package/dist/esm/internal/capabilities.js.map +1 -0
- 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/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +2 -2
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/experimental/actions/requestQuoteV0.d.ts +12 -0
- package/dist/types/experimental/actions/requestQuoteV0.d.ts.map +1 -0
- package/dist/types/experimental/swapActionsDecorator.d.ts +8 -0
- package/dist/types/experimental/swapActionsDecorator.d.ts.map +1 -0
- package/dist/types/exports/experimental.d.ts +5 -0
- package/dist/types/exports/experimental.d.ts.map +1 -0
- package/dist/types/exports/index.d.ts +14 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/internal/capabilities.d.ts +11 -0
- package/dist/types/internal/capabilities.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -6
- package/src/client/actions/prepareCalls.ts +3 -6
- package/src/client/index.ts +2 -2
- package/src/experimental/actions/requestQuoteV0.ts +56 -0
- package/src/experimental/swapActionsDecorator.ts +23 -0
- package/src/exports/experimental.ts +10 -0
- package/src/exports/index.ts +14 -0
- package/src/internal/capabilities.ts +24 -0
- package/src/version.ts +1 -1
|
@@ -2,6 +2,7 @@ import { AccountNotFoundError } from "@aa-sdk/core";
|
|
|
2
2
|
import { toHex } from "viem";
|
|
3
3
|
import { wallet_prepareCalls } from "@alchemy/wallet-api-types/rpc";
|
|
4
4
|
import { metrics } from "../../metrics.js";
|
|
5
|
+
import { mergeClientCapabilities } from "../../internal/capabilities.js";
|
|
5
6
|
/**
|
|
6
7
|
* Prepares a set of contract calls for execution by building a user operation.
|
|
7
8
|
* Returns the built user operation and a signature request that needs to be signed
|
|
@@ -38,12 +39,7 @@ export async function prepareCalls(client, params) {
|
|
|
38
39
|
if (!from) {
|
|
39
40
|
throw new AccountNotFoundError();
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
params.capabilities = {
|
|
43
|
-
...params.capabilities,
|
|
44
|
-
paymasterService: { policyIds: client.policyIds },
|
|
45
|
-
};
|
|
46
|
-
}
|
|
42
|
+
const capabilities = mergeClientCapabilities(client, params.capabilities);
|
|
47
43
|
return await client.request({
|
|
48
44
|
method: "wallet_prepareCalls",
|
|
49
45
|
params: [
|
|
@@ -51,6 +47,7 @@ export async function prepareCalls(client, params) {
|
|
|
51
47
|
...params,
|
|
52
48
|
chainId: toHex(client.chain.id),
|
|
53
49
|
from,
|
|
50
|
+
capabilities,
|
|
54
51
|
},
|
|
55
52
|
],
|
|
56
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAqBzE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAGhC,MAA4B,EAC5B,MAAoC;IAEpC,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,eAAe;KACtB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,YAAY,GAAG,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAE1E,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE;YACN;gBACE,GAAG,MAAM;gBACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI;gBACJ,YAAY;aACb;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { AccountNotFoundError } from \"@aa-sdk/core\";\nimport { toHex, type Address, type IsUndefined } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_prepareCalls } from \"@alchemy/wallet-api-types/rpc\";\nimport { metrics } from \"../../metrics.js\";\nimport { mergeClientCapabilities } from \"../../internal/capabilities.js\";\n\nexport type GetAccountParam<TAccount> =\n IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: Address };\n\nexport type PrepareCallsParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"from\" | \"chainId\"\n> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type PrepareCallsResult = Static<\n typeof wallet_prepareCalls\n>[\"ReturnType\"];\n\n/**\n * Prepares a set of contract calls for execution by building a user operation.\n * Returns the built user operation and a signature request that needs to be signed\n * before submitting to sendPreparedCalls.\n *\n * @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request\n * @param {PrepareCallsParams<TAccount>} params - Parameters for preparing 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. See [API documentation](/wallets/api-reference/smart-wallets/wallet-api-endpoints/wallet-api-endpoints/wallet-prepare-calls#request.body.prepareCallsRequest.capabilities) for details.\n * @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing\n * the user operation data and signature request\n *\n * @example\n * ```ts\n * // Prepare a sponsored user operation call\n * const result = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n * ```\n */\nexport async function prepareCalls<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n params: PrepareCallsParams<TAccount>,\n): Promise<PrepareCallsResult> {\n metrics.trackEvent({\n name: \"prepare_calls\",\n });\n\n const from = params.from ?? client.account?.address;\n if (!from) {\n throw new AccountNotFoundError();\n }\n\n const capabilities = mergeClientCapabilities(client, params.capabilities);\n\n return await client.request({\n method: \"wallet_prepareCalls\",\n params: [\n {\n ...params,\n chainId: toHex(client.chain.id),\n from,\n capabilities,\n },\n ],\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
3
3
|
import { type Address, type Chain, type Prettify } from "viem";
|
|
4
|
-
import type {
|
|
4
|
+
import type { InnerWalletApiClientBase } from "../types.ts";
|
|
5
5
|
import { type SmartWalletActions } from "./decorator.js";
|
|
6
6
|
export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
|
|
7
7
|
transport: AlchemyTransport;
|
|
@@ -15,7 +15,7 @@ export type SmartWalletClientParams<TAccount extends Address | undefined = Addre
|
|
|
15
15
|
policyIds?: string[];
|
|
16
16
|
policyId?: never;
|
|
17
17
|
})>;
|
|
18
|
-
export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> =
|
|
18
|
+
export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> = InnerWalletApiClientBase<SmartWalletActions<TAccount>>;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a smart wallet client that can be used to interact with a smart account.
|
|
21
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,YAAY,EACZ,MAAM,GACP,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAqDxC,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ;QAC/B,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC,SAAS;YAChB,CAAC,CAAC,MAAM,CAAC,SAAS;YAClB,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,WAAW,GAAG,YAAY,CAAC;QAC/B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,SAAS;QACT,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport {\n type Address,\n type Chain,\n type Prettify,\n createClient,\n custom,\n} from \"viem\";\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,YAAY,EACZ,MAAM,GACP,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAqDxC,MAAM,UAAU,uBAAuB,CACrC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ;QAC/B,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC,SAAS;YAChB,CAAC,CAAC,MAAM,CAAC,SAAS;YAClB,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,WAAW,GAAG,YAAY,CAAC;QAC/B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,SAAS;QACT,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,UAAU,CAAC;QACjB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport {\n type Address,\n type Chain,\n type Prettify,\n createClient,\n custom,\n} from \"viem\";\nimport type { InnerWalletApiClientBase } from \"../types.ts\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\nimport { Provider } from \"ox\";\nimport { WalletServerRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { metrics } from \"../metrics.js\";\n\nexport type SmartWalletClientParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Prettify<\n {\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartAccountSigner;\n account?: TAccount | Address | undefined;\n } & (\n | { policyId?: string; policyIds?: never }\n | { policyIds?: string[]; policyId?: never }\n )\n>;\n\nexport type SmartWalletClient<\n TAccount extends Address | undefined = Address | undefined,\n> = InnerWalletApiClientBase<SmartWalletActions<TAccount>>;\n\n/**\n * Creates a smart wallet client that can be used to interact with a smart account.\n *\n * @param {SmartWalletClientParams} params - The parameters for creating the smart wallet client\n * @param {AlchemyTransport} params.transport - The Alchemy transport to use\n * @param {Chain} params.chain - The chain to use\n * @param {SmartAccountSigner} params.signer - The signer to use for the smart account\n * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)\n * @param {Address} [params.account] - The smart account address to use (optional)\n * @returns {SmartWalletClient} - A viem-compatible client\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\n * import { generatePrivateKey } from \"viem/accounts\";\n * import { createSmartWalletClient } from \"@account-kit/wallet-client\";\n *\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey());\n * const transport = alchemy({\n * apiKey: \"your-alchemy-api-key\",\n * });\n * const client = createSmartWalletClient({\n * transport,\n * chain: arbitrumSepolia,\n * signer,\n * });\n * ```\n */\nexport function createSmartWalletClient<\n TAccount extends Address | undefined = undefined,\n>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;\n\nexport function createSmartWalletClient(\n params: SmartWalletClientParams,\n): SmartWalletClient {\n const { transport, chain, account, signer } = params;\n\n const policyIds = params.policyId\n ? [params.policyId]\n : params.policyIds\n ? params.policyIds\n : undefined;\n\n const innerClient = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n }).extend(() => ({\n policyIds,\n internal: internalStateDecorator(),\n }));\n\n metrics.trackEvent({\n name: \"client_created\",\n data: {\n chainId: params.chain.id,\n },\n });\n\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import { type Address, type IsUndefined, type Prettify, type UnionOmit } from "viem";
|
|
3
|
+
import type { wallet_requestQuote_v0 } from "@alchemy/wallet-api-types/rpc";
|
|
4
|
+
import type { InnerWalletApiClientBase } from "../../types.js";
|
|
5
|
+
export type RequestQuoteV0Params<TAccount extends Address | undefined = Address | undefined> = Prettify<UnionOmit<Static<(typeof wallet_requestQuote_v0)["properties"]["Request"]["properties"]["params"]>[0], "from" | "chainId">> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuoteV0Result = Prettify<Static<typeof wallet_requestQuote_v0>["ReturnType"]>;
|
|
11
|
+
export declare function requestQuoteV0<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClientBase, params: RequestQuoteV0Params<TAccount>): Promise<RequestQuoteV0Result>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toHex, } from "viem";
|
|
2
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
3
|
+
import { mergeClientCapabilities } from "../../internal/capabilities.js";
|
|
4
|
+
export async function requestQuoteV0(client, params) {
|
|
5
|
+
const from = params.from ?? client.account?.address;
|
|
6
|
+
if (!from) {
|
|
7
|
+
throw new AccountNotFoundError();
|
|
8
|
+
}
|
|
9
|
+
const capabilities = params.returnRawCalls
|
|
10
|
+
? undefined
|
|
11
|
+
: mergeClientCapabilities(client, params.capabilities);
|
|
12
|
+
return await client.request({
|
|
13
|
+
method: "wallet_requestQuote_v0",
|
|
14
|
+
params: [
|
|
15
|
+
{
|
|
16
|
+
...params,
|
|
17
|
+
chainId: toHex(client.chain.id),
|
|
18
|
+
from,
|
|
19
|
+
...(capabilities && { capabilities }),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=requestQuoteV0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestQuoteV0.js","sourceRoot":"","sources":["../../../../src/experimental/actions/requestQuoteV0.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,GAKN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAkBzE,MAAM,CAAC,KAAK,UAAU,cAAc,CAGlC,MAAgC,EAChC,MAAsC;IAEtC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc;QACxC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,wBAAwB;QAChC,MAAM,EAAE;YACN;gBACE,GAAG,MAAM;gBACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI;gBACJ,GAAG,CAAC,YAAY,IAAI,EAAE,YAAY,EAAE,CAAC;aACtC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport {\n toHex,\n type Address,\n type IsUndefined,\n type Prettify,\n type UnionOmit,\n} from \"viem\";\nimport type { wallet_requestQuote_v0 } from \"@alchemy/wallet-api-types/rpc\";\nimport type { InnerWalletApiClientBase } from \"../../types.js\";\nimport { AccountNotFoundError } from \"@aa-sdk/core\";\nimport { mergeClientCapabilities } from \"../../internal/capabilities.js\";\n\nexport type RequestQuoteV0Params<\n TAccount extends Address | undefined = Address | undefined,\n> = Prettify<\n UnionOmit<\n Static<\n (typeof wallet_requestQuote_v0)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"from\" | \"chainId\"\n >\n> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type RequestQuoteV0Result = Prettify<\n Static<typeof wallet_requestQuote_v0>[\"ReturnType\"]\n>;\n\nexport async function requestQuoteV0<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClientBase,\n params: RequestQuoteV0Params<TAccount>,\n): Promise<RequestQuoteV0Result> {\n const from = params.from ?? client.account?.address;\n if (!from) {\n throw new AccountNotFoundError();\n }\n\n const capabilities = params.returnRawCalls\n ? undefined\n : mergeClientCapabilities(client, params.capabilities);\n\n return await client.request({\n method: \"wallet_requestQuote_v0\",\n params: [\n {\n ...params,\n chainId: toHex(client.chain.id),\n from,\n ...(capabilities && { capabilities }),\n },\n ],\n });\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import { type RequestQuoteV0Params, type RequestQuoteV0Result } from "./actions/requestQuoteV0.js";
|
|
3
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
4
|
+
export type SwapActions<TAccount extends Address | undefined = Address | undefined> = {
|
|
5
|
+
requestQuoteV0: (params: RequestQuoteV0Params<TAccount>) => Promise<RequestQuoteV0Result>;
|
|
6
|
+
};
|
|
7
|
+
export declare const swapActions: <TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClientBase) => SwapActions<TAccount>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapActionsDecorator.js","sourceRoot":"","sources":["../../../src/experimental/swapActionsDecorator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AAWrC,MAAM,CAAC,MAAM,WAAW,GAIK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3D,CAAC,CAAC","sourcesContent":["import type { Address } from \"viem\";\nimport {\n requestQuoteV0,\n type RequestQuoteV0Params,\n type RequestQuoteV0Result,\n} from \"./actions/requestQuoteV0.js\";\nimport type { InnerWalletApiClientBase } from \"../types.js\";\n\nexport type SwapActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestQuoteV0: (\n params: RequestQuoteV0Params<TAccount>,\n ) => Promise<RequestQuoteV0Result>;\n};\n\nexport const swapActions: <\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClientBase,\n) => SwapActions<TAccount> = (client) => ({\n requestQuoteV0: (params) => requestQuoteV0(client, params),\n});\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { requestQuoteV0 } from "../experimental/actions/requestQuoteV0.js";
|
|
2
|
+
export { type RequestQuoteV0Params, type RequestQuoteV0Result, } from "../experimental/actions/requestQuoteV0.js";
|
|
3
|
+
export { swapActions } from "../experimental/swapActionsDecorator.js";
|
|
4
|
+
export { type SwapActions } from "../experimental/swapActionsDecorator.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// individual actions
|
|
2
|
+
export { requestQuoteV0 } from "../experimental/actions/requestQuoteV0.js";
|
|
3
|
+
export {} from "../experimental/actions/requestQuoteV0.js";
|
|
4
|
+
// decorator
|
|
5
|
+
export { swapActions } from "../experimental/swapActionsDecorator.js";
|
|
6
|
+
export {} from "../experimental/swapActionsDecorator.js";
|
|
7
|
+
//# sourceMappingURL=experimental.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimental.js","sourceRoot":"","sources":["../../../src/exports/experimental.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAGN,MAAM,2CAA2C,CAAC;AAEnD,YAAY;AACZ,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAoB,MAAM,yCAAyC,CAAC","sourcesContent":["// individual actions\nexport { requestQuoteV0 } from \"../experimental/actions/requestQuoteV0.js\";\nexport {\n type RequestQuoteV0Params,\n type RequestQuoteV0Result,\n} from \"../experimental/actions/requestQuoteV0.js\";\n\n// decorator\nexport { swapActions } from \"../experimental/swapActionsDecorator.js\";\nexport { type SwapActions } from \"../experimental/swapActionsDecorator.js\";\n"]}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
export { createSmartWalletClient, type SmartWalletClient, type SmartWalletClientParams, } from "../client/index.js";
|
|
2
2
|
export { WalletServerRpcSchema, type WalletServerRpcSchemaType, } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
export type * from "../client/actions/getCallsStatus.js";
|
|
3
4
|
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
5
|
+
export type * from "../client/actions/grantPermissions.js";
|
|
4
6
|
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
7
|
+
export type * from "../client/actions/listAccounts.js";
|
|
5
8
|
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
9
|
+
export type * from "../client/actions/prepareCalls.js";
|
|
6
10
|
export { prepareCalls } from "../client/actions/prepareCalls.js";
|
|
11
|
+
export type * from "../client/actions/requestAccount.js";
|
|
7
12
|
export { requestAccount } from "../client/actions/requestAccount.js";
|
|
13
|
+
export type * from "../client/actions/signSignatureRequest.js";
|
|
8
14
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
15
|
+
export type * from "../client/actions/signPreparedCalls.js";
|
|
9
16
|
export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
17
|
+
export type * from "../client/actions/signMessage.js";
|
|
10
18
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
19
|
+
export type * from "../client/actions/signTypedData.js";
|
|
11
20
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
21
|
+
export type * from "../client/actions/sendPreparedCalls.js";
|
|
12
22
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
23
|
+
export type * from "../client/actions/sendCalls.js";
|
|
13
24
|
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
25
|
+
export type * from "../client/actions/waitForCallsStatus.js";
|
|
14
26
|
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
27
|
+
export type * from "../client/actions/prepareSign.js";
|
|
15
28
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
29
|
+
export type * from "../client/actions/formatSign.js";
|
|
16
30
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// and we shouldn't export * for the sake of tree-shaking
|
|
3
3
|
export { createSmartWalletClient, } from "../client/index.js";
|
|
4
4
|
export { WalletServerRpcSchema, } from "@alchemy/wallet-api-types/rpc";
|
|
5
|
-
// client actions
|
|
6
5
|
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
7
6
|
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
8
7
|
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
@@ -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;
|
|
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;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/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 type * from \"../client/actions/getCallsStatus.js\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport type * from \"../client/actions/grantPermissions.js\";\nexport { grantPermissions } from \"../client/actions/grantPermissions.js\";\nexport type * from \"../client/actions/listAccounts.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport type * from \"../client/actions/prepareCalls.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport type * from \"../client/actions/requestAccount.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport type * from \"../client/actions/signSignatureRequest.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport type * from \"../client/actions/signPreparedCalls.js\";\nexport { signPreparedCalls } from \"../client/actions/signPreparedCalls.js\";\nexport type * from \"../client/actions/signMessage.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport type * from \"../client/actions/signTypedData.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\nexport type * from \"../client/actions/sendPreparedCalls.js\";\nexport { sendPreparedCalls } from \"../client/actions/sendPreparedCalls.js\";\nexport type * from \"../client/actions/sendCalls.js\";\nexport { sendCalls } from \"../client/actions/sendCalls.js\";\nexport type * from \"../client/actions/waitForCallsStatus.js\";\nexport { waitForCallsStatus } from \"../client/actions/waitForCallsStatus.js\";\nexport type * from \"../client/actions/prepareSign.js\";\nexport { prepareSign } from \"../client/actions/prepareSign.js\";\nexport type * from \"../client/actions/formatSign.js\";\nexport { formatSign } from \"../client/actions/formatSign.js\";\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Capabilities } from "@alchemy/wallet-api-types/capabilities";
|
|
2
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merges client capabilities with capabilities from the request.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClientBase} client - The inner wallet API client (potentially including global capabilities like policy IDs)
|
|
7
|
+
* @param {Capabilities | undefined} capabilities - Request capabilities to merge with, if any
|
|
8
|
+
* @returns {Capabilities | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client
|
|
9
|
+
*/
|
|
10
|
+
export declare const mergeClientCapabilities: (client: InnerWalletApiClientBase, capabilities: Capabilities | undefined) => Capabilities | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges client capabilities with capabilities from the request.
|
|
3
|
+
*
|
|
4
|
+
* @param {InnerWalletApiClientBase} client - The inner wallet API client (potentially including global capabilities like policy IDs)
|
|
5
|
+
* @param {Capabilities | undefined} capabilities - Request capabilities to merge with, if any
|
|
6
|
+
* @returns {Capabilities | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client
|
|
7
|
+
*/
|
|
8
|
+
export const mergeClientCapabilities = (client, capabilities) => {
|
|
9
|
+
return client.policyIds?.length
|
|
10
|
+
? {
|
|
11
|
+
...capabilities,
|
|
12
|
+
paymasterService: {
|
|
13
|
+
policyIds: client.policyIds,
|
|
14
|
+
...capabilities?.paymasterService,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
: capabilities;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/internal/capabilities.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAAgC,EAChC,YAAsC,EACZ,EAAE;IAC5B,OAAO,MAAM,CAAC,SAAS,EAAE,MAAM;QAC7B,CAAC,CAAC;YACE,GAAG,YAAY;YACf,gBAAgB,EAAE;gBAChB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,GAAG,YAAY,EAAE,gBAAgB;aAClC;SACF;QACH,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type { Capabilities } from \"@alchemy/wallet-api-types/capabilities\";\nimport type { InnerWalletApiClientBase } from \"../types.js\";\n\n/**\n * Merges client capabilities with capabilities from the request.\n *\n * @param {InnerWalletApiClientBase} client - The inner wallet API client (potentially including global capabilities like policy IDs)\n * @param {Capabilities | undefined} capabilities - Request capabilities to merge with, if any\n * @returns {Capabilities | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client\n */\nexport const mergeClientCapabilities = (\n client: InnerWalletApiClientBase,\n capabilities: Capabilities | undefined,\n): Capabilities | undefined => {\n return client.policyIds?.length\n ? {\n ...capabilities,\n paymasterService: {\n policyIds: client.policyIds,\n ...capabilities?.paymasterService,\n },\n }\n : capabilities;\n};\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.66.0";
|
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,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.
|
|
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.66.0\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,MAAM,MAAM,eAAe,CAAC,QAAQ,IAClC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC9B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GACpB;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5B,MAAM,MAAM,kBAAkB,CAC5B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CACN,MAAM,CACJ,CAAC,OAAO,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9E,CAAC,CAAC,CAAC,EACJ,MAAM,GAAG,SAAS,CACnB,GACC,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,OAAO,mBAAmB,CAC3B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACnC,OAAO,CAAC,kBAAkB,CAAC,CAuB7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
3
3
|
import { type Address, type Chain, type Prettify } from "viem";
|
|
4
|
-
import type {
|
|
4
|
+
import type { InnerWalletApiClientBase } from "../types.ts";
|
|
5
5
|
import { type SmartWalletActions } from "./decorator.js";
|
|
6
6
|
export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
|
|
7
7
|
transport: AlchemyTransport;
|
|
@@ -15,7 +15,7 @@ export type SmartWalletClientParams<TAccount extends Address | undefined = Addre
|
|
|
15
15
|
policyIds?: string[];
|
|
16
16
|
policyId?: never;
|
|
17
17
|
})>;
|
|
18
|
-
export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> =
|
|
18
|
+
export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> = InnerWalletApiClientBase<SmartWalletActions<TAccount>>;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a smart wallet client that can be used to interact with a smart account.
|
|
21
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,QAAQ,EAGd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,QAAQ,EAGd,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,QAAQ,CACV;IACE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1C,GAAG,CACA;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,GACxC;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAC7C,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC3B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import { type Address, type IsUndefined, type Prettify, type UnionOmit } from "viem";
|
|
3
|
+
import type { wallet_requestQuote_v0 } from "@alchemy/wallet-api-types/rpc";
|
|
4
|
+
import type { InnerWalletApiClientBase } from "../../types.js";
|
|
5
|
+
export type RequestQuoteV0Params<TAccount extends Address | undefined = Address | undefined> = Prettify<UnionOmit<Static<(typeof wallet_requestQuote_v0)["properties"]["Request"]["properties"]["params"]>[0], "from" | "chainId">> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuoteV0Result = Prettify<Static<typeof wallet_requestQuote_v0>["ReturnType"]>;
|
|
11
|
+
export declare function requestQuoteV0<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClientBase, params: RequestQuoteV0Params<TAccount>): Promise<RequestQuoteV0Result>;
|
|
12
|
+
//# sourceMappingURL=requestQuoteV0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestQuoteV0.d.ts","sourceRoot":"","sources":["../../../../src/experimental/actions/requestQuoteV0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAI/D,MAAM,MAAM,oBAAoB,CAC9B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,QAAQ,CACV,SAAS,CACP,MAAM,CACJ,CAAC,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CACjF,CAAC,CAAC,CAAC,EACJ,MAAM,GAAG,SAAS,CACnB,CACF,GACC,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CACzC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CACpD,CAAC;AAEF,wBAAsB,cAAc,CAClC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAqB/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import { type RequestQuoteV0Params, type RequestQuoteV0Result } from "./actions/requestQuoteV0.js";
|
|
3
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
4
|
+
export type SwapActions<TAccount extends Address | undefined = Address | undefined> = {
|
|
5
|
+
requestQuoteV0: (params: RequestQuoteV0Params<TAccount>) => Promise<RequestQuoteV0Result>;
|
|
6
|
+
};
|
|
7
|
+
export declare const swapActions: <TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClientBase) => SwapActions<TAccount>;
|
|
8
|
+
//# sourceMappingURL=swapActionsDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapActionsDecorator.d.ts","sourceRoot":"","sources":["../../../src/experimental/swapActionsDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD;IACF,cAAc,EAAE,CACd,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,KACnC,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,CACxB,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,wBAAwB,KAC7B,WAAW,CAAC,QAAQ,CAEvB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { requestQuoteV0 } from "../experimental/actions/requestQuoteV0.js";
|
|
2
|
+
export { type RequestQuoteV0Params, type RequestQuoteV0Result, } from "../experimental/actions/requestQuoteV0.js";
|
|
3
|
+
export { swapActions } from "../experimental/swapActionsDecorator.js";
|
|
4
|
+
export { type SwapActions } from "../experimental/swapActionsDecorator.js";
|
|
5
|
+
//# sourceMappingURL=experimental.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../../../src/exports/experimental.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
export { createSmartWalletClient, type SmartWalletClient, type SmartWalletClientParams, } from "../client/index.js";
|
|
2
2
|
export { WalletServerRpcSchema, type WalletServerRpcSchemaType, } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
export type * from "../client/actions/getCallsStatus.js";
|
|
3
4
|
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
5
|
+
export type * from "../client/actions/grantPermissions.js";
|
|
4
6
|
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
7
|
+
export type * from "../client/actions/listAccounts.js";
|
|
5
8
|
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
9
|
+
export type * from "../client/actions/prepareCalls.js";
|
|
6
10
|
export { prepareCalls } from "../client/actions/prepareCalls.js";
|
|
11
|
+
export type * from "../client/actions/requestAccount.js";
|
|
7
12
|
export { requestAccount } from "../client/actions/requestAccount.js";
|
|
13
|
+
export type * from "../client/actions/signSignatureRequest.js";
|
|
8
14
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
15
|
+
export type * from "../client/actions/signPreparedCalls.js";
|
|
9
16
|
export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
17
|
+
export type * from "../client/actions/signMessage.js";
|
|
10
18
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
19
|
+
export type * from "../client/actions/signTypedData.js";
|
|
11
20
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
21
|
+
export type * from "../client/actions/sendPreparedCalls.js";
|
|
12
22
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
23
|
+
export type * from "../client/actions/sendCalls.js";
|
|
13
24
|
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
25
|
+
export type * from "../client/actions/waitForCallsStatus.js";
|
|
14
26
|
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
27
|
+
export type * from "../client/actions/prepareSign.js";
|
|
15
28
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
29
|
+
export type * from "../client/actions/formatSign.js";
|
|
16
30
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
17
31
|
//# 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,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"}
|
|
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,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,mBAAmB,uCAAuC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,mBAAmB,mCAAmC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,mBAAmB,mCAAmC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,mBAAmB,2CAA2C,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,mBAAmB,wCAAwC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,mBAAmB,kCAAkC,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,mBAAmB,oCAAoC,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,mBAAmB,wCAAwC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,mBAAmB,gCAAgC,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,mBAAmB,yCAAyC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,mBAAmB,kCAAkC,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,mBAAmB,iCAAiC,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Capabilities } from "@alchemy/wallet-api-types/capabilities";
|
|
2
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merges client capabilities with capabilities from the request.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClientBase} client - The inner wallet API client (potentially including global capabilities like policy IDs)
|
|
7
|
+
* @param {Capabilities | undefined} capabilities - Request capabilities to merge with, if any
|
|
8
|
+
* @returns {Capabilities | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client
|
|
9
|
+
*/
|
|
10
|
+
export declare const mergeClientCapabilities: (client: InnerWalletApiClientBase, capabilities: Capabilities | undefined) => Capabilities | undefined;
|
|
11
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/internal/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,wBAAwB,EAChC,cAAc,YAAY,GAAG,SAAS,KACrC,YAAY,GAAG,SAUjB,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.66.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/wallet-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.66.0",
|
|
4
4
|
"description": "Wallet Client for Alchemy Account Kit",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"require": "./dist/esm/exports/index.js",
|
|
29
29
|
"import": "./dist/esm/exports/index.js"
|
|
30
30
|
},
|
|
31
|
+
"./experimental": {
|
|
32
|
+
"types": "./dist/types/exports/experimental.d.ts",
|
|
33
|
+
"import": "./dist/esm/exports/experimental.js",
|
|
34
|
+
"default": "./dist/esm/exports/experimental.js"
|
|
35
|
+
},
|
|
31
36
|
"./package.json": "./package.json"
|
|
32
37
|
},
|
|
33
38
|
"scripts": {
|
|
@@ -36,13 +41,12 @@
|
|
|
36
41
|
"build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm",
|
|
37
42
|
"build:types": "tsc --project tsconfig.build.json --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
|
|
38
43
|
"clean": "rm -rf ./dist",
|
|
39
|
-
"fern:gen": "node ../../doc-gen/dist/esm/cli.js generate --in ./src/exports/index.ts --out ../../docs/pages/reference/account-kit/wallet-client",
|
|
40
44
|
"test:e2e": "bun test ./src/**/*.e2e.test.*"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@aa-sdk/core": "^4.
|
|
44
|
-
"@account-kit/infra": "^4.
|
|
45
|
-
"@account-kit/smart-contracts": "^4.
|
|
47
|
+
"@aa-sdk/core": "^4.66.0",
|
|
48
|
+
"@account-kit/infra": "^4.66.0",
|
|
49
|
+
"@account-kit/smart-contracts": "^4.66.0",
|
|
46
50
|
"@alchemy/wallet-api-types": "0.1.0-alpha.16",
|
|
47
51
|
"deep-equal": "^2.2.3",
|
|
48
52
|
"ox": "^0.6.12"
|
|
@@ -69,5 +73,5 @@
|
|
|
69
73
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
70
74
|
},
|
|
71
75
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
72
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "e82c14b7d477a925e7340d614f321affb7cda782"
|
|
73
77
|
}
|
|
@@ -4,6 +4,7 @@ import type { InnerWalletApiClient } from "../../types.ts";
|
|
|
4
4
|
import type { Static } from "@sinclair/typebox";
|
|
5
5
|
import { wallet_prepareCalls } from "@alchemy/wallet-api-types/rpc";
|
|
6
6
|
import { metrics } from "../../metrics.js";
|
|
7
|
+
import { mergeClientCapabilities } from "../../internal/capabilities.js";
|
|
7
8
|
|
|
8
9
|
export type GetAccountParam<TAccount> =
|
|
9
10
|
IsUndefined<TAccount> extends true
|
|
@@ -67,12 +68,7 @@ export async function prepareCalls<
|
|
|
67
68
|
throw new AccountNotFoundError();
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
params.capabilities = {
|
|
72
|
-
...params.capabilities,
|
|
73
|
-
paymasterService: { policyIds: client.policyIds },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
71
|
+
const capabilities = mergeClientCapabilities(client, params.capabilities);
|
|
76
72
|
|
|
77
73
|
return await client.request({
|
|
78
74
|
method: "wallet_prepareCalls",
|
|
@@ -81,6 +77,7 @@ export async function prepareCalls<
|
|
|
81
77
|
...params,
|
|
82
78
|
chainId: toHex(client.chain.id),
|
|
83
79
|
from,
|
|
80
|
+
capabilities,
|
|
84
81
|
},
|
|
85
82
|
],
|
|
86
83
|
});
|
package/src/client/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createClient,
|
|
8
8
|
custom,
|
|
9
9
|
} from "viem";
|
|
10
|
-
import type {
|
|
10
|
+
import type { InnerWalletApiClientBase } from "../types.ts";
|
|
11
11
|
import {
|
|
12
12
|
smartWalletClientActions,
|
|
13
13
|
type SmartWalletActions,
|
|
@@ -33,7 +33,7 @@ export type SmartWalletClientParams<
|
|
|
33
33
|
|
|
34
34
|
export type SmartWalletClient<
|
|
35
35
|
TAccount extends Address | undefined = Address | undefined,
|
|
36
|
-
> =
|
|
36
|
+
> = InnerWalletApiClientBase<SmartWalletActions<TAccount>>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Creates a smart wallet client that can be used to interact with a smart account.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import {
|
|
3
|
+
toHex,
|
|
4
|
+
type Address,
|
|
5
|
+
type IsUndefined,
|
|
6
|
+
type Prettify,
|
|
7
|
+
type UnionOmit,
|
|
8
|
+
} from "viem";
|
|
9
|
+
import type { wallet_requestQuote_v0 } from "@alchemy/wallet-api-types/rpc";
|
|
10
|
+
import type { InnerWalletApiClientBase } from "../../types.js";
|
|
11
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
12
|
+
import { mergeClientCapabilities } from "../../internal/capabilities.js";
|
|
13
|
+
|
|
14
|
+
export type RequestQuoteV0Params<
|
|
15
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
16
|
+
> = Prettify<
|
|
17
|
+
UnionOmit<
|
|
18
|
+
Static<
|
|
19
|
+
(typeof wallet_requestQuote_v0)["properties"]["Request"]["properties"]["params"]
|
|
20
|
+
>[0],
|
|
21
|
+
"from" | "chainId"
|
|
22
|
+
>
|
|
23
|
+
> &
|
|
24
|
+
(IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });
|
|
25
|
+
|
|
26
|
+
export type RequestQuoteV0Result = Prettify<
|
|
27
|
+
Static<typeof wallet_requestQuote_v0>["ReturnType"]
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export async function requestQuoteV0<
|
|
31
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
32
|
+
>(
|
|
33
|
+
client: InnerWalletApiClientBase,
|
|
34
|
+
params: RequestQuoteV0Params<TAccount>,
|
|
35
|
+
): Promise<RequestQuoteV0Result> {
|
|
36
|
+
const from = params.from ?? client.account?.address;
|
|
37
|
+
if (!from) {
|
|
38
|
+
throw new AccountNotFoundError();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const capabilities = params.returnRawCalls
|
|
42
|
+
? undefined
|
|
43
|
+
: mergeClientCapabilities(client, params.capabilities);
|
|
44
|
+
|
|
45
|
+
return await client.request({
|
|
46
|
+
method: "wallet_requestQuote_v0",
|
|
47
|
+
params: [
|
|
48
|
+
{
|
|
49
|
+
...params,
|
|
50
|
+
chainId: toHex(client.chain.id),
|
|
51
|
+
from,
|
|
52
|
+
...(capabilities && { capabilities }),
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import {
|
|
3
|
+
requestQuoteV0,
|
|
4
|
+
type RequestQuoteV0Params,
|
|
5
|
+
type RequestQuoteV0Result,
|
|
6
|
+
} from "./actions/requestQuoteV0.js";
|
|
7
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
8
|
+
|
|
9
|
+
export type SwapActions<
|
|
10
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
11
|
+
> = {
|
|
12
|
+
requestQuoteV0: (
|
|
13
|
+
params: RequestQuoteV0Params<TAccount>,
|
|
14
|
+
) => Promise<RequestQuoteV0Result>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const swapActions: <
|
|
18
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
19
|
+
>(
|
|
20
|
+
client: InnerWalletApiClientBase,
|
|
21
|
+
) => SwapActions<TAccount> = (client) => ({
|
|
22
|
+
requestQuoteV0: (params) => requestQuoteV0(client, params),
|
|
23
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// individual actions
|
|
2
|
+
export { requestQuoteV0 } from "../experimental/actions/requestQuoteV0.js";
|
|
3
|
+
export {
|
|
4
|
+
type RequestQuoteV0Params,
|
|
5
|
+
type RequestQuoteV0Result,
|
|
6
|
+
} from "../experimental/actions/requestQuoteV0.js";
|
|
7
|
+
|
|
8
|
+
// decorator
|
|
9
|
+
export { swapActions } from "../experimental/swapActionsDecorator.js";
|
|
10
|
+
export { type SwapActions } from "../experimental/swapActionsDecorator.js";
|
package/src/exports/index.ts
CHANGED
|
@@ -12,17 +12,31 @@ export {
|
|
|
12
12
|
} from "@alchemy/wallet-api-types/rpc";
|
|
13
13
|
|
|
14
14
|
// client actions
|
|
15
|
+
export type * from "../client/actions/getCallsStatus.js";
|
|
15
16
|
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
17
|
+
export type * from "../client/actions/grantPermissions.js";
|
|
16
18
|
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
19
|
+
export type * from "../client/actions/listAccounts.js";
|
|
17
20
|
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
21
|
+
export type * from "../client/actions/prepareCalls.js";
|
|
18
22
|
export { prepareCalls } from "../client/actions/prepareCalls.js";
|
|
23
|
+
export type * from "../client/actions/requestAccount.js";
|
|
19
24
|
export { requestAccount } from "../client/actions/requestAccount.js";
|
|
25
|
+
export type * from "../client/actions/signSignatureRequest.js";
|
|
20
26
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
27
|
+
export type * from "../client/actions/signPreparedCalls.js";
|
|
21
28
|
export { signPreparedCalls } from "../client/actions/signPreparedCalls.js";
|
|
29
|
+
export type * from "../client/actions/signMessage.js";
|
|
22
30
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
31
|
+
export type * from "../client/actions/signTypedData.js";
|
|
23
32
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
33
|
+
export type * from "../client/actions/sendPreparedCalls.js";
|
|
24
34
|
export { sendPreparedCalls } from "../client/actions/sendPreparedCalls.js";
|
|
35
|
+
export type * from "../client/actions/sendCalls.js";
|
|
25
36
|
export { sendCalls } from "../client/actions/sendCalls.js";
|
|
37
|
+
export type * from "../client/actions/waitForCallsStatus.js";
|
|
26
38
|
export { waitForCallsStatus } from "../client/actions/waitForCallsStatus.js";
|
|
39
|
+
export type * from "../client/actions/prepareSign.js";
|
|
27
40
|
export { prepareSign } from "../client/actions/prepareSign.js";
|
|
41
|
+
export type * from "../client/actions/formatSign.js";
|
|
28
42
|
export { formatSign } from "../client/actions/formatSign.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Capabilities } from "@alchemy/wallet-api-types/capabilities";
|
|
2
|
+
import type { InnerWalletApiClientBase } from "../types.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Merges client capabilities with capabilities from the request.
|
|
6
|
+
*
|
|
7
|
+
* @param {InnerWalletApiClientBase} client - The inner wallet API client (potentially including global capabilities like policy IDs)
|
|
8
|
+
* @param {Capabilities | undefined} capabilities - Request capabilities to merge with, if any
|
|
9
|
+
* @returns {Capabilities | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client
|
|
10
|
+
*/
|
|
11
|
+
export const mergeClientCapabilities = (
|
|
12
|
+
client: InnerWalletApiClientBase,
|
|
13
|
+
capabilities: Capabilities | undefined,
|
|
14
|
+
): Capabilities | undefined => {
|
|
15
|
+
return client.policyIds?.length
|
|
16
|
+
? {
|
|
17
|
+
...capabilities,
|
|
18
|
+
paymasterService: {
|
|
19
|
+
policyIds: client.policyIds,
|
|
20
|
+
...capabilities?.paymasterService,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
: capabilities;
|
|
24
|
+
};
|
package/src/version.ts
CHANGED