diff options
Diffstat (limited to 'packages/types')
-rw-r--r-- | packages/types/CHANGELOG.json | 28 | ||||
-rw-r--r-- | packages/types/CHANGELOG.md | 20 | ||||
-rw-r--r-- | packages/types/package.json | 10 | ||||
-rw-r--r-- | packages/types/src/index.ts | 83 |
4 files changed, 130 insertions, 11 deletions
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 0728b8070..afcfd862c 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,5 +1,33 @@ [ { + "version": "0.7.0", + "changes": [ + { + "note": + "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js", + "pr": 579 + } + ] + }, + { + "timestamp": 1525477860, + "version": "0.6.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "timestamp": 1525428773, + "version": "0.6.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1524044013, "version": "0.6.1", "changes": [ diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 4b866c63f..edfd42269 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,11 +5,19 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.6.3 - _May 5, 2018_ + + * Dependencies updated + +## v0.6.2 - _May 4, 2018_ + + * Dependencies updated + ## v0.6.1 - _April 18, 2018_ * Dependencies updated -## v0.6.0 - _April 12, 2018_ +## v0.6.0 - _April 11, 2018_ * Add Provider type (#501) @@ -21,25 +29,25 @@ CHANGELOG * Dependencies updated -## v0.4.0 - _March 18, 2018_ +## v0.4.0 - _March 17, 2018_ * Remove `JSONRPCPayload` (#426) * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) -## v0.3.1 - _March 8, 2018_ +## v0.3.1 - _March 7, 2018_ * Added `RawLogEntry` type. -## v0.3.0 - _March 4, 2018_ +## v0.3.0 - _March 3, 2018_ * Add `data` to `TxData` (#413) * Add `number` as an option to `ContractEventArg` (#413) * Move web3 types from devDep to dep since required when using this package (#429) -## v0.2.1 - _February 9, 2018_ +## v0.2.1 - _February 8, 2018_ * Fix publishing issue where .npmignore was not properly excluding undesired content (#389) -## v0.2.0 - _February 7, 2018_ +## v0.2.0 - _February 6, 2018_ * Added BlockLiteralParam and BlockParam, refactored out of 0x.js types. (#355) diff --git a/packages/types/package.json b/packages/types/package.json index 50241810d..973d5b8d0 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "0.6.1", + "version": "0.6.3", "description": "0x types", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -8,7 +8,7 @@ "build:watch": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", - "lint": "tslint --project . 'src/**/*.ts'", + "lint": "tslint --project .", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, "license": "Apache-2.0", @@ -21,15 +21,15 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.18", - "@0xproject/tslint-config": "^0.4.16", - "@types/node": "^8.0.53", + "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/tslint-config": "^0.4.17", "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" }, "dependencies": { + "@types/node": "^8.0.53", "bignumber.js": "~4.1.0" }, "publishConfig": { diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 044aae3c8..f28c2f9a3 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -240,6 +240,11 @@ export enum SolidityTypes { Uint = 'uint', } +/** + * Contains the logs returned by a TransactionReceipt. We attempt to decode the + * logs using AbiDecoder. If we have the logs corresponding ABI, we decode it, + * otherwise we don't. + */ export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt { logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>; } @@ -292,3 +297,81 @@ export interface ECSignature { r: string; s: string; } + +/** + * Errors originating from the 0x exchange contract + */ +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', +} + +export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry' | 'Token' | 'Exchange' | 'EtherToken'; + +export interface Artifact { + contract_name: ArtifactContractName; + abi: ContractAbi; + networks: { + [networkId: number]: { + address: string; + }; + }; +} + +export type OrderAddresses = [string, string, string, string, string]; + +export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]; + +export type DoneCallback = (err?: Error) => void; + +export interface OrderRelevantState { + 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; +} + +export interface OrderStateInvalid { + isValid: false; + orderHash: string; + error: ExchangeContractErrs; +} + +export type OrderState = OrderStateValid | OrderStateInvalid; + +export interface Token { + name: string; + address: string; + symbol: string; + decimals: number; +} |