diff options
author | Fabio Berger <me@fabioberger.com> | 2018-01-30 20:21:01 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-01-30 20:21:01 +0800 |
commit | 93a5b3f457c1211676296840c285759007a55500 (patch) | |
tree | d1682b657c207f447748e08550095bafc79b6997 /packages/0x.js/src/types.ts | |
parent | 4242176d291f54212797de9f5df80b1346724ebb (diff) | |
download | dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.gz dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.bz2 dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.lz dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.xz dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.zst dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.zip |
Fix prettier
Diffstat (limited to 'packages/0x.js/src/types.ts')
-rw-r--r-- | packages/0x.js/src/types.ts | 390 |
1 files changed, 195 insertions, 195 deletions
diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 3c93910e9..7eda4bea6 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -3,41 +3,41 @@ import { BigNumber } from '@0xproject/utils'; import * as Web3 from 'web3'; export enum ZeroExError { - ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', - ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', - EtherTokenContractDoesNotExist = 'ETHER_TOKEN_CONTRACT_DOES_NOT_EXIST', - TokenTransferProxyContractDoesNotExist = 'TOKEN_TRANSFER_PROXY_CONTRACT_DOES_NOT_EXIST', - TokenRegistryContractDoesNotExist = 'TOKEN_REGISTRY_CONTRACT_DOES_NOT_EXIST', - TokenContractDoesNotExist = 'TOKEN_CONTRACT_DOES_NOT_EXIST', - UnhandledError = 'UNHANDLED_ERROR', - UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES', - InvalidSignature = 'INVALID_SIGNATURE', - ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK', - InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER', - InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER', - InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT', - InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL', - InvalidJump = 'INVALID_JUMP', - OutOfGas = 'OUT_OF_GAS', - NoNetworkId = 'NO_NETWORK_ID', - SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND', - SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT', - TransactionMiningTimeout = 'TRANSACTION_MINING_TIMEOUT', + ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', + ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', + EtherTokenContractDoesNotExist = 'ETHER_TOKEN_CONTRACT_DOES_NOT_EXIST', + TokenTransferProxyContractDoesNotExist = 'TOKEN_TRANSFER_PROXY_CONTRACT_DOES_NOT_EXIST', + TokenRegistryContractDoesNotExist = 'TOKEN_REGISTRY_CONTRACT_DOES_NOT_EXIST', + TokenContractDoesNotExist = 'TOKEN_CONTRACT_DOES_NOT_EXIST', + UnhandledError = 'UNHANDLED_ERROR', + UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES', + InvalidSignature = 'INVALID_SIGNATURE', + ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK', + InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER', + InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER', + InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT', + InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL', + InvalidJump = 'INVALID_JUMP', + OutOfGas = 'OUT_OF_GAS', + NoNetworkId = 'NO_NETWORK_ID', + SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND', + SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT', + TransactionMiningTimeout = 'TRANSACTION_MINING_TIMEOUT', } export enum InternalZeroExError { - NoAbiDecoder = 'NO_ABI_DECODER', - ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', - WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', + NoAbiDecoder = 'NO_ABI_DECODER', + ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', + WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', } /** * Elliptic Curve signature */ export interface ECSignature { - v: number; - r: string; - s: string; + v: number; + r: string; + s: string; } export type OrderAddresses = [string, string, string, string, string]; @@ -46,214 +46,214 @@ export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber export type LogEvent = Web3.LogEntryEvent; export interface DecodedLogEvent<ArgsType> { - isRemoved: boolean; - log: LogWithDecodedArgs<ArgsType>; + isRemoved: boolean; + log: LogWithDecodedArgs<ArgsType>; } export type EventCallback<ArgsType> = (err: null | Error, log?: DecodedLogEvent<ArgsType>) => void; export type EventWatcherCallback = (err: null | Error, log?: LogEvent) => void; export enum SolidityTypes { - Address = 'address', - Uint256 = 'uint256', - Uint8 = 'uint8', - Uint = 'uint', + Address = 'address', + Uint256 = 'uint256', + Uint8 = 'uint8', + Uint = 'uint', } export enum ExchangeContractErrCodes { - ERROR_FILL_EXPIRED, // Order has already expired - ERROR_FILL_NO_VALUE, // Order has already been fully filled or cancelled - ERROR_FILL_TRUNCATION, // Rounding error too large - ERROR_FILL_BALANCE_ALLOWANCE, // Insufficient balance or allowance for token transfer - ERROR_CANCEL_EXPIRED, // Order has already expired - ERROR_CANCEL_NO_VALUE, // Order has already been fully filled or cancelled + ERROR_FILL_EXPIRED, // Order has already expired + ERROR_FILL_NO_VALUE, // Order has already been fully filled or cancelled + ERROR_FILL_TRUNCATION, // Rounding error too large + ERROR_FILL_BALANCE_ALLOWANCE, // Insufficient balance or allowance for token transfer + ERROR_CANCEL_EXPIRED, // Order has already expired + ERROR_CANCEL_NO_VALUE, // Order has already been fully filled or cancelled } export enum ExchangeContractErrs { - OrderFillExpired = 'ORDER_FILL_EXPIRED', - OrderCancelExpired = 'ORDER_CANCEL_EXPIRED', - OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO', - OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED', - OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO', - OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO', - OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR', - FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR', - InsufficientTakerBalance = 'INSUFFICIENT_TAKER_BALANCE', - InsufficientTakerAllowance = 'INSUFFICIENT_TAKER_ALLOWANCE', - InsufficientMakerBalance = 'INSUFFICIENT_MAKER_BALANCE', - InsufficientMakerAllowance = 'INSUFFICIENT_MAKER_ALLOWANCE', - InsufficientTakerFeeBalance = 'INSUFFICIENT_TAKER_FEE_BALANCE', - InsufficientTakerFeeAllowance = 'INSUFFICIENT_TAKER_FEE_ALLOWANCE', - InsufficientMakerFeeBalance = 'INSUFFICIENT_MAKER_FEE_BALANCE', - InsufficientMakerFeeAllowance = 'INSUFFICIENT_MAKER_FEE_ALLOWANCE', - TransactionSenderIsNotFillOrderTaker = 'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER', - MultipleMakersInSingleCancelBatchDisallowed = 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED', - InsufficientRemainingFillAmount = 'INSUFFICIENT_REMAINING_FILL_AMOUNT', - MultipleTakerTokensInFillUpToDisallowed = 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED', - BatchOrdersMustHaveSameExchangeAddress = 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS', - BatchOrdersMustHaveAtLeastOneItem = 'BATCH_ORDERS_MUST_HAVE_AT_LEAST_ONE_ITEM', + OrderFillExpired = 'ORDER_FILL_EXPIRED', + OrderCancelExpired = 'ORDER_CANCEL_EXPIRED', + OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO', + OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED', + OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO', + OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO', + OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR', + FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR', + InsufficientTakerBalance = 'INSUFFICIENT_TAKER_BALANCE', + InsufficientTakerAllowance = 'INSUFFICIENT_TAKER_ALLOWANCE', + InsufficientMakerBalance = 'INSUFFICIENT_MAKER_BALANCE', + InsufficientMakerAllowance = 'INSUFFICIENT_MAKER_ALLOWANCE', + InsufficientTakerFeeBalance = 'INSUFFICIENT_TAKER_FEE_BALANCE', + InsufficientTakerFeeAllowance = 'INSUFFICIENT_TAKER_FEE_ALLOWANCE', + InsufficientMakerFeeBalance = 'INSUFFICIENT_MAKER_FEE_BALANCE', + InsufficientMakerFeeAllowance = 'INSUFFICIENT_MAKER_FEE_ALLOWANCE', + TransactionSenderIsNotFillOrderTaker = 'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER', + MultipleMakersInSingleCancelBatchDisallowed = 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED', + InsufficientRemainingFillAmount = 'INSUFFICIENT_REMAINING_FILL_AMOUNT', + MultipleTakerTokensInFillUpToDisallowed = 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED', + BatchOrdersMustHaveSameExchangeAddress = 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS', + BatchOrdersMustHaveAtLeastOneItem = 'BATCH_ORDERS_MUST_HAVE_AT_LEAST_ONE_ITEM', } export type RawLog = Web3.LogEntry; export interface ContractEvent { - logIndex: number; - transactionIndex: number; - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - type: string; - event: string; - args: ContractEventArgs; + logIndex: number; + transactionIndex: number; + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + type: string; + event: string; + 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; + 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; + maker: string; + feeRecipient: string; + makerToken: string; + takerToken: string; + cancelledMakerTokenAmount: BigNumber; + cancelledTakerTokenAmount: BigNumber; + tokens: string; + orderHash: string; } export interface LogErrorContractEventArgs { - errorId: BigNumber; - orderHash: string; + errorId: BigNumber; + orderHash: string; } export type ExchangeContractEventArgs = - | LogFillContractEventArgs - | LogCancelContractEventArgs - | LogErrorContractEventArgs; + | LogFillContractEventArgs + | LogCancelContractEventArgs + | LogErrorContractEventArgs; export interface TransferContractEventArgs { - _from: string; - _to: string; - _value: BigNumber; + _from: string; + _to: string; + _value: BigNumber; } export interface ApprovalContractEventArgs { - _owner: string; - _spender: string; - _value: BigNumber; + _owner: string; + _spender: string; + _value: BigNumber; } export interface DepositContractEventArgs { - _owner: string; - _value: BigNumber; + _owner: string; + _value: BigNumber; } export interface WithdrawalContractEventArgs { - _owner: string; - _value: BigNumber; + _owner: string; + _value: BigNumber; } export type TokenContractEventArgs = TransferContractEventArgs | ApprovalContractEventArgs; export type EtherTokenContractEventArgs = - | TokenContractEventArgs - | DepositContractEventArgs - | WithdrawalContractEventArgs; + | TokenContractEventArgs + | DepositContractEventArgs + | WithdrawalContractEventArgs; export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; export type ContractEventArg = string | BigNumber; export interface Order { - maker: string; - taker: string; - makerFee: BigNumber; - takerFee: BigNumber; - makerTokenAmount: BigNumber; - takerTokenAmount: BigNumber; - makerTokenAddress: string; - takerTokenAddress: string; - salt: BigNumber; - exchangeContractAddress: string; - feeRecipient: string; - expirationUnixTimestampSec: BigNumber; + maker: string; + taker: string; + makerFee: BigNumber; + takerFee: BigNumber; + makerTokenAmount: BigNumber; + takerTokenAmount: BigNumber; + makerTokenAddress: string; + takerTokenAddress: string; + salt: BigNumber; + exchangeContractAddress: string; + feeRecipient: string; + expirationUnixTimestampSec: BigNumber; } export interface SignedOrder extends Order { - ecSignature: ECSignature; + ecSignature: ECSignature; } // [address, name, symbol, decimals, ipfsHash, swarmHash] export type TokenMetadata = [string, string, string, BigNumber, string, string]; export interface Token { - name: string; - address: string; - symbol: string; - decimals: number; + name: string; + address: string; + symbol: string; + decimals: number; } export interface TxOpts { - from: string; - gas?: number; - value?: BigNumber; - gasPrice?: BigNumber; + from: string; + gas?: number; + value?: BigNumber; + gasPrice?: BigNumber; } export interface TokenAddressBySymbol { - [symbol: string]: string; + [symbol: string]: string; } export enum ExchangeEvents { - LogFill = 'LogFill', - LogCancel = 'LogCancel', - LogError = 'LogError', + LogFill = 'LogFill', + LogCancel = 'LogCancel', + LogError = 'LogError', } export enum TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', + Transfer = 'Transfer', + Approval = 'Approval', } export enum EtherTokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', - Deposit = 'Deposit', - Withdrawal = 'Withdrawal', + Transfer = 'Transfer', + Approval = 'Approval', + Deposit = 'Deposit', + Withdrawal = 'Withdrawal', } export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents; export interface IndexedFilterValues { - [index: string]: ContractEventArg; + [index: string]: ContractEventArg; } // Earliest is omitted by design. It is simply an alias for the `0` constant and // is thus not very helpful. Moreover, this type is used in places that only accept // `latest` or `pending`. export enum BlockParamLiteral { - Latest = 'latest', - Pending = 'pending', + Latest = 'latest', + Pending = 'pending', } export type BlockParam = BlockParamLiteral | number; export interface BlockRange { - fromBlock: BlockParam; - toBlock: BlockParam; + fromBlock: BlockParam; + toBlock: BlockParam; } export type DoneCallback = (err?: Error) => void; export interface OrderCancellationRequest { - order: Order | SignedOrder; - takerTokenCancelAmount: BigNumber; + order: Order | SignedOrder; + takerTokenCancelAmount: BigNumber; } export interface OrderFillRequest { - signedOrder: SignedOrder; - takerTokenFillAmount: BigNumber; + signedOrder: SignedOrder; + takerTokenFillAmount: BigNumber; } export type AsyncMethod = (...args: any[]) => Promise<any>; @@ -268,8 +268,8 @@ export type SyncMethod = (...args: any[]) => any; export type Web3Provider = Web3.Provider; export interface JSONRPCPayload { - params: any[]; - method: string; + params: any[]; + method: string; } /* @@ -280,10 +280,10 @@ export interface JSONRPCPayload { * cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Defaults: 1h */ export interface OrderStateWatcherConfig { - orderExpirationCheckingIntervalMs?: number; - eventPollingIntervalMs?: number; - expirationMarginMs?: number; - cleanupJobIntervalMs?: number; + orderExpirationCheckingIntervalMs?: number; + eventPollingIntervalMs?: number; + expirationMarginMs?: number; + cleanupJobIntervalMs?: number; } /* @@ -296,42 +296,42 @@ export interface OrderStateWatcherConfig { * orderWatcherConfig: All the configs related to the orderWatcher */ export interface ZeroExConfig { - networkId: number; - gasPrice?: BigNumber; - exchangeContractAddress?: string; - zrxContractAddress?: string; - tokenRegistryContractAddress?: string; - tokenTransferProxyContractAddress?: string; - orderWatcherConfig?: OrderStateWatcherConfig; + networkId: number; + gasPrice?: BigNumber; + exchangeContractAddress?: string; + zrxContractAddress?: string; + tokenRegistryContractAddress?: string; + tokenTransferProxyContractAddress?: string; + orderWatcherConfig?: OrderStateWatcherConfig; } export enum AbiType { - Function = 'function', - Constructor = 'constructor', - Event = 'event', - Fallback = 'fallback', + Function = 'function', + Constructor = 'constructor', + Event = 'event', + Fallback = 'fallback', } export interface DecodedLogArgs { - [argName: string]: ContractEventArg; + [argName: string]: ContractEventArg; } export interface LogWithDecodedArgs<ArgsType> extends Web3.DecodedLogEntry<ArgsType> {} export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt { - logs: Array<LogWithDecodedArgs<DecodedLogArgs> | Web3.LogEntry>; + logs: Array<LogWithDecodedArgs<DecodedLogArgs> | Web3.LogEntry>; } export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry' | 'Token' | 'Exchange' | 'EtherToken'; export interface Artifact { - contract_name: ArtifactContractName; - abi: Web3.ContractAbi; - networks: { - [networkId: number]: { - address: string; - }; - }; + contract_name: ArtifactContractName; + abi: Web3.ContractAbi; + networks: { + [networkId: number]: { + address: string; + }; + }; } /* @@ -341,7 +341,7 @@ export interface Artifact { * allowance/balance to fill the entire remaining order amount. */ export interface ValidateOrderFillableOpts { - expectedFillTakerTokenAmount?: BigNumber; + expectedFillTakerTokenAmount?: BigNumber; } /* @@ -351,7 +351,7 @@ export interface ValidateOrderFillableOpts { * flag when running Parity). */ export interface MethodOpts { - defaultBlock?: Web3.BlockParam; + defaultBlock?: Web3.BlockParam; } /* @@ -359,8 +359,8 @@ export interface MethodOpts { * gasLimit: The amount of gas to send with a transaction */ export interface TransactionOpts { - gasPrice?: BigNumber; - gasLimit?: number; + gasPrice?: BigNumber; + gasLimit?: number; } /* @@ -368,42 +368,42 @@ export interface TransactionOpts { * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default: true */ export interface OrderTransactionOpts extends TransactionOpts { - shouldValidate?: boolean; + shouldValidate?: boolean; } export type FilterObject = Web3.FilterObject; export enum TradeSide { - Maker = 'maker', - Taker = 'taker', + Maker = 'maker', + Taker = 'taker', } export enum TransferType { - Trade = 'trade', - Fee = 'fee', + Trade = 'trade', + Fee = 'fee', } export interface OrderRelevantState { - makerBalance: BigNumber; - makerProxyAllowance: BigNumber; - makerFeeBalance: BigNumber; - makerFeeProxyAllowance: BigNumber; - filledTakerTokenAmount: BigNumber; - cancelledTakerTokenAmount: BigNumber; - remainingFillableMakerTokenAmount: BigNumber; - remainingFillableTakerTokenAmount: BigNumber; + makerBalance: BigNumber; + makerProxyAllowance: BigNumber; + makerFeeBalance: BigNumber; + makerFeeProxyAllowance: BigNumber; + filledTakerTokenAmount: BigNumber; + cancelledTakerTokenAmount: BigNumber; + remainingFillableMakerTokenAmount: BigNumber; + remainingFillableTakerTokenAmount: BigNumber; } export interface OrderStateValid { - isValid: true; - orderHash: string; - orderRelevantState: OrderRelevantState; + isValid: true; + orderHash: string; + orderRelevantState: OrderRelevantState; } export interface OrderStateInvalid { - isValid: false; - orderHash: string; - error: ExchangeContractErrs; + isValid: false; + orderHash: string; + error: ExchangeContractErrs; } export type OrderState = OrderStateValid | OrderStateInvalid; |