@surec/oracle
Version:
Typescript SDK for the Sure Oracle to be used to bring off-chain data on-chain
57 lines • 1.89 kB
TypeScript
import * as anchor from '@project-serum/anchor';
import { PublicKey } from '@solana/web3.js';
import * as oracleIDL from './idls/oracle';
import { SureOracleSDK } from './sdk.js';
import { TransactionEnvelope } from '@saberhq/solana-contrib/dist/cjs';
import { ProposalType } from './program.js';
import { ProgramAccount } from '@project-serum/anchor';
declare type ProposeVote = {
name: string;
description: string;
stake: anchor.BN;
mint?: PublicKey;
};
declare type FinalizeVoteResults = {
proposal: PublicKey;
};
declare type CollectProposerReward = {
proposal: PublicKey;
tokenMint: PublicKey;
};
export declare class Proposal {
readonly sdk: SureOracleSDK;
readonly program: anchor.Program<oracleIDL.Oracle>;
constructor(sdk: SureOracleSDK);
fetchAllProposals(): Promise<ProgramAccount<ProposalType>[]>;
fetchProposal({ name }: {
name: string;
}): Promise<ProposalType>;
/**
* propose vote
*
* propose a vote
*
* @param name - name of vote
* @param description - description of vote
* @param stake - the amount of stake the user bets on the vote
* @param mint <optional> - SURE MINT if nothing specified
* @returns
*/
proposeVote({ name, description, stake, mint, }: ProposeVote): Promise<TransactionEnvelope>;
/**
* finalize vote resul ts
*
* @param proposal - the proposal PK
* @returns TransactionEnvelope - a new transaction
*/
finalizeVoteResults({ proposal, }: FinalizeVoteResults): Promise<TransactionEnvelope>;
/**
* collect proposer rewards
*
* @param proposal - the proposal PK
* @returns TransactionEnvelope - a new transaction
*/
collectProposerRewards({ proposal, tokenMint, }: CollectProposerReward): Promise<TransactionEnvelope>;
}
export {};
//# sourceMappingURL=proposal.d.ts.map