@terminusbet/stake-vote-sdk
Version:
A simple SDK for interacting with terminusbet governance
32 lines • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserRewardState = void 0;
const borsh_1 = require("@coral-xyz/borsh");
const web3_js_1 = require("@solana/web3.js");
class UserRewardState {
discriminator;
ballotBot;
rewardMint;
voteRewardState;
amount;
constructor(discriminator, ballotBot, rewardMint, voteRewardState, amount) {
this.discriminator = discriminator;
this.ballotBot = ballotBot;
this.rewardMint = rewardMint;
this.voteRewardState = voteRewardState;
this.amount = amount;
}
static fromBuffer(buffer) {
const structure = (0, borsh_1.struct)([
(0, borsh_1.u64)("discriminator"),
(0, borsh_1.publicKey)("ballotBot"),
(0, borsh_1.publicKey)("rewardMint"),
(0, borsh_1.publicKey)("voteRewardState"),
(0, borsh_1.u64)("amount")
]);
let value = structure.decode(buffer);
return new UserRewardState(BigInt(value.discriminator), new web3_js_1.PublicKey(value.ballotBot), new web3_js_1.PublicKey(value.rewardMint), new web3_js_1.PublicKey(value.voteRewardState), BigInt(value.amount));
}
}
exports.UserRewardState = UserRewardState;
//# sourceMappingURL=userRewardState.js.map