"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MsgClientImpl = void 0;
const transfer_1 = require("./transfer");
const _m0 = __importStar(require("protobufjs/minimal"));
const tx_1 = require("./tx");
class MsgClientImpl {
    constructor(rpc) {
        this.rpc = rpc;
        this.createTransfer = this.createTransfer.bind(this);
        this.depositToSubaccount = this.depositToSubaccount.bind(this);
        this.withdrawFromSubaccount = this.withdrawFromSubaccount.bind(this);
        this.sendFromModuleToAccount = this.sendFromModuleToAccount.bind(this);
    }
    createTransfer(request) {
        const data = tx_1.MsgCreateTransfer.encode(request).finish();
        const promise = this.rpc.request("ritbit.sending.Msg", "CreateTransfer", data);
        return promise.then(data => tx_1.MsgCreateTransferResponse.decode(new _m0.Reader(data)));
    }
    depositToSubaccount(request) {
        const data = transfer_1.MsgDepositToSubaccount.encode(request).finish();
        const promise = this.rpc.request("ritbit.sending.Msg", "DepositToSubaccount", data);
        return promise.then(data => tx_1.MsgDepositToSubaccountResponse.decode(new _m0.Reader(data)));
    }
    withdrawFromSubaccount(request) {
        const data = transfer_1.MsgWithdrawFromSubaccount.encode(request).finish();
        const promise = this.rpc.request("ritbit.sending.Msg", "WithdrawFromSubaccount", data);
        return promise.then(data => tx_1.MsgWithdrawFromSubaccountResponse.decode(new _m0.Reader(data)));
    }
    sendFromModuleToAccount(request) {
        const data = transfer_1.MsgSendFromModuleToAccount.encode(request).finish();
        const promise = this.rpc.request("ritbit.sending.Msg", "SendFromModuleToAccount", data);
        return promise.then(data => tx_1.MsgSendFromModuleToAccountResponse.decode(new _m0.Reader(data)));
    }
}
exports.MsgClientImpl = MsgClientImpl;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHgucnBjLm1zZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL25vZGVfbW9kdWxlcy9Acml0Yml0L3Y0LXByb3RvL3NyYy9jb2RlZ2VuL3JpdGJpdC9zZW5kaW5nL3R4LnJwYy5tc2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEseUNBQTJHO0FBRTNHLHdEQUEwQztBQUMxQyw2QkFBMks7QUF5QjNLLE1BQWEsYUFBYTtJQUd4QixZQUFZLEdBQVE7UUFDbEIsSUFBSSxDQUFDLEdBQUcsR0FBRyxHQUFHLENBQUM7UUFDZixJQUFJLENBQUMsY0FBYyxHQUFHLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ3JELElBQUksQ0FBQyxtQkFBbUIsR0FBRyxJQUFJLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQ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