@account-kit/wallet-client 0.0.1-alpha.1 → 0.1.0-alpha.1
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/abi/index.d.ts +8 -8
- package/dist/esm/abi/index.js +8 -8
- package/dist/esm/abi/index.js.map +1 -1
- package/dist/esm/capabilities/index.d.ts +23 -0
- package/dist/esm/capabilities/index.js +4 -2
- 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 +26 -15
- package/dist/esm/capabilities/permissions/index.js.map +1 -1
- package/dist/esm/capabilities/permissions/mav2.js +1 -1
- package/dist/esm/capabilities/permissions/mav2.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/requestAccount.d.ts +2 -2
- package/dist/esm/client/actions/requestAccount.js +2 -2
- package/dist/esm/client/actions/requestAccount.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/actions/signMessage.d.ts +1 -1
- package/dist/esm/client/actions/signMessage.js +1 -1
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +1 -1
- package/dist/esm/client/actions/signSignatureRequest.js +2 -2
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +1 -1
- package/dist/esm/client/actions/signTypedData.js +1 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +5 -6
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +8 -8
- package/dist/esm/client/decorator.js +10 -10
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +1 -1
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +13 -13
- package/dist/esm/exports/index.js +13 -13
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +12 -12
- package/dist/esm/exports/internal.js +11 -11
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/isomorphic/actions/createSession.d.ts +3 -3
- package/dist/esm/isomorphic/actions/createSession.js +7 -5
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +2 -2
- package/dist/esm/isomorphic/actions/getCallsStatus.js +3 -3
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +2 -2
- package/dist/esm/isomorphic/actions/prepareCalls.js +4 -3
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +4 -4
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +3 -3
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +8 -7
- package/dist/esm/isomorphic/client.js +15 -8
- package/dist/esm/isomorphic/client.js.map +1 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
- package/dist/esm/isomorphic/utils/createAccount.js +1 -1
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +1 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
- package/dist/esm/local/client.js +6 -5
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.js +3 -3
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/request.d.ts +32 -9
- package/dist/esm/rpc/request.js +17 -7
- package/dist/esm/rpc/request.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +32 -9
- package/dist/esm/rpc/schema.js +1 -1
- package/dist/esm/rpc/schema.js.map +1 -1
- package/dist/types/abi/index.d.ts +8 -8
- package/dist/types/abi/index.d.ts.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/requestAccount.d.ts +2 -2
- package/dist/types/client/actions/requestAccount.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/actions/signMessage.d.ts +1 -1
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +1 -1
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +8 -8
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +13 -13
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +12 -12
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/createSession.d.ts +3 -3
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +2 -2
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +2 -2
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +4 -4
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +8 -7
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts +2 -2
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +4 -4
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/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 +8 -3
- package/src/abi/index.ts +8 -8
- package/src/capabilities/index.ts +4 -2
- package/src/capabilities/overrides.ts +20 -0
- package/src/capabilities/permissions/index.ts +42 -24
- package/src/capabilities/permissions/mav2.ts +1 -1
- package/src/client/actions/grantPermissions.ts +1 -1
- package/src/client/actions/requestAccount.ts +4 -4
- package/src/client/actions/sendPreparedCalls.ts +3 -3
- package/src/client/actions/signMessage.ts +2 -2
- package/src/client/actions/signSignatureRequest.ts +2 -2
- package/src/client/actions/signTypedData.ts +2 -2
- package/src/client/client.e2e-test.ts +5 -6
- package/src/client/decorator.ts +19 -19
- package/src/client/index.ts +6 -3
- package/src/exports/index.ts +13 -13
- package/src/exports/internal.ts +12 -12
- package/src/isomorphic/actions/createSession.ts +18 -14
- package/src/isomorphic/actions/getCallsStatus.ts +6 -6
- package/src/isomorphic/actions/prepareCalls.ts +7 -6
- package/src/isomorphic/actions/sendPreparedCalls.ts +7 -7
- package/src/isomorphic/client.ts +24 -11
- package/src/isomorphic/utils/createAccount.ts +3 -3
- package/src/isomorphic/utils/parsePermissionsContext.ts +3 -3
- package/src/local/client.ts +9 -8
- package/src/remote/client.ts +3 -3
- package/src/rpc/request.ts +33 -18
- package/src/rpc/schema.ts +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type Address, type Hex, type JsonRpcAccount, type TypedDataDefinition } from "viem";
|
|
2
3
|
import type { InnerWalletApiClient } from "../../types";
|
|
3
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
export type SignTypedDataParams = TypedDataDefinition;
|
|
5
5
|
export type SignTypedDataResult = Hex;
|
|
6
6
|
export declare function signTypedData<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from "viem";
|
|
2
|
-
import { requestAccount } from "./requestAccount";
|
|
2
|
+
import { requestAccount } from "./requestAccount.js";
|
|
3
3
|
export async function signTypedData(client, signer, params) {
|
|
4
4
|
const account = await requestAccount(client, signer);
|
|
5
5
|
return account.signTypedDataWith6492(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBrD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition;\n\nexport type SignTypedDataResult = Hex;\n\nexport async function signTypedData<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult>;\n\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer);\n return account.signTypedDataWith6492(params);\n}\n"]}
|
|
@@ -2,9 +2,8 @@ import { LocalAccountSigner } from "@aa-sdk/core";
|
|
|
2
2
|
import { alchemy, arbitrumSepolia } from "@account-kit/infra";
|
|
3
3
|
import { describe, expect, it } from "bun:test";
|
|
4
4
|
import { createPublicClient, zeroAddress } from "viem";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { signSignatureRequest } from "./actions/signSignatureRequest";
|
|
5
|
+
import { signSignatureRequest } from "./actions/signSignatureRequest.js";
|
|
6
|
+
import { createSmartWalletClient } from "./index.js";
|
|
8
7
|
describe("Client E2E Tests", () => {
|
|
9
8
|
const transport = alchemy(process.env.ALCHEMY_PROXY_RPC_URL
|
|
10
9
|
? {
|
|
@@ -72,7 +71,7 @@ describe("Client E2E Tests", () => {
|
|
|
72
71
|
const result = await client.sendPreparedCalls({
|
|
73
72
|
...preparedUO,
|
|
74
73
|
signature: {
|
|
75
|
-
type: "
|
|
74
|
+
type: "ecdsa",
|
|
76
75
|
signature,
|
|
77
76
|
},
|
|
78
77
|
});
|
|
@@ -88,7 +87,7 @@ describe("Client E2E Tests", () => {
|
|
|
88
87
|
publicKey: await sessionKey.getAddress(),
|
|
89
88
|
type: "secp256k1",
|
|
90
89
|
},
|
|
91
|
-
permissions: [{ type:
|
|
90
|
+
permissions: [{ type: "root" }],
|
|
92
91
|
});
|
|
93
92
|
const preparedUO = await client.prepareCalls({
|
|
94
93
|
calls: [{ to: zeroAddress, value: "0x0" }],
|
|
@@ -180,7 +179,7 @@ describe("Client E2E Tests", () => {
|
|
|
180
179
|
publicKey: await sessionKey.getAddress(),
|
|
181
180
|
type: "secp256k1",
|
|
182
181
|
},
|
|
183
|
-
permissions: [{ type:
|
|
182
|
+
permissions: [{ type: "root" }],
|
|
184
183
|
});
|
|
185
184
|
const preparedUO = await client.prepareCalls({
|
|
186
185
|
calls: [{ to: zeroAddress, value: "0x0" }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,M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EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;aACpC;YACD,IAAI,EAAE;gBACJ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAChC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;aACrC;SACF;QACD,WAAW,EAAE,MAAe;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,CAAC;YACV,iBAAiB,EACf,4CAAuD;SAC1D;QACD,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { createSmartWalletClient } from \".\";\nimport { PermissionType } from \"@account-kit/smart-contracts/experimental\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n if (preparedUO.signatureRequest.type !== \"personal_sign\") {\n throw new Error(\"Invalid signature request type\");\n }\n\n const signature = await signer.signMessage(\n preparedUO.signatureRequest.data,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature: {\n type: \"ECDSA\",\n signature,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: PermissionType.ROOT }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: PermissionType.ROOT }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
|
|
1
|
+
{"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,c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AAgB,CAC5B,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;gBAC5C,GAAG,UAAU;gBACb,SAAS;gBACT,YAAY,EAAE;oBACZ,WAAW;iBACZ;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG;QACrB,KAAK,EAAE;YACL,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAChC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;aACpC;YACD,IAAI,EAAE;gBACJ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAChC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;aACrC;SACF;QACD,WAAW,EAAE,MAAe;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,CAAC;YACV,iBAAiB,EACf,4CAAuD;SAC1D;QACD,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest.js\";\nimport { createSmartWalletClient } from \"./index.js\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n if (preparedUO.signatureRequest.type !== \"personal_sign\") {\n throw new Error(\"Invalid signature request type\");\n }\n\n const signature = await signer.signMessage(\n preparedUO.signatureRequest.data,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature: {\n type: \"ecdsa\",\n signature,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: \"root\" }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
|
|
@@ -2,13 +2,13 @@ import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
|
2
2
|
import type { Hex, JsonRpcAccount, SignableMessage, TypedDataDefinition } from "viem";
|
|
3
3
|
import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls";
|
|
4
4
|
import type { InnerWalletApiClient } from "../types";
|
|
5
|
-
import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount";
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
8
|
-
import { type
|
|
9
|
-
import { type
|
|
10
|
-
import { type
|
|
11
|
-
import { type
|
|
5
|
+
import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount.js";
|
|
6
|
+
import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
|
|
7
|
+
import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
|
|
8
|
+
import { type ListAccountsParams, type ListAccountsResult } from "./actions/listAccounts.js";
|
|
9
|
+
import { type PrepareCallsParams, type PrepareCallsResult } from "./actions/prepareCalls.js";
|
|
10
|
+
import { type RequestAccountParams, type RequestAccountResult } from "./actions/requestAccount.js";
|
|
11
|
+
import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
|
|
12
12
|
export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined> = {
|
|
13
13
|
requestAccount: (params?: RequestAccountParams<TAccount>) => Promise<RequestAccountResult>;
|
|
14
14
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
@@ -19,6 +19,6 @@ export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = Jso
|
|
|
19
19
|
signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
|
|
20
20
|
signMessage: (params: SignableMessage) => Promise<Hex>;
|
|
21
21
|
signTypedData: (params: TypedDataDefinition) => Promise<Hex>;
|
|
22
|
-
grantPermissions: (params: GrantPermissionsParams) => Promise<GrantPermissionsResult>;
|
|
22
|
+
grantPermissions: (params: GrantPermissionsParams<TAccount>) => Promise<GrantPermissionsResult>;
|
|
23
23
|
};
|
|
24
24
|
export declare function smartWalletClientActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createAccount, } from "./actions/createAccount";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { createAccount, } from "./actions/createAccount.js";
|
|
2
|
+
import { getCallsStatus, } from "./actions/getCallsStatus.js";
|
|
3
|
+
import { grantPermissions, } from "./actions/grantPermissions.js";
|
|
4
|
+
import { listAccounts, } from "./actions/listAccounts.js";
|
|
5
|
+
import { prepareCalls, } from "./actions/prepareCalls.js";
|
|
6
|
+
import { requestAccount, } from "./actions/requestAccount.js";
|
|
7
|
+
import { sendPreparedCalls } from "./actions/sendPreparedCalls.js";
|
|
8
|
+
import { signMessage } from "./actions/signMessage.js";
|
|
9
|
+
import { signSignatureRequest, } from "./actions/signSignatureRequest.js";
|
|
10
|
+
import { signTypedData } from "./actions/signTypedData.js";
|
|
11
11
|
export function smartWalletClientActions(client, signer) {
|
|
12
12
|
return {
|
|
13
13
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,aAAa,GAGd,MAAM,
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,oBAAoB,GAGrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAoC3D,MAAM,UAAU,wBAAwB,CACtC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO;QACL,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAClE,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1D,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;QACtE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type {\n Hex,\n JsonRpcAccount,\n SignableMessage,\n TypedDataDefinition,\n} from \"viem\";\nimport type {\n SendPreparedCallsParams,\n SendPreparedCallsResult,\n} from \"../isomorphic/actions/sendPreparedCalls\";\nimport type { InnerWalletApiClient } from \"../types\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport { sendPreparedCalls } from \"./actions/sendPreparedCalls.js\";\nimport { signMessage } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport { signTypedData } from \"./actions/signTypedData.js\";\n\nexport type SmartWalletActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams<TAccount>,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signMessage: (params: SignableMessage) => Promise<Hex>;\n signTypedData: (params: TypedDataDefinition) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount>;\n\nexport function smartWalletClientActions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n createAccount: (params) => createAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
|
2
2
|
import { type AlchemyTransport } from "@account-kit/infra";
|
|
3
3
|
import { type Address, type Chain, type IsUndefined, type JsonRpcAccount, type Prettify } from "viem";
|
|
4
4
|
import type { InnerWalletApiClient } from "../types";
|
|
5
|
-
import { type SmartWalletActions } from "./decorator";
|
|
5
|
+
import { type SmartWalletActions } from "./decorator.js";
|
|
6
6
|
export type SmartWalletClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Prettify<{
|
|
7
7
|
transport: AlchemyTransport;
|
|
8
8
|
chain: Chain;
|
package/dist/esm/client/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {} from "@aa-sdk/core";
|
|
2
2
|
import {} from "@account-kit/infra";
|
|
3
3
|
import {} from "viem";
|
|
4
|
-
import { createLocalClient } from "../local/client";
|
|
5
|
-
import { createRemoteClient } from "../remote/client";
|
|
6
|
-
import { smartWalletClientActions } from "./decorator";
|
|
4
|
+
import { createLocalClient } from "../local/client.js";
|
|
5
|
+
import { createRemoteClient } from "../remote/client.js";
|
|
6
|
+
import { smartWalletClientActions, } from "./decorator.js";
|
|
7
7
|
export function createSmartWalletClient(params) {
|
|
8
8
|
const { transport, chain, policyId, mode, account, signer } = params;
|
|
9
9
|
const innerClient = mode === "local"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AACvD,OAAO,EAAyB,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAMN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AACvD,OAAO,EAAyB,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAMN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAoCxB,MAAM,UAAU,uBAAuB,CAAC,MAA+B;IACrE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,WAAW,GACf,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,iBAAiB,CAAC;YAChB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,kBAAkB,CAAC;YACjB,SAAS;YACT,KAAK;YACL,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IAET,yCAAyC;IACzC,qDAAqD;IACrD,4JAA4J;IAC5J,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CACnC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,yDAAyD;AACzD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,MAAM;AAEN,gEAAgE;AAEhE,sDAAsD;AACtD,2CAA2C;AAC3C,wBAAwB;AACxB,4CAA4C;AAC5C,mBAAmB;AACnB,0BAA0B;AAC1B,MAAM;AAEN,6DAA6D","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type AlchemyTransport } from \"@account-kit/infra\";\nimport {\n type Address,\n type Chain,\n type IsUndefined,\n type JsonRpcAccount,\n type Prettify,\n} from \"viem\";\nimport { createLocalClient } from \"../local/client.js\";\nimport { createRemoteClient } from \"../remote/client.js\";\nimport type { InnerWalletApiClient } from \"../types\";\nimport {\n smartWalletClientActions,\n type SmartWalletActions,\n} from \"./decorator.js\";\n\nexport type SmartWalletClientParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Prettify<\n {\n transport: AlchemyTransport;\n chain: Chain;\n signer: SmartAccountSigner;\n mode: \"local\" | \"remote\";\n policyId?: string;\n } & (IsUndefined<TAccount> extends true\n ? {\n account?: never;\n }\n : {\n account: Address;\n })\n>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n params: SmartWalletClientParams<TAccount>,\n): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;\n\nexport function createSmartWalletClient<\n TAccount extends JsonRpcAccount<Address> = JsonRpcAccount<Address>,\n>(\n params: SmartWalletClientParams<TAccount>,\n): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;\n\nexport function createSmartWalletClient(params: SmartWalletClientParams) {\n const { transport, chain, policyId, mode, account, signer } = params;\n\n const innerClient =\n mode === \"local\"\n ? createLocalClient({\n transport,\n chain,\n policyId,\n account,\n })\n : createRemoteClient({\n transport,\n chain,\n policyId,\n account,\n });\n\n // TODO: we need to do a few things here:\n // 1. decorate the client with the wallet api actions\n // 2. potentially we might want to make this client async and have it use `requestAccount` so that it can create a SCA client with an account attached to it\n return innerClient.extend((client) =>\n smartWalletClientActions(client, signer),\n );\n}\n\n// Example usage:\n// const clientWithoutAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// });\n\n// const account1 = await clientWithoutAccount.requestAccount();\n\n// const clientWithAccount = createSmartWalletClient({\n// transport: alchemy({ apiKey: \"123\" }),\n// chain: baseSepolia,\n// signer: createDummySigner(zeroAddress),\n// mode: \"local\",\n// account: zeroAddress,\n// });\n\n// const account2 = await clientWithAccount.requestAccount();\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { createSmartWalletClient, type SmartWalletClientParams, } from "../client";
|
|
2
|
-
export { WalletServerRpcSchema, type WalletServerRpcSchemaType, type WalletServerViemRpcSchema, } from "../rpc/schema";
|
|
3
|
-
export { Capabilities } from "../capabilities";
|
|
4
|
-
export { PaymasterCapability } from "../capabilities/paymaster";
|
|
5
|
-
export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions";
|
|
6
|
-
export { createAccount } from "../client/actions/createAccount";
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export { signTypedData } from "../client/actions/signTypedData";
|
|
1
|
+
export { createSmartWalletClient, type SmartWalletClientParams, } from "../client/index.js";
|
|
2
|
+
export { WalletServerRpcSchema, type WalletServerRpcSchemaType, type WalletServerViemRpcSchema, } from "../rpc/schema.js";
|
|
3
|
+
export { Capabilities } from "../capabilities/index.js";
|
|
4
|
+
export { PaymasterCapability } from "../capabilities/paymaster.js";
|
|
5
|
+
export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions/index.js";
|
|
6
|
+
export { createAccount } from "../client/actions/createAccount.js";
|
|
7
|
+
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
8
|
+
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
9
|
+
export { prepareCalls } from "../client/actions/prepareCalls.js";
|
|
10
|
+
export { requestAccount } from "../client/actions/requestAccount.js";
|
|
11
|
+
export { signMessage } from "../client/actions/signMessage.js";
|
|
12
|
+
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
13
|
+
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories
|
|
2
2
|
// and we shouldn't export * for the sake of tree-shaking
|
|
3
|
-
export { createSmartWalletClient, } from "../client";
|
|
4
|
-
export { WalletServerRpcSchema, } from "../rpc/schema";
|
|
3
|
+
export { createSmartWalletClient, } from "../client/index.js";
|
|
4
|
+
export { WalletServerRpcSchema, } from "../rpc/schema.js";
|
|
5
5
|
// capabilities: TODO: should these actually just have the types exported?
|
|
6
|
-
export { Capabilities } from "../capabilities";
|
|
7
|
-
export { PaymasterCapability } from "../capabilities/paymaster";
|
|
8
|
-
export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions";
|
|
6
|
+
export { Capabilities } from "../capabilities/index.js";
|
|
7
|
+
export { PaymasterCapability } from "../capabilities/paymaster.js";
|
|
8
|
+
export { PermissionsArray, PermissionsCapability, PermissionsContext, PermissionsData, } from "../capabilities/permissions/index.js";
|
|
9
9
|
// client actions
|
|
10
|
-
export { createAccount } from "../client/actions/createAccount";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export { signTypedData } from "../client/actions/signTypedData";
|
|
10
|
+
export { createAccount } from "../client/actions/createAccount.js";
|
|
11
|
+
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
12
|
+
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
13
|
+
export { prepareCalls } from "../client/actions/prepareCalls.js";
|
|
14
|
+
export { requestAccount } from "../client/actions/requestAccount.js";
|
|
15
|
+
export { signMessage } from "../client/actions/signMessage.js";
|
|
16
|
+
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
17
|
+
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yDAAyD;AACzD,OAAO,EACL,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,GAGtB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["// TODO: anything that we want to expose publicly should be exported from `index.ts` files in the subdirectories\n// and we shouldn't export * for the sake of tree-shaking\nexport {\n createSmartWalletClient,\n type SmartWalletClientParams,\n} from \"../client/index.js\";\n\nexport {\n WalletServerRpcSchema,\n type WalletServerRpcSchemaType,\n type WalletServerViemRpcSchema,\n} from \"../rpc/schema.js\";\n\n// capabilities: TODO: should these actually just have the types exported?\nexport { Capabilities } from \"../capabilities/index.js\";\nexport { PaymasterCapability } from \"../capabilities/paymaster.js\";\nexport {\n PermissionsArray,\n PermissionsCapability,\n PermissionsContext,\n PermissionsData,\n} from \"../capabilities/permissions/index.js\";\n\n// client actions\nexport { createAccount } from \"../client/actions/createAccount.js\";\nexport { getCallsStatus } from \"../client/actions/getCallsStatus.js\";\nexport { listAccounts } from \"../client/actions/listAccounts.js\";\nexport { prepareCalls } from \"../client/actions/prepareCalls.js\";\nexport { requestAccount } from \"../client/actions/requestAccount.js\";\nexport { signMessage } from \"../client/actions/signMessage.js\";\nexport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nexport { signTypedData } from \"../client/actions/signTypedData.js\";\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from "../capabilities";
|
|
2
|
-
export * from "../capabilities/paymaster";
|
|
3
|
-
export * from "../capabilities/permissions";
|
|
4
|
-
export * from "../capabilities/permissions/mav2";
|
|
5
|
-
export type * from "../isomorphic/client";
|
|
6
|
-
export { createIsomorphicClient } from "../isomorphic/client";
|
|
7
|
-
export { createDummySigner } from "../isomorphic/utils/createDummySigner";
|
|
8
|
-
export * from "../rpc/request";
|
|
9
|
-
export * as RpcSchemas from "../rpc/request";
|
|
10
|
-
export * from "../rpc/schema";
|
|
11
|
-
export * from "../schemas";
|
|
1
|
+
export * from "../capabilities/index.js";
|
|
2
|
+
export * from "../capabilities/paymaster.js";
|
|
3
|
+
export * from "../capabilities/permissions/index.js";
|
|
4
|
+
export * from "../capabilities/permissions/mav2.js";
|
|
5
|
+
export type * from "../isomorphic/client.js";
|
|
6
|
+
export { createIsomorphicClient } from "../isomorphic/client.js";
|
|
7
|
+
export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
|
|
8
|
+
export * from "../rpc/request.js";
|
|
9
|
+
export * as RpcSchemas from "../rpc/request.js";
|
|
10
|
+
export * from "../rpc/schema.js";
|
|
11
|
+
export * from "../schemas.js";
|
|
12
12
|
export type * from "../types";
|
|
13
|
-
export * from "../utils";
|
|
13
|
+
export * from "../utils.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// exports from this file are meant to be imported by our packages in the monorepo
|
|
2
2
|
// we will expose this in the package.json as a named export like `this-pkg/internal`
|
|
3
3
|
// TODO: name `this-pkg`
|
|
4
|
-
export * from "../capabilities";
|
|
5
|
-
export * from "../capabilities/paymaster";
|
|
6
|
-
export * from "../capabilities/permissions";
|
|
7
|
-
export * from "../capabilities/permissions/mav2";
|
|
8
|
-
export { createIsomorphicClient } from "../isomorphic/client";
|
|
9
|
-
export { createDummySigner } from "../isomorphic/utils/createDummySigner";
|
|
10
|
-
export * from "../rpc/request";
|
|
11
|
-
export * as RpcSchemas from "../rpc/request";
|
|
12
|
-
export * from "../rpc/schema";
|
|
13
|
-
export * from "../schemas";
|
|
14
|
-
export * from "../utils";
|
|
4
|
+
export * from "../capabilities/index.js";
|
|
5
|
+
export * from "../capabilities/paymaster.js";
|
|
6
|
+
export * from "../capabilities/permissions/index.js";
|
|
7
|
+
export * from "../capabilities/permissions/mav2.js";
|
|
8
|
+
export { createIsomorphicClient } from "../isomorphic/client.js";
|
|
9
|
+
export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
|
|
10
|
+
export * from "../rpc/request.js";
|
|
11
|
+
export * as RpcSchemas from "../rpc/request.js";
|
|
12
|
+
export * from "../rpc/schema.js";
|
|
13
|
+
export * from "../schemas.js";
|
|
14
|
+
export * from "../utils.js";
|
|
15
15
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,wBAAwB;AACxB,cAAc,
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type Chain, type Transport, type Hex } from "viem";
|
|
3
|
-
import type { wallet_createSession } from "../../rpc/request";
|
|
4
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema";
|
|
5
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
|
+
import { type Chain, type Hex, type Transport } from "viem";
|
|
4
|
+
import type { wallet_createSession } from "../../rpc/request.js";
|
|
5
|
+
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
6
|
export type CreateSessionParams = Omit<Static<(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]>[0], "chainId"> & {
|
|
7
7
|
entityId?: Hex;
|
|
8
8
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
2
|
-
import { ChainNotFoundError, custom, hexToNumber, toHex, } from "viem";
|
|
3
|
-
import { isGlobalValidation } from "../../capabilities/permissions/mav2";
|
|
4
2
|
import { deferralActions, PermissionBuilder, } from "@account-kit/smart-contracts/experimental";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Value } from "@sinclair/typebox/value";
|
|
4
|
+
import { ChainNotFoundError, custom, hexToNumber, toHex, } from "viem";
|
|
5
|
+
import { TypePermission } from "../../capabilities/permissions/index.js";
|
|
6
|
+
import { isGlobalValidation } from "../../capabilities/permissions/mav2.js";
|
|
7
|
+
import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
|
|
8
|
+
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
7
9
|
export async function createSession(client, params) {
|
|
8
10
|
if (!client.chain) {
|
|
9
11
|
throw new ChainNotFoundError();
|
|
@@ -47,7 +49,7 @@ export async function createSession(client, params) {
|
|
|
47
49
|
deadline: params.expiry,
|
|
48
50
|
})
|
|
49
51
|
.addPermissions({
|
|
50
|
-
permissions: params.permissions,
|
|
52
|
+
permissions: params.permissions.map((permission) => Value.Encode(TypePermission, permission)),
|
|
51
53
|
})
|
|
52
54
|
.compileDeferred();
|
|
53
55
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,WAAW,EACX,KAAK,GAIN,M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ACR,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAE3B,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC;QAC5D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QACpE,kBAAkB,EAAE,kBAAkB,CAAC,MAAM,CAAC;KAC/C,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,oCAAoC,EAAE,GACvD,MAAM,IAAI,iBAAiB,CAAC;QAC1B,MAAM,EAAE,OAAO;QACf,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;QACR,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM;KACxB,CAAC;SACC,cAAc,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CACzC;KACF,CAAC;SACD,eAAe,EAAE,CAAC;IAEvB,OAAO;QACL,SAAS,EAAE,IAAI,EAAE,kDAAkD;QACnE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;QACzB,gBAAgB,EAAE;YAChB,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,SAAS;SAChB;QACD,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n deferralActions,\n PermissionBuilder,\n} from \"@account-kit/smart-contracts/experimental\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n custom,\n hexToNumber,\n toHex,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { TypePermission } from \"../../capabilities/permissions/index.js\";\nimport { isGlobalValidation } from \"../../capabilities/permissions/mav2.js\";\nimport type { wallet_createSession } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { createAccount, isModularAccountV2 } from \"../utils/createAccount.js\";\nimport { createDummySigner } from \"../utils/createDummySigner.js\";\n\nexport type CreateSessionParams = Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"chainId\"\n> & {\n entityId?: Hex;\n};\n\nexport type CreateSessionResult = Omit<\n Static<(typeof wallet_createSession)[\"properties\"][\"ReturnType\"]>,\n \"sessionId\"\n> & {\n sessionId: Hex | null;\n entityId: Hex;\n fullPreSignatureDeferredActionDigest: Hex;\n};\n\nexport async function createSession(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: CreateSessionParams,\n): Promise<CreateSessionResult> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { counterfactualInfo } = await client.request({\n method: \"wallet_requestAccount\",\n params: [\n {\n includeCounterfactualInfo: true,\n accountAddress: params.account,\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(params.account),\n accountAddress: params.account,\n counterfactualInfo,\n });\n\n if (!isModularAccountV2(account)) {\n throw new Error(\"Sessions are currently only supported by MAv2 accounts.\");\n }\n\n const _client = createSmartAccountClient({\n chain: client.chain,\n transport: custom(client.transport),\n account,\n }).extend(deferralActions);\n\n const { entityId, nonce } = await _client.getEntityIdAndNonce({\n entityId: params.entityId ? hexToNumber(params.entityId) : undefined,\n isGlobalValidation: isGlobalValidation(params),\n });\n\n const { typedData, fullPreSignatureDeferredActionDigest } =\n await new PermissionBuilder({\n client: _client,\n key: params.key,\n entityId,\n nonce,\n deadline: params.expiry,\n })\n .addPermissions({\n permissions: params.permissions.map((permission) =>\n Value.Encode(TypePermission, permission),\n ),\n })\n .compileDeferred();\n\n return {\n sessionId: null, // In remote mode, the server will set this later.\n entityId: toHex(entityId),\n signatureRequest: {\n type: \"eth_signTypedData_v4\",\n data: typedData,\n },\n fullPreSignatureDeferredActionDigest,\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import { type Chain, type Transport } from "viem";
|
|
4
|
-
import type { wallet_getCallsStatus } from "../../rpc/request";
|
|
5
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema";
|
|
4
|
+
import type { wallet_getCallsStatus } from "../../rpc/request.js";
|
|
5
|
+
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
6
|
export type GetCallsStatusParams = Static<(typeof wallet_getCallsStatus)["properties"]["Request"]["properties"]["params"]>[0];
|
|
7
7
|
export type GetCallsStatusResponse = Static<(typeof wallet_getCallsStatus)["properties"]["ReturnType"]>;
|
|
8
8
|
/** EIP-5792 call status codes */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {} from "@aa-sdk/core";
|
|
2
|
-
import { ChainNotFoundError, isHex, } from "viem";
|
|
3
|
-
import { TypeCallId } from "../../schemas";
|
|
4
|
-
import { castToHex } from "../../utils";
|
|
5
2
|
import { Value } from "@sinclair/typebox/value";
|
|
3
|
+
import { ChainNotFoundError, isHex, } from "viem";
|
|
4
|
+
import { TypeCallId } from "../../schemas.js";
|
|
5
|
+
import { castToHex } from "../../utils.js";
|
|
6
6
|
const ReceiptStatus = {
|
|
7
7
|
reverted: "0x0",
|
|
8
8
|
success: "0x1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/isomorphic/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,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,CAAC,OAAO;gBACd,CAAC,CAAC,cAAc,CAAC,SAAS;gBAC1B,CAAC,CAAC,cAAc,CAAC,mBAAmB;QACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAC5E,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA2B;IAE3B,OAAO;QACL,wGAAwG;QACxG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAC3B,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,+FAA+F;QAC/F,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;QAC3C,2FAA2F;QAC3F,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n type SmartAccountClient,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n ChainNotFoundError,\n isHex,\n type Chain,\n type Hex,\n type TransactionReceipt,\n type Transport,\n} from \"viem\";\nimport type { wallet_getCallsStatus } from \"../../rpc/request.js\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { TypeCallId } from \"../../schemas.js\";\nimport { castToHex } from \"../../utils.js\";\n\nexport type GetCallsStatusParams = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\nexport type GetCallsStatusResponse = Static<\n (typeof wallet_getCallsStatus)[\"properties\"][\"ReturnType\"]\n>;\n\nconst ReceiptStatus: Record<TransactionReceipt[\"status\"], Hex> = {\n reverted: \"0x0\",\n success: \"0x1\",\n};\n\n/** EIP-5792 call status codes */\nexport const CallStatusCode = {\n /** Batch has been received by the wallet but has not completed execution onchain */\n PENDING: 100,\n /** Batch has been included onchain without reverts, receipts array contains info of all calls */\n CONFIRMED: 200,\n /** Batch has not been included onchain and wallet will not retry */\n OFFCHAIN_FAILURE: 400,\n /** Batch reverted *completely* and only changes related to gas charge may have been included onchain */\n CHAIN_RULES_FAILURE: 500,\n /** Batch reverted *partially* and some changes related to batch calls may have been included onchain */\n PARTIAL_CHAIN_RULES_FAILURE: 600,\n} as const;\n\nexport async function getCallsStatus(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n callId: GetCallsStatusParams,\n): Promise<GetCallsStatusResponse> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const { chainId, hash } = Value.Decode(TypeCallId, callId);\n\n const result = await client.getUserOperationReceipt(hash);\n\n return {\n id: callId,\n chainId,\n atomic: true,\n status: !result?.receipt\n ? CallStatusCode.PENDING\n : result.success\n ? CallStatusCode.CONFIRMED\n : CallStatusCode.CHAIN_RULES_FAILURE,\n receipts: !result?.receipt ? undefined : [transformReceipt(result.receipt)],\n };\n}\n\nfunction transformReceipt(\n receipt: TransactionReceipt,\n): NonNullable<GetCallsStatusResponse[\"receipts\"]>[number] {\n return {\n // viem's type for status is \"success\" | \"reverted\", but the actual value seems to already be 0x0 or 0x1\n status: isHex(receipt.status)\n ? receipt.status\n : ReceiptStatus[receipt.status],\n blockHash: receipt.blockHash,\n // viem's type for blockNumber is bigint, but the actual value seems to already be a hex string\n blockNumber: castToHex(receipt.blockNumber),\n // viem's type for gasUsed is bigint, but the actual value seems to already be a hex string\n gasUsed: castToHex(receipt.gasUsed),\n transactionHash: receipt.transactionHash,\n logs: receipt.logs.map((log) => ({\n address: log.address,\n data: log.data,\n topics: log.topics,\n })),\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import { type Chain, type Transport } from "viem";
|
|
4
|
-
import type { wallet_prepareCalls } from "../../rpc/request";
|
|
5
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema";
|
|
4
|
+
import type { wallet_prepareCalls } from "../../rpc/request.js";
|
|
5
|
+
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
6
6
|
export type PrepareCallsParams = Omit<Static<(typeof wallet_prepareCalls)["properties"]["Request"]["properties"]["params"]>[0], "chainId">;
|
|
7
7
|
export type PrepareCallsResult = Static<(typeof wallet_prepareCalls)["properties"]["ReturnType"]>;
|
|
8
8
|
export declare function prepareCalls(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: PrepareCallsParams): Promise<PrepareCallsResult>;
|