@infy-protocol/sdk
Version:
Lend and rent any ERC721s and ERC1155s on supported mainnet and testnet.
55 lines (54 loc) • 2.18 kB
TypeScript
import { BigNumber } from 'ethers';
import { NFTStandard } from './types';
declare type IObjectKeysValues = string[] | BigNumber[] | boolean[] | number[] | string[][] | string[][][] | number[][] | [string[], number[]][];
interface IObjectKeys {
[key: string]: IObjectKeysValues | undefined;
}
interface PrepareBatch extends IObjectKeys {
nftStandards: NFTStandard[];
nftAddresses: string[];
tokenIds: BigNumber[];
lendAmounts?: BigNumber[];
rentAmounts?: BigNumber[];
maxRentDurations?: number[];
minRentDurations?: number[];
dailyRentPrices?: BigNumber[];
collateralPrices?: BigNumber[];
paymentOptions?: number[];
rentDurations?: number[];
lendingIds?: BigNumber[];
rentingIds?: BigNumber[];
allowedRenters?: string[][][];
}
interface PrepareRevenueShareBatch extends IObjectKeys {
nftStandards?: NFTStandard[];
nftAddresses: string[];
tokenIds: BigNumber[];
lendAmounts?: BigNumber[];
rentAmounts?: BigNumber[];
maxRentDurations?: number[];
paymentOptions?: number[];
rentDurations?: number[];
lendingIds?: BigNumber[];
rentingIds?: BigNumber[];
upfrontFees?: BigNumber[];
revenueShareInfos?: [string[], number[]][];
allowedRenters?: string[][][];
revenueAmounts?: BigNumber[];
renters?: string[];
revenueTokenAddress?: string[];
}
/**
* To spend as little gas as possible, arguments must follow a particular format
* when passed to the contract. This function prepares whatever inputs you want
* to send, and returns the inputs in an optimal format.
*
* This algorithm's time complexity is pretty awful. But, it will never run on
* large arrays, so it doesn't really matter.
* @param args
*/
export declare const prepareBatch: (args: PrepareBatch) => PrepareBatch;
export declare const prepareRevenueShareBatch: (args: PrepareRevenueShareBatch) => PrepareRevenueShareBatch;
export declare const bigNumberToWei: (amount: string | number, decimal?: string | number) => string;
export declare const bigNumberToEther: (amount: string | number, decimal?: string | number) => string;
export {};