@metamask/keyring-api
Version:
MetaMask Keyring API
41 lines • 1.38 kB
JavaScript
import { object } from "@metamask/keyring-utils";
import { array, enums, literal, nonempty } from "@metamask/superstruct";
import { definePattern } from "@metamask/utils";
import { CaipChainIdStruct, KeyringAccountStruct, TrxAccountType } from "../api/index.mjs";
/**
* TRON addresses are Base58-encoded strings that are exactly 34 characters long
* and start with the letter 'T'.
*/
export const TrxAddressStruct = definePattern('TrxAddress', /^T[1-9A-HJ-NP-Za-km-z]{33}$/iu);
/**
* Supported TRON methods.
*/
export var TrxMethod;
(function (TrxMethod) {
TrxMethod["SignMessage"] = "signMessage";
TrxMethod["SignTransaction"] = "signTransaction";
// @deprecated Use `SignMessage` instead.
TrxMethod["SignMessageV2"] = "signMessageV2";
// @deprecated Not supported anymore.
TrxMethod["VerifyMessageV2"] = "verifyMessageV2";
})(TrxMethod || (TrxMethod = {}));
export const TrxEoaAccountStruct = object({
...KeyringAccountStruct.schema,
/**
* Account address.
*/
address: TrxAddressStruct,
/**
* Account type.
*/
type: literal(`${TrxAccountType.Eoa}`),
/**
* Account supported scopes (CAIP-2 chain IDs).
*/
scopes: nonempty(array(CaipChainIdStruct)),
/**
* Account supported methods.
*/
methods: array(enums(Object.values(TrxMethod))),
});
//# sourceMappingURL=types.mjs.map