@metamask/keyring-api 10.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/{JsonRpcRequest.js → JsonRpcRequest.cjs} +2 -2
- package/dist/JsonRpcRequest.cjs.map +1 -0
- package/dist/{JsonRpcRequest.d.ts → JsonRpcRequest.d.cts} +3 -2
- package/dist/JsonRpcRequest.d.cts.map +1 -0
- package/dist/JsonRpcRequest.d.mts +17 -0
- package/dist/JsonRpcRequest.d.mts.map +1 -0
- package/dist/JsonRpcRequest.mjs +10 -0
- package/dist/JsonRpcRequest.mjs.map +1 -0
- package/dist/{KeyringClient.js → KeyringClient.cjs} +4 -4
- package/dist/KeyringClient.cjs.map +1 -0
- package/dist/{KeyringClient.d.ts → KeyringClient.d.cts} +4 -3
- package/dist/KeyringClient.d.cts.map +1 -0
- package/dist/KeyringClient.d.mts +29 -0
- package/dist/KeyringClient.d.mts.map +1 -0
- package/dist/KeyringClient.mjs +120 -0
- package/dist/KeyringClient.mjs.map +1 -0
- package/dist/{KeyringSnapRpcClient.js → KeyringSnapRpcClient.cjs} +2 -2
- package/dist/KeyringSnapRpcClient.cjs.map +1 -0
- package/dist/{KeyringSnapRpcClient.d.ts → KeyringSnapRpcClient.d.cts} +6 -5
- package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
- package/dist/KeyringSnapRpcClient.d.mts +40 -0
- package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
- package/dist/KeyringSnapRpcClient.mjs +63 -0
- package/dist/KeyringSnapRpcClient.mjs.map +1 -0
- package/dist/api/{account.js → account.cjs} +3 -3
- package/dist/api/account.cjs.map +1 -0
- package/dist/api/{account.d.ts → account.d.cts} +2 -1
- package/dist/api/account.d.cts.map +1 -0
- package/dist/api/account.d.mts +70 -0
- package/dist/api/account.d.mts.map +1 -0
- package/dist/api/account.mjs +61 -0
- package/dist/api/account.mjs.map +1 -0
- package/dist/api/{balance.js → balance.cjs} +3 -3
- package/dist/api/balance.cjs.map +1 -0
- package/dist/api/{balance.d.ts → balance.d.cts} +2 -1
- package/dist/api/balance.d.cts.map +1 -0
- package/dist/api/balance.d.mts +10 -0
- package/dist/api/balance.d.mts.map +1 -0
- package/dist/api/balance.mjs +8 -0
- package/dist/api/balance.mjs.map +1 -0
- package/dist/api/{caip.js → caip.cjs} +5 -5
- package/dist/api/caip.cjs.map +1 -0
- package/dist/api/{caip.d.ts → caip.d.cts} +2 -1
- package/dist/api/caip.d.cts.map +1 -0
- package/dist/api/caip.d.mts +38 -0
- package/dist/api/caip.d.mts.map +1 -0
- package/dist/api/caip.mjs +43 -0
- package/dist/api/caip.mjs.map +1 -0
- package/dist/api/{export.js → export.cjs} +1 -1
- package/dist/api/export.cjs.map +1 -0
- package/dist/api/{export.d.ts → export.d.cts} +2 -1
- package/dist/api/export.d.cts.map +1 -0
- package/dist/api/export.d.mts +9 -0
- package/dist/api/export.d.mts.map +1 -0
- package/dist/api/export.mjs +4 -0
- package/dist/api/export.mjs.map +1 -0
- package/dist/api/{index.js → index.cjs} +7 -7
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +8 -0
- package/dist/api/index.d.cts.map +1 -0
- package/dist/api/index.d.mts +8 -0
- package/dist/api/index.d.mts.map +1 -0
- package/dist/api/index.mjs +7 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/{keyring.js → keyring.cjs} +1 -1
- package/dist/api/keyring.cjs.map +1 -0
- package/dist/api/{keyring.d.ts → keyring.d.cts} +8 -7
- package/dist/api/keyring.d.cts.map +1 -0
- package/dist/api/keyring.d.mts +160 -0
- package/dist/api/keyring.d.mts.map +1 -0
- package/dist/api/keyring.mjs +2 -0
- package/dist/api/keyring.mjs.map +1 -0
- package/dist/api/{request.js → request.cjs} +3 -3
- package/dist/api/request.cjs.map +1 -0
- package/dist/api/{request.d.ts → request.d.cts} +3 -2
- package/dist/api/request.d.cts.map +1 -0
- package/dist/api/request.d.mts +40 -0
- package/dist/api/request.d.mts.map +1 -0
- package/dist/api/request.mjs +26 -0
- package/dist/api/request.mjs.map +1 -0
- package/dist/api/{response.js → response.cjs} +2 -2
- package/dist/api/response.cjs.map +1 -0
- package/dist/api/{response.d.ts → response.d.cts} +2 -1
- package/dist/api/response.d.cts.map +1 -0
- package/dist/api/response.d.mts +25 -0
- package/dist/api/response.d.mts.map +1 -0
- package/dist/api/response.mjs +41 -0
- package/dist/api/response.mjs.map +1 -0
- package/dist/{eth/erc4337/index.js → btc/index.cjs} +2 -2
- package/dist/btc/index.cjs.map +1 -0
- package/dist/btc/index.d.cts +2 -0
- package/dist/btc/index.d.cts.map +1 -0
- package/dist/btc/index.d.mts +2 -0
- package/dist/btc/index.d.mts.map +1 -0
- package/dist/btc/index.mjs +2 -0
- package/dist/btc/index.mjs.map +1 -0
- package/dist/btc/{types.js → types.cjs} +3 -3
- package/dist/btc/types.cjs.map +1 -0
- package/dist/btc/{types.d.ts → types.d.cts} +2 -1
- package/dist/btc/types.d.cts.map +1 -0
- package/dist/btc/types.d.mts +34 -0
- package/dist/btc/types.d.mts.map +1 -0
- package/dist/btc/types.mjs +37 -0
- package/dist/btc/types.mjs.map +1 -0
- package/dist/{contexts.js → contexts.cjs} +1 -1
- package/dist/contexts.cjs.map +1 -0
- package/dist/{contexts.d.ts → contexts.d.cts} +1 -0
- package/dist/contexts.d.cts.map +1 -0
- package/dist/contexts.d.mts +8 -0
- package/dist/contexts.d.mts.map +1 -0
- package/dist/contexts.mjs +2 -0
- package/dist/contexts.mjs.map +1 -0
- package/dist/{sol/index.js → eth/erc4337/index.cjs} +2 -2
- package/dist/eth/erc4337/index.cjs.map +1 -0
- package/dist/eth/erc4337/index.d.cts +2 -0
- package/dist/eth/erc4337/index.d.cts.map +1 -0
- package/dist/eth/erc4337/index.d.mts +2 -0
- package/dist/eth/erc4337/index.d.mts.map +1 -0
- package/dist/eth/erc4337/index.mjs +2 -0
- package/dist/eth/erc4337/index.mjs.map +1 -0
- package/dist/eth/erc4337/{types.js → types.cjs} +4 -4
- package/dist/eth/erc4337/types.cjs.map +1 -0
- package/dist/eth/erc4337/{types.d.ts → types.d.cts} +6 -5
- package/dist/eth/erc4337/types.d.cts.map +1 -0
- package/dist/eth/erc4337/types.d.mts +98 -0
- package/dist/eth/erc4337/types.d.mts.map +1 -0
- package/dist/eth/erc4337/types.mjs +59 -0
- package/dist/eth/erc4337/types.mjs.map +1 -0
- package/dist/eth/{index.js → index.cjs} +4 -4
- package/dist/eth/index.cjs.map +1 -0
- package/dist/eth/index.d.cts +4 -0
- package/dist/eth/index.d.cts.map +1 -0
- package/dist/eth/index.d.mts +4 -0
- package/dist/eth/index.d.mts.map +1 -0
- package/dist/eth/index.mjs +4 -0
- package/dist/eth/index.mjs.map +1 -0
- package/dist/eth/{types.js → types.cjs} +3 -3
- package/dist/eth/types.cjs.map +1 -0
- package/dist/eth/{types.d.ts → types.d.cts} +2 -1
- package/dist/eth/types.d.cts.map +1 -0
- package/dist/eth/types.d.mts +81 -0
- package/dist/eth/types.d.mts.map +1 -0
- package/dist/eth/types.mjs +70 -0
- package/dist/eth/types.mjs.map +1 -0
- package/dist/eth/{utils.js → utils.cjs} +3 -4
- package/dist/eth/{utils.js.map → utils.cjs.map} +1 -1
- package/dist/eth/{utils.d.ts → utils.d.cts} +2 -1
- package/dist/eth/utils.d.cts.map +1 -0
- package/dist/eth/utils.d.mts +9 -0
- package/dist/eth/utils.d.mts.map +1 -0
- package/dist/eth/utils.mjs +11 -0
- package/dist/eth/utils.mjs.map +1 -0
- package/dist/{events.js → events.cjs} +1 -1
- package/dist/events.cjs.map +1 -0
- package/dist/{events.d.ts → events.d.cts} +1 -0
- package/dist/events.d.cts.map +1 -0
- package/dist/events.d.mts +11 -0
- package/dist/events.d.mts.map +1 -0
- package/dist/events.mjs +14 -0
- package/dist/events.mjs.map +1 -0
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +14 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/{api.js → api.cjs} +5 -5
- package/dist/internal/api.cjs.map +1 -0
- package/dist/internal/{api.d.ts → api.d.cts} +5 -4
- package/dist/internal/api.d.cts.map +1 -0
- package/dist/internal/api.d.mts +420 -0
- package/dist/internal/api.d.mts.map +1 -0
- package/dist/internal/api.mjs +136 -0
- package/dist/internal/api.mjs.map +1 -0
- package/dist/internal/eth/{EthKeyring.js → EthKeyring.cjs} +1 -1
- package/dist/internal/eth/EthKeyring.cjs.map +1 -0
- package/dist/internal/eth/{EthKeyring.d.ts → EthKeyring.d.cts} +4 -3
- package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
- package/dist/internal/eth/EthKeyring.d.mts +34 -0
- package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
- package/dist/internal/eth/EthKeyring.mjs +2 -0
- package/dist/internal/eth/EthKeyring.mjs.map +1 -0
- package/dist/internal/eth/{index.js → index.cjs} +1 -1
- package/dist/internal/eth/index.cjs.map +1 -0
- package/dist/internal/eth/index.d.cts +2 -0
- package/dist/internal/eth/index.d.cts.map +1 -0
- package/dist/internal/eth/index.d.mts +2 -0
- package/dist/internal/eth/index.d.mts.map +1 -0
- package/dist/internal/eth/index.mjs +2 -0
- package/dist/internal/eth/index.mjs.map +1 -0
- package/dist/internal/{events.js → events.cjs} +5 -5
- package/dist/internal/events.cjs.map +1 -0
- package/dist/internal/{events.d.ts → events.d.cts} +3 -2
- package/dist/internal/events.d.cts.map +1 -0
- package/dist/internal/events.d.mts +162 -0
- package/dist/internal/events.d.mts.map +1 -0
- package/dist/internal/events.mjs +69 -0
- package/dist/internal/events.mjs.map +1 -0
- package/dist/internal/{index.js → index.cjs} +5 -5
- package/dist/internal/index.cjs.map +1 -0
- package/dist/internal/index.d.cts +6 -0
- package/dist/internal/index.d.cts.map +1 -0
- package/dist/internal/index.d.mts +6 -0
- package/dist/internal/index.d.mts.map +1 -0
- package/dist/internal/index.mjs +5 -0
- package/dist/internal/index.mjs.map +1 -0
- package/dist/internal/{rpc.js → rpc.cjs} +3 -3
- package/dist/internal/rpc.cjs.map +1 -0
- package/dist/internal/{rpc.d.ts → rpc.d.cts} +1 -0
- package/dist/internal/rpc.d.cts.map +1 -0
- package/dist/internal/rpc.d.mts +26 -0
- package/dist/internal/rpc.d.mts.map +1 -0
- package/dist/internal/rpc.mjs +29 -0
- package/dist/internal/{rpc.js.map → rpc.mjs.map} +1 -1
- package/dist/internal/{types.js → types.cjs} +6 -6
- package/dist/internal/types.cjs.map +1 -0
- package/dist/internal/{types.d.ts → types.d.cts} +21 -20
- package/dist/internal/types.d.cts.map +1 -0
- package/dist/internal/types.d.mts +392 -0
- package/dist/internal/types.d.mts.map +1 -0
- package/dist/internal/types.mjs +49 -0
- package/dist/internal/types.mjs.map +1 -0
- package/dist/{rpc-handler.js → rpc-handler.cjs} +6 -6
- package/dist/rpc-handler.cjs.map +1 -0
- package/dist/{rpc-handler.d.ts → rpc-handler.d.cts} +4 -3
- package/dist/rpc-handler.d.cts.map +1 -0
- package/dist/rpc-handler.d.mts +30 -0
- package/dist/rpc-handler.d.mts.map +1 -0
- package/dist/rpc-handler.mjs +131 -0
- package/dist/rpc-handler.mjs.map +1 -0
- package/dist/{snap-utils.js → snap-utils.cjs} +2 -3
- package/dist/snap-utils.cjs.map +1 -0
- package/dist/{snap-utils.d.ts → snap-utils.d.cts} +4 -3
- package/dist/snap-utils.d.cts.map +1 -0
- package/dist/snap-utils.d.mts +12 -0
- package/dist/snap-utils.d.mts.map +1 -0
- package/dist/snap-utils.mjs +17 -0
- package/dist/snap-utils.mjs.map +1 -0
- package/dist/{btc/index.js → sol/index.cjs} +2 -2
- package/dist/sol/index.cjs.map +1 -0
- package/dist/sol/index.d.cts +2 -0
- package/dist/sol/index.d.cts.map +1 -0
- package/dist/sol/index.d.mts +2 -0
- package/dist/sol/index.d.mts.map +1 -0
- package/dist/sol/index.mjs +2 -0
- package/dist/sol/index.mjs.map +1 -0
- package/dist/sol/{types.js → types.cjs} +3 -3
- package/dist/sol/types.cjs.map +1 -0
- package/dist/sol/{types.d.ts → types.d.cts} +2 -1
- package/dist/sol/types.d.cts.map +1 -0
- package/dist/sol/types.d.mts +39 -0
- package/dist/sol/types.d.mts.map +1 -0
- package/dist/sol/types.mjs +33 -0
- package/dist/sol/types.mjs.map +1 -0
- package/dist/{superstruct.js → superstruct.cjs} +5 -6
- package/dist/superstruct.cjs.map +1 -0
- package/dist/{superstruct.d.ts → superstruct.d.cts} +3 -2
- package/dist/superstruct.d.cts.map +1 -0
- package/dist/superstruct.d.mts +84 -0
- package/dist/superstruct.d.mts.map +1 -0
- package/dist/superstruct.mjs +74 -0
- package/dist/superstruct.mjs.map +1 -0
- package/dist/utils/{index.js → index.cjs} +3 -3
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +3 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +3 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/{types.js → types.cjs} +2 -2
- package/dist/utils/types.cjs.map +1 -0
- package/dist/utils/{types.d.ts → types.d.cts} +2 -1
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +18 -0
- package/dist/utils/types.d.mts.map +1 -0
- package/dist/utils/types.mjs +26 -0
- package/dist/utils/types.mjs.map +1 -0
- package/dist/utils/{typing.js → typing.cjs} +2 -3
- package/dist/utils/{typing.js.map → typing.cjs.map} +1 -1
- package/dist/utils/{typing.d.ts → typing.d.cts} +1 -0
- package/dist/utils/typing.d.cts.map +1 -0
- package/dist/utils/typing.d.mts +33 -0
- package/dist/utils/typing.d.mts.map +1 -0
- package/dist/utils/typing.mjs +17 -0
- package/dist/utils/typing.mjs.map +1 -0
- package/package.json +19 -8
- package/dist/JsonRpcRequest.js.map +0 -1
- package/dist/KeyringClient.js.map +0 -1
- package/dist/KeyringSnapRpcClient.js.map +0 -1
- package/dist/api/account.js.map +0 -1
- package/dist/api/balance.js.map +0 -1
- package/dist/api/caip.js.map +0 -1
- package/dist/api/export.js.map +0 -1
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js.map +0 -1
- package/dist/api/keyring.js.map +0 -1
- package/dist/api/request.js.map +0 -1
- package/dist/api/response.js.map +0 -1
- package/dist/btc/index.d.ts +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/btc/types.js.map +0 -1
- package/dist/contexts.js.map +0 -1
- package/dist/eth/erc4337/index.d.ts +0 -1
- package/dist/eth/erc4337/index.js.map +0 -1
- package/dist/eth/erc4337/types.js.map +0 -1
- package/dist/eth/index.d.ts +0 -3
- package/dist/eth/index.js.map +0 -1
- package/dist/eth/types.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/internal/api.js.map +0 -1
- package/dist/internal/eth/EthKeyring.js.map +0 -1
- package/dist/internal/eth/index.d.ts +0 -1
- package/dist/internal/eth/index.js.map +0 -1
- package/dist/internal/events.js.map +0 -1
- package/dist/internal/index.d.ts +0 -5
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/types.js.map +0 -1
- package/dist/rpc-handler.js.map +0 -1
- package/dist/snap-utils.js.map +0 -1
- package/dist/sol/index.d.ts +0 -1
- package/dist/sol/index.js.map +0 -1
- package/dist/sol/types.js.map +0 -1
- package/dist/superstruct.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/types.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,MAAM,kBAAkB;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;IAQH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { array, enums, record, string } from "@metamask/superstruct";
|
2
|
+
import { JsonStruct } from "@metamask/utils";
|
3
|
+
import { object } from "../superstruct.mjs";
|
4
|
+
import { UuidStruct } from "../utils/index.mjs";
|
5
|
+
/**
|
6
|
+
* Supported Ethereum account types.
|
7
|
+
*/
|
8
|
+
export var EthAccountType;
|
9
|
+
(function (EthAccountType) {
|
10
|
+
EthAccountType["Eoa"] = "eip155:eoa";
|
11
|
+
EthAccountType["Erc4337"] = "eip155:erc4337";
|
12
|
+
})(EthAccountType || (EthAccountType = {}));
|
13
|
+
/**
|
14
|
+
* Supported Bitcoin account types.
|
15
|
+
*/
|
16
|
+
export var BtcAccountType;
|
17
|
+
(function (BtcAccountType) {
|
18
|
+
BtcAccountType["P2wpkh"] = "bip122:p2wpkh";
|
19
|
+
})(BtcAccountType || (BtcAccountType = {}));
|
20
|
+
/**
|
21
|
+
* Supported Solana account types.
|
22
|
+
*/
|
23
|
+
export var SolAccountType;
|
24
|
+
(function (SolAccountType) {
|
25
|
+
SolAccountType["DataAccount"] = "solana:data-account";
|
26
|
+
})(SolAccountType || (SolAccountType = {}));
|
27
|
+
/**
|
28
|
+
* A struct which represents a Keyring account object. It is abstract enough to
|
29
|
+
* be used with any blockchain. Specific blockchain account types should extend
|
30
|
+
* this struct.
|
31
|
+
*
|
32
|
+
* See {@link KeyringAccount}.
|
33
|
+
*/
|
34
|
+
export const KeyringAccountStruct = object({
|
35
|
+
/**
|
36
|
+
* Account ID (UUIDv4).
|
37
|
+
*/
|
38
|
+
id: UuidStruct,
|
39
|
+
/**
|
40
|
+
* Account type.
|
41
|
+
*/
|
42
|
+
type: enums([
|
43
|
+
`${EthAccountType.Eoa}`,
|
44
|
+
`${EthAccountType.Erc4337}`,
|
45
|
+
`${BtcAccountType.P2wpkh}`,
|
46
|
+
`${SolAccountType.DataAccount}`,
|
47
|
+
]),
|
48
|
+
/**
|
49
|
+
* Account main address.
|
50
|
+
*/
|
51
|
+
address: string(),
|
52
|
+
/**
|
53
|
+
* Account options.
|
54
|
+
*/
|
55
|
+
options: record(string(), JsonStruct),
|
56
|
+
/**
|
57
|
+
* Account supported methods.
|
58
|
+
*/
|
59
|
+
methods: array(string()),
|
60
|
+
});
|
61
|
+
//# sourceMappingURL=account.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,MAAM,EAAE,2BAAuB;AACxC,OAAO,EAAE,UAAU,EAAE,2BAAiB;AAEtC;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,WAAW,EAAE;KAChC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2wpkh = 'bip122:p2wpkh',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2wpkh}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2wpkh}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
@@ -2,10 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.BalanceStruct = void 0;
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
5
|
-
const superstruct_2 = require("../superstruct");
|
6
|
-
const utils_1 = require("../utils");
|
5
|
+
const superstruct_2 = require("../superstruct.cjs");
|
6
|
+
const utils_1 = require("../utils/index.cjs");
|
7
7
|
exports.BalanceStruct = (0, superstruct_2.object)({
|
8
8
|
amount: utils_1.StringNumberStruct,
|
9
9
|
unit: (0, superstruct_1.string)(),
|
10
10
|
});
|
11
|
-
//# sourceMappingURL=balance.
|
11
|
+
//# sourceMappingURL=balance.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"balance.cjs","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AAE/C,oDAAwC;AACxC,8CAA8C;AAEjC,QAAA,aAAa,GAAG,IAAA,oBAAM,EAAC;IAClC,MAAM,EAAE,0BAAkB;IAC1B,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nimport { object } from '../superstruct';\nimport { StringNumberStruct } from '../utils';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Infer } from
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
2
|
export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
3
3
|
amount: string;
|
4
4
|
unit: string;
|
@@ -7,3 +7,4 @@ export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
|
7
7
|
unit: import("@metamask/superstruct").Struct<string, null>;
|
8
8
|
}>;
|
9
9
|
export type Balance = Infer<typeof BalanceStruct>;
|
10
|
+
//# sourceMappingURL=balance.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"balance.d.cts","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
|
+
export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
3
|
+
amount: string;
|
4
|
+
unit: string;
|
5
|
+
}, {
|
6
|
+
amount: import("@metamask/superstruct").Struct<string, null>;
|
7
|
+
unit: import("@metamask/superstruct").Struct<string, null>;
|
8
|
+
}>;
|
9
|
+
export type Balance = Infer<typeof BalanceStruct>;
|
10
|
+
//# sourceMappingURL=balance.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"balance.d.mts","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { string } from "@metamask/superstruct";
|
2
|
+
import { object } from "../superstruct.mjs";
|
3
|
+
import { StringNumberStruct } from "../utils/index.mjs";
|
4
|
+
export const BalanceStruct = object({
|
5
|
+
amount: StringNumberStruct,
|
6
|
+
unit: string(),
|
7
|
+
});
|
8
|
+
//# sourceMappingURL=balance.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"balance.mjs","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/C,OAAO,EAAE,MAAM,EAAE,2BAAuB;AACxC,OAAO,EAAE,kBAAkB,EAAE,2BAAiB;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nimport { object } from '../superstruct';\nimport { StringNumberStruct } from '../utils';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
|
4
|
+
exports.isCaipAssetType = isCaipAssetType;
|
5
|
+
exports.isCaipAssetId = isCaipAssetId;
|
4
6
|
const superstruct_1 = require("@metamask/superstruct");
|
5
|
-
const superstruct_2 = require("../superstruct");
|
7
|
+
const superstruct_2 = require("../superstruct.cjs");
|
6
8
|
const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
|
7
9
|
const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
|
8
10
|
/**
|
@@ -28,7 +30,6 @@ exports.CaipAssetIdStruct = (0, superstruct_2.definePattern)('CaipAssetId', CAIP
|
|
28
30
|
function isCaipAssetType(value) {
|
29
31
|
return (0, superstruct_1.is)(value, exports.CaipAssetTypeStruct);
|
30
32
|
}
|
31
|
-
exports.isCaipAssetType = isCaipAssetType;
|
32
33
|
/**
|
33
34
|
* Check if the given value is a {@link CaipAssetId}.
|
34
35
|
*
|
@@ -44,5 +45,4 @@ exports.isCaipAssetType = isCaipAssetType;
|
|
44
45
|
function isCaipAssetId(value) {
|
45
46
|
return (0, superstruct_1.is)(value, exports.CaipAssetIdStruct);
|
46
47
|
}
|
47
|
-
|
48
|
-
//# sourceMappingURL=caip.js.map
|
48
|
+
//# sourceMappingURL=caip.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":";;;AAwCA,0CAEC;AAcD,sCAEC;AA1DD,uDAAuD;AAEvD,oDAA+C;AAE/C,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,2BAAa,EAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,2BAAa,EAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,2BAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,yBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { is, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type Infer } from
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
2
2
|
/**
|
3
3
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
4
4
|
*/
|
@@ -35,3 +35,4 @@ export declare function isCaipAssetType(value: unknown): value is CaipAssetType;
|
|
35
35
|
* ```
|
36
36
|
*/
|
37
37
|
export declare function isCaipAssetId(value: unknown): value is CaipAssetId;
|
38
|
+
//# sourceMappingURL=caip.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAUvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
2
|
+
/**
|
3
|
+
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
4
|
+
*/
|
5
|
+
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<string, null>;
|
6
|
+
export type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;
|
7
|
+
/**
|
8
|
+
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
9
|
+
*/
|
10
|
+
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<string, null>;
|
11
|
+
export type CaipAssetId = Infer<typeof CaipAssetIdStruct>;
|
12
|
+
/**
|
13
|
+
* Check if the given value is a {@link CaipAssetType}.
|
14
|
+
*
|
15
|
+
* @param value - The value to check.
|
16
|
+
* @returns Whether the value is a {@link CaipAssetType}.
|
17
|
+
* @example
|
18
|
+
* ```ts
|
19
|
+
* isCaipAssetType('eip155:1/slip44:60'); // true
|
20
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
|
21
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
export declare function isCaipAssetType(value: unknown): value is CaipAssetType;
|
25
|
+
/**
|
26
|
+
* Check if the given value is a {@link CaipAssetId}.
|
27
|
+
*
|
28
|
+
* @param value - The value to check.
|
29
|
+
* @returns Whether the value is a {@link CaipAssetId}.
|
30
|
+
* @example
|
31
|
+
* ```ts
|
32
|
+
* isCaipAssetType('eip155:1/slip44:60'); // false
|
33
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
|
34
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
|
35
|
+
* ```
|
36
|
+
*/
|
37
|
+
export declare function isCaipAssetId(value: unknown): value is CaipAssetId;
|
38
|
+
//# sourceMappingURL=caip.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAUvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { is } from "@metamask/superstruct";
|
2
|
+
import { definePattern } from "../superstruct.mjs";
|
3
|
+
const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
|
4
|
+
const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
|
5
|
+
/**
|
6
|
+
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
7
|
+
*/
|
8
|
+
export const CaipAssetTypeStruct = definePattern('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
|
9
|
+
/**
|
10
|
+
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
11
|
+
*/
|
12
|
+
export const CaipAssetIdStruct = definePattern('CaipAssetId', CAIP_ASSET_ID_REGEX);
|
13
|
+
/**
|
14
|
+
* Check if the given value is a {@link CaipAssetType}.
|
15
|
+
*
|
16
|
+
* @param value - The value to check.
|
17
|
+
* @returns Whether the value is a {@link CaipAssetType}.
|
18
|
+
* @example
|
19
|
+
* ```ts
|
20
|
+
* isCaipAssetType('eip155:1/slip44:60'); // true
|
21
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
|
22
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
|
23
|
+
* ```
|
24
|
+
*/
|
25
|
+
export function isCaipAssetType(value) {
|
26
|
+
return is(value, CaipAssetTypeStruct);
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Check if the given value is a {@link CaipAssetId}.
|
30
|
+
*
|
31
|
+
* @param value - The value to check.
|
32
|
+
* @returns Whether the value is a {@link CaipAssetId}.
|
33
|
+
* @example
|
34
|
+
* ```ts
|
35
|
+
* isCaipAssetType('eip155:1/slip44:60'); // false
|
36
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
|
37
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export function isCaipAssetId(value) {
|
41
|
+
return is(value, CaipAssetIdStruct);
|
42
|
+
}
|
43
|
+
//# sourceMappingURL=caip.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAc,8BAA8B;AAEvD,OAAO,EAAE,aAAa,EAAE,2BAAuB;AAE/C,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { is, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
|
@@ -4,4 +4,4 @@ exports.KeyringAccountDataStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const utils_1 = require("@metamask/utils");
|
6
6
|
exports.KeyringAccountDataStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct);
|
7
|
-
//# sourceMappingURL=export.
|
7
|
+
//# sourceMappingURL=export.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"export.cjs","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,2CAA6C;AAEhC,QAAA,wBAAwB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Infer } from
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
2
|
export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
3
3
|
/**
|
4
4
|
* Response to a call to `exportAccount`.
|
@@ -6,3 +6,4 @@ export declare const KeyringAccountDataStruct: import("@metamask/superstruct").S
|
|
6
6
|
* The exact response depends on the keyring implementation.
|
7
7
|
*/
|
8
8
|
export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
|
9
|
+
//# sourceMappingURL=export.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"export.d.cts","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
|
+
export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
3
|
+
/**
|
4
|
+
* Response to a call to `exportAccount`.
|
5
|
+
*
|
6
|
+
* The exact response depends on the keyring implementation.
|
7
|
+
*/
|
8
|
+
export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
|
9
|
+
//# sourceMappingURL=export.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"export.d.mts","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"export.mjs","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACvD,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
|
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./account"), exports);
|
18
|
-
__exportStar(require("./balance"), exports);
|
19
|
-
__exportStar(require("./caip"), exports);
|
20
|
-
__exportStar(require("./export"), exports);
|
21
|
-
__exportStar(require("./request"), exports);
|
22
|
-
__exportStar(require("./response"), exports);
|
23
|
-
//# sourceMappingURL=index.
|
17
|
+
__exportStar(require("./account.cjs"), exports);
|
18
|
+
__exportStar(require("./balance.cjs"), exports);
|
19
|
+
__exportStar(require("./caip.cjs"), exports);
|
20
|
+
__exportStar(require("./export.cjs"), exports);
|
21
|
+
__exportStar(require("./request.cjs"), exports);
|
22
|
+
__exportStar(require("./response.cjs"), exports);
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AAEzB,gDAA0B;AAC1B,iDAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport type * from './keyring';\nexport * from './request';\nexport * from './response';\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from "./account.cjs";
|
2
|
+
export * from "./balance.cjs";
|
3
|
+
export * from "./caip.cjs";
|
4
|
+
export * from "./export.cjs";
|
5
|
+
export type * from "./keyring.cjs";
|
6
|
+
export * from "./request.cjs";
|
7
|
+
export * from "./response.cjs";
|
8
|
+
//# sourceMappingURL=index.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from "./account.mjs";
|
2
|
+
export * from "./balance.mjs";
|
3
|
+
export * from "./caip.mjs";
|
4
|
+
export * from "./export.mjs";
|
5
|
+
export type * from "./keyring.mjs";
|
6
|
+
export * from "./request.mjs";
|
7
|
+
export * from "./response.mjs";
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AAEzB,8BAA0B;AAC1B,+BAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport type * from './keyring';\nexport * from './request';\nexport * from './response';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import type { Json } from
|
2
|
-
import type { KeyringAccount } from
|
3
|
-
import type { Balance } from
|
4
|
-
import type { CaipAssetType } from
|
5
|
-
import type { KeyringAccountData } from
|
6
|
-
import type { KeyringRequest } from
|
7
|
-
import type { KeyringResponse } from
|
1
|
+
import type { Json } from "@metamask/utils";
|
2
|
+
import type { KeyringAccount } from "./account.cjs";
|
3
|
+
import type { Balance } from "./balance.cjs";
|
4
|
+
import type { CaipAssetType } from "./caip.cjs";
|
5
|
+
import type { KeyringAccountData } from "./export.cjs";
|
6
|
+
import type { KeyringRequest } from "./request.cjs";
|
7
|
+
import type { KeyringResponse } from "./response.cjs";
|
8
8
|
/**
|
9
9
|
* Keyring interface.
|
10
10
|
*
|
@@ -157,3 +157,4 @@ export type Keyring = {
|
|
157
157
|
*/
|
158
158
|
rejectRequest?(id: string): Promise<void>;
|
159
159
|
};
|
160
|
+
//# sourceMappingURL=keyring.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import type { Json } from "@metamask/utils";
|
2
|
+
import type { KeyringAccount } from "./account.mjs";
|
3
|
+
import type { Balance } from "./balance.mjs";
|
4
|
+
import type { CaipAssetType } from "./caip.mjs";
|
5
|
+
import type { KeyringAccountData } from "./export.mjs";
|
6
|
+
import type { KeyringRequest } from "./request.mjs";
|
7
|
+
import type { KeyringResponse } from "./response.mjs";
|
8
|
+
/**
|
9
|
+
* Keyring interface.
|
10
|
+
*
|
11
|
+
* Represents the functionality and operations related to managing accounts and
|
12
|
+
* handling requests.
|
13
|
+
*/
|
14
|
+
export type Keyring = {
|
15
|
+
/**
|
16
|
+
* List accounts.
|
17
|
+
*
|
18
|
+
* Retrieves an array of KeyringAccount objects representing the available
|
19
|
+
* accounts.
|
20
|
+
*
|
21
|
+
* @returns A promise that resolves to an array of KeyringAccount objects.
|
22
|
+
*/
|
23
|
+
listAccounts(): Promise<KeyringAccount[]>;
|
24
|
+
/**
|
25
|
+
* Get an account.
|
26
|
+
*
|
27
|
+
* Retrieves the KeyringAccount object for the given account ID.
|
28
|
+
*
|
29
|
+
* @param id - The ID of the account to retrieve.
|
30
|
+
* @returns A promise that resolves to the KeyringAccount object if found, or
|
31
|
+
* undefined otherwise.
|
32
|
+
*/
|
33
|
+
getAccount(id: string): Promise<KeyringAccount | undefined>;
|
34
|
+
/**
|
35
|
+
* Create an account.
|
36
|
+
*
|
37
|
+
* Creates a new account with optional, keyring-defined, account options.
|
38
|
+
*
|
39
|
+
* @param options - Keyring-defined options for the account (optional).
|
40
|
+
* @returns A promise that resolves to the newly created KeyringAccount
|
41
|
+
* object without any private information.
|
42
|
+
*/
|
43
|
+
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
|
44
|
+
/**
|
45
|
+
* Retrieve the balances of a given account.
|
46
|
+
*
|
47
|
+
* This method fetches the balances of specified assets for a given account
|
48
|
+
* ID. It returns a promise that resolves to an object where the keys are
|
49
|
+
* asset types and the values are balance objects containing the amount and
|
50
|
+
* unit.
|
51
|
+
*
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* await keyring.getAccountBalances(
|
55
|
+
* '43550276-c7d6-4fac-87c7-00390ad0ce90',
|
56
|
+
* ['bip122:000000000019d6689c085ae165831e93/slip44:0']
|
57
|
+
* );
|
58
|
+
* // Returns something similar to:
|
59
|
+
* // {
|
60
|
+
* // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {
|
61
|
+
* // amount: '0.0001',
|
62
|
+
* // unit: 'BTC',
|
63
|
+
* // }
|
64
|
+
* // }
|
65
|
+
* ```
|
66
|
+
* @param id - ID of the account to retrieve the balances for.
|
67
|
+
* @param assets - Array of asset types (CAIP-19) to retrieve balances for.
|
68
|
+
* @returns A promise that resolves to an object mapping asset types to their
|
69
|
+
* respective balances.
|
70
|
+
*/
|
71
|
+
getAccountBalances?(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
|
72
|
+
/**
|
73
|
+
* Filter supported chains for a given account.
|
74
|
+
*
|
75
|
+
* @param id - ID of the account to be checked.
|
76
|
+
* @param chains - List of chains (CAIP-2) to be checked.
|
77
|
+
* @returns A Promise that resolves to a filtered list of CAIP-2 IDs
|
78
|
+
* representing the supported chains.
|
79
|
+
*/
|
80
|
+
filterAccountChains(id: string, chains: string[]): Promise<string[]>;
|
81
|
+
/**
|
82
|
+
* Update an account.
|
83
|
+
*
|
84
|
+
* Updates the account with the given account object. Does nothing if the
|
85
|
+
* account does not exist.
|
86
|
+
*
|
87
|
+
* @param account - The updated account object.
|
88
|
+
* @returns A promise that resolves when the account is successfully updated.
|
89
|
+
*/
|
90
|
+
updateAccount(account: KeyringAccount): Promise<void>;
|
91
|
+
/**
|
92
|
+
* Delete an account from the keyring.
|
93
|
+
*
|
94
|
+
* Deletes the account with the given ID from the keyring.
|
95
|
+
*
|
96
|
+
* @param id - The ID of the account to delete.
|
97
|
+
* @returns A promise that resolves when the account is successfully deleted.
|
98
|
+
*/
|
99
|
+
deleteAccount(id: string): Promise<void>;
|
100
|
+
/**
|
101
|
+
* Exports an account's private key.
|
102
|
+
*
|
103
|
+
* If the keyring cannot export a private key, this function should throw an
|
104
|
+
* error.
|
105
|
+
*
|
106
|
+
* @param id - The ID of the account to export.
|
107
|
+
* @returns A promise that resolves to the exported account.
|
108
|
+
*/
|
109
|
+
exportAccount?(id: string): Promise<KeyringAccountData>;
|
110
|
+
/**
|
111
|
+
* List all submitted requests.
|
112
|
+
*
|
113
|
+
* Retrieves an array of KeyringRequest objects representing the submitted
|
114
|
+
* requests.
|
115
|
+
*
|
116
|
+
* @returns A promise that resolves to an array of KeyringRequest objects.
|
117
|
+
*/
|
118
|
+
listRequests?(): Promise<KeyringRequest[]>;
|
119
|
+
/**
|
120
|
+
* Get a request.
|
121
|
+
*
|
122
|
+
* Retrieves the KeyringRequest object for the given request ID.
|
123
|
+
*
|
124
|
+
* @param id - The ID of the request to retrieve.
|
125
|
+
* @returns A promise that resolves to the KeyringRequest object if found, or
|
126
|
+
* undefined otherwise.
|
127
|
+
*/
|
128
|
+
getRequest?(id: string): Promise<KeyringRequest | undefined>;
|
129
|
+
/**
|
130
|
+
* Submit a request.
|
131
|
+
*
|
132
|
+
* Submits the given KeyringRequest object.
|
133
|
+
*
|
134
|
+
* @param request - The KeyringRequest object to submit.
|
135
|
+
* @returns A promise that resolves to the request response.
|
136
|
+
*/
|
137
|
+
submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
|
138
|
+
/**
|
139
|
+
* Approve a request.
|
140
|
+
*
|
141
|
+
* Approves the request with the given ID and sets the response if provided.
|
142
|
+
*
|
143
|
+
* @param id - The ID of the request to approve.
|
144
|
+
* @param data - The response to the request (optional).
|
145
|
+
* @returns A promise that resolves when the request is successfully
|
146
|
+
* approved.
|
147
|
+
*/
|
148
|
+
approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;
|
149
|
+
/**
|
150
|
+
* Reject a request.
|
151
|
+
*
|
152
|
+
* Rejects the request with the given ID.
|
153
|
+
*
|
154
|
+
* @param id - The ID of the request to reject.
|
155
|
+
* @returns A promise that resolves when the request is successfully
|
156
|
+
* rejected.
|
157
|
+
*/
|
158
|
+
rejectRequest?(id: string): Promise<void>;
|
159
|
+
};
|
160
|
+
//# sourceMappingURL=keyring.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAElD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|