@algofi/v0
Version:
The official JavaScript SDK for Algofi
117 lines (116 loc) • 4.39 kB
TypeScript
import { Algodv2 } from "algosdk";
/**
* Function to get the storage address for an algofi user. This address is stored in the users local state.
* If the user clears their local state, their storage contract is irrecoverable.
*
* @param {accountInformation} accountInfo - Address of user
*
* @return {string} storageAccont - Storage address of user
*/
export declare function getStorageAddress(accountInfo: any, stakeAsset?: string): Promise<string>;
/**
* Function to get oracle price info
*
* @param {Algodv2} algodClient
*
* @return {dict<string,int} prices
*/
export declare function getPriceInfo(algodClient: Algodv2): Promise<{}>;
/**
* Get balance info from and accountInformation object
*
* @param {AccountInformation} accountInfo
*
* @return {dict<string,int>} balanceInfo - dictionary of asset names to balances
*/
export declare function getBalanceInfoFromAccountInfo(accountInfo: any): Promise<{}>;
/**
* Get balance info for a given address
*
* @param {Algodv2} algodClient
* @param {string} address
*
* @return {dict<string,int>} balanceInfo - dictionary of asset names to balances
*/
export declare function getBalanceInfo(algodClient: Algodv2, address: string): Promise<{}>;
/**
* Function to get manager global state
*
* @param {Algodv2} algodClient
*
* @return {dict<string,int>} results - dictionary of global state for this market
*/
export declare function getGlobalManagerInfo(algodClient: Algodv2, stakeAsset?: string): Promise<{}>;
/**
* Function to get manager global state
*
* @param {AccountInformation} accountInfo
*
* @return {dict<string,int>} results - dictionary of global state for this market
*/
export declare function getUserManagerData(accountInfo: any, stakeAsset?: string): Promise<{}>;
/**
* Function to get a users local state in a given market
*
* @param {AccountInformation} accountInfo
* @param {any} globalData
* @param {string} assetName
*
* @return {dict<string,int>} results - dictionary of user market local state
*/
export declare function getUserMarketData(accountInfo: any, globalData: {}, assetName: string): Promise<{}>;
/**
* Function to get market global state
*
* @param {Algodv2} algodClient
* @param {number} marketId
*
* @return {dict<string,int>} results - dictionary of global state for this market
*/
export declare function getGlobalMarketInfo(algodClient: Algodv2, marketId: number): Promise<{}>;
/**
* Function to get extrapolate additional data from market global state
*
* @param {dict<string,int>} globalData - dictionary of market global state
* @param {dict<string,int>} prices
* @param {string} assetName
*
* @return {dict<string,int>} extrapolatedData - dictionary of market extrapolated values
*/
export declare function extrapolateMarketData(globalData: {}, prices: {}, assetName: string): Promise<{}>;
/**
* Function to extrapolate data from user data
*
* @param {dict<string,int>} userResults
* @param {dict<string,int>} userResults
* @param {string} assetName
*
* @return {dict<string,int>} extroplatedData
*/
export declare function extrapolateUserData(userResults: {}, globalResults: {}, assetName: string): Promise<{}>;
/**
* Function to extrapolate data from user data
*
* @param {dict<string,int>} userResults
*
* @return {dict<string,int>} extroplatedData
*/
export declare function updateGlobalTotals(globalResults: {}): Promise<void>;
/**
* Function to extrapolate data from user data
*
* @param {dict<string,int>} userResults
* @param {dict<string,int>} globalResults
* @param {string[]} activeMarkets
*
* @return {dict<string,int>} extroplatedData
*/
export declare function updateGlobalUserTotals(userResults: {}, globalResults: {}, activeMarkets: string[]): Promise<void>;
/**
* Function to calculate account opt in info
*
* @param {AccountInformation} accountInfo
*
* @return {dict<string,int>} userData - userData with added USD values
*/
export declare function getAccountOptInData(accountInfo: any): Promise<{}>;