"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const perpetual_1 = require("@ritbit/v4-proto/src/codegen/ritbit/perpetuals/perpetual");
const long_1 = __importDefault(require("long"));
const src_1 = require("../src");
const composite_client_1 = require("../src/clients/composite-client");
const constants_1 = require("../src/clients/constants");
const utils_1 = require("../src/lib/utils");
const constants_2 = require("./constants");
const INITIAL_DEPOSIT_AMOUNT = 10000000000000; // 10,000 whole native tokens.
const MOCK_DATA = {
    // common
    id: 34,
    ticker: 'BONK-USD',
    // x/prices
    priceExponent: -14,
    minExchanges: 3,
    minPriceChange: 4000,
    exchangeConfigJson: JSON.stringify({
        exchanges: [
            { exchangeName: 'Binance', ticker: 'BONKUSDT', adjustByMarket: 'USDT-USD' },
            { exchangeName: 'Bybit', ticker: 'BONKUSDT', adjustByMarket: 'USDT-USD' },
            { exchangeName: 'CoinbasePro', ticker: 'BONK-USD' },
            { exchangeName: 'Kucoin', ticker: 'BONK-USDT', adjustByMarket: 'USDT-USD' },
            { exchangeName: 'Okx', ticker: 'BONK-USDT', adjustByMarket: 'USDT-USD' },
            { exchangeName: 'Mexc', ticker: 'BONK_USDT', adjustByMarket: 'USDT-USD' },
        ],
    }),
    // x/perpetuals
    liquidityTier: 2,
    atomicResolution: -1,
    marketType: perpetual_1.PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS,
    // x/clob
    quantumConversionExponent: -9,
    stepBaseQuantums: long_1.default.fromNumber(1000000),
    subticksPerTick: 1000000,
    // x/delaymsg
    delayBlocks: 5,
};
// To run this test:
//  npm run build && node build/examples/gov_add_new_market.js
//
// Confirmed that the proposals have the exact same content.
//  1. submit using an example json file
//   ritbitd tx gov submit-proposal gov_add_new_market.json \
//      --from alice --keyring-backend test --gas auto --fees 9553225000000000adv4tnt
//   ritbitd query gov proposals
//  2. submit using the file's mock data
//   npm run build && node build/examples/gov_add_new_market.js
//   ritbitd query gov proposals
//  3. then compare the two proposals and ensure they match
async function test() {
    console.log('**Start**');
    const wallet = await src_1.LocalWallet.fromMnemonic(constants_2.LOCAL_MNEMONIC, constants_1.BECH32_PREFIX);
    console.log(wallet);
    const network = constants_1.Network.local();
    const client = await composite_client_1.CompositeClient.connect(network);
    console.log('**Client**');
    console.log(client);
    const tx = await client.submitGovAddNewMarketProposal(wallet, MOCK_DATA, (0, utils_1.getGovAddNewMarketTitle)(MOCK_DATA.ticker), (0, utils_1.getGovAddNewMarketSummary)(MOCK_DATA.ticker, MOCK_DATA.delayBlocks), BigInt(INITIAL_DEPOSIT_AMOUNT).toString());
    console.log('**Tx**');
    console.log(tx);
    await (0, utils_1.sleep)(5000);
    const depositProposals = await client.validatorClient.get.getAllGovProposals(src_1.ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD);
    console.log('**Deposit Proposals**');
    console.log(depositProposals);
    const votingProposals = await client.validatorClient.get.getAllGovProposals(src_1.ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD);
    console.log('**Voting Proposals**');
    console.log(votingProposals);
}
test().catch((error) => {
    console.error(error);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ292X2FkZF9uZXdfbWFya2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vZXhhbXBsZXMvZ292X2FkZF9uZXdfbWFya2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsd0ZBQStGO0FBQy9GLGdEQUF3QjtBQUV4QixnQ0FBNEU7QUFDNUUsc0VBQWtFO0FBQ2xFLHdEQUFrRTtBQUNsRSw0Q0FBNkY7QUFDN0YsMkNBQTZDO0FBRTdDLE1BQU0sc0JBQXNCLEdBQUcsY0FBa0IsQ0FBQyxDQUFDLDhCQUE4QjtBQUNqRixNQUFNLFNBQVMsR0FBMEI7SUFDdkMsU0FBUztJQUNULEVBQUUsRUF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