@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Alchemy Insights, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import type { wallet_formatSign } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { InnerWalletApiClient, WithoutChainId } from "../../types.ts";
|
|
4
|
+
import { type Address, type IsUndefined } from "viem";
|
|
5
|
+
export type FormatSignParams<TAccount extends Address | undefined = Address | undefined> = Omit<WithoutChainId<Static<(typeof wallet_formatSign)["properties"]["Request"]["properties"]["params"]>[0]>, "from"> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type FormatSignResult = Static<typeof wallet_formatSign>["ReturnType"];
|
|
11
|
+
/**
|
|
12
|
+
* Formats a signature request for signing messages or transactions.
|
|
13
|
+
*
|
|
14
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
15
|
+
* @param {FormatSignParams} params - Parameters for formatting the signature
|
|
16
|
+
* @returns {Promise<FormatSignResult>} A Promise that resolves to the formatSign result containing the formatted signature.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Formats a signature
|
|
21
|
+
* const result = await client.formatSign({
|
|
22
|
+
* from: "0x1234...",
|
|
23
|
+
* signature: {
|
|
24
|
+
* type: "ecdsa",
|
|
25
|
+
* data: "0xabcd..."
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatSign<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: FormatSignParams<TAccount>): Promise<FormatSignResult>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { toHex } from "viem";
|
|
2
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
3
|
+
/**
|
|
4
|
+
* Formats a signature request for signing messages or transactions.
|
|
5
|
+
*
|
|
6
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
7
|
+
* @param {FormatSignParams} params - Parameters for formatting the signature
|
|
8
|
+
* @returns {Promise<FormatSignResult>} A Promise that resolves to the formatSign result containing the formatted signature.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Formats a signature
|
|
13
|
+
* const result = await client.formatSign({
|
|
14
|
+
* from: "0x1234...",
|
|
15
|
+
* signature: {
|
|
16
|
+
* type: "ecdsa",
|
|
17
|
+
* data: "0xabcd..."
|
|
18
|
+
* },
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export async function formatSign(client, params) {
|
|
23
|
+
const from = params.from ?? client.account?.address;
|
|
24
|
+
if (!from) {
|
|
25
|
+
throw new AccountNotFoundError();
|
|
26
|
+
}
|
|
27
|
+
return client.request({
|
|
28
|
+
method: "wallet_formatSign",
|
|
29
|
+
params: [{ ...params, from, chainId: toHex(client.chain.id) }],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=formatSign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatSign.js","sourceRoot":"","sources":["../../../../src/client/actions/formatSign.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAgBpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAG9B,MAA4B,EAC5B,MAAkC;IAElC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_formatSign } from \"@alchemy/wallet-api-types/rpc\";\nimport type { InnerWalletApiClient, WithoutChainId } from \"../../types.ts\";\nimport { toHex, type Address, type IsUndefined } from \"viem\";\nimport { AccountNotFoundError } from \"@aa-sdk/core\";\n\nexport type FormatSignParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Omit<\n WithoutChainId<\n Static<\n (typeof wallet_formatSign)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0]\n >,\n \"from\"\n> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type FormatSignResult = Static<typeof wallet_formatSign>[\"ReturnType\"];\n\n/**\n * Formats a signature request for signing messages or transactions.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {FormatSignParams} params - Parameters for formatting the signature\n * @returns {Promise<FormatSignResult>} A Promise that resolves to the formatSign result containing the formatted signature.\n *\n * @example\n * ```ts\n * // Formats a signature\n * const result = await client.formatSign({\n * from: \"0x1234...\",\n * signature: {\n * type: \"ecdsa\",\n * data: \"0xabcd...\"\n * },\n * });\n * ```\n */\nexport async function formatSign<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n params: FormatSignParams<TAccount>,\n): Promise<FormatSignResult> {\n const from = params.from ?? client.account?.address;\n if (!from) {\n throw new AccountNotFoundError();\n }\n\n return client.request({\n method: \"wallet_formatSign\",\n params: [{ ...params, from, chainId: toHex(client.chain.id) }],\n });\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
|
|
2
1
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Static } from "@sinclair/typebox";
|
|
3
|
+
import { wallet_getCallsStatus } from "@alchemy/wallet-api-types/rpc";
|
|
4
|
+
export type GetCallsStatusParams = Static<typeof wallet_getCallsStatus>["Request"]["params"][0];
|
|
5
|
+
export type GetCallsStatusResult = Static<typeof wallet_getCallsStatus>["ReturnType"];
|
|
5
6
|
/**
|
|
6
7
|
* Gets the status of a prepared call by its ID.
|
|
7
8
|
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
@@ -15,10 +16,12 @@ export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
|
15
16
|
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
16
17
|
*
|
|
17
18
|
* @example
|
|
19
|
+
* ```ts
|
|
18
20
|
* // After sending prepared calls
|
|
19
21
|
* const sendResult = await client.sendPreparedCalls({...});
|
|
20
22
|
*
|
|
21
23
|
* // Check the status of the first call ID
|
|
22
24
|
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
25
|
+
* ```
|
|
23
26
|
*/
|
|
24
27
|
export declare function getCallsStatus(client: InnerWalletApiClient, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wallet_getCallsStatus } from "@alchemy/wallet-api-types/rpc";
|
|
1
2
|
/**
|
|
2
3
|
* Gets the status of a prepared call by its ID.
|
|
3
4
|
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
@@ -11,11 +12,13 @@
|
|
|
11
12
|
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
15
|
+
* ```ts
|
|
14
16
|
* // After sending prepared calls
|
|
15
17
|
* const sendResult = await client.sendPreparedCalls({...});
|
|
16
18
|
*
|
|
17
19
|
* // Check the status of the first call ID
|
|
18
20
|
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
21
|
+
* ```
|
|
19
22
|
*/
|
|
20
23
|
export async function getCallsStatus(client, params) {
|
|
21
24
|
return await client.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCallsStatus.js","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAUtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA4B;IAE5B,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,MAAM,CAAC;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_getCallsStatus } from \"@alchemy/wallet-api-types/rpc\";\n\nexport type GetCallsStatusParams = Static<\n typeof wallet_getCallsStatus\n>[\"Request\"][\"params\"][0];\n\nexport type GetCallsStatusResult = Static<\n typeof wallet_getCallsStatus\n>[\"ReturnType\"];\n\n/**\n * Gets the status of a prepared call by its ID.\n * This method is used to check the execution status of calls sent via sendPreparedCalls.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {GetCallsStatusParams} params - The ID of the prepared call to check\n * @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:\n * - id: The hex ID of the call\n * - chainId: The chain ID in hex format\n * - status: The current status of the batch execution\n * - receipts: Optional array of transaction receipts if the batch has been executed\n *\n * @example\n * ```ts\n * // After sending prepared calls\n * const sendResult = await client.sendPreparedCalls({...});\n *\n * // Check the status of the first call ID\n * const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);\n * ```\n */\nexport async function getCallsStatus(\n client: InnerWalletApiClient,\n params: GetCallsStatusParams,\n): Promise<GetCallsStatusResult> {\n return await client.request({\n method: \"wallet_getCallsStatus\",\n params: [params],\n });\n}\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
-
import { type Address, type Hex, type IsUndefined } from "viem";
|
|
3
|
-
import type { CreateSessionParams } from "../../isomorphic/actions/createSession.ts";
|
|
2
|
+
import { type Address, type Hex, type IsUndefined, type Prettify } from "viem";
|
|
4
3
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
5
|
-
|
|
4
|
+
import type { Static } from "@sinclair/typebox";
|
|
5
|
+
import { wallet_createSession } from "@alchemy/wallet-api-types/rpc";
|
|
6
|
+
export type GrantPermissionsParams<TAccount extends Address | undefined = Address | undefined> = Prettify<Omit<Static<(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]>[0], "account" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
6
7
|
account: Address;
|
|
7
8
|
} : {
|
|
8
9
|
account?: never;
|
|
9
|
-
})
|
|
10
|
+
})>;
|
|
10
11
|
export type GrantPermissionsResult = {
|
|
11
12
|
context: Hex;
|
|
12
13
|
};
|
|
@@ -19,21 +20,21 @@ export type GrantPermissionsResult = {
|
|
|
19
20
|
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
20
21
|
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
21
22
|
* @param {number} params.expirySec - Unix timestamp when the permissions expire
|
|
22
|
-
* @param {
|
|
23
|
+
* @param {sessionKeyData} params.key - The session key information
|
|
23
24
|
* @param {string} params.key.publicKey - The public key of the session key
|
|
24
25
|
* @param {string} params.key.type - The type of the key (e.g., "secp256k1")
|
|
25
26
|
* @param {Array} params.permissions - Array of permission objects defining what the session key can do
|
|
26
27
|
* @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier
|
|
27
|
-
* @returns {Hex} result.context - A hex identifier for the granted permissions context
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
|
+
* ```ts
|
|
30
31
|
* // Create a session key and grant root permissions
|
|
31
32
|
* const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
|
|
32
33
|
* const account = await client.requestAccount();
|
|
33
34
|
*
|
|
34
35
|
* const permissions = await client.grantPermissions({
|
|
35
36
|
* account: account.address,
|
|
36
|
-
*
|
|
37
|
+
* expirySec: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
|
|
37
38
|
* key: {
|
|
38
39
|
* publicKey: await sessionKey.getAddress(),
|
|
39
40
|
* type: "secp256k1",
|
|
@@ -54,10 +55,7 @@ export type GrantPermissionsResult = {
|
|
|
54
55
|
* });
|
|
55
56
|
*
|
|
56
57
|
* // Sign with the session key
|
|
57
|
-
* const signedCalls = await
|
|
58
|
-
* sessionKey,
|
|
59
|
-
* preparedCalls,
|
|
60
|
-
* );
|
|
58
|
+
* const signedCalls = await signPreparedCalls(sessionKey, preparedCalls);
|
|
61
59
|
*
|
|
62
60
|
* // Send the prepared call using the session key
|
|
63
61
|
* const result = await client.sendPreparedCalls({
|
|
@@ -66,5 +64,6 @@ export type GrantPermissionsResult = {
|
|
|
66
64
|
* permissions,
|
|
67
65
|
* },
|
|
68
66
|
* });
|
|
67
|
+
* ```
|
|
69
68
|
*/
|
|
70
69
|
export declare function grantPermissions<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner, params: GrantPermissionsParams<TAccount>): Promise<GrantPermissionsResult>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
2
|
-
import { toHex } from "viem";
|
|
2
|
+
import { toHex, } from "viem";
|
|
3
|
+
import { wallet_createSession } from "@alchemy/wallet-api-types/rpc";
|
|
4
|
+
import { encodePermissionsContext } from "@alchemy/wallet-api-types/capabilities";
|
|
5
|
+
import { signSignatureRequest } from "./signSignatureRequest.js";
|
|
3
6
|
/**
|
|
4
7
|
* Grants permissions to a smart account by creating a session.
|
|
5
8
|
* This allows another key to perform operations on behalf of the account.
|
|
@@ -9,21 +12,21 @@ import { toHex } from "viem";
|
|
|
9
12
|
* @param {GrantPermissionsParams} params - The parameters for granting permissions
|
|
10
13
|
* @param {Address} [params.account] - The account address (required if client was not initialized with an account)
|
|
11
14
|
* @param {number} params.expirySec - Unix timestamp when the permissions expire
|
|
12
|
-
* @param {
|
|
15
|
+
* @param {sessionKeyData} params.key - The session key information
|
|
13
16
|
* @param {string} params.key.publicKey - The public key of the session key
|
|
14
17
|
* @param {string} params.key.type - The type of the key (e.g., "secp256k1")
|
|
15
18
|
* @param {Array} params.permissions - Array of permission objects defining what the session key can do
|
|
16
19
|
* @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier
|
|
17
|
-
* @returns {Hex} result.context - A hex identifier for the granted permissions context
|
|
18
20
|
*
|
|
19
21
|
* @example
|
|
22
|
+
* ```ts
|
|
20
23
|
* // Create a session key and grant root permissions
|
|
21
24
|
* const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
|
|
22
25
|
* const account = await client.requestAccount();
|
|
23
26
|
*
|
|
24
27
|
* const permissions = await client.grantPermissions({
|
|
25
28
|
* account: account.address,
|
|
26
|
-
*
|
|
29
|
+
* expirySec: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
|
|
27
30
|
* key: {
|
|
28
31
|
* publicKey: await sessionKey.getAddress(),
|
|
29
32
|
* type: "secp256k1",
|
|
@@ -44,10 +47,7 @@ import { toHex } from "viem";
|
|
|
44
47
|
* });
|
|
45
48
|
*
|
|
46
49
|
* // Sign with the session key
|
|
47
|
-
* const signedCalls = await
|
|
48
|
-
* sessionKey,
|
|
49
|
-
* preparedCalls,
|
|
50
|
-
* );
|
|
50
|
+
* const signedCalls = await signPreparedCalls(sessionKey, preparedCalls);
|
|
51
51
|
*
|
|
52
52
|
* // Send the prepared call using the session key
|
|
53
53
|
* const result = await client.sendPreparedCalls({
|
|
@@ -56,16 +56,30 @@ import { toHex } from "viem";
|
|
|
56
56
|
* permissions,
|
|
57
57
|
* },
|
|
58
58
|
* });
|
|
59
|
+
* ```
|
|
59
60
|
*/
|
|
60
61
|
export async function grantPermissions(client, signer, params) {
|
|
61
62
|
const account = params.account ?? client.account?.address;
|
|
62
63
|
if (!account) {
|
|
63
64
|
throw new AccountNotFoundError();
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const { sessionId, signatureRequest } = await client.request({
|
|
67
|
+
method: "wallet_createSession",
|
|
68
|
+
params: [
|
|
69
|
+
{
|
|
70
|
+
...params,
|
|
71
|
+
account,
|
|
72
|
+
chainId: toHex(client.chain.id),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
69
75
|
});
|
|
76
|
+
const signature = await signSignatureRequest(signer, signatureRequest);
|
|
77
|
+
return {
|
|
78
|
+
context: encodePermissionsContext({
|
|
79
|
+
contextVersion: "REMOTE_MODE_DEFERRED_ACTION",
|
|
80
|
+
sessionId,
|
|
81
|
+
signature: signature.data,
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
70
84
|
}
|
|
71
85
|
//# sourceMappingURL=grantPermissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantPermissions.js","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,cAAc,CAAC;AAC7E,OAAO,
|
|
1
|
+
{"version":3,"file":"grantPermissions.js","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,KAAK,GAKN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAoBjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAGpC,MAA4B,EAC5B,MAA0B,EAC1B,MAAwC;IAExC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAC3D,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE;YACN;gBACE,GAAG,MAAM;gBACT,OAAO;gBACP,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;aAChC;SACF;KACF,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAEvE,OAAO;QACL,OAAO,EAAE,wBAAwB,CAAC;YAChC,cAAc,EAAE,6BAA6B;YAC7C,SAAS;YACT,SAAS,EAAE,SAAS,CAAC,IAAI;SAC1B,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import { AccountNotFoundError, type SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n toHex,\n type Address,\n type Hex,\n type IsUndefined,\n type Prettify,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_createSession } from \"@alchemy/wallet-api-types/rpc\";\nimport { encodePermissionsContext } from \"@alchemy/wallet-api-types/capabilities\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\n\nexport type GrantPermissionsParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Prettify<\n Omit<\n Static<\n (typeof wallet_createSession)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"account\" | \"chainId\"\n > &\n (IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: never })\n>;\n\nexport type GrantPermissionsResult = {\n context: Hex;\n};\n\n/**\n * Grants permissions to a smart account by creating a session.\n * This allows another key to perform operations on behalf of the account.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {GrantPermissionsParams} params - The parameters for granting permissions\n * @param {Address} [params.account] - The account address (required if client was not initialized with an account)\n * @param {number} params.expirySec - Unix timestamp when the permissions expire\n * @param {sessionKeyData} params.key - The session key information\n * @param {string} params.key.publicKey - The public key of the session key\n * @param {string} params.key.type - The type of the key (e.g., \"secp256k1\")\n * @param {Array} params.permissions - Array of permission objects defining what the session key can do\n * @returns {Promise<GrantPermissionsResult>} A Promise that resolves to the result containing a context identifier\n *\n * @example\n * ```ts\n * // Create a session key and grant root permissions\n * const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n * const account = await client.requestAccount();\n *\n * const permissions = await client.grantPermissions({\n * account: account.address,\n * expirySec: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now\n * key: {\n * publicKey: await sessionKey.getAddress(),\n * type: \"secp256k1\",\n * },\n * permissions: [{ type: \"root\" }],\n * });\n *\n * // Use the permissions to prepare a call\n * const preparedCalls = await client.prepareCalls({\n * calls: [{ to: zeroAddress, value: \"0x0\" }],\n * from: account.address,\n * capabilities: {\n * paymasterService: {\n * policyId: \"your-paymaster-policy-id\",\n * },\n * permissions,\n * },\n * });\n *\n * // Sign with the session key\n * const signedCalls = await signPreparedCalls(sessionKey, preparedCalls);\n *\n * // Send the prepared call using the session key\n * const result = await client.sendPreparedCalls({\n * ...signedCalls,\n * capabilities: {\n * permissions,\n * },\n * });\n * ```\n */\nexport async function grantPermissions<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: GrantPermissionsParams<TAccount>,\n): Promise<GrantPermissionsResult> {\n const account = params.account ?? client.account?.address;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const { sessionId, signatureRequest } = await client.request({\n method: \"wallet_createSession\",\n params: [\n {\n ...params,\n account,\n chainId: toHex(client.chain.id),\n },\n ],\n });\n\n const signature = await signSignatureRequest(signer, signatureRequest);\n\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature: signature.data,\n }),\n };\n}\n"]}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_listAccounts } from "
|
|
2
|
+
import type { wallet_listAccounts } from "@alchemy/wallet-api-types/rpc";
|
|
3
3
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
|
-
|
|
4
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
5
|
+
import type { Address } from "viem";
|
|
6
|
+
export type ListAccountsParams = Omit<Static<typeof wallet_listAccounts>["Request"]["params"][0], "signerAddress"> & {
|
|
7
|
+
signerAddress?: Address;
|
|
8
|
+
};
|
|
5
9
|
export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"];
|
|
6
10
|
/**
|
|
7
11
|
* Lists all smart accounts for a given signer using the wallet API client.
|
|
8
12
|
*
|
|
9
13
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
14
|
+
* @param {SmartAccountSigner} signer - The signer for which to list accounts
|
|
10
15
|
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
11
16
|
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
12
17
|
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
@@ -14,6 +19,7 @@ export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"
|
|
|
14
19
|
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
15
20
|
*
|
|
16
21
|
* @example
|
|
22
|
+
* ```ts
|
|
17
23
|
* // Fetch the first page of accounts
|
|
18
24
|
* const firstPage = await client.listAccounts({
|
|
19
25
|
* signerAddress: "0x123...",
|
|
@@ -26,5 +32,6 @@ export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"
|
|
|
26
32
|
* limit: 10,
|
|
27
33
|
* after: firstPage.meta.after
|
|
28
34
|
* });
|
|
35
|
+
* ```
|
|
29
36
|
*/
|
|
30
|
-
export declare function listAccounts(client: InnerWalletApiClient, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
37
|
+
export declare function listAccounts(client: InnerWalletApiClient, signer: SmartAccountSigner, params: ListAccountsParams): Promise<ListAccountsResult>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Lists all smart accounts for a given signer using the wallet API client.
|
|
3
3
|
*
|
|
4
4
|
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
5
|
+
* @param {SmartAccountSigner} signer - The signer for which to list accounts
|
|
5
6
|
* @param {ListAccountsParams} params - Parameters for listing accounts
|
|
6
7
|
* @param {string} params.signerAddress - The address of the signer to list accounts for
|
|
7
8
|
* @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
* @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
13
|
+
* ```ts
|
|
12
14
|
* // Fetch the first page of accounts
|
|
13
15
|
* const firstPage = await client.listAccounts({
|
|
14
16
|
* signerAddress: "0x123...",
|
|
@@ -21,8 +23,18 @@
|
|
|
21
23
|
* limit: 10,
|
|
22
24
|
* after: firstPage.meta.after
|
|
23
25
|
* });
|
|
26
|
+
* ```
|
|
24
27
|
*/
|
|
25
|
-
export async function listAccounts(client, params) {
|
|
26
|
-
|
|
28
|
+
export async function listAccounts(client, signer, params) {
|
|
29
|
+
const signerAddress = params.signerAddress ?? (await signer.getAddress());
|
|
30
|
+
return client.request({
|
|
31
|
+
method: "wallet_listAccounts",
|
|
32
|
+
params: [
|
|
33
|
+
{
|
|
34
|
+
...params,
|
|
35
|
+
signerAddress,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
});
|
|
27
39
|
}
|
|
28
40
|
//# sourceMappingURL=listAccounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listAccounts.js","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listAccounts.js","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B,EAC1B,MAA0B;IAE1B,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAE1E,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE;YACN;gBACE,GAAG,MAAM;gBACT,aAAa;aACd;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_listAccounts } from \"@alchemy/wallet-api-types/rpc\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Address } from \"viem\";\n\nexport type ListAccountsParams = Omit<\n Static<typeof wallet_listAccounts>[\"Request\"][\"params\"][0],\n \"signerAddress\"\n> & { signerAddress?: Address };\n\nexport type ListAccountsResult = Static<\n typeof wallet_listAccounts\n>[\"ReturnType\"];\n\n/**\n * Lists all smart accounts for a given signer using the wallet API client.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer for which to list accounts\n * @param {ListAccountsParams} params - Parameters for listing accounts\n * @param {string} params.signerAddress - The address of the signer to list accounts for\n * @param {number} [params.limit] - Optional maximum number of accounts to return (default: 100, max: 100)\n * @param {string} [params.after] - Optional pagination cursor for fetching subsequent pages\n * @returns {Promise<ListAccountsResult>} A Promise that resolves to the list of accounts and pagination metadata\n *\n * @example\n * ```ts\n * // Fetch the first page of accounts\n * const firstPage = await client.listAccounts({\n * signerAddress: \"0x123...\",\n * limit: 10\n * });\n *\n * // If an 'after' cursor exists, use it to fetch the next page\n * const nextPage = await client.listAccounts({\n * signerAddress: \"0x123...\",\n * limit: 10,\n * after: firstPage.meta.after\n * });\n * ```\n */\nexport async function listAccounts(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: ListAccountsParams,\n): Promise<ListAccountsResult> {\n const signerAddress = params.signerAddress ?? (await signer.getAddress());\n\n return client.request({\n method: \"wallet_listAccounts\",\n params: [\n {\n ...params,\n signerAddress,\n },\n ],\n });\n}\n"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { type Address, type IsUndefined } from "viem";
|
|
2
|
-
import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls.ts";
|
|
3
2
|
import type { InnerWalletApiClient } from "../../types.ts";
|
|
3
|
+
import type { Static } from "@sinclair/typebox";
|
|
4
|
+
import { wallet_prepareCalls } from "@alchemy/wallet-api-types/rpc";
|
|
4
5
|
export type GetAccountParam<TAccount> = IsUndefined<TAccount> extends true ? {
|
|
5
6
|
account: Address;
|
|
6
7
|
} : {
|
|
7
8
|
account?: Address;
|
|
8
9
|
};
|
|
9
|
-
export type PrepareCallsParams<TAccount extends Address | undefined = Address | undefined> = Omit<
|
|
10
|
+
export type PrepareCallsParams<TAccount extends Address | undefined = Address | undefined> = Omit<Static<(typeof wallet_prepareCalls)["properties"]["Request"]["properties"]["params"]>[0], "from" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
10
11
|
from: Address;
|
|
11
12
|
} : {
|
|
12
13
|
from?: never;
|
|
13
14
|
});
|
|
14
|
-
export type PrepareCallsResult =
|
|
15
|
+
export type PrepareCallsResult = Static<typeof wallet_prepareCalls>["ReturnType"];
|
|
15
16
|
/**
|
|
16
17
|
* Prepares a set of contract calls for execution by building a user operation.
|
|
17
18
|
* Returns the built user operation and a signature request that needs to be signed
|
|
@@ -26,6 +27,7 @@ export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
|
26
27
|
* the user operation data and signature request
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
30
|
+
* ```ts
|
|
29
31
|
* // Prepare a sponsored user operation call
|
|
30
32
|
* const result = await client.prepareCalls({
|
|
31
33
|
* calls: [{
|
|
@@ -37,5 +39,6 @@ export type PrepareCallsResult = IsomorphicPrepareCallsResult;
|
|
|
37
39
|
* paymasterService: { policyId: "your-policy-id" }
|
|
38
40
|
* }
|
|
39
41
|
* });
|
|
42
|
+
* ```
|
|
40
43
|
*/
|
|
41
44
|
export declare function prepareCalls<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: PrepareCallsParams<TAccount>): Promise<PrepareCallsResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
2
2
|
import { toHex } from "viem";
|
|
3
|
+
import { wallet_prepareCalls } from "@alchemy/wallet-api-types/rpc";
|
|
3
4
|
/**
|
|
4
5
|
* Prepares a set of contract calls for execution by building a user operation.
|
|
5
6
|
* Returns the built user operation and a signature request that needs to be signed
|
|
@@ -14,6 +15,7 @@ import { toHex } from "viem";
|
|
|
14
15
|
* the user operation data and signature request
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
18
|
+
* ```ts
|
|
17
19
|
* // Prepare a sponsored user operation call
|
|
18
20
|
* const result = await client.prepareCalls({
|
|
19
21
|
* calls: [{
|
|
@@ -25,26 +27,28 @@ import { toHex } from "viem";
|
|
|
25
27
|
* paymasterService: { policyId: "your-policy-id" }
|
|
26
28
|
* }
|
|
27
29
|
* });
|
|
30
|
+
* ```
|
|
28
31
|
*/
|
|
29
32
|
export async function prepareCalls(client, params) {
|
|
30
33
|
const from = params.from ?? client.account?.address;
|
|
31
34
|
if (!from) {
|
|
32
35
|
throw new AccountNotFoundError();
|
|
33
36
|
}
|
|
34
|
-
if (client.
|
|
37
|
+
if (client.policyIds && !params.capabilities?.paymasterService) {
|
|
35
38
|
params.capabilities = {
|
|
36
39
|
...params.capabilities,
|
|
37
|
-
paymasterService: {
|
|
40
|
+
paymasterService: { policyIds: client.policyIds },
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
|
-
const params_ = {
|
|
41
|
-
...params,
|
|
42
|
-
chainId: toHex(client.chain.id),
|
|
43
|
-
from,
|
|
44
|
-
};
|
|
45
43
|
return await client.request({
|
|
46
44
|
method: "wallet_prepareCalls",
|
|
47
|
-
params: [
|
|
45
|
+
params: [
|
|
46
|
+
{
|
|
47
|
+
...params,
|
|
48
|
+
chainId: toHex(client.chain.id),
|
|
49
|
+
from,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
//# sourceMappingURL=prepareCalls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAqBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAGhC,MAA4B,EAC5B,MAAoC;IAEpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,EAAE,CAAC;QAC/D,MAAM,CAAC,YAAY,GAAG;YACpB,GAAG,MAAM,CAAC,YAAY;YACtB,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;SAClD,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE;YACN;gBACE,GAAG,MAAM;gBACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI;aACL;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { AccountNotFoundError } from \"@aa-sdk/core\";\nimport { toHex, type Address, type IsUndefined } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_prepareCalls } from \"@alchemy/wallet-api-types/rpc\";\n\nexport type GetAccountParam<TAccount> =\n IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: Address };\n\nexport type PrepareCallsParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Omit<\n Static<\n (typeof wallet_prepareCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"from\" | \"chainId\"\n> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type PrepareCallsResult = Static<\n typeof wallet_prepareCalls\n>[\"ReturnType\"];\n\n/**\n * Prepares a set of contract calls for execution by building a user operation.\n * Returns the built user operation and a signature request that needs to be signed\n * before submitting to sendPreparedCalls.\n *\n * @param {InnerWalletApiClient<TAccount>} client - The wallet API client to use for the request\n * @param {PrepareCallsParams<TAccount>} params - Parameters for preparing calls\n * @param {Array<{to: Address, data?: Hex, value?: Hex}>} params.calls - Array of contract calls to execute\n * @param {Address} [params.from] - The address to execute the calls from (required if the client wasn't initialized with an account)\n * @param {object} [params.capabilities] - Optional capabilities to include with the request\n * @returns {Promise<PrepareCallsResult>} A Promise that resolves to the prepared calls result containing\n * the user operation data and signature request\n *\n * @example\n * ```ts\n * // Prepare a sponsored user operation call\n * const result = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n * ```\n */\nexport async function prepareCalls<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n params: PrepareCallsParams<TAccount>,\n): Promise<PrepareCallsResult> {\n const from = params.from ?? client.account?.address;\n if (!from) {\n throw new AccountNotFoundError();\n }\n\n if (client.policyIds && !params.capabilities?.paymasterService) {\n params.capabilities = {\n ...params.capabilities,\n paymasterService: { policyIds: client.policyIds },\n };\n }\n\n return await client.request({\n method: \"wallet_prepareCalls\",\n params: [\n {\n ...params,\n chainId: toHex(client.chain.id),\n from,\n },\n ],\n });\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
2
|
+
import { type Address, type IsUndefined } from "viem";
|
|
3
|
+
import type { Static } from "@sinclair/typebox";
|
|
4
|
+
import { wallet_prepareSign } from "@alchemy/wallet-api-types/rpc";
|
|
5
|
+
export type PrepareSignParams<TAccount extends Address | undefined = Address | undefined> = Omit<Static<(typeof wallet_prepareSign)["properties"]["Request"]["properties"]["params"]>[0], "from" | "chainId"> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type PrepareSignResult = Static<typeof wallet_prepareSign>["ReturnType"];
|
|
11
|
+
/**
|
|
12
|
+
* Prepares a signature request for signing messages or transactions.
|
|
13
|
+
*
|
|
14
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
15
|
+
* @param {PrepareSignParams} params - Parameters for preparing the signature request
|
|
16
|
+
* @returns {Promise<PrepareSignResult>} A Promise that resolves to the prepare sign result containing a signature request
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Prepare a message to be signed
|
|
21
|
+
* const result = await client.prepareSign({
|
|
22
|
+
* from: "0x1234...",
|
|
23
|
+
* type: "personal_sign",
|
|
24
|
+
* data: "Hello, world!",
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function prepareSign<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: PrepareSignParams<TAccount>): Promise<PrepareSignResult>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { toHex } from "viem";
|
|
2
|
+
import { AccountNotFoundError } from "@aa-sdk/core";
|
|
3
|
+
import { wallet_prepareSign } from "@alchemy/wallet-api-types/rpc";
|
|
4
|
+
/**
|
|
5
|
+
* Prepares a signature request for signing messages or transactions.
|
|
6
|
+
*
|
|
7
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
8
|
+
* @param {PrepareSignParams} params - Parameters for preparing the signature request
|
|
9
|
+
* @returns {Promise<PrepareSignResult>} A Promise that resolves to the prepare sign result containing a signature request
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Prepare a message to be signed
|
|
14
|
+
* const result = await client.prepareSign({
|
|
15
|
+
* from: "0x1234...",
|
|
16
|
+
* type: "personal_sign",
|
|
17
|
+
* data: "Hello, world!",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export async function prepareSign(client, params) {
|
|
22
|
+
const from = params.from ?? client.account?.address;
|
|
23
|
+
if (!from) {
|
|
24
|
+
throw new AccountNotFoundError();
|
|
25
|
+
}
|
|
26
|
+
return client.request({
|
|
27
|
+
method: "wallet_prepareSign",
|
|
28
|
+
params: [{ ...params, from, chainId: toHex(client.chain.id) }],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=prepareSign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareSign.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareSign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAkC,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAcnE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAG/B,MAA4B,EAC5B,MAAmC;IAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,oBAAoB;QAC5B,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { InnerWalletApiClient } from \"../../types.ts\";\nimport { toHex, type Address, type IsUndefined } from \"viem\";\nimport { AccountNotFoundError } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_prepareSign } from \"@alchemy/wallet-api-types/rpc\";\n\nexport type PrepareSignParams<\n TAccount extends Address | undefined = Address | undefined,\n> = Omit<\n Static<\n (typeof wallet_prepareSign)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0],\n \"from\" | \"chainId\"\n> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type PrepareSignResult = Static<typeof wallet_prepareSign>[\"ReturnType\"];\n\n/**\n * Prepares a signature request for signing messages or transactions.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {PrepareSignParams} params - Parameters for preparing the signature request\n * @returns {Promise<PrepareSignResult>} A Promise that resolves to the prepare sign result containing a signature request\n *\n * @example\n * ```ts\n * // Prepare a message to be signed\n * const result = await client.prepareSign({\n * from: \"0x1234...\",\n * type: \"personal_sign\",\n * data: \"Hello, world!\",\n * });\n * ```\n */\nexport async function prepareSign<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n params: PrepareSignParams<TAccount>,\n): Promise<PrepareSignResult> {\n const from = params.from ?? client.account?.address;\n if (!from) {\n throw new AccountNotFoundError();\n }\n\n return client.request({\n method: \"wallet_prepareSign\",\n params: [{ ...params, from, chainId: toHex(client.chain.id) }],\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_requestAccount } from "
|
|
4
|
+
import type { wallet_requestAccount } from "@alchemy/wallet-api-types/rpc";
|
|
5
5
|
import type { InnerWalletApiClient } from "../../types.js";
|
|
6
6
|
export type RequestAccountParams = Omit<Extract<Static<typeof wallet_requestAccount>["Request"]["params"][0], {
|
|
7
7
|
signerAddress: Address;
|
|
@@ -22,8 +22,10 @@ export type RequestAccountResult = SmartContractAccount;
|
|
|
22
22
|
* @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
|
+
* ```ts
|
|
25
26
|
* // Request an account with default parameters using a local signer
|
|
26
27
|
* const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
|
|
27
28
|
* const account = await client.requestAccount(signer);
|
|
29
|
+
* ```
|
|
28
30
|
*/
|
|
29
31
|
export declare function requestAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params?: RequestAccountParams): Promise<RequestAccountResult>;
|