From 539c243733c60fe083ed0e3e7d7663981f5d7663 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:23:02 +0100 Subject: Move fetchers to contract-wrappers --- packages/contract-wrappers/CHANGELOG.json | 4 ++ .../asset_balance_and_proxy_allowance_fetcher.ts | 77 ++++++++++++++++++++++ .../src/fetchers/order_filled_cancelled_fetcher.ts | 30 +++++++++ .../asset_balance_and_proxy_allowance_fetcher.ts | 74 --------------------- .../src/fetchers/order_filled_cancelled_fetcher.ts | 27 -------- 5 files changed, 111 insertions(+), 101 deletions(-) create mode 100644 packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts create mode 100644 packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts delete mode 100644 packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts delete mode 100644 packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index b7c89a325..8a41c560e 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -4,6 +4,10 @@ "changes": [ { "note": "Add `OrderValidatorWrapper`" + }, + { + "note": + "Export `AssetBalanceAndProxyAllowanceFetcher` and `OrderFilledCancelledFetcher` implementations" } ] }, diff --git a/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts new file mode 100644 index 000000000..023cd5ac3 --- /dev/null +++ b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts @@ -0,0 +1,77 @@ +// tslint:disable:no-unnecessary-type-assertion +import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0xproject/order-utils'; +import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import { BlockParamLiteral } from 'ethereum-types'; + +import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper'; +import { ERC721TokenWrapper } from '../contract_wrappers/erc721_token_wrapper'; + +export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { + private readonly _erc20Token: ERC20TokenWrapper; + private readonly _erc721Token: ERC721TokenWrapper; + private readonly _stateLayer: BlockParamLiteral; + constructor(erc20Token: ERC20TokenWrapper, erc721Token: ERC721TokenWrapper, stateLayer: BlockParamLiteral) { + this._erc20Token = erc20Token; + this._erc721Token = erc721Token; + this._stateLayer = stateLayer; + } + public async getBalanceAsync(assetData: string, userAddress: string): Promise { + const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData); + if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) { + const decodedERC20AssetData = decodedAssetData as ERC20AssetData; + const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, { + defaultBlock: this._stateLayer, + }); + return balance; + } else { + const decodedERC721AssetData = decodedAssetData as ERC721AssetData; + const tokenOwner = await this._erc721Token.getOwnerOfAsync( + decodedERC721AssetData.tokenAddress, + decodedERC721AssetData.tokenId, + { + defaultBlock: this._stateLayer, + }, + ); + const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0); + return balance; + } + } + public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise { + const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData); + if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) { + const decodedERC20AssetData = decodedAssetData as ERC20AssetData; + const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync( + decodedERC20AssetData.tokenAddress, + userAddress, + { + defaultBlock: this._stateLayer, + }, + ); + return proxyAllowance; + } else { + const decodedERC721AssetData = decodedAssetData as ERC721AssetData; + + const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync( + decodedERC721AssetData.tokenAddress, + userAddress, + { + defaultBlock: this._stateLayer, + }, + ); + if (isApprovedForAll) { + return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + } else { + const isApproved = await this._erc721Token.isProxyApprovedAsync( + decodedERC721AssetData.tokenAddress, + decodedERC721AssetData.tokenId, + { + defaultBlock: this._stateLayer, + }, + ); + const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0); + return proxyAllowance; + } + } + } +} diff --git a/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts new file mode 100644 index 000000000..ba6f5fb5e --- /dev/null +++ b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts @@ -0,0 +1,30 @@ +// tslint:disable:no-unnecessary-type-assertion +import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; +import { BigNumber } from '@0xproject/utils'; +import { BlockParamLiteral } from 'ethereum-types'; + +import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper'; +import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; + +export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher { + private readonly _exchange: ExchangeWrapper; + private readonly _stateLayer: BlockParamLiteral; + constructor(exchange: ExchangeWrapper, stateLayer: BlockParamLiteral) { + this._exchange = exchange; + this._stateLayer = stateLayer; + } + public async getFilledTakerAmountAsync(orderHash: string): Promise { + const filledTakerAmount = this._exchange.getFilledTakerAssetAmountAsync(orderHash, { + defaultBlock: this._stateLayer, + }); + return filledTakerAmount; + } + public async isOrderCancelledAsync(orderHash: string): Promise { + const isCancelled = await this._exchange.isCancelledAsync(orderHash); + return isCancelled; + } + public getZRXAssetData(): string { + const zrxAssetData = this._exchange.getZRXAssetData(); + return zrxAssetData; + } +} diff --git a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts deleted file mode 100644 index a1de22a5e..000000000 --- a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts +++ /dev/null @@ -1,74 +0,0 @@ -// tslint:disable:no-unnecessary-type-assertion -import { BlockParamLiteral, ERC20TokenWrapper, ERC721TokenWrapper } from '@0xproject/contract-wrappers'; -import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0xproject/order-utils'; -import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; - -export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { - private readonly _erc20Token: ERC20TokenWrapper; - private readonly _erc721Token: ERC721TokenWrapper; - private readonly _stateLayer: BlockParamLiteral; - constructor(erc20Token: ERC20TokenWrapper, erc721Token: ERC721TokenWrapper, stateLayer: BlockParamLiteral) { - this._erc20Token = erc20Token; - this._erc721Token = erc721Token; - this._stateLayer = stateLayer; - } - public async getBalanceAsync(assetData: string, userAddress: string): Promise { - const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData); - if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) { - const decodedERC20AssetData = decodedAssetData as ERC20AssetData; - const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, { - defaultBlock: this._stateLayer, - }); - return balance; - } else { - const decodedERC721AssetData = decodedAssetData as ERC721AssetData; - const tokenOwner = await this._erc721Token.getOwnerOfAsync( - decodedERC721AssetData.tokenAddress, - decodedERC721AssetData.tokenId, - { - defaultBlock: this._stateLayer, - }, - ); - const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0); - return balance; - } - } - public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise { - const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData); - if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) { - const decodedERC20AssetData = decodedAssetData as ERC20AssetData; - const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync( - decodedERC20AssetData.tokenAddress, - userAddress, - { - defaultBlock: this._stateLayer, - }, - ); - return proxyAllowance; - } else { - const decodedERC721AssetData = decodedAssetData as ERC721AssetData; - - const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync( - decodedERC721AssetData.tokenAddress, - userAddress, - { - defaultBlock: this._stateLayer, - }, - ); - if (isApprovedForAll) { - return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); - } else { - const isApproved = await this._erc721Token.isProxyApprovedAsync( - decodedERC721AssetData.tokenAddress, - decodedERC721AssetData.tokenId, - { - defaultBlock: this._stateLayer, - }, - ); - const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0); - return proxyAllowance; - } - } - } -} diff --git a/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts deleted file mode 100644 index bfad1a48c..000000000 --- a/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts +++ /dev/null @@ -1,27 +0,0 @@ -// tslint:disable:no-unnecessary-type-assertion -import { BlockParamLiteral, ExchangeWrapper } from '@0xproject/contract-wrappers'; -import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; -import { BigNumber } from '@0xproject/utils'; - -export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher { - private readonly _exchange: ExchangeWrapper; - private readonly _stateLayer: BlockParamLiteral; - constructor(exchange: ExchangeWrapper, stateLayer: BlockParamLiteral) { - this._exchange = exchange; - this._stateLayer = stateLayer; - } - public async getFilledTakerAmountAsync(orderHash: string): Promise { - const filledTakerAmount = this._exchange.getFilledTakerAssetAmountAsync(orderHash, { - defaultBlock: this._stateLayer, - }); - return filledTakerAmount; - } - public async isOrderCancelledAsync(orderHash: string): Promise { - const isCancelled = await this._exchange.isCancelledAsync(orderHash); - return isCancelled; - } - public getZRXAssetData(): string { - const zrxAssetData = this._exchange.getZRXAssetData(); - return zrxAssetData; - } -} -- cgit From ed786f3e8f970fac88cee68f399813f17160cdd7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:23:29 +0100 Subject: Export fetchers from contract-wrappers --- packages/contract-wrappers/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index b66d8460e..8f32a906f 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -85,3 +85,6 @@ export { ExchangeEventArgs, ExchangeEvents, } from './contract_wrappers/generated/exchange'; + +export { AssetBalanceAndProxyAllowanceFetcher } from './fetchers/asset_balance_and_proxy_allowance_fetcher'; +export { OrderFilledCancelledFetcher } from './fetchers/order_filled_cancelled_fetcher'; -- cgit From 8d7f2a993a9ecb9f805135b56aee05f8e656e0a8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:24:01 +0100 Subject: Import fetchers from contract-wrappers --- packages/order-watcher/src/order_watcher/order_watcher.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index d4c5cca4b..cab2efa4b 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -1,5 +1,6 @@ // tslint:disable:no-unnecessary-type-assertion import { + AssetBalanceAndProxyAllowanceFetcher, ContractWrappers, ERC20TokenApprovalEventArgs, ERC20TokenEventArgs, @@ -15,6 +16,7 @@ import { ExchangeEventArgs, ExchangeEvents, ExchangeFillEventArgs, + OrderFilledCancelledFetcher, WETH9DepositEventArgs, WETH9EventArgs, WETH9Events, @@ -34,8 +36,6 @@ import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from ' import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { AssetBalanceAndProxyAllowanceFetcher } from '../fetchers/asset_balance_and_proxy_allowance_fetcher'; -import { OrderFilledCancelledFetcher } from '../fetchers/order_filled_cancelled_fetcher'; import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema'; import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types'; import { assert } from '../utils/assert'; -- cgit From d496a7585c06ff48770841e12f7be5a9707f6d5a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:27:16 +0100 Subject: Add `validateFillOrderThrowIfInvalidAsync` and `validateOrderFillableOrThrowAsync` to ExchangeWrapper --- packages/contract-wrappers/CHANGELOG.json | 4 ++ .../contract-wrappers/src/contract_wrappers.ts | 2 + .../src/contract_wrappers/exchange_wrapper.ts | 79 +++++++++++++++++++++- 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 8a41c560e..9dc9cd1b3 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -8,6 +8,10 @@ { "note": "Export `AssetBalanceAndProxyAllowanceFetcher` and `OrderFilledCancelledFetcher` implementations" + }, + { + "note": + "Add `validateOrderFillableOrThrowAsync` and `validateFillOrderThrowIfInvalidAsync` to ExchangeWrapper" } ] }, diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 8ca0fc93c..4272cc943 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -111,6 +111,8 @@ export class ContractWrappers { this.exchange = new ExchangeWrapper( this._web3Wrapper, config.networkId, + this.erc20Token, + this.erc721Token, config.exchangeContractAddress, config.zrxContractAddress, blockPollingIntervalMs, diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index cfef0f107..dc9ffcbf7 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -1,12 +1,19 @@ import { schemas } from '@0xproject/json-schemas'; -import { assetDataUtils } from '@0xproject/order-utils'; +import { + assetDataUtils, + BalanceAndProxyAllowanceLazyStore, + ExchangeTransferSimulator, + OrderValidationUtils, +} from '@0xproject/order-utils'; import { AssetProxyId, Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types'; +import { BlockParamLiteral, ContractAbi, LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; +import { AssetBalanceAndProxyAllowanceFetcher } from '../fetchers/asset_balance_and_proxy_allowance_fetcher'; +import { OrderFilledCancelledFetcher } from '../fetchers/order_filled_cancelled_fetcher'; import { methodOptsSchema } from '../schemas/method_opts_schema'; import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema'; import { txOptsSchema } from '../schemas/tx_opts_schema'; @@ -17,13 +24,17 @@ import { IndexedFilterValues, MethodOpts, OrderInfo, + OrderStatus, OrderTransactionOpts, + ValidateOrderFillableOpts, } from '../types'; import { assert } from '../utils/assert'; import { decorators } from '../utils/decorators'; import { TransactionEncoder } from '../utils/transaction_encoder'; import { ContractWrapper } from './contract_wrapper'; +import { ERC20TokenWrapper } from './erc20_token_wrapper'; +import { ERC721TokenWrapper } from './erc721_token_wrapper'; import { ExchangeContract, ExchangeEventArgs, ExchangeEvents } from './generated/exchange'; /** @@ -33,6 +44,8 @@ import { ExchangeContract, ExchangeEventArgs, ExchangeEvents } from './generated export class ExchangeWrapper extends ContractWrapper { public abi: ContractAbi = artifacts.Exchange.compilerOutput.abi; private _exchangeContractIfExists?: ExchangeContract; + private _erc721TokenWrapper: ERC721TokenWrapper; + private _erc20TokenWrapper: ERC20TokenWrapper; private _contractAddressIfExists?: string; private _zrxContractAddressIfExists?: string; /** @@ -48,11 +61,15 @@ export class ExchangeWrapper extends ContractWrapper { constructor( web3Wrapper: Web3Wrapper, networkId: number, + erc20TokenWrapper: ERC20TokenWrapper, + erc721TokenWrapper: ERC721TokenWrapper, contractAddressIfExists?: string, zrxContractAddressIfExists?: string, blockPollingIntervalMs?: number, ) { super(web3Wrapper, networkId, blockPollingIntervalMs); + this._erc20TokenWrapper = erc20TokenWrapper; + this._erc721TokenWrapper = erc721TokenWrapper; this._contractAddressIfExists = contractAddressIfExists; this._zrxContractAddressIfExists = zrxContractAddressIfExists; } @@ -1084,6 +1101,64 @@ export class ExchangeWrapper extends ContractWrapper { ); return logs; } + /** + * Validate if the supplied order is fillable, and throw if it isn't + * @param signedOrder SignedOrder of interest + * @param opts ValidateOrderFillableOpts options (e.g expectedFillTakerTokenAmount. + * If it isn't supplied, we check if the order is fillable for a non-zero amount) + */ + public async validateOrderFillableOrThrowAsync( + signedOrder: SignedOrder, + opts: ValidateOrderFillableOpts = {}, + ): Promise { + const balanceAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher( + this._erc20TokenWrapper, + this._erc721TokenWrapper, + BlockParamLiteral.Latest, + ); + const balanceAllowanceStore = new BalanceAndProxyAllowanceLazyStore(balanceAllowanceFetcher); + const exchangeTradeSimulator = new ExchangeTransferSimulator(balanceAllowanceStore); + + const expectedFillTakerTokenAmountIfExists = opts.expectedFillTakerTokenAmount; + const filledCancelledFetcher = new OrderFilledCancelledFetcher(this, BlockParamLiteral.Latest); + const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher); + await orderValidationUtils.validateOrderFillableOrThrowAsync( + exchangeTradeSimulator, + signedOrder, + this.getZRXAssetData(), + expectedFillTakerTokenAmountIfExists, + ); + } + /** + * Validate a call to FillOrder and throw if it wouldn't succeed + * @param signedOrder SignedOrder of interest + * @param fillTakerAssetAmount Amount we'd like to fill the order for + * @param takerAddress The taker of the order + */ + public async validateFillOrderThrowIfInvalidAsync( + signedOrder: SignedOrder, + fillTakerAssetAmount: BigNumber, + takerAddress: string, + ): Promise { + const balanceAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher( + this._erc20TokenWrapper, + this._erc721TokenWrapper, + BlockParamLiteral.Latest, + ); + const balanceAllowanceStore = new BalanceAndProxyAllowanceLazyStore(balanceAllowanceFetcher); + const exchangeTradeSimulator = new ExchangeTransferSimulator(balanceAllowanceStore); + + const filledCancelledFetcher = new OrderFilledCancelledFetcher(this, BlockParamLiteral.Latest); + const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher); + await orderValidationUtils.validateFillOrderThrowIfInvalidAsync( + exchangeTradeSimulator, + this._web3Wrapper.getProvider(), + signedOrder, + fillTakerAssetAmount, + takerAddress, + this.getZRXAssetData(), + ); + } /** * Retrieves the Ethereum address of the Exchange contract deployed on the network * that the user-passed web3 provider is connected to. -- cgit From 8324ab3af7e894dfa8a28fe2ab5d74a65215bd65 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:27:26 +0100 Subject: Update yarn.lock --- yarn.lock | 62 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/yarn.lock b/yarn.lock index cb9b6a76c..d3e8591ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1411,9 +1411,9 @@ aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" -aes-js@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" +aes-js@^0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d" ajv-keywords@^2.1.0: version "2.1.1" @@ -2479,6 +2479,10 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +base-x@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" + base-x@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" @@ -2886,7 +2890,7 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -bs58@=4.0.1, bs58@^4.0.0: +bs58@=4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: @@ -2896,13 +2900,18 @@ bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" +bs58@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e" dependencies: - bs58 "^4.0.0" + base-x "^1.1.0" + +bs58check@^1.0.8: + version "1.3.4" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8" + dependencies: + bs58 "^3.1.0" create-hash "^1.1.0" - safe-buffer "^5.1.2" btoa@1.1.2: version "1.1.2" @@ -5288,7 +5297,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: +ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -5342,18 +5351,17 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@~0.6.0: - version "0.6.2" - resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" +ethereumjs-wallet@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" dependencies: - aes-js "^3.1.1" - bs58check "^2.1.2" - ethereumjs-util "^5.2.0" - hdkey "^1.0.0" - safe-buffer "^5.1.2" + aes-js "^0.2.3" + bs58check "^1.0.8" + ethereumjs-util "^4.4.0" + hdkey "^0.7.0" scrypt.js "^0.2.0" - utf8 "^3.0.0" - uuid "^3.3.2" + utf8 "^2.1.1" + uuid "^2.0.1" ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: version "3.0.18" @@ -6794,21 +6802,13 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -hdkey@^0.7.1: +hdkey@^0.7.0, hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" dependencies: coinstring "^2.0.0" secp256k1 "^3.0.1" -hdkey@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" - dependencies: - coinstring "^2.0.0" - safe-buffer "^5.1.1" - secp256k1 "^3.0.1" - he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -14311,10 +14311,6 @@ utf8@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" -utf8@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -- cgit From 56847a53f4cae5f6ea68f72f8577ae3f1ea33a04 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:41:43 +0100 Subject: Add PR nr --- packages/contract-wrappers/CHANGELOG.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 9dc9cd1b3..f863972f9 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -7,11 +7,13 @@ }, { "note": - "Export `AssetBalanceAndProxyAllowanceFetcher` and `OrderFilledCancelledFetcher` implementations" + "Export `AssetBalanceAndProxyAllowanceFetcher` and `OrderFilledCancelledFetcher` implementations", + "pr": 1054 }, { "note": - "Add `validateOrderFillableOrThrowAsync` and `validateFillOrderThrowIfInvalidAsync` to ExchangeWrapper" + "Add `validateOrderFillableOrThrowAsync` and `validateFillOrderThrowIfInvalidAsync` to ExchangeWrapper", + "pr": 1054 } ] }, -- cgit From bbfd7647a805c9d6867868b040ca8434f10ef6c3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 16:52:21 +0100 Subject: Export missing type --- packages/0x.js/src/index.ts | 1 + packages/contract-wrappers/src/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 17511f468..d07bfcfc8 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -46,6 +46,7 @@ export { BalanceAndAllowance, OrderAndTraderInfo, TraderInfo, + ValidateOrderFillableOpts, } from '@0xproject/contract-wrappers'; export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 8f32a906f..f6d7ff879 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -25,6 +25,7 @@ export { BalanceAndAllowance, OrderAndTraderInfo, TraderInfo, + ValidateOrderFillableOpts, } from './types'; export { Order, SignedOrder, AssetProxyId } from '@0xproject/types'; -- cgit From 8d8528996a02aa65d81f3c3b59d5a42359205f54 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 4 Sep 2018 17:44:27 +0100 Subject: Export abstract fetchers --- packages/contract-wrappers/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index f6d7ff879..2fcdd2ddb 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -87,5 +87,7 @@ export { ExchangeEvents, } from './contract_wrappers/generated/exchange'; +export { AbstractBalanceAndProxyAllowanceFetcher, AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; + export { AssetBalanceAndProxyAllowanceFetcher } from './fetchers/asset_balance_and_proxy_allowance_fetcher'; export { OrderFilledCancelledFetcher } from './fetchers/order_filled_cancelled_fetcher'; -- cgit