@account-kit/wallet-client 0.1.0-alpha.3 → 0.1.0-alpha.5
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/eip7702Auth.d.ts +4 -0
- package/dist/esm/capabilities/eip7702Auth.js +16 -0
- package/dist/esm/capabilities/eip7702Auth.js.map +1 -0
- package/dist/esm/capabilities/index.d.ts +4 -0
- package/dist/esm/capabilities/index.js +2 -0
- package/dist/esm/capabilities/index.js.map +1 -1
- package/dist/esm/capabilities/permissions/index.d.ts +1 -1
- package/dist/esm/capabilities/permissions/mav2.js +1 -0
- package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
- package/dist/esm/client/actions/getCallsStatus.d.ts +1 -2
- package/dist/esm/client/actions/getCallsStatus.js +19 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +6 -6
- package/dist/esm/client/actions/grantPermissions.js +115 -3
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +4 -4
- package/dist/esm/client/actions/prepareCalls.js +38 -5
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +3 -4
- package/dist/esm/client/actions/requestAccount.js +18 -1
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +3 -3
- package/dist/esm/client/actions/signMessage.js +18 -0
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -3
- 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 +2 -2
- package/dist/esm/client/actions/signTypedData.js +31 -0
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +19 -19
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +4 -4
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +36 -10
- package/dist/esm/client/index.js +0 -29
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +2 -2
- package/dist/esm/exports/index.js +1 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/isomorphic/actions/createSession.js +21 -10
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.js +62 -9
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.js +18 -11
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +2 -2
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +1 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +9 -3
- package/dist/esm/isomorphic/utils/7702.js +35 -8
- package/dist/esm/isomorphic/utils/7702.js.map +1 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +2 -2
- package/dist/esm/isomorphic/utils/createAccount.js +4 -3
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +2 -2
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +8 -7
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
- package/dist/esm/local/client.d.ts +2 -2
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +8 -2
- package/dist/esm/remote/client.js +1 -7
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/request.d.ts +12 -2
- package/dist/esm/rpc/request.js +6 -9
- package/dist/esm/rpc/request.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +23 -13
- package/dist/esm/schemas.d.ts +3 -1
- package/dist/esm/schemas.js +6 -4
- package/dist/esm/schemas.js.map +1 -1
- package/dist/esm/types.d.ts +7 -10
- package/dist/esm/types.js.map +1 -1
- package/dist/types/capabilities/eip7702Auth.d.ts +5 -0
- package/dist/types/capabilities/eip7702Auth.d.ts.map +1 -0
- package/dist/types/capabilities/index.d.ts +4 -0
- package/dist/types/capabilities/index.d.ts.map +1 -1
- package/dist/types/capabilities/permissions/index.d.ts +1 -1
- package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +1 -2
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +6 -6
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +4 -4
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +3 -4
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +3 -3
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +3 -3
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +2 -2
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +4 -4
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +36 -10
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +2 -2
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +1 -1
- package/dist/types/isomorphic/utils/7702.d.ts +9 -3
- package/dist/types/isomorphic/utils/7702.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 +2 -2
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
- package/dist/types/local/client.d.ts +2 -2
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +8 -2
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/request.d.ts +12 -2
- package/dist/types/rpc/request.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +23 -13
- package/dist/types/rpc/schema.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +3 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/types.d.ts +7 -10
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/capabilities/eip7702Auth.ts +19 -0
- package/src/capabilities/index.ts +2 -0
- package/src/capabilities/permissions/mav2.ts +1 -0
- package/src/client/actions/getCallsStatus.ts +0 -10
- package/src/client/actions/grantPermissions.ts +12 -25
- package/src/client/actions/prepareCalls.ts +18 -23
- package/src/client/actions/requestAccount.ts +9 -26
- package/src/client/actions/signMessage.ts +2 -17
- package/src/client/actions/signSignatureRequest.ts +5 -5
- package/src/client/actions/signTypedData.ts +1 -16
- package/src/client/client.e2e-test.ts +22 -22
- package/src/client/decorator.ts +5 -10
- package/src/client/index.ts +20 -41
- package/src/exports/index.ts +2 -1
- package/src/isomorphic/actions/createSession.ts +29 -10
- package/src/isomorphic/actions/getCallsStatus.ts +82 -10
- package/src/isomorphic/actions/prepareCalls.ts +19 -11
- package/src/isomorphic/actions/sendPreparedCalls.ts +2 -2
- package/src/isomorphic/utils/7702.ts +61 -13
- package/src/isomorphic/utils/createAccount.ts +5 -5
- package/src/isomorphic/utils/parsePermissionsContext.ts +9 -9
- package/src/local/client.ts +3 -5
- package/src/remote/client.ts +5 -13
- package/src/rpc/request.ts +8 -9
- package/src/schemas.ts +8 -4
- package/src/types.ts +5 -21
|
@@ -34,6 +34,10 @@ export declare const WalletServerRpcSchema: {
|
|
|
34
34
|
multiplier: number;
|
|
35
35
|
} | undefined;
|
|
36
36
|
} | undefined;
|
|
37
|
+
eip7702Auth?: true | {
|
|
38
|
+
account?: `0x${string}` | undefined;
|
|
39
|
+
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
|
|
40
|
+
} | undefined;
|
|
37
41
|
} | undefined;
|
|
38
42
|
chainId: `0x${string}`;
|
|
39
43
|
calls: {
|
|
@@ -46,7 +50,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
46
50
|
method: "wallet_prepareCalls";
|
|
47
51
|
};
|
|
48
52
|
ReturnType: {
|
|
49
|
-
type: "user-operation-
|
|
53
|
+
type: "user-operation-v060" | "user-operation-v070";
|
|
50
54
|
chainId: `0x${string}`;
|
|
51
55
|
data: {
|
|
52
56
|
sender: `0x${string}`;
|
|
@@ -112,14 +116,6 @@ export declare const WalletServerRpcSchema: {
|
|
|
112
116
|
} | {
|
|
113
117
|
Request: {
|
|
114
118
|
params: [{
|
|
115
|
-
signedAuthorization?: {
|
|
116
|
-
nonce: `0x${string}`;
|
|
117
|
-
chainId: `0x${string}`;
|
|
118
|
-
address: `0x${string}`;
|
|
119
|
-
r: `0x${string}`;
|
|
120
|
-
s: `0x${string}`;
|
|
121
|
-
yParity: `0x${string}`;
|
|
122
|
-
} | undefined;
|
|
123
119
|
capabilities?: {
|
|
124
120
|
permissions?: {
|
|
125
121
|
context: `0x${string}`;
|
|
@@ -128,9 +124,17 @@ export declare const WalletServerRpcSchema: {
|
|
|
128
124
|
sessionId: `0x${string}`;
|
|
129
125
|
} | undefined;
|
|
130
126
|
} | undefined;
|
|
131
|
-
|
|
127
|
+
signedAuthorization?: {
|
|
128
|
+
nonce: `0x${string}`;
|
|
129
|
+
chainId: `0x${string}`;
|
|
130
|
+
address: `0x${string}`;
|
|
131
|
+
r: `0x${string}`;
|
|
132
|
+
s: `0x${string}`;
|
|
133
|
+
yParity: `0x${string}`;
|
|
134
|
+
} | undefined;
|
|
135
|
+
type: "user-operation-v060" | "user-operation-v070";
|
|
132
136
|
signature: {
|
|
133
|
-
type: "ecdsa";
|
|
137
|
+
type: "secp256k1" | "ecdsa";
|
|
134
138
|
signature: `0x${string}`;
|
|
135
139
|
};
|
|
136
140
|
chainId: `0x${string}`;
|
|
@@ -204,12 +208,12 @@ export declare const WalletServerRpcSchema: {
|
|
|
204
208
|
method: "wallet_requestAccount";
|
|
205
209
|
};
|
|
206
210
|
ReturnType: {
|
|
211
|
+
delegation?: `0x${string}` | undefined;
|
|
207
212
|
counterfactualInfo?: {
|
|
208
213
|
factoryData: `0x${string}`;
|
|
209
214
|
factoryAddress: `0x${string}`;
|
|
210
215
|
factoryType: "unknown" | "LightAccountV2.0.0" | "LightAccountV1.1.0" | "LightAccountV1.0.2" | "LightAccountV1.0.1" | "MAv1.0.0-MultiOwner" | "LightAccountV2.0.0-MultiOwner" | "MAv1.0.0-MultiSig" | "MAv2.0.0-sma-b" | "MAv2.0.0-ma-ssv" | "MAv2.0.0-ma-webauthn";
|
|
211
216
|
} | undefined;
|
|
212
|
-
delegation?: `0x${string}` | undefined;
|
|
213
217
|
accountAddress: `0x${string}`;
|
|
214
218
|
id: string;
|
|
215
219
|
};
|
|
@@ -238,7 +242,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
238
242
|
expiry?: number | undefined;
|
|
239
243
|
chainId: `0x${string}`;
|
|
240
244
|
key: {
|
|
241
|
-
type: "secp256k1" | "contract";
|
|
245
|
+
type: "secp256k1" | "ecdsa" | "contract";
|
|
242
246
|
publicKey: `0x${string}`;
|
|
243
247
|
};
|
|
244
248
|
permissions: ({
|
|
@@ -283,6 +287,12 @@ export declare const WalletServerRpcSchema: {
|
|
|
283
287
|
type: "root";
|
|
284
288
|
})[];
|
|
285
289
|
} & {
|
|
290
|
+
capabilities?: {
|
|
291
|
+
eip7702Auth?: true | {
|
|
292
|
+
account?: `0x${string}` | undefined;
|
|
293
|
+
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
|
|
294
|
+
} | undefined;
|
|
295
|
+
} | undefined;
|
|
286
296
|
account: `0x${string}`;
|
|
287
297
|
}];
|
|
288
298
|
method: "wallet_createSession";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/rpc/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ/B,CAAC;AAEJ,MAAM,MAAM,yBAAyB,GAAG,OAAO,qBAAqB,CAAC;AAErE,KAAK,qBAAqB,GAAG;KAC1B,CAAC,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAG;QACrD,MAAM,EAAE,CAAC,CAAC;QACV,UAAU,EAAE,OAAO,CACjB,yBAAyB,CAAC,SAAS,CAAC,EACpC;YAAE,MAAM,EAAE,CAAC,CAAA;SAAE,CACd,CAAC,QAAQ,CAAC,CAAC;QACZ,UAAU,EAAE,OAAO,CACjB,yBAAyB,EACzB;YAAE,OAAO,EAAE;gBAAE,MAAM,EAAE,CAAC,CAAA;aAAE,CAAA;SAAE,CAC3B,CAAC,YAAY,CAAC,CAAC;KACjB;CACF,CAAC;AAGF,MAAM,MAAM,yBAAyB,GAAG;IACtC,qBAAqB,CAAC,sBAAsB,CAAC;IAC7C,qBAAqB,CAAC,uBAAuB,CAAC;IAC9C,qBAAqB,CAAC,qBAAqB,CAAC;IAC5C,qBAAqB,CAAC,qBAAqB,CAAC;IAC5C,qBAAqB,CAAC,0BAA0B,CAAC;IACjD,qBAAqB,CAAC,uBAAuB,CAAC;IAC9C,qBAAqB,CAAC,sBAAsB,CAAC;CAC9C,CAAC"}
|
package/dist/types/schemas.d.ts
CHANGED
|
@@ -147,8 +147,10 @@ export declare const TypeCreationOptions: import("@sinclair/typebox").TOptional<
|
|
|
147
147
|
}>]>>;
|
|
148
148
|
export type TypeCreationOptions = Static<typeof TypeCreationOptions>;
|
|
149
149
|
export type TypeAccountType = Exclude<Static<typeof TypeCreationOptions>, undefined>["accountType"];
|
|
150
|
+
export declare const TypeSignatureType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"secp256k1">, import("@sinclair/typebox").TLiteral<"ecdsa">, import("@sinclair/typebox").TLiteral<"contract">]>;
|
|
151
|
+
export type TypeSignatureType = Static<typeof TypeSignatureType>;
|
|
150
152
|
export declare const KeySigner: import("@sinclair/typebox").TObject<{
|
|
151
|
-
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"secp256k1">, import("@sinclair/typebox").TLiteral<"contract">]>;
|
|
153
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"secp256k1">, import("@sinclair/typebox").TLiteral<"ecdsa">, import("@sinclair/typebox").TLiteral<"contract">]>;
|
|
152
154
|
publicKey: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
153
155
|
}>;
|
|
154
156
|
export type KeySigner = Static<typeof KeySigner>;
|
|
@@ -1 +1 @@
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,OAAO,iBAAiB,CAAC,CAAC;AAEjE,eAAO,MAAM,SAAS;;;EAGpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEjD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4C7B,CAAC;AA4BL,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK/B,CAAC;AAEH,eAAO,MAAM,UAAU;;;EAUnB,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
3
|
-
import type { Address, Chain, Client, Hex,
|
|
3
|
+
import type { Address, Chain, Client, Hex, JsonRpcAccount, Transport } from "viem";
|
|
4
4
|
import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
|
|
5
5
|
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
6
6
|
import type { WalletServerViemRpcSchema } from "./rpc/schema.ts";
|
|
7
|
-
export type CreateInnerClientParams<TAccount extends
|
|
7
|
+
export type CreateInnerClientParams<TAccount extends Address | undefined = Address | undefined> = {
|
|
8
8
|
chain: Chain;
|
|
9
9
|
transport: AlchemyTransport;
|
|
10
10
|
policyId?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
account: Address;
|
|
15
|
-
});
|
|
16
|
-
export type InnerWalletApiClientBase<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined, TExtend extends {
|
|
11
|
+
account?: TAccount | Address | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type InnerWalletApiClientBase<TExtend extends {
|
|
17
14
|
[key: string]: unknown;
|
|
18
15
|
} | undefined = {
|
|
19
16
|
[key: string]: unknown;
|
|
20
|
-
} | undefined> = Client<Transport, Chain,
|
|
17
|
+
} | undefined> = Client<Transport, Chain, JsonRpcAccount<Address> | undefined, WalletServerViemRpcSchema, {
|
|
21
18
|
policyId?: string;
|
|
22
19
|
} & TExtend>;
|
|
23
20
|
export type InnerClientActions = {
|
|
@@ -33,7 +30,7 @@ export type InternalState = {
|
|
|
33
30
|
setAccount: (account: CachedAccount) => void;
|
|
34
31
|
getAccount: () => CachedAccount | undefined;
|
|
35
32
|
};
|
|
36
|
-
export type InnerWalletApiClient
|
|
33
|
+
export type InnerWalletApiClient = InnerWalletApiClientBase<InnerClientActions & {
|
|
37
34
|
internal: InternalState;
|
|
38
35
|
}>;
|
|
39
36
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,cAAc,EACd,SAAS,EACV,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,yBAAyB,EAA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|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@account-kit/wallet-client",
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.5",
|
|
6
6
|
"main": "./dist/esm/exports/index.js",
|
|
7
7
|
"module": "./dist/esm/exports/index.js",
|
|
8
8
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"access": "public",
|
|
71
71
|
"registry": "https://registry.npmjs.org/"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "4323e2956bec73ebfc890ce40803b09bb0372d4a"
|
|
74
74
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { TypeAddress } from "../schemas.js";
|
|
3
|
+
import {
|
|
4
|
+
EIP_7702_ACCOUNT_TYPE,
|
|
5
|
+
SUPPORTED_DELEGATION_ADDRESSES,
|
|
6
|
+
} from "../isomorphic/utils/7702.js";
|
|
7
|
+
|
|
8
|
+
export const Eip7702AuthCapability = Type.Union([
|
|
9
|
+
Type.Object({
|
|
10
|
+
account: Type.Optional(TypeAddress),
|
|
11
|
+
// Wallet applications must maintain a strict shortlist of well-known accounts.
|
|
12
|
+
// https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR189
|
|
13
|
+
delegation: Type.Union([
|
|
14
|
+
...SUPPORTED_DELEGATION_ADDRESSES.map((address) => Type.Literal(address)),
|
|
15
|
+
...EIP_7702_ACCOUNT_TYPE.map((it) => Type.Literal(it)),
|
|
16
|
+
]),
|
|
17
|
+
}),
|
|
18
|
+
Type.Literal(true),
|
|
19
|
+
]);
|
|
@@ -2,9 +2,11 @@ import { Type } from "@sinclair/typebox";
|
|
|
2
2
|
import { GasParamsOverrideCapability } from "./overrides.js";
|
|
3
3
|
import { PaymasterCapability } from "./paymaster.js";
|
|
4
4
|
import { PermissionsCapability } from "./permissions/index.js";
|
|
5
|
+
import { Eip7702AuthCapability } from "./eip7702Auth.js";
|
|
5
6
|
|
|
6
7
|
export const Capabilities = Type.Object({
|
|
7
8
|
permissions: Type.Optional(PermissionsCapability),
|
|
8
9
|
paymasterService: Type.Optional(PaymasterCapability),
|
|
9
10
|
gasParamsOverride: Type.Optional(GasParamsOverrideCapability),
|
|
11
|
+
eip7702Auth: Type.Optional(Eip7702AuthCapability),
|
|
10
12
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Address, JsonRpcAccount } from "viem";
|
|
2
1
|
import type {
|
|
3
2
|
GetCallsStatusParams as IsomorphicGetCallsStatusParams,
|
|
4
3
|
GetCallsStatusResponse as IsomorphicGetCallsStatusResult,
|
|
@@ -28,15 +27,6 @@ export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
|
28
27
|
* // Check the status of the first call ID
|
|
29
28
|
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
30
29
|
*/
|
|
31
|
-
export async function getCallsStatus<
|
|
32
|
-
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
33
|
-
| JsonRpcAccount<Address>
|
|
34
|
-
| undefined,
|
|
35
|
-
>(
|
|
36
|
-
client: InnerWalletApiClient<TAccount>,
|
|
37
|
-
params: GetCallsStatusParams,
|
|
38
|
-
): Promise<GetCallsStatusResult>;
|
|
39
|
-
|
|
40
30
|
export async function getCallsStatus(
|
|
41
31
|
client: InnerWalletApiClient,
|
|
42
32
|
params: GetCallsStatusParams,
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type IsUndefined,
|
|
5
|
-
type JsonRpcAccount,
|
|
6
|
-
toHex,
|
|
7
|
-
} from "viem";
|
|
8
|
-
import type { InnerWalletApiClient } from "../../types.ts";
|
|
9
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
1
|
+
import { AccountNotFoundError, type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import type { Static } from "@sinclair/typebox";
|
|
3
|
+
import { type Address, type Hex, type IsUndefined, toHex } from "viem";
|
|
10
4
|
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
11
5
|
import { TypeEip7702AuthExtendedFields } from "../../schemas.js";
|
|
12
|
-
import type {
|
|
6
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
13
7
|
|
|
14
8
|
export type GrantPermissionsParams<
|
|
15
|
-
TAccount extends
|
|
16
|
-
| JsonRpcAccount<Address>
|
|
17
|
-
| undefined,
|
|
9
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
18
10
|
> = Omit<CreateSessionParams, "account" | "chainId"> &
|
|
19
11
|
(IsUndefined<TAccount> extends true
|
|
20
12
|
? { account: Address }
|
|
@@ -135,26 +127,21 @@ export type GrantPermissionsResult = {
|
|
|
135
127
|
* });
|
|
136
128
|
*/
|
|
137
129
|
export async function grantPermissions<
|
|
138
|
-
TAccount extends
|
|
139
|
-
| JsonRpcAccount<Address>
|
|
140
|
-
| undefined,
|
|
130
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
141
131
|
>(
|
|
142
|
-
client: InnerWalletApiClient<TAccount>,
|
|
143
|
-
signer: SmartAccountSigner,
|
|
144
|
-
params: GrantPermissionsParams<TAccount>,
|
|
145
|
-
): Promise<GrantPermissionsResult>;
|
|
146
|
-
|
|
147
|
-
export async function grantPermissions(
|
|
148
132
|
client: InnerWalletApiClient,
|
|
149
133
|
signer: SmartAccountSigner,
|
|
150
|
-
params: GrantPermissionsParams
|
|
134
|
+
params: GrantPermissionsParams<TAccount>,
|
|
151
135
|
): Promise<GrantPermissionsResult> {
|
|
152
|
-
|
|
153
|
-
|
|
136
|
+
const account = params.account ?? client.account?.address;
|
|
137
|
+
|
|
138
|
+
if (!account) {
|
|
139
|
+
throw new AccountNotFoundError();
|
|
154
140
|
}
|
|
155
141
|
|
|
156
142
|
return client.grantPermissions(signer, {
|
|
157
143
|
...params,
|
|
144
|
+
account,
|
|
158
145
|
chainId: toHex(client.chain.id),
|
|
159
146
|
});
|
|
160
147
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type Address,
|
|
4
|
-
type IsUndefined,
|
|
5
|
-
type JsonRpcAccount,
|
|
6
|
-
} from "viem";
|
|
1
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
2
|
+
import { toHex, type Address, type IsUndefined } from "viem";
|
|
7
3
|
import type {
|
|
8
4
|
PrepareCallsParams as IsomorphicPrepareCallsParams,
|
|
9
5
|
PrepareCallsResult as IsomorphicPrepareCallsResult,
|
|
@@ -13,12 +9,10 @@ import type { InnerWalletApiClient } from "../../types.ts";
|
|
|
13
9
|
export type GetAccountParam<TAccount> =
|
|
14
10
|
IsUndefined<TAccount> extends true
|
|
15
11
|
? { account: Address }
|
|
16
|
-
: { account?:
|
|
12
|
+
: { account?: Address };
|
|
17
13
|
|
|
18
14
|
export type PrepareCallsParams<
|
|
19
|
-
TAccount extends
|
|
20
|
-
| JsonRpcAccount<Address>
|
|
21
|
-
| undefined,
|
|
15
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
22
16
|
> = Omit<IsomorphicPrepareCallsParams, "from" | "chainId"> &
|
|
23
17
|
(IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });
|
|
24
18
|
|
|
@@ -51,18 +45,17 @@ export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
|
51
45
|
* });
|
|
52
46
|
*/
|
|
53
47
|
export async function prepareCalls<
|
|
54
|
-
TAccount extends
|
|
55
|
-
| JsonRpcAccount<Address>
|
|
56
|
-
| undefined,
|
|
48
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
57
49
|
>(
|
|
58
|
-
client: InnerWalletApiClient<TAccount>,
|
|
59
|
-
params: PrepareCallsParams<TAccount>,
|
|
60
|
-
): Promise<PrepareCallsResult>;
|
|
61
|
-
|
|
62
|
-
export async function prepareCalls(
|
|
63
50
|
client: InnerWalletApiClient,
|
|
64
|
-
params: PrepareCallsParams
|
|
51
|
+
params: PrepareCallsParams<TAccount>,
|
|
65
52
|
): Promise<PrepareCallsResult> {
|
|
53
|
+
const from = params.from ?? client.account?.address;
|
|
54
|
+
|
|
55
|
+
if (!from) {
|
|
56
|
+
throw new AccountNotFoundError();
|
|
57
|
+
}
|
|
58
|
+
|
|
66
59
|
if (client.policyId && !params.capabilities?.paymasterService) {
|
|
67
60
|
params.capabilities = {
|
|
68
61
|
...params.capabilities,
|
|
@@ -70,12 +63,14 @@ export async function prepareCalls(
|
|
|
70
63
|
};
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
params
|
|
75
|
-
|
|
66
|
+
const params_ = {
|
|
67
|
+
...params,
|
|
68
|
+
chainId: toHex(client.chain.id),
|
|
69
|
+
from,
|
|
70
|
+
};
|
|
76
71
|
|
|
77
72
|
return await client.request({
|
|
78
73
|
method: "wallet_prepareCalls",
|
|
79
|
-
params: [
|
|
74
|
+
params: [params_],
|
|
80
75
|
});
|
|
81
76
|
}
|
|
@@ -5,27 +5,20 @@ import {
|
|
|
5
5
|
import type { Static } from "@sinclair/typebox";
|
|
6
6
|
import { Value } from "@sinclair/typebox/value";
|
|
7
7
|
import type { Address } from "abitype";
|
|
8
|
-
import
|
|
8
|
+
import deepEqual from "deep-equal";
|
|
9
|
+
import { custom } from "viem";
|
|
9
10
|
import { createAccount } from "../../isomorphic/utils/createAccount.js";
|
|
10
11
|
import type { wallet_requestAccount } from "../../rpc/request.js";
|
|
11
12
|
import { TypeSerializedInitcode } from "../../schemas.js";
|
|
12
13
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
13
|
-
import deepEqual from "deep-equal";
|
|
14
14
|
|
|
15
|
-
export type RequestAccountParams<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Extract<
|
|
23
|
-
Static<typeof wallet_requestAccount>["Request"]["params"][0],
|
|
24
|
-
{ signerAddress: Address }
|
|
25
|
-
>,
|
|
26
|
-
"signerAddress" | "includeCounterfactualInfo"
|
|
27
|
-
> & { accountAddress?: Address }
|
|
28
|
-
: never;
|
|
15
|
+
export type RequestAccountParams = Omit<
|
|
16
|
+
Extract<
|
|
17
|
+
Static<typeof wallet_requestAccount>["Request"]["params"][0],
|
|
18
|
+
{ signerAddress: Address }
|
|
19
|
+
>,
|
|
20
|
+
"signerAddress" | "includeCounterfactualInfo"
|
|
21
|
+
> & { accountAddress?: Address };
|
|
29
22
|
|
|
30
23
|
export type RequestAccountResult = SmartContractAccount;
|
|
31
24
|
|
|
@@ -46,16 +39,6 @@ export type RequestAccountResult = SmartContractAccount;
|
|
|
46
39
|
* const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
|
|
47
40
|
* const account = await client.requestAccount(signer);
|
|
48
41
|
*/
|
|
49
|
-
export function requestAccount<
|
|
50
|
-
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
51
|
-
| JsonRpcAccount<Address>
|
|
52
|
-
| undefined,
|
|
53
|
-
>(
|
|
54
|
-
client: InnerWalletApiClient<TAccount>,
|
|
55
|
-
signer: SmartAccountSigner,
|
|
56
|
-
params?: RequestAccountParams<TAccount>,
|
|
57
|
-
): Promise<RequestAccountResult>;
|
|
58
|
-
|
|
59
42
|
export async function requestAccount(
|
|
60
43
|
client: InnerWalletApiClient,
|
|
61
44
|
signer: SmartAccountSigner,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
type Address,
|
|
4
|
-
type Hex,
|
|
5
|
-
type JsonRpcAccount,
|
|
6
|
-
type SignableMessage,
|
|
7
|
-
} from "viem";
|
|
1
|
+
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import { type Address, type Hex, type SignableMessage } from "viem";
|
|
8
3
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
9
4
|
import { requestAccount } from "./requestAccount.js";
|
|
10
5
|
|
|
@@ -29,16 +24,6 @@ export type SignMessageResult = Hex;
|
|
|
29
24
|
* // Sign a raw hex message
|
|
30
25
|
* const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
|
|
31
26
|
*/
|
|
32
|
-
export async function signMessage<
|
|
33
|
-
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
34
|
-
| JsonRpcAccount<Address>
|
|
35
|
-
| undefined,
|
|
36
|
-
>(
|
|
37
|
-
client: InnerWalletApiClient<TAccount>,
|
|
38
|
-
signer: SmartAccountSigner,
|
|
39
|
-
params: SignMessageParams,
|
|
40
|
-
): Promise<SignMessageResult>;
|
|
41
|
-
|
|
42
27
|
export async function signMessage(
|
|
43
28
|
client: InnerWalletApiClient,
|
|
44
29
|
signer: SmartAccountSigner,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import { type Hex, toHex } from "viem";
|
|
4
|
-
import { TypeSignatureRequest } from "../../schemas.js";
|
|
4
|
+
import { TypeSignatureRequest, type TypeSignatureType } from "../../schemas.js";
|
|
5
5
|
import { assertNever } from "../../utils.js";
|
|
6
6
|
import type { Eip7702ExtendedFields } from "@aa-sdk/core";
|
|
7
7
|
|
|
8
8
|
export type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;
|
|
9
9
|
|
|
10
10
|
export type SignSignatureRequestResult = {
|
|
11
|
-
type: "
|
|
11
|
+
type: Exclude<TypeSignatureType, "contract">; // TODO: Add support for identifying contract signatures
|
|
12
12
|
signature: Hex;
|
|
13
13
|
signedAuthorization?: Eip7702ExtendedFields["eip7702Auth"];
|
|
14
14
|
};
|
|
@@ -22,7 +22,7 @@ export type SignSignatureRequestResult = {
|
|
|
22
22
|
* @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
|
|
23
23
|
* @param {any} params.data - The data to sign, format depends on the signature type
|
|
24
24
|
* @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
|
|
25
|
-
* @returns {string} result.type - The signature type (currently only '
|
|
25
|
+
* @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)
|
|
26
26
|
* @returns {Hex} result.signature - The hex-encoded signature
|
|
27
27
|
* @returns {Eip7702ExtendedFields["eip7702Auth"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable
|
|
28
28
|
*
|
|
@@ -63,7 +63,7 @@ export async function signSignatureRequest(
|
|
|
63
63
|
|
|
64
64
|
if (!params.authorizationRequest) {
|
|
65
65
|
return {
|
|
66
|
-
type: "
|
|
66
|
+
type: "secp256k1" as const,
|
|
67
67
|
signature,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -86,7 +86,7 @@ export async function signSignatureRequest(
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
return {
|
|
89
|
-
type: "
|
|
89
|
+
type: "secp256k1" as const,
|
|
90
90
|
signature,
|
|
91
91
|
signedAuthorization,
|
|
92
92
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import {
|
|
3
|
-
type Address,
|
|
4
|
-
type Hex,
|
|
5
|
-
type JsonRpcAccount,
|
|
6
|
-
type TypedDataDefinition,
|
|
7
|
-
} from "viem";
|
|
2
|
+
import { type Address, type Hex, type TypedDataDefinition } from "viem";
|
|
8
3
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
9
4
|
import { requestAccount } from "./requestAccount.js";
|
|
10
5
|
|
|
@@ -45,16 +40,6 @@ export type SignTypedDataResult = Hex;
|
|
|
45
40
|
* }
|
|
46
41
|
* });
|
|
47
42
|
*/
|
|
48
|
-
export async function signTypedData<
|
|
49
|
-
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
50
|
-
| JsonRpcAccount<Address>
|
|
51
|
-
| undefined,
|
|
52
|
-
>(
|
|
53
|
-
client: InnerWalletApiClient<TAccount>,
|
|
54
|
-
signer: SmartAccountSigner,
|
|
55
|
-
params: SignTypedDataParams,
|
|
56
|
-
): Promise<SignTypedDataResult>;
|
|
57
|
-
|
|
58
43
|
export async function signTypedData(
|
|
59
44
|
client: InnerWalletApiClient,
|
|
60
45
|
signer: SmartAccountSigner,
|