@account-kit/wallet-client 0.0.1-alpha.1 → 0.1.0-alpha.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/capabilities/index.d.ts +23 -0
- package/dist/esm/capabilities/index.js +2 -0
- package/dist/esm/capabilities/index.js.map +1 -1
- package/dist/esm/capabilities/overrides.d.ts +26 -0
- package/dist/esm/capabilities/overrides.js +14 -0
- package/dist/esm/capabilities/overrides.js.map +1 -0
- package/dist/esm/capabilities/permissions/index.d.ts +57 -17
- package/dist/esm/capabilities/permissions/index.js +25 -14
- package/dist/esm/capabilities/permissions/index.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +1 -1
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +3 -4
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +1 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/isomorphic/actions/createSession.js +3 -1
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.js +2 -1
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +4 -3
- package/dist/esm/isomorphic/client.js +13 -6
- package/dist/esm/isomorphic/client.js.map +1 -1
- package/dist/esm/local/client.js +4 -3
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/rpc/request.d.ts +32 -9
- package/dist/esm/rpc/request.js +14 -4
- package/dist/esm/rpc/request.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +32 -9
- package/dist/esm/rpc/schema.js.map +1 -1
- package/dist/types/capabilities/index.d.ts +23 -0
- package/dist/types/capabilities/index.d.ts.map +1 -1
- package/dist/types/capabilities/overrides.d.ts +27 -0
- package/dist/types/capabilities/overrides.d.ts.map +1 -0
- package/dist/types/capabilities/permissions/index.d.ts +57 -17
- package/dist/types/capabilities/permissions/index.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +1 -1
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +2 -2
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +4 -3
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/rpc/request.d.ts +32 -9
- package/dist/types/rpc/request.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +32 -9
- package/dist/types/rpc/schema.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/capabilities/index.ts +2 -0
- package/src/capabilities/overrides.ts +20 -0
- package/src/capabilities/permissions/index.ts +41 -23
- package/src/client/actions/grantPermissions.ts +1 -1
- package/src/client/actions/sendPreparedCalls.ts +3 -3
- package/src/client/client.e2e-test.ts +3 -4
- package/src/client/decorator.ts +1 -1
- package/src/isomorphic/actions/createSession.ts +5 -1
- package/src/isomorphic/actions/prepareCalls.ts +3 -2
- package/src/isomorphic/actions/sendPreparedCalls.ts +3 -3
- package/src/isomorphic/client.ts +19 -9
- package/src/local/client.ts +7 -6
- package/src/rpc/request.ts +30 -15
- package/src/rpc/schema.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deepHexlify, } from "@aa-sdk/core";
|
|
2
|
-
import { custom, fromHex,
|
|
2
|
+
import { ChainNotFoundError, custom, fromHex, toHex, zeroAddress, } from "viem";
|
|
3
3
|
import { createAccount } from "../utils/createAccount";
|
|
4
4
|
import { createDummySigner } from "../utils/createDummySigner";
|
|
5
5
|
// TODO: handle capabilities like permissions and paymaster here
|
|
@@ -37,6 +37,7 @@ export async function prepareCalls(client, params) {
|
|
|
37
37
|
value: x.value ? fromHex(x.value, "bigint") : undefined,
|
|
38
38
|
})),
|
|
39
39
|
account,
|
|
40
|
+
overrides: params.capabilities?.gasParamsOverride,
|
|
40
41
|
});
|
|
41
42
|
const uoRequest = deepHexlify(builtUo);
|
|
42
43
|
const hash = account.getEntryPoint().getUserOperationHash(uoRequest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,MAAM,EACN,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,KAAK,EACL,WAAW,GAGZ,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAa/D,gEAAgE;AAChE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAMC,EACD,MAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,k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,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAErE,OAAO;QACL,IAAI,EACF,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,KAAK,OAAO;YACzC,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,qBAAqB;QAC3B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,gBAAgB,EAAE;YAChB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,GAAG,EAAE,IAAI;aACV;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport {\n ChainNotFoundError,\n custom,\n fromHex,\n toHex,\n zeroAddress,\n type Chain,\n type Transport,\n} from \"viem\";\nimport type { wallet_prepareCalls } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport { createAccount } from \"../utils/createAccount\";\nimport { createDummySigner } from \"../utils/createDummySigner\";\n\nexport type PrepareCallsParams = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type PrepareCallsResult = Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: handle capabilities like permissions and paymaster here\nexport async function prepareCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n // in local mode, we probably want some kind of caching for this\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n accountAddress: params.from,\n includeCounterfactualInfo: true,\n },\n ],\n });\n if (!counterfactualInfo) {\n throw new Error(\"No counterfactual info found.\");\n }\n\n const account = await createAccount({\n chain: client.chain,\n transport: custom(client.transport),\n signer: createDummySigner(zeroAddress),\n accountAddress: params.from,\n counterfactualInfo,\n capabilities: params.capabilities,\n });\n\n // TODO: oops we don't actually support setting the policyId as an override here\n // if we assume that the the isomorphic client is never used directly, then we can assume that this is handled upstream correctly\n const builtUo = await client.buildUserOperation({\n uo: params.calls.map((x) => ({\n target: x.to,\n data: x.data ?? \"0x\",\n value: x.value ? fromHex(x.value, \"bigint\") : undefined,\n })),\n account,\n overrides: params.capabilities?.gasParamsOverride,\n });\n\n const uoRequest = deepHexlify(builtUo);\n\n const hash = account.getEntryPoint().getUserOperationHash(uoRequest);\n\n return {\n type:\n account.getEntryPoint().version === \"0.7.0\"\n ? \"user-operation-v070\"\n : \"user-operation-v060\",\n data: uoRequest,\n chainId: toHex(client.chain.id),\n signatureRequest: {\n type: \"personal_sign\",\n data: {\n raw: hash,\n },\n },\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
+
import type { Static, StaticDecode } from "@sinclair/typebox";
|
|
2
3
|
import { type Chain, type Transport } from "viem";
|
|
3
4
|
import type { wallet_sendPreparedCalls } from "../../rpc/request";
|
|
4
5
|
import type { WalletServerViemRpcSchema } from "../../rpc/schema";
|
|
5
|
-
|
|
6
|
-
export type SendPreparedCallsParams = Omit<Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
|
|
6
|
+
export type SendPreparedCallsParams = Omit<StaticDecode<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
|
|
7
7
|
export type SendPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["properties"]["ReturnType"]>;
|
|
8
8
|
export declare function sendPreparedCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getEntryPoint, } from "@aa-sdk/core";
|
|
2
|
+
import { Value } from "@sinclair/typebox/value";
|
|
2
3
|
import { ChainNotFoundError, concat, concatHex, toHex, } from "viem";
|
|
3
4
|
import { decodePermissionsContext } from "../../capabilities/permissions/mav2";
|
|
4
|
-
import { Value } from "@sinclair/typebox/value";
|
|
5
5
|
import { TypeCallId } from "../../schemas";
|
|
6
6
|
// TODO: this only supports MAv2 right now, we need to fix this
|
|
7
7
|
export async function sendPreparedCalls(client, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAa3C,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAMC,EACD,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;YAC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SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static, StaticDecode } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n concat,\n concatHex,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2\";\nimport type { wallet_sendPreparedCalls } from \"../../rpc/request\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema\";\nimport { TypeCallId } from \"../../schemas\";\n\nexport type SendPreparedCallsParams = Omit<\n StaticDecode<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n>;\n\nexport type SendPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"ReturnType\"]\n>;\n\n// TODO: this only supports MAv2 right now, we need to fix this\nexport async function sendPreparedCalls(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const deferredAction: Hex | undefined = (() => {\n if (!params.capabilities?.permissions?.context) {\n return;\n }\n\n const decodedContext = decodePermissionsContext(\n params.capabilities.permissions.context,\n );\n\n if (decodedContext.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new Error(\n \"Remote mode deferred action not supported in isomorphic client\",\n );\n }\n\n return decodedContext.deferredAction;\n })();\n\n const entryPoint =\n params.type === \"user-operation-v060\"\n ? getEntryPoint(client.chain, { version: \"0.6.0\" })\n : getEntryPoint(client.chain, { version: \"0.7.0\" });\n\n const hash = await client.sendRawUserOperation(\n {\n ...params.data,\n signature:\n deferredAction != null\n ? concatHex([\n `0x${deferredAction.slice(68)}`, // Cuts off stuff preprended to the digest (nonce, etc. that we had previously).\n \"0xff\",\n \"0x00\",\n params.signature.signature,\n ])\n : concat([\"0xFF\", \"0x00\", params.signature.signature]),\n },\n entryPoint.address,\n );\n\n const callId = Value.Encode(TypeCallId, {\n chainId: toHex(client.chain.id),\n hash,\n });\n\n return {\n preparedCallIds: [callId],\n };\n}\n"]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import { type Chain, type Transport } from "viem";
|
|
3
3
|
import type { WalletServerViemRpcSchema } from "../rpc/schema";
|
|
4
|
+
import { type CreateSessionParams } from "./actions/createSession";
|
|
5
|
+
import { type GetCallsStatusParams } from "./actions/getCallsStatus";
|
|
4
6
|
import { type PrepareCallsParams } from "./actions/prepareCalls";
|
|
5
7
|
import { type SendPreparedCallsParams } from "./actions/sendPreparedCalls";
|
|
6
|
-
import { type GetCallsStatusParams } from "./actions/getCallsStatus";
|
|
7
|
-
import { type CreateSessionParams } from "./actions/createSession";
|
|
8
8
|
type ClientParams = {
|
|
9
9
|
chain: Chain;
|
|
10
10
|
transport: Transport;
|
|
11
11
|
policyId?: string;
|
|
12
|
+
useErc7677middleware?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare function isomorphicClientActions(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>): {
|
|
14
15
|
prepareCalls: (params: PrepareCallsParams) => Promise<{
|
|
@@ -92,6 +93,6 @@ export declare function isomorphicClientActions(client: SmartAccountClient<Trans
|
|
|
92
93
|
}>;
|
|
93
94
|
createSession: (params: CreateSessionParams) => Promise<import("./actions/createSession").CreateSessionResult>;
|
|
94
95
|
};
|
|
95
|
-
export declare function createIsomorphicClient({ chain, transport, policyId, }: ClientParams): SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, ReturnType<typeof isomorphicClientActions>, WalletServerViemRpcSchema & SmartAccountClientRpcSchema>;
|
|
96
|
+
export declare function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware, }: ClientParams): SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, ReturnType<typeof isomorphicClientActions>, WalletServerViemRpcSchema & SmartAccountClientRpcSchema>;
|
|
96
97
|
export type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;
|
|
97
98
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
2
|
-
import { alchemyFeeEstimator, alchemyGasManagerMiddleware, } from "@account-kit/infra";
|
|
2
|
+
import { alchemyFeeEstimator, alchemyGasAndPaymasterAndDataMiddleware, alchemyGasManagerMiddleware, } from "@account-kit/infra";
|
|
3
3
|
import {} from "viem";
|
|
4
|
+
import { createSession, } from "./actions/createSession";
|
|
5
|
+
import { getCallsStatus, } from "./actions/getCallsStatus";
|
|
4
6
|
import { prepareCalls } from "./actions/prepareCalls";
|
|
5
7
|
import { sendPreparedCalls, } from "./actions/sendPreparedCalls";
|
|
6
|
-
import { getCallsStatus, } from "./actions/getCallsStatus";
|
|
7
|
-
import { createSession, } from "./actions/createSession";
|
|
8
8
|
export function isomorphicClientActions(client) {
|
|
9
9
|
return {
|
|
10
10
|
prepareCalls: (params) => prepareCalls(client, params),
|
|
@@ -15,15 +15,22 @@ export function isomorphicClientActions(client) {
|
|
|
15
15
|
}
|
|
16
16
|
// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client
|
|
17
17
|
// if the dev chooses to run the client in "local" mode.
|
|
18
|
-
export function createIsomorphicClient({ chain, transport, policyId, }) {
|
|
18
|
+
export function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware = true, }) {
|
|
19
19
|
// This must be a smart account client since as of now we use it to build UOs under the hood
|
|
20
20
|
const client = createSmartAccountClient({
|
|
21
21
|
transport,
|
|
22
22
|
chain,
|
|
23
23
|
// TODO: we will want to enforce alchemy transport here probably
|
|
24
24
|
feeEstimator: alchemyFeeEstimator(transport),
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
...(policyId
|
|
26
|
+
? useErc7677middleware
|
|
27
|
+
? alchemyGasManagerMiddleware(policyId)
|
|
28
|
+
: // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware
|
|
29
|
+
alchemyGasAndPaymasterAndDataMiddleware({
|
|
30
|
+
policyId,
|
|
31
|
+
transport: transport,
|
|
32
|
+
})
|
|
33
|
+
: {}),
|
|
27
34
|
}).extend(isomorphicClientActions);
|
|
28
35
|
return client;
|
|
29
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,uCAAuC,EACvC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,aAAa,GAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACL,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AAUrC,MAAM,UAAU,uBAAuB,CACrC,MAMC;IAED,OAAO;QACL,YAAY,EAAE,CAAC,MAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1E,iBAAiB,EAAE,CAAC,MAA+B,EAAE,EAAE,CACrD,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,cAAc,EAAE,CAAC,MAA4B,EAAE,EAAE,CAC/C,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAChC,aAAa,EAAE,CAAC,MAA2B,EAAE,EAAE,CAC7C,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,wJAAwJ;AACxJ,wDAAwD;AACxD,MAAM,UAAU,sBAAsB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,QAAQ,EACR,oBAAoB,GAAG,IAAI,GACd;IAOb,4FAA4F;IAC5F,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACtC,SAAS;QACT,KAAK;QACL,gEAAgE;QAChE,YAAY,EAAE,mBAAmB,CAAC,SAA6B,CAAC;QAChE,GAAG,CAAC,QAAQ;YACV,CAAC,CAAC,oBAAoB;gBACpB,CAAC,CAAC,2BAA2B,CAAC,QAAQ,CAAC;gBACvC,CAAC,CAAC,oGAAoG;oBACpG,uCAAuC,CAAC;wBACtC,QAAQ;wBACR,SAAS,EAAE,SAA6B;qBACzC,CAAC;YACN,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n alchemyFeeEstimator,\n alchemyGasAndPaymasterAndDataMiddleware,\n alchemyGasManagerMiddleware,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type Chain, type Transport } from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../rpc/schema\";\nimport {\n createSession,\n type CreateSessionParams,\n} from \"./actions/createSession\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n} from \"./actions/getCallsStatus\";\nimport { prepareCalls, type PrepareCallsParams } from \"./actions/prepareCalls\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n} from \"./actions/sendPreparedCalls\";\n\n// let's start with something that takes in as many params as possible, then we can eliminate them as we don't need them\ntype ClientParams = {\n chain: Chain;\n transport: Transport;\n policyId?: string;\n useErc7677middleware?: boolean;\n};\n\nexport function isomorphicClientActions(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n) {\n return {\n prepareCalls: (params: PrepareCallsParams) => prepareCalls(client, params),\n sendPreparedCalls: (params: SendPreparedCallsParams) =>\n sendPreparedCalls(client, params),\n getCallsStatus: (params: GetCallsStatusParams) =>\n getCallsStatus(client, params),\n createSession: (params: CreateSessionParams) =>\n createSession(client, params),\n };\n}\n\n// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client\n// if the dev chooses to run the client in \"local\" mode.\nexport function createIsomorphicClient({\n chain,\n transport,\n policyId,\n useErc7677middleware = true,\n}: ClientParams): SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n ReturnType<typeof isomorphicClientActions>,\n WalletServerViemRpcSchema & SmartAccountClientRpcSchema\n> {\n // This must be a smart account client since as of now we use it to build UOs under the hood\n const client = createSmartAccountClient({\n transport,\n chain,\n // TODO: we will want to enforce alchemy transport here probably\n feeEstimator: alchemyFeeEstimator(transport as AlchemyTransport),\n ...(policyId\n ? useErc7677middleware\n ? alchemyGasManagerMiddleware(policyId)\n : // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware\n alchemyGasAndPaymasterAndDataMiddleware({\n policyId,\n transport: transport as AlchemyTransport,\n })\n : {}),\n }).extend(isomorphicClientActions);\n\n return client;\n}\n\nexport type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;\n"]}
|
package/dist/esm/local/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { split } from "@aa-sdk/core";
|
|
2
|
+
import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experimental";
|
|
2
3
|
import { createClient, custom } from "viem";
|
|
4
|
+
import { encodePermissionsContext, prefixSignatureKeyType, } from "../capabilities/permissions/mav2";
|
|
5
|
+
import { signSignatureRequest } from "../client/actions/signSignatureRequest";
|
|
3
6
|
import { createIsomorphicClient, } from "../isomorphic/client";
|
|
4
7
|
import { assertNever } from "../utils";
|
|
5
|
-
import { signSignatureRequest } from "../client/actions/signSignatureRequest";
|
|
6
|
-
import { encodePermissionsContext, prefixSignatureKeyType, } from "../capabilities/permissions/mav2";
|
|
7
|
-
import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experimental";
|
|
8
8
|
const localMethods = [
|
|
9
9
|
"wallet_prepareCalls",
|
|
10
10
|
"wallet_sendPreparedCalls",
|
|
@@ -17,6 +17,7 @@ export function createLocalClient(params) {
|
|
|
17
17
|
transport,
|
|
18
18
|
chain,
|
|
19
19
|
policyId,
|
|
20
|
+
useErc7677middleware: false,
|
|
20
21
|
});
|
|
21
22
|
const clientMap = {
|
|
22
23
|
[policyId ?? "default"]: isomorphicClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAA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AAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,4BAA4B;oBAC5C,cAAc,EAAE,yBAAyB,CAAC;wBACxC,oCAAoC;wBACpC,GAAG,EAAE,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC;qBACpD,CAAC;iBACH,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"../capabilities/permissions/mav2\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types\";\nimport { assertNever } from \"../utils\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async request(args: { method: LocalMethod; params: any }) {\n switch (args.method) {\n case \"wallet_prepareCalls\": {\n const params = args.params[0] as PrepareCallsParams;\n const capabilityPolicyId =\n params.capabilities?.paymasterService?.policyId;\n\n if (\n capabilityPolicyId != null &&\n policyId !== capabilityPolicyId &&\n !clientMap[capabilityPolicyId]\n ) {\n clientMap[capabilityPolicyId] = createIsomorphicClient({\n transport,\n chain,\n policyId: capabilityPolicyId,\n });\n }\n\n const client =\n clientMap[capabilityPolicyId ?? policyId ?? \"default\"];\n return client.prepareCalls(params);\n }\n case \"wallet_sendPreparedCalls\":\n return isomorphicClient.sendPreparedCalls(args.params[0]);\n case \"wallet_getCallsStatus\":\n return isomorphicClient.getCallsStatus(args.params[0]);\n case \"wallet_createSession\": {\n return isomorphicClient.createSession(args.params[0]);\n }\n default:\n return assertNever(\n args.method,\n `Unexpected method: ${args.method}`,\n );\n }\n },\n }),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n }).extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature, \"secp256k1\"),\n }),\n }),\n };\n },\n };\n};\n"]}
|
|
@@ -32,7 +32,7 @@ export declare const wallet_sendPreparedCalls: import("@sinclair/typebox").TObje
|
|
|
32
32
|
}>]>;
|
|
33
33
|
chainId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
34
34
|
signature: import("@sinclair/typebox").TObject<{
|
|
35
|
-
type: import("@sinclair/typebox").TString
|
|
35
|
+
type: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, "ecdsa">;
|
|
36
36
|
signature: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
37
37
|
}>;
|
|
38
38
|
capabilities: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
@@ -64,6 +64,29 @@ export declare const wallet_prepareCalls: import("@sinclair/typebox").TObject<{
|
|
|
64
64
|
paymasterService: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
65
65
|
policyId: import("@sinclair/typebox").TString;
|
|
66
66
|
}>>;
|
|
67
|
+
gasParamsOverride: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
68
|
+
preVerificationGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
69
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
70
|
+
}>]>>;
|
|
71
|
+
verificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
72
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
73
|
+
}>]>>;
|
|
74
|
+
callGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
75
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
76
|
+
}>]>>;
|
|
77
|
+
paymasterVerificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
78
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
79
|
+
}>]>>;
|
|
80
|
+
paymasterPostOpGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
81
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
82
|
+
}>]>>;
|
|
83
|
+
maxFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
84
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
85
|
+
}>]>>;
|
|
86
|
+
maxPriorityFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
87
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
88
|
+
}>]>>;
|
|
89
|
+
}>>;
|
|
67
90
|
}>>;
|
|
68
91
|
}>]>;
|
|
69
92
|
}>;
|
|
@@ -214,44 +237,44 @@ export declare const wallet_createSession: import("@sinclair/typebox").TObject<{
|
|
|
214
237
|
publicKey: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
215
238
|
}>;
|
|
216
239
|
permissions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
217
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
240
|
+
type: import("@sinclair/typebox").TLiteral<"native-token-transfer">;
|
|
218
241
|
data: import("@sinclair/typebox").TObject<{
|
|
219
242
|
allowance: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
220
243
|
}>;
|
|
221
244
|
}>, import("@sinclair/typebox").TObject<{
|
|
222
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
245
|
+
type: import("@sinclair/typebox").TLiteral<"erc20-token-transfer">;
|
|
223
246
|
data: import("@sinclair/typebox").TObject<{
|
|
224
247
|
allowance: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
225
248
|
address: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
226
249
|
}>;
|
|
227
250
|
}>, import("@sinclair/typebox").TObject<{
|
|
228
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
251
|
+
type: import("@sinclair/typebox").TLiteral<"gas-limit">;
|
|
229
252
|
data: import("@sinclair/typebox").TObject<{
|
|
230
253
|
limit: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
231
254
|
}>;
|
|
232
255
|
}>, import("@sinclair/typebox").TObject<{
|
|
233
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
256
|
+
type: import("@sinclair/typebox").TLiteral<"contract-access">;
|
|
234
257
|
data: import("@sinclair/typebox").TObject<{
|
|
235
258
|
address: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
236
259
|
}>;
|
|
237
260
|
}>, import("@sinclair/typebox").TObject<{
|
|
238
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
261
|
+
type: import("@sinclair/typebox").TLiteral<"account-functions">;
|
|
239
262
|
data: import("@sinclair/typebox").TObject<{
|
|
240
263
|
functions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
241
264
|
}>;
|
|
242
265
|
}>, import("@sinclair/typebox").TObject<{
|
|
243
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
266
|
+
type: import("@sinclair/typebox").TLiteral<"functions-on-all-contracts">;
|
|
244
267
|
data: import("@sinclair/typebox").TObject<{
|
|
245
268
|
functions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
246
269
|
}>;
|
|
247
270
|
}>, import("@sinclair/typebox").TObject<{
|
|
248
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
271
|
+
type: import("@sinclair/typebox").TLiteral<"functions-on-contract">;
|
|
249
272
|
data: import("@sinclair/typebox").TObject<{
|
|
250
273
|
address: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
251
274
|
functions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
252
275
|
}>;
|
|
253
276
|
}>, import("@sinclair/typebox").TObject<{
|
|
254
|
-
type: import("@sinclair/typebox").TLiteral<
|
|
277
|
+
type: import("@sinclair/typebox").TLiteral<"root">;
|
|
255
278
|
data: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
|
|
256
279
|
}>]>>;
|
|
257
280
|
}>, import("@sinclair/typebox").TObject<{
|
package/dist/esm/rpc/request.js
CHANGED
|
@@ -17,9 +17,14 @@ export const wallet_sendPreparedCalls = Type.Object({
|
|
|
17
17
|
]),
|
|
18
18
|
chainId: TypeHex(),
|
|
19
19
|
signature: Type.Object({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
type: Type.Transform(Type.String())
|
|
21
|
+
.Decode((value) => {
|
|
22
|
+
if (value.toLowerCase() !== "ecdsa") {
|
|
23
|
+
throw new Error("Invalid signature type, must be 'ecdsa'");
|
|
24
|
+
}
|
|
25
|
+
return "ecdsa";
|
|
26
|
+
})
|
|
27
|
+
.Encode((value) => value),
|
|
23
28
|
signature: TypeHex(),
|
|
24
29
|
}),
|
|
25
30
|
capabilities: Type.Optional(Type.Object({ permissions: PermissionsContext })),
|
|
@@ -135,13 +140,18 @@ export const wallet_createSession = Type.Object({
|
|
|
135
140
|
Request: Type.Object({
|
|
136
141
|
method: Type.Literal("wallet_createSession"),
|
|
137
142
|
params: Type.Tuple([
|
|
138
|
-
Type.Intersect([
|
|
143
|
+
Type.Intersect([
|
|
144
|
+
PermissionsData,
|
|
145
|
+
Type.Object({ account: TypeAddress }),
|
|
146
|
+
]),
|
|
139
147
|
]),
|
|
140
148
|
}),
|
|
141
149
|
ReturnType: Type.Object({
|
|
142
150
|
sessionId: TypeHex(),
|
|
143
151
|
signatureRequest: TypeSignatureRequest,
|
|
144
152
|
}),
|
|
153
|
+
}, {
|
|
154
|
+
description: "This method is used to create a session for a given address with specified permissions.",
|
|
145
155
|
});
|
|
146
156
|
export const wallet_getCallsStatus = Type.Object({
|
|
147
157
|
Request: Type.Object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/rpc/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,OAAO,EACP,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,MAAM,CACjD;IACE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC;gBACV,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;oBACnC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;iBACpC,CAAC;gBACF,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;oBACrD,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,WAAW,CAAC,CAAC;iBACtD,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE;gBAClB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;oBACrB,sGAAsG;oBACtG,2CAA2C;oBAC3C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ACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,4FAA4F;aAC/F,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,+DAA+D;aAClE,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;SACH,CAAC;QACF,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CACR,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,EAAE,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,MAAM,CAAC;gBACV,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,OAAO,EAAE;gBACf,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aAC9B,CAAC,CACH;YACD,MAAM,EAAE,OAAO,CAAC;gBACd,WAAW,EAAE,kCAAkC;aAChD,CAAC;YACF,SAAS,EAAE,OAAO,EAAE;YACpB,WAAW,EAAE,OAAO,EAAE;YACtB,OAAO,EAAE,OAAO,EAAE;YAClB,eAAe,EAAE,OAAO,EAAE;SAC3B,CAAC,CACH,CACF;KACF,CAAC;CACH,EACD;IACE,WAAW,EACT,4FAA4F;CAC/F,CACF,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { Capabilities } from \"../capabilities\";\nimport {\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions\";\nimport {\n TypeAddress,\n TypeBase64UrlEncodedString,\n TypeCreationOptions,\n TypeHex,\n TypeSerializedInitcode,\n TypeSignatureRequest,\n TypeUserOperationRequest_v6,\n TypeUserOperationRequest_v7,\n TypeUuid,\n} from \"../schemas\";\n\nexport const wallet_sendPreparedCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_sendPreparedCalls\"),\n params: Type.Tuple([\n Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signature: Type.Object({\n // ignored, but in the spec can be used when the signature on the UO needs to be formatted differently\n // potentially useful for deferred actions?\n type: Type.String(),\n signature: TypeHex(),\n }),\n capabilities: Type.Optional(\n Type.Object({ permissions: PermissionsContext }),\n ),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n preparedCallIds: Type.Array(TypeHex()),\n }),\n },\n {\n description:\n \"This method is used after signing the signatureRequest returned from prepareCalls to submit a user operation\",\n },\n);\n\nexport const wallet_prepareCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_prepareCalls\"),\n params: Type.Tuple([\n Type.Object({\n calls: Type.Array(\n Type.Object({\n to: TypeAddress,\n data: Type.Optional(TypeHex()),\n value: Type.Optional(TypeHex()),\n }),\n ),\n from: TypeAddress,\n chainId: TypeHex(),\n capabilities: Type.Optional(Capabilities),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to prepare a user operation for submission. It will return a built user operation and a signature request which needs to be signed by the user before submitting to wallet_sendPreparedCalls\",\n },\n);\n\nexport const wallet_requestAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_requestAccount\"),\n params: Type.Tuple([\n Type.Union([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationHint: TypeCreationOptions,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n Type.Object({\n accountAddress: TypeAddress,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n counterfactualInfo: Type.Optional(TypeSerializedInitcode),\n }),\n },\n {\n description: `This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.`,\n },\n);\n\nexport const wallet_createAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createAccount\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationOptions: TypeCreationOptions,\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n },\n {\n description: `This method is used to create a smart account for a given signer. This method is primarly used to import existing accounts. For most cases, you should use wallet_requestAccount instead.`,\n },\n);\n\nexport const wallet_listAccounts = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_listAccounts\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n limit: Type.Optional(\n Type.Number({ minimum: 1, maximum: 100, default: 100 }),\n ),\n after: Type.Optional(TypeBase64UrlEncodedString),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accounts: Type.Array(\n Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n ),\n meta: Type.Object({\n totalCount: Type.Number(),\n after: Type.Union([TypeBase64UrlEncodedString, Type.Null()]),\n }),\n }),\n },\n {\n description:\n \"This method is used to list all smart accounts for a given signer.\",\n },\n);\n\nexport const wallet_createSession = Type.Object({\n Request: Type.Object({\n method: Type.Literal(\"wallet_createSession\"),\n params: Type.Tuple([\n Type.Intersect([PermissionsData, Type.Object({ account: TypeAddress })]),\n ]),\n }),\n ReturnType: Type.Object({\n sessionId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n});\n\nexport const wallet_getCallsStatus = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_getCallsStatus\"),\n params: Type.Tuple([\n TypeHex({\n description: \"The call ID returned from wallet_sendPreparedCalls\",\n }),\n ]),\n }),\n ReturnType: Type.Object({\n id: TypeHex(),\n chainId: TypeHex(),\n atomic: Type.Boolean(),\n status: Type.Union([\n Type.Literal(100, {\n description:\n \"Batch has been received by the wallet but has not completed execution onchain\",\n }),\n Type.Literal(200, {\n description:\n \"Batch has been included onchain without reverts, receipts array contains info of all calls\",\n }),\n Type.Literal(400, {\n description:\n \"Batch has not been included onchain and wallet will not retry\",\n }),\n Type.Literal(500, {\n description:\n \"Batch reverted *completely* and only changes related to gas charge may have been included onchain\",\n }),\n Type.Literal(600, {\n description:\n \"Batch reverted *partially* and some changes related to batch calls may have been included onchain\",\n }),\n ]),\n receipts: Type.Optional(\n Type.Array(\n Type.Object({\n logs: Type.Array(\n Type.Object({\n address: TypeAddress,\n data: TypeHex(),\n topics: Type.Array(TypeHex()),\n }),\n ),\n status: TypeHex({\n description: \"0x1 for success, 0x0 for failure\",\n }),\n blockHash: TypeHex(),\n blockNumber: TypeHex(),\n gasUsed: TypeHex(),\n transactionHash: TypeHex(),\n }),\n ),\n ),\n }),\n },\n {\n description:\n \"This method is used to get the status of calls IDs returned from wallet_sendPreparedCalls.\",\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/rpc/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,OAAO,EACP,sBAAsB,EACtB,oBAAoB,EACp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OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;gBAChB,WAAW,EACT,mGAAmG;aACtG,CAAC;SACH,CAAC;QACF,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CACR,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,EAAE,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,MAAM,CAAC;gBACV,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,OAAO,EAAE;gBACf,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aAC9B,CAAC,CACH;YACD,MAAM,EAAE,OAAO,CAAC;gBACd,WAAW,EAAE,kCAAkC;aAChD,CAAC;YACF,SAAS,EAAE,OAAO,EAAE;YACpB,WAAW,EAAE,OAAO,EAAE;YACtB,OAAO,EAAE,OAAO,EAAE;YAClB,eAAe,EAAE,OAAO,EAAE;SAC3B,CAAC,CACH,CACF;KACF,CAAC;CACH,EACD;IACE,WAAW,EACT,4FAA4F;CAC/F,CACF,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { Capabilities } from \"../capabilities\";\nimport {\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions\";\nimport {\n TypeAddress,\n TypeBase64UrlEncodedString,\n TypeCreationOptions,\n TypeHex,\n TypeSerializedInitcode,\n TypeSignatureRequest,\n TypeUserOperationRequest_v6,\n TypeUserOperationRequest_v7,\n TypeUuid,\n} from \"../schemas\";\n\nexport const wallet_sendPreparedCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_sendPreparedCalls\"),\n params: Type.Tuple([\n Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signature: Type.Object({\n type: Type.Transform(Type.String())\n .Decode((value) => {\n if (value.toLowerCase() !== \"ecdsa\") {\n throw new Error(\"Invalid signature type, must be 'ecdsa'\");\n }\n\n return \"ecdsa\" as const;\n })\n .Encode((value) => value),\n signature: TypeHex(),\n }),\n capabilities: Type.Optional(\n Type.Object({ permissions: PermissionsContext }),\n ),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n preparedCallIds: Type.Array(TypeHex()),\n }),\n },\n {\n description:\n \"This method is used after signing the signatureRequest returned from prepareCalls to submit a user operation\",\n },\n);\n\nexport const wallet_prepareCalls = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_prepareCalls\"),\n params: Type.Tuple([\n Type.Object({\n calls: Type.Array(\n Type.Object({\n to: TypeAddress,\n data: Type.Optional(TypeHex()),\n value: Type.Optional(TypeHex()),\n }),\n ),\n from: TypeAddress,\n chainId: TypeHex(),\n capabilities: Type.Optional(Capabilities),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n type: Type.Union([\n Type.Literal(\"user-operation-v060\"),\n Type.Literal(\"user-operation-v070\"),\n ]),\n data: Type.Union([\n Type.Omit(TypeUserOperationRequest_v6, [\"signature\"]),\n Type.Omit(TypeUserOperationRequest_v7, [\"signature\"]),\n ]),\n chainId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to prepare a user operation for submission. It will return a built user operation and a signature request which needs to be signed by the user before submitting to wallet_sendPreparedCalls\",\n },\n);\n\nexport const wallet_requestAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_requestAccount\"),\n params: Type.Tuple([\n Type.Union([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationHint: TypeCreationOptions,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n Type.Object({\n accountAddress: TypeAddress,\n includeCounterfactualInfo: Type.Optional(\n Type.Boolean({ default: false }),\n ),\n }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n counterfactualInfo: Type.Optional(TypeSerializedInitcode),\n }),\n },\n {\n description: `This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.`,\n },\n);\n\nexport const wallet_createAccount = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createAccount\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n id: Type.Optional(TypeUuid),\n creationOptions: TypeCreationOptions,\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n },\n {\n description: `This method is used to create a smart account for a given signer. This method is primarly used to import existing accounts. For most cases, you should use wallet_requestAccount instead.`,\n },\n);\n\nexport const wallet_listAccounts = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_listAccounts\"),\n params: Type.Tuple([\n Type.Object({\n signerAddress: TypeAddress,\n limit: Type.Optional(\n Type.Number({ minimum: 1, maximum: 100, default: 100 }),\n ),\n after: Type.Optional(TypeBase64UrlEncodedString),\n }),\n ]),\n }),\n ReturnType: Type.Object({\n accounts: Type.Array(\n Type.Object({\n accountAddress: TypeAddress,\n id: TypeUuid,\n }),\n ),\n meta: Type.Object({\n totalCount: Type.Number(),\n after: Type.Union([TypeBase64UrlEncodedString, Type.Null()]),\n }),\n }),\n },\n {\n description:\n \"This method is used to list all smart accounts for a given signer.\",\n },\n);\n\nexport const wallet_createSession = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_createSession\"),\n params: Type.Tuple([\n Type.Intersect([\n PermissionsData,\n Type.Object({ account: TypeAddress }),\n ]),\n ]),\n }),\n ReturnType: Type.Object({\n sessionId: TypeHex(),\n signatureRequest: TypeSignatureRequest,\n }),\n },\n {\n description:\n \"This method is used to create a session for a given address with specified permissions.\",\n },\n);\n\nexport const wallet_getCallsStatus = Type.Object(\n {\n Request: Type.Object({\n method: Type.Literal(\"wallet_getCallsStatus\"),\n params: Type.Tuple([\n TypeHex({\n description: \"The call ID returned from wallet_sendPreparedCalls\",\n }),\n ]),\n }),\n ReturnType: Type.Object({\n id: TypeHex(),\n chainId: TypeHex(),\n atomic: Type.Boolean(),\n status: Type.Union([\n Type.Literal(100, {\n description:\n \"Batch has been received by the wallet but has not completed execution onchain\",\n }),\n Type.Literal(200, {\n description:\n \"Batch has been included onchain without reverts, receipts array contains info of all calls\",\n }),\n Type.Literal(400, {\n description:\n \"Batch has not been included onchain and wallet will not retry\",\n }),\n Type.Literal(500, {\n description:\n \"Batch reverted *completely* and only changes related to gas charge may have been included onchain\",\n }),\n Type.Literal(600, {\n description:\n \"Batch reverted *partially* and some changes related to batch calls may have been included onchain\",\n }),\n ]),\n receipts: Type.Optional(\n Type.Array(\n Type.Object({\n logs: Type.Array(\n Type.Object({\n address: TypeAddress,\n data: TypeHex(),\n topics: Type.Array(TypeHex()),\n }),\n ),\n status: TypeHex({\n description: \"0x1 for success, 0x0 for failure\",\n }),\n blockHash: TypeHex(),\n blockNumber: TypeHex(),\n gasUsed: TypeHex(),\n transactionHash: TypeHex(),\n }),\n ),\n ),\n }),\n },\n {\n description:\n \"This method is used to get the status of calls IDs returned from wallet_sendPreparedCalls.\",\n },\n);\n"]}
|
package/dist/esm/rpc/schema.d.ts
CHANGED
|
@@ -8,6 +8,29 @@ export declare const WalletServerRpcSchema: {
|
|
|
8
8
|
paymasterService?: {
|
|
9
9
|
policyId: string;
|
|
10
10
|
} | undefined;
|
|
11
|
+
gasParamsOverride?: {
|
|
12
|
+
callGasLimit?: `0x${string}` | {
|
|
13
|
+
multiplier: number;
|
|
14
|
+
} | undefined;
|
|
15
|
+
verificationGasLimit?: `0x${string}` | {
|
|
16
|
+
multiplier: number;
|
|
17
|
+
} | undefined;
|
|
18
|
+
preVerificationGas?: `0x${string}` | {
|
|
19
|
+
multiplier: number;
|
|
20
|
+
} | undefined;
|
|
21
|
+
maxFeePerGas?: `0x${string}` | {
|
|
22
|
+
multiplier: number;
|
|
23
|
+
} | undefined;
|
|
24
|
+
maxPriorityFeePerGas?: `0x${string}` | {
|
|
25
|
+
multiplier: number;
|
|
26
|
+
} | undefined;
|
|
27
|
+
paymasterVerificationGasLimit?: `0x${string}` | {
|
|
28
|
+
multiplier: number;
|
|
29
|
+
} | undefined;
|
|
30
|
+
paymasterPostOpGasLimit?: `0x${string}` | {
|
|
31
|
+
multiplier: number;
|
|
32
|
+
} | undefined;
|
|
33
|
+
} | undefined;
|
|
11
34
|
} | undefined;
|
|
12
35
|
chainId: `0x${string}`;
|
|
13
36
|
calls: {
|
|
@@ -87,7 +110,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
87
110
|
} | undefined;
|
|
88
111
|
type: "user-operation-v060" | "user-operation-v070";
|
|
89
112
|
signature: {
|
|
90
|
-
type:
|
|
113
|
+
type: "ecdsa";
|
|
91
114
|
signature: `0x${string}`;
|
|
92
115
|
};
|
|
93
116
|
chainId: `0x${string}`;
|
|
@@ -194,45 +217,45 @@ export declare const WalletServerRpcSchema: {
|
|
|
194
217
|
publicKey: `0x${string}`;
|
|
195
218
|
};
|
|
196
219
|
permissions: ({
|
|
197
|
-
type:
|
|
220
|
+
type: "native-token-transfer";
|
|
198
221
|
data: {
|
|
199
222
|
allowance: `0x${string}`;
|
|
200
223
|
};
|
|
201
224
|
} | {
|
|
202
|
-
type:
|
|
225
|
+
type: "erc20-token-transfer";
|
|
203
226
|
data: {
|
|
204
227
|
allowance: `0x${string}`;
|
|
205
228
|
address: `0x${string}`;
|
|
206
229
|
};
|
|
207
230
|
} | {
|
|
208
|
-
type:
|
|
231
|
+
type: "gas-limit";
|
|
209
232
|
data: {
|
|
210
233
|
limit: `0x${string}`;
|
|
211
234
|
};
|
|
212
235
|
} | {
|
|
213
|
-
type:
|
|
236
|
+
type: "contract-access";
|
|
214
237
|
data: {
|
|
215
238
|
address: `0x${string}`;
|
|
216
239
|
};
|
|
217
240
|
} | {
|
|
218
|
-
type:
|
|
241
|
+
type: "account-functions";
|
|
219
242
|
data: {
|
|
220
243
|
functions: `0x${string}`[];
|
|
221
244
|
};
|
|
222
245
|
} | {
|
|
223
|
-
type:
|
|
246
|
+
type: "functions-on-all-contracts";
|
|
224
247
|
data: {
|
|
225
248
|
functions: `0x${string}`[];
|
|
226
249
|
};
|
|
227
250
|
} | {
|
|
228
|
-
type:
|
|
251
|
+
type: "functions-on-contract";
|
|
229
252
|
data: {
|
|
230
253
|
address: `0x${string}`;
|
|
231
254
|
functions: `0x${string}`[];
|
|
232
255
|
};
|
|
233
256
|
} | {
|
|
234
257
|
data?: undefined;
|
|
235
|
-
type:
|
|
258
|
+
type: "root";
|
|
236
259
|
})[];
|
|
237
260
|
} & {
|
|
238
261
|
account: `0x${string}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,IAAI,EAQhD,CAAC","sourcesContent":["import { type Static, type StaticDecode } from \"@sinclair/typebox\";\nimport { RpcSchema } from \"ox\";\nimport * as Requests from \"./request\";\n\nexport const WalletServerRpcSchema = RpcSchema.from<\n | Static<typeof Requests.wallet_prepareCalls>\n | StaticDecode<typeof Requests.wallet_sendPreparedCalls>\n | Static<typeof Requests.wallet_createAccount>\n | Static<typeof Requests.wallet_requestAccount>\n | Static<typeof Requests.wallet_listAccounts>\n | Static<typeof Requests.wallet_createSession>\n | Static<typeof Requests.wallet_getCallsStatus>\n>();\n\nexport type WalletServerRpcSchemaType = typeof WalletServerRpcSchema;\n\ntype MethodToViemRpcSchema = {\n [K in WalletServerRpcSchemaType[\"Request\"][\"method\"]]: {\n Method: K;\n Parameters: Extract<\n WalletServerRpcSchemaType[\"Request\"],\n { method: K }\n >[\"params\"];\n ReturnType: Extract<\n WalletServerRpcSchemaType,\n { Request: { method: K } }\n >[\"ReturnType\"];\n };\n};\n\n// TODO: figure out how we can do this without manually listing all the methods\nexport type WalletServerViemRpcSchema = [\n MethodToViemRpcSchema[\"wallet_createAccount\"],\n MethodToViemRpcSchema[\"wallet_requestAccount\"],\n MethodToViemRpcSchema[\"wallet_listAccounts\"],\n MethodToViemRpcSchema[\"wallet_prepareCalls\"],\n MethodToViemRpcSchema[\"wallet_sendPreparedCalls\"],\n MethodToViemRpcSchema[\"wallet_getCallsStatus\"],\n MethodToViemRpcSchema[\"wallet_createSession\"],\n];\n"]}
|
|
@@ -5,5 +5,28 @@ export declare const Capabilities: import("@sinclair/typebox").TObject<{
|
|
|
5
5
|
paymasterService: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
6
6
|
policyId: import("@sinclair/typebox").TString;
|
|
7
7
|
}>>;
|
|
8
|
+
gasParamsOverride: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
9
|
+
preVerificationGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
10
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
11
|
+
}>]>>;
|
|
12
|
+
verificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
13
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
14
|
+
}>]>>;
|
|
15
|
+
callGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
16
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
17
|
+
}>]>>;
|
|
18
|
+
paymasterVerificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
19
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
20
|
+
}>]>>;
|
|
21
|
+
paymasterPostOpGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
22
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
23
|
+
}>]>>;
|
|
24
|
+
maxFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
25
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
26
|
+
}>]>>;
|
|
27
|
+
maxPriorityFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
28
|
+
multiplier: import("@sinclair/typebox").TNumber;
|
|
29
|
+
}>]>>;
|
|
30
|
+
}>>;
|
|
8
31
|
}>;
|
|
9
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAC"}
|