@account-kit/wallet-client 0.1.0-alpha.1 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/esm/capabilities/permissions/mav2.js.map +1 -1
- package/dist/esm/client/actions/createAccount.d.ts +27 -2
- package/dist/esm/client/actions/createAccount.js +25 -0
- package/dist/esm/client/actions/createAccount.js.map +1 -1
- package/dist/esm/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +60 -2
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +26 -2
- package/dist/esm/client/actions/listAccounts.js +24 -0
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +28 -2
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.d.ts +21 -2
- package/dist/esm/client/actions/requestAccount.js +14 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +22 -2
- package/dist/esm/client/actions/signMessage.js +4 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +35 -2
- package/dist/esm/client/actions/signTypedData.js +3 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +99 -11
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +7 -5
- package/dist/esm/client/decorator.js +1 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +4 -4
- package/dist/esm/client/index.js +29 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -0
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +1 -1
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/internal/decorator.d.ts +2 -0
- package/dist/esm/internal/decorator.js +10 -0
- package/dist/esm/internal/decorator.js.map +1 -0
- package/dist/esm/local/client.d.ts +1 -1
- package/dist/esm/local/client.js +8 -1
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +1 -1
- package/dist/esm/remote/client.js +6 -1
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +1 -1
- package/dist/esm/types.d.ts +15 -4
- package/dist/esm/types.js.map +1 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +2 -2
- package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -1
- package/dist/types/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +21 -2
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +60 -2
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +26 -2
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +28 -2
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts +21 -2
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +39 -2
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +22 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +31 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +35 -2
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +7 -5
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/internal/decorator.d.ts +3 -0
- package/dist/types/internal/decorator.d.ts.map +1 -0
- package/dist/types/local/client.d.ts +1 -1
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +1 -1
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +1 -1
- package/dist/types/types.d.ts +15 -4
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/capabilities/permissions/mav2.ts +2 -2
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/getCallsStatus.ts +21 -2
- package/src/client/actions/grantPermissions.ts +60 -2
- package/src/client/actions/listAccounts.ts +26 -2
- package/src/client/actions/prepareCalls.ts +28 -2
- package/src/client/actions/requestAccount.ts +40 -5
- package/src/client/actions/sendPreparedCalls.ts +39 -2
- package/src/client/actions/signMessage.ts +24 -4
- package/src/client/actions/signSignatureRequest.ts +31 -0
- package/src/client/actions/signTypedData.ts +39 -3
- package/src/client/client.e2e-test.ts +120 -11
- package/src/client/decorator.ts +10 -12
- package/src/client/index.ts +41 -10
- package/src/exports/index.ts +1 -0
- package/src/exports/internal.ts +1 -1
- package/src/internal/decorator.ts +12 -0
- package/src/local/client.ts +52 -42
- package/src/remote/client.ts +10 -5
- package/src/types.ts +18 -4
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Hex, type JsonRpcAccount, type SignableMessage } from "viem";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
export type SignMessageParams =
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
+
export type SignMessageParams = {
|
|
5
|
+
message: SignableMessage;
|
|
6
|
+
account?: Address;
|
|
7
|
+
};
|
|
5
8
|
export type SignMessageResult = Hex;
|
|
9
|
+
/**
|
|
10
|
+
* Signs a message using the smart account.
|
|
11
|
+
* This method requests the account associated with the signer and uses it to sign the message.
|
|
12
|
+
*
|
|
13
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
15
|
+
* @param {SignableMessage} message - The message to sign
|
|
16
|
+
* @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Sign a simple text message
|
|
20
|
+
* const signature = await client.signMessage("Hello, world!");
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Sign a raw hex message
|
|
24
|
+
* const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
|
|
25
|
+
*/
|
|
6
26
|
export declare function signMessage<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignMessageParams): Promise<SignMessageResult>;
|
|
7
27
|
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,MAAM,iBAAiB,GAAG;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -7,5 +7,36 @@ export type SignSignatureRequestResult = {
|
|
|
7
7
|
type: "ecdsa";
|
|
8
8
|
signature: Hex;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Signs a signature request using the provided signer.
|
|
12
|
+
* This method handles different types of signature requests including personal_sign and eth_signTypedData_v4.
|
|
13
|
+
*
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer to use for signing the request
|
|
15
|
+
* @param {SignSignatureRequestParams} params - The signature request parameters
|
|
16
|
+
* @param {string} params.type - The type of signature request ('personal_sign' or 'eth_signTypedData_v4')
|
|
17
|
+
* @param {any} params.data - The data to sign, format depends on the signature type
|
|
18
|
+
* @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
|
|
19
|
+
* @returns {string} result.type - The signature type (currently only 'ecdsa' is supported)
|
|
20
|
+
* @returns {Hex} result.signature - The hex-encoded signature
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Sign a personal message
|
|
24
|
+
* const result = await client.signSignatureRequest({
|
|
25
|
+
* type: 'personal_sign',
|
|
26
|
+
* data: 'Hello, world!'
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Sign typed data (EIP-712)
|
|
31
|
+
* const result = await client.signSignatureRequest({
|
|
32
|
+
* type: 'eth_signTypedData_v4',
|
|
33
|
+
* data: {
|
|
34
|
+
* domain: { ... },
|
|
35
|
+
* types: { ... },
|
|
36
|
+
* primaryType: '...',
|
|
37
|
+
* message: { ... }
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*/
|
|
10
41
|
export declare function signSignatureRequest(signer: SmartAccountSigner, params: SignSignatureRequestParams): Promise<SignSignatureRequestResult>;
|
|
11
42
|
//# sourceMappingURL=signSignatureRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"signSignatureRequest.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Hex, type JsonRpcAccount, type TypedDataDefinition } from "viem";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
-
export type SignTypedDataParams = TypedDataDefinition
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
+
export type SignTypedDataParams = TypedDataDefinition & {
|
|
5
|
+
account?: Address;
|
|
6
|
+
};
|
|
5
7
|
export type SignTypedDataResult = Hex;
|
|
8
|
+
/**
|
|
9
|
+
* Signs typed data (EIP-712) using the smart account.
|
|
10
|
+
* This method requests the account associated with the signer and uses it to sign the typed data.
|
|
11
|
+
*
|
|
12
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
13
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
14
|
+
* @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format
|
|
15
|
+
* @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Sign typed data
|
|
19
|
+
* const signature = await client.signTypedData({
|
|
20
|
+
* domain: {
|
|
21
|
+
* name: 'Example DApp',
|
|
22
|
+
* version: '1',
|
|
23
|
+
* chainId: 1,
|
|
24
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
|
|
25
|
+
* },
|
|
26
|
+
* types: {
|
|
27
|
+
* Person: [
|
|
28
|
+
* { name: 'name', type: 'string' },
|
|
29
|
+
* { name: 'wallet', type: 'address' }
|
|
30
|
+
* ]
|
|
31
|
+
* },
|
|
32
|
+
* primaryType: 'Person',
|
|
33
|
+
* message: {
|
|
34
|
+
* name: 'John Doe',
|
|
35
|
+
* wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
6
39
|
export declare function signTypedData<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
|
|
7
40
|
//# sourceMappingURL=signTypedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,aAAa,CACjC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import type { Hex, JsonRpcAccount
|
|
3
|
-
import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls";
|
|
4
|
-
import type { InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { Hex, JsonRpcAccount } from "viem";
|
|
3
|
+
import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls.ts";
|
|
4
|
+
import type { InnerWalletApiClient } from "../types.ts";
|
|
5
5
|
import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount.js";
|
|
6
6
|
import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
|
|
7
7
|
import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
|
|
8
8
|
import { type ListAccountsParams, type ListAccountsResult } from "./actions/listAccounts.js";
|
|
9
9
|
import { type PrepareCallsParams, type PrepareCallsResult } from "./actions/prepareCalls.js";
|
|
10
10
|
import { type RequestAccountParams, type RequestAccountResult } from "./actions/requestAccount.js";
|
|
11
|
+
import { type SignMessageParams } from "./actions/signMessage.js";
|
|
11
12
|
import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest.js";
|
|
13
|
+
import { type SignTypedDataParams } from "./actions/signTypedData.js";
|
|
12
14
|
export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined> = {
|
|
13
15
|
requestAccount: (params?: RequestAccountParams<TAccount>) => Promise<RequestAccountResult>;
|
|
14
16
|
prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
|
|
@@ -17,8 +19,8 @@ export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = Jso
|
|
|
17
19
|
listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
|
|
18
20
|
getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
|
|
19
21
|
signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
|
|
20
|
-
signMessage: (params:
|
|
21
|
-
signTypedData: (params:
|
|
22
|
+
signMessage: (params: SignMessageParams) => Promise<Hex>;
|
|
23
|
+
signTypedData: (params: SignTypedDataParams) => Promise<Hex>;
|
|
22
24
|
grantPermissions: (params: GrantPermissionsParams<TAccount>) => Promise<GrantPermissionsResult>;
|
|
23
25
|
};
|
|
24
26
|
export declare function smartWalletClientActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,K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AAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type { InnerWalletApiClient } from "../types";
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import type { Address, Chain, IsUndefined, JsonRpcAccount, Prettify } from "viem";
|
|
3
|
+
import type { InnerWalletApiClient } from "../types.ts";
|
|
5
4
|
import { type SmartWalletActions } from "./decorator.js";
|
|
5
|
+
import type { AlchemyTransport } from "@account-kit/infra";
|
|
6
6
|
export type SmartWalletClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Prettify<{
|
|
7
7
|
transport: AlchemyTransport;
|
|
8
8
|
chain: Chain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,WAAW,EACX,cAAc,EACd,QAAQ,EACT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,IACX,QAAQ,CACV;IACE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GACnC;IACE,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,GACD;IACE,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CACP,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EAEb,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GACxC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAEjE,wBAAgB,uBAAuB,CACrC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,EAElE,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GACxC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -11,4 +11,5 @@ export { requestAccount } from "../client/actions/requestAccount.js";
|
|
|
11
11
|
export { signMessage } from "../client/actions/signMessage.js";
|
|
12
12
|
export { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
13
13
|
export { signTypedData } from "../client/actions/signTypedData.js";
|
|
14
|
+
export { grantPermissions } from "../client/actions/grantPermissions.js";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,kBAA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E,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -9,6 +9,6 @@ export * from "../rpc/request.js";
|
|
|
9
9
|
export * as RpcSchemas from "../rpc/request.js";
|
|
10
10
|
export * from "../rpc/schema.js";
|
|
11
11
|
export * from "../schemas.js";
|
|
12
|
-
export type * from "../types";
|
|
12
|
+
export type * from "../types.ts";
|
|
13
13
|
export * from "../utils.js";
|
|
14
14
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAGA,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/exports/internal.ts"],"names":[],"mappings":"AAGA,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,mBAAmB,aAAa,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/internal/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,wBAAgB,sBAAsB,IAAI,aAAa,CAStD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Address, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
3
|
export declare function createLocalClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
|
|
4
4
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;AAY/E,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAWrB,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EACb,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Address, type JsonRpcAccount } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
3
|
export declare function createRemoteClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient<TAccount>;
|
|
4
4
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;AAK/E,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAErB,wBAAgB,kBAAkB,CAChC,QAAQ,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,EACb,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -263,6 +263,7 @@ export declare const WalletServerRpcSchema: {
|
|
|
263
263
|
method: "wallet_createSession";
|
|
264
264
|
};
|
|
265
265
|
ReturnType: {
|
|
266
|
+
sessionId: `0x${string}`;
|
|
266
267
|
signatureRequest: {
|
|
267
268
|
type: "personal_sign";
|
|
268
269
|
data: string | {
|
|
@@ -290,7 +291,6 @@ export declare const WalletServerRpcSchema: {
|
|
|
290
291
|
};
|
|
291
292
|
};
|
|
292
293
|
};
|
|
293
|
-
sessionId: `0x${string}`;
|
|
294
294
|
};
|
|
295
295
|
} | {
|
|
296
296
|
Request: {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
1
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
2
3
|
import type { Address, Chain, Client, Hex, IsUndefined, JsonRpcAccount, Transport } from "viem";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
|
|
5
|
+
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
6
|
+
import type { WalletServerViemRpcSchema } from "./rpc/schema.ts";
|
|
6
7
|
export type CreateInnerClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = {
|
|
7
8
|
chain: Chain;
|
|
8
9
|
transport: AlchemyTransport;
|
|
@@ -24,5 +25,15 @@ export type InnerClientActions = {
|
|
|
24
25
|
chainId: Hex;
|
|
25
26
|
}) => Promise<GrantPermissionsResult>;
|
|
26
27
|
};
|
|
27
|
-
export type
|
|
28
|
+
export type CachedAccount = {
|
|
29
|
+
account: SmartContractAccount;
|
|
30
|
+
requestParams: RequestAccountParams;
|
|
31
|
+
};
|
|
32
|
+
export type InternalState = {
|
|
33
|
+
setAccount: (account: CachedAccount) => void;
|
|
34
|
+
getAccount: () => CachedAccount | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type InnerWalletApiClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = InnerWalletApiClientBase<TAccount, InnerClientActions & {
|
|
37
|
+
internal: InternalState;
|
|
38
|
+
}>;
|
|
28
39
|
//# 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,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,WAAW,EACX,cAAc,EACd,SAAS,EACV,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,
|
|
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,WAAW,EACX,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,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,CAAC,OAAO,CAAC,GACvB,SAAS,IACX;IACF,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GACnC;IACE,OAAO,CAA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"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.2",
|
|
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",
|
|
@@ -51,22 +51,24 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@repo/configs": "workspace:*",
|
|
54
|
+
"@types/deep-equal": "^1.0.4",
|
|
54
55
|
"eslint-plugin-import": "^2.31.0"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"typescript": "^5.8.2"
|
|
58
59
|
},
|
|
59
60
|
"dependencies": {
|
|
60
|
-
"@aa-sdk/core": "^4.
|
|
61
|
-
"@account-kit/infra": "^4.
|
|
62
|
-
"@account-kit/smart-contracts": "^4.
|
|
61
|
+
"@aa-sdk/core": "^4.34.0",
|
|
62
|
+
"@account-kit/infra": "^4.34.0",
|
|
63
|
+
"@account-kit/smart-contracts": "^4.34.0",
|
|
63
64
|
"@sinclair/typebox": "^0.34.33",
|
|
65
|
+
"deep-equal": "^2.2.3",
|
|
64
66
|
"ox": "^0.6.12",
|
|
65
|
-
"viem": "
|
|
67
|
+
"viem": "2.29.2"
|
|
66
68
|
},
|
|
67
69
|
"publishConfig": {
|
|
68
70
|
"access": "public",
|
|
69
71
|
"registry": "https://registry.npmjs.org/"
|
|
70
72
|
},
|
|
71
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "435c18e58616f1f0706d6e4df6f23c7676062191"
|
|
72
74
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PermissionType } from "@account-kit/smart-contracts/experimental";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import { concatHex, sliceHex, type Hex } from "viem";
|
|
4
|
-
import type { PermissionsData } from ".";
|
|
5
|
-
import type { KeySigner } from "../../schemas";
|
|
4
|
+
import type { PermissionsData } from "./index.ts";
|
|
5
|
+
import type { KeySigner } from "../../schemas.ts";
|
|
6
6
|
import { assertNever } from "../../utils.js";
|
|
7
7
|
|
|
8
8
|
export const SESSION_ID_LENGTH_BYTES = 16;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_createAccount } from "../../rpc/request";
|
|
5
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
+
import type { wallet_createAccount } from "../../rpc/request.ts";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
6
6
|
|
|
7
7
|
export type CreateAccountParams = Omit<
|
|
8
8
|
Extract<
|
|
@@ -16,6 +16,31 @@ export type CreateAccountResult = Static<
|
|
|
16
16
|
typeof wallet_createAccount
|
|
17
17
|
>["ReturnType"];
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
21
|
+
* This method is primarily used to import existing accounts.
|
|
22
|
+
* For most cases, you should use requestAccount instead.
|
|
23
|
+
* If the account already exists, an error will be thrown.
|
|
24
|
+
*
|
|
25
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
26
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
27
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
28
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
29
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
30
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
31
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
32
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Create a new account with a custom salt
|
|
36
|
+
* const account = await client.createAccount({
|
|
37
|
+
* creationOptions: {
|
|
38
|
+
* accountType: "sma-b",
|
|
39
|
+
* salt: "0x04"
|
|
40
|
+
* }
|
|
41
|
+
* });
|
|
42
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
43
|
+
*/
|
|
19
44
|
export async function createAccount(
|
|
20
45
|
client: InnerWalletApiClient,
|
|
21
46
|
signer: SmartAccountSigner,
|
|
@@ -2,13 +2,32 @@ import type { Address, JsonRpcAccount } from "viem";
|
|
|
2
2
|
import type {
|
|
3
3
|
GetCallsStatusParams as IsomorphicGetCallsStatusParams,
|
|
4
4
|
GetCallsStatusResponse as IsomorphicGetCallsStatusResult,
|
|
5
|
-
} from "../../isomorphic/actions/getCallsStatus";
|
|
6
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
5
|
+
} from "../../isomorphic/actions/getCallsStatus.ts";
|
|
6
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
7
7
|
|
|
8
8
|
export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
|
|
9
9
|
|
|
10
10
|
export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Gets the status of a prepared call by its ID.
|
|
14
|
+
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {GetCallsStatusParams} params - The ID of the prepared call to check
|
|
18
|
+
* @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
|
|
19
|
+
* - id: The hex ID of the call
|
|
20
|
+
* - chainId: The chain ID in hex format
|
|
21
|
+
* - status: The current status of the batch execution
|
|
22
|
+
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // After sending prepared calls
|
|
26
|
+
* const sendResult = await client.sendPreparedCalls({...});
|
|
27
|
+
*
|
|
28
|
+
* // Check the status of the first call ID
|
|
29
|
+
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
30
|
+
*/
|
|
12
31
|
export async function getCallsStatus<
|
|
13
32
|
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
14
33
|
| JsonRpcAccount<Address>
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
type JsonRpcAccount,
|
|
6
6
|
toHex,
|
|
7
7
|
} from "viem";
|
|
8
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
8
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
9
9
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
10
|
-
import type { CreateSessionParams } from "../../isomorphic/actions/createSession";
|
|
10
|
+
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
11
11
|
|
|
12
12
|
export type GrantPermissionsParams<
|
|
13
13
|
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
@@ -22,6 +22,64 @@ export type GrantPermissionsResult = {
|
|
|
22
22
|
context: Hex;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Grants permissions to a smart account by creating a session.
|
|
27
|
+
* This allows another key to perform operations on behalf of the account.
|
|
28
|
+
*
|
|
29
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
30
|
+
* @param {SmartAccountSigner} signer - The signer of the smart account
|
|
31
|
+
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
32
|
+
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
33
|
+
* @param {number} params.expiry - Unix timestamp when the permissions expire
|
|
34
|
+
* @param {object} params.key - The session key information
|
|
35
|
+
* @param {string} params.key.publicKey - The public key of the session key
|
|
36
|
+
* @param {string} params.key.type - The type of the key (e.g., "secp256k1")
|
|
37
|
+
* @param {Array} params.permissions - Array of permission objects defining what the session key can do
|
|
38
|
+
* @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier
|
|
39
|
+
* @returns {Hex} result.context - A hex identifier for the granted permissions context
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Create a session key and grant root permissions
|
|
43
|
+
* const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
|
|
44
|
+
* const account = await client.requestAccount();
|
|
45
|
+
*
|
|
46
|
+
* const permissions = await client.grantPermissions({
|
|
47
|
+
* account: account.address,
|
|
48
|
+
* expiry: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
|
|
49
|
+
* key: {
|
|
50
|
+
* publicKey: await sessionKey.getAddress(),
|
|
51
|
+
* type: "secp256k1",
|
|
52
|
+
* },
|
|
53
|
+
* permissions: [{ type: "root" }],
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // Use the permissions to prepare a call
|
|
57
|
+
* const preparedUO = await client.prepareCalls({
|
|
58
|
+
* calls: [{ to: zeroAddress, value: "0x0" }],
|
|
59
|
+
* from: account.address,
|
|
60
|
+
* capabilities: {
|
|
61
|
+
* paymasterService: {
|
|
62
|
+
* policyId: "your-paymaster-policy-id",
|
|
63
|
+
* },
|
|
64
|
+
* permissions,
|
|
65
|
+
* },
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Sign with the session key
|
|
69
|
+
* const signature = await signSignatureRequest(
|
|
70
|
+
* sessionKey,
|
|
71
|
+
* preparedUO.signatureRequest,
|
|
72
|
+
* );
|
|
73
|
+
*
|
|
74
|
+
* // Send the prepared call using the session key
|
|
75
|
+
* const result = await client.sendPreparedCalls({
|
|
76
|
+
* ...preparedUO,
|
|
77
|
+
* signature,
|
|
78
|
+
* capabilities: {
|
|
79
|
+
* permissions,
|
|
80
|
+
* },
|
|
81
|
+
* });
|
|
82
|
+
*/
|
|
25
83
|
export async function grantPermissions<
|
|
26
84
|
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
27
85
|
| JsonRpcAccount<Address>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_listAccounts } from "../../rpc/request";
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
2
|
+
import type { wallet_listAccounts } from "../../rpc/request.ts";
|
|
3
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
4
|
|
|
5
5
|
export type ListAccountsParams = Static<
|
|
6
6
|
typeof wallet_listAccounts
|
|
@@ -10,6 +10,30 @@ export type ListAccountsResult = Static<
|
|
|
10
10
|
typeof wallet_listAccounts
|
|
11
11
|
>["ReturnType"];
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Lists all smart accounts for a given signer using the wallet API client.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
18
|
+
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
19
|
+
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
20
|
+
* @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages
|
|
21
|
+
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Fetch the first page of accounts
|
|
25
|
+
* const firstPage = await client.listAccounts({
|
|
26
|
+
* signerAddress: "0x123...",
|
|
27
|
+
* limit: 10
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // If an 'after' cursor exists, use it to fetch the next page
|
|
31
|
+
* const nextPage = await client.listAccounts({
|
|
32
|
+
* signerAddress: "0x123...",
|
|
33
|
+
* limit: 10,
|
|
34
|
+
* after: firstPage.meta.after
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
13
37
|
export async function listAccounts(
|
|
14
38
|
client: InnerWalletApiClient,
|
|
15
39
|
params: ListAccountsParams,
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import type {
|
|
8
8
|
PrepareCallsParams as IsomorphicPrepareCallsParams,
|
|
9
9
|
PrepareCallsResult as IsomorphicPrepareCallsResult,
|
|
10
|
-
} from "../../isomorphic/actions/prepareCalls";
|
|
11
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
10
|
+
} from "../../isomorphic/actions/prepareCalls.ts";
|
|
11
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
12
12
|
|
|
13
13
|
export type GetAccountParam<TAccount> =
|
|
14
14
|
IsUndefined<TAccount> extends true
|
|
@@ -24,6 +24,32 @@ export type PrepareCallsParams<
|
|
|
24
24
|
|
|
25
25
|
export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Prepares a set of contract calls for execution by building a user operation.
|
|
29
|
+
* Returns the built user operation and a signature request that needs to be signed
|
|
30
|
+
* before submitting to sendPreparedCalls.
|
|
31
|
+
*
|
|
32
|
+
* @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request
|
|
33
|
+
* @param {PrepareCallsParams<TAccount>} params - Parameters for preparing calls
|
|
34
|
+
* @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute
|
|
35
|
+
* @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)
|
|
36
|
+
* @param {object} [params.capabilities] - Optional capabilities to include with the request
|
|
37
|
+
* @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing
|
|
38
|
+
* the user operation data and signature request
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Prepare a sponosored user operation call
|
|
42
|
+
* const result = await client.prepareCalls({
|
|
43
|
+
* calls: [{
|
|
44
|
+
* to: "0x1234...",
|
|
45
|
+
* data: "0xabcdef...",
|
|
46
|
+
* value: "0x0"
|
|
47
|
+
* }],
|
|
48
|
+
* capabilities: {
|
|
49
|
+
* paymasterService: { policyId: "your-policy-id" }
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
*/
|
|
27
53
|
export async function prepareCalls<
|
|
28
54
|
TAccount extends JsonRpcAccount<Address> | undefined =
|
|
29
55
|
| JsonRpcAccount<Address>
|