aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/types.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-09-14 22:18:16 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-09-15 20:14:48 +0800
commit7b46cef83dca0a743bd598a70076004983cbf294 (patch)
tree420bed06e9eb99270cf674a767cb6b1b31440219 /packages/asset-buyer/src/types.ts
parent8da7d399981472ff9cbfa28fb0957a530de72b2d (diff)
downloaddexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar.gz
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar.bz2
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar.lz
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar.xz
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.tar.zst
dexon-sol-tools-7b46cef83dca0a743bd598a70076004983cbf294.zip
Create initial AssetBuyer class
Diffstat (limited to 'packages/asset-buyer/src/types.ts')
-rw-r--r--packages/asset-buyer/src/types.ts63
1 files changed, 28 insertions, 35 deletions
diff --git a/packages/asset-buyer/src/types.ts b/packages/asset-buyer/src/types.ts
index a7f02ff8d..8a12d0cf8 100644
--- a/packages/asset-buyer/src/types.ts
+++ b/packages/asset-buyer/src/types.ts
@@ -1,49 +1,42 @@
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
-export enum ForwarderHelperFactoryError {
- NoEtherTokenContractFound = 'NO_ETHER_TOKEN_CONTRACT_FOUND',
- NoZrxTokenContractFound = 'NO_ZRX_TOKEN_CONTRACT_FOUND',
- StandardRelayerApiError = 'STANDARD_RELAYER_API_ERROR',
-}
-
-export interface ForwarderHelper {
- /**
- * Given a MarketBuyOrdersInfoRequest, returns a MarketBuyOrdersInfo containing all information relevant to fulfilling the request
- * using the ForwarderContract marketBuyOrdersWithEth function.
- * @param request An object that conforms to MarketBuyOrdersInfoRequest. See type definition for more information.
- * @return An object that conforms to MarketBuyOrdersInfo that satisfies the request. See type definition for more information.
- */
- getMarketBuyOrdersInfo: (request: MarketBuyOrdersInfoRequest) => MarketBuyOrdersInfo;
-}
-
-export enum ForwarderHelperError {
- InsufficientMakerAssetLiquidity = 'INSUFFICIENT_MAKER_ASSET_LIQUIDITY',
- InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY',
-}
-
/**
- * makerAssetFillAmount: The amount of makerAsset requesting to be filled
- * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations
+ * assetBuyAmount: The amount of asset to buy.
+ * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations.
*/
-export interface MarketBuyOrdersInfoRequest {
- makerAssetFillAmount: BigNumber;
+export interface BuyQuoteRequest {
+ assetBuyAmount: BigNumber;
feePercentage?: BigNumber;
}
/**
- * makerAssetFillAmount: The amount of makerAsset requesting to be filled
- * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested makerAssetFillAmount plus slippage
- * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above
- * minEthAmount: Amount of eth in wei to send with the tx for the most optimistic case
- * maxEthAmount: Amount of eth in wei to send with the tx for the worst case
- * feePercentage: Affiliate fee percentage used to calculate the eth amounts above. Passed thru directly from the request
+ * assetData: The asset information.
+ * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested assetBuyAmount plus slippage.
+ * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above.
+ * minRate: Min rate that needs to be paid in order to execute the buy.
+ * maxRate: Max rate that can be paid in order to execute the buy.
+ * assetBuyAmount: The amount of asset to buy. Passed through directly from the request.
+ * feePercentage: Affiliate fee percentage used to calculate the eth amounts above. Passed through directly from the request.
*/
-export interface MarketBuyOrdersInfo {
- makerAssetFillAmount: BigNumber;
+export interface BuyQuote {
+ assetData: string;
orders: SignedOrder[];
feeOrders: SignedOrder[];
- minEthAmount: BigNumber;
- maxEthAmount: BigNumber;
+ minRate: BigNumber;
+ maxRate: BigNumber;
+ assetBuyAmount: BigNumber;
feePercentage?: BigNumber;
}
+
+/**
+ * Possible errors thrown by an AssetBuyer instance or associated static methods
+ */
+export enum AssetBuyerError {
+ NoEtherTokenContractFound = 'NO_ETHER_TOKEN_CONTRACT_FOUND',
+ NoZrxTokenContractFound = 'NO_ZRX_TOKEN_CONTRACT_FOUND',
+ StandardRelayerApiError = 'STANDARD_RELAYER_API_ERROR',
+ InsufficientAssetLiquidity = 'INSUFFICIENT_ASSET_LIQUIDITY',
+ InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY',
+ NoAddressAvailable = 'NO_ADDRESS_AVAILABLE',
+}