@account-kit/wallet-client 4.63.2 → 4.65.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/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 +19 -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/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.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/version.d.ts +1 -1
- package/package.json +10 -5
- package/src/client/index.ts +2 -2
- package/src/experimental/actions/requestQuoteV0.ts +50 -0
- package/src/experimental/swapActionsDecorator.ts +23 -0
- package/src/exports/experimental.ts +10 -0
- package/src/version.ts +1 -1
|
@@ -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,19 @@
|
|
|
1
|
+
import { toHex, } from "viem";
|
|
2
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
3
|
+
export async function requestQuoteV0(client, params) {
|
|
4
|
+
const from = params.from ?? client.account?.address;
|
|
5
|
+
if (!from) {
|
|
6
|
+
throw new AccountNotFoundError();
|
|
7
|
+
}
|
|
8
|
+
return await client.request({
|
|
9
|
+
method: "wallet_requestQuote_v0",
|
|
10
|
+
params: [
|
|
11
|
+
{
|
|
12
|
+
...params,
|
|
13
|
+
chainId: toHex(client.chain.id),
|
|
14
|
+
from,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# 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;AAkBpD,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,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;aACL;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\";\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 (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never })\n>;\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 return await client.request({\n method: \"wallet_requestQuote_v0\",\n params: [\n {\n ...params,\n chainId: toHex(client.chain.id),\n from,\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"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.65.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.65.0\";\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.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;AAG/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,GACC,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAC9E,CAAC;AAEF,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,CAgB/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"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.65.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.65.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": {
|
|
@@ -40,9 +45,9 @@
|
|
|
40
45
|
"test:e2e": "bun test ./src/**/*.e2e.test.*"
|
|
41
46
|
},
|
|
42
47
|
"dependencies": {
|
|
43
|
-
"@aa-sdk/core": "^4.
|
|
44
|
-
"@account-kit/infra": "^4.
|
|
45
|
-
"@account-kit/smart-contracts": "^4.
|
|
48
|
+
"@aa-sdk/core": "^4.65.0",
|
|
49
|
+
"@account-kit/infra": "^4.65.0",
|
|
50
|
+
"@account-kit/smart-contracts": "^4.65.0",
|
|
46
51
|
"@alchemy/wallet-api-types": "0.1.0-alpha.16",
|
|
47
52
|
"deep-equal": "^2.2.3",
|
|
48
53
|
"ox": "^0.6.12"
|
|
@@ -69,5 +74,5 @@
|
|
|
69
74
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
70
75
|
},
|
|
71
76
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
72
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "5433a77a6f488b7ba30d2be844374d87d388dd7b"
|
|
73
78
|
}
|
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,50 @@
|
|
|
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
|
+
|
|
13
|
+
export type RequestQuoteV0Params<
|
|
14
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
15
|
+
> = Prettify<
|
|
16
|
+
UnionOmit<
|
|
17
|
+
Static<
|
|
18
|
+
(typeof wallet_requestQuote_v0)["properties"]["Request"]["properties"]["params"]
|
|
19
|
+
>[0],
|
|
20
|
+
"from" | "chainId"
|
|
21
|
+
> &
|
|
22
|
+
(IsUndefined<TAccount> extends true ? { from: Address } : { from?: never })
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type RequestQuoteV0Result = Prettify<
|
|
26
|
+
Static<typeof wallet_requestQuote_v0>["ReturnType"]
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export async function requestQuoteV0<
|
|
30
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
31
|
+
>(
|
|
32
|
+
client: InnerWalletApiClientBase,
|
|
33
|
+
params: RequestQuoteV0Params<TAccount>,
|
|
34
|
+
): Promise<RequestQuoteV0Result> {
|
|
35
|
+
const from = params.from ?? client.account?.address;
|
|
36
|
+
if (!from) {
|
|
37
|
+
throw new AccountNotFoundError();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return await client.request({
|
|
41
|
+
method: "wallet_requestQuote_v0",
|
|
42
|
+
params: [
|
|
43
|
+
{
|
|
44
|
+
...params,
|
|
45
|
+
chainId: toHex(client.chain.id),
|
|
46
|
+
from,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -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/version.ts
CHANGED