PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@polkadot/api-derive/cjs/accounts

Просмотр файла: indexToId.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.indexToId = indexToId;
const rxjs_1 = require("rxjs");
const index_js_1 = require("../util/index.js");
/**
 * @name indexToId
 * @param {( AccountIndex | string )} accountIndex - An accounts index in different formats.
 * @returns Returns the corresponding AccountId.
 * @example
 * <BR>
 *
 * ```javascript
 * api.derive.accounts.indexToId('F7Hs', (accountId) => {
 *   console.log(`The AccountId of F7Hs is ${accountId}`);
 * });
 * ```
 */
function indexToId(instanceId, api) {
    return (0, index_js_1.memo)(instanceId, (accountIndex) => api.query.indices
        ? api.query.indices.accounts(accountIndex).pipe((0, rxjs_1.map)((optResult) => optResult.unwrapOr([])[0]))
        : (0, rxjs_1.of)(undefined));
}

Выполнить команду


Для локальной разработки. Не используйте в интернете!