@metamask/keyring-api
Version:
MetaMask Keyring API
47 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
const keyring_utils_1 = require("@metamask/keyring-utils");
const superstruct_1 = require("@metamask/superstruct");
const utils_1 = require("@metamask/utils");
const api_1 = require("../api/index.cjs");
/**
* Solana addresses are represented in the format of a 256-bit ed25519 public key and
* are encoded using base58.
* They are usually 32 to 44 characters long.
*/
exports.SolAddressStruct = (0, utils_1.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
/**
* Supported Solana methods.
*/
var SolMethod;
(function (SolMethod) {
// General transaction methods
// @deprecated
// TODO: Remove this once the new methods are fully adopted
SolMethod["SendAndConfirmTransaction"] = "sendAndConfirmTransaction";
SolMethod["SignAndSendTransaction"] = "signAndSendTransaction";
SolMethod["SignTransaction"] = "signTransaction";
SolMethod["SignMessage"] = "signMessage";
SolMethod["SignIn"] = "signIn";
})(SolMethod || (exports.SolMethod = SolMethod = {}));
exports.SolDataAccountStruct = (0, keyring_utils_1.object)({
...api_1.KeyringAccountStruct.schema,
/**
* Account address.
*/
address: exports.SolAddressStruct,
/**
* Account type.
*/
type: (0, superstruct_1.literal)(`${api_1.SolAccountType.DataAccount}`),
/**
* Account supported scopes (CAIP-2 chain IDs).
*/
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)(api_1.CaipChainIdStruct)),
/**
* Account supported methods.
*/
methods: (0, superstruct_1.array)((0, superstruct_1.enums)(Object.values(SolMethod))),
});
//# sourceMappingURL=types.cjs.map