@terminusbet/stake-vote-sdk
Version:
A simple SDK for interacting with terminusbet governance
38 lines • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StakeState = void 0;
const borsh_1 = require("@coral-xyz/borsh");
const web3_js_1 = require("@solana/web3.js");
class StakeState {
discriminator;
operater;
stakeMintAuthor;
platformMint;
voucherMint;
platformMintTokenAccount;
voucherMintTokenAccount;
constructor(discriminator, operater, stakeMintAuthor, platformMint, voucherMint, platformMintTokenAccount, voucherMintTokenAccount) {
this.discriminator = discriminator;
this.operater = operater;
this.stakeMintAuthor = stakeMintAuthor;
this.platformMint = platformMint;
this.voucherMint = voucherMint;
this.platformMintTokenAccount = platformMintTokenAccount;
this.voucherMintTokenAccount = voucherMintTokenAccount;
}
static fromBuffer(buffer) {
const structure = (0, borsh_1.struct)([
(0, borsh_1.u64)("discriminator"),
(0, borsh_1.publicKey)("operater"),
(0, borsh_1.publicKey)("stakeMintAuthor"),
(0, borsh_1.publicKey)("platformMint"),
(0, borsh_1.publicKey)("voucherMint"),
(0, borsh_1.publicKey)("platformMintTokenAccount"),
(0, borsh_1.publicKey)("voucherMintTokenAccount")
]);
let value = structure.decode(buffer);
return new StakeState(BigInt(value.discriminator), new web3_js_1.PublicKey(value.operater), new web3_js_1.PublicKey(value.stakeMintAuthor), new web3_js_1.PublicKey(value.platformMint), new web3_js_1.PublicKey(value.voucherMint), new web3_js_1.PublicKey(value.platformMintTokenAccount), new web3_js_1.PublicKey(value.voucherMintTokenAccount));
}
}
exports.StakeState = StakeState;
//# sourceMappingURL=stakeState.js.map