UNPKG

@surec/oracle

Version:

Typescript SDK for the Sure Oracle to be used to bring off-chain data on-chain

95 lines 2.78 kB
/// <reference types="node" /> import * as anchor from '@project-serum/anchor'; import { PublicKey } from '@solana/web3.js'; import * as oracleIDL from './idls/oracle'; import { SureOracleSDK } from './sdk'; import { TransactionEnvelope } from '@saberhq/solana-contrib/dist/cjs'; declare type SubmitVote = { vote: anchor.BN; mint?: PublicKey; locker: PublicKey; userEscrow: PublicKey; proposal: PublicKey; }; declare type UpdateVote = { vote: anchor.BN; proposal: PublicKey; }; declare type CancelVote = { voteAccount: PublicKey; }; declare type RevealVote = { voteAccount: PublicKey; vote: anchor.BN; salt: Buffer; }; declare type CollectVoteReward = { voteAccount: PublicKey; tokenMint: PublicKey; }; declare type VoteTransactionEnvelope = { salt: Buffer; transactionEnvelope: TransactionEnvelope; }; export declare const createVoteHash: ({ vote, salt, }: { vote: anchor.BN; salt: Buffer; }) => Buffer; export declare const revealVote: ({ expectedVoteHash, vote, salt, }: { expectedVoteHash: number[]; vote: anchor.BN; salt: Buffer; }) => Boolean; export declare class Vote { readonly sdk: SureOracleSDK; readonly program: anchor.Program<oracleIDL.Oracle>; constructor(sdk: SureOracleSDK); /** * submit a vote to a proposal * * @param mint - mint of proposal vault * @param proposal - the proposal to vote on * @param locker - locker used to lock tokens, see Tribeca * @param userEscrow - escrow that holds the locked tokens * @returns */ submitVote({ vote, mint, proposal, locker, userEscrow, }: SubmitVote): Promise<VoteTransactionEnvelope>; /** * update vote * * @param mint - mint of proposal vault * @param proposal - the proposal to vote on * @returns */ updateVote({ vote, proposal, }: UpdateVote): Promise<VoteTransactionEnvelope>; /** * cancel vote * * @param voteAccout - the account used to vote with * @returns */ cancelVote({ voteAccount }: CancelVote): Promise<TransactionEnvelope>; /** * cancel vote * * @param voteAccount - the account used to vote with * @returns */ revealVote({ voteAccount, vote, salt, }: RevealVote): Promise<TransactionEnvelope>; /** * finalize vote * * @param voteAccount - the account used to vote with * @returns */ finalizeVote({ voteAccount, }: CancelVote): Promise<TransactionEnvelope>; /** * collect vote rewards * * @param voteAccount - the account used to vote with * @returns */ collectRewards({ voteAccount, tokenMint, }: CollectVoteReward): Promise<TransactionEnvelope>; } export {}; //# sourceMappingURL=vote.d.ts.map