@account-kit/wallet-client 0.1.0-alpha.4 → 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 +35 -10
- package/dist/esm/client/index.js +0 -29
- package/dist/esm/client/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 +35 -10
- package/dist/types/client/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 +16 -39
- 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
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 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAU3B,eAAO,MAAM,OAAO,GAAI,UAAU,aAAa,sEAG3C,CAAC;AAEL,eAAO,MAAM,WAAW,mEAA0C,CAAC;AAEnE,eAAO,MAAM,QAAQ,qCAEnB,CAAC;AAEH,eAAO,MAAM,0BAA0B,qCAErC,CAAC;AAGH,eAAO,MAAM,QAAQ,qFAEa,CAAC;AAEnC,eAAO,MAAM,OAAO,qFAEc,CAAC;AAEnC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EA0BtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;EAgBtC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;EAOxC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;EA4BjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,mBAAmB;;;;;KA0B/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,MAAM,CAAC,OAAO,mBAAmB,CAAC,EAClC,SAAS,CACV,CAAC,aAAa,CAAC,CAAC;AAEjB,eAAO,MAAM,SAAS;;;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAU3B,eAAO,MAAM,OAAO,GAAI,UAAU,aAAa,sEAG3C,CAAC;AAEL,eAAO,MAAM,WAAW,mEAA0C,CAAC;AAEnE,eAAO,MAAM,QAAQ,qCAEnB,CAAC;AAEH,eAAO,MAAM,0BAA0B,qCAErC,CAAC;AAGH,eAAO,MAAM,QAAQ,qFAEa,CAAC;AAEnC,eAAO,MAAM,OAAO,qFAEc,CAAC;AAEnC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EA0BtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;EAgBtC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;EAOxC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;EA4BjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,mBAAmB;;;;;KA0B/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,MAAM,CAAC,OAAO,mBAAmB,CAAC,EAClC,SAAS,CACV,CAAC,aAAa,CAAC,CAAC;AAEjB,eAAO,MAAM,iBAAiB,0LAI5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,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,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD;IACF,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,SAAS,GAClD;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAC1B,SAAS,IACX,MAAM,CACR,SAAS,EACT,KAAK,EACL,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,EACnC,yBAAyB,EACzB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,CAChB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,sBAAsB,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAC9C,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,aAAa,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,CACzD,kBAAkB,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAA;CAAE,CACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -17,7 +17,7 @@ describe("Client E2E Tests", () => {
|
|
|
17
17
|
);
|
|
18
18
|
describe("Local Mode Tests", () => {
|
|
19
19
|
const signer = LocalAccountSigner.privateKeyToAccountSigner(
|
|
20
|
-
"
|
|
20
|
+
"0xbaca22d9b6846ec09a4da378ffa07e2f14ce7d65675d135911b6fd281416bb03",
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const client = createSmartWalletClient({
|
|
@@ -32,34 +32,34 @@ describe("Client E2E Tests", () => {
|
|
|
32
32
|
transport,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
it("should successfully get a counterfactual address", async () => {
|
|
36
|
+
const account = await client.requestAccount();
|
|
37
|
+
expect(account.address).toMatchInlineSnapshot(
|
|
38
|
+
`"0xa46944b7a39c35d931D514ACAc3ac77c226a81ff"`,
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
35
42
|
it("should successfully request account with different salt", async () => {
|
|
36
43
|
const account = await client.requestAccount({
|
|
37
|
-
id: "
|
|
44
|
+
id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
|
|
38
45
|
creationHint: { salt: "0x1" },
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
expect(account.address).toMatchInlineSnapshot(
|
|
42
|
-
`"
|
|
49
|
+
`"0xA692f0E5AfAD20F771443D89C635146C6A592f06"`,
|
|
43
50
|
);
|
|
44
51
|
});
|
|
45
52
|
|
|
46
53
|
it("should not cache account if different inputs provided", async () => {
|
|
47
54
|
const account = await client.requestAccount();
|
|
48
55
|
const account2 = await client.requestAccount({
|
|
49
|
-
id: "
|
|
50
|
-
creationHint: { salt: "
|
|
56
|
+
id: "52ab44be-b03e-47ed-ad65-43014ea5fbfc",
|
|
57
|
+
creationHint: { salt: "0x2" },
|
|
51
58
|
});
|
|
52
59
|
|
|
53
60
|
expect(account.address).not.toEqual(account2.address);
|
|
54
61
|
});
|
|
55
62
|
|
|
56
|
-
it("should successfully get a counterfactual address", async () => {
|
|
57
|
-
const account = await client.requestAccount();
|
|
58
|
-
expect(account.address).toMatchInlineSnapshot(
|
|
59
|
-
`"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58"`,
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
63
|
it("can correctly sign a message", async () => {
|
|
64
64
|
const account = await client.requestAccount();
|
|
65
65
|
const message = "hello world";
|
|
@@ -85,7 +85,7 @@ describe("Client E2E Tests", () => {
|
|
|
85
85
|
|
|
86
86
|
it("can correctly sign a message with a different account", async () => {
|
|
87
87
|
const account = await client.requestAccount({
|
|
88
|
-
id: "
|
|
88
|
+
id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
|
|
89
89
|
creationHint: { salt: "0x1" },
|
|
90
90
|
});
|
|
91
91
|
const message = "hello world";
|
|
@@ -104,7 +104,7 @@ describe("Client E2E Tests", () => {
|
|
|
104
104
|
|
|
105
105
|
it("can correctly sign typed data with a different account", async () => {
|
|
106
106
|
const account = await client.requestAccount({
|
|
107
|
-
id: "
|
|
107
|
+
id: "f4c1d956-24ef-4002-a141-2c9d6d92af1a",
|
|
108
108
|
creationHint: { salt: "0x1" },
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -189,7 +189,7 @@ describe("Client E2E Tests", () => {
|
|
|
189
189
|
|
|
190
190
|
describe("Remote Mode Tests", () => {
|
|
191
191
|
const signer = LocalAccountSigner.privateKeyToAccountSigner(
|
|
192
|
-
"
|
|
192
|
+
"0xd7b061ef04d29cf68b3c89356678eccec9988de8d5ed892c19461c4a9d65925d",
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
const client = createSmartWalletClient({
|
|
@@ -207,26 +207,26 @@ describe("Client E2E Tests", () => {
|
|
|
207
207
|
it("should successfully get a counterfactual address", async () => {
|
|
208
208
|
const account = await client.requestAccount();
|
|
209
209
|
expect(account.address).toMatchInlineSnapshot(
|
|
210
|
-
`"
|
|
210
|
+
`"0x76E765e80FFAC96ac10Aa8908a8267A3B80d606D"`,
|
|
211
211
|
);
|
|
212
212
|
});
|
|
213
213
|
|
|
214
214
|
it("should successfully request account with different salt", async () => {
|
|
215
215
|
const account = await client.requestAccount({
|
|
216
|
-
id: "
|
|
216
|
+
id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
|
|
217
217
|
creationHint: { salt: "0x1" },
|
|
218
218
|
});
|
|
219
219
|
|
|
220
220
|
expect(account.address).toMatchInlineSnapshot(
|
|
221
|
-
`"
|
|
221
|
+
`"0xdfdd407b9569D40BEFa503208753E59cAc9713fA"`,
|
|
222
222
|
);
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
it("should not cache account if different inputs provided", async () => {
|
|
226
226
|
const account = await client.requestAccount();
|
|
227
227
|
const account2 = await client.requestAccount({
|
|
228
|
-
id: "
|
|
229
|
-
creationHint: { salt: "
|
|
228
|
+
id: "2a3320b4-6ed2-4833-a488-5188e9bdd9d2",
|
|
229
|
+
creationHint: { salt: "0x2" },
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
expect(account.address).not.toEqual(account2.address);
|
|
@@ -257,7 +257,7 @@ describe("Client E2E Tests", () => {
|
|
|
257
257
|
|
|
258
258
|
it("can correctly sign a message with a different account", async () => {
|
|
259
259
|
const account = await client.requestAccount({
|
|
260
|
-
id: "
|
|
260
|
+
id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
|
|
261
261
|
creationHint: { salt: "0x1" },
|
|
262
262
|
});
|
|
263
263
|
|
|
@@ -276,7 +276,7 @@ describe("Client E2E Tests", () => {
|
|
|
276
276
|
|
|
277
277
|
it("can correctly sign typed data with a different account", async () => {
|
|
278
278
|
const account = await client.requestAccount({
|
|
279
|
-
id: "
|
|
279
|
+
id: "26b375e3-c94a-4e98-b6b7-5a97121aa583",
|
|
280
280
|
creationHint: { salt: "0x1" },
|
|
281
281
|
});
|
|
282
282
|
|
package/src/client/decorator.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
3
|
import type {
|
|
4
4
|
SendPreparedCallsParams,
|
|
5
5
|
SendPreparedCallsResult,
|
|
@@ -48,10 +48,10 @@ import {
|
|
|
48
48
|
} from "./actions/signTypedData.js";
|
|
49
49
|
|
|
50
50
|
export type SmartWalletActions<
|
|
51
|
-
TAccount extends
|
|
51
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
52
52
|
> = {
|
|
53
53
|
requestAccount: (
|
|
54
|
-
params?: RequestAccountParams
|
|
54
|
+
params?: RequestAccountParams,
|
|
55
55
|
) => Promise<RequestAccountResult>;
|
|
56
56
|
prepareCalls: (
|
|
57
57
|
params: PrepareCallsParams<TAccount>,
|
|
@@ -75,16 +75,11 @@ export type SmartWalletActions<
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
export function smartWalletClientActions<
|
|
78
|
-
TAccount extends
|
|
78
|
+
TAccount extends Address | undefined = Address | undefined,
|
|
79
79
|
>(
|
|
80
|
-
client: InnerWalletApiClient<TAccount>,
|
|
81
|
-
signer: SmartAccountSigner,
|
|
82
|
-
): SmartWalletActions<TAccount>;
|
|
83
|
-
|
|
84
|
-
export function smartWalletClientActions(
|
|
85
80
|
client: InnerWalletApiClient,
|
|
86
81
|
signer: SmartAccountSigner,
|
|
87
|
-
): SmartWalletActions {
|
|
82
|
+
): SmartWalletActions<TAccount> {
|
|
88
83
|
return {
|
|
89
84
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
90
85
|
createAccount: (params) => createAccount(client, signer, params),
|