@account-kit/wallet-client 0.1.0-alpha.8 → 4.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/esm/client/actions/formatSign.d.ts +30 -0
- package/dist/esm/client/actions/formatSign.js +32 -0
- package/dist/esm/client/actions/formatSign.js.map +1 -0
- package/dist/esm/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/esm/client/actions/getCallsStatus.js +3 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +10 -11
- package/dist/esm/client/actions/grantPermissions.js +26 -12
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +10 -3
- package/dist/esm/client/actions/listAccounts.js +14 -2
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +6 -3
- package/dist/esm/client/actions/prepareCalls.js +12 -8
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +28 -0
- package/dist/esm/client/actions/prepareSign.js +31 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -0
- package/dist/esm/client/actions/requestAccount.d.ts +3 -1
- package/dist/esm/client/actions/requestAccount.js +5 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/esm/client/actions/sendPreparedCalls.js +2 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +5 -2
- package/dist/esm/client/actions/signMessage.js +5 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/esm/client/actions/signPreparedCalls.js +28 -39
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/esm/client/actions/signSignatureRequest.js +4 -7
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +2 -0
- package/dist/esm/client/actions/signTypedData.js +2 -0
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +0 -2
- package/dist/esm/client/decorator.js +1 -3
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +10 -6
- package/dist/esm/client/index.js +18 -21
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -5
- package/dist/esm/exports/index.js +1 -6
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/internal/account.d.ts +33 -0
- package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +33 -35
- package/dist/esm/internal/account.js.map +1 -0
- package/dist/esm/types.d.ts +5 -11
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +14 -1
- package/dist/esm/utils.js +13 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +4 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/client/actions/formatSign.d.ts +31 -0
- package/dist/types/client/actions/formatSign.d.ts.map +1 -0
- package/dist/types/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +10 -11
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +10 -3
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +6 -3
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +29 -0
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/client/actions/requestAccount.d.ts +3 -1
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +5 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +2 -0
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +0 -2
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +10 -6
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -5
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/internal/account.d.ts +34 -0
- package/dist/types/internal/account.d.ts.map +1 -0
- package/dist/types/types.d.ts +5 -11
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +14 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +33 -28
- package/src/client/actions/formatSign.ts +55 -0
- package/src/client/actions/getCallsStatus.ts +10 -6
- package/src/client/actions/grantPermissions.ts +46 -18
- package/src/client/actions/listAccounts.ts +22 -5
- package/src/client/actions/prepareCalls.ts +22 -16
- package/src/client/actions/prepareSign.ts +51 -0
- package/src/client/actions/requestAccount.ts +6 -4
- package/src/client/actions/sendPreparedCalls.ts +3 -1
- package/src/client/actions/signMessage.ts +5 -2
- package/src/client/actions/signPreparedCalls.ts +40 -45
- package/src/client/actions/signSignatureRequest.ts +12 -15
- package/src/client/actions/signTypedData.ts +2 -0
- package/src/client/decorator.ts +1 -8
- package/src/client/index.ts +41 -33
- package/src/exports/index.ts +1 -13
- package/src/{isomorphic/utils/createAccount.ts → internal/account.ts} +37 -54
- package/src/types.ts +7 -18
- package/src/utils.ts +15 -1
- package/src/version.ts +3 -0
- package/dist/esm/capabilities/eip7702Auth.d.ts +0 -4
- package/dist/esm/capabilities/eip7702Auth.js +0 -18
- package/dist/esm/capabilities/eip7702Auth.js.map +0 -1
- package/dist/esm/capabilities/index.d.ts +0 -38
- package/dist/esm/capabilities/index.js +0 -12
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/overrides.d.ts +0 -26
- package/dist/esm/capabilities/overrides.js +0 -14
- package/dist/esm/capabilities/overrides.js.map +0 -1
- package/dist/esm/capabilities/paymaster.d.ts +0 -3
- package/dist/esm/capabilities/paymaster.js +0 -5
- package/dist/esm/capabilities/paymaster.js.map +0 -1
- package/dist/esm/capabilities/permissions/index.d.ts +0 -145
- package/dist/esm/capabilities/permissions/index.js +0 -83
- package/dist/esm/capabilities/permissions/index.js.map +0 -1
- package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
- package/dist/esm/capabilities/permissions/mav2.js +0 -88
- package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
- package/dist/esm/client/actions/createAccount.d.ts +0 -35
- package/dist/esm/client/actions/createAccount.js +0 -32
- package/dist/esm/client/actions/createAccount.js.map +0 -1
- package/dist/esm/client/client.e2e-test.d.ts +0 -1
- package/dist/esm/client/client.e2e-test.js +0 -375
- package/dist/esm/client/client.e2e-test.js.map +0 -1
- package/dist/esm/exports/internal.d.ts +0 -13
- package/dist/esm/exports/internal.js +0 -15
- package/dist/esm/exports/internal.js.map +0 -1
- package/dist/esm/isomorphic/actions/createSession.d.ts +0 -14
- package/dist/esm/isomorphic/actions/createSession.js +0 -89
- package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -21
- package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -113
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/prepareCalls.js +0 -101
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -148
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
- package/dist/esm/isomorphic/client.d.ts +0 -239
- package/dist/esm/isomorphic/client.js +0 -37
- package/dist/esm/isomorphic/client.js.map +0 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +0 -18
- package/dist/esm/isomorphic/utils/7702.js +0 -74
- package/dist/esm/isomorphic/utils/7702.js.map +0 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +0 -23
- package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
- package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
- package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
- package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
- package/dist/esm/isomorphic/utils/decodeSignature.js +0 -13
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
- package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
- package/dist/esm/local/client.d.ts +0 -3
- package/dist/esm/local/client.js +0 -97
- package/dist/esm/local/client.js.map +0 -1
- package/dist/esm/remote/client.d.ts +0 -9
- package/dist/esm/remote/client.js +0 -41
- package/dist/esm/remote/client.js.map +0 -1
- package/dist/esm/rpc/examples.d.ts +0 -230
- package/dist/esm/rpc/examples.js +0 -314
- package/dist/esm/rpc/examples.js.map +0 -1
- package/dist/esm/rpc/request.d.ts +0 -711
- package/dist/esm/rpc/request.js +0 -213
- package/dist/esm/rpc/request.js.map +0 -1
- package/dist/esm/rpc/schema.d.ts +0 -659
- package/dist/esm/rpc/schema.js +0 -5
- package/dist/esm/rpc/schema.js.map +0 -1
- package/dist/esm/schemas.d.ts +0 -693
- package/dist/esm/schemas.js +0 -419
- package/dist/esm/schemas.js.map +0 -1
- package/dist/types/capabilities/eip7702Auth.d.ts +0 -5
- package/dist/types/capabilities/eip7702Auth.d.ts.map +0 -1
- package/dist/types/capabilities/index.d.ts +0 -39
- package/dist/types/capabilities/index.d.ts.map +0 -1
- package/dist/types/capabilities/overrides.d.ts +0 -27
- package/dist/types/capabilities/overrides.d.ts.map +0 -1
- package/dist/types/capabilities/paymaster.d.ts +0 -4
- package/dist/types/capabilities/paymaster.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/index.d.ts +0 -146
- package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
- package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
- package/dist/types/client/actions/createAccount.d.ts +0 -36
- package/dist/types/client/actions/createAccount.d.ts.map +0 -1
- package/dist/types/client/client.e2e-test.d.ts +0 -2
- package/dist/types/client/client.e2e-test.d.ts.map +0 -1
- package/dist/types/exports/internal.d.ts +0 -14
- package/dist/types/exports/internal.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/createSession.d.ts +0 -15
- package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -22
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/client.d.ts +0 -240
- package/dist/types/isomorphic/client.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/7702.d.ts +0 -19
- package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts +0 -24
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
- package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
- package/dist/types/local/client.d.ts +0 -4
- package/dist/types/local/client.d.ts.map +0 -1
- package/dist/types/remote/client.d.ts +0 -10
- package/dist/types/remote/client.d.ts.map +0 -1
- package/dist/types/rpc/examples.d.ts +0 -231
- package/dist/types/rpc/examples.d.ts.map +0 -1
- package/dist/types/rpc/request.d.ts +0 -712
- package/dist/types/rpc/request.d.ts.map +0 -1
- package/dist/types/rpc/schema.d.ts +0 -660
- package/dist/types/rpc/schema.d.ts.map +0 -1
- package/dist/types/schemas.d.ts +0 -694
- package/dist/types/schemas.d.ts.map +0 -1
- package/src/capabilities/eip7702Auth.ts +0 -26
- package/src/capabilities/index.ts +0 -12
- package/src/capabilities/overrides.ts +0 -35
- package/src/capabilities/paymaster.ts +0 -5
- package/src/capabilities/permissions/index.ts +0 -163
- package/src/capabilities/permissions/mav2.ts +0 -138
- package/src/client/actions/createAccount.ts +0 -53
- package/src/client/client.e2e-test.ts +0 -463
- package/src/exports/internal.ts +0 -16
- package/src/isomorphic/actions/createSession.ts +0 -151
- package/src/isomorphic/actions/getCallsStatus.ts +0 -170
- package/src/isomorphic/actions/prepareCalls.ts +0 -152
- package/src/isomorphic/actions/sendPreparedCalls.ts +0 -222
- package/src/isomorphic/client.ts +0 -94
- package/src/isomorphic/utils/7702.ts +0 -132
- package/src/isomorphic/utils/createDummySigner.ts +0 -27
- package/src/isomorphic/utils/decodeSignature.ts +0 -18
- package/src/isomorphic/utils/parsePermissionsContext.ts +0 -49
- package/src/isomorphic/utils/supportsFeature.ts +0 -34
- package/src/local/client.ts +0 -136
- package/src/remote/client.ts +0 -67
- package/src/rpc/examples.ts +0 -342
- package/src/rpc/request.ts +0 -299
- package/src/rpc/schema.ts +0 -40
- package/src/schemas.ts +0 -585
package/src/client/decorator.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
3
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
4
|
-
import {
|
|
5
|
-
createAccount,
|
|
6
|
-
type CreateAccountParams,
|
|
7
|
-
type CreateAccountResult,
|
|
8
|
-
} from "./actions/createAccount.js";
|
|
9
4
|
import {
|
|
10
5
|
getCallsStatus,
|
|
11
6
|
type GetCallsStatusParams,
|
|
@@ -64,7 +59,6 @@ export type SmartWalletActions<
|
|
|
64
59
|
sendPreparedCalls: (
|
|
65
60
|
params: SendPreparedCallsParams,
|
|
66
61
|
) => Promise<SendPreparedCallsResult>;
|
|
67
|
-
createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;
|
|
68
62
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
69
63
|
getCallsStatus: (
|
|
70
64
|
params: GetCallsStatusParams,
|
|
@@ -90,9 +84,8 @@ export function smartWalletClientActions<
|
|
|
90
84
|
): SmartWalletActions<TAccount> {
|
|
91
85
|
return {
|
|
92
86
|
requestAccount: (params) => requestAccount(client, signer, params),
|
|
93
|
-
createAccount: (params) => createAccount(client, signer, params),
|
|
94
87
|
prepareCalls: (params) => prepareCalls(client, params),
|
|
95
|
-
listAccounts: (params) => listAccounts(client, params),
|
|
88
|
+
listAccounts: (params) => listAccounts(client, signer, params),
|
|
96
89
|
sendPreparedCalls: (params) => sendPreparedCalls(client, params),
|
|
97
90
|
getCallsStatus: (params) => getCallsStatus(client, params),
|
|
98
91
|
signSignatureRequest: (params) => signSignatureRequest(signer, params),
|
package/src/client/index.ts
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
type Address,
|
|
5
|
+
type Chain,
|
|
6
|
+
type Prettify,
|
|
7
|
+
createClient,
|
|
8
|
+
custom,
|
|
9
|
+
} from "viem";
|
|
6
10
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
7
11
|
import {
|
|
8
12
|
smartWalletClientActions,
|
|
9
13
|
type SmartWalletActions,
|
|
10
14
|
} from "./decorator.js";
|
|
15
|
+
import { Provider } from "ox";
|
|
16
|
+
import { WalletServerRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
17
|
+
import { internalStateDecorator } from "../internal/decorator.js";
|
|
11
18
|
|
|
12
19
|
export type SmartWalletClientParams<
|
|
13
20
|
TAccount extends Address | undefined = Address | undefined,
|
|
14
|
-
> = Prettify<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
21
|
+
> = Prettify<
|
|
22
|
+
{
|
|
23
|
+
transport: AlchemyTransport;
|
|
24
|
+
chain: Chain;
|
|
25
|
+
signer: SmartAccountSigner;
|
|
26
|
+
account?: TAccount | Address | undefined;
|
|
27
|
+
} & (
|
|
28
|
+
| { policyId?: string; policyIds?: never }
|
|
29
|
+
| { policyIds?: string[]; policyId?: never }
|
|
30
|
+
)
|
|
31
|
+
>;
|
|
22
32
|
|
|
23
33
|
export type SmartWalletClient<
|
|
24
34
|
TAccount extends Address | undefined = Address | undefined,
|
|
@@ -31,12 +41,12 @@ export type SmartWalletClient<
|
|
|
31
41
|
* @param {AlchemyTransport} params.transport - The Alchemy transport to use
|
|
32
42
|
* @param {Chain} params.chain - The chain to use
|
|
33
43
|
* @param {SmartAccountSigner} params.signer - The signer to use for the smart account
|
|
34
|
-
* @param {"local" | "remote"} params.mode - The client's mode (local or remote).
|
|
35
44
|
* @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
|
|
36
45
|
* @param {Address} [params.account] - The smart account address to use (optional)
|
|
37
46
|
* @returns {SmartWalletClient} - A viem-compatible client
|
|
38
47
|
*
|
|
39
48
|
* @example
|
|
49
|
+
* ```ts
|
|
40
50
|
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
41
51
|
* import { alchemy, arbitrumSepolia } from "@account-kit/infra";
|
|
42
52
|
* import { generatePrivateKey } from "viem/accounts";
|
|
@@ -49,9 +59,9 @@ export type SmartWalletClient<
|
|
|
49
59
|
* const client = createSmartWalletClient({
|
|
50
60
|
* transport,
|
|
51
61
|
* chain: arbitrumSepolia,
|
|
52
|
-
* mode: "remote",
|
|
53
62
|
* signer,
|
|
54
63
|
* });
|
|
64
|
+
* ```
|
|
55
65
|
*/
|
|
56
66
|
export function createSmartWalletClient<
|
|
57
67
|
TAccount extends Address | undefined = undefined,
|
|
@@ -60,26 +70,26 @@ export function createSmartWalletClient<
|
|
|
60
70
|
export function createSmartWalletClient(
|
|
61
71
|
params: SmartWalletClientParams,
|
|
62
72
|
): SmartWalletClient {
|
|
63
|
-
const { transport, chain,
|
|
73
|
+
const { transport, chain, account, signer } = params;
|
|
74
|
+
|
|
75
|
+
const policyIds = params.policyId
|
|
76
|
+
? [params.policyId]
|
|
77
|
+
: params.policyIds
|
|
78
|
+
? params.policyIds
|
|
79
|
+
: undefined;
|
|
64
80
|
|
|
65
|
-
const innerClient =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
policyId,
|
|
77
|
-
account,
|
|
78
|
-
});
|
|
81
|
+
const innerClient = createClient({
|
|
82
|
+
transport: (opts) =>
|
|
83
|
+
custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(
|
|
84
|
+
opts,
|
|
85
|
+
),
|
|
86
|
+
chain,
|
|
87
|
+
account,
|
|
88
|
+
}).extend(() => ({
|
|
89
|
+
policyIds,
|
|
90
|
+
internal: internalStateDecorator(),
|
|
91
|
+
}));
|
|
79
92
|
|
|
80
|
-
// TODO: we need to do a few things here:
|
|
81
|
-
// 1. decorate the client with the wallet api actions
|
|
82
|
-
// 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
|
|
83
93
|
return innerClient.extend((client) =>
|
|
84
94
|
smartWalletClientActions(client, signer),
|
|
85
95
|
);
|
|
@@ -90,7 +100,6 @@ export function createSmartWalletClient(
|
|
|
90
100
|
// transport: alchemy({ apiKey: "123" }),
|
|
91
101
|
// chain: baseSepolia,
|
|
92
102
|
// signer: createDummySigner(zeroAddress),
|
|
93
|
-
// mode: "local",
|
|
94
103
|
// });
|
|
95
104
|
|
|
96
105
|
// const account1 = await clientWithoutAccount.requestAccount();
|
|
@@ -99,7 +108,6 @@ export function createSmartWalletClient(
|
|
|
99
108
|
// transport: alchemy({ apiKey: "123" }),
|
|
100
109
|
// chain: baseSepolia,
|
|
101
110
|
// signer: createDummySigner(zeroAddress),
|
|
102
|
-
// mode: "local",
|
|
103
111
|
// account: zeroAddress,
|
|
104
112
|
// });
|
|
105
113
|
|
package/src/exports/index.ts
CHANGED
|
@@ -9,21 +9,9 @@ export {
|
|
|
9
9
|
export {
|
|
10
10
|
WalletServerRpcSchema,
|
|
11
11
|
type WalletServerRpcSchemaType,
|
|
12
|
-
|
|
13
|
-
} from "../rpc/schema.js";
|
|
14
|
-
|
|
15
|
-
// capabilities: TODO: should these actually just have the types exported?
|
|
16
|
-
export { Capabilities } from "../capabilities/index.js";
|
|
17
|
-
export { PaymasterCapability } from "../capabilities/paymaster.js";
|
|
18
|
-
export {
|
|
19
|
-
PermissionsArray,
|
|
20
|
-
PermissionsCapability,
|
|
21
|
-
PermissionsContext,
|
|
22
|
-
PermissionsData,
|
|
23
|
-
} from "../capabilities/permissions/index.js";
|
|
12
|
+
} from "@alchemy/wallet-api-types/rpc";
|
|
24
13
|
|
|
25
14
|
// client actions
|
|
26
|
-
export { createAccount } from "../client/actions/createAccount.js";
|
|
27
15
|
export { getCallsStatus } from "../client/actions/getCallsStatus.js";
|
|
28
16
|
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
29
17
|
export { listAccounts } from "../client/actions/listAccounts.js";
|
|
@@ -1,79 +1,63 @@
|
|
|
1
1
|
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import {
|
|
3
|
-
createLightAccount,
|
|
4
3
|
createModularAccountV2,
|
|
5
|
-
|
|
4
|
+
createLightAccount,
|
|
5
|
+
createMultiOwnerLightAccount,
|
|
6
|
+
createMultiOwnerModularAccount,
|
|
6
7
|
} from "@account-kit/smart-contracts";
|
|
8
|
+
import { concatHex, type Chain, type Transport, type Address } from "viem";
|
|
7
9
|
import type { StaticDecode } from "@sinclair/typebox";
|
|
8
|
-
import
|
|
9
|
-
import { concatHex, hexToNumber } from "viem";
|
|
10
|
-
import type { TypeSerializedInitcode } from "../../schemas.js";
|
|
11
|
-
import { parsePermissionsContext } from "./parsePermissionsContext.js";
|
|
12
|
-
import { assertNever } from "../../utils.js";
|
|
13
|
-
import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
|
|
14
|
-
import { PermissionsCapability } from "../../capabilities/permissions/index.js";
|
|
10
|
+
import { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
15
11
|
import { InternalError, InvalidRequestError } from "ox/RpcResponse";
|
|
12
|
+
import { assertNever } from "../utils.js";
|
|
13
|
+
import { getAccountTypeForDelegationAddress7702 } from "@alchemy/wallet-api-types/capabilities";
|
|
16
14
|
|
|
17
15
|
type CreateAccountParams = {
|
|
18
16
|
chain: Chain;
|
|
19
17
|
transport: Transport;
|
|
20
18
|
signer: SmartAccountSigner;
|
|
21
19
|
accountAddress: Address;
|
|
22
|
-
counterfactualInfo?: StaticDecode<typeof
|
|
23
|
-
|
|
24
|
-
delegation?: Address;
|
|
20
|
+
counterfactualInfo?: StaticDecode<typeof SerializedInitcode>; // undefined for 7702 accounts
|
|
21
|
+
delegation?: Address; // for 7702 accounts
|
|
25
22
|
};
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* Creates a smart account instance from the given parameters.
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
26
|
+
*
|
|
27
|
+
* @param {CreateAccountParams} params - The parameters for creating a smart account.
|
|
28
|
+
* @returns {Promise<SmartContractAccount>} A promise that resolves to the created smart account.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* // Create a smart account
|
|
33
|
+
* const account = await createAccount({
|
|
34
|
+
* chain: arbitrumSepolia,
|
|
35
|
+
* transport: alchemy({
|
|
36
|
+
* apiKey: "your-alchemy-api-key",
|
|
37
|
+
* }),
|
|
38
|
+
* signer: signer,
|
|
39
|
+
* accountAddress: "0x1234...",
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
31
42
|
*/
|
|
32
43
|
export async function createAccount(
|
|
33
44
|
params: CreateAccountParams,
|
|
34
45
|
): Promise<SmartContractAccount> {
|
|
35
46
|
const { counterfactualInfo: ci, ...accountParams } = params;
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
// TODO: test that this edge case is handled correctly
|
|
39
|
-
const parsedContext = parsePermissionsContext(
|
|
40
|
-
params.permissions,
|
|
41
|
-
ci,
|
|
42
|
-
params.delegation,
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const signerEntity =
|
|
46
|
-
parsedContext?.contextVersion === "NON_DEFERRED_ACTION"
|
|
47
|
-
? {
|
|
48
|
-
entityId: hexToNumber(parsedContext.entityId),
|
|
49
|
-
isGlobalValidation: parsedContext.isGlobalValidation,
|
|
50
|
-
}
|
|
51
|
-
: undefined;
|
|
52
|
-
|
|
53
|
-
const mode = params.delegation ? "7702" : "default";
|
|
54
|
-
|
|
55
|
-
if (mode === "7702") {
|
|
48
|
+
if (params.delegation) {
|
|
56
49
|
const accountType = getAccountTypeForDelegationAddress7702(
|
|
57
|
-
params.delegation
|
|
50
|
+
params.delegation,
|
|
58
51
|
);
|
|
59
52
|
if (accountType !== "ModularAccountV2") {
|
|
60
53
|
throw new Error("7702 mode currently only supports ModularAccountV2");
|
|
61
54
|
}
|
|
62
55
|
return createModularAccountV2({
|
|
63
56
|
...accountParams,
|
|
64
|
-
|
|
65
|
-
deferredAction: parsedContext?.deferredAction,
|
|
66
|
-
mode,
|
|
57
|
+
mode: "7702",
|
|
67
58
|
});
|
|
68
59
|
}
|
|
69
60
|
|
|
70
|
-
if (mode !== "default") {
|
|
71
|
-
return assertNever(mode, "Unexpected mode in createAccount");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// At this point, we are guaranteed to be in default mode, where ci
|
|
75
|
-
// (counterfactualInfo) must be defined
|
|
76
|
-
|
|
77
61
|
if (!ci) {
|
|
78
62
|
throw new InternalError({
|
|
79
63
|
message: "Counterfactual info not found",
|
|
@@ -91,9 +75,7 @@ export async function createAccount(
|
|
|
91
75
|
case "MAv2.0.0-sma-b":
|
|
92
76
|
return createModularAccountV2({
|
|
93
77
|
...commonParams,
|
|
94
|
-
|
|
95
|
-
deferredAction: parsedContext?.deferredAction,
|
|
96
|
-
mode,
|
|
78
|
+
mode: "default",
|
|
97
79
|
});
|
|
98
80
|
case "LightAccountV2.0.0":
|
|
99
81
|
return createLightAccount({
|
|
@@ -115,8 +97,15 @@ export async function createAccount(
|
|
|
115
97
|
...commonParams,
|
|
116
98
|
version: "v1.1.0",
|
|
117
99
|
});
|
|
118
|
-
case "LightAccountV2.0.0-MultiOwner":
|
|
119
100
|
case "MAv1.0.0-MultiOwner":
|
|
101
|
+
return createMultiOwnerModularAccount({
|
|
102
|
+
...commonParams,
|
|
103
|
+
});
|
|
104
|
+
case "LightAccountV2.0.0-MultiOwner":
|
|
105
|
+
return createMultiOwnerLightAccount({
|
|
106
|
+
...commonParams,
|
|
107
|
+
version: "v2.0.0",
|
|
108
|
+
});
|
|
120
109
|
case "MAv1.0.0-MultiSig":
|
|
121
110
|
case "MAv2.0.0-ma-ssv":
|
|
122
111
|
case "MAv2.0.0-ma-webauthn":
|
|
@@ -129,9 +118,3 @@ export async function createAccount(
|
|
|
129
118
|
return assertNever(factoryType, "Unsupported factory type");
|
|
130
119
|
}
|
|
131
120
|
}
|
|
132
|
-
|
|
133
|
-
export function isModularAccountV2(
|
|
134
|
-
account: SmartContractAccount,
|
|
135
|
-
): account is ModularAccountV2 {
|
|
136
|
-
return account.source === "ModularAccountV2";
|
|
137
|
-
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
3
3
|
import type {
|
|
4
4
|
Address,
|
|
@@ -8,19 +8,15 @@ import type {
|
|
|
8
8
|
JsonRpcAccount,
|
|
9
9
|
Transport,
|
|
10
10
|
} from "viem";
|
|
11
|
-
import type {
|
|
12
|
-
GrantPermissionsParams,
|
|
13
|
-
GrantPermissionsResult,
|
|
14
|
-
} from "./client/actions/grantPermissions.ts";
|
|
15
11
|
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
16
|
-
import type { WalletServerViemRpcSchema } from "
|
|
12
|
+
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
17
13
|
|
|
18
14
|
export type CreateInnerClientParams<
|
|
19
15
|
TAccount extends Address | undefined = Address | undefined,
|
|
20
16
|
> = {
|
|
21
17
|
chain: Chain;
|
|
22
18
|
transport: AlchemyTransport;
|
|
23
|
-
|
|
19
|
+
policyIds?: string[];
|
|
24
20
|
account?: TAccount | Address | undefined;
|
|
25
21
|
};
|
|
26
22
|
|
|
@@ -33,16 +29,9 @@ export type InnerWalletApiClientBase<
|
|
|
33
29
|
Chain,
|
|
34
30
|
JsonRpcAccount<Address> | undefined,
|
|
35
31
|
WalletServerViemRpcSchema,
|
|
36
|
-
{
|
|
32
|
+
{ policyIds?: string[] } & TExtend
|
|
37
33
|
>;
|
|
38
34
|
|
|
39
|
-
export type InnerClientActions = {
|
|
40
|
-
grantPermissions: (
|
|
41
|
-
signer: SmartAccountSigner,
|
|
42
|
-
params: GrantPermissionsParams & { chainId: Hex },
|
|
43
|
-
) => Promise<GrantPermissionsResult>;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
35
|
export type CachedAccount = {
|
|
47
36
|
account: SmartContractAccount;
|
|
48
37
|
requestParams: RequestAccountParams;
|
|
@@ -53,9 +42,9 @@ export type InternalState = {
|
|
|
53
42
|
getAccount: () => CachedAccount | undefined;
|
|
54
43
|
};
|
|
55
44
|
|
|
56
|
-
export type InnerWalletApiClient = InnerWalletApiClientBase<
|
|
57
|
-
|
|
58
|
-
>;
|
|
45
|
+
export type InnerWalletApiClient = InnerWalletApiClientBase<{
|
|
46
|
+
internal: InternalState;
|
|
47
|
+
}>;
|
|
59
48
|
|
|
60
49
|
export type WithoutChainId<T> = T extends { chainId: Hex }
|
|
61
50
|
? Omit<T, "chainId">
|
package/src/utils.ts
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { isHex, toHex, type Hex } from "viem";
|
|
2
2
|
|
|
3
|
+
export type Expect<T extends true> = T;
|
|
4
|
+
|
|
3
5
|
export const assertNever = (_val: never, msg: string): never => {
|
|
4
6
|
throw new Error(msg);
|
|
5
7
|
};
|
|
6
8
|
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted.
|
|
11
|
+
*
|
|
12
|
+
* @param {string | number | bigint | Hex} val - The value to convert to Hex.
|
|
13
|
+
* @returns {Hex} The Hex value.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const hex = castToHex("0x1234");
|
|
18
|
+
* const hex2 = castToHex(1234);
|
|
19
|
+
* const hex3 = castToHex(BigInt(1234));
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
8
22
|
export const castToHex = (val: string | number | bigint | Hex): Hex => {
|
|
9
23
|
if (isHex(val)) {
|
|
10
24
|
return val;
|
package/src/version.ts
ADDED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const Eip7702AuthCapability: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
2
|
-
account: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
3
|
-
delegation: import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TLiteral<"0x69007702764179f14F51cdce752f4f775d74E139"> | import("@sinclair/typebox").TLiteral<"ModularAccountV2">)[]>;
|
|
4
|
-
}>, import("@sinclair/typebox").TLiteral<true>]>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { TypeAddress } from "../schemas.js";
|
|
3
|
-
import { EIP_7702_ACCOUNT_TYPE, SUPPORTED_DELEGATION_ADDRESSES, } from "../isomorphic/utils/7702.js";
|
|
4
|
-
export const Eip7702AuthCapability = Type.Union([
|
|
5
|
-
Type.Object({
|
|
6
|
-
account: Type.Optional(TypeAddress),
|
|
7
|
-
// Wallet applications must maintain a strict shortlist of well-known accounts.
|
|
8
|
-
// https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR189
|
|
9
|
-
delegation: Type.Union([
|
|
10
|
-
...SUPPORTED_DELEGATION_ADDRESSES.map((address) => Type.Literal(address)),
|
|
11
|
-
...EIP_7702_ACCOUNT_TYPE.map((it) => Type.Literal(it)),
|
|
12
|
-
]),
|
|
13
|
-
}, {
|
|
14
|
-
description: "Specify EIP-7702 delegation",
|
|
15
|
-
}),
|
|
16
|
-
Type.Literal(true, { description: "Default EIP-7702 delegation" }),
|
|
17
|
-
]);
|
|
18
|
-
//# sourceMappingURL=eip7702Auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eip7702Auth.js","sourceRoot":"","sources":["../../../src/capabilities/eip7702Auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC9C,IAAI,CAAC,MAAM,CACT;QACE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QACnC,+EAA+E;QAC/E,4HAA4H;QAC5H,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC;YACrB,GAAG,8BAA8B,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAChD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CACtB;YACD,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SACvD,CAAC;KACH,EACD;QACE,WAAW,EAAE,6BAA6B;KAC3C,CACF;IACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { TypeAddress } from \"../schemas.js\";\nimport {\n EIP_7702_ACCOUNT_TYPE,\n SUPPORTED_DELEGATION_ADDRESSES,\n} from \"../isomorphic/utils/7702.js\";\n\nexport const Eip7702AuthCapability = Type.Union([\n Type.Object(\n {\n account: Type.Optional(TypeAddress),\n // Wallet applications must maintain a strict shortlist of well-known accounts.\n // https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR189\n delegation: Type.Union([\n ...SUPPORTED_DELEGATION_ADDRESSES.map((address) =>\n Type.Literal(address),\n ),\n ...EIP_7702_ACCOUNT_TYPE.map((it) => Type.Literal(it)),\n ]),\n },\n {\n description: \"Specify EIP-7702 delegation\",\n },\n ),\n Type.Literal(true, { description: \"Default EIP-7702 delegation\" }),\n]);\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare const Capabilities: import("@sinclair/typebox").TObject<{
|
|
2
|
-
permissions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
3
|
-
context: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
4
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
5
|
-
sessionId: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
6
|
-
signature: import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">;
|
|
7
|
-
}>]>>;
|
|
8
|
-
paymasterService: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
9
|
-
policyId: import("@sinclair/typebox").TString;
|
|
10
|
-
}>>;
|
|
11
|
-
gasParamsOverride: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
12
|
-
preVerificationGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
13
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
14
|
-
}>]>>;
|
|
15
|
-
verificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
16
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
17
|
-
}>]>>;
|
|
18
|
-
callGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
19
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
20
|
-
}>]>>;
|
|
21
|
-
paymasterVerificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
22
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
23
|
-
}>]>>;
|
|
24
|
-
paymasterPostOpGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
25
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
26
|
-
}>]>>;
|
|
27
|
-
maxFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
28
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
29
|
-
}>]>>;
|
|
30
|
-
maxPriorityFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
31
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
32
|
-
}>]>>;
|
|
33
|
-
}>>;
|
|
34
|
-
eip7702Auth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
35
|
-
account: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">>;
|
|
36
|
-
delegation: import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TLiteral<"0x69007702764179f14F51cdce752f4f775d74E139"> | import("@sinclair/typebox").TLiteral<"ModularAccountV2">)[]>;
|
|
37
|
-
}>, import("@sinclair/typebox").TLiteral<true>]>>;
|
|
38
|
-
}>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { GasParamsOverrideCapability } from "./overrides.js";
|
|
3
|
-
import { PaymasterCapability } from "./paymaster.js";
|
|
4
|
-
import { PermissionsCapability } from "./permissions/index.js";
|
|
5
|
-
import { Eip7702AuthCapability } from "./eip7702Auth.js";
|
|
6
|
-
export const Capabilities = Type.Object({
|
|
7
|
-
permissions: Type.Optional(PermissionsCapability),
|
|
8
|
-
paymasterService: Type.Optional(PaymasterCapability),
|
|
9
|
-
gasParamsOverride: Type.Optional(GasParamsOverrideCapability),
|
|
10
|
-
eip7702Auth: Type.Optional(Eip7702AuthCapability),
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACpD,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC7D,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { GasParamsOverrideCapability } from \"./overrides.js\";\nimport { PaymasterCapability } from \"./paymaster.js\";\nimport { PermissionsCapability } from \"./permissions/index.js\";\nimport { Eip7702AuthCapability } from \"./eip7702Auth.js\";\n\nexport const Capabilities = Type.Object({\n permissions: Type.Optional(PermissionsCapability),\n paymasterService: Type.Optional(PaymasterCapability),\n gasParamsOverride: Type.Optional(GasParamsOverrideCapability),\n eip7702Auth: Type.Optional(Eip7702AuthCapability),\n});\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const Mutliplier: import("@sinclair/typebox").TObject<{
|
|
2
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
3
|
-
}>;
|
|
4
|
-
export declare const GasParamsOverrideCapability: import("@sinclair/typebox").TObject<{
|
|
5
|
-
preVerificationGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
6
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
7
|
-
}>]>>;
|
|
8
|
-
verificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
9
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
10
|
-
}>]>>;
|
|
11
|
-
callGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
12
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
13
|
-
}>]>>;
|
|
14
|
-
paymasterVerificationGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
15
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
16
|
-
}>]>>;
|
|
17
|
-
paymasterPostOpGasLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
18
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
19
|
-
}>]>>;
|
|
20
|
-
maxFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
21
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
22
|
-
}>]>>;
|
|
23
|
-
maxPriorityFeePerGas: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTemplateLiteralSyntax<"0x${string}">, import("@sinclair/typebox").TObject<{
|
|
24
|
-
multiplier: import("@sinclair/typebox").TNumber;
|
|
25
|
-
}>]>>;
|
|
26
|
-
}>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { TypeHex } from "../schemas.js";
|
|
3
|
-
export const Mutliplier = Type.Object({ multiplier: Type.Number() }, { description: "Multiplier" });
|
|
4
|
-
// This is still being defined in https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR158
|
|
5
|
-
export const GasParamsOverrideCapability = Type.Object({
|
|
6
|
-
preVerificationGas: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
7
|
-
verificationGasLimit: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
8
|
-
callGasLimit: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
9
|
-
paymasterVerificationGasLimit: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
10
|
-
paymasterPostOpGasLimit: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
11
|
-
maxFeePerGas: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
12
|
-
maxPriorityFeePerGas: Type.Optional(Type.Union([TypeHex({ description: "Absolute" }), Mutliplier])),
|
|
13
|
-
}, { minProperties: 1 });
|
|
14
|
-
//# sourceMappingURL=overrides.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../../src/capabilities/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CACnC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAC7B,EAAE,WAAW,EAAE,YAAY,EAAE,CAC9B,CAAC;AAEF,2JAA2J;AAC3J,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CACpD;IACE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAC/B,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CACjC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,YAAY,EAAE,IAAI,CAAC,QAAQ,CACzB,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,6BAA6B,EAAE,IAAI,CAAC,QAAQ,CAC1C,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,uBAAuB,EAAE,IAAI,CAAC,QAAQ,CACpC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,YAAY,EAAE,IAAI,CAAC,QAAQ,CACzB,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;IACD,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CACjC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAC/D;CACF,EACD,EAAE,aAAa,EAAE,CAAC,EAAE,CACrB,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\nimport { TypeHex } from \"../schemas.js\";\n\nexport const Mutliplier = Type.Object(\n { multiplier: Type.Number() },\n { description: \"Multiplier\" },\n);\n\n// This is still being defined in https://github.com/ethereum/ERCs/pull/947/files#diff-dab085f963ca621595044bcbc0922705aa38b69f5bf8770dcb3d0496a633efcfR158\nexport const GasParamsOverrideCapability = Type.Object(\n {\n preVerificationGas: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n verificationGasLimit: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n callGasLimit: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n paymasterVerificationGasLimit: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n paymasterPostOpGasLimit: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n maxFeePerGas: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n maxPriorityFeePerGas: Type.Optional(\n Type.Union([TypeHex({ description: \"Absolute\" }), Mutliplier]),\n ),\n },\n { minProperties: 1 },\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paymaster.js","sourceRoot":"","sources":["../../../src/capabilities/paymaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC","sourcesContent":["import { Type } from \"@sinclair/typebox\";\n\nexport const PaymasterCapability = Type.Object({\n policyId: Type.String(),\n});\n"]}
|