"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CosmwasmUnsignedTransaction = exports.buildExecuteMsg = exports.computeFee = void 0;
const stargate_1 = require("@cosmjs/stargate");
const connect_sdk_1 = require("@wormhole-foundation/connect-sdk");
const tx_1 = require("cosmjs-types/cosmwasm/wasm/v1/tx");
const constants_1 = require("./constants");
const platform_1 = require("./platform");
function computeFee(network, chain) {
    return (0, stargate_1.calculateFee)(constants_1.DEFAULT_FEE, `0.1${platform_1.CosmwasmPlatform.getNativeDenom(network, chain)}`);
}
exports.computeFee = computeFee;
function buildExecuteMsg(sender, contract, msg, funds) {
    return {
        typeUrl: constants_1.MSG_EXECUTE_CONTRACT_TYPE_URL,
        value: tx_1.MsgExecuteContract.fromPartial({
            sender: sender,
            contract: contract,
            msg: connect_sdk_1.encoding.bytes.encode(JSON.stringify(msg)),
            funds,
        }),
    };
}
exports.buildExecuteMsg = buildExecuteMsg;
class CosmwasmUnsignedTransaction {
    transaction;
    network;
    chain;
    description;
    parallelizable;
    constructor(transaction, network, chain, description, parallelizable = false) {
        this.transaction = transaction;
        this.network = network;
        this.chain = chain;
        this.description = description;
        this.parallelizable = parallelizable;
    }
}
exports.CosmwasmUnsignedTransaction = CosmwasmUnsignedTransaction;
//# sourceMappingURL=unsignedTransaction.js.map