@metamask-previews/keyring-api 11.0.0-cd6bf38 → 11.1.0-72196d6
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 +8 -1
- package/dist/api/account.cjs +3 -4
- 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 +1 -2
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +5 -6
- 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 +1 -2
- package/dist/api/asset.mjs.map +1 -1
- package/dist/api/balance.cjs +3 -4
- 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 +1 -2
- 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 +2 -0
- 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 +2 -0
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/request.cjs +6 -7
- 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 +1 -2
- 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 +19 -8
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +76 -64
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +76 -64
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +13 -2
- 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 +10 -11
- 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 +1 -2
- 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 +67 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +161 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +161 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +66 -0
- package/dist/events.mjs.map +1 -1
- package/dist/index.cjs +3 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -8
- package/dist/index.mjs.map +1 -1
- package/dist/rpc.cjs.map +1 -0
- package/dist/rpc.d.cts.map +1 -0
- package/dist/rpc.d.mts.map +1 -0
- package/dist/rpc.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/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +0 -2
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +0 -2
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +0 -2
- 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/package.json +9 -12
- package/dist/JsonRpcRequest.cjs +0 -13
- package/dist/JsonRpcRequest.cjs.map +0 -1
- package/dist/JsonRpcRequest.d.cts +0 -17
- package/dist/JsonRpcRequest.d.cts.map +0 -1
- package/dist/JsonRpcRequest.d.mts +0 -17
- package/dist/JsonRpcRequest.d.mts.map +0 -1
- package/dist/JsonRpcRequest.mjs +0 -10
- package/dist/JsonRpcRequest.mjs.map +0 -1
- package/dist/KeyringClient.cjs +0 -130
- package/dist/KeyringClient.cjs.map +0 -1
- package/dist/KeyringClient.d.cts +0 -31
- package/dist/KeyringClient.d.cts.map +0 -1
- package/dist/KeyringClient.d.mts +0 -31
- package/dist/KeyringClient.d.mts.map +0 -1
- package/dist/KeyringClient.mjs +0 -126
- package/dist/KeyringClient.mjs.map +0 -1
- package/dist/KeyringSnapRpcClient.cjs +0 -68
- package/dist/KeyringSnapRpcClient.cjs.map +0 -1
- package/dist/KeyringSnapRpcClient.d.cts +0 -40
- package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
- package/dist/KeyringSnapRpcClient.d.mts +0 -40
- package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
- package/dist/KeyringSnapRpcClient.mjs +0 -63
- package/dist/KeyringSnapRpcClient.mjs.map +0 -1
- package/dist/internal/api.cjs +0 -150
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.d.cts +0 -737
- package/dist/internal/api.d.cts.map +0 -1
- package/dist/internal/api.d.mts +0 -737
- package/dist/internal/api.d.mts.map +0 -1
- package/dist/internal/api.mjs +0 -147
- package/dist/internal/api.mjs.map +0 -1
- package/dist/internal/eth/EthKeyring.cjs +0 -3
- package/dist/internal/eth/EthKeyring.cjs.map +0 -1
- package/dist/internal/eth/EthKeyring.d.cts +0 -34
- package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
- package/dist/internal/eth/EthKeyring.d.mts +0 -34
- package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
- package/dist/internal/eth/EthKeyring.mjs +0 -2
- package/dist/internal/eth/EthKeyring.mjs.map +0 -1
- package/dist/internal/eth/index.cjs +0 -3
- package/dist/internal/eth/index.cjs.map +0 -1
- package/dist/internal/eth/index.d.cts +0 -2
- package/dist/internal/eth/index.d.cts.map +0 -1
- package/dist/internal/eth/index.d.mts +0 -2
- package/dist/internal/eth/index.d.mts.map +0 -1
- package/dist/internal/eth/index.mjs +0 -2
- package/dist/internal/eth/index.mjs.map +0 -1
- package/dist/internal/events.cjs +0 -72
- package/dist/internal/events.cjs.map +0 -1
- package/dist/internal/events.d.cts +0 -162
- package/dist/internal/events.d.cts.map +0 -1
- package/dist/internal/events.d.mts +0 -162
- package/dist/internal/events.d.mts.map +0 -1
- package/dist/internal/events.mjs +0 -69
- package/dist/internal/events.mjs.map +0 -1
- package/dist/internal/index.cjs +0 -21
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.d.cts +0 -6
- package/dist/internal/index.d.cts.map +0 -1
- package/dist/internal/index.d.mts +0 -6
- package/dist/internal/index.d.mts.map +0 -1
- package/dist/internal/index.mjs +0 -5
- package/dist/internal/index.mjs.map +0 -1
- package/dist/internal/rpc.cjs.map +0 -1
- package/dist/internal/rpc.d.cts.map +0 -1
- package/dist/internal/rpc.d.mts.map +0 -1
- package/dist/internal/rpc.mjs.map +0 -1
- package/dist/internal/types.cjs +0 -52
- package/dist/internal/types.cjs.map +0 -1
- package/dist/internal/types.d.cts +0 -392
- package/dist/internal/types.d.cts.map +0 -1
- package/dist/internal/types.d.mts +0 -392
- package/dist/internal/types.d.mts.map +0 -1
- package/dist/internal/types.mjs +0 -49
- package/dist/internal/types.mjs.map +0 -1
- package/dist/rpc-handler.cjs +0 -143
- package/dist/rpc-handler.cjs.map +0 -1
- package/dist/rpc-handler.d.cts +0 -30
- package/dist/rpc-handler.d.cts.map +0 -1
- package/dist/rpc-handler.d.mts +0 -30
- package/dist/rpc-handler.d.mts.map +0 -1
- package/dist/rpc-handler.mjs +0 -138
- package/dist/rpc-handler.mjs.map +0 -1
- package/dist/snap-utils.cjs +0 -20
- package/dist/snap-utils.cjs.map +0 -1
- package/dist/snap-utils.d.cts +0 -12
- package/dist/snap-utils.d.cts.map +0 -1
- package/dist/snap-utils.d.mts +0 -12
- package/dist/snap-utils.d.mts.map +0 -1
- package/dist/snap-utils.mjs +0 -17
- package/dist/snap-utils.mjs.map +0 -1
- package/dist/superstruct.cjs +0 -109
- package/dist/superstruct.cjs.map +0 -1
- package/dist/superstruct.d.cts +0 -102
- package/dist/superstruct.d.cts.map +0 -1
- package/dist/superstruct.d.mts +0 -102
- package/dist/superstruct.d.mts.map +0 -1
- package/dist/superstruct.mjs +0 -102
- package/dist/superstruct.mjs.map +0 -1
- package/dist/utils/types.cjs +0 -29
- package/dist/utils/types.cjs.map +0 -1
- package/dist/utils/types.d.cts +0 -42
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.mts +0 -42
- package/dist/utils/types.d.mts.map +0 -1
- package/dist/utils/types.mjs +0 -26
- package/dist/utils/types.mjs.map +0 -1
- package/dist/utils/typing.cjs +0 -20
- package/dist/utils/typing.cjs.map +0 -1
- package/dist/utils/typing.d.cts +0 -33
- package/dist/utils/typing.d.cts.map +0 -1
- package/dist/utils/typing.d.mts +0 -33
- package/dist/utils/typing.d.mts.map +0 -1
- package/dist/utils/typing.mjs +0 -17
- package/dist/utils/typing.mjs.map +0 -1
- /package/dist/{internal/rpc.cjs → rpc.cjs} +0 -0
- /package/dist/{internal/rpc.d.cts → rpc.d.cts} +0 -0
- /package/dist/{internal/rpc.d.mts → rpc.d.mts} +0 -0
- /package/dist/{internal/rpc.mjs → rpc.mjs} +0 -0
package/dist/events.d.mts
CHANGED
|
@@ -8,4 +8,165 @@ export declare enum KeyringEvent {
|
|
|
8
8
|
RequestApproved = "notify:requestApproved",
|
|
9
9
|
RequestRejected = "notify:requestRejected"
|
|
10
10
|
}
|
|
11
|
+
export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
12
|
+
method: "notify:accountCreated";
|
|
13
|
+
params: {
|
|
14
|
+
account: {
|
|
15
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
16
|
+
id: string;
|
|
17
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
18
|
+
address: string;
|
|
19
|
+
methods: string[];
|
|
20
|
+
};
|
|
21
|
+
accountNameSuggestion?: string;
|
|
22
|
+
displayConfirmation?: boolean;
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
|
26
|
+
params: import("@metamask/superstruct").Struct<{
|
|
27
|
+
account: {
|
|
28
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
29
|
+
id: string;
|
|
30
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
31
|
+
address: string;
|
|
32
|
+
methods: string[];
|
|
33
|
+
};
|
|
34
|
+
accountNameSuggestion?: string;
|
|
35
|
+
displayConfirmation?: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
/**
|
|
38
|
+
* New account object.
|
|
39
|
+
*/
|
|
40
|
+
account: import("@metamask/superstruct").Struct<{
|
|
41
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
42
|
+
id: string;
|
|
43
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
44
|
+
address: string;
|
|
45
|
+
methods: string[];
|
|
46
|
+
}, {
|
|
47
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
48
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
49
|
+
"eip155:eoa": "eip155:eoa";
|
|
50
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
51
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
52
|
+
"solana:data-account": "solana:data-account";
|
|
53
|
+
}>;
|
|
54
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
55
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
56
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Account name suggestion provided to the MetaMask client.
|
|
60
|
+
*
|
|
61
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
62
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
63
|
+
* client decides to use a different name.
|
|
64
|
+
*/
|
|
65
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
66
|
+
/**
|
|
67
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
68
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
69
|
+
*/
|
|
70
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
71
|
+
}>;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
74
|
+
method: "notify:accountUpdated";
|
|
75
|
+
params: {
|
|
76
|
+
account: {
|
|
77
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
78
|
+
id: string;
|
|
79
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
80
|
+
address: string;
|
|
81
|
+
methods: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
|
86
|
+
params: import("@metamask/superstruct").Struct<{
|
|
87
|
+
account: {
|
|
88
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
89
|
+
id: string;
|
|
90
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
91
|
+
address: string;
|
|
92
|
+
methods: string[];
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
95
|
+
/**
|
|
96
|
+
* Updated account object.
|
|
97
|
+
*/
|
|
98
|
+
account: import("@metamask/superstruct").Struct<{
|
|
99
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
100
|
+
id: string;
|
|
101
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
102
|
+
address: string;
|
|
103
|
+
methods: string[];
|
|
104
|
+
}, {
|
|
105
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
106
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
107
|
+
"eip155:eoa": "eip155:eoa";
|
|
108
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
109
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
110
|
+
"solana:data-account": "solana:data-account";
|
|
111
|
+
}>;
|
|
112
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
113
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
114
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
|
|
119
|
+
method: "notify:accountDeleted";
|
|
120
|
+
params: {
|
|
121
|
+
id: string;
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
|
|
125
|
+
params: import("@metamask/superstruct").Struct<{
|
|
126
|
+
id: string;
|
|
127
|
+
}, {
|
|
128
|
+
/**
|
|
129
|
+
* Deleted account ID.
|
|
130
|
+
*/
|
|
131
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
132
|
+
}>;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
|
|
135
|
+
method: "notify:requestApproved";
|
|
136
|
+
params: {
|
|
137
|
+
result: import("@metamask/utils").Json;
|
|
138
|
+
id: string;
|
|
139
|
+
};
|
|
140
|
+
}, {
|
|
141
|
+
method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
|
|
142
|
+
params: import("@metamask/superstruct").Struct<{
|
|
143
|
+
result: import("@metamask/utils").Json;
|
|
144
|
+
id: string;
|
|
145
|
+
}, {
|
|
146
|
+
/**
|
|
147
|
+
* Request ID.
|
|
148
|
+
*/
|
|
149
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
150
|
+
/**
|
|
151
|
+
* Request result.
|
|
152
|
+
*/
|
|
153
|
+
result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
|
154
|
+
}>;
|
|
155
|
+
}>;
|
|
156
|
+
export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
|
|
157
|
+
method: "notify:requestRejected";
|
|
158
|
+
params: {
|
|
159
|
+
id: string;
|
|
160
|
+
};
|
|
161
|
+
}, {
|
|
162
|
+
method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
|
|
163
|
+
params: import("@metamask/superstruct").Struct<{
|
|
164
|
+
id: string;
|
|
165
|
+
}, {
|
|
166
|
+
/**
|
|
167
|
+
* Request ID.
|
|
168
|
+
*/
|
|
169
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
170
|
+
}>;
|
|
171
|
+
}>;
|
|
11
172
|
//# sourceMappingURL=events.d.mts.map
|
package/dist/events.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAED,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"}
|
package/dist/events.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
|
|
2
|
+
import { boolean, literal, string } from "@metamask/superstruct";
|
|
3
|
+
import { JsonStruct } from "@metamask/utils";
|
|
4
|
+
import { KeyringAccountStruct } from "./api/index.mjs";
|
|
1
5
|
/**
|
|
2
6
|
* Supported keyring events.
|
|
3
7
|
*/
|
|
@@ -11,4 +15,66 @@ export var KeyringEvent;
|
|
|
11
15
|
KeyringEvent["RequestApproved"] = "notify:requestApproved";
|
|
12
16
|
KeyringEvent["RequestRejected"] = "notify:requestRejected";
|
|
13
17
|
})(KeyringEvent || (KeyringEvent = {}));
|
|
18
|
+
export const AccountCreatedEventStruct = object({
|
|
19
|
+
method: literal(`${KeyringEvent.AccountCreated}`),
|
|
20
|
+
params: object({
|
|
21
|
+
/**
|
|
22
|
+
* New account object.
|
|
23
|
+
*/
|
|
24
|
+
account: KeyringAccountStruct,
|
|
25
|
+
/**
|
|
26
|
+
* Account name suggestion provided to the MetaMask client.
|
|
27
|
+
*
|
|
28
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
29
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
30
|
+
* client decides to use a different name.
|
|
31
|
+
*/
|
|
32
|
+
accountNameSuggestion: exactOptional(string()),
|
|
33
|
+
/**
|
|
34
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
35
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
36
|
+
*/
|
|
37
|
+
displayConfirmation: exactOptional(boolean()),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
export const AccountUpdatedEventStruct = object({
|
|
41
|
+
method: literal(`${KeyringEvent.AccountUpdated}`),
|
|
42
|
+
params: object({
|
|
43
|
+
/**
|
|
44
|
+
* Updated account object.
|
|
45
|
+
*/
|
|
46
|
+
account: KeyringAccountStruct,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
export const AccountDeletedEventStruct = object({
|
|
50
|
+
method: literal(`${KeyringEvent.AccountDeleted}`),
|
|
51
|
+
params: object({
|
|
52
|
+
/**
|
|
53
|
+
* Deleted account ID.
|
|
54
|
+
*/
|
|
55
|
+
id: UuidStruct,
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
export const RequestApprovedEventStruct = object({
|
|
59
|
+
method: literal(`${KeyringEvent.RequestApproved}`),
|
|
60
|
+
params: object({
|
|
61
|
+
/**
|
|
62
|
+
* Request ID.
|
|
63
|
+
*/
|
|
64
|
+
id: UuidStruct,
|
|
65
|
+
/**
|
|
66
|
+
* Request result.
|
|
67
|
+
*/
|
|
68
|
+
result: JsonStruct,
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
export const RequestRejectedEventStruct = object({
|
|
72
|
+
method: literal(`${KeyringEvent.RequestRejected}`),
|
|
73
|
+
params: object({
|
|
74
|
+
/**
|
|
75
|
+
* Request ID.
|
|
76
|
+
*/
|
|
77
|
+
id: UuidStruct,
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
14
80
|
//# sourceMappingURL=events.mjs.map
|
package/dist/events.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","sourcesContent":["/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n"]}
|
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAC5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AACjE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,oBAAoB,EAAE,wBAAc;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED,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 { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\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"]}
|
package/dist/index.cjs
CHANGED
|
@@ -16,14 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api/index.cjs"), exports);
|
|
18
18
|
__exportStar(require("./btc/index.cjs"), exports);
|
|
19
|
-
__exportStar(require("./eth/index.cjs"), exports);
|
|
20
19
|
__exportStar(require("./sol/index.cjs"), exports);
|
|
20
|
+
__exportStar(require("./eth/index.cjs"), exports);
|
|
21
|
+
__exportStar(require("./rpc.cjs"), exports);
|
|
21
22
|
__exportStar(require("./events.cjs"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./JsonRpcRequest.cjs"), exports);
|
|
24
|
-
__exportStar(require("./KeyringClient.cjs"), exports);
|
|
25
|
-
__exportStar(require("./KeyringSnapRpcClient.cjs"), exports);
|
|
26
|
-
__exportStar(require("./rpc-handler.cjs"), exports);
|
|
27
|
-
__exportStar(require("./snap-utils.cjs"), exports);
|
|
28
|
-
__exportStar(require("./superstruct.cjs"), exports);
|
|
23
|
+
__exportStar(require("./utils/index.cjs"), exports);
|
|
29
24
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;AACtB,kDAAsB;AACtB,kDAAsB;AAEtB,4CAAsB;AACtB,+CAAyB;AACzB,oDAAwB","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './sol';\nexport * from './eth';\nexport type * from './contexts';\nexport * from './rpc';\nexport * from './events';\nexport * from './utils';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
export * from "./api/index.cjs";
|
|
2
2
|
export * from "./btc/index.cjs";
|
|
3
|
-
export type * from "./contexts.cjs";
|
|
4
|
-
export * from "./eth/index.cjs";
|
|
5
3
|
export * from "./sol/index.cjs";
|
|
4
|
+
export * from "./eth/index.cjs";
|
|
5
|
+
export type * from "./contexts.cjs";
|
|
6
|
+
export * from "./rpc.cjs";
|
|
6
7
|
export * from "./events.cjs";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./JsonRpcRequest.cjs";
|
|
9
|
-
export * from "./KeyringClient.cjs";
|
|
10
|
-
export * from "./KeyringSnapRpcClient.cjs";
|
|
11
|
-
export * from "./rpc-handler.cjs";
|
|
12
|
-
export * from "./snap-utils.cjs";
|
|
13
|
-
export * from "./superstruct.cjs";
|
|
8
|
+
export * from "./utils/index.cjs";
|
|
14
9
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AACtB,oCAAgC;AAChC,0BAAsB;AACtB,6BAAyB;AACzB,kCAAwB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
export * from "./api/index.mjs";
|
|
2
2
|
export * from "./btc/index.mjs";
|
|
3
|
-
export type * from "./contexts.mjs";
|
|
4
|
-
export * from "./eth/index.mjs";
|
|
5
3
|
export * from "./sol/index.mjs";
|
|
4
|
+
export * from "./eth/index.mjs";
|
|
5
|
+
export type * from "./contexts.mjs";
|
|
6
|
+
export * from "./rpc.mjs";
|
|
6
7
|
export * from "./events.mjs";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./JsonRpcRequest.mjs";
|
|
9
|
-
export * from "./KeyringClient.mjs";
|
|
10
|
-
export * from "./KeyringSnapRpcClient.mjs";
|
|
11
|
-
export * from "./rpc-handler.mjs";
|
|
12
|
-
export * from "./snap-utils.mjs";
|
|
13
|
-
export * from "./superstruct.mjs";
|
|
8
|
+
export * from "./utils/index.mjs";
|
|
14
9
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AACtB,oCAAgC;AAChC,0BAAsB;AACtB,6BAAyB;AACzB,kCAAwB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
export * from "./api/index.mjs";
|
|
2
2
|
export * from "./btc/index.mjs";
|
|
3
|
-
export * from "./eth/index.mjs";
|
|
4
3
|
export * from "./sol/index.mjs";
|
|
4
|
+
export * from "./eth/index.mjs";
|
|
5
|
+
export * from "./rpc.mjs";
|
|
5
6
|
export * from "./events.mjs";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./JsonRpcRequest.mjs";
|
|
8
|
-
export * from "./KeyringClient.mjs";
|
|
9
|
-
export * from "./KeyringSnapRpcClient.mjs";
|
|
10
|
-
export * from "./rpc-handler.mjs";
|
|
11
|
-
export * from "./snap-utils.mjs";
|
|
12
|
-
export * from "./superstruct.mjs";
|
|
7
|
+
export * from "./utils/index.mjs";
|
|
13
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AACtB,gCAAsB;AAEtB,0BAAsB;AACtB,6BAAyB;AACzB,kCAAwB","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './sol';\nexport * from './eth';\nexport type * from './contexts';\nexport * from './rpc';\nexport * from './events';\nexport * from './utils';\n"]}
|
package/dist/rpc.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../src/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/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/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"}
|
package/dist/rpc.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../src/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"]}
|
package/dist/sol/types.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
|
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
4
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
6
|
const api_1 = require("../api/index.cjs");
|
|
6
|
-
const superstruct_2 = require("../superstruct.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* Solana addresses are represented in the format of a 256-bit ed25519 public key and
|
|
9
9
|
* are encoded using base58.
|
|
10
10
|
* They are usually 32 to 44 characters long.
|
|
11
11
|
*/
|
|
12
|
-
exports.SolAddressStruct = (0,
|
|
12
|
+
exports.SolAddressStruct = (0, keyring_utils_1.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
|
|
13
13
|
/**
|
|
14
14
|
* Supported Solana methods.
|
|
15
15
|
*/
|
|
@@ -18,7 +18,7 @@ var SolMethod;
|
|
|
18
18
|
// General transaction methods
|
|
19
19
|
SolMethod["SendAndConfirmTransaction"] = "sendAndConfirmTransaction";
|
|
20
20
|
})(SolMethod || (exports.SolMethod = SolMethod = {}));
|
|
21
|
-
exports.SolDataAccountStruct = (0,
|
|
21
|
+
exports.SolDataAccountStruct = (0, keyring_utils_1.object)({
|
|
22
22
|
...api_1.KeyringAccountStruct.schema,
|
|
23
23
|
/**
|
|
24
24
|
* Account address.
|
package/dist/sol/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA8D;AAE9D,0CAA8D;AAE9D;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
|
package/dist/sol/types.d.cts
CHANGED
|
@@ -14,8 +14,8 @@ export declare enum SolMethod {
|
|
|
14
14
|
export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
|
|
15
15
|
type: "solana:data-account";
|
|
16
16
|
id: string;
|
|
17
|
-
address: string;
|
|
18
17
|
options: Record<string, import("@metamask/utils").Json>;
|
|
18
|
+
address: string;
|
|
19
19
|
methods: "sendAndConfirmTransaction"[];
|
|
20
20
|
}, {
|
|
21
21
|
/**
|
package/dist/sol/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/sol/types.d.mts
CHANGED
|
@@ -14,8 +14,8 @@ export declare enum SolMethod {
|
|
|
14
14
|
export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
|
|
15
15
|
type: "solana:data-account";
|
|
16
16
|
id: string;
|
|
17
|
-
address: string;
|
|
18
17
|
options: Record<string, import("@metamask/utils").Json>;
|
|
18
|
+
address: string;
|
|
19
19
|
methods: "sendAndConfirmTransaction"[];
|
|
20
20
|
}, {
|
|
21
21
|
/**
|
package/dist/sol/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/sol/types.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { object, definePattern } from "@metamask/keyring-utils";
|
|
1
2
|
import { array, enums, literal } from "@metamask/superstruct";
|
|
2
3
|
import { KeyringAccountStruct, SolAccountType } from "../api/index.mjs";
|
|
3
|
-
import { object, definePattern } from "../superstruct.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Solana addresses are represented in the format of a 256-bit ed25519 public key and
|
|
6
6
|
* are encoded using base58.
|
package/dist/sol/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,yBAAe;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -15,6 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./pagination.cjs"), exports);
|
|
18
|
-
__exportStar(require("./types.cjs"), exports);
|
|
19
|
-
__exportStar(require("./typing.cjs"), exports);
|
|
20
18
|
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA6B
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA6B","sourcesContent":["export * from './pagination';\n"]}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B"}
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B"}
|
package/dist/utils/index.mjs
CHANGED
package/dist/utils/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B","sourcesContent":["export * from './pagination';\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PaginationStruct = void 0;
|
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
4
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
-
const superstruct_2 = require("../superstruct.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Pagination struct. This struct is used to specify the limit of items to
|
|
8
8
|
* return and the next cursor to iterate over the results.
|
|
@@ -15,7 +15,7 @@ const superstruct_2 = require("../superstruct.cjs");
|
|
|
15
15
|
* }
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
exports.PaginationStruct = (0,
|
|
18
|
+
exports.PaginationStruct = (0, keyring_utils_1.object)({
|
|
19
19
|
/**
|
|
20
20
|
* Maximum number of items to return.
|
|
21
21
|
*/
|
|
@@ -23,6 +23,6 @@ exports.PaginationStruct = (0, superstruct_2.object)({
|
|
|
23
23
|
/**
|
|
24
24
|
* Next cursor to iterate over the results.
|
|
25
25
|
*/
|
|
26
|
-
next: (0,
|
|
26
|
+
next: (0, keyring_utils_1.exactOptional)((0, superstruct_1.nullable)((0, superstruct_1.string)())),
|
|
27
27
|
});
|
|
28
28
|
//# sourceMappingURL=pagination.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.cjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"pagination.cjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAiE;AAEjE;;;;;;;;;;;GAWG;AACU,QAAA,gBAAgB,GAAG,IAAA,sBAAM,EAAC;IACrC;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,IAAI,EAAE,IAAA,6BAAa,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nullable, number, string } from '@metamask/superstruct';\n\n/**\n * Pagination struct. This struct is used to specify the limit of items to\n * return and the next cursor to iterate over the results.\n *\n * @example\n * ```ts\n * {\n * limit: 10,\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport const PaginationStruct = object({\n /**\n * Maximum number of items to return.\n */\n limit: number(),\n\n /**\n * Next cursor to iterate over the results.\n */\n next: exactOptional(nullable(string())),\n});\n\n/**\n * Pagination object.\n *\n * See {@link PaginationStruct}.\n */\nexport type Pagination = Infer<typeof PaginationStruct>;\n\n/**\n * Page of results. It includes the data and the next cursor to iterate over\n * the results.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Item object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport type Paginated<Type> = {\n /**\n * The list of items for this page.\n */\n data: Type[];\n\n /**\n * Next cursor to iterate over the results if any, will be `null` otherwise.\n */\n next: string | null;\n};\n"]}
|
|
@@ -22,7 +22,7 @@ export declare const PaginationStruct: import("@metamask/superstruct").Struct<{
|
|
|
22
22
|
/**
|
|
23
23
|
* Next cursor to iterate over the results.
|
|
24
24
|
*/
|
|
25
|
-
next: import("@metamask/superstruct").Struct<string | import("
|
|
25
|
+
next: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag | null, null>;
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
28
|
* Pagination object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.cts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.d.cts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;IAC3B;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,EAAE,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC"}
|
|
@@ -22,7 +22,7 @@ export declare const PaginationStruct: import("@metamask/superstruct").Struct<{
|
|
|
22
22
|
/**
|
|
23
23
|
* Next cursor to iterate over the results.
|
|
24
24
|
*/
|
|
25
|
-
next: import("@metamask/superstruct").Struct<string | import("
|
|
25
|
+
next: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag | null, null>;
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
28
|
* Pagination object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;IAC3B;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,EAAE,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { exactOptional, object } from "@metamask/keyring-utils";
|
|
1
2
|
import { nullable, number, string } from "@metamask/superstruct";
|
|
2
|
-
import { exactOptional, object } from "../superstruct.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Pagination struct. This struct is used to specify the limit of items to
|
|
5
5
|
* return and the next cursor to iterate over the results.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE;IAEf;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nullable, number, string } from '@metamask/superstruct';\n\n/**\n * Pagination struct. This struct is used to specify the limit of items to\n * return and the next cursor to iterate over the results.\n *\n * @example\n * ```ts\n * {\n * limit: 10,\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport const PaginationStruct = object({\n /**\n * Maximum number of items to return.\n */\n limit: number(),\n\n /**\n * Next cursor to iterate over the results.\n */\n next: exactOptional(nullable(string())),\n});\n\n/**\n * Pagination object.\n *\n * See {@link PaginationStruct}.\n */\nexport type Pagination = Infer<typeof PaginationStruct>;\n\n/**\n * Page of results. It includes the data and the next cursor to iterate over\n * the results.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Item object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport type Paginated<Type> = {\n /**\n * The list of items for this page.\n */\n data: Type[];\n\n /**\n * Next cursor to iterate over the results if any, will be `null` otherwise.\n */\n next: string | null;\n};\n"]}
|