@firefly-exchange/library-sui
Version:
Sui library housing helper methods, classes to interact with Bluefin protocol(s) deployed on Sui
113 lines (112 loc) • 5.11 kB
TypeScript
import { IBluefinSpotContracts, IOnChainCallOptionalParams, IPosition, ISignerConfig } from "../spot";
import { OnChainCallResponse, Signer, SuiClient } from "../types";
import { Address, ID } from "../types";
import { AuqadityContracts, ClosePositionArgs, CollectFeeArgs, CollectRewardArgs, CreateVaultArgs, FundVaultArgs, OpenPositionArgs, ProvideLiquidityArgs, RemoveLiquidityArgs, Reserves, UpdateUsersArgs, Vault, WithdrawFundArgs } from "./types";
export declare class OnChainCalls {
suiClient: SuiClient;
contracts: AuqadityContracts;
spotContracts: IBluefinSpotContracts;
signerConfig: ISignerConfig;
constructor(_suiClient: SuiClient, _contracts: AuqadityContracts, options?: {
spotContracts?: IBluefinSpotContracts;
signer?: Signer;
address?: Address;
isUIWallet?: boolean;
});
/**
* Returns the vaults of provided name
* @param name Name of the vault(s) to look for
* @returns Array of vaults
*/
getVaultByName(name: string): Array<Vault>;
/**
* Fetches the state of vault from chain
* @param id
* @returns
*/
getVaultFromChain(id: ID): Promise<Vault>;
/**
* Returns all positions opened using the funds of provided vault
* @param vault The id of the vault
* @returns array of positions
*/
getVaultPositions(vault: ID): Promise<Array<IPosition>>;
/**
* Returns the current available reserves of each token that vault holds
* @param vault The id of the vault
* @returns Array of coin reserves
*/
getVaultReserves(vault: ID): Promise<Array<Reserves>>;
/**
* @notice Allows caller to create a vault. Any one is allowed to create a vault.
* @param args CreateVaultArgs
* @param options: OnChain params call
* Returns OnChainCallResponse
*/
createVault(args: CreateVaultArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* @notice Allows caller to deposit funds into the vault for its users to use
* @param args FundVaultArgs
* @param options: OnChain params call
* Returns OnChainCallResponse
*/
provideFunds(args: FundVaultArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* @notice Allows vault manager to withdraw funds from the vault
* @param args WithdrawFundArgs
* @param options: OnChain params call
* Returns OnChainCallResponse
*/
withdrawFunds(args: WithdrawFundArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* @notice Allows vault manager to add/whitelist or remove/blacklist users from the vault
* @param args UpdateUsersArgs
* @param options: OnChain params call
* Returns OnChainCallResponse
*/
updateUsers(args: UpdateUsersArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to open a position for the provided pool for given ticks
* using the specified vault funds
* @param args OpenPositionArgs
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
openPosition(args: OpenPositionArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to provide liquidity to a position opened using the vault on bluefin spot protocol
* @param args Provide liquidity arguments
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
provideLiquidity(args: ProvideLiquidityArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to remove liquidity from a position opened using the vault on bluefin spot protocol
* @param args Remove liquidity arguments
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
removeLiquidity(args: RemoveLiquidityArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to collect any fee accrued in the position opened on bluefin spot pools using vault funds
* @param args Collect Fee Arguments
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
collectFee(args: CollectFeeArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to collect the rewards accrued of given coin type on a position opened on bluefin spot pools
* @param args Collect Reward Arguments
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
collectReward(args: CollectRewardArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
/**
* Allows caller to close a position on bluefin spot protocol
* @param args Close Position Arguments
* @param options IOnChainCallOptionalParams
* @returns Onchain call response
*/
closePosition(args: ClosePositionArgs, options?: IOnChainCallOptionalParams): Promise<OnChainCallResponse>;
private setAndExecute;
}