UNPKG

@terminusbet/stake-vote-sdk

Version:

A simple SDK for interacting with terminusbet governance

34 lines 1.51 kB
import { struct, publicKey, u64 } from "@coral-xyz/borsh"; import { PublicKey } from "@solana/web3.js"; export 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 = struct([ u64("discriminator"), publicKey("operater"), publicKey("stakeMintAuthor"), publicKey("platformMint"), publicKey("voucherMint"), publicKey("platformMintTokenAccount"), publicKey("voucherMintTokenAccount") ]); let value = structure.decode(buffer); return new StakeState(BigInt(value.discriminator), new PublicKey(value.operater), new PublicKey(value.stakeMintAuthor), new PublicKey(value.platformMint), new PublicKey(value.voucherMint), new PublicKey(value.platformMintTokenAccount), new PublicKey(value.voucherMintTokenAccount)); } } //# sourceMappingURL=stakeState.js.map