@metamask/keyring-api 9.0.0 → 10.1.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 +16 -1
- package/LICENSE +18 -0
- package/dist/api/account.d.ts +10 -3
- package/dist/api/account.js +9 -1
- package/dist/api/account.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/api.d.ts +15 -11
- package/dist/internal/events.d.ts +10 -8
- package/dist/internal/types.d.ts +70 -6
- package/dist/internal/types.js +7 -1
- package/dist/internal/types.js.map +1 -1
- package/dist/sol/index.d.ts +1 -0
- package/dist/sol/index.js +18 -0
- package/dist/sol/index.js.map +1 -0
- package/dist/sol/types.d.ts +38 -0
- package/dist/sol/types.js +36 -0
- package/dist/sol/types.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [10.1.0]
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add `solana:data-account` account support ([#93](https://github.com/MetaMask/accounts/pull/93))
|
15
|
+
|
16
|
+
## [10.0.0]
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Add proprietary license ([#83](https://github.com/MetaMask/accounts/pull/83))
|
21
|
+
- **BREAKING:** Bump peer dependency `@metamask/providers` from `^17.2.0` to `^18.1.0` ([#76](https://github.com/MetaMask/accounts/pull/76))
|
22
|
+
|
10
23
|
## [9.0.0]
|
11
24
|
|
12
25
|
### Changed
|
@@ -418,7 +431,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
418
431
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
419
432
|
- Helper functions to create keyring handler in the snap.
|
420
433
|
|
421
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@
|
434
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.1.0...HEAD
|
435
|
+
[10.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.0.0...@metamask/keyring-api@10.1.0
|
436
|
+
[10.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@9.0.0...@metamask/keyring-api@10.0.0
|
422
437
|
[9.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.3...@metamask/keyring-api@9.0.0
|
423
438
|
[8.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.2...@metamask/keyring-api@8.1.3
|
424
439
|
[8.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.1...@metamask/keyring-api@8.1.2
|
package/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright ConsenSys Software Inc. 2022. All rights reserved.
|
2
|
+
|
3
|
+
You acknowledge and agree that ConsenSys Software Inc. (“ConsenSys”) (or ConsenSys’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.
|
4
|
+
|
5
|
+
Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository.
|
6
|
+
|
7
|
+
You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you:
|
8
|
+
1. give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ConsenSys; and
|
9
|
+
2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein.
|
10
|
+
|
11
|
+
“Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by ConsenSys in its sole discretion:
|
12
|
+
1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application;
|
13
|
+
2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or
|
14
|
+
3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time.
|
15
|
+
|
16
|
+
You will not use any trade mark, service mark, trade name, logo of ConsenSys or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos.
|
17
|
+
|
18
|
+
If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at communications@metamask.io.
|
package/dist/api/account.d.ts
CHANGED
@@ -12,10 +12,16 @@ export declare enum EthAccountType {
|
|
12
12
|
export declare enum BtcAccountType {
|
13
13
|
P2wpkh = "bip122:p2wpkh"
|
14
14
|
}
|
15
|
+
/**
|
16
|
+
* Supported Solana account types.
|
17
|
+
*/
|
18
|
+
export declare enum SolAccountType {
|
19
|
+
DataAccount = "solana:data-account"
|
20
|
+
}
|
15
21
|
/**
|
16
22
|
* Supported account types.
|
17
23
|
*/
|
18
|
-
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}`;
|
24
|
+
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}` | `${SolAccountType.DataAccount}`;
|
19
25
|
/**
|
20
26
|
* A struct which represents a Keyring account object. It is abstract enough to
|
21
27
|
* be used with any blockchain. Specific blockchain account types should extend
|
@@ -24,7 +30,7 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
|
|
24
30
|
* See {@link KeyringAccount}.
|
25
31
|
*/
|
26
32
|
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
27
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
33
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
28
34
|
id: string;
|
29
35
|
address: string;
|
30
36
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -37,10 +43,11 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
37
43
|
/**
|
38
44
|
* Account type.
|
39
45
|
*/
|
40
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
46
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
41
47
|
"eip155:eoa": "eip155:eoa";
|
42
48
|
"eip155:erc4337": "eip155:erc4337";
|
43
49
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
50
|
+
"solana:data-account": "solana:data-account";
|
44
51
|
}>;
|
45
52
|
/**
|
46
53
|
* Account main address.
|
package/dist/api/account.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.KeyringAccountStruct = exports.BtcAccountType = exports.EthAccountType = void 0;
|
3
|
+
exports.KeyringAccountStruct = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const utils_1 = require("@metamask/utils");
|
6
6
|
const superstruct_2 = require("../superstruct");
|
@@ -20,6 +20,13 @@ var BtcAccountType;
|
|
20
20
|
(function (BtcAccountType) {
|
21
21
|
BtcAccountType["P2wpkh"] = "bip122:p2wpkh";
|
22
22
|
})(BtcAccountType || (exports.BtcAccountType = BtcAccountType = {}));
|
23
|
+
/**
|
24
|
+
* Supported Solana account types.
|
25
|
+
*/
|
26
|
+
var SolAccountType;
|
27
|
+
(function (SolAccountType) {
|
28
|
+
SolAccountType["DataAccount"] = "solana:data-account";
|
29
|
+
})(SolAccountType || (exports.SolAccountType = SolAccountType = {}));
|
23
30
|
/**
|
24
31
|
* A struct which represents a Keyring account object. It is abstract enough to
|
25
32
|
* be used with any blockchain. Specific blockchain account types should extend
|
@@ -39,6 +46,7 @@ exports.KeyringAccountStruct = (0, superstruct_2.object)({
|
|
39
46
|
`${EthAccountType.Eoa}`,
|
40
47
|
`${EthAccountType.Erc4337}`,
|
41
48
|
`${BtcAccountType.P2wpkh}`,
|
49
|
+
`${SolAccountType.DataAccount}`,
|
42
50
|
]),
|
43
51
|
/**
|
44
52
|
* Account main address.
|
package/dist/api/account.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,gDAAwC;AACxC,oCAAsC;AAEtC;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,gDAAwC;AACxC,oCAAsC;AAEtC;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;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,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,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"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api"), exports);
|
18
18
|
__exportStar(require("./btc"), exports);
|
19
19
|
__exportStar(require("./eth"), exports);
|
20
|
+
__exportStar(require("./sol"), exports);
|
20
21
|
__exportStar(require("./events"), exports);
|
21
22
|
__exportStar(require("./internal"), exports);
|
22
23
|
__exportStar(require("./KeyringClient"), exports);
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AAEtB,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport type * from './contexts';\nexport * from './eth';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AAEtB,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport type * from './contexts';\nexport * from './eth';\nexport * from './sol';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
|
package/dist/internal/api.d.ts
CHANGED
@@ -10,23 +10,24 @@ export declare const ListAccountsRequestStruct: import("@metamask/superstruct").
|
|
10
10
|
}>;
|
11
11
|
export type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
|
12
12
|
export declare const ListAccountsResponseStruct: import("@metamask/superstruct").Struct<{
|
13
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
13
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
14
14
|
id: string;
|
15
15
|
address: string;
|
16
16
|
options: Record<string, import("@metamask/utils").Json>;
|
17
17
|
methods: string[];
|
18
18
|
}[], import("@metamask/superstruct").Struct<{
|
19
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
19
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
20
20
|
id: string;
|
21
21
|
address: string;
|
22
22
|
options: Record<string, import("@metamask/utils").Json>;
|
23
23
|
methods: string[];
|
24
24
|
}, {
|
25
25
|
id: import("@metamask/superstruct").Struct<string, null>;
|
26
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
26
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
27
27
|
"eip155:eoa": "eip155:eoa";
|
28
28
|
"eip155:erc4337": "eip155:erc4337";
|
29
29
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
30
|
+
"solana:data-account": "solana:data-account";
|
30
31
|
}>;
|
31
32
|
address: import("@metamask/superstruct").Struct<string, null>;
|
32
33
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
@@ -52,17 +53,18 @@ export declare const GetAccountRequestStruct: import("@metamask/superstruct").St
|
|
52
53
|
}>;
|
53
54
|
export type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
|
54
55
|
export declare const GetAccountResponseStruct: import("@metamask/superstruct").Struct<{
|
55
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
56
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
56
57
|
id: string;
|
57
58
|
address: string;
|
58
59
|
options: Record<string, import("@metamask/utils").Json>;
|
59
60
|
methods: string[];
|
60
61
|
}, {
|
61
62
|
id: import("@metamask/superstruct").Struct<string, null>;
|
62
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
63
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
63
64
|
"eip155:eoa": "eip155:eoa";
|
64
65
|
"eip155:erc4337": "eip155:erc4337";
|
65
66
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
67
|
+
"solana:data-account": "solana:data-account";
|
66
68
|
}>;
|
67
69
|
address: import("@metamask/superstruct").Struct<string, null>;
|
68
70
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
@@ -88,17 +90,18 @@ export declare const CreateAccountRequestStruct: import("@metamask/superstruct")
|
|
88
90
|
}>;
|
89
91
|
export type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
|
90
92
|
export declare const CreateAccountResponseStruct: import("@metamask/superstruct").Struct<{
|
91
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
93
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
92
94
|
id: string;
|
93
95
|
address: string;
|
94
96
|
options: Record<string, import("@metamask/utils").Json>;
|
95
97
|
methods: string[];
|
96
98
|
}, {
|
97
99
|
id: import("@metamask/superstruct").Struct<string, null>;
|
98
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
100
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
99
101
|
"eip155:eoa": "eip155:eoa";
|
100
102
|
"eip155:erc4337": "eip155:erc4337";
|
101
103
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
104
|
+
"solana:data-account": "solana:data-account";
|
102
105
|
}>;
|
103
106
|
address: import("@metamask/superstruct").Struct<string, null>;
|
104
107
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
@@ -160,7 +163,7 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
|
|
160
163
|
method: "keyring_updateAccount";
|
161
164
|
params: {
|
162
165
|
account: {
|
163
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
166
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
164
167
|
id: string;
|
165
168
|
address: string;
|
166
169
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -171,7 +174,7 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
|
|
171
174
|
method: import("@metamask/superstruct").Struct<"keyring_updateAccount", "keyring_updateAccount">;
|
172
175
|
params: import("@metamask/superstruct").Struct<{
|
173
176
|
account: {
|
174
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
177
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
175
178
|
id: string;
|
176
179
|
address: string;
|
177
180
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -179,17 +182,18 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
|
|
179
182
|
};
|
180
183
|
}, {
|
181
184
|
account: import("@metamask/superstruct").Struct<{
|
182
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
185
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
183
186
|
id: string;
|
184
187
|
address: string;
|
185
188
|
options: Record<string, import("@metamask/utils").Json>;
|
186
189
|
methods: string[];
|
187
190
|
}, {
|
188
191
|
id: import("@metamask/superstruct").Struct<string, null>;
|
189
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
192
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
190
193
|
"eip155:eoa": "eip155:eoa";
|
191
194
|
"eip155:erc4337": "eip155:erc4337";
|
192
195
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
196
|
+
"solana:data-account": "solana:data-account";
|
193
197
|
}>;
|
194
198
|
address: import("@metamask/superstruct").Struct<string, null>;
|
195
199
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
@@ -2,7 +2,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
2
2
|
method: "notify:accountCreated";
|
3
3
|
params: {
|
4
4
|
account: {
|
5
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
5
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
6
6
|
id: string;
|
7
7
|
address: string;
|
8
8
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -15,7 +15,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
15
15
|
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
16
16
|
params: import("@metamask/superstruct").Struct<{
|
17
17
|
account: {
|
18
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
18
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
19
19
|
id: string;
|
20
20
|
address: string;
|
21
21
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -28,17 +28,18 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
28
28
|
* New account object.
|
29
29
|
*/
|
30
30
|
account: import("@metamask/superstruct").Struct<{
|
31
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
31
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
32
32
|
id: string;
|
33
33
|
address: string;
|
34
34
|
options: Record<string, import("@metamask/utils").Json>;
|
35
35
|
methods: string[];
|
36
36
|
}, {
|
37
37
|
id: import("@metamask/superstruct").Struct<string, null>;
|
38
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
38
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
39
39
|
"eip155:eoa": "eip155:eoa";
|
40
40
|
"eip155:erc4337": "eip155:erc4337";
|
41
41
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
42
|
+
"solana:data-account": "solana:data-account";
|
42
43
|
}>;
|
43
44
|
address: import("@metamask/superstruct").Struct<string, null>;
|
44
45
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
@@ -63,7 +64,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
63
64
|
method: "notify:accountUpdated";
|
64
65
|
params: {
|
65
66
|
account: {
|
66
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
67
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
67
68
|
id: string;
|
68
69
|
address: string;
|
69
70
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -74,7 +75,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
74
75
|
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
75
76
|
params: import("@metamask/superstruct").Struct<{
|
76
77
|
account: {
|
77
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
78
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
78
79
|
id: string;
|
79
80
|
address: string;
|
80
81
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -85,17 +86,18 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
85
86
|
* Updated account object.
|
86
87
|
*/
|
87
88
|
account: import("@metamask/superstruct").Struct<{
|
88
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
89
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
89
90
|
id: string;
|
90
91
|
address: string;
|
91
92
|
options: Record<string, import("@metamask/utils").Json>;
|
92
93
|
methods: string[];
|
93
94
|
}, {
|
94
95
|
id: import("@metamask/superstruct").Struct<string, null>;
|
95
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
96
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
96
97
|
"eip155:eoa": "eip155:eoa";
|
97
98
|
"eip155:erc4337": "eip155:erc4337";
|
98
99
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
100
|
+
"solana:data-account": "solana:data-account";
|
99
101
|
}>;
|
100
102
|
address: import("@metamask/superstruct").Struct<string, null>;
|
101
103
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
package/dist/internal/types.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Infer, Struct } from '@metamask/superstruct';
|
2
|
-
import { BtcAccountType, EthAccountType } from '../api';
|
3
|
-
export type InternalAccountType = EthAccountType | BtcAccountType;
|
2
|
+
import { BtcAccountType, EthAccountType, SolAccountType } from '../api';
|
3
|
+
export type InternalAccountType = EthAccountType | BtcAccountType | SolAccountType;
|
4
4
|
export declare const InternalAccountMetadataStruct: Struct<{
|
5
5
|
metadata: {
|
6
6
|
name: string;
|
@@ -249,13 +249,76 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
|
|
249
249
|
id: Struct<string, null>;
|
250
250
|
options: Struct<Record<string, import("@metamask/utils").Json>, null>;
|
251
251
|
}>;
|
252
|
+
export declare const InternalSolDataAccountStruct: Struct<{
|
253
|
+
type: "solana:data-account";
|
254
|
+
id: string;
|
255
|
+
address: string;
|
256
|
+
options: Record<string, import("@metamask/utils").Json>;
|
257
|
+
methods: "sendAndConfirmTransaction"[];
|
258
|
+
metadata: {
|
259
|
+
name: string;
|
260
|
+
importTime: number;
|
261
|
+
keyring: {
|
262
|
+
type: string;
|
263
|
+
};
|
264
|
+
nameLastUpdatedAt?: number;
|
265
|
+
snap?: {
|
266
|
+
id: string;
|
267
|
+
name: string;
|
268
|
+
enabled: boolean;
|
269
|
+
};
|
270
|
+
lastSelected?: number;
|
271
|
+
};
|
272
|
+
}, {
|
273
|
+
metadata: Struct<{
|
274
|
+
name: string;
|
275
|
+
importTime: number;
|
276
|
+
keyring: {
|
277
|
+
type: string;
|
278
|
+
};
|
279
|
+
nameLastUpdatedAt?: number;
|
280
|
+
snap?: {
|
281
|
+
id: string;
|
282
|
+
name: string;
|
283
|
+
enabled: boolean;
|
284
|
+
};
|
285
|
+
lastSelected?: number;
|
286
|
+
}, {
|
287
|
+
name: Struct<string, null>;
|
288
|
+
nameLastUpdatedAt: Struct<number | import("../superstruct").ExactOptionalTag, null>;
|
289
|
+
snap: Struct<import("../superstruct").ExactOptionalTag | {
|
290
|
+
id: string;
|
291
|
+
name: string;
|
292
|
+
enabled: boolean;
|
293
|
+
}, {
|
294
|
+
id: Struct<string, null>;
|
295
|
+
enabled: Struct<boolean, null>;
|
296
|
+
name: Struct<string, null>;
|
297
|
+
}>;
|
298
|
+
lastSelected: Struct<number | import("../superstruct").ExactOptionalTag, null>;
|
299
|
+
importTime: Struct<number, null>;
|
300
|
+
keyring: Struct<{
|
301
|
+
type: string;
|
302
|
+
}, {
|
303
|
+
type: Struct<string, null>;
|
304
|
+
}>;
|
305
|
+
}>;
|
306
|
+
address: Struct<string, null>;
|
307
|
+
type: Struct<"solana:data-account", "solana:data-account">;
|
308
|
+
methods: Struct<"sendAndConfirmTransaction"[], Struct<"sendAndConfirmTransaction", {
|
309
|
+
sendAndConfirmTransaction: "sendAndConfirmTransaction";
|
310
|
+
}>>;
|
311
|
+
id: Struct<string, null>;
|
312
|
+
options: Struct<Record<string, import("@metamask/utils").Json>, null>;
|
313
|
+
}>;
|
252
314
|
export type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
|
253
315
|
export type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
|
254
316
|
export type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
|
255
|
-
export
|
256
|
-
export
|
317
|
+
export type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;
|
318
|
+
export declare const InternalAccountStructs: Record<string, Struct<InternalEthEoaAccount> | Struct<InternalEthErc4337Account> | Struct<InternalBtcP2wpkhAccount> | Struct<InternalSolDataAccount>>;
|
319
|
+
export type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2wpkhAccount | InternalSolDataAccount;
|
257
320
|
export declare const InternalAccountStruct: Struct<{
|
258
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
321
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
259
322
|
id: string;
|
260
323
|
address: string;
|
261
324
|
options: Record<string, import("@metamask/utils").Json>;
|
@@ -309,10 +372,11 @@ export declare const InternalAccountStruct: Struct<{
|
|
309
372
|
}>;
|
310
373
|
}>;
|
311
374
|
id: Struct<string, null>;
|
312
|
-
type: Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
375
|
+
type: Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
313
376
|
"eip155:eoa": "eip155:eoa";
|
314
377
|
"eip155:erc4337": "eip155:erc4337";
|
315
378
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
379
|
+
"solana:data-account": "solana:data-account";
|
316
380
|
}>;
|
317
381
|
address: Struct<string, null>;
|
318
382
|
options: Struct<Record<string, import("@metamask/utils").Json>, null>;
|
package/dist/internal/types.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
|
3
|
+
exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalSolDataAccountStruct = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const api_1 = require("../api");
|
6
6
|
const types_1 = require("../btc/types");
|
7
7
|
const types_2 = require("../eth/types");
|
8
|
+
const types_3 = require("../sol/types");
|
8
9
|
const superstruct_2 = require("../superstruct");
|
9
10
|
exports.InternalAccountMetadataStruct = (0, superstruct_2.object)({
|
10
11
|
metadata: (0, superstruct_2.object)({
|
@@ -34,10 +35,15 @@ exports.InternalBtcP2wpkhAccountStruct = (0, superstruct_2.object)({
|
|
34
35
|
...types_1.BtcP2wpkhAccountStruct.schema,
|
35
36
|
...exports.InternalAccountMetadataStruct.schema,
|
36
37
|
});
|
38
|
+
exports.InternalSolDataAccountStruct = (0, superstruct_2.object)({
|
39
|
+
...types_3.SolDataAccountStruct.schema,
|
40
|
+
...exports.InternalAccountMetadataStruct.schema,
|
41
|
+
});
|
37
42
|
exports.InternalAccountStructs = {
|
38
43
|
[`${api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
|
39
44
|
[`${api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
|
40
45
|
[`${api_1.BtcAccountType.P2wpkh}`]: exports.InternalBtcP2wpkhAccountStruct,
|
46
|
+
[`${api_1.SolAccountType.DataAccount}`]: exports.InternalSolDataAccountStruct,
|
41
47
|
};
|
42
48
|
exports.InternalAccountStruct = (0, superstruct_2.object)({
|
43
49
|
...api_1.KeyringAccountStruct.schema,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,gCAKgB;AAChB,wCAAsD;AACtD,wCAA4E;AAC5E,wCAAoD;AACpD,gDAAuD;AAO1C,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,2BAAmB,CAAC,MAAM;IAC7B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD,GAAG,+BAAuB,CAAC,MAAM;IACjC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,IAAA,oBAAM,EAAC;IACnD,GAAG,8BAAsB,CAAC,MAAM;IAChC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD,GAAG,4BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAcU,QAAA,sBAAsB,GAM/B;IACF,CAAC,GAAG,oBAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;IAC5D,CAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC,EAAE,oCAA4B;CAChE,CAAC;AAQW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n} from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { SolDataAccountStruct } from '../sol/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './types';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./types"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sol/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from './types';\n"]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
/**
|
3
|
+
* Solana addresses are represented in the format of a 256-bit ed25519 public key and
|
4
|
+
* are encoded using base58.
|
5
|
+
* They are usually 32 to 44 characters long.
|
6
|
+
*/
|
7
|
+
export declare const SolAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
8
|
+
/**
|
9
|
+
* Supported Solana methods.
|
10
|
+
*/
|
11
|
+
export declare enum SolMethod {
|
12
|
+
SendAndConfirmTransaction = "sendAndConfirmTransaction"
|
13
|
+
}
|
14
|
+
export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
|
15
|
+
type: "solana:data-account";
|
16
|
+
id: string;
|
17
|
+
address: string;
|
18
|
+
options: Record<string, import("@metamask/utils").Json>;
|
19
|
+
methods: "sendAndConfirmTransaction"[];
|
20
|
+
}, {
|
21
|
+
/**
|
22
|
+
* Account address.
|
23
|
+
*/
|
24
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
25
|
+
/**
|
26
|
+
* Account type.
|
27
|
+
*/
|
28
|
+
type: import("@metamask/superstruct").Struct<"solana:data-account", "solana:data-account">;
|
29
|
+
/**
|
30
|
+
* Account supported methods.
|
31
|
+
*/
|
32
|
+
methods: import("@metamask/superstruct").Struct<"sendAndConfirmTransaction"[], import("@metamask/superstruct").Struct<"sendAndConfirmTransaction", {
|
33
|
+
sendAndConfirmTransaction: "sendAndConfirmTransaction";
|
34
|
+
}>>;
|
35
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
36
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
37
|
+
}>;
|
38
|
+
export type SolDataAccount = Infer<typeof SolDataAccountStruct>;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
5
|
+
const api_1 = require("../api");
|
6
|
+
const superstruct_2 = require("../superstruct");
|
7
|
+
/**
|
8
|
+
* Solana addresses are represented in the format of a 256-bit ed25519 public key and
|
9
|
+
* are encoded using base58.
|
10
|
+
* They are usually 32 to 44 characters long.
|
11
|
+
*/
|
12
|
+
exports.SolAddressStruct = (0, superstruct_2.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
|
13
|
+
/**
|
14
|
+
* Supported Solana methods.
|
15
|
+
*/
|
16
|
+
var SolMethod;
|
17
|
+
(function (SolMethod) {
|
18
|
+
// General transaction methods
|
19
|
+
SolMethod["SendAndConfirmTransaction"] = "sendAndConfirmTransaction";
|
20
|
+
})(SolMethod || (exports.SolMethod = SolMethod = {}));
|
21
|
+
exports.SolDataAccountStruct = (0, superstruct_2.object)({
|
22
|
+
...api_1.KeyringAccountStruct.schema,
|
23
|
+
/**
|
24
|
+
* Account address.
|
25
|
+
*/
|
26
|
+
address: exports.SolAddressStruct,
|
27
|
+
/**
|
28
|
+
* Account type.
|
29
|
+
*/
|
30
|
+
type: (0, superstruct_1.literal)(`${api_1.SolAccountType.DataAccount}`),
|
31
|
+
/**
|
32
|
+
* Account supported methods.
|
33
|
+
*/
|
34
|
+
methods: (0, superstruct_1.array)((0, superstruct_1.enums)([`${SolMethod.SendAndConfirmTransaction}`])),
|
35
|
+
});
|
36
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AACA,uDAA8D;AAE9D,gCAA8D;AAC9D,gDAAuD;AAEvD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,2BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\nimport { object, definePattern } from '../superstruct';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask/keyring-api",
|
3
|
-
"version": "
|
3
|
+
"version": "10.1.0",
|
4
4
|
"description": "MetaMask Keyring API",
|
5
5
|
"keywords": [
|
6
6
|
"metamask",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"@lavamoat/allow-scripts": "^3.2.1",
|
48
48
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
49
49
|
"@metamask/auto-changelog": "^3.4.4",
|
50
|
-
"@metamask/providers": "^
|
50
|
+
"@metamask/providers": "^18.1.0",
|
51
51
|
"@types/jest": "^29.5.12",
|
52
52
|
"@types/node": "^20.12.12",
|
53
53
|
"@types/webextension-polyfill": "^0.12.1",
|
@@ -63,7 +63,7 @@
|
|
63
63
|
"typescript": "~5.4.5"
|
64
64
|
},
|
65
65
|
"peerDependencies": {
|
66
|
-
"@metamask/providers": "^
|
66
|
+
"@metamask/providers": "^18.1.0"
|
67
67
|
},
|
68
68
|
"engines": {
|
69
69
|
"node": "^18.18 || >=20"
|