@volare.finance/volare.js
Version:
The SDK for Volare Protocol
45 lines (44 loc) • 1.95 kB
TypeScript
/**
* @file Exchange.ts
* @author astra <astra@volare.com>
* @date 2022
*/
import { TransactionResponse } from '@ethersproject/providers';
import { Address, BigNumber, ERC20, Hash, IERC20Address, Provider } from '@volare.finance/utils.js';
import { ContractInterface, Wallet } from 'ethers';
import { IVolareAddress } from './contracts';
import { INativeOrder, LimitOrderFields, OrderInfo } from './orders';
export interface IExchangeOptions {
endpoint: string;
contracts: IERC20Address & IVolareAddress;
}
export declare class Exchange extends Provider {
usdc: ERC20;
static ABI(): ContractInterface;
constructor(options: IExchangeOptions);
getLimitOrderRelevantState(order: INativeOrder): Promise<OrderInfo>;
getLimitOrderHash(order: LimitOrderFields): Promise<Hash>;
/***
* @param maker
* @param order
*/
cancelLimitOrder(maker: Wallet, order: INativeOrder): Promise<TransactionResponse>;
/**
* @param maker The maker wallet
* @param assetAddress The address of asset being bought by the maker.
* @param assetAmount The amount of asset being bought by the maker.
* @param assetPrice The price of asset filled by the maker.
* @param expiry The unix timestamp in seconds when this order expires.
* @returns
*/
buy(maker: Wallet, assetAddress: Address, assetAmount: BigNumber, assetPrice: BigNumber, expiry: number): Promise<INativeOrder>;
/**
* @param maker The maker wallet (ethers.Wallet)
* @param assetAddress The address of asset being bought by the maker.
* @param assetAmount The amount of asset being bought by the maker.
* @param assetPrice The price of asset filled by the maker.
* @param expiry The unix timestamp in seconds when this order expires.
* @returns
*/
sell(maker: Wallet, assetAddress: Address, assetAmount: BigNumber, assetPrice: BigNumber, expiry: number): Promise<INativeOrder>;
}