Add SignedOrder, Order, and ECSignature types to the types package
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
|
||||
import { TransactionReceiptWithDecodedLogs } from '@0xproject/types';
|
||||
import { ECSignature, Order, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
|
||||
import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
@@ -15,7 +15,7 @@ import { OrderStateWatcher } from './order_watcher/order_state_watcher';
|
||||
import { zeroExConfigSchema } from './schemas/zero_ex_config_schema';
|
||||
import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema';
|
||||
import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema';
|
||||
import { ECSignature, Order, SignedOrder, Web3Provider, ZeroExConfig, ZeroExError } from './types';
|
||||
import { Web3Provider, ZeroExConfig, ZeroExError } from './types';
|
||||
import { assert } from './utils/assert';
|
||||
import { constants } from './utils/constants';
|
||||
import { decorators } from './utils/decorators';
|
||||
|
@@ -1,5 +1,12 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { BlockParamLiteral, DecodedLogArgs, LogWithDecodedArgs } from '@0xproject/types';
|
||||
import {
|
||||
BlockParamLiteral,
|
||||
DecodedLogArgs,
|
||||
ECSignature,
|
||||
LogWithDecodedArgs,
|
||||
Order,
|
||||
SignedOrder,
|
||||
} from '@0xproject/types';
|
||||
import { AbiDecoder, BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
@@ -8,19 +15,16 @@ import * as Web3 from 'web3';
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
BlockRange,
|
||||
ECSignature,
|
||||
EventCallback,
|
||||
ExchangeContractErrCodes,
|
||||
ExchangeContractErrs,
|
||||
IndexedFilterValues,
|
||||
MethodOpts,
|
||||
Order,
|
||||
OrderAddresses,
|
||||
OrderCancellationRequest,
|
||||
OrderFillRequest,
|
||||
OrderTransactionOpts,
|
||||
OrderValues,
|
||||
SignedOrder,
|
||||
ValidateOrderFillableOpts,
|
||||
} from '../types';
|
||||
import { assert } from '../utils/assert';
|
||||
|
@@ -1,9 +1,6 @@
|
||||
export { ZeroEx } from './0x';
|
||||
|
||||
export {
|
||||
Order,
|
||||
SignedOrder,
|
||||
ECSignature,
|
||||
ZeroExError,
|
||||
EventCallback,
|
||||
ExchangeContractErrs,
|
||||
@@ -34,6 +31,9 @@ export {
|
||||
BlockParam,
|
||||
ContractEventArg,
|
||||
LogWithDecodedArgs,
|
||||
Order,
|
||||
SignedOrder,
|
||||
ECSignature,
|
||||
TransactionReceipt,
|
||||
TransactionReceiptWithDecodedLogs,
|
||||
} from '@0xproject/types';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { BlockParamLiteral, LogWithDecodedArgs } from '@0xproject/types';
|
||||
import { BlockParamLiteral, LogWithDecodedArgs, SignedOrder } from '@0xproject/types';
|
||||
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
OnOrderStateChangeCallback,
|
||||
OrderState,
|
||||
OrderStateWatcherConfig,
|
||||
SignedOrder,
|
||||
ZeroExError,
|
||||
} from '../types';
|
||||
import { assert } from '../utils/assert';
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
|
||||
import { SignedOrder } from '../types';
|
||||
|
||||
export class RemainingFillableCalculator {
|
||||
private _signedOrder: SignedOrder;
|
||||
private _isMakerTokenZRX: boolean;
|
||||
|
@@ -1,6 +1,13 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
|
||||
import { BlockParam, BlockParamLiteral, ContractEventArg, LogWithDecodedArgs } from '@0xproject/types';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
ContractEventArg,
|
||||
LogWithDecodedArgs,
|
||||
Order,
|
||||
SignedOrder,
|
||||
} from '@0xproject/types';
|
||||
|
||||
import * as Web3 from 'web3';
|
||||
|
||||
@@ -37,15 +44,6 @@ export enum InternalZeroExError {
|
||||
WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY',
|
||||
}
|
||||
|
||||
/**
|
||||
* Elliptic Curve signature
|
||||
*/
|
||||
export interface ECSignature {
|
||||
v: number;
|
||||
r: string;
|
||||
s: string;
|
||||
}
|
||||
|
||||
export type OrderAddresses = [string, string, string, string, string];
|
||||
|
||||
export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber];
|
||||
@@ -107,25 +105,6 @@ export interface ContractEvent {
|
||||
|
||||
export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
export interface SignedOrder extends Order {
|
||||
ecSignature: ECSignature;
|
||||
}
|
||||
|
||||
// [address, name, symbol, decimals, ipfsHash, swarmHash]
|
||||
export type TokenMetadata = [string, string, string, number, string, string];
|
||||
|
||||
|
@@ -3,11 +3,11 @@ import { assert as sharedAssert } from '@0xproject/assert';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { Schema } from '@0xproject/json-schemas';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { ECSignature } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ECSignature } from '../types';
|
||||
import { signatureUtils } from '../utils/signature_utils';
|
||||
|
||||
export const assert = {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
@@ -6,14 +7,7 @@ import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
|
||||
import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator';
|
||||
import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store';
|
||||
import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store';
|
||||
import {
|
||||
ExchangeContractErrs,
|
||||
OrderRelevantState,
|
||||
OrderState,
|
||||
OrderStateInvalid,
|
||||
OrderStateValid,
|
||||
SignedOrder,
|
||||
} from '../types';
|
||||
import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types';
|
||||
|
||||
const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001;
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import { Order, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ZeroEx } from '../0x';
|
||||
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
|
||||
import { ExchangeContractErrs, Order, SignedOrder, TradeSide, TransferType, ZeroExError } from '../types';
|
||||
import { ExchangeContractErrs, TradeSide, TransferType, ZeroExError } from '../types';
|
||||
import { constants } from '../utils/constants';
|
||||
import { utils } from '../utils/utils';
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { ECSignature } from '@0xproject/types';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
|
||||
import { ECSignature } from '../types';
|
||||
|
||||
export const signatureUtils = {
|
||||
isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
|
||||
const dataBuff = ethUtil.toBuffer(data);
|
||||
|
@@ -1,12 +1,10 @@
|
||||
import { SolidityTypes } from '@0xproject/types';
|
||||
import { Order, SignedOrder, SolidityTypes } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import BN = require('bn.js');
|
||||
import * as ethABI from 'ethereumjs-abi';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { Order, SignedOrder } from '../types';
|
||||
|
||||
export const utils = {
|
||||
/**
|
||||
* Converts BigNumber instance to BN
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { ECSignature, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
import { ZeroEx } from '../src/0x';
|
||||
import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fillable_calculator';
|
||||
import { ECSignature, SignedOrder } from '../src/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
|
Reference in New Issue
Block a user