@account-kit/wallet-client 0.1.0-alpha.1 → 0.1.0-alpha.2
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/permissions/mav2.d.ts +2 -2
- package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
- package/dist/esm/client/actions/createAccount.d.ts +27 -2
- package/dist/esm/client/actions/createAccount.js +25 -0
- package/dist/esm/client/actions/createAccount.js.map +1 -1
- package/dist/esm/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +60 -2
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +26 -2
- package/dist/esm/client/actions/listAccounts.js +24 -0
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +28 -2
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +21 -2
- package/dist/esm/client/actions/requestAccount.js +14 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +22 -2
- package/dist/esm/client/actions/signMessage.js +4 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +35 -2
- package/dist/esm/client/actions/signTypedData.js +3 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +99 -11
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +7 -5
- package/dist/esm/client/decorator.js +1 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +4 -4
- package/dist/esm/client/index.js +29 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -0
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +1 -1
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/internal/decorator.d.ts +2 -0
- package/dist/esm/internal/decorator.js +10 -0
- package/dist/esm/internal/decorator.js.map +1 -0
- package/dist/esm/local/client.d.ts +1 -1
- package/dist/esm/local/client.js +8 -1
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +1 -1
- package/dist/esm/remote/client.js +6 -1
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +1 -1
- package/dist/esm/types.d.ts +15 -4
- package/dist/esm/types.js.map +1 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
- package/dist/types/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +60 -2
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +26 -2
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +28 -2
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +21 -2
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +22 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +35 -2
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +7 -5
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/internal/decorator.d.ts +3 -0
- package/dist/types/internal/decorator.d.ts.map +1 -0
- package/dist/types/local/client.d.ts +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +1 -1
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +1 -1
- package/dist/types/types.d.ts +15 -4
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/capabilities/permissions/mav2.ts +2 -2
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/getCallsStatus.ts +21 -2
- package/src/client/actions/grantPermissions.ts +60 -2
- package/src/client/actions/listAccounts.ts +26 -2
- package/src/client/actions/prepareCalls.ts +28 -2
- package/src/client/actions/requestAccount.ts +40 -5
- package/src/client/actions/sendPreparedCalls.ts +39 -2
- package/src/client/actions/signMessage.ts +24 -4
- package/src/client/actions/signSignatureRequest.ts +31 -0
- package/src/client/actions/signTypedData.ts +39 -3
- package/src/client/client.e2e-test.ts +120 -11
- package/src/client/decorator.ts +10 -12
- package/src/client/index.ts +41 -10
- package/src/exports/index.ts +1 -0
- package/src/exports/internal.ts +1 -1
- package/src/internal/decorator.ts +12 -0
- package/src/local/client.ts +52 -42
- package/src/remote/client.ts +10 -5
- package/src/types.ts +18 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types\";\nexport * from \"../utils.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAE9B,cAAc,aAAa,CAAC","sourcesContent":["// exports from this file are meant to be imported by our packages in the monorepo\n// we will expose this in the package.json as a named export like `this-pkg/internal`\n// TODO: name `this-pkg`\nexport * from \"../capabilities/index.js\";\nexport * from \"../capabilities/paymaster.js\";\nexport * from \"../capabilities/permissions/index.js\";\nexport * from \"../capabilities/permissions/mav2.js\";\nexport type * from \"../isomorphic/client.js\";\nexport { createIsomorphicClient } from \"../isomorphic/client.js\";\nexport { createDummySigner } from \"../isomorphic/utils/createDummySigner.js\";\nexport * from \"../rpc/request.js\";\nexport * as RpcSchemas from \"../rpc/request.js\";\nexport * from \"../rpc/schema.js\";\nexport * from \"../schemas.js\";\nexport type * from \"../types.ts\";\nexport * from \"../utils.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/internal/decorator.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB;IACpC,IAAI,OAAO,GAA8B,SAAS,CAAC;IAEnD,OAAO;QACL,UAAU,EAAE,CAAC,UAAyB,EAAE,EAAE;YACxC,OAAO,GAAG,UAAU,CAAC;QACvB,CAAC;QACD,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import type { CachedAccount, InternalState } from \"../types.ts\";\n\nexport function internalStateDecorator(): InternalState {\n let account: CachedAccount | undefined = undefined;\n\n return {\n setAccount: (newAccount: CachedAccount) => {\n account = newAccount;\n },\n getAccount: () => account,\n };\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Address, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
3
|
export declare function createLocalClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
|
package/dist/esm/local/client.js
CHANGED
|
@@ -3,6 +3,7 @@ import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experime
|
|
|
3
3
|
import { createClient, custom } from "viem";
|
|
4
4
|
import { encodePermissionsContext, prefixSignatureKeyType, } from "../capabilities/permissions/mav2.js";
|
|
5
5
|
import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
6
|
+
import { internalStateDecorator } from "../internal/decorator.js";
|
|
6
7
|
import { createIsomorphicClient, } from "../isomorphic/client.js";
|
|
7
8
|
import { assertNever } from "../utils.js";
|
|
8
9
|
const localMethods = [
|
|
@@ -56,6 +57,8 @@ export function createLocalClient(params) {
|
|
|
56
57
|
return assertNever(args.method, `Unexpected method: ${args.method}`);
|
|
57
58
|
}
|
|
58
59
|
},
|
|
60
|
+
}, {
|
|
61
|
+
retryCount: 0,
|
|
59
62
|
}),
|
|
60
63
|
},
|
|
61
64
|
],
|
|
@@ -65,9 +68,13 @@ export function createLocalClient(params) {
|
|
|
65
68
|
transport: innerTransport,
|
|
66
69
|
chain,
|
|
67
70
|
account,
|
|
68
|
-
})
|
|
71
|
+
})
|
|
72
|
+
.extend(() => ({
|
|
69
73
|
policyId,
|
|
70
74
|
...innerClientActions(isomorphicClient),
|
|
75
|
+
}))
|
|
76
|
+
.extend(() => ({
|
|
77
|
+
internal: internalStateDecorator(),
|
|
71
78
|
}));
|
|
72
79
|
}
|
|
73
80
|
const innerClientActions = (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,OAA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CAAC;iBACF,EACD;oBACE,UAAU,EAAE,CAAC;iBACd,CACF;aACF;SACF;QACD,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;QAClB,SAAS,EAAE,cAAc;QACzB,KAAK;QACL,OAAO;KACR,CAAC;SACC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ;QACR,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;KACxC,CAAC,CAAC;SACF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,gBAAkC,EACd,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,gBAAgB,EAAE,oCAAoC,EAAE,GAC9D,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAE/C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,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.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls.ts\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types.ts\";\nimport { assertNever } from \"../utils.js\";\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 {\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 retryCount: 0,\n },\n ),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n })\n .extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\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"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Address, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
3
|
export declare function createRemoteClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
|
|
@@ -2,6 +2,7 @@ import { Provider } from "ox";
|
|
|
2
2
|
import { createClient, custom } from "viem";
|
|
3
3
|
import { encodePermissionsContext } from "../capabilities/permissions/mav2.js";
|
|
4
4
|
import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
5
|
+
import { internalStateDecorator } from "../internal/decorator.js";
|
|
5
6
|
import { WalletServerRpcSchema } from "../rpc/schema.js";
|
|
6
7
|
/**
|
|
7
8
|
* This is a low-level client just used to make RPC requests in remote mode
|
|
@@ -15,9 +16,13 @@ export function createRemoteClient(params) {
|
|
|
15
16
|
transport: (opts) => custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(opts),
|
|
16
17
|
chain,
|
|
17
18
|
account,
|
|
18
|
-
})
|
|
19
|
+
})
|
|
20
|
+
.extend((_client) => ({
|
|
19
21
|
policyId: params.policyId,
|
|
20
22
|
...innerClientActions(_client),
|
|
23
|
+
}))
|
|
24
|
+
.extend(() => ({
|
|
25
|
+
internal: internalStateDecorator(),
|
|
21
26
|
}));
|
|
22
27
|
return client;
|
|
23
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAczD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,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,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,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E,SAAS,EAAE,GAAG,MAAM,oBAAoB,CAC9C,MAAM,EACN,gBAAgB,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS;iBACV,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address, type JsonRpcAccount } from \"viem\";\nimport { encodePermissionsContext } from \"../capabilities/permissions/mav2.js\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport { WalletServerRpcSchema } from \"../rpc/schema.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\nexport function createRemoteClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const { signature } = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature,\n }),\n };\n },\n };\n};\n"]}
|
package/dist/esm/rpc/schema.d.ts
CHANGED
|
@@ -263,6 +263,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
263
263
|
method: "wallet_createSession";
|
|
264
264
|
};
|
|
265
265
|
ReturnType: {
|
|
266
|
+
sessionId: `0x${string}`;
|
|
266
267
|
signatureRequest: {
|
|
267
268
|
type: "personal_sign";
|
|
268
269
|
data: string | {
|
|
@@ -290,7 +291,6 @@ export declare const WalletServerRpcSchema: {
|
|
|
290
291
|
};
|
|
291
292
|
};
|
|
292
293
|
};
|
|
293
|
-
sessionId: `0x${string}`;
|
|
294
294
|
};
|
|
295
295
|
} | {
|
|
296
296
|
Request: {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
1
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
2
3
|
import type { Address, Chain, Client, Hex, IsUndefined, JsonRpcAccount, Transport } from "viem";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
|
|
5
|
+
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
6
|
+
import type { WalletServerViemRpcSchema } from "./rpc/schema.ts";
|
|
6
7
|
export type CreateInnerClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = {
|
|
7
8
|
chain: Chain;
|
|
8
9
|
transport: AlchemyTransport;
|
|
@@ -24,4 +25,14 @@ export type InnerClientActions = {
|
|
|
24
25
|
chainId: Hex;
|
|
25
26
|
}) => Promise<GrantPermissionsResult>;
|
|
26
27
|
};
|
|
27
|
-
export type
|
|
28
|
+
export type CachedAccount = {
|
|
29
|
+
account: SmartContractAccount;
|
|
30
|
+
requestParams: RequestAccountParams;
|
|
31
|
+
};
|
|
32
|
+
export type InternalState = {
|
|
33
|
+
setAccount: (account: CachedAccount) => void;
|
|
34
|
+
getAccount: () => CachedAccount | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type InnerWalletApiClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = InnerWalletApiClientBase<TAccount, InnerClientActions & {
|
|
37
|
+
internal: InternalState;
|
|
38
|
+
}>;
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n IsUndefined,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n IsUndefined,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type {\n GrantPermissionsParams,\n GrantPermissionsResult,\n} from \"./client/actions/grantPermissions.ts\";\nimport type { RequestAccountParams } from \"./client/actions/requestAccount.ts\";\nimport type { WalletServerViemRpcSchema } from \"./rpc/schema.ts\";\n\nexport type CreateInnerClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = {\n chain: Chain;\n transport: AlchemyTransport;\n policyId?: string;\n} & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n });\n\nexport type InnerWalletApiClientBase<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n TExtend extends { [key: string]: unknown } | undefined =\n | { [key: string]: unknown }\n | undefined,\n> = Client<\n Transport,\n Chain,\n TAccount,\n WalletServerViemRpcSchema,\n { policyId?: string } & TExtend\n>;\n\nexport type InnerClientActions = {\n grantPermissions: (\n signer: SmartAccountSigner,\n params: GrantPermissionsParams & { chainId: Hex },\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport type CachedAccount = {\n account: SmartContractAccount;\n requestParams: RequestAccountParams;\n};\n\nexport type InternalState = {\n setAccount: (account: CachedAccount) => void;\n getAccount: () => CachedAccount | undefined;\n};\n\nexport type InnerWalletApiClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = InnerWalletApiClientBase<\n TAccount,\n InnerClientActions & { internal: InternalState }\n>;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
2
|
import { type Hex } from "viem";
|
|
3
|
-
import type { PermissionsData } from ".";
|
|
4
|
-
import type { KeySigner } from "../../schemas";
|
|
3
|
+
import type { PermissionsData } from "./index.ts";
|
|
4
|
+
import type { KeySigner } from "../../schemas.ts";
|
|
5
5
|
export declare const SESSION_ID_LENGTH_BYTES = 16;
|
|
6
6
|
export declare const ENTITY_ID_LENGTH_BYTES = 4;
|
|
7
7
|
export declare const PermissionsContextVersion: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mav2.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/permissions/mav2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mav2.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/permissions/mav2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAu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@@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_createAccount } from "../../rpc/request";
|
|
5
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
+
import type { wallet_createAccount } from "../../rpc/request.ts";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
6
6
|
export type CreateAccountParams = Omit<Extract<Static<typeof wallet_createAccount>["Request"]["params"][0], {
|
|
7
7
|
signerAddress: Address;
|
|
8
8
|
}>, "signerAddress">;
|
|
9
9
|
export type CreateAccountResult = Static<typeof wallet_createAccount>["ReturnType"];
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
12
|
+
* This method is primarily used to import existing accounts.
|
|
13
|
+
* For most cases, you should use requestAccount instead.
|
|
14
|
+
* If the account already exists, an error will be thrown.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
18
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
19
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
20
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
21
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
22
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
23
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Create a new account with a custom salt
|
|
27
|
+
* const account = await client.createAccount({
|
|
28
|
+
* creationOptions: {
|
|
29
|
+
* accountType: "sma-b",
|
|
30
|
+
* salt: "0x04"
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
34
|
+
*/
|
|
10
35
|
export declare function createAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params: CreateAccountParams): Promise<CreateAccountResult>;
|
|
11
36
|
//# sourceMappingURL=createAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,OAAO,CACL,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC3D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,OAAO,oBAAoB,CAC5B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAK9B"}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import type { Address, JsonRpcAccount } from "viem";
|
|
2
|
-
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
|
|
5
5
|
export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the status of a prepared call by its ID.
|
|
8
|
+
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
9
|
+
*
|
|
10
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
11
|
+
* @param {GetCallsStatusParams} params - The ID of the prepared call to check
|
|
12
|
+
* @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
|
|
13
|
+
* - id: The hex ID of the call
|
|
14
|
+
* - chainId: The chain ID in hex format
|
|
15
|
+
* - status: The current status of the batch execution
|
|
16
|
+
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // After sending prepared calls
|
|
20
|
+
* const sendResult = await client.sendPreparedCalls({...});
|
|
21
|
+
*
|
|
22
|
+
* // Check the status of the first call ID
|
|
23
|
+
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
24
|
+
*/
|
|
6
25
|
export declare function getCallsStatus<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
|
|
7
26
|
//# sourceMappingURL=getCallsStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,
|
|
1
|
+
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Address, type Hex, type IsUndefined, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
3
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
|
-
import type { CreateSessionParams } from "../../isomorphic/actions/createSession";
|
|
4
|
+
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
5
5
|
export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Omit<CreateSessionParams, "account" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
6
6
|
account: Address;
|
|
7
7
|
} : {
|
|
@@ -10,5 +10,63 @@ export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | un
|
|
|
10
10
|
export type GrantPermissionsResult = {
|
|
11
11
|
context: Hex;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Grants permissions to a smart account by creating a session.
|
|
15
|
+
* This allows another key to perform operations on behalf of the account.
|
|
16
|
+
*
|
|
17
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
18
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
19
|
+
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
20
|
+
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
21
|
+
* @param {number} params.expiry - Unix timestamp when the permissions expire
|
|
22
|
+
* @param {object} params.key - The session key information
|
|
23
|
+
* @param {string} params.key.publicKey - The public key of the session key
|
|
24
|
+
* @param {string} params.key.type - The type of the key (e.g., "secp256k1")
|
|
25
|
+
* @param {Array} params.permissions - Array of permission objects defining what the session key can do
|
|
26
|
+
* @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier
|
|
27
|
+
* @returns {Hex} result.context - A hex identifier for the granted permissions context
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Create a session key and grant root permissions
|
|
31
|
+
* const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
|
|
32
|
+
* const account = await client.requestAccount();
|
|
33
|
+
*
|
|
34
|
+
* const permissions = await client.grantPermissions({
|
|
35
|
+
* account: account.address,
|
|
36
|
+
* expiry: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
|
|
37
|
+
* key: {
|
|
38
|
+
* publicKey: await sessionKey.getAddress(),
|
|
39
|
+
* type: "secp256k1",
|
|
40
|
+
* },
|
|
41
|
+
* permissions: [{ type: "root" }],
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Use the permissions to prepare a call
|
|
45
|
+
* const preparedUO = await client.prepareCalls({
|
|
46
|
+
* calls: [{ to: zeroAddress, value: "0x0" }],
|
|
47
|
+
* from: account.address,
|
|
48
|
+
* capabilities: {
|
|
49
|
+
* paymasterService: {
|
|
50
|
+
* policyId: "your-paymaster-policy-id",
|
|
51
|
+
* },
|
|
52
|
+
* permissions,
|
|
53
|
+
* },
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // Sign with the session key
|
|
57
|
+
* const signature = await signSignatureRequest(
|
|
58
|
+
* sessionKey,
|
|
59
|
+
* preparedUO.signatureRequest,
|
|
60
|
+
* );
|
|
61
|
+
*
|
|
62
|
+
* // Send the prepared call using the session key
|
|
63
|
+
* const result = await client.sendPreparedCalls({
|
|
64
|
+
* ...preparedUO,
|
|
65
|
+
* signature,
|
|
66
|
+
* capabilities: {
|
|
67
|
+
* permissions,
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
13
71
|
export declare function grantPermissions<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: GrantPermissionsParams<TAccount>): Promise<GrantPermissionsResult>;
|
|
14
72
|
//# sourceMappingURL=grantPermissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantPermissions.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,WAAW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
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_listAccounts } from "../../rpc/request";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { wallet_listAccounts } from "../../rpc/request.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type ListAccountsParams = Static<typeof wallet_listAccounts>["Request"]["params"][0];
|
|
5
5
|
export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"];
|
|
6
|
+
/**
|
|
7
|
+
* Lists all smart accounts for a given signer using the wallet API client.
|
|
8
|
+
*
|
|
9
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
10
|
+
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
11
|
+
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
12
|
+
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
13
|
+
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
14
|
+
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Fetch the first page of accounts
|
|
18
|
+
* const firstPage = await client.listAccounts({
|
|
19
|
+
* signerAddress: "0x123...",
|
|
20
|
+
* limit: 10
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // If an 'after' cursor exists, use it to fetch the next page
|
|
24
|
+
* const nextPage = await client.listAccounts({
|
|
25
|
+
* signerAddress: "0x123...",
|
|
26
|
+
* limit: 10,
|
|
27
|
+
* after: firstPage.meta.after
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
6
30
|
export declare function listAccounts(client: InnerWalletApiClient, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
7
31
|
//# sourceMappingURL=listAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"listAccounts.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,OAAO,mBAAmB,CAC3B,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,OAAO,mBAAmB,CAC3B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAE7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address, type IsUndefined, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type GetAccountParam<TAccount> = IsUndefined<TAccount> extends true ? {
|
|
5
5
|
account: Address;
|
|
6
6
|
} : {
|
|
@@ -12,5 +12,31 @@ export type PrepareCallsParams<TAccount extends JsonRpcAccount<Address> | undefi
|
|
|
12
12
|
from?: never;
|
|
13
13
|
});
|
|
14
14
|
export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
15
|
+
/**
|
|
16
|
+
* Prepares a set of contract calls for execution by building a user operation.
|
|
17
|
+
* Returns the built user operation and a signature request that needs to be signed
|
|
18
|
+
* before submitting to sendPreparedCalls.
|
|
19
|
+
*
|
|
20
|
+
* @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request
|
|
21
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for preparing calls
|
|
22
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
23
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
24
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request
|
|
25
|
+
* @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing
|
|
26
|
+
* the user operation data and signature request
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Prepare a sponosored user operation call
|
|
30
|
+
* const result = await client.prepareCalls({
|
|
31
|
+
* calls: [{
|
|
32
|
+
* to: "0x1234...",
|
|
33
|
+
* data: "0xabcdef...",
|
|
34
|
+
* value: "0x0"
|
|
35
|
+
* }],
|
|
36
|
+
* capabilities: {
|
|
37
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*/
|
|
15
41
|
export declare function prepareCalls<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: PrepareCallsParams<TAccount>): Promise<PrepareCallsResult>;
|
|
16
42
|
//# sourceMappingURL=prepareCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,kBAAkB,IAAI,4BAA4B,EAClD,kBAAkB,IAAI,4BAA4B,EACnD,MAAM,
|
|
1
|
+
{"version":3,"file":"prepareCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,kBAAkB,IAAI,4BAA4B,EAClD,kBAAkB,IAAI,4BAA4B,EACnD,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,eAAe,CAAC,QAAQ,IAClC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC9B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GACpB;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE1B,MAAM,MAAM,kBAAkB,CAC5B,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,IACX,IAAI,CAAC,4BAA4B,EAAE,MAAM,GAAG,SAAS,CAAC,GACxD,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,4BAA4B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACnC,OAAO,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
4
|
import { type IsUndefined, type JsonRpcAccount } from "viem";
|
|
@@ -6,7 +6,26 @@ import type { wallet_requestAccount } from "../../rpc/request.js";
|
|
|
6
6
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
7
7
|
export type RequestAccountParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = IsUndefined<TAccount> extends true ? Omit<Extract<Static<typeof wallet_requestAccount>["Request"]["params"][0], {
|
|
8
8
|
signerAddress: Address;
|
|
9
|
-
}>, "signerAddress" | "includeCounterfactualInfo">
|
|
9
|
+
}>, "signerAddress" | "includeCounterfactualInfo"> & {
|
|
10
|
+
accountAddress?: Address;
|
|
11
|
+
} : never;
|
|
10
12
|
export type RequestAccountResult = SmartContractAccount;
|
|
13
|
+
/**
|
|
14
|
+
* Requests an account for the provided signer using the wallet API client.
|
|
15
|
+
* If an account already exists for the signer, it will always return that account unless a new ID is specified.
|
|
16
|
+
* If an account already exists, the creationHint will be ignored.
|
|
17
|
+
*
|
|
18
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
19
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
20
|
+
* @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account
|
|
21
|
+
* @param {string} [params.id] - Optional identifier for the account. If specified, a new account with this ID will be created even if one already exists for the signer
|
|
22
|
+
* @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists
|
|
23
|
+
* @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Request an account with default parameters using a local signer
|
|
27
|
+
* const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
|
|
28
|
+
* const account = await client.requestAccount(signer);
|
|
29
|
+
*/
|
|
11
30
|
export declare function requestAccount<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params?: RequestAccountParams<TAccount>): Promise<RequestAccountResult>;
|
|
12
31
|
//# sourceMappingURL=requestAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"requestAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,CAC9B,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,IAEb,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAC9B,IAAI,CACF,OAAO,CACL,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC5D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,GAAG,2BAA2B,CAC9C,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,KAAK,CAAC;AAGZ,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GACtC,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
import type { Static, StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_sendPreparedCalls } from "../../rpc/request";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { wallet_sendPreparedCalls } from "../../rpc/request.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
export type SendPreparedCallsParams = Omit<StaticDecode<typeof wallet_sendPreparedCalls>["Request"]["params"][0], "chainId">;
|
|
5
5
|
export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["ReturnType"];
|
|
6
|
+
/**
|
|
7
|
+
* Sends prepared calls by submitting a signed user operation.
|
|
8
|
+
* This method is used after signing the signature request returned from prepareCalls.
|
|
9
|
+
*
|
|
10
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
11
|
+
* @param {SendPreparedCallsParams} params - Parameters for sending prepared calls
|
|
12
|
+
* @param {string} params.type - The user operation type ('user-operation-v060' or 'user-operation-v070')
|
|
13
|
+
* @param {object} params.data - The user operation data without signature
|
|
14
|
+
* @param {string} params.chainId - The chain ID in hex format
|
|
15
|
+
* @param {object} params.signature - The signature object
|
|
16
|
+
* @param {string} params.signature.type - The signature type (must be 'ecdsa')
|
|
17
|
+
* @param {string} params.signature.signature - The hex-encoded signature value
|
|
18
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request
|
|
19
|
+
* @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // First prepare the calls
|
|
23
|
+
* const preparedCalls = await client.prepareCalls({
|
|
24
|
+
* calls: [{
|
|
25
|
+
* to: "0x1234...",
|
|
26
|
+
* data: "0xabcdef...",
|
|
27
|
+
* value: "0x0"
|
|
28
|
+
* }],
|
|
29
|
+
* capabilities: {
|
|
30
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* // Sign the signature request using signSignatureRequest with your signer
|
|
35
|
+
* const signedRequest = await client.signSignatureRequest(preparedCalls.signatureRequest);
|
|
36
|
+
*
|
|
37
|
+
* // Then send the prepared calls with the signature
|
|
38
|
+
* const result = await client.sendPreparedCalls({
|
|
39
|
+
* ...preparedCalls,
|
|
40
|
+
* signature: signedRequest.signature,
|
|
41
|
+
* });
|
|
42
|
+
*/
|
|
6
43
|
export declare function sendPreparedCalls(client: InnerWalletApiClient, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
|
|
7
44
|
//# sourceMappingURL=sendPreparedCalls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sendPreparedCalls.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,YAAY,CAAC,OAAO,wBAAwB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACrE,SAAS,CACV,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,wBAAwB,CAChC,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAKlC"}
|