@metamask/keyring-api 20.0.0 → 20.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 +8 -1
- package/dist/api/account.cjs +9 -1
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +10 -3
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +10 -3
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +8 -0
- package/dist/api/account.mjs.map +1 -1
- package/dist/events.d.cts +10 -8
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +10 -8
- package/dist/events.d.mts.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/rpc.d.cts +15 -11
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +15 -11
- package/dist/rpc.d.mts.map +1 -1
- package/dist/trx/constants.cjs +14 -0
- package/dist/trx/constants.cjs.map +1 -0
- package/dist/trx/constants.d.cts +9 -0
- package/dist/trx/constants.d.cts.map +1 -0
- package/dist/trx/constants.d.mts +9 -0
- package/dist/trx/constants.d.mts.map +1 -0
- package/dist/trx/constants.mjs +11 -0
- package/dist/trx/constants.mjs.map +1 -0
- package/dist/trx/index.cjs +19 -0
- package/dist/trx/index.cjs.map +1 -0
- package/dist/trx/index.d.cts +3 -0
- package/dist/trx/index.d.cts.map +1 -0
- package/dist/trx/index.d.mts +3 -0
- package/dist/trx/index.d.mts.map +1 -0
- package/dist/trx/index.mjs +3 -0
- package/dist/trx/index.mjs.map +1 -0
- package/dist/trx/types.cjs +40 -0
- package/dist/trx/types.cjs.map +1 -0
- package/dist/trx/types.d.cts +65 -0
- package/dist/trx/types.d.cts.map +1 -0
- package/dist/trx/types.d.mts +65 -0
- package/dist/trx/types.d.mts.map +1 -0
- package/dist/trx/types.mjs +37 -0
- package/dist/trx/types.mjs.map +1 -0
- package/package.json +1 -1
@@ -0,0 +1,37 @@
|
|
1
|
+
import { object } from "@metamask/keyring-utils";
|
2
|
+
import { array, enums, literal, nonempty } from "@metamask/superstruct";
|
3
|
+
import { definePattern } from "@metamask/utils";
|
4
|
+
import { CaipChainIdStruct, KeyringAccountStruct, TrxAccountType } from "../api/index.mjs";
|
5
|
+
/**
|
6
|
+
* TRON addresses are Base58-encoded strings that are exactly 34 characters long
|
7
|
+
* and start with the letter 'T'.
|
8
|
+
*/
|
9
|
+
export const TrxAddressStruct = definePattern('TrxAddress', /^T[1-9A-HJ-NP-Za-km-z]{33}$/iu);
|
10
|
+
/**
|
11
|
+
* Supported TRON methods.
|
12
|
+
*/
|
13
|
+
export var TrxMethod;
|
14
|
+
(function (TrxMethod) {
|
15
|
+
TrxMethod["SignMessageV2"] = "signMessageV2";
|
16
|
+
TrxMethod["VerifyMessageV2"] = "verifyMessageV2";
|
17
|
+
})(TrxMethod || (TrxMethod = {}));
|
18
|
+
export const TrxEoaAccountStruct = object({
|
19
|
+
...KeyringAccountStruct.schema,
|
20
|
+
/**
|
21
|
+
* Account address.
|
22
|
+
*/
|
23
|
+
address: TrxAddressStruct,
|
24
|
+
/**
|
25
|
+
* Account type.
|
26
|
+
*/
|
27
|
+
type: literal(`${TrxAccountType.Eoa}`),
|
28
|
+
/**
|
29
|
+
* Account supported scopes (CAIP-2 chain IDs).
|
30
|
+
*/
|
31
|
+
scopes: nonempty(array(CaipChainIdStruct)),
|
32
|
+
/**
|
33
|
+
* Account supported methods.
|
34
|
+
*/
|
35
|
+
methods: array(enums(Object.values(TrxMethod))),
|
36
|
+
});
|
37
|
+
//# sourceMappingURL=types.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/trx/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACf,yBAAe;AAEhB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,+BAA+B,CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;AACrC,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACxC,GAAG,oBAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IACtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n TrxAccountType,\n} from '../api';\n\n/**\n * TRON addresses are Base58-encoded strings that are exactly 34 characters long\n * and start with the letter 'T'.\n */\nexport const TrxAddressStruct = definePattern(\n 'TrxAddress',\n /^T[1-9A-HJ-NP-Za-km-z]{33}$/iu,\n);\n\n/**\n * Supported TRON methods.\n */\nexport enum TrxMethod {\n SignMessageV2 = 'signMessageV2',\n VerifyMessageV2 = 'verifyMessageV2',\n}\n\nexport const TrxEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: TrxAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${TrxAccountType.Eoa}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(TrxMethod))),\n});\n\nexport type TrxEoaAccount = Infer<typeof TrxEoaAccountStruct>;\n"]}
|