@sol-synth-engine/js-client
Version:
JavaScript client for Sol Synth Engine
144 lines (143 loc) • 5.03 kB
TypeScript
import { Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
import BN from "bn.js";
import { Program } from "@coral-xyz/anchor";
import { SolSynthEngine } from "./idls/sol_synth_engine";
export interface InitializeProtocolConfigParams {
configIndex: number;
protocolFeeBps: number;
feeAuthority: PublicKey;
payer: PublicKey;
}
export declare function createInitializeProtocolConfigInstruction(program: Program<SolSynthEngine>, params: InitializeProtocolConfigParams): Promise<{
instruction: TransactionInstruction;
config: PublicKey;
}>;
export interface CreateMarketParams {
marketIndex: number;
adminAuthority: PublicKey;
operator: PublicKey;
marketName: string;
syntheticMintDecimals: number;
minRedeemAmount: BN;
maxSyntheticSupply: BN;
oracleSource: any;
protocolConfig: PublicKey;
signer: PublicKey;
syntheticMint: PublicKey;
syntheticOracle: PublicKey;
treasuryAuthority: PublicKey;
tokenProgram: PublicKey;
}
export declare function createCreateMarketInstruction(program: Program<SolSynthEngine>, params: CreateMarketParams): Promise<{
instruction: TransactionInstruction;
market: PublicKey;
}>;
export interface AddUnderlyingTokenParams {
signer: PublicKey;
market: PublicKey;
underlyingToken: PublicKey;
underlyingTokenOracle: PublicKey;
tokenProgram: PublicKey;
maxUnderlyingCapacity: BN;
oracleSource: any;
minDepositAmount: BN;
}
export declare function createAddUnderlyingTokenInstruction(program: Program<SolSynthEngine>, params: AddUnderlyingTokenParams): Promise<{
instruction: TransactionInstruction;
marketUnderlyingTokenAccount: PublicKey;
}>;
export interface AddTreasuryParams {
market: PublicKey;
treasuryMint: PublicKey;
oracleSource: any;
signer: PublicKey;
treasuryOracle: PublicKey;
tokenProgram: PublicKey;
maxTreasuryCapacity: BN;
}
export declare function createAddTreasuryInstruction(program: Program<SolSynthEngine>, params: AddTreasuryParams): Promise<{
instruction: TransactionInstruction;
marketTreasuryAccount: PublicKey;
}>;
export interface CreateMintParams {
amount: BN;
minMintAmount: BN;
protocolConfig: PublicKey;
market: PublicKey;
marketUnderlyingTokenAccount: PublicKey;
userUnderlyingTokenAccount: PublicKey;
userSyntheticAccount: PublicKey;
syntheticMint: PublicKey;
underlyingTokenMint: PublicKey;
syntheticOracle: PublicKey;
underlyingTokenOracle: PublicKey;
tokenProgramUnderlying: PublicKey;
tokenProgramSynthetic: PublicKey;
signer: PublicKey;
}
export declare function createMintInstruction(program: Program<SolSynthEngine>, params: CreateMintParams): Promise<TransactionInstruction>;
export interface CreateRequestRedeemParams {
amount: BN;
protocolConfig: PublicKey;
market: PublicKey;
userSyntheticAccount: PublicKey;
receiverUnderlyingTokenAccount: PublicKey;
syntheticMint: PublicKey;
underlyingTokenMint: PublicKey;
tokenProgram: PublicKey;
signer: PublicKey;
}
export declare function createRequestRedeemInstruction(program: Program<SolSynthEngine>, params: CreateRequestRedeemParams): Promise<{
instruction: TransactionInstruction;
redeemRequest: Keypair;
}>;
export interface CreateRedeemParams {
protocolConfig: PublicKey;
market: PublicKey;
marketUnderlyingTokenAccount: PublicKey;
underlyingTokenMint: PublicKey;
underlyingTokenOracle: PublicKey;
syntheticOracle: PublicKey;
tokenProgram: PublicKey;
signer: PublicKey;
redeemPairs: {
redeemRequest: PublicKey;
receiverUnderlyingTokenAccount: PublicKey;
}[];
}
export declare function createRedeemInstruction(program: Program<SolSynthEngine>, params: CreateRedeemParams): Promise<TransactionInstruction>;
export interface CreateFlashBorrowParams {
amount: BN;
tokenToBorrow: any;
tokenToRepay: any;
minAmountToRepay: BN;
protocolConfig: PublicKey;
market: PublicKey;
marketTokenAccountToBorrow: PublicKey;
userTokenAccountToBorrow: PublicKey;
tokenMintToBorrow: PublicKey;
tokenOracle: PublicKey;
tokenProgram: PublicKey;
signer: PublicKey;
}
export interface CreateFlashRepayParams {
amount: BN;
tokenToBorrow: any;
tokenToRepay: any;
minAmountToRepay: BN;
protocolConfig: PublicKey;
market: PublicKey;
loan: PublicKey;
marketTokenAccountToRepay: PublicKey;
userTokenAccountToRepay: PublicKey;
tokenMintToRepay: PublicKey;
tokenMintBorrowed: PublicKey;
tokenOracle: PublicKey;
tokenProgram: PublicKey;
signer: PublicKey;
}
export declare function createFlashBorrowInstruction(program: Program<SolSynthEngine>, params: CreateFlashBorrowParams): Promise<{
instruction: TransactionInstruction;
loan: Keypair;
}>;
export declare function createFlashRepayInstruction(program: Program<SolSynthEngine>, params: CreateFlashRepayParams): Promise<TransactionInstruction>;