@metamask/keyring-api 20.0.0 → 20.1.1

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/api/account.cjs +9 -1
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +10 -3
  5. package/dist/api/account.d.cts.map +1 -1
  6. package/dist/api/account.d.mts +10 -3
  7. package/dist/api/account.d.mts.map +1 -1
  8. package/dist/api/account.mjs +8 -0
  9. package/dist/api/account.mjs.map +1 -1
  10. package/dist/btc/types.cjs +10 -3
  11. package/dist/btc/types.cjs.map +1 -1
  12. package/dist/btc/types.d.cts +53 -13
  13. package/dist/btc/types.d.cts.map +1 -1
  14. package/dist/btc/types.d.mts +53 -13
  15. package/dist/btc/types.d.mts.map +1 -1
  16. package/dist/btc/types.mjs +10 -3
  17. package/dist/btc/types.mjs.map +1 -1
  18. package/dist/events.d.cts +10 -8
  19. package/dist/events.d.cts.map +1 -1
  20. package/dist/events.d.mts +10 -8
  21. package/dist/events.d.mts.map +1 -1
  22. package/dist/index.cjs +1 -0
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +1 -0
  25. package/dist/index.d.cts.map +1 -1
  26. package/dist/index.d.mts +1 -0
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +1 -0
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/rpc.d.cts +15 -11
  31. package/dist/rpc.d.cts.map +1 -1
  32. package/dist/rpc.d.mts +15 -11
  33. package/dist/rpc.d.mts.map +1 -1
  34. package/dist/trx/constants.cjs +14 -0
  35. package/dist/trx/constants.cjs.map +1 -0
  36. package/dist/trx/constants.d.cts +9 -0
  37. package/dist/trx/constants.d.cts.map +1 -0
  38. package/dist/trx/constants.d.mts +9 -0
  39. package/dist/trx/constants.d.mts.map +1 -0
  40. package/dist/trx/constants.mjs +11 -0
  41. package/dist/trx/constants.mjs.map +1 -0
  42. package/dist/trx/index.cjs +19 -0
  43. package/dist/trx/index.cjs.map +1 -0
  44. package/dist/trx/index.d.cts +3 -0
  45. package/dist/trx/index.d.cts.map +1 -0
  46. package/dist/trx/index.d.mts +3 -0
  47. package/dist/trx/index.d.mts.map +1 -0
  48. package/dist/trx/index.mjs +3 -0
  49. package/dist/trx/index.mjs.map +1 -0
  50. package/dist/trx/types.cjs +40 -0
  51. package/dist/trx/types.cjs.map +1 -0
  52. package/dist/trx/types.d.cts +65 -0
  53. package/dist/trx/types.d.cts.map +1 -0
  54. package/dist/trx/types.d.mts +65 -0
  55. package/dist/trx/types.d.mts.map +1 -0
  56. package/dist/trx/types.mjs +37 -0
  57. package/dist/trx/types.mjs.map +1 -0
  58. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [20.1.1]
