UNPKG

goosefx-stake-rewards-sdk

Version:

A SDK for interfacing with the GooseFX stake rewards program

80 lines (79 loc) 4.54 kB
import { Network } from '../constants'; import { ConfirmOptions, Connection, PublicKey, TransactionInstruction } from '@solana/web3.js'; import * as anchor from '@project-serum/anchor'; import { Program, Wallet } from '@project-serum/anchor'; import { FeesCollected, GOFXUnstaked, GOFXVault, StakePool, UnstakeableTicket, UnstakeTicket, USDCRewardVault, UserMetadata, GfxStakeRewardsProgramTypes } from '../types'; import { Swap } from 'goosefx-ssl-sdk'; export interface SwapRouteParams { ammProgram: PublicKey; state: PublicKey; config: PublicKey; authority: PublicKey; inputVault: PublicKey; outputVault: PublicKey; inputTokenProgram: PublicKey; outputTokenProgram: PublicKey; observationState: PublicKey; inputMint: PublicKey; outputMint: PublicKey; amountIn?: anchor.BN; minOut?: anchor.BN; inputTokenAccount?: PublicKey; } type LSTRewardsAccount = anchor.IdlAccounts<GfxStakeRewardsProgramTypes>['lstRewards']; type TokenCrankAccount = anchor.IdlAccounts<GfxStakeRewardsProgramTypes>['tokenCrank']; export declare class GfxStakeRewards { connection: Connection; network: Network; wallet: Wallet; program: Program<GfxStakeRewardsProgramTypes>; swap: Swap; static programId: PublicKey; constructor(connection: Connection, network: Network, wallet: Wallet); setConnection(conn: Connection, network: Network, commitment?: ConfirmOptions): void; setWallet(wallet: Wallet, commitment?: ConfirmOptions): void; setNetwork(network: Network, commitment?: ConfirmOptions): void; newProgram(commitment?: ConfirmOptions): anchor.Program<GfxStakeRewardsProgramTypes>; newSwap(): Swap; initializeUserAccount(secondaryFunder?: PublicKey, walletPublicKey?: PublicKey): Promise<TransactionInstruction>; crank(mint: PublicKey): Promise<TransactionInstruction>; crankV2Single(swap: SwapRouteParams): Promise<TransactionInstruction>; crankV2TwoHop(swap1: SwapRouteParams, swap2: SwapRouteParams): Promise<TransactionInstruction[]>; crankUserRewardsHoldingAccount(user?: PublicKey): Promise<TransactionInstruction>; stake(amount: anchor.BN, walletPublicKey?: PublicKey): Promise<TransactionInstruction>; unstake(amount: anchor.BN, walletPublicKey?: PublicKey): Promise<TransactionInstruction>; initializeTokenCrank(tokenCrank: PublicKey, outputMint: PublicKey, destinationOwner: PublicKey, payer?: PublicKey): Promise<TransactionInstruction>; crankTokensViaGammaSwap(crank: PublicKey, swap: SwapRouteParams, output?: { owner: PublicKey; mint: PublicKey; }): Promise<TransactionInstruction[]>; initializeLstRewards(authority: PublicKey, destinationReserveAccount: PublicKey, payer?: PublicKey): Promise<TransactionInstruction>; updateLstRewards(newAuthority: PublicKey | null, newDestinationReserveAccount: PublicKey | null, authority?: PublicKey): Promise<TransactionInstruction>; transferLSTRewards(reserveAccount: PublicKey, outputMint?: PublicKey): Promise<TransactionInstruction>; isUnstakingTicketClaimable(createdAt: number): boolean; resolveUnstakingTicket(unstakeableTickets: number[], walletPublicKey?: PublicKey): Promise<TransactionInstruction>; claimFees(walletPublicKey?: PublicKey): Promise<TransactionInstruction>; closeUserAccount(rentRecipient?: PublicKey, walletPublicKey?: PublicKey): Promise<TransactionInstruction>; getStakePool(): Promise<StakePool>; getUSDCRewardVault(): Promise<USDCRewardVault>; getFeesCollected(mint?: PublicKey): Promise<FeesCollected>; getGoFxVault(): Promise<GOFXVault>; getGoFxUnstakedVault(): Promise<GOFXUnstaked>; getUserMetaData(walletPublicKey?: PublicKey): Promise<UserMetadata>; getUnstakingTickets(walletPublicKey?: PublicKey): Promise<UnstakeTicket[]>; getCrankSignerPDA(crank: PublicKey, programOverride?: PublicKey): { publicKey: PublicKey; nonce: number; }; getLSTRewardsPDA(programOverride?: PublicKey): { publicKey: PublicKey; nonce: number; }; getLSTRewardsAccount(address?: PublicKey): Promise<LSTRewardsAccount>; getTokenCrankAccount(address: PublicKey): Promise<TokenCrankAccount>; getUnstakeableTickets(unstakingTickets: UnstakeTicket[]): UnstakeableTicket[]; getTotalUnstakeClaimable(unstakeableTickets: UnstakeableTicket[]): number; getUserRewardsHoldingAccount(walletPublicKey?: PublicKey): Promise<PublicKey>; getUserRewardsHoldingAmount(walletPublicKey?: PublicKey): Promise<string>; } export {};