factored out interfaces in types.ts

This commit is contained in:
Daniel Pyrathon
2020-03-02 10:12:51 -08:00
parent 82de5adbe9
commit 599af2b1a9
3 changed files with 11 additions and 10 deletions

View File

@@ -2,14 +2,7 @@ import { IERC20BridgeSamplerContract } from '@0x/contract-wrappers';
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { samplerOperations } from './sampler_operations'; import { samplerOperations } from './sampler_operations';
import { BatchedOperation } from './types';
/**
* A composable operation the be run in `DexOrderSampler.executeAsync()`.
*/
export interface BatchedOperation<TResult> {
encodeCall(contract: IERC20BridgeSamplerContract): string;
handleCallResultsAsync(contract: IERC20BridgeSamplerContract, callResults: string): Promise<TResult>;
}
/** /**
* Generate sample amounts up to `maxFillAmount`. * Generate sample amounts up to `maxFillAmount`.

View File

@@ -2,8 +2,7 @@ import { constants } from 'zlib';
import { BigNumber, ERC20BridgeSource, SignedOrder } from '../..'; import { BigNumber, ERC20BridgeSource, SignedOrder } from '../..';
import { BatchedOperation } from './sampler'; import { BatchedOperation, DexSample } from './types';
import { DexSample } from './types';
/** /**
* Composable operations that can be batched in a single transaction, * Composable operations that can be batched in a single transaction,

View File

@@ -1,3 +1,4 @@
import { IERC20BridgeSamplerContract } from '@0x/contract-wrappers';
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { SignedOrderWithFillableAmounts } from '../../types'; import { SignedOrderWithFillableAmounts } from '../../types';
@@ -176,3 +177,11 @@ export interface GetMarketOrdersOpts {
*/ */
fees: { [source: string]: BigNumber }; fees: { [source: string]: BigNumber };
} }
/**
* A composable operation the be run in `DexOrderSampler.executeAsync()`.
*/
export interface BatchedOperation<TResult> {
encodeCall(contract: IERC20BridgeSamplerContract): string;
handleCallResultsAsync(contract: IERC20BridgeSamplerContract, callResults: string): Promise<TResult>;
}