11
+
12
+ ### Added
13
+
14
+ - Add new bitcoin methods to `BtcMethod` enum ([#354](https://github.com/MetaMask/accounts/pull/354))
15
+
16
+ ## [20.1.0]
17
+
18
+ ### Added
19
+
20
+ - Add Tron support ([#349](https://github.com/MetaMask/accounts/pull/349))
21
+
10
22
  ## [20.0.0]
11
23
 
12
24
  ### Changed
@@ -606,7 +618,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
606
618
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
607
619
  - Helper functions to create keyring handler in the snap.
608
620
 
609
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.0.0...HEAD
621
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.1.1...HEAD
622
+ [20.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.1.0...@metamask/keyring-api@20.1.1
623
+ [20.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@20.0.0...@metamask/keyring-api@20.1.0
610
624
  [20.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@19.1.0...@metamask/keyring-api@20.0.0
611
625
  [19.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@19.0.0...@metamask/keyring-api@19.1.0
612
626
  [19.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@18.0.0...@metamask/keyring-api@19.0.0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyringAccountStruct = exports.AnyAccountType = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
3
+ exports.KeyringAccountStruct = 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");
@@ -30,6 +30,13 @@ var SolAccountType;
30
30
  (function (SolAccountType) {
31
31
  SolAccountType["DataAccount"] = "solana:data-account";
32
32
  })(SolAccountType || (exports.SolAccountType = SolAccountType = {}));
33
+ /**
34
+ * Supported Tron account types.
35
+ */
36
+ var TrxAccountType;
37
+ (function (TrxAccountType) {
38
+ TrxAccountType["Eoa"] = "tron:eoa";
39
+ })(TrxAccountType || (exports.TrxAccountType = TrxAccountType = {}));
33
40
  /**
34
41
  * A generic account type. It can be used to represent any account type that is
35
42
  * not covered by the other account types. It only applies to non-EVM chains.
@@ -61,6 +68,7 @@ exports.KeyringAccountStruct = (0, keyring_utils_1.object)({
61
68
  `${BtcAccountType.P2wpkh}`,
62
69
  `${BtcAccountType.P2tr}`,
63
70
  `${SolAccountType.DataAccount}`,
71
+ `${TrxAccountType.Eoa}`,
64
72
  `${AnyAccountType.Account}`,
65
73
  ]),
66
74
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":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EpC;;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 * 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 | `${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 `${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,CAAA;AAClB,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED;;;GAGG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,yCAAuB,CAAA;AACzB,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAgBD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,+BAAe;IAEnB;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;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,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"]}
@@ -21,6 +21,12 @@ export declare enum BtcAccountType {
21
21
  export declare enum SolAccountType {
22
22
  DataAccount = "solana:data-account"
23
23
  }
24
+ /**
25
+ * Supported Tron account types.
26
+ */
27
+ export declare enum TrxAccountType {
28
+ Eoa = "tron:eoa"
29
+ }
24
30
  /**
25
31
  * A generic account type. It can be used to represent any account type that is
26
32
  * not covered by the other account types. It only applies to non-EVM chains.
@@ -31,7 +37,7 @@ export declare enum AnyAccountType {
31
37
  /**
32
38
  * Supported account types.
33
39
  */
34
- export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${AnyAccountType.Account}`;
40
+ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${TrxAccountType.Eoa}` | `${AnyAccountType.Account}`;
35
41
  /**
36
42
  * A struct which represents a Keyring account object. It is abstract enough to
37
43
  * be used with any blockchain. Specific blockchain account types should extend
@@ -40,7 +46,7 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
40
46
  * See {@link KeyringAccount}.
41
47
  */
42
48
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
43
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
49
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
44
50
  id: string;
45
51
  options: Record<string, import("@metamask/utils").Json> & {
46
52
  entropy?: {
@@ -64,7 +70,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
64
70
  /**
65
71
  * Account type.
66
72
  */
67
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account", {
73
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
68
74
  "eip155:eoa": "eip155:eoa";
69
75
  "eip155:erc4337": "eip155:erc4337";
70
76
  "bip122:p2pkh": "bip122:p2pkh";
@@ -72,6 +78,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
72
78
  "bip122:p2wpkh": "bip122:p2wpkh";
73
79
  "bip122:p2tr": "bip122:p2tr";
74
80
  "solana:data-account": "solana:data-account";
81
+ "tron:eoa": "tron:eoa";
75
82
  "any:account": "any:account";
76
83
  }>;
77
84
  /**
@@ -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;;;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,OAAO,EAAE,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;IAYH;;OAEG;;IAGH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K,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -21,6 +21,12 @@ export declare enum BtcAccountType {
21
21
  export declare enum SolAccountType {
22
22
  DataAccount = "solana:data-account"
23
23
  }
24
+ /**
25
+ * Supported Tron account types.
26
+ */
27
+ export declare enum TrxAccountType {
28
+ Eoa = "tron:eoa"
29
+ }
24
30
  /**
25
31
  * A generic account type. It can be used to represent any account type that is
26
32
  * not covered by the other account types. It only applies to non-EVM chains.
@@ -31,7 +37,7 @@ export declare enum AnyAccountType {
31
37
  /**
32
38
  * Supported account types.
33
39
  */
34
- export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${AnyAccountType.Account}`;
40
+ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}` | `${TrxAccountType.Eoa}` | `${AnyAccountType.Account}`;
35
41
  /**
36
42
  * A struct which represents a Keyring account object. It is abstract enough to
37
43
  * be used with any blockchain. Specific blockchain account types should extend
@@ -40,7 +46,7 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
40
46
  * See {@link KeyringAccount}.
41
47
  */
42
48
  export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
43
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
49
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
44
50
  id: string;
45
51
  options: Record<string, import("@metamask/utils").Json> & {
46
52
  entropy?: {
@@ -64,7 +70,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
64
70
  /**
65
71
  * Account type.
66
72
  */
67
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account", {
73
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
68
74
  "eip155:eoa": "eip155:eoa";
69
75
  "eip155:erc4337": "eip155:erc4337";
70
76
  "bip122:p2pkh": "bip122:p2pkh";
@@ -72,6 +78,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
72
78
  "bip122:p2wpkh": "bip122:p2wpkh";
73
79
  "bip122:p2tr": "bip122:p2tr";
74
80
  "solana:data-account": "solana:data-account";
81
+ "tron:eoa": "tron:eoa";
75
82
  "any:account": "any:account";
76
83
  }>;
77
84
  /**
@@ -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;;;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,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AAG,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"}
@@ -27,6 +27,13 @@ export var SolAccountType;
27
27
  (function (SolAccountType) {
28
28
  SolAccountType["DataAccount"] = "solana:data-account";
29
29
  })(SolAccountType || (SolAccountType = {}));
30
+ /**
31
+ * Supported Tron account types.
32
+ */
33
+ export var TrxAccountType;
34
+ (function (TrxAccountType) {
35
+ TrxAccountType["Eoa"] = "tron:eoa";
36
+ })(TrxAccountType || (TrxAccountType = {}));
30
37
  /**
31
38
  * A generic account type. It can be used to represent any account type that is
32
39
  * not covered by the other account types. It only applies to non-EVM chains.
@@ -58,6 +65,7 @@ export const KeyringAccountStruct = object({
58
65
  `${BtcAccountType.P2wpkh}`,
59
66
  `${BtcAccountType.P2tr}`,
60
67
  `${SolAccountType.DataAccount}`,
68
+ `${TrxAccountType.Eoa}`,
61
69
  `${AnyAccountType.Account}`,
62
70
  ]),
63
71
  /**
@@ -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,IAA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cesContent":["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 * 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 | `${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 `${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;;;;;;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"]}
@@ -34,8 +34,15 @@ exports.BtcP2trAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.strin
34
34
  */
35
35
  var BtcMethod;
36
36
  (function (BtcMethod) {
37
- // General transaction methods
38
- BtcMethod["SendBitcoin"] = "sendBitcoin";
37
+ BtcMethod["SignPsbt"] = "signPsbt";
38
+ BtcMethod["ComputeFee"] = "computeFee";
39
+ BtcMethod["FillPsbt"] = "fillPsbt";
40
+ BtcMethod["BroadcastPsbt"] = "broadcastPsbt";
41
+ BtcMethod["SendTransfer"] = "sendTransfer";
42
+ BtcMethod["GetUtxo"] = "getUtxo";
43
+ BtcMethod["ListUtxos"] = "listUtxos";
44
+ BtcMethod["PublicDescriptor"] = "publicDescriptor";
45
+ BtcMethod["SignMessage"] = "signMessage";
39
46
  })(BtcMethod || (exports.BtcMethod = BtcMethod = {}));
40
47
  const BtcAccountStruct = (0, keyring_utils_1.object)({
41
48
  ...api_1.KeyringAccountStruct.schema,
@@ -46,7 +53,7 @@ const BtcAccountStruct = (0, keyring_utils_1.object)({
46
53
  /**
47
54
  * Account supported methods.
48
55
  */
49
- methods: (0, superstruct_1.array)((0, superstruct_1.enums)([`${BtcMethod.SendBitcoin}`])),
56
+ methods: (0, superstruct_1.array)((0, superstruct_1.enums)(Object.values(BtcMethod))),
50
57
  });
51
58
  exports.BtcP2pkhAccountStruct = (0, keyring_utils_1.object)({
52
59
  ...BtcAccountStruct.schema,
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAO+B;AAC/B,2EAAyE;AAEzE,0CAIgB;AAEhB,MAAM,eAAe,GAAG,CACtB,OAAe,EACf,IAAiB,EACA,EAAE;IACnB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,2CAAc,EAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oBAAoB,IAAI,aAAc,KAAe,CAAC,OAAO,EAAE,CAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;A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AC;AAEU,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,6BAAqB;IAE9B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,KAAK,EAAE,CAAC;CACzC,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,4BAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC;CAC1C,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,4BAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n nonempty,\n} from '@metamask/superstruct';\nimport { AddressType, getAddressInfo } from 'bitcoin-address-validation';\n\nimport {\n BtcAccountType,\n CaipChainIdStruct,\n KeyringAccountStruct,\n} from '../api';\n\nconst validateAddress = (\n address: string,\n type: AddressType,\n): boolean | Error => {\n try {\n const addressInfo = getAddressInfo(address);\n if (addressInfo.type === type) {\n return true;\n }\n return new Error(`Invalid ${type} address`);\n } catch (error) {\n return new Error(\n `Failed to decode ${type} address: ${(error as Error).message}`,\n );\n }\n};\n\nexport const BtcP2pkhAddressStruct = refine(\n string(),\n 'BtcP2pkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2pkh);\n },\n);\n\nexport const BtcP2shAddressStruct = refine(\n string(),\n 'BtcP2shAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2sh);\n },\n);\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2wpkh);\n },\n);\n\nexport const BtcP2trAddressStruct = refine(\n string(),\n 'BtcP2trAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2tr);\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nconst BtcAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account supported scopes (CAIP-2 chain ID).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport const BtcP2pkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2PKH address.\n */\n address: BtcP2pkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2pkh}`),\n});\n\nexport const BtcP2shAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2SH address.\n */\n address: BtcP2shAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2sh}`),\n});\n\nexport const BtcP2wpkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2WPKH address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n});\n\nexport const BtcP2trAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2TR address.\n */\n address: BtcP2trAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2tr}`),\n});\n\nexport type BtcP2pkhAccount = Infer<typeof BtcP2pkhAccountStruct>;\nexport type BtcP2shAccount = Infer<typeof BtcP2shAccountStruct>;\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\nexport type BtcP2trAccount = Infer<typeof BtcP2trAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAO+B;AAC/B,2EAAyE;AAEzE,0CAIgB;AAEhB,MAAM,eAAe,GAAG,CACtB,OAAe,EACf,IAAiB,EACA,EAAE;IACnB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,2CAAc,EAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oBAAoB,IAAI,aAAc,KAAe,CAAC,OAAO,EAAE,CAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EACzC,IAAA,oBAAM,GAAE,EACR,uBAAuB,EACvB,CAAC,OAAe,EAAE,EAAE;IAClB,OAAO,eAAe,CAAC,OAAO,EAAE,wCAAW,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC,CACF,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EACxC,IAAA,oBAAM,GAAE,EACR,sBAAsB,EACtB,CAAC,OAAe,EAAE,EAAE;IAClB,OAAO,eAAe,CAAC,OAAO,EAAE,wCAAW,CAAC,IAAI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,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,4BAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC;CAC1C,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,4BAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n nonempty,\n} from '@metamask/superstruct';\nimport { AddressType, getAddressInfo } from 'bitcoin-address-validation';\n\nimport {\n BtcAccountType,\n CaipChainIdStruct,\n KeyringAccountStruct,\n} from '../api';\n\nconst validateAddress = (\n address: string,\n type: AddressType,\n): boolean | Error => {\n try {\n const addressInfo = getAddressInfo(address);\n if (addressInfo.type === type) {\n return true;\n }\n return new Error(`Invalid ${type} address`);\n } catch (error) {\n return new Error(\n `Failed to decode ${type} address: ${(error as Error).message}`,\n );\n }\n};\n\nexport const BtcP2pkhAddressStruct = refine(\n string(),\n 'BtcP2pkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2pkh);\n },\n);\n\nexport const BtcP2shAddressStruct = refine(\n string(),\n 'BtcP2shAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2sh);\n },\n);\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2wpkh);\n },\n);\n\nexport const BtcP2trAddressStruct = refine(\n string(),\n 'BtcP2trAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2tr);\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n SignPsbt = 'signPsbt',\n ComputeFee = 'computeFee',\n FillPsbt = 'fillPsbt',\n BroadcastPsbt = 'broadcastPsbt',\n SendTransfer = 'sendTransfer',\n GetUtxo = 'getUtxo',\n ListUtxos = 'listUtxos',\n PublicDescriptor = 'publicDescriptor',\n SignMessage = 'signMessage',\n}\n\nconst BtcAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account supported scopes (CAIP-2 chain ID).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(BtcMethod))),\n});\n\nexport const BtcP2pkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2PKH address.\n */\n address: BtcP2pkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2pkh}`),\n});\n\nexport const BtcP2shAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2SH address.\n */\n address: BtcP2shAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2sh}`),\n});\n\nexport const BtcP2wpkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2WPKH address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n});\n\nexport const BtcP2trAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2TR address.\n */\n address: BtcP2trAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2tr}`),\n});\n\nexport type BtcP2pkhAccount = Infer<typeof BtcP2pkhAccountStruct>;\nexport type BtcP2shAccount = Infer<typeof BtcP2shAccountStruct>;\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\nexport type BtcP2trAccount = Infer<typeof BtcP2trAccountStruct>;\n"]}
@@ -7,7 +7,15 @@ export declare const BtcP2trAddressStruct: import("@metamask/superstruct").Struc
7
7
  * Supported Bitcoin methods.
8
8
  */
9
9
  export declare enum BtcMethod {
10
- SendBitcoin = "sendBitcoin"
10
+ SignPsbt = "signPsbt",
11
+ ComputeFee = "computeFee",
12
+ FillPsbt = "fillPsbt",
13
+ BroadcastPsbt = "broadcastPsbt",
14
+ SendTransfer = "sendTransfer",
15
+ GetUtxo = "getUtxo",
16
+ ListUtxos = "listUtxos",
17
+ PublicDescriptor = "publicDescriptor",
18
+ SignMessage = "signMessage"
11
19
  }
12
20
  export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Struct<{
13
21
  type: "bip122:p2pkh";
@@ -25,7 +33,7 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
25
33
  };
26
34
  address: string;
27
35
  scopes: `${string}:${string}`[];
28
- methods: "sendBitcoin"[];
36
+ methods: BtcMethod[];
29
37
  }, {
30
38
  /**
31
39
  * Account P2PKH address.
@@ -42,8 +50,16 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
42
50
  /**
43
51
  * Account supported methods.
44
52
  */
45
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
46
- sendBitcoin: "sendBitcoin";
53
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
54
+ signPsbt: BtcMethod.SignPsbt;
55
+ computeFee: BtcMethod.ComputeFee;
56
+ fillPsbt: BtcMethod.FillPsbt;
57
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
58
+ sendTransfer: BtcMethod.SendTransfer;
59
+ getUtxo: BtcMethod.GetUtxo;
60
+ listUtxos: BtcMethod.ListUtxos;
61
+ publicDescriptor: BtcMethod.PublicDescriptor;
62
+ signMessage: BtcMethod.SignMessage;
47
63
  }>>;
48
64
  id: import("@metamask/superstruct").Struct<string, null>;
49
65
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -74,7 +90,7 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
74
90
  };
75
91
  address: string;
76
92
  scopes: `${string}:${string}`[];
77
- methods: "sendBitcoin"[];
93
+ methods: BtcMethod[];
78
94
  }, {
79
95
  /**
80
96
  * Account P2SH address.
@@ -91,8 +107,16 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
91
107
  /**
92
108
  * Account supported methods.
93
109
  */
94
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
95
- sendBitcoin: "sendBitcoin";
110
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
111
+ signPsbt: BtcMethod.SignPsbt;
112
+ computeFee: BtcMethod.ComputeFee;
113
+ fillPsbt: BtcMethod.FillPsbt;
114
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
115
+ sendTransfer: BtcMethod.SendTransfer;
116
+ getUtxo: BtcMethod.GetUtxo;
117
+ listUtxos: BtcMethod.ListUtxos;
118
+ publicDescriptor: BtcMethod.PublicDescriptor;
119
+ signMessage: BtcMethod.SignMessage;
96
120
  }>>;
97
121
  id: import("@metamask/superstruct").Struct<string, null>;
98
122
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -123,7 +147,7 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
123
147
  };
124
148
  address: string;
125
149
  scopes: `${string}:${string}`[];
126
- methods: "sendBitcoin"[];
150
+ methods: BtcMethod[];
127
151
  }, {
128
152
  /**
129
153
  * Account P2WPKH address.
@@ -140,8 +164,16 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
140
164
  /**
141
165
  * Account supported methods.
142
166
  */
143
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
144
- sendBitcoin: "sendBitcoin";
167
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
168
+ signPsbt: BtcMethod.SignPsbt;
169
+ computeFee: BtcMethod.ComputeFee;
170
+ fillPsbt: BtcMethod.FillPsbt;
171
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
172
+ sendTransfer: BtcMethod.SendTransfer;
173
+ getUtxo: BtcMethod.GetUtxo;
174
+ listUtxos: BtcMethod.ListUtxos;
175
+ publicDescriptor: BtcMethod.PublicDescriptor;
176
+ signMessage: BtcMethod.SignMessage;
145
177
  }>>;
146
178
  id: import("@metamask/superstruct").Struct<string, null>;
147
179
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -172,7 +204,7 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
172
204
  };
173
205
  address: string;
174
206
  scopes: `${string}:${string}`[];
175
- methods: "sendBitcoin"[];
207
+ methods: BtcMethod[];
176
208
  }, {
177
209
  /**
178
210
  * Account P2TR address.
@@ -189,8 +221,16 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
189
221
  /**
190
222
  * Account supported methods.
191
223
  */
192
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
193
- sendBitcoin: "sendBitcoin";
224
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
225
+ signPsbt: BtcMethod.SignPsbt;
226
+ computeFee: BtcMethod.ComputeFee;
227
+ fillPsbt: BtcMethod.FillPsbt;
228
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
229
+ sendTransfer: BtcMethod.SendTransfer;
230
+ getUtxo: BtcMethod.GetUtxo;
231
+ listUtxos: BtcMethod.ListUtxos;
232
+ publicDescriptor: BtcMethod.PublicDescriptor;
233
+ signMessage: BtcMethod.SignMessage;
194
234
  }>>;
195
235
  id: import("@metamask/superstruct").Struct<string, null>;
196
236
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EA8BH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAjDH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBA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;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -7,7 +7,15 @@ export declare const BtcP2trAddressStruct: import("@metamask/superstruct").Struc
7
7
  * Supported Bitcoin methods.
8
8
  */
9
9
  export declare enum BtcMethod {
10
- SendBitcoin = "sendBitcoin"
10
+ SignPsbt = "signPsbt",
11
+ ComputeFee = "computeFee",
12
+ FillPsbt = "fillPsbt",
13
+ BroadcastPsbt = "broadcastPsbt",
14
+ SendTransfer = "sendTransfer",
15
+ GetUtxo = "getUtxo",
16
+ ListUtxos = "listUtxos",
17
+ PublicDescriptor = "publicDescriptor",
18
+ SignMessage = "signMessage"
11
19
  }
12
20
  export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Struct<{
13
21
  type: "bip122:p2pkh";
@@ -25,7 +33,7 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
25
33
  };
26
34
  address: string;
27
35
  scopes: `${string}:${string}`[];
28
- methods: "sendBitcoin"[];
36
+ methods: BtcMethod[];
29
37
  }, {
30
38
  /**
31
39
  * Account P2PKH address.
@@ -42,8 +50,16 @@ export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Stru
42
50
  /**
43
51
  * Account supported methods.
44
52
  */
45
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
46
- sendBitcoin: "sendBitcoin";
53
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
54
+ signPsbt: BtcMethod.SignPsbt;
55
+ computeFee: BtcMethod.ComputeFee;
56
+ fillPsbt: BtcMethod.FillPsbt;
57
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
58
+ sendTransfer: BtcMethod.SendTransfer;
59
+ getUtxo: BtcMethod.GetUtxo;
60
+ listUtxos: BtcMethod.ListUtxos;
61
+ publicDescriptor: BtcMethod.PublicDescriptor;
62
+ signMessage: BtcMethod.SignMessage;
47
63
  }>>;
48
64
  id: import("@metamask/superstruct").Struct<string, null>;
49
65
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -74,7 +90,7 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
74
90
  };
75
91
  address: string;
76
92
  scopes: `${string}:${string}`[];
77
- methods: "sendBitcoin"[];
93
+ methods: BtcMethod[];
78
94
  }, {
79
95
  /**
80
96
  * Account P2SH address.
@@ -91,8 +107,16 @@ export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struc
91
107
  /**
92
108
  * Account supported methods.
93
109
  */
94
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
95
- sendBitcoin: "sendBitcoin";
110
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
111
+ signPsbt: BtcMethod.SignPsbt;
112
+ computeFee: BtcMethod.ComputeFee;
113
+ fillPsbt: BtcMethod.FillPsbt;
114
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
115
+ sendTransfer: BtcMethod.SendTransfer;
116
+ getUtxo: BtcMethod.GetUtxo;
117
+ listUtxos: BtcMethod.ListUtxos;
118
+ publicDescriptor: BtcMethod.PublicDescriptor;
119
+ signMessage: BtcMethod.SignMessage;
96
120
  }>>;
97
121
  id: import("@metamask/superstruct").Struct<string, null>;
98
122
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -123,7 +147,7 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
123
147
  };
124
148
  address: string;
125
149
  scopes: `${string}:${string}`[];
126
- methods: "sendBitcoin"[];
150
+ methods: BtcMethod[];
127
151
  }, {
128
152
  /**
129
153
  * Account P2WPKH address.
@@ -140,8 +164,16 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
140
164
  /**
141
165
  * Account supported methods.
142
166
  */
143
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
144
- sendBitcoin: "sendBitcoin";
167
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
168
+ signPsbt: BtcMethod.SignPsbt;
169
+ computeFee: BtcMethod.ComputeFee;
170
+ fillPsbt: BtcMethod.FillPsbt;
171
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
172
+ sendTransfer: BtcMethod.SendTransfer;
173
+ getUtxo: BtcMethod.GetUtxo;
174
+ listUtxos: BtcMethod.ListUtxos;
175
+ publicDescriptor: BtcMethod.PublicDescriptor;
176
+ signMessage: BtcMethod.SignMessage;
145
177
  }>>;
146
178
  id: import("@metamask/superstruct").Struct<string, null>;
147
179
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -172,7 +204,7 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
172
204
  };
173
205
  address: string;
174
206
  scopes: `${string}:${string}`[];
175
- methods: "sendBitcoin"[];
207
+ methods: BtcMethod[];
176
208
  }, {
177
209
  /**
178
210
  * Account P2TR address.
@@ -189,8 +221,16 @@ export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struc
189
221
  /**
190
222
  * Account supported methods.
191
223
  */
192
- methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
193
- sendBitcoin: "sendBitcoin";
224
+ methods: import("@metamask/superstruct").Struct<BtcMethod[], import("@metamask/superstruct").Struct<BtcMethod, {
225
+ signPsbt: BtcMethod.SignPsbt;
226
+ computeFee: BtcMethod.ComputeFee;
227
+ fillPsbt: BtcMethod.FillPsbt;
228
+ broadcastPsbt: BtcMethod.BroadcastPsbt;
229
+ sendTransfer: BtcMethod.SendTransfer;
230
+ getUtxo: BtcMethod.GetUtxo;
231
+ listUtxos: BtcMethod.ListUtxos;
232
+ publicDescriptor: BtcMethod.PublicDescriptor;
233
+ signMessage: BtcMethod.SignMessage;
194
234
  }>>;
195
235
  id: import("@metamask/superstruct").Struct<string, null>;
196
236
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EA8BH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAjDH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAG/B;;OAEG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OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -31,8 +31,15 @@ export const BtcP2trAddressStruct = refine(string(), 'BtcP2trAddressStruct', (ad
31
31
  */
32
32
  export var BtcMethod;
33
33
  (function (BtcMethod) {
34
- // General transaction methods
35
- BtcMethod["SendBitcoin"] = "sendBitcoin";
34
+ BtcMethod["SignPsbt"] = "signPsbt";
35
+ BtcMethod["ComputeFee"] = "computeFee";
36
+ BtcMethod["FillPsbt"] = "fillPsbt";
37
+ BtcMethod["BroadcastPsbt"] = "broadcastPsbt";
38
+ BtcMethod["SendTransfer"] = "sendTransfer";
39
+ BtcMethod["GetUtxo"] = "getUtxo";
40
+ BtcMethod["ListUtxos"] = "listUtxos";
41
+ BtcMethod["PublicDescriptor"] = "publicDescriptor";
42
+ BtcMethod["SignMessage"] = "signMessage";
36
43
  })(BtcMethod || (BtcMethod = {}));
37
44
  const BtcAccountStruct = object({
38
45
  ...KeyringAccountStruct.schema,
@@ -43,7 +50,7 @@ const BtcAccountStruct = object({
43
50
  /**
44
51
  * Account supported methods.
45
52
  */
46
- methods: array(enums([`${BtcMethod.SendBitcoin}`])),
53
+ methods: array(enums(Object.values(BtcMethod))),
47
54
  });
48
55
  export const BtcP2pkhAccountStruct = object({
49
56
  ...BtcAccountStruct.schema,