@metamask/account-api
Version:
MetaMask Account API
44 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountGroupType = exports.DEFAULT_ACCOUNT_GROUP_UNIQUE_ID = void 0;
exports.toAccountGroupId = toAccountGroupId;
exports.toDefaultAccountGroupId = toDefaultAccountGroupId;
/**
* Default account group unique ID.
*
* This constant can be used to reference the "default" group from
* an account wallet.
*/
exports.DEFAULT_ACCOUNT_GROUP_UNIQUE_ID = 'default';
/**
* Account group object.
*
* Each group types groups accounts using different criterias.
*/
var AccountGroupType;
(function (AccountGroupType) {
/** Group that represents a multichain account. */
AccountGroupType["MultichainAccount"] = "multichain-account";
/** Group that represents a single account. */
AccountGroupType["SingleAccount"] = "single-account";
})(AccountGroupType || (exports.AccountGroupType = AccountGroupType = {}));
/**
* Convert a wallet ID and a unique ID, to a group ID.
*
* @param walletId - A wallet ID.
* @param id - A unique ID.
* @returns A group ID.
*/
function toAccountGroupId(walletId, id) {
return `${walletId}/${id}`;
}
/**
* Convert a wallet ID to the default group ID.
*
* @param walletId - A wallet ID.
* @returns The default group ID.
*/
function toDefaultAccountGroupId(walletId) {
return toAccountGroupId(walletId, exports.DEFAULT_ACCOUNT_GROUP_UNIQUE_ID);
}
//# sourceMappingURL=group.cjs.map