@metamask/keyring-api 10.1.0 → 11.0.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/CHANGELOG.md +9 -1
- package/dist/{JsonRpcRequest.js → JsonRpcRequest.cjs} +2 -2
- package/dist/JsonRpcRequest.cjs.map +1 -0
- package/dist/{JsonRpcRequest.d.ts → JsonRpcRequest.d.cts} +3 -2
- package/dist/JsonRpcRequest.d.cts.map +1 -0
- package/dist/JsonRpcRequest.d.mts +17 -0
- package/dist/JsonRpcRequest.d.mts.map +1 -0
- package/dist/JsonRpcRequest.mjs +10 -0
- package/dist/JsonRpcRequest.mjs.map +1 -0
- package/dist/{KeyringClient.js → KeyringClient.cjs} +4 -4
- package/dist/KeyringClient.cjs.map +1 -0
- package/dist/{KeyringClient.d.ts → KeyringClient.d.cts} +4 -3
- package/dist/KeyringClient.d.cts.map +1 -0
- package/dist/KeyringClient.d.mts +29 -0
- package/dist/KeyringClient.d.mts.map +1 -0
- package/dist/KeyringClient.mjs +120 -0
- package/dist/KeyringClient.mjs.map +1 -0
- package/dist/{KeyringSnapRpcClient.js → KeyringSnapRpcClient.cjs} +2 -2
- package/dist/KeyringSnapRpcClient.cjs.map +1 -0
- package/dist/{KeyringSnapRpcClient.d.ts → KeyringSnapRpcClient.d.cts} +6 -5
- package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
- package/dist/KeyringSnapRpcClient.d.mts +40 -0
- package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
- package/dist/KeyringSnapRpcClient.mjs +63 -0
- package/dist/KeyringSnapRpcClient.mjs.map +1 -0
- package/dist/api/{account.js → account.cjs} +3 -3
- package/dist/api/account.cjs.map +1 -0
- package/dist/api/{account.d.ts → account.d.cts} +2 -1
- package/dist/api/account.d.cts.map +1 -0
- package/dist/api/account.d.mts +70 -0
- package/dist/api/account.d.mts.map +1 -0
- package/dist/api/account.mjs +61 -0
- package/dist/api/account.mjs.map +1 -0
- package/dist/api/{balance.js → balance.cjs} +3 -3
- package/dist/api/balance.cjs.map +1 -0
- package/dist/api/{balance.d.ts → balance.d.cts} +2 -1
- package/dist/api/balance.d.cts.map +1 -0
- package/dist/api/balance.d.mts +10 -0
- package/dist/api/balance.d.mts.map +1 -0
- package/dist/api/balance.mjs +8 -0
- package/dist/api/balance.mjs.map +1 -0
- package/dist/api/{caip.js → caip.cjs} +5 -5
- package/dist/api/caip.cjs.map +1 -0
- package/dist/api/{caip.d.ts → caip.d.cts} +2 -1
- package/dist/api/caip.d.cts.map +1 -0
- package/dist/api/caip.d.mts +38 -0
- package/dist/api/caip.d.mts.map +1 -0
- package/dist/api/caip.mjs +43 -0
- package/dist/api/caip.mjs.map +1 -0
- package/dist/api/{export.js → export.cjs} +1 -1
- package/dist/api/export.cjs.map +1 -0
- package/dist/api/{export.d.ts → export.d.cts} +2 -1
- package/dist/api/export.d.cts.map +1 -0
- package/dist/api/export.d.mts +9 -0
- package/dist/api/export.d.mts.map +1 -0
- package/dist/api/export.mjs +4 -0
- package/dist/api/export.mjs.map +1 -0
- package/dist/api/{index.js → index.cjs} +7 -7
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +8 -0
- package/dist/api/index.d.cts.map +1 -0
- package/dist/api/index.d.mts +8 -0
- package/dist/api/index.d.mts.map +1 -0
- package/dist/api/index.mjs +7 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/{keyring.js → keyring.cjs} +1 -1
- package/dist/api/keyring.cjs.map +1 -0
- package/dist/api/{keyring.d.ts → keyring.d.cts} +8 -7
- package/dist/api/keyring.d.cts.map +1 -0
- package/dist/api/keyring.d.mts +160 -0
- package/dist/api/keyring.d.mts.map +1 -0
- package/dist/api/keyring.mjs +2 -0
- package/dist/api/keyring.mjs.map +1 -0
- package/dist/api/{request.js → request.cjs} +3 -3
- package/dist/api/request.cjs.map +1 -0
- package/dist/api/{request.d.ts → request.d.cts} +3 -2
- package/dist/api/request.d.cts.map +1 -0
- package/dist/api/request.d.mts +40 -0
- package/dist/api/request.d.mts.map +1 -0
- package/dist/api/request.mjs +26 -0
- package/dist/api/request.mjs.map +1 -0
- package/dist/api/{response.js → response.cjs} +2 -2
- package/dist/api/response.cjs.map +1 -0
- package/dist/api/{response.d.ts → response.d.cts} +2 -1
- package/dist/api/response.d.cts.map +1 -0
- package/dist/api/response.d.mts +25 -0
- package/dist/api/response.d.mts.map +1 -0
- package/dist/api/response.mjs +41 -0
- package/dist/api/response.mjs.map +1 -0
- package/dist/{eth/erc4337/index.js → btc/index.cjs} +2 -2
- package/dist/btc/index.cjs.map +1 -0
- package/dist/btc/index.d.cts +2 -0
- package/dist/btc/index.d.cts.map +1 -0
- package/dist/btc/index.d.mts +2 -0
- package/dist/btc/index.d.mts.map +1 -0
- package/dist/btc/index.mjs +2 -0
- package/dist/btc/index.mjs.map +1 -0
- package/dist/btc/{types.js → types.cjs} +3 -3
- package/dist/btc/types.cjs.map +1 -0
- package/dist/btc/{types.d.ts → types.d.cts} +2 -1
- package/dist/btc/types.d.cts.map +1 -0
- package/dist/btc/types.d.mts +34 -0
- package/dist/btc/types.d.mts.map +1 -0
- package/dist/btc/types.mjs +37 -0
- package/dist/btc/types.mjs.map +1 -0
- package/dist/{contexts.js → contexts.cjs} +1 -1
- package/dist/contexts.cjs.map +1 -0
- package/dist/{contexts.d.ts → contexts.d.cts} +1 -0
- package/dist/contexts.d.cts.map +1 -0
- package/dist/contexts.d.mts +8 -0
- package/dist/contexts.d.mts.map +1 -0
- package/dist/contexts.mjs +2 -0
- package/dist/contexts.mjs.map +1 -0
- package/dist/{sol/index.js → eth/erc4337/index.cjs} +2 -2
- package/dist/eth/erc4337/index.cjs.map +1 -0
- package/dist/eth/erc4337/index.d.cts +2 -0
- package/dist/eth/erc4337/index.d.cts.map +1 -0
- package/dist/eth/erc4337/index.d.mts +2 -0
- package/dist/eth/erc4337/index.d.mts.map +1 -0
- package/dist/eth/erc4337/index.mjs +2 -0
- package/dist/eth/erc4337/index.mjs.map +1 -0
- package/dist/eth/erc4337/{types.js → types.cjs} +4 -4
- package/dist/eth/erc4337/types.cjs.map +1 -0
- package/dist/eth/erc4337/{types.d.ts → types.d.cts} +6 -5
- package/dist/eth/erc4337/types.d.cts.map +1 -0
- package/dist/eth/erc4337/types.d.mts +98 -0
- package/dist/eth/erc4337/types.d.mts.map +1 -0
- package/dist/eth/erc4337/types.mjs +59 -0
- package/dist/eth/erc4337/types.mjs.map +1 -0
- package/dist/eth/{index.js → index.cjs} +4 -4
- package/dist/eth/index.cjs.map +1 -0
- package/dist/eth/index.d.cts +4 -0
- package/dist/eth/index.d.cts.map +1 -0
- package/dist/eth/index.d.mts +4 -0
- package/dist/eth/index.d.mts.map +1 -0
- package/dist/eth/index.mjs +4 -0
- package/dist/eth/index.mjs.map +1 -0
- package/dist/eth/{types.js → types.cjs} +3 -3
- package/dist/eth/types.cjs.map +1 -0
- package/dist/eth/{types.d.ts → types.d.cts} +2 -1
- package/dist/eth/types.d.cts.map +1 -0
- package/dist/eth/types.d.mts +81 -0
- package/dist/eth/types.d.mts.map +1 -0
- package/dist/eth/types.mjs +70 -0
- package/dist/eth/types.mjs.map +1 -0
- package/dist/eth/{utils.js → utils.cjs} +3 -4
- package/dist/eth/{utils.js.map → utils.cjs.map} +1 -1
- package/dist/eth/{utils.d.ts → utils.d.cts} +2 -1
- package/dist/eth/utils.d.cts.map +1 -0
- package/dist/eth/utils.d.mts +9 -0
- package/dist/eth/utils.d.mts.map +1 -0
- package/dist/eth/utils.mjs +11 -0
- package/dist/eth/utils.mjs.map +1 -0
- package/dist/{events.js → events.cjs} +1 -1
- package/dist/events.cjs.map +1 -0
- package/dist/{events.d.ts → events.d.cts} +1 -0
- package/dist/events.d.cts.map +1 -0
- package/dist/events.d.mts +11 -0
- package/dist/events.d.mts.map +1 -0
- package/dist/events.mjs +14 -0
- package/dist/events.mjs.map +1 -0
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +14 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/{api.js → api.cjs} +5 -5
- package/dist/internal/api.cjs.map +1 -0
- package/dist/internal/{api.d.ts → api.d.cts} +5 -4
- package/dist/internal/api.d.cts.map +1 -0
- package/dist/internal/api.d.mts +420 -0
- package/dist/internal/api.d.mts.map +1 -0
- package/dist/internal/api.mjs +136 -0
- package/dist/internal/api.mjs.map +1 -0
- package/dist/internal/eth/{EthKeyring.js → EthKeyring.cjs} +1 -1
- package/dist/internal/eth/EthKeyring.cjs.map +1 -0
- package/dist/internal/eth/{EthKeyring.d.ts → EthKeyring.d.cts} +4 -3
- package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
- package/dist/internal/eth/EthKeyring.d.mts +34 -0
- package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
- package/dist/internal/eth/EthKeyring.mjs +2 -0
- package/dist/internal/eth/EthKeyring.mjs.map +1 -0
- package/dist/internal/eth/{index.js → index.cjs} +1 -1
- package/dist/internal/eth/index.cjs.map +1 -0
- package/dist/internal/eth/index.d.cts +2 -0
- package/dist/internal/eth/index.d.cts.map +1 -0
- package/dist/internal/eth/index.d.mts +2 -0
- package/dist/internal/eth/index.d.mts.map +1 -0
- package/dist/internal/eth/index.mjs +2 -0
- package/dist/internal/eth/index.mjs.map +1 -0
- package/dist/internal/{events.js → events.cjs} +5 -5
- package/dist/internal/events.cjs.map +1 -0
- package/dist/internal/{events.d.ts → events.d.cts} +3 -2
- package/dist/internal/events.d.cts.map +1 -0
- package/dist/internal/events.d.mts +162 -0
- package/dist/internal/events.d.mts.map +1 -0
- package/dist/internal/events.mjs +69 -0
- package/dist/internal/events.mjs.map +1 -0
- package/dist/internal/{index.js → index.cjs} +5 -5
- package/dist/internal/index.cjs.map +1 -0
- package/dist/internal/index.d.cts +6 -0
- package/dist/internal/index.d.cts.map +1 -0
- package/dist/internal/index.d.mts +6 -0
- package/dist/internal/index.d.mts.map +1 -0
- package/dist/internal/index.mjs +5 -0
- package/dist/internal/index.mjs.map +1 -0
- package/dist/internal/{rpc.js → rpc.cjs} +3 -3
- package/dist/internal/rpc.cjs.map +1 -0
- package/dist/internal/{rpc.d.ts → rpc.d.cts} +1 -0
- package/dist/internal/rpc.d.cts.map +1 -0
- package/dist/internal/rpc.d.mts +26 -0
- package/dist/internal/rpc.d.mts.map +1 -0
- package/dist/internal/rpc.mjs +29 -0
- package/dist/internal/{rpc.js.map → rpc.mjs.map} +1 -1
- package/dist/internal/{types.js → types.cjs} +6 -6
- package/dist/internal/types.cjs.map +1 -0
- package/dist/internal/{types.d.ts → types.d.cts} +21 -20
- package/dist/internal/types.d.cts.map +1 -0
- package/dist/internal/types.d.mts +392 -0
- package/dist/internal/types.d.mts.map +1 -0
- package/dist/internal/types.mjs +49 -0
- package/dist/internal/types.mjs.map +1 -0
- package/dist/{rpc-handler.js → rpc-handler.cjs} +6 -6
- package/dist/rpc-handler.cjs.map +1 -0
- package/dist/{rpc-handler.d.ts → rpc-handler.d.cts} +4 -3
- package/dist/rpc-handler.d.cts.map +1 -0
- package/dist/rpc-handler.d.mts +30 -0
- package/dist/rpc-handler.d.mts.map +1 -0
- package/dist/rpc-handler.mjs +131 -0
- package/dist/rpc-handler.mjs.map +1 -0
- package/dist/{snap-utils.js → snap-utils.cjs} +2 -3
- package/dist/snap-utils.cjs.map +1 -0
- package/dist/{snap-utils.d.ts → snap-utils.d.cts} +4 -3
- package/dist/snap-utils.d.cts.map +1 -0
- package/dist/snap-utils.d.mts +12 -0
- package/dist/snap-utils.d.mts.map +1 -0
- package/dist/snap-utils.mjs +17 -0
- package/dist/snap-utils.mjs.map +1 -0
- package/dist/{btc/index.js → sol/index.cjs} +2 -2
- package/dist/sol/index.cjs.map +1 -0
- package/dist/sol/index.d.cts +2 -0
- package/dist/sol/index.d.cts.map +1 -0
- package/dist/sol/index.d.mts +2 -0
- package/dist/sol/index.d.mts.map +1 -0
- package/dist/sol/index.mjs +2 -0
- package/dist/sol/index.mjs.map +1 -0
- package/dist/sol/{types.js → types.cjs} +3 -3
- package/dist/sol/types.cjs.map +1 -0
- package/dist/sol/{types.d.ts → types.d.cts} +2 -1
- package/dist/sol/types.d.cts.map +1 -0
- package/dist/sol/types.d.mts +39 -0
- package/dist/sol/types.d.mts.map +1 -0
- package/dist/sol/types.mjs +33 -0
- package/dist/sol/types.mjs.map +1 -0
- package/dist/{superstruct.js → superstruct.cjs} +5 -6
- package/dist/superstruct.cjs.map +1 -0
- package/dist/{superstruct.d.ts → superstruct.d.cts} +3 -2
- package/dist/superstruct.d.cts.map +1 -0
- package/dist/superstruct.d.mts +84 -0
- package/dist/superstruct.d.mts.map +1 -0
- package/dist/superstruct.mjs +74 -0
- package/dist/superstruct.mjs.map +1 -0
- package/dist/utils/{index.js → index.cjs} +3 -3
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +3 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +3 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/{types.js → types.cjs} +2 -2
- package/dist/utils/types.cjs.map +1 -0
- package/dist/utils/{types.d.ts → types.d.cts} +2 -1
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +18 -0
- package/dist/utils/types.d.mts.map +1 -0
- package/dist/utils/types.mjs +26 -0
- package/dist/utils/types.mjs.map +1 -0
- package/dist/utils/{typing.js → typing.cjs} +2 -3
- package/dist/utils/{typing.js.map → typing.cjs.map} +1 -1
- package/dist/utils/{typing.d.ts → typing.d.cts} +1 -0
- package/dist/utils/typing.d.cts.map +1 -0
- package/dist/utils/typing.d.mts +33 -0
- package/dist/utils/typing.d.mts.map +1 -0
- package/dist/utils/typing.mjs +17 -0
- package/dist/utils/typing.mjs.map +1 -0
- package/package.json +19 -8
- package/dist/JsonRpcRequest.js.map +0 -1
- package/dist/KeyringClient.js.map +0 -1
- package/dist/KeyringSnapRpcClient.js.map +0 -1
- package/dist/api/account.js.map +0 -1
- package/dist/api/balance.js.map +0 -1
- package/dist/api/caip.js.map +0 -1
- package/dist/api/export.js.map +0 -1
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js.map +0 -1
- package/dist/api/keyring.js.map +0 -1
- package/dist/api/request.js.map +0 -1
- package/dist/api/response.js.map +0 -1
- package/dist/btc/index.d.ts +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/btc/types.js.map +0 -1
- package/dist/contexts.js.map +0 -1
- package/dist/eth/erc4337/index.d.ts +0 -1
- package/dist/eth/erc4337/index.js.map +0 -1
- package/dist/eth/erc4337/types.js.map +0 -1
- package/dist/eth/index.d.ts +0 -3
- package/dist/eth/index.js.map +0 -1
- package/dist/eth/types.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/internal/api.js.map +0 -1
- package/dist/internal/eth/EthKeyring.js.map +0 -1
- package/dist/internal/eth/index.d.ts +0 -1
- package/dist/internal/eth/index.js.map +0 -1
- package/dist/internal/events.js.map +0 -1
- package/dist/internal/index.d.ts +0 -5
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/types.js.map +0 -1
- package/dist/rpc-handler.js.map +0 -1
- package/dist/snap-utils.js.map +0 -1
- package/dist/sol/index.d.ts +0 -1
- package/dist/sol/index.js.map +0 -1
- package/dist/sol/types.js.map +0 -1
- package/dist/superstruct.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/types.js.map +0 -1
@@ -0,0 +1,136 @@
|
|
1
|
+
import { array, literal, number, record, string, union } from "@metamask/superstruct";
|
2
|
+
import { JsonStruct } from "@metamask/utils";
|
3
|
+
import { KeyringRpcMethod } from "./rpc.mjs";
|
4
|
+
import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct } from "../api/index.mjs";
|
5
|
+
import { object } from "../superstruct.mjs";
|
6
|
+
import { UuidStruct } from "../utils/index.mjs";
|
7
|
+
const CommonHeader = {
|
8
|
+
jsonrpc: literal('2.0'),
|
9
|
+
id: union([string(), number(), literal(null)]),
|
10
|
+
};
|
11
|
+
// ----------------------------------------------------------------------------
|
12
|
+
// List accounts
|
13
|
+
export const ListAccountsRequestStruct = object({
|
14
|
+
...CommonHeader,
|
15
|
+
method: literal('keyring_listAccounts'),
|
16
|
+
});
|
17
|
+
export const ListAccountsResponseStruct = array(KeyringAccountStruct);
|
18
|
+
// ----------------------------------------------------------------------------
|
19
|
+
// Get account
|
20
|
+
export const GetAccountRequestStruct = object({
|
21
|
+
...CommonHeader,
|
22
|
+
method: literal('keyring_getAccount'),
|
23
|
+
params: object({
|
24
|
+
id: UuidStruct,
|
25
|
+
}),
|
26
|
+
});
|
27
|
+
export const GetAccountResponseStruct = KeyringAccountStruct;
|
28
|
+
// ----------------------------------------------------------------------------
|
29
|
+
// Create account
|
30
|
+
export const CreateAccountRequestStruct = object({
|
31
|
+
...CommonHeader,
|
32
|
+
method: literal('keyring_createAccount'),
|
33
|
+
params: object({
|
34
|
+
options: record(string(), JsonStruct),
|
35
|
+
}),
|
36
|
+
});
|
37
|
+
export const CreateAccountResponseStruct = KeyringAccountStruct;
|
38
|
+
// ----------------------------------------------------------------------------
|
39
|
+
// Get account balances
|
40
|
+
export const GetAccountBalancesRequestStruct = object({
|
41
|
+
...CommonHeader,
|
42
|
+
method: literal(`${KeyringRpcMethod.GetAccountBalances}`),
|
43
|
+
params: object({
|
44
|
+
id: UuidStruct,
|
45
|
+
assets: array(CaipAssetTypeStruct),
|
46
|
+
}),
|
47
|
+
});
|
48
|
+
export const GetAccountBalancesResponseStruct = record(CaipAssetTypeStruct, BalanceStruct);
|
49
|
+
// ----------------------------------------------------------------------------
|
50
|
+
// Filter account chains
|
51
|
+
export const FilterAccountChainsStruct = object({
|
52
|
+
...CommonHeader,
|
53
|
+
method: literal('keyring_filterAccountChains'),
|
54
|
+
params: object({
|
55
|
+
id: UuidStruct,
|
56
|
+
chains: array(string()),
|
57
|
+
}),
|
58
|
+
});
|
59
|
+
export const FilterAccountChainsResponseStruct = array(string());
|
60
|
+
// ----------------------------------------------------------------------------
|
61
|
+
// Update account
|
62
|
+
export const UpdateAccountRequestStruct = object({
|
63
|
+
...CommonHeader,
|
64
|
+
method: literal('keyring_updateAccount'),
|
65
|
+
params: object({
|
66
|
+
account: KeyringAccountStruct,
|
67
|
+
}),
|
68
|
+
});
|
69
|
+
export const UpdateAccountResponseStruct = literal(null);
|
70
|
+
// ----------------------------------------------------------------------------
|
71
|
+
// Delete account
|
72
|
+
export const DeleteAccountRequestStruct = object({
|
73
|
+
...CommonHeader,
|
74
|
+
method: literal('keyring_deleteAccount'),
|
75
|
+
params: object({
|
76
|
+
id: UuidStruct,
|
77
|
+
}),
|
78
|
+
});
|
79
|
+
export const DeleteAccountResponseStruct = literal(null);
|
80
|
+
// ----------------------------------------------------------------------------
|
81
|
+
// Export account
|
82
|
+
export const ExportAccountRequestStruct = object({
|
83
|
+
...CommonHeader,
|
84
|
+
method: literal('keyring_exportAccount'),
|
85
|
+
params: object({
|
86
|
+
id: UuidStruct,
|
87
|
+
}),
|
88
|
+
});
|
89
|
+
export const ExportAccountResponseStruct = KeyringAccountDataStruct;
|
90
|
+
// ----------------------------------------------------------------------------
|
91
|
+
// List requests
|
92
|
+
export const ListRequestsRequestStruct = object({
|
93
|
+
...CommonHeader,
|
94
|
+
method: literal('keyring_listRequests'),
|
95
|
+
});
|
96
|
+
export const ListRequestsResponseStruct = array(KeyringRequestStruct);
|
97
|
+
// ----------------------------------------------------------------------------
|
98
|
+
// Get request
|
99
|
+
export const GetRequestRequestStruct = object({
|
100
|
+
...CommonHeader,
|
101
|
+
method: literal('keyring_getRequest'),
|
102
|
+
params: object({
|
103
|
+
id: UuidStruct,
|
104
|
+
}),
|
105
|
+
});
|
106
|
+
export const GetRequestResponseStruct = KeyringRequestStruct;
|
107
|
+
// ----------------------------------------------------------------------------
|
108
|
+
// Submit request
|
109
|
+
export const SubmitRequestRequestStruct = object({
|
110
|
+
...CommonHeader,
|
111
|
+
method: literal('keyring_submitRequest'),
|
112
|
+
params: KeyringRequestStruct,
|
113
|
+
});
|
114
|
+
export const SubmitRequestResponseStruct = KeyringResponseStruct;
|
115
|
+
// ----------------------------------------------------------------------------
|
116
|
+
// Approve request
|
117
|
+
export const ApproveRequestRequestStruct = object({
|
118
|
+
...CommonHeader,
|
119
|
+
method: literal('keyring_approveRequest'),
|
120
|
+
params: object({
|
121
|
+
id: UuidStruct,
|
122
|
+
data: record(string(), JsonStruct),
|
123
|
+
}),
|
124
|
+
});
|
125
|
+
export const ApproveRequestResponseStruct = literal(null);
|
126
|
+
// ----------------------------------------------------------------------------
|
127
|
+
// Reject request
|
128
|
+
export const RejectRequestRequestStruct = object({
|
129
|
+
...CommonHeader,
|
130
|
+
method: literal('keyring_rejectRequest'),
|
131
|
+
params: object({
|
132
|
+
id: UuidStruct,
|
133
|
+
}),
|
134
|
+
});
|
135
|
+
export const RejectRequestResponseStruct = literal(null);
|
136
|
+
//# sourceMappingURL=api.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"api.mjs","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,gBAAgB,EAAE,kBAAc;AACzC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACtB,yBAAe;AAChB,OAAO,EAAE,MAAM,EAAE,2BAAuB;AACx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CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EthKeyring.cjs","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, Keyring } from '@metamask/utils';\n\nimport type { KeyringExecutionContext } from '../../contexts';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '../../eth';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { Json, Keyring } from
|
2
|
-
import type { KeyringExecutionContext } from
|
3
|
-
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from
|
1
|
+
import type { Json, Keyring } from "@metamask/utils";
|
2
|
+
import type { KeyringExecutionContext } from "../../contexts.cjs";
|
3
|
+
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "../../eth/index.cjs";
|
4
4
|
export type EthKeyring<State extends Json> = Keyring<State> & {
|
5
5
|
/**
|
6
6
|
* Convert a base transaction to a base UserOperation.
|
@@ -31,3 +31,4 @@ export type EthKeyring<State extends Json> = Keyring<State> & {
|
|
31
31
|
*/
|
32
32
|
signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
|
33
33
|
};
|
34
|
+
//# sourceMappingURL=EthKeyring.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EthKeyring.d.cts","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,4BAAkB;AAEnB,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { Json, Keyring } from "@metamask/utils";
|
2
|
+
import type { KeyringExecutionContext } from "../../contexts.mjs";
|
3
|
+
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "../../eth/index.mjs";
|
4
|
+
export type EthKeyring<State extends Json> = Keyring<State> & {
|
5
|
+
/**
|
6
|
+
* Convert a base transaction to a base UserOperation.
|
7
|
+
*
|
8
|
+
* @param address - Address of the sender.
|
9
|
+
* @param transactions - Base transactions to include in the UserOperation.
|
10
|
+
* @param context - Keyring execution context.
|
11
|
+
* @returns A pseudo-UserOperation that can be used to construct a real.
|
12
|
+
*/
|
13
|
+
prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
|
14
|
+
/**
|
15
|
+
* Patches properties of a UserOperation. Currently, only the
|
16
|
+
* `paymasterAndData` can be patched.
|
17
|
+
*
|
18
|
+
* @param address - Address of the sender.
|
19
|
+
* @param userOp - UserOperation to patch.
|
20
|
+
* @param context - Keyring execution context.
|
21
|
+
* @returns A patch to apply to the UserOperation.
|
22
|
+
*/
|
23
|
+
patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
|
24
|
+
/**
|
25
|
+
* Signs an UserOperation.
|
26
|
+
*
|
27
|
+
* @param address - Address of the sender.
|
28
|
+
* @param userOp - UserOperation to sign.
|
29
|
+
* @param context - Keyring execution context.
|
30
|
+
* @returns The signature of the UserOperation.
|
31
|
+
*/
|
32
|
+
signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
|
33
|
+
};
|
34
|
+
//# sourceMappingURL=EthKeyring.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EthKeyring.d.mts","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,4BAAkB;AAEnB,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EthKeyring.mjs","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, Keyring } from '@metamask/utils';\n\nimport type { KeyringExecutionContext } from '../../contexts';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '../../eth';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RequestRejectedEventStruct = exports.RequestApprovedEventStruct = exports.AccountDeletedEventStruct = exports.AccountUpdatedEventStruct = exports.AccountCreatedEventStruct = void 0;
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const utils_1 = require("@metamask/utils");
|
6
|
-
const api_1 = require("../api");
|
7
|
-
const events_1 = require("../events");
|
8
|
-
const superstruct_2 = require("../superstruct");
|
9
|
-
const utils_2 = require("../utils");
|
6
|
+
const api_1 = require("../api/index.cjs");
|
7
|
+
const events_1 = require("../events.cjs");
|
8
|
+
const superstruct_2 = require("../superstruct.cjs");
|
9
|
+
const utils_2 = require("../utils/index.cjs");
|
10
10
|
exports.AccountCreatedEventStruct = (0, superstruct_2.object)({
|
11
11
|
method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
|
12
12
|
params: (0, superstruct_2.object)({
|
@@ -69,4 +69,4 @@ exports.RequestRejectedEventStruct = (0, superstruct_2.object)({
|
|
69
69
|
id: utils_2.UuidStruct,
|
70
70
|
}),
|
71
71
|
});
|
72
|
-
//# sourceMappingURL=events.
|
72
|
+
//# sourceMappingURL=events.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,uDAAiE;AACjE,2CAA6C;AAE7C,0CAA8C;AAC9C,0CAAyC;AACzC,oDAAuD;AACvD,8CAAsC;AAEzB,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
|
@@ -52,12 +52,12 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
52
52
|
* client to decide whether to use it. The keyring won't be informed if the
|
53
53
|
* client decides to use a different name.
|
54
54
|
*/
|
55
|
-
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct").ExactOptionalTag, null>;
|
55
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct.cjs").ExactOptionalTag, null>;
|
56
56
|
/**
|
57
57
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
58
58
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
59
59
|
*/
|
60
|
-
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct").ExactOptionalTag, null>;
|
60
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct.cjs").ExactOptionalTag, null>;
|
61
61
|
}>;
|
62
62
|
}>;
|
63
63
|
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
@@ -159,3 +159,4 @@ export declare const RequestRejectedEventStruct: import("@metamask/superstruct")
|
|
159
159
|
id: import("@metamask/superstruct").Struct<string, null>;
|
160
160
|
}>;
|
161
161
|
}>;
|
162
|
+
//# sourceMappingURL=events.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
|
2
|
+
method: "notify:accountCreated";
|
3
|
+
params: {
|
4
|
+
account: {
|
5
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
6
|
+
id: string;
|
7
|
+
address: string;
|
8
|
+
options: Record<string, import("@metamask/utils").Json>;
|
9
|
+
methods: string[];
|
10
|
+
};
|
11
|
+
accountNameSuggestion?: string;
|
12
|
+
displayConfirmation?: boolean;
|
13
|
+
};
|
14
|
+
}, {
|
15
|
+
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
16
|
+
params: import("@metamask/superstruct").Struct<{
|
17
|
+
account: {
|
18
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
19
|
+
id: string;
|
20
|
+
address: string;
|
21
|
+
options: Record<string, import("@metamask/utils").Json>;
|
22
|
+
methods: string[];
|
23
|
+
};
|
24
|
+
accountNameSuggestion?: string;
|
25
|
+
displayConfirmation?: boolean;
|
26
|
+
}, {
|
27
|
+
/**
|
28
|
+
* New account object.
|
29
|
+
*/
|
30
|
+
account: import("@metamask/superstruct").Struct<{
|
31
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
32
|
+
id: string;
|
33
|
+
address: string;
|
34
|
+
options: Record<string, import("@metamask/utils").Json>;
|
35
|
+
methods: string[];
|
36
|
+
}, {
|
37
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
38
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
39
|
+
"eip155:eoa": "eip155:eoa";
|
40
|
+
"eip155:erc4337": "eip155:erc4337";
|
41
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
42
|
+
"solana:data-account": "solana:data-account";
|
43
|
+
}>;
|
44
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
45
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
46
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
47
|
+
}>;
|
48
|
+
/**
|
49
|
+
* Account name suggestion provided to the MetaMask client.
|
50
|
+
*
|
51
|
+
* The keyring can suggest a name for the account, but it's up to the
|
52
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
53
|
+
* client decides to use a different name.
|
54
|
+
*/
|
55
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct.mjs").ExactOptionalTag, null>;
|
56
|
+
/**
|
57
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
58
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
59
|
+
*/
|
60
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct.mjs").ExactOptionalTag, null>;
|
61
|
+
}>;
|
62
|
+
}>;
|
63
|
+
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
64
|
+
method: "notify:accountUpdated";
|
65
|
+
params: {
|
66
|
+
account: {
|
67
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
68
|
+
id: string;
|
69
|
+
address: string;
|
70
|
+
options: Record<string, import("@metamask/utils").Json>;
|
71
|
+
methods: string[];
|
72
|
+
};
|
73
|
+
};
|
74
|
+
}, {
|
75
|
+
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
76
|
+
params: import("@metamask/superstruct").Struct<{
|
77
|
+
account: {
|
78
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
79
|
+
id: string;
|
80
|
+
address: string;
|
81
|
+
options: Record<string, import("@metamask/utils").Json>;
|
82
|
+
methods: string[];
|
83
|
+
};
|
84
|
+
}, {
|
85
|
+
/**
|
86
|
+
* Updated account object.
|
87
|
+
*/
|
88
|
+
account: import("@metamask/superstruct").Struct<{
|
89
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
90
|
+
id: string;
|
91
|
+
address: string;
|
92
|
+
options: Record<string, import("@metamask/utils").Json>;
|
93
|
+
methods: string[];
|
94
|
+
}, {
|
95
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
96
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
97
|
+
"eip155:eoa": "eip155:eoa";
|
98
|
+
"eip155:erc4337": "eip155:erc4337";
|
99
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
100
|
+
"solana:data-account": "solana:data-account";
|
101
|
+
}>;
|
102
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
103
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
104
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
105
|
+
}>;
|
106
|
+
}>;
|
107
|
+
}>;
|
108
|
+
export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
|
109
|
+
method: "notify:accountDeleted";
|
110
|
+
params: {
|
111
|
+
id: string;
|
112
|
+
};
|
113
|
+
}, {
|
114
|
+
method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
|
115
|
+
params: import("@metamask/superstruct").Struct<{
|
116
|
+
id: string;
|
117
|
+
}, {
|
118
|
+
/**
|
119
|
+
* Deleted account ID.
|
120
|
+
*/
|
121
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
122
|
+
}>;
|
123
|
+
}>;
|
124
|
+
export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
|
125
|
+
method: "notify:requestApproved";
|
126
|
+
params: {
|
127
|
+
id: string;
|
128
|
+
result: import("@metamask/utils").Json;
|
129
|
+
};
|
130
|
+
}, {
|
131
|
+
method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
|
132
|
+
params: import("@metamask/superstruct").Struct<{
|
133
|
+
id: string;
|
134
|
+
result: import("@metamask/utils").Json;
|
135
|
+
}, {
|
136
|
+
/**
|
137
|
+
* Request ID.
|
138
|
+
*/
|
139
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
140
|
+
/**
|
141
|
+
* Request result.
|
142
|
+
*/
|
143
|
+
result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
144
|
+
}>;
|
145
|
+
}>;
|
146
|
+
export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
|
147
|
+
method: "notify:requestRejected";
|
148
|
+
params: {
|
149
|
+
id: string;
|
150
|
+
};
|
151
|
+
}, {
|
152
|
+
method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
|
153
|
+
params: import("@metamask/superstruct").Struct<{
|
154
|
+
id: string;
|
155
|
+
}, {
|
156
|
+
/**
|
157
|
+
* Request ID.
|
158
|
+
*/
|
159
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
160
|
+
}>;
|
161
|
+
}>;
|
162
|
+
//# sourceMappingURL=events.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { boolean, literal, string } from "@metamask/superstruct";
|
2
|
+
import { JsonStruct } from "@metamask/utils";
|
3
|
+
import { KeyringAccountStruct } from "../api/index.mjs";
|
4
|
+
import { KeyringEvent } from "../events.mjs";
|
5
|
+
import { exactOptional, object } from "../superstruct.mjs";
|
6
|
+
import { UuidStruct } from "../utils/index.mjs";
|
7
|
+
export const AccountCreatedEventStruct = object({
|
8
|
+
method: literal(`${KeyringEvent.AccountCreated}`),
|
9
|
+
params: object({
|
10
|
+
/**
|
11
|
+
* New account object.
|
12
|
+
*/
|
13
|
+
account: KeyringAccountStruct,
|
14
|
+
/**
|
15
|
+
* Account name suggestion provided to the MetaMask client.
|
16
|
+
*
|
17
|
+
* The keyring can suggest a name for the account, but it's up to the
|
18
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
19
|
+
* client decides to use a different name.
|
20
|
+
*/
|
21
|
+
accountNameSuggestion: exactOptional(string()),
|
22
|
+
/**
|
23
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
24
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
25
|
+
*/
|
26
|
+
displayConfirmation: exactOptional(boolean()),
|
27
|
+
}),
|
28
|
+
});
|
29
|
+
export const AccountUpdatedEventStruct = object({
|
30
|
+
method: literal(`${KeyringEvent.AccountUpdated}`),
|
31
|
+
params: object({
|
32
|
+
/**
|
33
|
+
* Updated account object.
|
34
|
+
*/
|
35
|
+
account: KeyringAccountStruct,
|
36
|
+
}),
|
37
|
+
});
|
38
|
+
export const AccountDeletedEventStruct = object({
|
39
|
+
method: literal(`${KeyringEvent.AccountDeleted}`),
|
40
|
+
params: object({
|
41
|
+
/**
|
42
|
+
* Deleted account ID.
|
43
|
+
*/
|
44
|
+
id: UuidStruct,
|
45
|
+
}),
|
46
|
+
});
|
47
|
+
export const RequestApprovedEventStruct = object({
|
48
|
+
method: literal(`${KeyringEvent.RequestApproved}`),
|
49
|
+
params: object({
|
50
|
+
/**
|
51
|
+
* Request ID.
|
52
|
+
*/
|
53
|
+
id: UuidStruct,
|
54
|
+
/**
|
55
|
+
* Request result.
|
56
|
+
*/
|
57
|
+
result: JsonStruct,
|
58
|
+
}),
|
59
|
+
});
|
60
|
+
export const RequestRejectedEventStruct = object({
|
61
|
+
method: literal(`${KeyringEvent.RequestRejected}`),
|
62
|
+
params: object({
|
63
|
+
/**
|
64
|
+
* Request ID.
|
65
|
+
*/
|
66
|
+
id: UuidStruct,
|
67
|
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AAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;QAEd;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./api"), exports);
|
18
|
-
__exportStar(require("./events"), exports);
|
19
|
-
__exportStar(require("./rpc"), exports);
|
20
|
-
__exportStar(require("./types"), exports);
|
21
|
-
//# sourceMappingURL=index.
|
17
|
+
__exportStar(require("./api.cjs"), exports);
|
18
|
+
__exportStar(require("./events.cjs"), exports);
|
19
|
+
__exportStar(require("./rpc.cjs"), exports);
|
20
|
+
__exportStar(require("./types.cjs"), exports);
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAsB;AAEtB,+CAAyB;AACzB,4CAAsB;AACtB,8CAAwB","sourcesContent":["export * from './api';\nexport type * from './eth';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,0BAAsB;AACtB,qCAA2B;AAC3B,6BAAyB;AACzB,0BAAsB;AACtB,4BAAwB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,0BAAsB;AACtB,qCAA2B;AAC3B,6BAAyB;AACzB,0BAAsB;AACtB,4BAAwB"}
|