var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
export const getKeplr = () => __awaiter(void 0, void 0, void 0, function* () {
    if (window.keplr) {
        return window.keplr;
    }
    if (document.readyState === 'complete') {
        return window.keplr;
    }
    return new Promise((resolve) => {
        const documentStateChange = (event) => {
            if (event.target &&
                event.target.readyState === 'complete') {
                resolve(window.keplr);
                document.removeEventListener('readystatechange', documentStateChange);
            }
        };
        document.addEventListener('readystatechange', documentStateChange);
    });
});
const configKeplr = (prefix) => __awaiter(void 0, void 0, void 0, function* () {
    const cyber = (yield import('./config')).CYBER;
    return {
        chainId: cyber.CHAIN_ID,
        chainName: cyber.CHAIN_ID,
        rpc: cyber.CYBER_NODE_URL_API,
        rest: cyber.CYBER_NODE_URL_LCD,
        stakeCurrency: {
            coinDenom: cyber.DENOM_CYBER.toUpperCase(),
            coinMinimalDenom: cyber.DENOM_CYBER,
            coinDecimals: 0,
        },
        bip44: {
            coinType: 118,
        },
        bech32Config: {
            bech32PrefixAccAddr: prefix,
            bech32PrefixAccPub: `${prefix}pub`,
            bech32PrefixValAddr: `${prefix}valoper`,
            bech32PrefixValPub: `${prefix}valoperpub`,
            bech32PrefixConsAddr: `${prefix}valcons`,
            bech32PrefixConsPub: `${prefix}valconspub`,
        },
        currencies: [
            {
                coinDenom: cyber.DENOM_CYBER.toUpperCase(),
                coinMinimalDenom: cyber.DENOM_CYBER,
                coinDecimals: 0,
            },
            {
                coinDenom: 'L',
                coinMinimalDenom: 'liquidpussy',
                coinDecimals: 0,
            },
            {
                coinDenom: 'V',
                coinMinimalDenom: 'millivolt',
                coinDecimals: 3,
            },
            {
                coinDenom: 'A',
                coinMinimalDenom: 'milliampere',
                coinDecimals: 3,
            },
        ],
        feeCurrencies: [
            {
                coinDenom: cyber.DENOM_CYBER.toUpperCase(),
                coinMinimalDenom: cyber.DENOM_CYBER,
                coinDecimals: 0,
            },
        ],
        coinType: 118,
        gasPriceStep: {
            low: 0,
            average: 0,
            high: 0.01,
        },
        features: ['stargate', 'ibc-transfer'],
    };
});
export default configKeplr;
//# sourceMappingURL=keplrUtils.js.map