@surec/oracle
Version:
Typescript SDK for the Sure Oracle to be used to bring off-chain data on-chain
65 lines • 2.58 kB
TypeScript
/// <reference types="bn.js" />
import * as anchor from '@project-serum/anchor';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import { Oracle } from './idls/oracle.js';
import { SureOracleSDK } from './sdk.js';
import { TransactionEnvelope } from '@saberhq/solana-contrib/dist/cjs';
import { ConfigType } from './program.js';
export declare type InitializeOracleConfig = {
protocolAuthority: PublicKey;
tokenMint: PublicKey;
};
export declare type UpdateConfig = {
proposalPk: PublicKey;
votingPeriod?: anchor.BN;
revealPeriod?: anchor.BN;
requiredVotes?: anchor.BN;
minimumProposalStake?: anchor.BN;
voteStakeRate?: number;
protocolFeeRate?: number;
};
export declare class Config {
readonly sdk: SureOracleSDK;
readonly program: anchor.Program<Oracle>;
constructor(sdk: SureOracleSDK);
fetchConfig({ tokenMint, }: {
tokenMint: PublicKey;
}): Promise<ConfigType>;
/**
* initialize oracle config
*
* initialize
*
* @param protocolAuthority - owner of the config
* @param tokenMint - mint of vault
*/
initializeOracleConfig({ protocolAuthority, tokenMint, }: InitializeOracleConfig): Promise<TransactionEnvelope>;
/**
* update oracle config
*
* @param proposalPk - public key of proposal
* @param votingPeriod - the voting period in seconds
* @param revealPeriod - the period for which the users can reveal their vote in seconds
* @param requiredVotes - the number of required voted to reach quorum
* @param minimumProposalStake - the minimum amount of stake a proposer needs to put into the vault (escrow)
* @param voteStakeRate - the 1/x of total voting power the user have to deposit to vote
* @param protocolFeeRate - the 1/x the protocol will extract from the voting pool
*
* @returns TransactionEnvelope
*/
updateConfigInstructions({ proposalPk, votingPeriod, revealPeriod, requiredVotes, minimumProposalStake, voteStakeRate, protocolFeeRate, }: UpdateConfig): Promise<TransactionInstruction[]>;
/**
* collect protocol fees
*
*
* @params tokenMint - the mint of the vault
* @params proposalName - name of the proposal
* @params feeDestination - the token account for where to send the fees
*/
collectProtocolFees({ tokenMint, proposalName, feeDestination, }: {
tokenMint: PublicKey;
proposalName: string;
feeDestination: PublicKey;
}): Promise<TransactionEnvelope>;
}
//# sourceMappingURL=config.d.ts.map