aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r--packages/contract-wrappers/src/types.ts56
1 files changed, 21 insertions, 35 deletions
diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts
index 0c1c58486..649133584 100644
--- a/packages/contract-wrappers/src/types.ts
+++ b/packages/contract-wrappers/src/types.ts
@@ -1,26 +1,21 @@
import { BigNumber } from '@0xproject/utils';
-import {
- BlockParam,
- ContractEventArg,
- LogEntryEvent,
- LogWithDecodedArgs,
- Order,
- OrderState,
- SignedOrder,
-} from '@0xproject/types';
-
-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';
+import { OrderState, SignedOrder } from '@0xproject/types';
+import { BlockParam, ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types';
+
+import { ERC20TokenEventArgs, ERC20TokenEvents } from './contract_wrappers/generated/erc20_token';
+import { ERC721TokenEventArgs, ERC721TokenEvents } from './contract_wrappers/generated/erc721_token';
+import { ExchangeEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange';
+import { WETH9EventArgs, WETH9Events } from './contract_wrappers/generated/weth9';
export enum ContractWrappersError {
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',
+ ERC20ProxyContractDoesNotExist = 'ERC20_PROXY_CONTRACT_DOES_NOT_EXIST',
+ ERC721ProxyContractDoesNotExist = 'ERC721_PROXY_CONTRACT_DOES_NOT_EXIST',
+ ERC20TokenContractDoesNotExist = 'ERC20_TOKEN_CONTRACT_DOES_NOT_EXIST',
+ ERC721TokenContractDoesNotExist = 'ERC721_TOKEN_CONTRACT_DOES_NOT_EXIST',
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
@@ -30,6 +25,8 @@ export enum ContractWrappersError {
OutOfGas = 'OUT_OF_GAS',
SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
+ ERC721OwnerNotFound = 'ERC_721_OWNER_NOT_FOUND',
+ ERC721NoApproval = 'ERC_721_NO_APPROVAL',
}
export enum InternalContractWrappersError {
@@ -39,21 +36,15 @@ export enum InternalContractWrappersError {
}
export type LogEvent = LogEntryEvent;
-export interface DecodedLogEvent<ArgsType> {
+export interface DecodedLogEvent<ArgsType extends DecodedLogArgs> {
isRemoved: boolean;
log: LogWithDecodedArgs<ArgsType>;
}
-export type EventCallback<ArgsType> = (err: null | Error, log?: DecodedLogEvent<ArgsType>) => void;
-
-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
-}
+export type EventCallback<ArgsType extends DecodedLogArgs> = (
+ err: null | Error,
+ log?: DecodedLogEvent<ArgsType>,
+) => void;
export interface ContractEvent {
logIndex: number;
@@ -67,7 +58,7 @@ export interface ContractEvent {
args: ContractEventArgs;
}
-export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs;
+export type ContractEventArgs = ExchangeEventArgs | ERC20TokenEventArgs | ERC721TokenEventArgs | WETH9EventArgs;
// [address, name, symbol, decimals, ipfsHash, swarmHash]
export type TokenMetadata = [string, string, string, number, string, string];
@@ -90,7 +81,7 @@ export interface TokenAddressBySymbol {
[symbol: string]: string;
}
-export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents;
+export type ContractEvents = ERC20TokenEvents | ERC721TokenEvents | ExchangeEvents | WETH9Events;
export interface IndexedFilterValues {
[index: string]: ContractEventArg;
@@ -101,14 +92,9 @@ export interface BlockRange {
toBlock: BlockParam;
}
-export interface OrderCancellationRequest {
- order: Order | SignedOrder;
- takerTokenCancelAmount: BigNumber;
-}
-
export interface OrderFillRequest {
signedOrder: SignedOrder;
- takerTokenFillAmount: BigNumber;
+ takerAssetFillAmount: BigNumber;
}
export type AsyncMethod = (...args: any[]) => Promise<any>;