@widolabs/collateral-swap-sdk
Version:
TypeScript SDK for interacting with the Wido protocol to allow collateral swaps on Compound Comet.
38 lines (37 loc) • 1.29 kB
TypeScript
import { Deployment, UserAsset, UserAssets } from '../types';
import { LoanProvider } from '../providers/loanProvider';
import { BigNumber } from 'ethers';
export declare const widoCollateralSwapAddress: Record<number, Record<LoanProvider, string>>;
/**
* Get contract address from the comet key
* @param cometKey
*/
export declare function getCometAddress(cometKey: string): string;
/**
* Convert comet key to chain ID
* @param comet
*/
export declare function getChainId(comet: string): number;
/**
* Returns the deployment details of a Comet
* @param comet
*/
export declare function getDeploymentDetails(comet: string): Deployment | undefined;
/**
* Seek and return a collateral from the list, by address
* @param collaterals
* @param asset
*/
export declare function pickAsset(collaterals: UserAssets, asset: string): UserAsset;
/**
* Formats an `amount` of `decimals` precision into a string for the UI
*/
export declare function formatNumber(amount: BigNumber, decimals: number, precision?: number): number;
/**
* Returns the given amount in split in two parts: `integer` and `decimal`
* so it can be formatted and shown as necessary
*/
export declare function getAmountParts(amount: BigNumber, decimals: number): {
integer: string;
decimal: string;
};