@bandprotocol/bandchain.js
Version:
Library for interacting with BandChain in browser and Node.js environments
133 lines (132 loc) • 4.78 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CancelSoftwareUpgradeProposal = exports.SoftwareUpgradeProposal = exports.ParameterChangeProposal = exports.CommunityPoolSpendProposal = exports.TextProposal = void 0;
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
const distribution_pb_1 = require("../codegen/cosmos/distribution/v1beta1/distribution_pb");
const gov_pb_1 = require("../codegen/cosmos/gov/v1beta1/gov_pb");
const params_pb_1 = require("../codegen/cosmos/params/v1beta1/params_pb");
const upgrade_pb_1 = require("../codegen/cosmos/upgrade/v1beta1/upgrade_pb");
class TextProposal extends gov_pb_1.TextProposal {
constructor(title, description) {
super();
this.setTitle(title);
this.setDescription(description);
}
toAny() {
const any = new any_pb_1.Any();
any.pack(this.serializeBinary(), 'cosmos.gov.v1beta1.TextProposal', '/');
return any;
}
toJSON() {
return {
type: 'cosmos-sdk/TextProposal',
value: {
title: this.getTitle().toString(),
description: this.getDescription().toString(),
},
};
}
}
exports.TextProposal = TextProposal;
class CommunityPoolSpendProposal extends distribution_pb_1.CommunityPoolSpendProposal {
constructor(title, description, recipient, amount) {
super();
this.setTitle(title);
this.setDescription(description);
this.setRecipient(recipient);
this.setAmountList(amount);
}
toAny() {
const any = new any_pb_1.Any();
any.pack(this.serializeBinary(), 'cosmos.distribution.v1beta1.CommunityPoolSpendProposal', '/');
return any;
}
toJSON() {
return {
type: 'cosmos-sdk/CommunityPoolSpend',
value: {
title: this.getTitle().toString(),
description: this.getDescription().toString(),
recipient: this.getRecipient().toString(),
amount: this.getAmountList().map((coin) => coin.toObject()),
},
};
}
}
exports.CommunityPoolSpendProposal = CommunityPoolSpendProposal;
class ParameterChangeProposal extends params_pb_1.ParameterChangeProposal {
constructor(title, description, changes) {
super();
this.setTitle(title);
this.setDescription(description);
this.setChangesList(changes);
}
toAny() {
const any = new any_pb_1.Any();
any.pack(this.serializeBinary(), 'cosmos.params.v1beta1.ParameterChangeProposal', '/');
return any;
}
toJSON() {
return {
type: 'cosmos-sdk/ParameterChangeProposal',
value: {
title: this.getTitle().toString(),
description: this.getDescription().toString(),
changes: this.getChangesList().map((change) => change.toObject()),
},
};
}
}
exports.ParameterChangeProposal = ParameterChangeProposal;
class SoftwareUpgradeProposal extends upgrade_pb_1.SoftwareUpgradeProposal {
constructor(title, description, plan) {
super();
this.plan = plan;
this.setTitle(title);
this.setDescription(description);
this.setPlan(plan);
}
toAny() {
const any = new any_pb_1.Any();
any.pack(this.serializeBinary(), 'cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', '/');
return any;
}
toJSON() {
const plan = this.getPlan();
return {
type: 'cosmos-sdk/SoftwareUpgradeProposal',
value: {
title: this.getTitle().toString(),
description: this.getDescription(),
plan: {
info: plan.getInfo().toString(),
name: plan.getName().toString(),
height: plan.getHeight().toString(),
},
},
};
}
}
exports.SoftwareUpgradeProposal = SoftwareUpgradeProposal;
class CancelSoftwareUpgradeProposal extends upgrade_pb_1.CancelSoftwareUpgradeProposal {
constructor(title, description) {
super();
this.setTitle(title);
this.setDescription(description);
}
toAny() {
const any = new any_pb_1.Any();
any.pack(this.serializeBinary(), 'cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal', '/');
return any;
}
toJSON() {
return {
type: 'cosmos-sdk/CancelSoftwareUpgradeProposal',
value: {
title: this.getTitle().toString(),
description: this.getDescription().toString(),
},
};
}
}
exports.CancelSoftwareUpgradeProposal = CancelSoftwareUpgradeProposal;