@metamask-previews/keyring-api 21.1.0-8202c83 → 21.3.0-ca02a28
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 +31 -1
- package/README.md +11 -0
- package/dist/api/account.cjs +15 -1
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +14 -0
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +14 -0
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +14 -0
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs +0 -2
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +0 -2
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/v2/create-account/bip44.cjs +57 -0
- package/dist/api/v2/create-account/bip44.cjs.map +1 -0
- package/dist/api/v2/create-account/bip44.d.cts +83 -0
- package/dist/api/v2/create-account/bip44.d.cts.map +1 -0
- package/dist/api/v2/create-account/bip44.d.mts +83 -0
- package/dist/api/v2/create-account/bip44.d.mts.map +1 -0
- package/dist/api/v2/create-account/bip44.mjs +54 -0
- package/dist/api/v2/create-account/bip44.mjs.map +1 -0
- package/dist/api/v2/create-account/index.cjs +72 -0
- package/dist/api/v2/create-account/index.cjs.map +1 -0
- package/dist/api/v2/create-account/index.d.cts +58 -0
- package/dist/api/v2/create-account/index.d.cts.map +1 -0
- package/dist/api/v2/create-account/index.d.mts +58 -0
- package/dist/api/v2/create-account/index.d.mts.map +1 -0
- package/dist/api/v2/create-account/index.mjs +55 -0
- package/dist/api/v2/create-account/index.mjs.map +1 -0
- package/dist/api/v2/create-account/private-key.cjs +28 -0
- package/dist/api/v2/create-account/private-key.cjs.map +1 -0
- package/dist/api/v2/create-account/private-key.d.cts +45 -0
- package/dist/api/v2/create-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/create-account/private-key.d.mts +45 -0
- package/dist/api/v2/create-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/create-account/private-key.mjs +25 -0
- package/dist/api/v2/create-account/private-key.mjs.map +1 -0
- package/dist/api/v2/export-account/index.cjs +38 -0
- package/dist/api/v2/export-account/index.cjs.map +1 -0
- package/dist/api/v2/export-account/index.d.cts +48 -0
- package/dist/api/v2/export-account/index.d.cts.map +1 -0
- package/dist/api/v2/export-account/index.d.mts +48 -0
- package/dist/api/v2/export-account/index.d.mts.map +1 -0
- package/dist/api/v2/export-account/index.mjs +21 -0
- package/dist/api/v2/export-account/index.mjs.map +1 -0
- package/dist/api/v2/export-account/private-key.cjs +36 -0
- package/dist/api/v2/export-account/private-key.cjs.map +1 -0
- package/dist/api/v2/export-account/private-key.d.cts +53 -0
- package/dist/api/v2/export-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/export-account/private-key.d.mts +53 -0
- package/dist/api/v2/export-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/export-account/private-key.mjs +33 -0
- package/dist/api/v2/export-account/private-key.mjs.map +1 -0
- package/dist/api/v2/index.cjs +23 -0
- package/dist/api/v2/index.cjs.map +1 -0
- package/dist/api/v2/index.d.cts +8 -0
- package/dist/api/v2/index.d.cts.map +1 -0
- package/dist/api/v2/index.d.mts +8 -0
- package/dist/api/v2/index.d.mts.map +1 -0
- package/dist/api/v2/index.mjs +7 -0
- package/dist/api/v2/index.mjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.cjs +46 -0
- package/dist/api/v2/keyring-capabilities.cjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.cts +128 -0
- package/dist/api/v2/keyring-capabilities.d.cts.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.mts +128 -0
- package/dist/api/v2/keyring-capabilities.d.mts.map +1 -0
- package/dist/api/v2/keyring-capabilities.mjs +43 -0
- package/dist/api/v2/keyring-capabilities.mjs.map +1 -0
- package/dist/api/v2/keyring-type.cjs +44 -0
- package/dist/api/v2/keyring-type.cjs.map +1 -0
- package/dist/api/v2/keyring-type.d.cts +40 -0
- package/dist/api/v2/keyring-type.d.cts.map +1 -0
- package/dist/api/v2/keyring-type.d.mts +40 -0
- package/dist/api/v2/keyring-type.d.mts.map +1 -0
- package/dist/api/v2/keyring-type.mjs +41 -0
- package/dist/api/v2/keyring-type.mjs.map +1 -0
- package/dist/api/v2/keyring.cjs +3 -0
- package/dist/api/v2/keyring.cjs.map +1 -0
- package/dist/api/v2/keyring.d.cts +107 -0
- package/dist/api/v2/keyring.d.cts.map +1 -0
- package/dist/api/v2/keyring.d.mts +107 -0
- package/dist/api/v2/keyring.d.mts.map +1 -0
- package/dist/api/v2/keyring.mjs +2 -0
- package/dist/api/v2/keyring.mjs.map +1 -0
- package/dist/api/v2/private-key.cjs +53 -0
- package/dist/api/v2/private-key.cjs.map +1 -0
- package/dist/api/v2/private-key.d.cts +77 -0
- package/dist/api/v2/private-key.d.cts.map +1 -0
- package/dist/api/v2/private-key.d.mts +77 -0
- package/dist/api/v2/private-key.d.mts.map +1 -0
- package/dist/api/v2/private-key.mjs +50 -0
- package/dist/api/v2/private-key.mjs.map +1 -0
- package/dist/api/v2/wrapper/index.cjs +19 -0
- package/dist/api/v2/wrapper/index.cjs.map +1 -0
- package/dist/api/v2/wrapper/index.d.cts +3 -0
- package/dist/api/v2/wrapper/index.d.cts.map +1 -0
- package/dist/api/v2/wrapper/index.d.mts +3 -0
- package/dist/api/v2/wrapper/index.d.mts.map +1 -0
- package/dist/api/v2/wrapper/index.mjs +3 -0
- package/dist/api/v2/wrapper/index.mjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.cjs +135 -0
- package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts +88 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts +88 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.mjs +131 -0
- package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.cjs +116 -0
- package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts +146 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts +146 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.mjs +112 -0
- package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -0
- package/dist/eth/erc4337/types.d.cts +4 -4
- package/dist/eth/erc4337/types.d.mts +4 -4
- package/dist/eth/index.cjs +2 -0
- package/dist/eth/index.cjs.map +1 -1
- package/dist/eth/index.d.cts +2 -0
- package/dist/eth/index.d.cts.map +1 -1
- package/dist/eth/index.d.mts +2 -0
- package/dist/eth/index.d.mts.map +1 -1
- package/dist/eth/index.mjs +2 -0
- package/dist/eth/index.mjs.map +1 -1
- package/dist/eth/rpc/index.cjs +18 -0
- package/dist/eth/rpc/index.cjs.map +1 -0
- package/dist/eth/rpc/index.d.cts +2 -0
- package/dist/eth/rpc/index.d.cts.map +1 -0
- package/dist/eth/rpc/index.d.mts +2 -0
- package/dist/eth/rpc/index.d.mts.map +1 -0
- package/dist/eth/rpc/index.mjs +2 -0
- package/dist/eth/rpc/index.mjs.map +1 -0
- package/dist/eth/rpc/params.cjs +151 -0
- package/dist/eth/rpc/params.cjs.map +1 -0
- package/dist/eth/rpc/params.d.cts +215 -0
- package/dist/eth/rpc/params.d.cts.map +1 -0
- package/dist/eth/rpc/params.d.mts +215 -0
- package/dist/eth/rpc/params.d.mts.map +1 -0
- package/dist/eth/rpc/params.mjs +148 -0
- package/dist/eth/rpc/params.mjs.map +1 -0
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +5 -5
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +5 -5
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/v2/eth-keyring-wrapper.cjs +165 -0
- package/dist/eth/v2/eth-keyring-wrapper.cjs.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.cts +54 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.mts +54 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.mjs +161 -0
- package/dist/eth/v2/eth-keyring-wrapper.mjs.map +1 -0
- package/dist/eth/v2/index.cjs +18 -0
- package/dist/eth/v2/index.cjs.map +1 -0
- package/dist/eth/v2/index.d.cts +2 -0
- package/dist/eth/v2/index.d.cts.map +1 -0
- package/dist/eth/v2/index.d.mts +2 -0
- package/dist/eth/v2/index.d.mts.map +1 -0
- package/dist/eth/v2/index.mjs +2 -0
- package/dist/eth/v2/index.mjs.map +1 -0
- package/dist/events.cjs +0 -2
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +0 -2
- package/dist/events.mjs.map +1 -1
- package/dist/trx/types.cjs +4 -0
- package/dist/trx/types.cjs.map +1 -1
- package/dist/trx/types.d.cts +4 -0
- package/dist/trx/types.d.cts.map +1 -1
- package/dist/trx/types.d.mts +4 -0
- package/dist/trx/types.d.mts.map +1 -1
- package/dist/trx/types.mjs +4 -0
- package/dist/trx/types.mjs.map +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add `EthKeyringWrapper` abstract class for Ethereum-based `KeyringV2` implementations ([#404](https://github.com/MetaMask/accounts/pull/404))
|
|
13
|
+
- Provides common Ethereum signing method routing (`submitRequest`) for all Ethereum-based keyrings.
|
|
14
|
+
- Add `KeyringWrapper` base class to adapt legacy keyrings to `KeyringV2` ([#398](https://github.com/MetaMask/accounts/pull/398)), ([#410](https://github.com/MetaMask/accounts/pull/410))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Refine `EthAddressStruct` in order to make it compatible with the `Hex` type from `@metamask/utils` ([#405](https://github.com/MetaMask/accounts/pull/405))
|
|
19
|
+
|
|
20
|
+
## [21.3.0]
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Add initial `Keyringv2` interface ([#397](https://github.com/MetaMask/accounts/pull/397))
|
|
25
|
+
- This is an on-going work and should not be used for now.
|
|
26
|
+
- Add new Tron methods `signMessage` and `signTransaction` ([#401](https://github.com/MetaMask/accounts/pull/401))
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Deprecate Tron methods `signMessageV2` and `verifyMessageV2` ([#401](https://github.com/MetaMask/accounts/pull/401))
|
|
31
|
+
|
|
32
|
+
## [21.2.0]
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Add `stake:{deposit,withdraw}` transaction types ([#394](https://github.com/MetaMask/accounts/pull/394))
|
|
37
|
+
|
|
10
38
|
## [21.1.0]
|
|
11
39
|
|
|
12
40
|
### Added
|
|
@@ -637,7 +665,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
637
665
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
|
638
666
|
- Helper functions to create keyring handler in the snap.
|
|
639
667
|
|
|
640
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.
|
|
668
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.3.0...HEAD
|
|
669
|
+
[21.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.2.0...@metamask/keyring-api@21.3.0
|
|
670
|
+
[21.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.1.0...@metamask/keyring-api@21.2.0
|
|
641
671
|
[21.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@21.0.0...@metamask/keyring-api@21.1.0
|
|
642
672
|
[21.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.1.1...@metamask/keyring-api@21.0.0
|
|
643
673
|
[20.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.1.0...@metamask/keyring-api@20.1.1
|
package/README.md
CHANGED
|
@@ -223,6 +223,17 @@ these instruction assume that you are already familiar with the process of
|
|
|
223
223
|
const accounts = await client.listAccounts();
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
+
## KeyringV2 Interface (WIP, not implemented yet)
|
|
227
|
+
|
|
228
|
+
A unified keyring interface, designed to work for both native (EVM) keyrings and Snap keyrings, and to support non‑EVM chains and new features like backup & sync.
|
|
229
|
+
|
|
230
|
+
- Interface name: `KeyringV2`
|
|
231
|
+
- Location: `@metamask/keyring-api/src/api/v2/keyring.ts`
|
|
232
|
+
|
|
233
|
+
### Keyring wrapper
|
|
234
|
+
|
|
235
|
+
The `KeyringWrapper` helper adapts existing keyrings that implement the legacy `Keyring` interface to the new `KeyringV2` interface. It is intended to be subclassed in concrete keyrings, overriding the account management and request-handling methods to delegate to the underlying implementation.
|
|
236
|
+
|
|
226
237
|
## Migrating from 0.1.x to 0.2.x
|
|
227
238
|
|
|
228
239
|
The following changes were made to the API, which may require changes to your
|
package/dist/api/account.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyringAccountStruct = exports.AnyAccountType = exports.TrxAccountType = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
|
|
3
|
+
exports.KeyringAccountStruct = exports.KeyringAccountTypeStruct = exports.AnyAccountType = exports.TrxAccountType = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
|
|
4
4
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
5
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
6
6
|
const account_options_1 = require("./account-options.cjs");
|
|
@@ -45,6 +45,20 @@ var AnyAccountType;
|
|
|
45
45
|
(function (AnyAccountType) {
|
|
46
46
|
AnyAccountType["Account"] = "any:account";
|
|
47
47
|
})(AnyAccountType || (exports.AnyAccountType = AnyAccountType = {}));
|
|
48
|
+
/**
|
|
49
|
+
* Struct for {@link KeyringAccountType}.
|
|
50
|
+
*/
|
|
51
|
+
exports.KeyringAccountTypeStruct = (0, superstruct_1.enums)([
|
|
52
|
+
`${EthAccountType.Eoa}`,
|
|
53
|
+
`${EthAccountType.Erc4337}`,
|
|
54
|
+
`${BtcAccountType.P2pkh}`,
|
|
55
|
+
`${BtcAccountType.P2sh}`,
|
|
56
|
+
`${BtcAccountType.P2wpkh}`,
|
|
57
|
+
`${BtcAccountType.P2tr}`,
|
|
58
|
+
`${SolAccountType.DataAccount}`,
|
|
59
|
+
`${TrxAccountType.Eoa}`,
|
|
60
|
+
`${AnyAccountType.Account}`,
|
|
61
|
+
]);
|
|
48
62
|
/**
|
|
49
63
|
* A struct which represents a Keyring account object. It is abstract enough to
|
|
50
64
|
* be used with any blockchain. Specific blockchain account types should extend
|
package/dist/api/account.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AO,EAAE;KAC5B,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,6CAA2B;IAEpC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, string } from '@metamask/superstruct';\n\nimport { KeyringAccountOptionsStruct } from './account-options';\nimport { CaipChainIdStruct } from './caip';\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 P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported Tron account types.\n */\nexport enum TrxAccountType {\n Eoa = 'tron:eoa',\n}\n\n/**\n * A generic account type. It can be used to represent any account type that is\n * not covered by the other account types. It only applies to non-EVM chains.\n */\nexport enum AnyAccountType {\n Account = 'any:account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`\n | `${TrxAccountType.Eoa}`\n | `${AnyAccountType.Account}`;\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: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: KeyringAccountOptionsStruct,\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"]}
|
|
1
|
+
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AAAA,2DAAkE;AAElE,uDAAuE;AAEvE,2DAAgE;AAChE,qCAA2C;AAE3C;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,wCAAsB,CAAA;IACtB,sCAAoB,CAAA;IACpB,0CAAwB,CAAA;IACxB,sCAAoB,CAAA;AACtB,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,kCAAgB,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E,6CAA2B;IAEpC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, string } from '@metamask/superstruct';\n\nimport { KeyringAccountOptionsStruct } from './account-options';\nimport { CaipChainIdStruct } from './caip';\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 P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported Tron account types.\n */\nexport enum TrxAccountType {\n Eoa = 'tron:eoa',\n}\n\n/**\n * A generic account type. It can be used to represent any account type that is\n * not covered by the other account types. It only applies to non-EVM chains.\n */\nexport enum AnyAccountType {\n Account = 'any:account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`\n | `${TrxAccountType.Eoa}`\n | `${AnyAccountType.Account}`;\n\n/**\n * Struct for {@link KeyringAccountType}.\n */\nexport const KeyringAccountTypeStruct = enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n]);\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: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: KeyringAccountOptionsStruct,\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"]}
|
package/dist/api/account.d.cts
CHANGED
|
@@ -38,6 +38,20 @@ export declare enum AnyAccountType {
|
|
|
38
38
|
* Supported account types.
|
|
39
39
|
*/
|
|
40
40
|
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${TrxAccountType.Eoa}` | `${AnyAccountType.Account}`;
|
|
41
|
+
/**
|
|
42
|
+
* Struct for {@link KeyringAccountType}.
|
|
43
|
+
*/
|
|
44
|
+
export declare const KeyringAccountTypeStruct: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
45
|
+
"eip155:eoa": "eip155:eoa";
|
|
46
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
47
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
48
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
49
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
50
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
51
|
+
"solana:data-account": "solana:data-account";
|
|
52
|
+
"tron:eoa": "tron:eoa";
|
|
53
|
+
"any:account": "any:account";
|
|
54
|
+
}>;
|
|
41
55
|
/**
|
|
42
56
|
* A struct which represents a Keyring account object. It is abstract enough to
|
|
43
57
|
* be used with any blockchain. Specific blockchain account types should extend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAA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AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;EAUnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAaH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/account.d.mts
CHANGED
|
@@ -38,6 +38,20 @@ export declare enum AnyAccountType {
|
|
|
38
38
|
* Supported account types.
|
|
39
39
|
*/
|
|
40
40
|
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${TrxAccountType.Eoa}` | `${AnyAccountType.Account}`;
|
|
41
|
+
/**
|
|
42
|
+
* Struct for {@link KeyringAccountType}.
|
|
43
|
+
*/
|
|
44
|
+
export declare const KeyringAccountTypeStruct: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
45
|
+
"eip155:eoa": "eip155:eoa";
|
|
46
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
47
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
48
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
49
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
50
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
51
|
+
"solana:data-account": "solana:data-account";
|
|
52
|
+
"tron:eoa": "tron:eoa";
|
|
53
|
+
"any:account": "any:account";
|
|
54
|
+
}>;
|
|
41
55
|
/**
|
|
42
56
|
* A struct which represents a Keyring account object. It is abstract enough to
|
|
43
57
|
* be used with any blockchain. Specific blockchain account types should extend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAaH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;EAUnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAaH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/account.mjs
CHANGED
|
@@ -42,6 +42,20 @@ export var AnyAccountType;
|
|
|
42
42
|
(function (AnyAccountType) {
|
|
43
43
|
AnyAccountType["Account"] = "any:account";
|
|
44
44
|
})(AnyAccountType || (AnyAccountType = {}));
|
|
45
|
+
/**
|
|
46
|
+
* Struct for {@link KeyringAccountType}.
|
|
47
|
+
*/
|
|
48
|
+
export const KeyringAccountTypeStruct = enums([
|
|
49
|
+
`${EthAccountType.Eoa}`,
|
|
50
|
+
`${EthAccountType.Erc4337}`,
|
|
51
|
+
`${BtcAccountType.P2pkh}`,
|
|
52
|
+
`${BtcAccountType.P2sh}`,
|
|
53
|
+
`${BtcAccountType.P2wpkh}`,
|
|
54
|
+
`${BtcAccountType.P2tr}`,
|
|
55
|
+
`${SolAccountType.DataAccount}`,
|
|
56
|
+
`${TrxAccountType.Eoa}`,
|
|
57
|
+
`${AnyAccountType.Account}`,
|
|
58
|
+
]);
|
|
45
59
|
/**
|
|
46
60
|
* A struct which represents a Keyring account object. It is abstract enough to
|
|
47
61
|
* be used with any blockchain. Specific blockchain account types should extend
|
package/dist/api/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gCAAgC;AAElE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAEvE,OAAO,EAAE,2BAA2B,EAAE,8BAA0B;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAE3C;;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,cAKX;AALD,WAAY,cAAc;IACxB,wCAAsB,CAAA;IACtB,sCAAoB,CAAA;IACpB,0CAAwB,CAAA;IACxB,sCAAoB,CAAA;AACtB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,kCAAgB,CAAA;AAClB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,yCAAuB,CAAA;AACzB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAgBD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,eAAe;IAEnB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,KAAK,EAAE;QACzB,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,WAAW,EAAE;QAC/B,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;KAC5B,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,2BAA2B;IAEpC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, string } from '@metamask/superstruct';\n\nimport { KeyringAccountOptionsStruct } from './account-options';\nimport { CaipChainIdStruct } from './caip';\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 P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported Tron account types.\n */\nexport enum TrxAccountType {\n Eoa = 'tron:eoa',\n}\n\n/**\n * A generic account type. It can be used to represent any account type that is\n * not covered by the other account types. It only applies to non-EVM chains.\n */\nexport enum AnyAccountType {\n Account = 'any:account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`\n | `${TrxAccountType.Eoa}`\n | `${AnyAccountType.Account}`;\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: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: KeyringAccountOptionsStruct,\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"]}
|
|
1
|
+
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gCAAgC;AAElE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAEvE,OAAO,EAAE,2BAA2B,EAAE,8BAA0B;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAE3C;;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,cAKX;AALD,WAAY,cAAc;IACxB,wCAAsB,CAAA;IACtB,sCAAoB,CAAA;IACpB,0CAAwB,CAAA;IACxB,sCAAoB,CAAA;AACtB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,kCAAgB,CAAA;AAClB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,yCAAuB,CAAA;AACzB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAgBD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;IAC5C,GAAG,cAAc,CAAC,GAAG,EAAE;IACvB,GAAG,cAAc,CAAC,OAAO,EAAE;IAC3B,GAAG,cAAc,CAAC,KAAK,EAAE;IACzB,GAAG,cAAc,CAAC,IAAI,EAAE;IACxB,GAAG,cAAc,CAAC,MAAM,EAAE;IAC1B,GAAG,cAAc,CAAC,IAAI,EAAE;IACxB,GAAG,cAAc,CAAC,WAAW,EAAE;IAC/B,GAAG,cAAc,CAAC,GAAG,EAAE;IACvB,GAAG,cAAc,CAAC,OAAO,EAAE;CAC5B,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,eAAe;IAEnB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,KAAK,EAAE;QACzB,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,WAAW,EAAE;QAC/B,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;KAC5B,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,2BAA2B;IAEpC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, string } from '@metamask/superstruct';\n\nimport { KeyringAccountOptionsStruct } from './account-options';\nimport { CaipChainIdStruct } from './caip';\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 P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported Tron account types.\n */\nexport enum TrxAccountType {\n Eoa = 'tron:eoa',\n}\n\n/**\n * A generic account type. It can be used to represent any account type that is\n * not covered by the other account types. It only applies to non-EVM chains.\n */\nexport enum AnyAccountType {\n Account = 'any:account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`\n | `${TrxAccountType.Eoa}`\n | `${AnyAccountType.Account}`;\n\n/**\n * Struct for {@link KeyringAccountType}.\n */\nexport const KeyringAccountTypeStruct = enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n]);\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: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n `${TrxAccountType.Eoa}`,\n `${AnyAccountType.Account}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: KeyringAccountOptionsStruct,\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"]}
|
package/dist/api/index.cjs
CHANGED
|
@@ -27,4 +27,5 @@ __exportStar(require("./response.cjs"), exports);
|
|
|
27
27
|
__exportStar(require("./transaction.cjs"), exports);
|
|
28
28
|
__exportStar(require("./pagination.cjs"), exports);
|
|
29
29
|
__exportStar(require("./options.cjs"), exports);
|
|
30
|
+
__exportStar(require("./v2/index.cjs"), exports);
|
|
30
31
|
//# sourceMappingURL=index.cjs.map
|
package/dist/api/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,kDAA4B;AAE5B,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B;AAC7B,gDAA0B","sourcesContent":["export * from './account';\nexport * from './account-options';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,kDAA4B;AAE5B,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B;AAC7B,gDAA0B;AAE1B,iDAAqB","sourcesContent":["export * from './account';\nexport * from './account-options';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\nexport * from './v2';\n"]}
|
package/dist/api/index.d.cts
CHANGED
package/dist/api/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B;AAC/B,+BAAqB"}
|
package/dist/api/index.d.mts
CHANGED
package/dist/api/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAC5B,mCAA+B;AAC/B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B;AAC/B,+BAAqB"}
|
package/dist/api/index.mjs
CHANGED
package/dist/api/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAE5B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B","sourcesContent":["export * from './account';\nexport * from './account-options';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,sCAAkC;AAClC,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,gCAA4B;AAE5B,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAE1B,+BAAqB","sourcesContent":["export * from './account';\nexport * from './account-options';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './discovery';\nexport type * from './entropy';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\nexport * from './v2';\n"]}
|
package/dist/api/keyring.cjs
CHANGED
package/dist/api/keyring.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { DiscoveredAccount } from './discovery';\nimport type { EntropySourceId } from './entropy';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\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). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Discover accounts.\n *\n * This method is called by the client to allow the keyring to discover\n * existing accounts based on the provided scopes and entropy source ID. Are\n * considered existing accounts, accounts that have at least one transaction,\n * as per BIP-44.\n *\n * The `groupIndex` is used to group accounts with the same value. In\n * strictly BIP-44 wallets, it matches `account_index`, but in wallets that\n * deviate from BIP-44 recommendations, it may align with a different path\n * level for compatibility.\n *\n * @param scopes - The list of scopes for account discovery.\n * @param entropySource - The ID of the entropy source used to derive the accounts.\n * @param groupIndex - The group index that should be used to derive the accounts.\n * @returns A promise resolving to a list of discovered accounts.\n */\n discoverAccounts?(\n scopes: CaipChainId[],\n entropySource: EntropySourceId,\n groupIndex: number,\n ): Promise<DiscoveredAccount[]>;\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 * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Set the selected accounts.\n *\n * @param accounts - The accounts to set as selected.\n */\n setSelectedAccounts?(accounts: AccountId[]): Promise<void>;\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings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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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,gCAAgC;AACzE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAoB;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAkB;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAkB;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAm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E,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;;;;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"}
|
package/dist/api/keyring.mjs
CHANGED
package/dist/api/keyring.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { DiscoveredAccount } from './discovery';\nimport type { EntropySourceId } from './entropy';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\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). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Discover accounts.\n *\n * This method is called by the client to allow the keyring to discover\n * existing accounts based on the provided scopes and entropy source ID. Are\n * considered existing accounts, accounts that have at least one transaction,\n * as per BIP-44.\n *\n * The `groupIndex` is used to group accounts with the same value. In\n * strictly BIP-44 wallets, it matches `account_index`, but in wallets that\n * deviate from BIP-44 recommendations, it may align with a different path\n * level for compatibility.\n *\n * @param scopes - The list of scopes for account discovery.\n * @param entropySource - The ID of the entropy source used to derive the accounts.\n * @param groupIndex - The group index that should be used to derive the accounts.\n * @returns A promise resolving to a list of discovered accounts.\n */\n discoverAccounts?(\n scopes: CaipChainId[],\n entropySource: EntropySourceId,\n groupIndex: number,\n ): Promise<DiscoveredAccount[]>;\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 * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Set the selected accounts.\n *\n * @param accounts - The accounts to set as selected.\n */\n setSelectedAccounts?(accounts: AccountId[]): Promise<void>;\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"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateAccountBip44DiscoverOptionsStruct = exports.CreateAccountBip44DeriveIndexOptionsStruct = exports.CreateAccountBip44DerivePathOptionsStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const derivation_1 = require("../../derivation.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
8
|
+
*/
|
|
9
|
+
exports.CreateAccountBip44DerivePathOptionsStruct = (0, superstruct_1.object)({
|
|
10
|
+
/**
|
|
11
|
+
* Type of the options.
|
|
12
|
+
*/
|
|
13
|
+
type: (0, superstruct_1.literal)('bip44:derive-path'),
|
|
14
|
+
/**
|
|
15
|
+
* ID of the entropy source to be used to derive the account.
|
|
16
|
+
*/
|
|
17
|
+
entropySource: (0, superstruct_1.string)(),
|
|
18
|
+
/**
|
|
19
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
20
|
+
*/
|
|
21
|
+
derivationPath: derivation_1.DerivationPathStruct,
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
25
|
+
*/
|
|
26
|
+
exports.CreateAccountBip44DeriveIndexOptionsStruct = (0, superstruct_1.object)({
|
|
27
|
+
/**
|
|
28
|
+
* The type of the options.
|
|
29
|
+
*/
|
|
30
|
+
type: (0, superstruct_1.literal)('bip44:derive-index'),
|
|
31
|
+
/**
|
|
32
|
+
* ID of the entropy source to be used to derive the account.
|
|
33
|
+
*/
|
|
34
|
+
entropySource: (0, superstruct_1.string)(),
|
|
35
|
+
/**
|
|
36
|
+
* The index of the account group to be derived.
|
|
37
|
+
*/
|
|
38
|
+
groupIndex: (0, superstruct_1.number)(),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
42
|
+
*/
|
|
43
|
+
exports.CreateAccountBip44DiscoverOptionsStruct = (0, superstruct_1.object)({
|
|
44
|
+
/**
|
|
45
|
+
* The type of the options.
|
|
46
|
+
*/
|
|
47
|
+
type: (0, superstruct_1.literal)('bip44:discover'),
|
|
48
|
+
/**
|
|
49
|
+
* ID of the entropy source to be used to derive the account.
|
|
50
|
+
*/
|
|
51
|
+
entropySource: (0, superstruct_1.string)(),
|
|
52
|
+
/**
|
|
53
|
+
* The index of the account group to be derived.
|
|
54
|
+
*/
|
|
55
|
+
groupIndex: (0, superstruct_1.number)(),
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=bip44.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,qDAAwD;AAExD;;GAEG;AACU,QAAA,yCAAyC,GAAG,IAAA,oBAAM,EAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,uCAAuC,GAAG,IAAA,oBAAM,EAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateAccountBip44DerivePathOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "bip44:derive-path";
|
|
7
|
+
derivationPath: `m/${string}`;
|
|
8
|
+
entropySource: string;
|
|
9
|
+
}, {
|
|
10
|
+
/**
|
|
11
|
+
* Type of the options.
|
|
12
|
+
*/
|
|
13
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-path", "bip44:derive-path">;
|
|
14
|
+
/**
|
|
15
|
+
* ID of the entropy source to be used to derive the account.
|
|
16
|
+
*/
|
|
17
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
18
|
+
/**
|
|
19
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
20
|
+
*/
|
|
21
|
+
derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Options for creating an account using the given BIP-44 derivation path.
|
|
25
|
+
*/
|
|
26
|
+
export type CreateAccountBip44DerivePathOptions = Infer<typeof CreateAccountBip44DerivePathOptionsStruct>;
|
|
27
|
+
/**
|
|
28
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CreateAccountBip44DeriveIndexOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
31
|
+
type: "bip44:derive-index";
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
entropySource: string;
|
|
34
|
+
}, {
|
|
35
|
+
/**
|
|
36
|
+
* The type of the options.
|
|
37
|
+
*/
|
|
38
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-index", "bip44:derive-index">;
|
|
39
|
+
/**
|
|
40
|
+
* ID of the entropy source to be used to derive the account.
|
|
41
|
+
*/
|
|
42
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
43
|
+
/**
|
|
44
|
+
* The index of the account group to be derived.
|
|
45
|
+
*/
|
|
46
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Options for creating an account using the given BIP-44 account group index.
|
|
50
|
+
*
|
|
51
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
52
|
+
* compatibility with other wallets.
|
|
53
|
+
*/
|
|
54
|
+
export type CreateAccountBip44DeriveIndexOptions = Infer<typeof CreateAccountBip44DeriveIndexOptionsStruct>;
|
|
55
|
+
/**
|
|
56
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
57
|
+
*/
|
|
58
|
+
export declare const CreateAccountBip44DiscoverOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
59
|
+
type: "bip44:discover";
|
|
60
|
+
groupIndex: number;
|
|
61
|
+
entropySource: string;
|
|
62
|
+
}, {
|
|
63
|
+
/**
|
|
64
|
+
* The type of the options.
|
|
65
|
+
*/
|
|
66
|
+
type: import("@metamask/superstruct").Struct<"bip44:discover", "bip44:discover">;
|
|
67
|
+
/**
|
|
68
|
+
* ID of the entropy source to be used to derive the account.
|
|
69
|
+
*/
|
|
70
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
71
|
+
/**
|
|
72
|
+
* The index of the account group to be derived.
|
|
73
|
+
*/
|
|
74
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Options for creating accounts by performing a BIP-44 account discovery.
|
|
78
|
+
*
|
|
79
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
80
|
+
* compatibility with other wallets.
|
|
81
|
+
*/
|
|
82
|
+
export type CreateAccountBip44DiscoverOptions = Infer<typeof CreateAccountBip44DiscoverOptionsStruct>;
|
|
83
|
+
//# sourceMappingURL=bip44.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,CACrD,OAAO,yCAAyC,CACjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;IACrD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uCAAuC;;;;;IAClD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,KAAK,CACnD,OAAO,uCAAuC,CAC/C,CAAC"}
|