diff options
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r-- | packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts | 12 | ||||
-rw-r--r-- | packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 10 | ||||
-rw-r--r-- | packages/0x.js/src/contract_wrappers/token_wrapper.ts | 13 | ||||
-rw-r--r-- | packages/0x.js/src/index.ts | 35 | ||||
-rw-r--r-- | packages/0x.js/src/order_watcher/order_state_watcher.ts | 25 | ||||
-rw-r--r-- | packages/0x.js/src/types.ts | 76 |
6 files changed, 52 insertions, 119 deletions
diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index 32c9ae6a9..db7cdee43 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -5,19 +5,11 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { - BlockRange, - EtherTokenContractEventArgs, - EtherTokenEvents, - EventCallback, - IndexedFilterValues, - TransactionOpts, - ZeroExError, -} from '../types'; +import { BlockRange, EventCallback, IndexedFilterValues, TransactionOpts, ZeroExError } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; -import { EtherTokenContract } from './generated/ether_token'; +import { EtherTokenContract, EtherTokenContractEventArgs, EtherTokenEvents } from './generated/ether_token'; import { TokenWrapper } from './token_wrapper'; /** diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index e0c85505c..c82b7ecf5 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -12,10 +12,7 @@ import { EventCallback, ExchangeContractErrCodes, ExchangeContractErrs, - ExchangeContractEventArgs, - ExchangeEvents, IndexedFilterValues, - LogErrorContractEventArgs, MethodOpts, Order, OrderAddresses, @@ -33,7 +30,12 @@ import { OrderValidationUtils } from '../utils/order_validation_utils'; import { utils } from '../utils/utils'; import { ContractWrapper } from './contract_wrapper'; -import { ExchangeContract } from './generated/exchange'; +import { + ExchangeContract, + ExchangeContractEventArgs, + ExchangeEvents, + LogErrorContractEventArgs, +} from './generated/exchange'; import { TokenWrapper } from './token_wrapper'; const SHOULD_VALIDATE_BY_DEFAULT = true; diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts index 98c24d059..a018006b8 100644 --- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts @@ -5,21 +5,12 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { - BlockRange, - EventCallback, - IndexedFilterValues, - MethodOpts, - TokenContractEventArgs, - TokenEvents, - TransactionOpts, - ZeroExError, -} from '../types'; +import { BlockRange, EventCallback, IndexedFilterValues, MethodOpts, TransactionOpts, ZeroExError } from '../types'; import { assert } from '../utils/assert'; import { constants } from '../utils/constants'; import { ContractWrapper } from './contract_wrapper'; -import { TokenContract } from './generated/token'; +import { TokenContract, TokenContractEventArgs, TokenEvents } from './generated/token'; import { TokenTransferProxyWrapper } from './token_transfer_proxy_wrapper'; /** diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index c3c8854da..161945443 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -9,26 +9,13 @@ export { ExchangeContractErrs, ContractEvent, Token, - ExchangeEvents, - TokenEvents, IndexedFilterValues, BlockRange, OrderCancellationRequest, OrderFillRequest, - LogErrorContractEventArgs, - LogCancelContractEventArgs, - LogFillContractEventArgs, - ExchangeContractEventArgs, - TransferContractEventArgs, - ApprovalContractEventArgs, - TokenContractEventArgs, - EtherTokenContractEventArgs, - WithdrawalContractEventArgs, - DepositContractEventArgs, ContractEventArgs, Web3Provider, ZeroExConfig, - EtherTokenEvents, MethodOpts, OrderTransactionOpts, TransactionOpts, @@ -50,4 +37,26 @@ export { TransactionReceiptWithDecodedLogs, } from '@0xproject/types'; +export { + EtherTokenContractEventArgs, + WithdrawalContractEventArgs, + DepositContractEventArgs, + EtherTokenEvents, +} from './contract_wrappers/generated/ether_token'; + +export { + TransferContractEventArgs, + ApprovalContractEventArgs, + TokenContractEventArgs, + TokenEvents, +} from './contract_wrappers/generated/token'; + +export { + LogErrorContractEventArgs, + LogCancelContractEventArgs, + LogFillContractEventArgs, + ExchangeContractEventArgs, + ExchangeEvents, +} from './contract_wrappers/generated/exchange'; + export { TransactionReceipt } from '@0xproject/types'; diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts index a9b3eba68..9ff07b38d 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -6,26 +6,33 @@ import * as _ from 'lodash'; import { ZeroEx } from '../0x'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; +import { + DepositContractEventArgs, + EtherTokenEvents, + WithdrawalContractEventArgs, +} from '../contract_wrappers/generated/ether_token'; +import { + ExchangeEvents, + LogCancelContractEventArgs, + LogFillContractEventArgs, +} from '../contract_wrappers/generated/exchange'; +import { + ApprovalContractEventArgs, + TokenEvents, + TransferContractEventArgs, +} from '../contract_wrappers/generated/token'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store'; import { - ApprovalContractEventArgs, + BlockParamLiteral, ContractEventArgs, - DepositContractEventArgs, - EtherTokenEvents, ExchangeContractErrs, - ExchangeEvents, - LogCancelContractEventArgs, LogEvent, - LogFillContractEventArgs, OnOrderStateChangeCallback, OrderState, OrderStateWatcherConfig, SignedOrder, - TokenEvents, - TransferContractEventArgs, - WithdrawalContractEventArgs, ZeroExError, } from '../types'; import { assert } from '../utils/assert'; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index a2d1b9eb4..ab97f7775 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -4,6 +4,10 @@ import { BlockParam, BlockParamLiteral, ContractEventArg, LogWithDecodedArgs } f import * as Web3 from 'web3'; +import { EtherTokenContractEventArgs, EtherTokenEvents } from './contract_wrappers/generated/ether_token'; +import { ExchangeContractEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange'; +import { TokenContractEventArgs, TokenEvents } from './contract_wrappers/generated/token'; + export enum ZeroExError { ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', @@ -101,60 +105,6 @@ export interface ContractEvent { args: ContractEventArgs; } -export interface LogFillContractEventArgs { - maker: string; - taker: string; - feeRecipient: string; - makerToken: string; - takerToken: string; - filledMakerTokenAmount: BigNumber; - filledTakerTokenAmount: BigNumber; - paidMakerFee: BigNumber; - paidTakerFee: BigNumber; - tokens: string; - orderHash: string; -} -export interface LogCancelContractEventArgs { - maker: string; - feeRecipient: string; - makerToken: string; - takerToken: string; - cancelledMakerTokenAmount: BigNumber; - cancelledTakerTokenAmount: BigNumber; - tokens: string; - orderHash: string; -} -export interface LogErrorContractEventArgs { - errorId: BigNumber; - orderHash: string; -} -export type ExchangeContractEventArgs = - | LogFillContractEventArgs - | LogCancelContractEventArgs - | LogErrorContractEventArgs; -export interface TransferContractEventArgs { - _from: string; - _to: string; - _value: BigNumber; -} -export interface ApprovalContractEventArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} -export interface DepositContractEventArgs { - _owner: string; - _value: BigNumber; -} -export interface WithdrawalContractEventArgs { - _owner: string; - _value: BigNumber; -} -export type TokenContractEventArgs = TransferContractEventArgs | ApprovalContractEventArgs; -export type EtherTokenContractEventArgs = - | TokenContractEventArgs - | DepositContractEventArgs - | WithdrawalContractEventArgs; export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; export interface Order { @@ -197,24 +147,6 @@ export interface TokenAddressBySymbol { [symbol: string]: string; } -export enum ExchangeEvents { - LogFill = 'LogFill', - LogCancel = 'LogCancel', - LogError = 'LogError', -} - -export enum TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export enum EtherTokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', - Deposit = 'Deposit', - Withdrawal = 'Withdrawal', -} - export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents; export interface IndexedFilterValues { |