@metamask-previews/keyring-api 11.1.0-72196d6 → 11.1.0-e345222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/JsonRpcRequest.cjs +13 -0
- package/dist/JsonRpcRequest.cjs.map +1 -0
- package/dist/JsonRpcRequest.d.cts +17 -0
- 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.cjs +130 -0
- package/dist/KeyringClient.cjs.map +1 -0
- package/dist/KeyringClient.d.cts +31 -0
- package/dist/KeyringClient.d.cts.map +1 -0
- package/dist/KeyringClient.d.mts +31 -0
- package/dist/KeyringClient.d.mts.map +1 -0
- package/dist/KeyringClient.mjs +126 -0
- package/dist/KeyringClient.mjs.map +1 -0
- package/dist/KeyringSnapRpcClient.cjs +68 -0
- package/dist/KeyringSnapRpcClient.cjs.map +1 -0
- package/dist/KeyringSnapRpcClient.d.cts +40 -0
- 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.cjs +4 -3
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +1 -1
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +1 -1
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +2 -1
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +6 -5
- package/dist/api/asset.cjs.map +1 -1
- package/dist/api/asset.d.cts +2 -2
- package/dist/api/asset.d.cts.map +1 -1
- package/dist/api/asset.d.mts +2 -2
- package/dist/api/asset.d.mts.map +1 -1
- package/dist/api/asset.mjs +2 -1
- package/dist/api/asset.mjs.map +1 -1
- package/dist/api/balance.cjs +4 -3
- package/dist/api/balance.cjs.map +1 -1
- package/dist/api/balance.d.cts.map +1 -1
- package/dist/api/balance.d.mts.map +1 -1
- package/dist/api/balance.mjs +2 -1
- package/dist/api/balance.mjs.map +1 -1
- package/dist/api/caip.cjs +3 -3
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +1 -1
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/keyring.cjs +0 -2
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +0 -2
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/request.cjs +7 -6
- package/dist/api/request.cjs.map +1 -1
- package/dist/api/request.d.cts +5 -5
- package/dist/api/request.d.cts.map +1 -1
- package/dist/api/request.d.mts +5 -5
- package/dist/api/request.d.mts.map +1 -1
- package/dist/api/request.mjs +2 -1
- package/dist/api/request.mjs.map +1 -1
- package/dist/api/response.cjs +6 -6
- package/dist/api/response.cjs.map +1 -1
- package/dist/api/response.d.cts +1 -1
- package/dist/api/response.d.cts.map +1 -1
- package/dist/api/response.d.mts +1 -1
- package/dist/api/response.d.mts.map +1 -1
- package/dist/api/response.mjs +1 -1
- package/dist/api/response.mjs.map +1 -1
- package/dist/api/transaction.cjs +8 -7
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +64 -64
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +64 -64
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +2 -1
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/btc/types.cjs +2 -2
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +1 -1
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +1 -1
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +2 -2
- package/dist/btc/types.mjs.map +1 -1
- package/dist/eth/erc4337/types.cjs +11 -10
- package/dist/eth/erc4337/types.cjs.map +1 -1
- package/dist/eth/erc4337/types.d.cts +5 -5
- package/dist/eth/erc4337/types.d.cts.map +1 -1
- package/dist/eth/erc4337/types.d.mts +5 -5
- package/dist/eth/erc4337/types.d.mts.map +1 -1
- package/dist/eth/erc4337/types.mjs +2 -1
- package/dist/eth/erc4337/types.mjs.map +1 -1
- package/dist/eth/types.cjs +6 -6
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +2 -2
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +2 -2
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/utils.cjs.map +1 -1
- package/dist/eth/utils.d.cts.map +1 -1
- package/dist/eth/utils.d.mts.map +1 -1
- package/dist/eth/utils.mjs.map +1 -1
- package/dist/events.cjs +1 -67
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +0 -161
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +0 -161
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +0 -66
- package/dist/events.mjs.map +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/api.cjs +150 -0
- package/dist/internal/api.cjs.map +1 -0
- package/dist/internal/api.d.cts +737 -0
- package/dist/internal/api.d.cts.map +1 -0
- package/dist/internal/api.d.mts +737 -0
- package/dist/internal/api.d.mts.map +1 -0
- package/dist/internal/api.mjs +147 -0
- package/dist/internal/api.mjs.map +1 -0
- package/dist/internal/eth/EthKeyring.cjs +3 -0
- package/dist/internal/eth/EthKeyring.cjs.map +1 -0
- package/dist/internal/eth/EthKeyring.d.cts +34 -0
- 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.cjs +3 -0
- 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.cjs +72 -0
- package/dist/internal/events.cjs.map +1 -0
- package/dist/internal/events.d.cts +162 -0
- 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.cjs +21 -0
- 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.cjs.map +1 -0
- package/dist/internal/rpc.d.cts.map +1 -0
- package/dist/internal/rpc.d.mts.map +1 -0
- package/dist/internal/rpc.mjs.map +1 -0
- package/dist/internal/types.cjs +52 -0
- package/dist/internal/types.cjs.map +1 -0
- package/dist/internal/types.d.cts +392 -0
- 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.cjs +143 -0
- package/dist/rpc-handler.cjs.map +1 -0
- package/dist/rpc-handler.d.cts +30 -0
- 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 +138 -0
- package/dist/rpc-handler.mjs.map +1 -0
- package/dist/snap-utils.cjs +20 -0
- package/dist/snap-utils.cjs.map +1 -0
- package/dist/snap-utils.d.cts +12 -0
- 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/sol/types.cjs +3 -3
- package/dist/sol/types.cjs.map +1 -1
- package/dist/sol/types.d.cts +1 -1
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +1 -1
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/sol/types.mjs +1 -1
- package/dist/sol/types.mjs.map +1 -1
- package/dist/superstruct.cjs +109 -0
- package/dist/superstruct.cjs.map +1 -0
- package/dist/superstruct.d.cts +102 -0
- package/dist/superstruct.d.cts.map +1 -0
- package/dist/superstruct.d.mts +102 -0
- package/dist/superstruct.d.mts.map +1 -0
- package/dist/superstruct.mjs +102 -0
- package/dist/superstruct.mjs.map +1 -0
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +2 -0
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +2 -0
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/pagination.cjs +3 -3
- package/dist/utils/pagination.cjs.map +1 -1
- package/dist/utils/pagination.d.cts +1 -1
- package/dist/utils/pagination.d.cts.map +1 -1
- package/dist/utils/pagination.d.mts +1 -1
- package/dist/utils/pagination.d.mts.map +1 -1
- package/dist/utils/pagination.mjs +1 -1
- package/dist/utils/pagination.mjs.map +1 -1
- package/dist/utils/types.cjs +29 -0
- package/dist/utils/types.cjs.map +1 -0
- package/dist/utils/types.d.cts +42 -0
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +42 -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.cjs +20 -0
- package/dist/utils/typing.cjs.map +1 -0
- package/dist/utils/typing.d.cts +33 -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 +12 -9
- package/dist/rpc.cjs.map +0 -1
- package/dist/rpc.d.cts.map +0 -1
- package/dist/rpc.d.mts.map +0 -1
- package/dist/rpc.mjs.map +0 -1
- /package/dist/{rpc.cjs → internal/rpc.cjs} +0 -0
- /package/dist/{rpc.d.cts → internal/rpc.d.cts} +0 -0
- /package/dist/{rpc.d.mts → internal/rpc.d.mts} +0 -0
- /package/dist/{rpc.mjs → internal/rpc.mjs} +0 -0
|
@@ -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
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AACjE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,oBAAoB,EAAE,yBAAe;AAC9C,OAAO,EAAE,YAAY,EAAE,sBAAkB;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,2BAAuB;AACvD,OAAO,EAAE,UAAU,EAAE,2BAAiB;AAEtC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,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;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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,0BAAsB;AAEtB,6BAAyB;AACzB,0BAAsB;AACtB,4BAAwB","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":"rpc.cjs","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":";;;AA0BA,gDAEC;AA5BD;;GAEG;AACH,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAfW,gBAAgB,gCAAhB,gBAAgB,QAe3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalSolDataAccountStruct = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const api_1 = require("../api/index.cjs");
|
|
6
|
+
const types_1 = require("../btc/types.cjs");
|
|
7
|
+
const types_2 = require("../eth/types.cjs");
|
|
8
|
+
const types_3 = require("../sol/types.cjs");
|
|
9
|
+
const superstruct_2 = require("../superstruct.cjs");
|
|
10
|
+
exports.InternalAccountMetadataStruct = (0, superstruct_2.object)({
|
|
11
|
+
metadata: (0, superstruct_2.object)({
|
|
12
|
+
name: (0, superstruct_1.string)(),
|
|
13
|
+
nameLastUpdatedAt: (0, superstruct_2.exactOptional)((0, superstruct_1.number)()),
|
|
14
|
+
snap: (0, superstruct_2.exactOptional)((0, superstruct_2.object)({
|
|
15
|
+
id: (0, superstruct_1.string)(),
|
|
16
|
+
enabled: (0, superstruct_1.boolean)(),
|
|
17
|
+
name: (0, superstruct_1.string)(),
|
|
18
|
+
})),
|
|
19
|
+
lastSelected: (0, superstruct_2.exactOptional)((0, superstruct_1.number)()),
|
|
20
|
+
importTime: (0, superstruct_1.number)(),
|
|
21
|
+
keyring: (0, superstruct_2.object)({
|
|
22
|
+
type: (0, superstruct_1.string)(),
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
exports.InternalEthEoaAccountStruct = (0, superstruct_2.object)({
|
|
27
|
+
...types_2.EthEoaAccountStruct.schema,
|
|
28
|
+
...exports.InternalAccountMetadataStruct.schema,
|
|
29
|
+
});
|
|
30
|
+
exports.InternalEthErc4337AccountStruct = (0, superstruct_2.object)({
|
|
31
|
+
...types_2.EthErc4337AccountStruct.schema,
|
|
32
|
+
...exports.InternalAccountMetadataStruct.schema,
|
|
33
|
+
});
|
|
34
|
+
exports.InternalBtcP2wpkhAccountStruct = (0, superstruct_2.object)({
|
|
35
|
+
...types_1.BtcP2wpkhAccountStruct.schema,
|
|
36
|
+
...exports.InternalAccountMetadataStruct.schema,
|
|
37
|
+
});
|
|
38
|
+
exports.InternalSolDataAccountStruct = (0, superstruct_2.object)({
|
|
39
|
+
...types_3.SolDataAccountStruct.schema,
|
|
40
|
+
...exports.InternalAccountMetadataStruct.schema,
|
|
41
|
+
});
|
|
42
|
+
exports.InternalAccountStructs = {
|
|
43
|
+
[`${api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
|
|
44
|
+
[`${api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
|
|
45
|
+
[`${api_1.BtcAccountType.P2wpkh}`]: exports.InternalBtcP2wpkhAccountStruct,
|
|
46
|
+
[`${api_1.SolAccountType.DataAccount}`]: exports.InternalSolDataAccountStruct,
|
|
47
|
+
};
|
|
48
|
+
exports.InternalAccountStruct = (0, superstruct_2.object)({
|
|
49
|
+
...api_1.KeyringAccountStruct.schema,
|
|
50
|
+
...exports.InternalAccountMetadataStruct.schema,
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,0CAKgB;AAChB,4CAAsD;AACtD,4CAA4E;AAC5E,4CAAoD;AACpD,oDAAuD;AAO1C,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,2BAAmB,CAAC,MAAM;IAC7B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD,GAAG,+BAAuB,CAAC,MAAM;IACjC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,IAAA,oBAAM,EAAC;IACnD,GAAG,8BAAsB,CAAC,MAAM;IAChC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD,GAAG,4BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAcU,QAAA,sBAAsB,GAM/B;IACF,CAAC,GAAG,oBAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;IAC5D,CAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC,EAAE,oCAA4B;CAChE,CAAC;AAQW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n} from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { SolDataAccountStruct } from '../sol/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
|