aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml25
-rw-r--r--.gitignore12
-rw-r--r--.prettierignore12
-rw-r--r--README.md18
-rw-r--r--contracts/.solhint.json (renamed from contracts/core/.solhint.json)0
-rw-r--r--contracts/core/src/artifacts/index.ts73
-rw-r--r--contracts/core/src/wrappers/index.ts30
-rw-r--r--contracts/core/test/tutorials/arbitrage.ts260
-rw-r--r--contracts/core/tsconfig.json45
-rw-r--r--contracts/examples/CHANGELOG.json11
-rw-r--r--contracts/examples/CHANGELOG.md10
-rw-r--r--contracts/examples/README.md56
-rw-r--r--contracts/examples/compiler.json22
-rw-r--r--contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol (renamed from contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol)2
-rw-r--r--contracts/examples/contracts/Validator/Validator.sol (renamed from contracts/core/contracts/examples/Validator/Validator.sol)2
-rw-r--r--contracts/examples/contracts/Wallet/Wallet.sol (renamed from contracts/core/contracts/examples/Wallet/Wallet.sol)2
-rw-r--r--contracts/examples/contracts/Whitelist/Whitelist.sol (renamed from contracts/core/contracts/examples/Whitelist/Whitelist.sol)2
-rw-r--r--contracts/examples/package.json82
-rw-r--r--contracts/examples/src/artifacts/index.ts13
-rw-r--r--contracts/examples/src/index.ts2
-rw-r--r--contracts/examples/src/wrappers/index.ts4
-rw-r--r--contracts/examples/tsconfig.json16
-rw-r--r--contracts/examples/tslint.json (renamed from contracts/core/tslint.json)0
-rw-r--r--contracts/extensions/CHANGELOG.json11
-rw-r--r--contracts/extensions/CHANGELOG.md10
-rw-r--r--contracts/extensions/DEPLOYS.json31
-rw-r--r--contracts/extensions/README.md69
-rw-r--r--contracts/extensions/compiler.json22
-rw-r--r--contracts/extensions/contracts/DutchAuction/DutchAuction.sol (renamed from contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol)4
-rw-r--r--contracts/extensions/contracts/Forwarder/Forwarder.sol (renamed from contracts/core/contracts/extensions/Forwarder/Forwarder.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinAssets.sol)4
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinWeth.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinWeth.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/libs/LibConstants.sol (renamed from contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol)6
-rw-r--r--contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol (renamed from contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MWeth.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol)0
-rw-r--r--contracts/extensions/package.json93
-rw-r--r--contracts/extensions/src/artifacts/index.ts9
-rw-r--r--contracts/extensions/src/index.ts2
-rw-r--r--contracts/extensions/src/wrappers/index.ts2
-rw-r--r--contracts/extensions/test/extensions/dutch_auction.ts (renamed from contracts/core/test/extensions/dutch_auction.ts)24
-rw-r--r--contracts/extensions/test/extensions/forwarder.ts (renamed from contracts/core/test/extensions/forwarder.ts)27
-rw-r--r--contracts/extensions/test/global_hooks.ts (renamed from contracts/core/test/global_hooks.ts)0
-rw-r--r--contracts/extensions/test/utils/forwarder_wrapper.ts (renamed from contracts/core/test/utils/forwarder_wrapper.ts)8
-rw-r--r--contracts/extensions/tsconfig.json11
-rw-r--r--contracts/extensions/tslint.json6
-rw-r--r--contracts/interfaces/CHANGELOG.json11
-rw-r--r--contracts/interfaces/CHANGELOG.md10
-rw-r--r--contracts/interfaces/README.md72
-rw-r--r--contracts/interfaces/compiler.json35
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol (renamed from contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetData.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol (renamed from contracts/core/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IExchange.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IExchange.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/ITransactions.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IValidator.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IWallet.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IWallet.sol)0
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol (renamed from contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol)0
-rw-r--r--contracts/interfaces/package.json56
-rw-r--r--contracts/interfaces/src/artifacts/index.ts29
-rw-r--r--contracts/interfaces/src/index.ts2
-rw-r--r--contracts/interfaces/src/wrappers/index.ts12
-rw-r--r--contracts/interfaces/tsconfig.json24
-rw-r--r--contracts/interfaces/tslint.json6
-rw-r--r--contracts/libs/.solhint.json20
-rw-r--r--contracts/libs/CHANGELOG.json11
-rw-r--r--contracts/libs/CHANGELOG.md10
-rw-r--r--contracts/libs/package.json44
-rw-r--r--contracts/multisig/.solhint.json20
-rw-r--r--contracts/multisig/CHANGELOG.json12
-rw-r--r--contracts/multisig/CHANGELOG.md10
-rw-r--r--contracts/multisig/package.json37
-rw-r--r--contracts/protocol/CHANGELOG.json11
-rw-r--r--contracts/protocol/CHANGELOG.md10
-rw-r--r--contracts/protocol/DEPLOYS.json (renamed from contracts/core/CHANGELOG.json)45
-rw-r--r--contracts/protocol/README.md (renamed from contracts/core/README.md)12
-rw-r--r--contracts/protocol/compiler.json (renamed from contracts/core/compiler.json)23
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol (renamed from contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol (renamed from contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol (renamed from contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/Exchange.sol (renamed from contracts/core/contracts/protocol/Exchange/Exchange.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol)4
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinTransactions.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol)2
-rw-r--r--contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol (renamed from contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol)6
-rw-r--r--contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol (renamed from contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol (renamed from contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol (renamed from contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol (renamed from contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol (renamed from contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol)2
-rw-r--r--contracts/protocol/package.json (renamed from contracts/core/package.json)55
-rw-r--r--contracts/protocol/src/artifacts/index.ts29
-rw-r--r--contracts/protocol/src/index.ts3
-rw-r--r--contracts/protocol/src/wrappers/index.ts11
-rw-r--r--contracts/protocol/test/asset_proxy/authorizable.ts (renamed from contracts/core/test/asset_proxy/authorizable.ts)0
-rw-r--r--contracts/protocol/test/asset_proxy/proxies.ts (renamed from contracts/core/test/asset_proxy/proxies.ts)28
-rw-r--r--contracts/protocol/test/exchange/core.ts (renamed from contracts/core/test/exchange/core.ts)20
-rw-r--r--contracts/protocol/test/exchange/dispatcher.ts (renamed from contracts/core/test/exchange/dispatcher.ts)2
-rw-r--r--contracts/protocol/test/exchange/fill_order.ts (renamed from contracts/core/test/exchange/fill_order.ts)0
-rw-r--r--contracts/protocol/test/exchange/internal.ts (renamed from contracts/core/test/exchange/internal.ts)0
-rw-r--r--contracts/protocol/test/exchange/match_orders.ts (renamed from contracts/core/test/exchange/match_orders.ts)11
-rw-r--r--contracts/protocol/test/exchange/order_validator.ts (renamed from contracts/core/test/extensions/order_validator.ts)21
-rw-r--r--contracts/protocol/test/exchange/signature_validator.ts (renamed from contracts/core/test/exchange/signature_validator.ts)22
-rw-r--r--contracts/protocol/test/exchange/transactions.ts (renamed from contracts/core/test/exchange/transactions.ts)9
-rw-r--r--contracts/protocol/test/exchange/wrapper.ts (renamed from contracts/core/test/exchange/wrapper.ts)11
-rw-r--r--contracts/protocol/test/global_hooks.ts17
-rw-r--r--contracts/protocol/test/multisig/asset_proxy_owner.ts (renamed from contracts/core/test/multisig/asset_proxy_owner.ts)0
-rw-r--r--contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts (renamed from contracts/core/test/utils/asset_proxy_owner_wrapper.ts)3
-rw-r--r--contracts/protocol/test/utils/asset_wrapper.ts (renamed from contracts/core/test/utils/asset_wrapper.ts)0
-rw-r--r--contracts/protocol/test/utils/erc20_wrapper.ts (renamed from contracts/core/test/utils/erc20_wrapper.ts)4
-rw-r--r--contracts/protocol/test/utils/erc721_wrapper.ts (renamed from contracts/core/test/utils/erc721_wrapper.ts)4
-rw-r--r--contracts/protocol/test/utils/exchange_wrapper.ts (renamed from contracts/core/test/utils/exchange_wrapper.ts)5
-rw-r--r--contracts/protocol/test/utils/fill_order_combinatorial_utils.ts (renamed from contracts/core/test/utils/fill_order_combinatorial_utils.ts)0
-rw-r--r--contracts/protocol/test/utils/index.ts3
-rw-r--r--contracts/protocol/test/utils/match_order_tester.ts (renamed from contracts/core/test/utils/match_order_tester.ts)0
-rw-r--r--contracts/protocol/test/utils/order_factory_from_scenario.ts (renamed from contracts/core/test/utils/order_factory_from_scenario.ts)3
-rw-r--r--contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts (renamed from contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts)0
-rw-r--r--contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts (renamed from contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts)0
-rw-r--r--contracts/protocol/tsconfig.json24
-rw-r--r--contracts/protocol/tslint.json6
-rw-r--r--contracts/test-utils/CHANGELOG.json11
-rw-r--r--contracts/test-utils/CHANGELOG.md10
-rw-r--r--contracts/test-utils/package.json36
-rw-r--r--contracts/test-utils/src/assertions.ts14
-rw-r--r--contracts/test-utils/src/test_with_reference.ts6
-rw-r--r--contracts/tokens/.solhintignore (renamed from contracts/core/.solhintignore)0
-rw-r--r--contracts/tokens/CHANGELOG.json11
-rw-r--r--contracts/tokens/CHANGELOG.md10
-rw-r--r--contracts/tokens/DEPLOYS.json16
-rw-r--r--contracts/tokens/README.md74
-rw-r--r--contracts/tokens/compiler.json44
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol (renamed from contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol (renamed from contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol (renamed from contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol (renamed from contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol)2
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol (renamed from contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol (renamed from contracts/core/contracts/tokens/EtherToken/IEtherToken.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/WETH9.sol (renamed from contracts/core/contracts/tokens/EtherToken/WETH9.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol (renamed from contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol)0
-rw-r--r--contracts/tokens/package.json92
-rw-r--r--contracts/tokens/src/artifacts/index.ts49
-rw-r--r--contracts/tokens/src/index.ts2
-rw-r--r--contracts/tokens/src/wrappers/index.ts21
-rw-r--r--contracts/tokens/test/erc721_token.ts (renamed from contracts/core/test/tokens/erc721_token.ts)8
-rw-r--r--contracts/tokens/test/global_hooks.ts17
-rw-r--r--contracts/tokens/test/unlimited_allowance_token.ts (renamed from contracts/core/test/tokens/unlimited_allowance_token.ts)3
-rw-r--r--contracts/tokens/test/weth9.ts (renamed from contracts/core/test/tokens/weth9.ts)3
-rw-r--r--contracts/tokens/test/zrx_token.ts (renamed from contracts/core/test/tokens/zrx_token.ts)3
-rw-r--r--contracts/tokens/tsconfig.json33
-rw-r--r--contracts/tokens/tslint.json6
-rw-r--r--contracts/utils/.solhint.json20
-rw-r--r--contracts/utils/CHANGELOG.json11
-rw-r--r--contracts/utils/CHANGELOG.md10
-rw-r--r--contracts/utils/package.json42
-rw-r--r--contracts/utils/test/lib_bytes.ts2
-rw-r--r--package.json2
-rw-r--r--packages/0x.js/CHANGELOG.json18
-rw-r--r--packages/0x.js/CHANGELOG.md8
-rw-r--r--packages/0x.js/package.json32
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.json18
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.md8
-rw-r--r--packages/abi-gen-wrappers/package.json16
-rw-r--r--packages/abi-gen/CHANGELOG.json18
-rw-r--r--packages/abi-gen/CHANGELOG.md8
-rw-r--r--packages/abi-gen/package.json10
-rw-r--r--packages/assert/CHANGELOG.json18
-rw-r--r--packages/assert/CHANGELOG.md8
-rw-r--r--packages/assert/package.json10
-rw-r--r--packages/asset-buyer/CHANGELOG.json12
-rw-r--r--packages/asset-buyer/CHANGELOG.md8
-rw-r--r--packages/asset-buyer/package.json26
-rw-r--r--packages/base-contract/CHANGELOG.json18
-rw-r--r--packages/base-contract/CHANGELOG.md8
-rw-r--r--packages/base-contract/package.json12
-rw-r--r--packages/connect/CHANGELOG.json18
-rw-r--r--packages/connect/CHANGELOG.md8
-rw-r--r--packages/connect/package.json16
-rw-r--r--packages/contract-wrappers/CHANGELOG.json18
-rw-r--r--packages/contract-wrappers/CHANGELOG.md8
-rw-r--r--packages/contract-wrappers/package.json30
-rw-r--r--packages/dev-tools-pages/package.json4
-rw-r--r--packages/dev-utils/CHANGELOG.json18
-rw-r--r--packages/dev-utils/CHANGELOG.md8
-rw-r--r--packages/dev-utils/package.json16
-rw-r--r--packages/ethereum-types/CHANGELOG.json18
-rw-r--r--packages/ethereum-types/CHANGELOG.md8
-rw-r--r--packages/ethereum-types/package.json4
-rw-r--r--packages/fill-scenarios/CHANGELOG.json18
-rw-r--r--packages/fill-scenarios/CHANGELOG.md8
-rw-r--r--packages/fill-scenarios/package.json20
-rw-r--r--packages/instant/README.md6
-rw-r--r--packages/instant/package.json29
-rw-r--r--packages/instant/src/components/erc20_token_selector.tsx13
-rw-r--r--packages/instant/src/components/instant_heading.tsx34
-rw-r--r--packages/instant/src/components/order_details.tsx265
-rw-r--r--packages/instant/src/components/payment_method.tsx11
-rw-r--r--packages/instant/src/components/scaling_amount_input.tsx1
-rw-r--r--packages/instant/src/components/scaling_input.tsx93
-rw-r--r--packages/instant/src/components/section_header.tsx20
-rw-r--r--packages/instant/src/components/ui/input.tsx6
-rw-r--r--packages/instant/src/components/zero_ex_instant_provider.tsx2
-rw-r--r--packages/instant/src/constants.ts1
-rw-r--r--packages/instant/src/containers/connected_account_payment_method.ts2
-rw-r--r--packages/instant/src/containers/latest_buy_quote_order_details.ts33
-rw-r--r--packages/instant/src/redux/actions.ts4
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts3
-rw-r--r--packages/instant/src/redux/async_data.ts5
-rw-r--r--packages/instant/src/redux/reducer.ts8
-rw-r--r--packages/instant/src/types.ts6
-rw-r--r--packages/instant/src/util/analytics.ts11
-rw-r--r--packages/instant/src/util/asset.ts3
-rw-r--r--packages/instant/src/util/env.ts7
-rw-r--r--packages/instant/src/util/format.ts30
-rw-r--r--packages/instant/src/util/provider_state_factory.ts33
-rw-r--r--packages/instant/test/util/format.test.ts18
-rw-r--r--packages/json-schemas/CHANGELOG.json18
-rw-r--r--packages/json-schemas/CHANGELOG.md8
-rw-r--r--packages/json-schemas/package.json8
-rw-r--r--packages/metacoin/package.json26
-rw-r--r--packages/migrations/CHANGELOG.json18
-rw-r--r--packages/migrations/CHANGELOG.md8
-rw-r--r--packages/migrations/package.json26
-rw-r--r--packages/monorepo-scripts/package.json2
-rw-r--r--packages/monorepo-scripts/src/test_installation.ts2
-rw-r--r--packages/order-utils/CHANGELOG.json28
-rw-r--r--packages/order-utils/CHANGELOG.md12
-rw-r--r--packages/order-utils/package.json24
-rw-r--r--packages/order-utils/src/signature_utils.ts2
-rw-r--r--packages/order-utils/test/order_hash_test.ts2
-rw-r--r--packages/order-watcher/CHANGELOG.json18
-rw-r--r--packages/order-watcher/CHANGELOG.md8
-rw-r--r--packages/order-watcher/package.json32
-rw-r--r--packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts26
-rw-r--r--packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts33
-rw-r--r--packages/pipeline/package.json21
-rw-r--r--packages/pipeline/src/data_sources/bloxy/index.ts2
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts45
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts76
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/utils.ts67
-rw-r--r--packages/pipeline/src/data_sources/idex/index.ts82
-rw-r--r--packages/pipeline/src/data_sources/oasis/index.ts103
-rw-r--r--packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts32
-rw-r--r--packages/pipeline/src/data_sources/paradex/index.ts6
-rw-r--r--packages/pipeline/src/entities/erc20_approval_event.ts26
-rw-r--r--packages/pipeline/src/entities/index.ts1
-rw-r--r--packages/pipeline/src/entities/token_order.ts10
-rw-r--r--packages/pipeline/src/ormconfig.ts2
-rw-r--r--packages/pipeline/src/parsers/ddex_orders/index.ts32
-rw-r--r--packages/pipeline/src/parsers/events/erc20_events.ts34
-rw-r--r--packages/pipeline/src/parsers/events/exchange_events.ts133
-rw-r--r--packages/pipeline/src/parsers/events/index.ts135
-rw-r--r--packages/pipeline/src/parsers/idex_orders/index.ts77
-rw-r--r--packages/pipeline/src/parsers/oasis_orders/index.ts71
-rw-r--r--packages/pipeline/src/parsers/paradex_orders/index.ts4
-rw-r--r--packages/pipeline/src/parsers/token_metadata/index.ts7
-rw-r--r--packages/pipeline/src/parsers/utils.ts28
-rw-r--r--packages/pipeline/src/scripts/pull_competing_dex_trades.ts4
-rw-r--r--packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts4
-rw-r--r--packages/pipeline/src/scripts/pull_erc20_events.ts96
-rw-r--r--packages/pipeline/src/scripts/pull_exchange_events.ts (renamed from packages/pipeline/src/scripts/pull_missing_events.ts)28
-rw-r--r--packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts63
-rw-r--r--packages/pipeline/src/scripts/pull_missing_blocks.ts37
-rw-r--r--packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts58
-rw-r--r--packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts6
-rw-r--r--packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts4
-rw-r--r--packages/pipeline/src/scripts/pull_trusted_tokens.ts8
-rw-r--r--packages/pipeline/src/scripts/update_relayer_info.ts4
-rw-r--r--packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts44
-rw-r--r--packages/pipeline/src/utils/index.ts15
-rw-r--r--packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts109
-rw-r--r--packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts4
-rw-r--r--packages/pipeline/test/entities/erc20_approval_events_test.ts29
-rw-r--r--packages/pipeline/test/parsers/bloxy/index_test.ts1
-rw-r--r--packages/pipeline/test/parsers/ddex_orders/index_test.ts29
-rw-r--r--packages/pipeline/test/parsers/events/erc20_events_test.ts54
-rw-r--r--packages/pipeline/test/parsers/events/exchange_events_test.ts (renamed from packages/pipeline/test/parsers/events/index_test.ts)2
-rw-r--r--packages/pipeline/test/parsers/idex_orders/index_test.ts87
-rw-r--r--packages/pipeline/test/parsers/oasis_orders/index_test.ts49
-rw-r--r--packages/pipeline/test/parsers/paradex_orders/index_test.ts4
-rw-r--r--packages/pipeline/test/parsers/utils/index_test.ts30
-rw-r--r--packages/react-docs/CHANGELOG.json18
-rw-r--r--packages/react-docs/CHANGELOG.md8
-rw-r--r--packages/react-docs/package.json12
-rw-r--r--packages/react-shared/CHANGELOG.json18
-rw-r--r--packages/react-shared/CHANGELOG.md8
-rw-r--r--packages/react-shared/package.json8
-rw-r--r--packages/sol-compiler/CHANGELOG.json12
-rw-r--r--packages/sol-compiler/CHANGELOG.md8
-rw-r--r--packages/sol-compiler/package.json22
-rw-r--r--packages/sol-compiler/src/compiler.ts2
-rw-r--r--packages/sol-cov/CHANGELOG.json18
-rw-r--r--packages/sol-cov/CHANGELOG.md8
-rw-r--r--packages/sol-cov/package.json18
-rw-r--r--packages/sol-doc/CHANGELOG.json18
-rw-r--r--packages/sol-doc/CHANGELOG.md8
-rw-r--r--packages/sol-doc/package.json12
-rw-r--r--packages/sol-resolver/CHANGELOG.json12
-rw-r--r--packages/sol-resolver/CHANGELOG.md8
-rw-r--r--packages/sol-resolver/package.json8
-rw-r--r--packages/sra-spec/CHANGELOG.json18
-rw-r--r--packages/sra-spec/CHANGELOG.md8
-rw-r--r--packages/sra-spec/package.json6
-rw-r--r--packages/subproviders/CHANGELOG.json18
-rw-r--r--packages/subproviders/CHANGELOG.md8
-rw-r--r--packages/subproviders/package.json16
-rw-r--r--packages/testnet-faucets/package.json16
-rw-r--r--packages/tslint-config/CHANGELOG.json10
-rw-r--r--packages/tslint-config/CHANGELOG.md4
-rw-r--r--packages/tslint-config/package.json2
-rw-r--r--packages/tslint-config/rules/walkers/async_suffix.ts39
-rw-r--r--packages/tslint-config/tslint.json1
-rw-r--r--packages/types/CHANGELOG.json12
-rw-r--r--packages/types/CHANGELOG.md9
-rw-r--r--packages/types/package.json6
-rw-r--r--packages/typescript-typings/CHANGELOG.json18
-rw-r--r--packages/typescript-typings/CHANGELOG.md8
-rw-r--r--packages/typescript-typings/package.json4
-rw-r--r--packages/utils/CHANGELOG.json13
-rw-r--r--packages/utils/CHANGELOG.md8
-rw-r--r--packages/utils/package.json12
-rw-r--r--packages/utils/src/abi_utils.ts4
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts4
-rw-r--r--packages/web3-wrapper/CHANGELOG.json12
-rw-r--r--packages/web3-wrapper/CHANGELOG.md8
-rw-r--r--packages/web3-wrapper/package.json14
-rw-r--r--packages/website/package.json26
-rw-r--r--packages/website/public/images/developers/tutorials/integrate_0x_instant.svg3
-rw-r--r--packages/website/translations/english.json3
-rw-r--r--packages/website/ts/components/documentation/sidebar_header.tsx16
-rw-r--r--packages/website/ts/containers/order_watcher_documentation.ts2
-rw-r--r--packages/website/ts/pages/documentation/docs_home.tsx8
-rw-r--r--packages/website/ts/types.ts2
-rw-r--r--python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py2
-rw-r--r--python-packages/sra_client/README.md303
-rw-r--r--python-packages/sra_client/docs/DefaultApi.md397
-rw-r--r--python-packages/sra_client/docs/OrderSchema.md21
-rw-r--r--python-packages/sra_client/docs/PaginatedCollectionSchema.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md16
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderSchema.md10
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md10
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md16
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/SignedOrderSchema.md9
-rwxr-xr-xpython-packages/sra_client/generate.sh26
-rw-r--r--python-packages/sra_client/openapi-generator-cli-config.json4
-rw-r--r--python-packages/sra_client/requirements.txt5
-rwxr-xr-xpython-packages/sra_client/setup.py67
-rw-r--r--python-packages/sra_client/sra_client/__init__.py59
-rw-r--r--python-packages/sra_client/sra_client/api/__init__.py6
-rw-r--r--python-packages/sra_client/sra_client/api/default_api.py976
-rw-r--r--python-packages/sra_client/sra_client/api_client.py730
-rw-r--r--python-packages/sra_client/sra_client/configuration.py225
-rw-r--r--python-packages/sra_client/sra_client/models/__init__.py49
-rw-r--r--python-packages/sra_client/sra_client/models/order_schema.py550
-rw-r--r--python-packages/sra_client/sra_client/models/paginated_collection_schema.py161
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py209
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py176
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py171
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py372
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py228
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_schema.py134
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py137
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py344
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py211
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py211
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/signed_order_schema.py113
-rw-r--r--python-packages/sra_client/sra_client/rest.py421
-rw-r--r--python-packages/sra_client/test-requirements.txt5
-rw-r--r--python-packages/sra_client/test/__init__.py0
-rw-r--r--python-packages/sra_client/test/test_default_api.py35
-rw-r--r--python-packages/sra_client/tox.ini10
-rw-r--r--tsconfig.json12
-rw-r--r--yarn.lock42
419 files changed, 11457 insertions, 1630 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d11c7fcae..68d8041a2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -18,6 +18,7 @@ jobs:
name: yarn
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
- run: yarn build:ci:no_website
+ - run: yarn build:ts
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -43,7 +44,9 @@ jobs:
- run: yarn wsrun test:circleci @0x/contracts-multisig
- run: yarn wsrun test:circleci @0x/contracts-utils
- run: yarn wsrun test:circleci @0x/contracts-libs
- - run: yarn wsrun test:circleci @0x/contracts-core
+ - run: yarn wsrun test:circleci @0x/contracts-tokens
+ - run: yarn wsrun test:circleci @0x/contracts-extensions
+ - run: yarn wsrun test:circleci @0x/contracts-protocol
test-contracts-geth:
docker:
- image: circleci/node:9
@@ -58,7 +61,9 @@ jobs:
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-core
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol
test-publish:
resource_class: medium+
docker:
@@ -186,6 +191,9 @@ jobs:
- image: 0xorg/ganache-cli
command: |
ganache-cli --gasLimit 10000000 --noVMErrorsOnRPCResponse --db /snapshot --noVMErrorsOnRPCResponse -p 8545 --networkId 50 -m "concert load couple harbor equip island argue ramp clarify fence smart topic"
+ - image: 0xorg/launch-kit-ci
+ command: |
+ yarn start:ts -p 3000:3000
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
@@ -197,6 +205,11 @@ jobs:
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
+ - run:
+ command: |
+ cd python-packages/sra_client
+ python -m ensurepip
+ python -m pip install -e .
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -210,10 +223,18 @@ jobs:
command: |
cd python-packages/order_utils
coverage run setup.py test
+ - run:
+ command: |
+ cd python-packages/sra_client
+ coverage run setup.py test
- save_cache:
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/order_utils/.coverage
+ - save_cache:
+ key: coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/python-packages/sra_client/.coverage
test-rest-python:
working_directory: ~/repo
docker:
diff --git a/.gitignore b/.gitignore
index da7620a78..1d4410e25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -83,19 +83,27 @@ packages/react-docs/example/public/bundle*
packages/testnet-faucets/server/
# generated contract artifacts/
-contracts/core/generated-artifacts/
+contracts/protocol/generated-artifacts/
contracts/multisig/generated-artifacts/
contracts/utils/generated-artifacts/
contracts/libs/generated-artifacts/
+contracts/interfaces/generated-artifacts/
+contracts/tokens/generated-artifacts/
+contracts/examples/generated-artifacts/
+contracts/extensions/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
# generated contract wrappers
packages/abi-gen-wrappers/wrappers
-contracts/core/generated-wrappers/
+contracts/protocol/generated-wrappers/
contracts/multisig/generated-wrappers/
contracts/utils/generated-wrappers/
contracts/libs/generated-wrappers/
+contracts/interfaces/generated-wrappers/
+contracts/tokens/generated-wrappers/
+contracts/examples/generated-wrappers/
+contracts/extensions/generated-wrappers/
packages/metacoin/src/contract_wrappers
# solc-bin in sol-compiler
diff --git a/.prettierignore b/.prettierignore
index 43c8015fd..7f8662b0a 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,13 +1,21 @@
lib
.nyc_output
-/contracts/core/generated-wrappers
-/contracts/core/generated-artifacts
+/contracts/protocol/generated-wrappers
+/contracts/protocol/generated-artifacts
/contracts/multisig/generated-wrappers
/contracts/multisig/generated-artifacts
/contracts/utils/generated-wrappers
/contracts/utils/generated-artifacts
/contracts/libs/generated-wrappers
/contracts/libs/generated-artifacts
+/contracts/interfaces/generated-wrappers
+/contracts/interfaces/generated-artifacts
+/contracts/tokens/generated-wrappers
+/contracts/tokens/generated-artifacts
+/contracts/examples/generated-wrappers
+/contracts/examples/generated-artifacts
+/contracts/extensions/generated-wrappers
+/contracts/extensions/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
diff --git a/README.md b/README.md
index 5e99b4788..fd96c2b86 100644
--- a/README.md
+++ b/README.md
@@ -24,9 +24,10 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
### Python Packages
-| Package | Version | Description |
-| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| [`0x-order-utils.py`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
+| Package | Version | Description |
+| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
+| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
### Typescript/Javascript Packages
@@ -76,11 +77,12 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
#### Private Packages
-| Package | Description |
-| -------------------------------------------------- | ---------------------------------------------------------------- |
-| [`@0x/contracts`](/contracts/core) | 0x protocol solidity smart contracts & tests |
-| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
-| [`@0x/website`](/packages/website) | 0x website |
+| Package | Description |
+| -------------------------------------------------- | -------------------------------------------------------------------------------- |
+| [`@0x/contracts`](/contracts/core) | 0x protocol solidity smart contracts & tests |
+| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
+| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
+| [`@0x/website`](/packages/website) | 0x website |
## Usage
diff --git a/contracts/core/.solhint.json b/contracts/.solhint.json
index 076afe9f3..076afe9f3 100644
--- a/contracts/core/.solhint.json
+++ b/contracts/.solhint.json
diff --git a/contracts/core/src/artifacts/index.ts b/contracts/core/src/artifacts/index.ts
deleted file mode 100644
index d578c36fe..000000000
--- a/contracts/core/src/artifacts/index.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
-import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json';
-import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
-import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
-import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json';
-import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json';
-import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
-import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
-import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
-import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
-import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
-import * as Exchange from '../../generated-artifacts/Exchange.json';
-import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
-import * as Forwarder from '../../generated-artifacts/Forwarder.json';
-import * as IAssetData from '../../generated-artifacts/IAssetData.json';
-import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
-import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
-import * as IValidator from '../../generated-artifacts/IValidator.json';
-import * as IWallet from '../../generated-artifacts/IWallet.json';
-import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
-import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
-import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
-import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
-import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
-import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
-import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
-import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
-import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
-import * as Validator from '../../generated-artifacts/Validator.json';
-import * as Wallet from '../../generated-artifacts/Wallet.json';
-import * as WETH9 from '../../generated-artifacts/WETH9.json';
-import * as Whitelist from '../../generated-artifacts/Whitelist.json';
-import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
-
-export const artifacts = {
- AssetProxyOwner: AssetProxyOwner as ContractArtifact,
- DummyERC20Token: DummyERC20Token as ContractArtifact,
- DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
- DummyERC721Token: DummyERC721Token as ContractArtifact,
- DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
- DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
- DutchAuction: DutchAuction as ContractArtifact,
- ERC20Proxy: ERC20Proxy as ContractArtifact,
- ERC20Token: ERC20Token as ContractArtifact,
- ERC721Proxy: ERC721Proxy as ContractArtifact,
- ERC721Token: ERC721Token as ContractArtifact,
- Exchange: Exchange as ContractArtifact,
- ExchangeWrapper: ExchangeWrapper as ContractArtifact,
- Forwarder: Forwarder as ContractArtifact,
- IAssetData: IAssetData as ContractArtifact,
- IAssetProxy: IAssetProxy as ContractArtifact,
- IValidator: IValidator as ContractArtifact,
- IWallet: IWallet as ContractArtifact,
- InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
- MixinAuthorizable: MixinAuthorizable as ContractArtifact,
- MultiAssetProxy: MultiAssetProxy as ContractArtifact,
- OrderValidator: OrderValidator as ContractArtifact,
- ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
- TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
- TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
- TestExchangeInternals: TestExchangeInternals as ContractArtifact,
- TestSignatureValidator: TestSignatureValidator as ContractArtifact,
- TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
- Validator: Validator as ContractArtifact,
- WETH9: WETH9 as ContractArtifact,
- Wallet: Wallet as ContractArtifact,
- Whitelist: Whitelist as ContractArtifact,
- // Note(albrow): "as any" hack still required here because ZRXToken does not
- // conform to the v2 artifact type.
- ZRXToken: (ZRXToken as any) as ContractArtifact,
-};
diff --git a/contracts/core/src/wrappers/index.ts b/contracts/core/src/wrappers/index.ts
deleted file mode 100644
index ed9d8ef47..000000000
--- a/contracts/core/src/wrappers/index.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export * from '../../generated-wrappers/asset_proxy_owner';
-export * from '../../generated-wrappers/dummy_erc20_token';
-export * from '../../generated-wrappers/dummy_erc721_receiver';
-export * from '../../generated-wrappers/dummy_erc721_token';
-export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
-export * from '../../generated-wrappers/dummy_no_return_erc20_token';
-export * from '../../generated-wrappers/dutch_auction';
-export * from '../../generated-wrappers/erc20_proxy';
-export * from '../../generated-wrappers/erc721_proxy';
-export * from '../../generated-wrappers/erc20_token';
-export * from '../../generated-wrappers/erc721_token';
-export * from '../../generated-wrappers/exchange';
-export * from '../../generated-wrappers/exchange_wrapper';
-export * from '../../generated-wrappers/forwarder';
-export * from '../../generated-wrappers/i_asset_data';
-export * from '../../generated-wrappers/i_asset_proxy';
-export * from '../../generated-wrappers/invalid_erc721_receiver';
-export * from '../../generated-wrappers/mixin_authorizable';
-export * from '../../generated-wrappers/order_validator';
-export * from '../../generated-wrappers/reentrant_erc20_token';
-export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
-export * from '../../generated-wrappers/test_asset_proxy_owner';
-export * from '../../generated-wrappers/test_exchange_internals';
-export * from '../../generated-wrappers/test_signature_validator';
-export * from '../../generated-wrappers/test_static_call_receiver';
-export * from '../../generated-wrappers/validator';
-export * from '../../generated-wrappers/wallet';
-export * from '../../generated-wrappers/weth9';
-export * from '../../generated-wrappers/whitelist';
-export * from '../../generated-wrappers/zrx_token';
diff --git a/contracts/core/test/tutorials/arbitrage.ts b/contracts/core/test/tutorials/arbitrage.ts
deleted file mode 100644
index 78e0bc238..000000000
--- a/contracts/core/test/tutorials/arbitrage.ts
+++ /dev/null
@@ -1,260 +0,0 @@
-// import { ECSignature, SignedOrder, ZeroEx } from '0x.js';
-// import { BlockchainLifecycle, devConstants, web3Factory } from '@0x/dev-utils';
-// import { ExchangeContractErrs } from 'ethereum-types';
-// import { BigNumber } from '@0x/utils';
-// import { Web3Wrapper } from '@0x/web3-wrapper';
-// import * as chai from 'chai';
-// import ethUtil = require('ethereumjs-util');
-// import * as Web3 from 'web3';
-
-// import { AccountLevelsContract } from '../../src/generated_contract_wrappers/account_levels';
-// import { ArbitrageContract } from '../../src/generated_contract_wrappers/arbitrage';
-// import { DummyTokenContract } from '../../src/generated_contract_wrappers/dummy_token';
-// import { EtherDeltaContract } from '../../src/generated_contract_wrappers/ether_delta';
-// import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange';
-// import { TokenTransferProxyContract } from '../../src/generated_contract_wrappers/token_transfer_proxy';
-// import { artifacts } from '../../util/artifacts';
-// import { Balances } from '../../util/balances';
-// import { constants } from '../../util/constants';
-// import { crypto } from '../../util/crypto';
-// import { ExchangeWrapper } from '../../util/exchange_wrapper';
-// import { OrderFactory } from '../../util/order_factory';
-// import { BalancesByOwner, ContractName } from '../../util/types';
-// import { chaiSetup } from '../utils/chai_setup';
-
-// import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-// chaiSetup.configure();
-// const expect = chai.expect;
-// const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-// describe('Arbitrage', () => {
-// let coinbase: string;
-// let maker: string;
-// let edMaker: string;
-// let edFrontRunner: string;
-// let amountGet: BigNumber;
-// let amountGive: BigNumber;
-// let makerTokenAmount: BigNumber;
-// let takerTokenAmount: BigNumber;
-// const feeRecipient = constants.NULL_ADDRESS;
-// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
-// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
-
-// let weth: DummyTokenContract;
-// let zrx: DummyTokenContract;
-// let arbitrage: ArbitrageContract;
-// let etherDelta: EtherDeltaContract;
-
-// let signedOrder: SignedOrder;
-// let exWrapper: ExchangeWrapper;
-// let orderFactory: OrderFactory;
-
-// let zeroEx: ZeroEx;
-
-// // From a bird's eye view - we create two orders.
-// // 0x order of 1 ZRX (maker) for 1 WETH (taker)
-// // ED order of 2 WETH (tokenGive) for 1 ZRX (tokenGet)
-// // And then we do an atomic arbitrage between them which gives us 1 WETH.
-// before(async () => {
-// const accounts = await web3Wrapper.getAvailableAddressesAsync();
-// [coinbase, maker, edMaker, edFrontRunner] = accounts;
-// weth = await DummyTokenContract.deployFrom0xArtifactAsync(
-// artifacts.DummyToken,
-// provider,
-// txDefaults,
-// constants.DUMMY_TOKEN_NAME,
-// constants.DUMMY_TOKEN_SYMBOL,
-// constants.DUMMY_TOKEN_DECIMALS,
-// constants.DUMMY_TOKEN_TOTAL_SUPPLY,
-// );
-// zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
-// artifacts.DummyToken,
-// provider,
-// txDefaults,
-// constants.DUMMY_TOKEN_NAME,
-// constants.DUMMY_TOKEN_SYMBOL,
-// constants.DUMMY_TOKEN_DECIMALS,
-// constants.DUMMY_TOKEN_TOTAL_SUPPLY,
-// );
-// const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
-// artifacts.AccountLevels,
-// provider,
-// txDefaults,
-// );
-// const edAdminAddress = accounts[0];
-// const edMakerFee = new BigNumber(0);
-// const edTakerFee = new BigNumber(0);
-// const edFeeRebate = new BigNumber(0);
-// etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
-// artifacts.EtherDelta,
-// provider,
-// txDefaults,
-// edAdminAddress,
-// feeRecipient,
-// accountLevels.address,
-// edMakerFee,
-// edTakerFee,
-// edFeeRebate,
-// );
-// const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
-// artifacts.TokenTransferProxy,
-// provider,
-// txDefaults,
-// );
-// const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
-// artifacts.Exchange,
-// provider,
-// txDefaults,
-// zrx.address,
-// tokenTransferProxy.address,
-// );
-// await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
-// zeroEx = new ZeroEx(provider, {
-// exchangeContractAddress: exchange.address,
-// networkId: constants.TESTRPC_NETWORK_ID,
-// });
-// exWrapper = new ExchangeWrapper(exchange, provider);
-
-// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
-// takerTokenAmount = makerTokenAmount;
-// const defaultOrderParams = {
-// exchangeContractAddress: exchange.address,
-// maker,
-// feeRecipient,
-// makerTokenAddress: zrx.address,
-// takerTokenAddress: weth.address,
-// makerTokenAmount,
-// takerTokenAmount,
-// makerFee: new BigNumber(0),
-// takerFee: new BigNumber(0),
-// };
-// orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
-// arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
-// artifacts.Arbitrage,
-// provider,
-// txDefaults,
-// exchange.address,
-// etherDelta.address,
-// tokenTransferProxy.address,
-// );
-// // Enable arbitrage and withdrawals of tokens
-// await arbitrage.setAllowances.sendTransactionAsync(weth.address, { from: coinbase });
-// await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
-
-// // Give some tokens to arbitrage contract
-// await weth.setBalance.sendTransactionAsync(arbitrage.address, takerTokenAmount, { from: coinbase });
-
-// // Fund the maker on exchange side
-// await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase });
-// // Set the allowance for the maker on Exchange side
-// await zrx.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
-
-// amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
-// // Fund the maker on EtherDelta side
-// await weth.setBalance.sendTransactionAsync(edMaker, amountGive, { from: coinbase });
-// // Set the allowance for the maker on EtherDelta side
-// await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
-// // Deposit maker funds into EtherDelta
-// await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
-
-// amountGet = makerTokenAmount;
-// // Fund the front runner on EtherDelta side
-// await zrx.setBalance.sendTransactionAsync(edFrontRunner, amountGet, { from: coinbase });
-// // Set the allowance for the front-runner on EtherDelta side
-// await zrx.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
-// // Deposit front runner funds into EtherDelta
-// await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
-// });
-// beforeEach(async () => {
-// await blockchainLifecycle.startAsync();
-// });
-// afterEach(async () => {
-// await blockchainLifecycle.revertAsync();
-// });
-// describe('makeAtomicTrade', () => {
-// let addresses: string[];
-// let values: BigNumber[];
-// let v: number[];
-// let r: string[];
-// let s: string[];
-// let tokenGet: string;
-// let tokenGive: string;
-// let expires: BigNumber;
-// let nonce: BigNumber;
-// let edSignature: ECSignature;
-// before(async () => {
-// signedOrder = await orderFactory.newSignedOrderAsync();
-// tokenGet = zrx.address;
-// tokenGive = weth.address;
-// const blockNumber = await web3Wrapper.getBlockNumberAsync();
-// const ED_ORDER_EXPIRATION_IN_BLOCKS = 10;
-// expires = new BigNumber(blockNumber + ED_ORDER_EXPIRATION_IN_BLOCKS);
-// nonce = new BigNumber(42);
-// const edOrderHash = `0x${crypto
-// .solSHA256([etherDelta.address, tokenGet, amountGet, tokenGive, amountGive, expires, nonce])
-// .toString('hex')}`;
-// const shouldAddPersonalMessagePrefix = false;
-// edSignature = await zeroEx.signOrderHashAsync(edOrderHash, edMaker, shouldAddPersonalMessagePrefix);
-// addresses = [
-// signedOrder.maker,
-// signedOrder.taker,
-// signedOrder.makerTokenAddress,
-// signedOrder.takerTokenAddress,
-// signedOrder.feeRecipient,
-// edMaker,
-// ];
-// const fillTakerTokenAmount = takerTokenAmount;
-// const edFillAmount = makerTokenAmount;
-// values = [
-// signedOrder.makerTokenAmount,
-// signedOrder.takerTokenAmount,
-// signedOrder.makerFee,
-// signedOrder.takerFee,
-// signedOrder.expirationUnixTimestampSec,
-// signedOrder.salt,
-// fillTakerTokenAmount,
-// amountGet,
-// amountGive,
-// expires,
-// nonce,
-// edFillAmount,
-// ];
-// v = [signedOrder.ecSignature.v, edSignature.v];
-// r = [signedOrder.ecSignature.r, edSignature.r];
-// s = [signedOrder.ecSignature.s, edSignature.s];
-// });
-// it('should successfully execute the arbitrage if not front-runned', async () => {
-// const txHash = await arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, {
-// from: coinbase,
-// });
-// const res = await zeroEx.awaitTransactionMinedAsync(txHash);
-// const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// expect(postBalance).to.be.bignumber.equal(amountGive);
-// });
-// it('should fail and revert if front-runned', async () => {
-// const preBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// // Front-running transaction
-// await etherDelta.trade.sendTransactionAsync(
-// tokenGet,
-// amountGet,
-// tokenGive,
-// amountGive,
-// expires,
-// nonce,
-// edMaker,
-// edSignature.v,
-// edSignature.r,
-// edSignature.s,
-// amountGet,
-// { from: edFrontRunner },
-// );
-// // tslint:disable-next-line:await-promise
-// await expect(
-// arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
-// ).to.be.rejectedWith(constants.REVERT);
-// const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// expect(preBalance).to.be.bignumber.equal(postBalance);
-// });
-// });
-// });
diff --git a/contracts/core/tsconfig.json b/contracts/core/tsconfig.json
deleted file mode 100644
index f2f3c4e97..000000000
--- a/contracts/core/tsconfig.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": ".",
- "resolveJsonModule": true
- },
- "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
- "files": [
- "./generated-artifacts/AssetProxyOwner.json",
- "./generated-artifacts/DummyERC20Token.json",
- "./generated-artifacts/DummyERC721Receiver.json",
- "./generated-artifacts/DummyERC721Token.json",
- "./generated-artifacts/DummyMultipleReturnERC20Token.json",
- "./generated-artifacts/DummyNoReturnERC20Token.json",
- "./generated-artifacts/DutchAuction.json",
- "./generated-artifacts/ERC20Proxy.json",
- "./generated-artifacts/ERC20Token.json",
- "./generated-artifacts/ERC721Proxy.json",
- "./generated-artifacts/ERC721Token.json",
- "./generated-artifacts/Exchange.json",
- "./generated-artifacts/ExchangeWrapper.json",
- "./generated-artifacts/Forwarder.json",
- "./generated-artifacts/IAssetData.json",
- "./generated-artifacts/IAssetProxy.json",
- "./generated-artifacts/IValidator.json",
- "./generated-artifacts/IWallet.json",
- "./generated-artifacts/InvalidERC721Receiver.json",
- "./generated-artifacts/MixinAuthorizable.json",
- "./generated-artifacts/MultiAssetProxy.json",
- "./generated-artifacts/OrderValidator.json",
- "./generated-artifacts/ReentrantERC20Token.json",
- "./generated-artifacts/TestAssetProxyDispatcher.json",
- "./generated-artifacts/TestAssetProxyOwner.json",
- "./generated-artifacts/TestExchangeInternals.json",
- "./generated-artifacts/TestSignatureValidator.json",
- "./generated-artifacts/TestStaticCallReceiver.json",
- "./generated-artifacts/Validator.json",
- "./generated-artifacts/WETH9.json",
- "./generated-artifacts/Wallet.json",
- "./generated-artifacts/Whitelist.json",
- "./generated-artifacts/ZRXToken.json"
- ],
- "exclude": ["./deploy/solc/solc_bin"]
-}
diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/examples/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/examples/CHANGELOG.md b/contracts/examples/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/examples/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/examples/README.md b/contracts/examples/README.md
new file mode 100644
index 000000000..ca23d0974
--- /dev/null
+++ b/contracts/examples/README.md
@@ -0,0 +1,56 @@
+## Contract examples
+
+Example smart contracts that interact with 0x protocol.
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory.
+This package contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-examples yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-examples yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
diff --git a/contracts/examples/compiler.json b/contracts/examples/compiler.json
new file mode 100644
index 000000000..375fa0c55
--- /dev/null
+++ b/contracts/examples/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"]
+}
diff --git a/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol
index ca5a64a26..d98136922 100644
--- a/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
+++ b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
diff --git a/contracts/core/contracts/examples/Validator/Validator.sol b/contracts/examples/contracts/Validator/Validator.sol
index 72ed528ba..e488a9ca7 100644
--- a/contracts/core/contracts/examples/Validator/Validator.sol
+++ b/contracts/examples/contracts/Validator/Validator.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../protocol/Exchange/interfaces/IValidator.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
contract Validator is
diff --git a/contracts/core/contracts/examples/Wallet/Wallet.sol b/contracts/examples/contracts/Wallet/Wallet.sol
index 3738be841..8edc74eb3 100644
--- a/contracts/core/contracts/examples/Wallet/Wallet.sol
+++ b/contracts/examples/contracts/Wallet/Wallet.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../protocol/Exchange/interfaces/IWallet.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
diff --git a/contracts/core/contracts/examples/Whitelist/Whitelist.sol b/contracts/examples/contracts/Whitelist/Whitelist.sol
index cfcddddd3..2a3d33738 100644
--- a/contracts/core/contracts/examples/Whitelist/Whitelist.sol
+++ b/contracts/examples/contracts/Whitelist/Whitelist.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
diff --git a/contracts/examples/package.json b/contracts/examples/package.json
new file mode 100644
index 000000000..77846241e
--- /dev/null
+++ b/contracts/examples/package.json
@@ -0,0 +1,82 @@
+{
+ "name": "@0x/contracts-examples",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract examples of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "compile": "sol-compiler --contracts-dir contracts",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/examples/src/artifacts/index.ts b/contracts/examples/src/artifacts/index.ts
new file mode 100644
index 000000000..c921fbf89
--- /dev/null
+++ b/contracts/examples/src/artifacts/index.ts
@@ -0,0 +1,13 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
+import * as Validator from '../../generated-artifacts/Validator.json';
+import * as Wallet from '../../generated-artifacts/Wallet.json';
+import * as Whitelist from '../../generated-artifacts/Whitelist.json';
+
+export const artifacts = {
+ ExchangeWrapper: ExchangeWrapper as ContractArtifact,
+ Validator: Validator as ContractArtifact,
+ Wallet: Wallet as ContractArtifact,
+ Whitelist: Whitelist as ContractArtifact,
+};
diff --git a/contracts/examples/src/index.ts b/contracts/examples/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/examples/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/examples/src/wrappers/index.ts b/contracts/examples/src/wrappers/index.ts
new file mode 100644
index 000000000..dc67277d7
--- /dev/null
+++ b/contracts/examples/src/wrappers/index.ts
@@ -0,0 +1,4 @@
+export * from '../../generated-wrappers/exchange_wrapper';
+export * from '../../generated-wrappers/validator';
+export * from '../../generated-wrappers/wallet';
+export * from '../../generated-wrappers/whitelist';
diff --git a/contracts/examples/tsconfig.json b/contracts/examples/tsconfig.json
new file mode 100644
index 000000000..63245da1e
--- /dev/null
+++ b/contracts/examples/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/ExchangeWrapper.json",
+ "./generated-artifacts/Validator.json",
+ "./generated-artifacts/Wallet.json",
+ "./generated-artifacts/Whitelist.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/core/tslint.json b/contracts/examples/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/core/tslint.json
+++ b/contracts/examples/tslint.json
diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/extensions/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/extensions/CHANGELOG.md b/contracts/extensions/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/extensions/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/extensions/DEPLOYS.json b/contracts/extensions/DEPLOYS.json
new file mode 100644
index 000000000..1a093bf77
--- /dev/null
+++ b/contracts/extensions/DEPLOYS.json
@@ -0,0 +1,31 @@
+[
+ {
+ "name": "Forwarder",
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "Round up when calculating remaining amounts in marketBuy functions",
+ "pr": 1162,
+ "networks": {
+ "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
+ "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
+ "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Forwarder",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
+ "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
+ "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/extensions/README.md b/contracts/extensions/README.md
new file mode 100644
index 000000000..820f6e78a
--- /dev/null
+++ b/contracts/extensions/README.md
@@ -0,0 +1,69 @@
+## Contract extensions
+
+Smart contracts that implement extensions for the 0x protocol.
+
+## Usage
+
+Contract extensions of the protocol can be found in the [contracts](./contracts) directory. This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-extensions yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-extensions yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/extensions/compiler.json b/contracts/extensions/compiler.json
new file mode 100644
index 000000000..69d607b3e
--- /dev/null
+++ b/contracts/extensions/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["DutchAuction", "Forwarder"]
+}
diff --git a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
index a40991ae7..9c9f3990a 100644
--- a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
+++ b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
@@ -19,9 +19,9 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/Forwarder.sol b/contracts/extensions/contracts/Forwarder/Forwarder.sol
index 94dec40ed..94dec40ed 100644
--- a/contracts/core/contracts/extensions/Forwarder/Forwarder.sol
+++ b/contracts/extensions/contracts/Forwarder/Forwarder.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
index 5f5f3456d..3ebf75161 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol
+++ b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
@@ -20,8 +20,8 @@ pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
import "./libs/LibConstants.sol";
import "./mixins/MAssets.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol
index 210eb14c2..210eb14c2 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
+++ b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol
index bab78d79b..bab78d79b 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol
+++ b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol b/contracts/extensions/contracts/Forwarder/MixinWeth.sol
index 2a281f3ae..2a281f3ae 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol
+++ b/contracts/extensions/contracts/Forwarder/MixinWeth.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol
index 1e034c003..1e034c003 100644
--- a/contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol
index f5a26e2ba..f5a26e2ba 100644
--- a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol
index eede20bb8..eede20bb8 100644
--- a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
index 0f98ae595..4a81abf76 100644
--- a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol
+++ b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
@@ -19,9 +19,9 @@
pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "../../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../../tokens/EtherToken/IEtherToken.sol";
-import "../../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
contract LibConstants {
diff --git a/contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol
index fb3ade1db..fb3ade1db 100644
--- a/contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol
+++ b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol
index 9e7f80d97..9e7f80d97 100644
--- a/contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol
+++ b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol
index d9e71786a..d9e71786a 100644
--- a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
+++ b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol
diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol
index 88e77be4e..88e77be4e 100644
--- a/contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol
+++ b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol
diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json
new file mode 100644
index 000000000..938e1138c
--- /dev/null
+++ b/contracts/extensions/package.json
@@ -0,0 +1,93 @@
+{
+ "name": "@0x/contracts-extensions",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract extensions of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler --contracts-dir contracts",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(DutchAuction|Forwarder).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-protocol": "^2.1.59",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/extensions/src/artifacts/index.ts b/contracts/extensions/src/artifacts/index.ts
new file mode 100644
index 000000000..7588178f0
--- /dev/null
+++ b/contracts/extensions/src/artifacts/index.ts
@@ -0,0 +1,9 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
+import * as Forwarder from '../../generated-artifacts/Forwarder.json';
+
+export const artifacts = {
+ DutchAuction: DutchAuction as ContractArtifact,
+ Forwarder: Forwarder as ContractArtifact,
+};
diff --git a/contracts/extensions/src/index.ts b/contracts/extensions/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/extensions/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/extensions/src/wrappers/index.ts b/contracts/extensions/src/wrappers/index.ts
new file mode 100644
index 000000000..90880e37f
--- /dev/null
+++ b/contracts/extensions/src/wrappers/index.ts
@@ -0,0 +1,2 @@
+export * from '../../generated-wrappers/dutch_auction';
+export * from '../../generated-wrappers/forwarder';
diff --git a/contracts/core/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts
index 54e6092d7..6c3b2f0f3 100644
--- a/contracts/core/test/extensions/dutch_auction.ts
+++ b/contracts/extensions/test/extensions/dutch_auction.ts
@@ -1,4 +1,11 @@
import {
+ artifacts as protocolArtifacts,
+ ERC20Wrapper,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
chaiSetup,
constants,
ContractName,
@@ -10,6 +17,12 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ WETH9Contract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -20,15 +33,8 @@ import ethAbi = require('ethereumjs-abi');
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
-import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
import { artifacts } from '../../src/artifacts';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -98,12 +104,12 @@ describe(ContractName.DutchAuction, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults);
erc20Wrapper.addDummyTokenContract(wethContract as any);
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
+ protocolArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/core/test/extensions/forwarder.ts b/contracts/extensions/test/extensions/forwarder.ts
index 44ad4d6ff..4027f493d 100644
--- a/contracts/core/test/extensions/forwarder.ts
+++ b/contracts/extensions/test/extensions/forwarder.ts
@@ -1,4 +1,11 @@
import {
+ artifacts as protocolArtifacts,
+ ERC20Wrapper,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
chaiSetup,
constants,
ContractName,
@@ -11,6 +18,12 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokenArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ WETH9Contract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -19,15 +32,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { ExchangeContract } from '../../generated-wrappers/exchange';
import { ForwarderContract } from '../../generated-wrappers/forwarder';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
import { artifacts } from '../../src/artifacts';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
+
import { ForwarderWrapper } from '../utils/forwarder_wrapper';
chaiSetup.configure();
@@ -94,14 +101,14 @@ describe(ContractName.Forwarder, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults);
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
erc20Wrapper.addDummyTokenContract(weth);
wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
+ protocolArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
@@ -172,7 +179,7 @@ describe(ContractName.Forwarder, () => {
describe('constructor', () => {
it('should revert if assetProxy is unregistered', async () => {
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
+ protocolArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/core/test/global_hooks.ts b/contracts/extensions/test/global_hooks.ts
index f8ace376a..f8ace376a 100644
--- a/contracts/core/test/global_hooks.ts
+++ b/contracts/extensions/test/global_hooks.ts
diff --git a/contracts/core/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts
index 9c5560381..9e44ff6b9 100644
--- a/contracts/core/test/utils/forwarder_wrapper.ts
+++ b/contracts/extensions/test/utils/forwarder_wrapper.ts
@@ -1,4 +1,6 @@
+import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
@@ -58,7 +60,11 @@ export class ForwarderWrapper {
constructor(contractInstance: ForwarderContract, provider: Provider) {
this._forwarderContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, {
+ ...artifacts,
+ ...tokensArtifacts,
+ ...protocolArtifacts,
+ });
}
public async marketSellOrdersWithEthAsync(
orders: SignedOrder[],
diff --git a/contracts/extensions/tsconfig.json b/contracts/extensions/tsconfig.json
new file mode 100644
index 000000000..a4ce1e002
--- /dev/null
+++ b/contracts/extensions/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": ["./generated-artifacts/DutchAuction.json", "./generated-artifacts/Forwarder.json"],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/extensions/tslint.json b/contracts/extensions/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/extensions/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/interfaces/CHANGELOG.json b/contracts/interfaces/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/interfaces/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/interfaces/CHANGELOG.md b/contracts/interfaces/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/interfaces/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/interfaces/README.md b/contracts/interfaces/README.md
new file mode 100644
index 000000000..b7d519abb
--- /dev/null
+++ b/contracts/interfaces/README.md
@@ -0,0 +1,72 @@
+## Contract interfaces
+
+Smart contract interfaces of the 0x protocol.
+
+## Usage
+
+Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [protocol](./contracts/protocol)
+ * This directory contains the contract interfaces that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-interfaces yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-interfaces yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/interfaces/compiler.json b/contracts/interfaces/compiler.json
new file mode 100644
index 000000000..38a232541
--- /dev/null
+++ b/contracts/interfaces/compiler.json
@@ -0,0 +1,35 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "IAssetData",
+ "IAssetProxy",
+ "IAuthorizable",
+ "IAssetProxyDispatcher",
+ "IExchange",
+ "IExchangeCore",
+ "IMatchOrders",
+ "ISignatureValidator",
+ "ITransactions",
+ "IValidator",
+ "IWallet",
+ "IWrapperFunctions"
+ ]
+}
diff --git a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetData.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol
index e2da68919..e2da68919 100644
--- a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetData.sol
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol
index b25d2d75a..b25d2d75a 100644
--- a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol
index 96ee05dee..96ee05dee 100644
--- a/contracts/core/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol b/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol
index 8db8d6f6c..8db8d6f6c 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IExchange.sol b/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol
index b92abba04..b92abba04 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IExchange.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol b/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol
index 0da73529c..0da73529c 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol b/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol
index b88e158c3..b88e158c3 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol b/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol
index 1fd0eccf0..1fd0eccf0 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/ITransactions.sol b/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol
index 4446c55ce..4446c55ce 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/ITransactions.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IValidator.sol b/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol
index 2dd69100c..2dd69100c 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IValidator.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IWallet.sol b/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol
index c97161ca6..c97161ca6 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IWallet.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol b/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol
index 833bb7e88..833bb7e88 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
+++ b/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol
diff --git a/contracts/interfaces/package.json b/contracts/interfaces/package.json
new file mode 100644
index 000000000..4d3e4b7f9
--- /dev/null
+++ b/contracts/interfaces/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "@0x/contracts-interfaces",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract interfaces of 0x protocol",
+ "main": "lib/src/index.js",
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "compile": "sol-compiler --contracts-dir contracts",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(IAssetData|IAssetProxy|IAuthorizable|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IValidator|IWallet|IWrapperFunctions).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/tslint-config": "^2.0.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/interfaces/src/artifacts/index.ts b/contracts/interfaces/src/artifacts/index.ts
new file mode 100644
index 000000000..5a2a37d8a
--- /dev/null
+++ b/contracts/interfaces/src/artifacts/index.ts
@@ -0,0 +1,29 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as IAssetData from '../../generated-artifacts/IAssetData.json';
+import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
+import * as IAssetProxyDispatcher from '../../generated-artifacts/IAssetProxyDispatcher.json';
+import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
+import * as IExchange from '../../generated-artifacts/IExchange.json';
+import * as IExchangeCore from '../../generated-artifacts/IExchangeCore.json';
+import * as IMatchOrders from '../../generated-artifacts/IMatchOrders.json';
+import * as ISignatureValidator from '../../generated-artifacts/ISignatureValidator.json';
+import * as ITransactions from '../../generated-artifacts/ITransactions.json';
+import * as IValidator from '../../generated-artifacts/IValidator.json';
+import * as IWallet from '../../generated-artifacts/IWallet.json';
+import * as IWrapperFunctions from '../../generated-artifacts/IWrapperFunctions.json';
+
+export const artifacts = {
+ IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
+ IAuthorizable: IAuthorizable as ContractArtifact,
+ IExchange: IExchange as ContractArtifact,
+ IExchangeCore: IExchangeCore as ContractArtifact,
+ IMatchOrders: IMatchOrders as ContractArtifact,
+ ISignatureValidator: ISignatureValidator as ContractArtifact,
+ ITransactions: ITransactions as ContractArtifact,
+ IWrapperFunctions: IWrapperFunctions as ContractArtifact,
+ IAssetData: IAssetData as ContractArtifact,
+ IAssetProxy: IAssetProxy as ContractArtifact,
+ IValidator: IValidator as ContractArtifact,
+ IWallet: IWallet as ContractArtifact,
+};
diff --git a/contracts/interfaces/src/index.ts b/contracts/interfaces/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/interfaces/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/interfaces/src/wrappers/index.ts b/contracts/interfaces/src/wrappers/index.ts
new file mode 100644
index 000000000..f7f72fada
--- /dev/null
+++ b/contracts/interfaces/src/wrappers/index.ts
@@ -0,0 +1,12 @@
+export * from '../../generated-wrappers/i_asset_data';
+export * from '../../generated-wrappers/i_asset_proxy';
+export * from '../../generated-wrappers/i_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/i_exchange';
+export * from '../../generated-wrappers/i_exchange_core';
+export * from '../../generated-wrappers/i_match_orders';
+export * from '../../generated-wrappers/i_signature_validator';
+export * from '../../generated-wrappers/i_transactions';
+export * from '../../generated-wrappers/i_authorizable';
+export * from '../../generated-wrappers/i_wrapper_functions';
+export * from '../../generated-wrappers/i_validator';
+export * from '../../generated-wrappers/i_wallet';
diff --git a/contracts/interfaces/tsconfig.json b/contracts/interfaces/tsconfig.json
new file mode 100644
index 000000000..90b7d41bb
--- /dev/null
+++ b/contracts/interfaces/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/IAssetData.json",
+ "./generated-artifacts/IAssetProxy.json",
+ "./generated-artifacts/IAuthorizable.json",
+ "./generated-artifacts/IAssetProxyDispatcher.json",
+ "./generated-artifacts/IExchange.json",
+ "./generated-artifacts/IExchangeCore.json",
+ "./generated-artifacts/IMatchOrders.json",
+ "./generated-artifacts/ISignatureValidator.json",
+ "./generated-artifacts/ITransactions.json",
+ "./generated-artifacts/IValidator.json",
+ "./generated-artifacts/IWallet.json",
+ "./generated-artifacts/IWrapperFunctions.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/interfaces/tslint.json b/contracts/interfaces/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/interfaces/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/libs/.solhint.json b/contracts/libs/.solhint.json
deleted file mode 100644
index 076afe9f3..000000000
--- a/contracts/libs/.solhint.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "default",
- "rules": {
- "avoid-low-level-calls": false,
- "avoid-tx-origin": "warn",
- "bracket-align": false,
- "code-complexity": false,
- "const-name-snakecase": "error",
- "expression-indent": "error",
- "function-max-lines": false,
- "func-order": "error",
- "indent": ["error", 4],
- "max-line-length": ["warn", 160],
- "no-inline-assembly": false,
- "quotes": ["error", "double"],
- "separate-by-one-line-in-contract": "error",
- "space-after-comma": "error",
- "statement-indent": "error"
- }
-}
diff --git a/contracts/libs/CHANGELOG.json b/contracts/libs/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/libs/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/libs/CHANGELOG.md b/contracts/libs/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/libs/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/libs/package.json b/contracts/libs/package.json
index 74288be76..fa4b6e523 100644
--- a/contracts/libs/package.json
+++ b/contracts/libs/package.json
@@ -1,7 +1,6 @@
{
- "private": true,
"name": "@0x/contracts-libs",
- "version": "1.0.0",
+ "version": "1.0.2",
"engines": {
"node": ">=6.12"
},
@@ -19,8 +18,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
- "run_mocha":
- "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile": "sol-compiler --contracts-dir contracts",
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
@@ -30,7 +28,7 @@
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
- "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "generated-artifacts/@(LibMath|LibOrder|LibFillResults|LibAbiEncoder|TestLibs|LibEIP712).json"
@@ -45,13 +43,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
- "@0x/contracts-test-utils": "^1.0.0",
- "@0x/abi-gen": "^1.0.17",
- "@0x/dev-utils": "^1.0.19",
- "@0x/sol-compiler": "^1.1.14",
- "@0x/sol-cov": "^2.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -60,29 +58,29 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
"dirty-chai": "^2.0.1",
- "make-promises-safe": "^1.1.0",
"ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
- "solhint": "^1.2.1",
+ "solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/base-contract": "^3.0.8",
- "@0x/order-utils": "^3.0.4",
- "@0x/contracts-multisig": "^1.0.0",
- "@0x/contracts-utils": "^1.0.0",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"
},
diff --git a/contracts/multisig/.solhint.json b/contracts/multisig/.solhint.json
deleted file mode 100644
index 076afe9f3..000000000
--- a/contracts/multisig/.solhint.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "default",
- "rules": {
- "avoid-low-level-calls": false,
- "avoid-tx-origin": "warn",
- "bracket-align": false,
- "code-complexity": false,
- "const-name-snakecase": "error",
- "expression-indent": "error",
- "function-max-lines": false,
- "func-order": "error",
- "indent": ["error", 4],
- "max-line-length": ["warn", 160],
- "no-inline-assembly": false,
- "quotes": ["error", "double"],
- "separate-by-one-line-in-contract": "error",
- "space-after-comma": "error",
- "statement-indent": "error"
- }
-}
diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json
index fe51488c7..19ac770af 100644
--- a/contracts/multisig/CHANGELOG.json
+++ b/contracts/multisig/CHANGELOG.json
@@ -1 +1,11 @@
-[]
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/multisig/CHANGELOG.md b/contracts/multisig/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/multisig/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json
index 37d064fef..b338f67f7 100644
--- a/contracts/multisig/package.json
+++ b/contracts/multisig/package.json
@@ -1,7 +1,6 @@
{
- "private": true,
"name": "@0x/contracts-multisig",
- "version": "1.0.0",
+ "version": "1.0.2",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +28,7 @@
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
- "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "generated-artifacts/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).json"
@@ -42,15 +41,15 @@
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
- "homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md",
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
- "@0x/contracts-test-utils": "^1.0.0",
- "@0x/abi-gen": "^1.0.17",
- "@0x/dev-utils": "^1.0.18",
- "@0x/sol-compiler": "^1.1.13",
- "@0x/sol-cov": "^2.1.13",
- "@0x/subproviders": "^2.1.5",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
"@types/lodash": "4.14.104",
@@ -65,19 +64,19 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
- "solhint": "^1.2.1",
+ "solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/base-contract": "^3.0.7",
- "@0x/order-utils": "^3.0.3",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.5",
- "ethereum-types": "^1.1.2",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/contracts/protocol/CHANGELOG.json b/contracts/protocol/CHANGELOG.json
new file mode 100644
index 000000000..5c3798a69
--- /dev/null
+++ b/contracts/protocol/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "2.1.59",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/protocol/CHANGELOG.md b/contracts/protocol/CHANGELOG.md
new file mode 100644
index 000000000..d90b1b2cc
--- /dev/null
+++ b/contracts/protocol/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v2.1.59 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/core/CHANGELOG.json b/contracts/protocol/DEPLOYS.json
index 7dfa06990..5c24ae59c 100644
--- a/contracts/core/CHANGELOG.json
+++ b/contracts/protocol/DEPLOYS.json
@@ -11,7 +11,7 @@
},
{
"name": "OrderValidator",
- "version": "1.0.1",
+ "version": "1.0.0",
"changes": [
{
"note": "remove `getApproved` check from ERC721 approval query",
@@ -20,35 +20,6 @@
]
},
{
- "name": "Forwarder",
- "version": "1.1.0",
- "changes": [
- {
- "note": "Round up when calculating remaining amounts in marketBuy functions",
- "pr": 1162,
- "networks": {
- "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
- "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
- }
- }
- ]
- },
- {
- "name": "Forwarder",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
- "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
- "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
- }
- }
- ]
- },
- {
"name": "OrderValidator",
"version": "1.0.0",
"changes": [
@@ -117,19 +88,5 @@
}
}
]
- },
- {
- "name": "ZRXToken",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v1 deploy",
- "networks": {
- "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
- "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
- "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
- }
- }
- ]
}
]
diff --git a/contracts/core/README.md b/contracts/protocol/README.md
index 0004925c1..5fc9c0a89 100644
--- a/contracts/core/README.md
+++ b/contracts/protocol/README.md
@@ -8,14 +8,6 @@ Contracts that make up and interact with version 2.0.0 of the protocol can be fo
* [protocol](./contracts/protocol)
* This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
-* [extensions](./contracts/extensions)
- * This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
-* [examples](./contracts/examples)
- * This directory contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
-* [tokens](./contracts/tokens)
- * This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
-* [utils](./contracts/utils)
- * This directory contains libraries and utils that are shared across all of the other directories.
* [test](./contracts/test)
* This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
@@ -50,13 +42,13 @@ yarn install
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
-PKG=@0x/contracts-core yarn build
+PKG=@0x/contracts-protocol yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-core yarn watch
+PKG=@0x/contracts-protocol yarn watch
```
### Clean
diff --git a/contracts/core/compiler.json b/contracts/protocol/compiler.json
index 7e527130a..c05d62aba 100644
--- a/contracts/core/compiler.json
+++ b/contracts/protocol/compiler.json
@@ -20,37 +20,16 @@
},
"contracts": [
"AssetProxyOwner",
- "DummyERC20Token",
- "DummyERC721Receiver",
- "DummyERC721Token",
- "DummyMultipleReturnERC20Token",
- "DummyNoReturnERC20Token",
- "DutchAuction",
"ERC20Proxy",
- "ERC20Token",
- "ERC721Token",
"ERC721Proxy",
"Exchange",
- "ExchangeWrapper",
- "Forwarder",
- "IAssetData",
- "IAssetProxy",
- "InvalidERC721Receiver",
- "IValidator",
- "IWallet",
"MixinAuthorizable",
"MultiAssetProxy",
"OrderValidator",
- "ReentrantERC20Token",
"TestAssetProxyOwner",
"TestAssetProxyDispatcher",
"TestExchangeInternals",
"TestSignatureValidator",
- "TestStaticCallReceiver",
- "Validator",
- "Wallet",
- "WETH9",
- "Whitelist",
- "ZRXToken"
+ "TestStaticCallReceiver"
]
}
diff --git a/contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol
index 258443bca..258443bca 100644
--- a/contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol
index 65b664b8b..65b664b8b 100644
--- a/contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol
index 08f9b94dc..08f9b94dc 100644
--- a/contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol
index 42231e73b..42231e73b 100644
--- a/contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
index d63fb7f6d..fe77048ce 100644
--- a/contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../interfaces/IAuthorizable.sol";
+import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol";
contract MAuthorizable is
diff --git a/contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
index bfc7b5a66..bfc7b5a66 100644
--- a/contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
diff --git a/contracts/core/contracts/protocol/Exchange/Exchange.sol b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol
index 65ca742ea..65ca742ea 100644
--- a/contracts/core/contracts/protocol/Exchange/Exchange.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol
diff --git a/contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
index 02aeb4a13..36ab39b45 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
import "./mixins/MAssetProxyDispatcher.sol";
-import "../AssetProxy/interfaces/IAssetProxy.sol";
+import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol";
contract MixinAssetProxyDispatcher is
diff --git a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol
index 68d6a3897..68d6a3897 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol
diff --git a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol
index fc6d73482..fc6d73482 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol
diff --git a/contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol
index 711535aa8..80b4c0755 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol
@@ -22,8 +22,8 @@ import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
-import "./interfaces/IWallet.sol";
-import "./interfaces/IValidator.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
contract MixinSignatureValidator is
diff --git a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol
index 87c614382..87c614382 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol
diff --git a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol
index 2d43432ff..2d43432ff 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
index 0ddfca270..fe3d03326 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../interfaces/IAssetProxyDispatcher.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol";
contract MAssetProxyDispatcher is
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol
index 099bdcc33..215284900 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "../interfaces/IExchangeCore.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchangeCore.sol";
contract MExchangeCore is
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol
index bb285de03..1eb4be329 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol
@@ -20,7 +20,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "../interfaces/IMatchOrders.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IMatchOrders.sol";
contract MMatchOrders is
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
index 1fe88b908..a933976d1 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../interfaces/ISignatureValidator.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/ISignatureValidator.sol";
contract MSignatureValidator is
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol
index 4f61a4945..a6b0fdc85 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol
@@ -17,7 +17,7 @@
*/
pragma solidity 0.4.24;
-import "../interfaces/ITransactions.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/ITransactions.sol";
contract MTransactions is
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
index 2d21bf057..101e7cb82 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "../interfaces/IWrapperFunctions.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol";
contract MWrapperFunctions is
diff --git a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol b/contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol
index 9e9e63e9b..33dd1326c 100644
--- a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
+++ b/contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol
@@ -19,10 +19,10 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
diff --git a/contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
index ad71fc9a1..ad71fc9a1 100644
--- a/contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
diff --git a/contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
index 52c66cb56..52c66cb56 100644
--- a/contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
+++ b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
diff --git a/contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
index 27187f8f8..27187f8f8 100644
--- a/contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
+++ b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
diff --git a/contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
index ea3e2de59..ea3e2de59 100644
--- a/contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
+++ b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
diff --git a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
index 41aab01c8..d08da7303 100644
--- a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
+++ b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/core/package.json b/contracts/protocol/package.json
index 43fa9370e..838189371 100644
--- a/contracts/core/package.json
+++ b/contracts/protocol/package.json
@@ -1,7 +1,6 @@
{
- "private": true,
- "name": "@0x/contracts-core",
- "version": "2.1.56",
+ "name": "@0x/contracts-protocol",
+ "version": "2.1.59",
"engines": {
"node": ">=6.12"
},
@@ -19,8 +18,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
- "run_mocha":
- "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile": "sol-compiler --contracts-dir contracts",
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
@@ -30,10 +28,10 @@
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
- "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DutchAuction|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiAssetProxy|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json"
+ "abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|OrderValidator|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json"
},
"repository": {
"type": "git",
@@ -43,15 +41,15 @@
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
- "homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md",
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
- "@0x/contracts-test-utils": "^1.0.0",
- "@0x/abi-gen": "^1.0.17",
- "@0x/dev-utils": "^1.0.19",
- "@0x/sol-compiler": "^1.1.14",
- "@0x/sol-cov": "^2.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -60,30 +58,33 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
"dirty-chai": "^2.0.1",
- "make-promises-safe": "^1.1.0",
"ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
- "solhint": "^1.2.1",
+ "solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/base-contract": "^3.0.8",
- "@0x/order-utils": "^3.0.4",
- "@0x/contracts-multisig": "^1.0.0",
- "@0x/contracts-utils": "^1.0.0",
- "@0x/contracts-libs": "^1.0.0",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-examples": "^1.0.2",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"
},
diff --git a/contracts/protocol/src/artifacts/index.ts b/contracts/protocol/src/artifacts/index.ts
new file mode 100644
index 000000000..1d53ceb04
--- /dev/null
+++ b/contracts/protocol/src/artifacts/index.ts
@@ -0,0 +1,29 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
+import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
+import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
+import * as Exchange from '../../generated-artifacts/Exchange.json';
+import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
+import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
+import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
+import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
+import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
+import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
+import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
+import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
+
+export const artifacts = {
+ AssetProxyOwner: AssetProxyOwner as ContractArtifact,
+ ERC20Proxy: ERC20Proxy as ContractArtifact,
+ ERC721Proxy: ERC721Proxy as ContractArtifact,
+ Exchange: Exchange as ContractArtifact,
+ MixinAuthorizable: MixinAuthorizable as ContractArtifact,
+ MultiAssetProxy: MultiAssetProxy as ContractArtifact,
+ OrderValidator: OrderValidator as ContractArtifact,
+ TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
+ TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
+ TestExchangeInternals: TestExchangeInternals as ContractArtifact,
+ TestSignatureValidator: TestSignatureValidator as ContractArtifact,
+ TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
+};
diff --git a/contracts/protocol/src/index.ts b/contracts/protocol/src/index.ts
new file mode 100644
index 000000000..ba813e7ca
--- /dev/null
+++ b/contracts/protocol/src/index.ts
@@ -0,0 +1,3 @@
+export * from './artifacts';
+export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/protocol/src/wrappers/index.ts b/contracts/protocol/src/wrappers/index.ts
new file mode 100644
index 000000000..ac951d269
--- /dev/null
+++ b/contracts/protocol/src/wrappers/index.ts
@@ -0,0 +1,11 @@
+export * from '../../generated-wrappers/asset_proxy_owner';
+export * from '../../generated-wrappers/erc20_proxy';
+export * from '../../generated-wrappers/erc721_proxy';
+export * from '../../generated-wrappers/exchange';
+export * from '../../generated-wrappers/mixin_authorizable';
+export * from '../../generated-wrappers/order_validator';
+export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/test_asset_proxy_owner';
+export * from '../../generated-wrappers/test_exchange_internals';
+export * from '../../generated-wrappers/test_signature_validator';
+export * from '../../generated-wrappers/test_static_call_receiver';
diff --git a/contracts/core/test/asset_proxy/authorizable.ts b/contracts/protocol/test/asset_proxy/authorizable.ts
index 853d18be0..853d18be0 100644
--- a/contracts/core/test/asset_proxy/authorizable.ts
+++ b/contracts/protocol/test/asset_proxy/authorizable.ts
diff --git a/contracts/core/test/asset_proxy/proxies.ts b/contracts/protocol/test/asset_proxy/proxies.ts
index 2527b0fbf..c4bd95905 100644
--- a/contracts/core/test/asset_proxy/proxies.ts
+++ b/contracts/protocol/test/asset_proxy/proxies.ts
@@ -1,3 +1,4 @@
+import { artifacts as interfacesArtifacts, IAssetDataContract, IAssetProxyContract } from '@0x/contracts-interfaces';
import {
chaiSetup,
constants,
@@ -8,6 +9,14 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721ReceiverContract,
+ DummyERC721TokenContract,
+ DummyMultipleReturnERC20TokenContract,
+ DummyNoReturnERC20TokenContract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -15,15 +24,8 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721ReceiverContract } from '../../generated-wrappers/dummy_erc721_receiver';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { DummyMultipleReturnERC20TokenContract } from '../../generated-wrappers/dummy_multiple_return_erc20_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
-import { IAssetDataContract } from '../../generated-wrappers/i_asset_data';
-import { IAssetProxyContract } from '../../generated-wrappers/i_asset_proxy';
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
@@ -33,12 +35,12 @@ chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetProxyInterface = new IAssetProxyContract(
- artifacts.IAssetProxy.compilerOutput.abi,
+ interfacesArtifacts.IAssetProxy.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
const assetDataInterface = new IAssetDataContract(
- artifacts.IAssetData.compilerOutput.abi,
+ interfacesArtifacts.IAssetData.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
@@ -144,7 +146,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_DECIMALS,
);
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
+ tokensArtifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -153,7 +155,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
);
multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyMultipleReturnERC20Token,
+ tokensArtifacts.DummyMultipleReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -194,7 +196,7 @@ describe('Asset Transfer Proxies', () => {
// Deploy and configure ERC721 tokens and receiver
[erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Receiver,
+ tokensArtifacts.DummyERC721Receiver,
provider,
txDefaults,
);
@@ -558,7 +560,7 @@ describe('Asset Transfer Proxies', () => {
erc721Receiver.address,
amount,
);
- const logDecoder = new LogDecoder(web3Wrapper, artifacts);
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
const tx = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
to: erc721Proxy.address,
diff --git a/contracts/core/test/exchange/core.ts b/contracts/protocol/test/exchange/core.ts
index fd6b9ee6b..9b948f991 100644
--- a/contracts/core/test/exchange/core.ts
+++ b/contracts/protocol/test/exchange/core.ts
@@ -1,3 +1,4 @@
+import { artifacts as interfacesArtifacts, IAssetDataContract } from '@0x/contracts-interfaces';
import {
chaiSetup,
constants,
@@ -11,6 +12,14 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC20TokenTransferEventArgs,
+ DummyERC721TokenContract,
+ DummyNoReturnERC20TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
@@ -21,15 +30,10 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import { DummyERC20TokenContract, DummyERC20TokenTransferEventArgs } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated-wrappers/exchange';
-import { IAssetDataContract } from '../../generated-wrappers/i_asset_data';
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
@@ -40,7 +44,7 @@ chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetDataInterface = new IAssetDataContract(
- artifacts.IAssetData.compilerOutput.abi,
+ interfacesArtifacts.IAssetData.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
@@ -116,7 +120,7 @@ describe('Exchange core', () => {
txDefaults,
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
@@ -341,7 +345,7 @@ describe('Exchange core', () => {
describe('Testing exchange of ERC20 tokens with no return values', () => {
before(async () => {
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
+ tokensArtifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/exchange/dispatcher.ts b/contracts/protocol/test/exchange/dispatcher.ts
index 9bc5cbcce..5b1ac1e20 100644
--- a/contracts/core/test/exchange/dispatcher.ts
+++ b/contracts/protocol/test/exchange/dispatcher.ts
@@ -7,6 +7,7 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { AssetProxyId, RevertReason } from '@0x/types';
@@ -15,7 +16,6 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import {
diff --git a/contracts/core/test/exchange/fill_order.ts b/contracts/protocol/test/exchange/fill_order.ts
index 2bdbe4855..2bdbe4855 100644
--- a/contracts/core/test/exchange/fill_order.ts
+++ b/contracts/protocol/test/exchange/fill_order.ts
diff --git a/contracts/core/test/exchange/internal.ts b/contracts/protocol/test/exchange/internal.ts
index 972f5efb6..972f5efb6 100644
--- a/contracts/core/test/exchange/internal.ts
+++ b/contracts/protocol/test/exchange/internal.ts
diff --git a/contracts/core/test/exchange/match_orders.ts b/contracts/protocol/test/exchange/match_orders.ts
index 0e841b359..8e943c237 100644
--- a/contracts/core/test/exchange/match_orders.ts
+++ b/contracts/protocol/test/exchange/match_orders.ts
@@ -9,6 +9,12 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -17,12 +23,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
@@ -139,7 +142,7 @@ describe('matchOrders', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/core/test/extensions/order_validator.ts b/contracts/protocol/test/exchange/order_validator.ts
index 3dbe76f6e..8f53426db 100644
--- a/contracts/core/test/extensions/order_validator.ts
+++ b/contracts/protocol/test/exchange/order_validator.ts
@@ -7,6 +7,7 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { SignedOrder } from '@0x/types';
@@ -14,16 +15,16 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
-import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
-import { artifacts } from '../../src/artifacts';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
+import {
+ artifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+ OrderValidatorContract,
+} from '../../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/core/test/exchange/signature_validator.ts b/contracts/protocol/test/exchange/signature_validator.ts
index b84a488a1..3f1786b5b 100644
--- a/contracts/core/test/exchange/signature_validator.ts
+++ b/contracts/protocol/test/exchange/signature_validator.ts
@@ -1,3 +1,4 @@
+import { artifacts as examplesArtifacts, ValidatorContract, WalletContract } from '@0x/contracts-examples';
import {
addressUtils,
chaiSetup,
@@ -9,6 +10,7 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
@@ -17,13 +19,11 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import {
+ artifacts,
TestSignatureValidatorContract,
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
-} from '../../generated-wrappers/test_signature_validator';
-import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
-import { ValidatorContract } from '../../generated-wrappers/validator';
-import { WalletContract } from '../../generated-wrappers/wallet';
-import { artifacts } from '../../src/artifacts';
+ TestStaticCallReceiverContract,
+} from '../../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -61,13 +61,13 @@ describe('MixinSignatureValidator', () => {
txDefaults,
);
testWallet = await WalletContract.deployFrom0xArtifactAsync(
- artifacts.Wallet,
+ examplesArtifacts.Wallet,
provider,
txDefaults,
signerAddress,
);
testValidator = await ValidatorContract.deployFrom0xArtifactAsync(
- artifacts.Validator,
+ examplesArtifacts.Validator,
provider,
txDefaults,
signerAddress,
@@ -77,7 +77,7 @@ describe('MixinSignatureValidator', () => {
provider,
txDefaults,
);
- signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, artifacts);
+ signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
await web3Wrapper.awaitTransactionSuccessAsync(
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
from: signerAddress,
@@ -135,7 +135,7 @@ describe('MixinSignatureValidator', () => {
it('should revert when signature type is unsupported', async () => {
const unsupportedSignatureType = SignatureType.NSignatureTypes;
- const unsupportedSignatureHex = '0x' + Buffer.from([unsupportedSignatureType]).toString('hex');
+ const unsupportedSignatureHex = `0x${Buffer.from([unsupportedSignatureType]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
return expectContractCallFailedAsync(
signatureValidator.publicIsValidSignature.callAsync(
@@ -148,7 +148,7 @@ describe('MixinSignatureValidator', () => {
});
it('should revert when SignatureType=Illegal', async () => {
- const unsupportedSignatureHex = '0x' + Buffer.from([SignatureType.Illegal]).toString('hex');
+ const unsupportedSignatureHex = `0x${Buffer.from([SignatureType.Illegal]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
return expectContractCallFailedAsync(
signatureValidator.publicIsValidSignature.callAsync(
@@ -161,7 +161,7 @@ describe('MixinSignatureValidator', () => {
});
it('should return false when SignatureType=Invalid and signature has a length of zero', async () => {
- const signatureHex = '0x' + Buffer.from([SignatureType.Invalid]).toString('hex');
+ const signatureHex = `0x${Buffer.from([SignatureType.Invalid]).toString('hex')}`;
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
diff --git a/contracts/core/test/exchange/transactions.ts b/contracts/protocol/test/exchange/transactions.ts
index c4086d9be..746f3cb04 100644
--- a/contracts/core/test/exchange/transactions.ts
+++ b/contracts/protocol/test/exchange/transactions.ts
@@ -1,3 +1,4 @@
+import { artifacts as examplesArtifacts, ExchangeWrapperContract, WhitelistContract } from '@0x/contracts-examples';
import {
chaiSetup,
constants,
@@ -11,6 +12,7 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
@@ -18,11 +20,8 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper';
-import { WhitelistContract } from '../../generated-wrappers/whitelist';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
import { ExchangeWrapper } from '../utils/exchange_wrapper';
@@ -222,7 +221,7 @@ describe('Exchange transactions', () => {
before(async () => {
exchangeWrapperContract = await ExchangeWrapperContract.deployFrom0xArtifactAsync(
- artifacts.ExchangeWrapper,
+ examplesArtifacts.ExchangeWrapper,
provider,
txDefaults,
exchange.address,
@@ -336,7 +335,7 @@ describe('Exchange transactions', () => {
before(async () => {
whitelist = await WhitelistContract.deployFrom0xArtifactAsync(
- artifacts.Whitelist,
+ examplesArtifacts.Whitelist,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/core/test/exchange/wrapper.ts b/contracts/protocol/test/exchange/wrapper.ts
index 17cb7a3bb..c9efb0c9d 100644
--- a/contracts/core/test/exchange/wrapper.ts
+++ b/contracts/protocol/test/exchange/wrapper.ts
@@ -11,6 +11,12 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -19,12 +25,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
import { ERC721Wrapper } from '../utils/erc721_wrapper';
@@ -113,7 +116,7 @@ describe('Exchange wrappers', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/protocol/test/global_hooks.ts b/contracts/protocol/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/protocol/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/core/test/multisig/asset_proxy_owner.ts b/contracts/protocol/test/multisig/asset_proxy_owner.ts
index daebfb7fb..daebfb7fb 100644
--- a/contracts/core/test/multisig/asset_proxy_owner.ts
+++ b/contracts/protocol/test/multisig/asset_proxy_owner.ts
diff --git a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts
index d5aaaf519..df23658d8 100644
--- a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts
+++ b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts
@@ -1,4 +1,5 @@
import { LogDecoder } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -14,7 +15,7 @@ export class AssetProxyOwnerWrapper {
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
this._assetProxyOwner = assetproxyOwnerContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
}
public async submitTransactionAsync(
destination: string,
diff --git a/contracts/core/test/utils/asset_wrapper.ts b/contracts/protocol/test/utils/asset_wrapper.ts
index e4090ad74..e4090ad74 100644
--- a/contracts/core/test/utils/asset_wrapper.ts
+++ b/contracts/protocol/test/utils/asset_wrapper.ts
diff --git a/contracts/core/test/utils/erc20_wrapper.ts b/contracts/protocol/test/utils/erc20_wrapper.ts
index d6210646c..e5ab0e36c 100644
--- a/contracts/core/test/utils/erc20_wrapper.ts
+++ b/contracts/protocol/test/utils/erc20_wrapper.ts
@@ -1,11 +1,11 @@
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-tokens';
import { assetDataUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { artifacts } from '../../src/artifacts';
@@ -38,7 +38,7 @@ export class ERC20Wrapper {
for (let i = 0; i < numberToDeploy; i++) {
this._dummyTokenContracts.push(
await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
+ tokensArtifacts.DummyERC20Token,
this._provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/utils/erc721_wrapper.ts b/contracts/protocol/test/utils/erc721_wrapper.ts
index b5ae34e60..1f658ce86 100644
--- a/contracts/core/test/utils/erc721_wrapper.ts
+++ b/contracts/protocol/test/utils/erc721_wrapper.ts
@@ -1,11 +1,11 @@
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-tokens';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { artifacts } from '../../src/artifacts';
@@ -30,7 +30,7 @@ export class ERC721Wrapper {
for (const i of _.times(constants.NUM_DUMMY_ERC721_TO_DEPLOY)) {
this._dummyTokenContracts.push(
await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
+ tokensArtifacts.DummyERC721Token,
this._provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
index 2a24b880f..cb6dce901 100644
--- a/contracts/core/test/utils/exchange_wrapper.ts
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -6,6 +6,7 @@ import {
orderUtils,
SignedTransaction,
} from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
@@ -21,7 +22,7 @@ export class ExchangeWrapper {
constructor(exchangeContract: ExchangeContract, provider: Provider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
}
public async fillOrderAsync(
signedOrder: SignedOrder,
@@ -228,7 +229,7 @@ export class ExchangeWrapper {
return orderEpoch;
}
public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
- const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
+ const orderInfo = await this._exchange.getOrderInfo.callAsync(signedOrder);
return orderInfo;
}
public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
diff --git a/contracts/core/test/utils/fill_order_combinatorial_utils.ts b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
index 5d0ea07a8..5d0ea07a8 100644
--- a/contracts/core/test/utils/fill_order_combinatorial_utils.ts
+++ b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
diff --git a/contracts/protocol/test/utils/index.ts b/contracts/protocol/test/utils/index.ts
new file mode 100644
index 000000000..75cd88666
--- /dev/null
+++ b/contracts/protocol/test/utils/index.ts
@@ -0,0 +1,3 @@
+export * from './exchange_wrapper';
+export * from './erc20_wrapper';
+export * from './erc721_wrapper';
diff --git a/contracts/core/test/utils/match_order_tester.ts b/contracts/protocol/test/utils/match_order_tester.ts
index 8f574704e..8f574704e 100644
--- a/contracts/core/test/utils/match_order_tester.ts
+++ b/contracts/protocol/test/utils/match_order_tester.ts
diff --git a/contracts/core/test/utils/order_factory_from_scenario.ts b/contracts/protocol/test/utils/order_factory_from_scenario.ts
index 1cc962020..ecb4b2e28 100644
--- a/contracts/core/test/utils/order_factory_from_scenario.ts
+++ b/contracts/protocol/test/utils/order_factory_from_scenario.ts
@@ -8,12 +8,11 @@ import {
OrderScenario,
TakerScenario,
} from '@0x/contracts-test-utils';
+import { DummyERC721TokenContract } from '@0x/contracts-tokens';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { Order } from '@0x/types';
import { BigNumber, errorUtils } from '@0x/utils';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-
const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
const POINT_ONE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(100_000_000_000_000_000);
diff --git a/contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
index 64b7dedbe..64b7dedbe 100644
--- a/contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
+++ b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
diff --git a/contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts
index af959e00e..af959e00e 100644
--- a/contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts
diff --git a/contracts/protocol/tsconfig.json b/contracts/protocol/tsconfig.json
new file mode 100644
index 000000000..989d3ef2b
--- /dev/null
+++ b/contracts/protocol/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/AssetProxyOwner.json",
+ "./generated-artifacts/ERC20Proxy.json",
+ "./generated-artifacts/ERC721Proxy.json",
+ "./generated-artifacts/Exchange.json",
+ "./generated-artifacts/MixinAuthorizable.json",
+ "./generated-artifacts/MultiAssetProxy.json",
+ "./generated-artifacts/OrderValidator.json",
+ "./generated-artifacts/TestAssetProxyDispatcher.json",
+ "./generated-artifacts/TestAssetProxyOwner.json",
+ "./generated-artifacts/TestExchangeInternals.json",
+ "./generated-artifacts/TestSignatureValidator.json",
+ "./generated-artifacts/TestStaticCallReceiver.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/protocol/tslint.json b/contracts/protocol/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/protocol/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json
new file mode 100644
index 000000000..6e4682b7e
--- /dev/null
+++ b/contracts/test-utils/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ }
+]
diff --git a/contracts/test-utils/CHANGELOG.md b/contracts/test-utils/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/test-utils/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json
index 513cfdc10..18ec8f6a8 100644
--- a/contracts/test-utils/package.json
+++ b/contracts/test-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
- "version": "1.0.0",
+ "version": "1.0.2",
"engines": {
"node": ">=6.12"
},
@@ -40,34 +40,34 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen": "^1.0.17",
- "@0x/dev-utils": "^1.0.18",
- "@0x/sol-compiler": "^1.1.13",
- "@0x/subproviders": "^2.1.5",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
+ "@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",
"@types/node": "*",
+ "bn.js": "^4.11.8",
"chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
"dirty-chai": "^2.0.1",
- "make-promises-safe": "^1.1.0",
- "@0x/order-utils": "^3.0.3",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/sol-cov": "^2.1.13",
- "@0x/web3-wrapper": "^3.1.5",
- "@types/js-combinatorics": "^0.5.29",
- "chai-as-promised": "^7.1.0",
- "bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"js-combinatorics": "^0.5.3",
- "lodash": "^4.17.5"
+ "lodash": "^4.17.5",
+ "make-promises-safe": "^1.1.0"
},
"publishConfig": {
"access": "public"
diff --git a/contracts/test-utils/src/assertions.ts b/contracts/test-utils/src/assertions.ts
index 5b1cedfcc..f31651f4d 100644
--- a/contracts/test-utils/src/assertions.ts
+++ b/contracts/test-utils/src/assertions.ts
@@ -23,7 +23,7 @@ export type sendTransactionResult = Promise<TransactionReceipt | TransactionRece
* @returns either the given ganacheError or gethError depending on the backing
* node.
*/
-async function _getGanacheOrGethError(ganacheError: string, gethError: string): Promise<string> {
+async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: string): Promise<string> {
if (_.isUndefined(nodeType)) {
nodeType = await web3Wrapper.getNodeTypeAsync();
}
@@ -38,15 +38,15 @@ async function _getGanacheOrGethError(ganacheError: string, gethError: string):
}
async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError("sender doesn't have enough funds", 'insufficient funds');
+ return _getGanacheOrGethErrorAsync("sender doesn't have enough funds", 'insufficient funds');
}
async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError('revert', 'always failing transaction');
+ return _getGanacheOrGethErrorAsync('revert', 'always failing transaction');
}
async function _getContractCallFailedErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError('revert', 'Contract call failed');
+ return _getGanacheOrGethErrorAsync('revert', 'Contract call failed');
}
/**
@@ -54,7 +54,7 @@ async function _getContractCallFailedErrorMessageAsync(): Promise<string> {
* contract call. The exact error message depends on the backing Ethereum node.
*/
export async function getInvalidOpcodeErrorMessageForCallAsync(): Promise<string> {
- return _getGanacheOrGethError('invalid opcode', 'Contract call failed');
+ return _getGanacheOrGethErrorAsync('invalid opcode', 'Contract call failed');
}
/**
@@ -65,7 +65,7 @@ export async function getInvalidOpcodeErrorMessageForCallAsync(): Promise<string
* @returns the expected error message.
*/
export async function getRevertReasonOrErrorMessageForSendTransactionAsync(reason: RevertReason): Promise<string> {
- return _getGanacheOrGethError(reason, 'always failing transaction');
+ return _getGanacheOrGethErrorAsync(reason, 'always failing transaction');
}
/**
@@ -137,7 +137,7 @@ export async function expectTransactionFailedWithoutReasonAsync(p: sendTransacti
// directly.
txReceiptStatus = result.status;
} else {
- throw new Error('Unexpected result type: ' + typeof result);
+ throw new Error(`Unexpected result type: ${typeof result}`);
}
expect(_.toString(txReceiptStatus)).to.equal(
'0',
diff --git a/contracts/test-utils/src/test_with_reference.ts b/contracts/test-utils/src/test_with_reference.ts
index b80be4a6c..75d15b0aa 100644
--- a/contracts/test-utils/src/test_with_reference.ts
+++ b/contracts/test-utils/src/test_with_reference.ts
@@ -26,7 +26,7 @@ type PromiseResult<T> = Value<T> | ErrorMessage;
// TODO(albrow): This seems like a generic utility function that could exist in
// lodash. We should replace it by a library implementation, or move it to our
// own.
-async function evaluatePromise<T>(promise: Promise<T>): Promise<PromiseResult<T>> {
+async function evaluatePromiseAsync<T>(promise: Promise<T>): Promise<PromiseResult<T>> {
try {
return new Value<T>(await promise);
} catch (e) {
@@ -93,10 +93,10 @@ export async function testWithReferenceFuncAsync(
values: any[],
): Promise<void> {
// Measure correct behaviour
- const expected = await evaluatePromise(referenceFuncAsync(...values));
+ const expected = await evaluatePromiseAsync(referenceFuncAsync(...values));
// Measure actual behaviour
- const actual = await evaluatePromise(testFuncAsync(...values));
+ const actual = await evaluatePromiseAsync(testFuncAsync(...values));
// Compare behaviour
if (expected instanceof ErrorMessage) {
diff --git a/contracts/core/.solhintignore b/contracts/tokens/.solhintignore
index 1e33ec53b..1e33ec53b 100644
--- a/contracts/core/.solhintignore
+++ b/contracts/tokens/.solhintignore
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/tokens/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/CHANGELOG.md b/contracts/tokens/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/tokens/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/tokens/DEPLOYS.json b/contracts/tokens/DEPLOYS.json
new file mode 100644
index 000000000..5ff58c035
--- /dev/null
+++ b/contracts/tokens/DEPLOYS.json
@@ -0,0 +1,16 @@
+[
+ {
+ "name": "ZRXToken",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v1 deploy",
+ "networks": {
+ "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
+ "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
+ "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/README.md b/contracts/tokens/README.md
new file mode 100644
index 000000000..9c4106d41
--- /dev/null
+++ b/contracts/tokens/README.md
@@ -0,0 +1,74 @@
+## Token contracts
+
+Token smart contracts that are used in the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
+
+## Usage
+
+Token contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [tokens](./contracts/tokens)
+ * This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-tokens yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-tokens yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/tokens/compiler.json b/contracts/tokens/compiler.json
new file mode 100644
index 000000000..498c5d826
--- /dev/null
+++ b/contracts/tokens/compiler.json
@@ -0,0 +1,44 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "DummyERC20Token",
+ "DummyMultipleReturnERC20Token",
+ "DummyNoReturnERC20Token",
+ "DummyERC721Receiver",
+ "InvalidERC721Receiver",
+ "DummyERC721Token",
+ "ReentrantERC20Token",
+ "ERC20Token",
+ "IERC20Token",
+ "MintableERC20Token",
+ "UnlimitedAllowanceERC20Token",
+ "ERC721Token",
+ "IERC721Receiver",
+ "IERC721Token",
+ "MintableERC721Token",
+ "IEtherToken",
+ "WETH9",
+ "ERC20Token_v1",
+ "Token_v1",
+ "UnlimitedAllowanceToken_v1",
+ "ZRXToken"
+ ]
+}
diff --git a/contracts/core/contracts/test/DummyERC20Token/DummyERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
index 33028db0c..33028db0c 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
index 733d4437e..733d4437e 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
index e16825a16..e16825a16 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
index 6c8371559..6c8371559 100644
--- a/contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
diff --git a/contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
index 309633bf5..309633bf5 100644
--- a/contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
diff --git a/contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
index 4c978b2df..4c978b2df 100644
--- a/contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
diff --git a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
index 8e077e3e8..d8c65929d 100644
--- a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "../../tokens/ERC20Token/ERC20Token.sol";
-import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
diff --git a/contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
index 725d304df..725d304df 100644
--- a/contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
index 258d47393..258d47393 100644
--- a/contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
index 58bccb5a1..58bccb5a1 100644
--- a/contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
index 2e5bd4348..2e5bd4348 100644
--- a/contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
index 600cee1ab..600cee1ab 100644
--- a/contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
index 8e0e32ab2..8e0e32ab2 100644
--- a/contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
index ac992c80d..ac992c80d 100644
--- a/contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
index bc5cd2cc2..bc5cd2cc2 100644
--- a/contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
diff --git a/contracts/core/contracts/tokens/EtherToken/IEtherToken.sol b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
index 9e2e68766..9e2e68766 100644
--- a/contracts/core/contracts/tokens/EtherToken/IEtherToken.sol
+++ b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
diff --git a/contracts/core/contracts/tokens/EtherToken/WETH9.sol b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
index 17876b86d..17876b86d 100644
--- a/contracts/core/contracts/tokens/EtherToken/WETH9.sol
+++ b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
index 4920c4aac..4920c4aac 100644
--- a/contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
index de619fb7e..de619fb7e 100644
--- a/contracts/core/contracts/tokens/ZRXToken/Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
index bf1b0335a..bf1b0335a 100644
--- a/contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
index 831e1822c..831e1822c 100644
--- a/contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
diff --git a/contracts/tokens/package.json b/contracts/tokens/package.json
new file mode 100644
index 000000000..6f8a366dd
--- /dev/null
+++ b/contracts/tokens/package.json
@@ -0,0 +1,92 @@
+{
+ "name": "@0x/contracts-tokens",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Token contracts used by 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler --contracts-dir contracts",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token|IEtherToken|WETH9|ERC20Token_v1|Token_v1|UnlimitedAllowanceToken_v1|ZRXToken).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/tokens/src/artifacts/index.ts b/contracts/tokens/src/artifacts/index.ts
new file mode 100644
index 000000000..63b808748
--- /dev/null
+++ b/contracts/tokens/src/artifacts/index.ts
@@ -0,0 +1,49 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json';
+import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
+import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
+import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json';
+import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json';
+import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
+import * as ERC20Token_v1 from '../../generated-artifacts/ERC20Token_v1.json';
+import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
+import * as IERC20Token from '../../generated-artifacts/IERC20Token.json';
+import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
+import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
+import * as IEtherToken from '../../generated-artifacts/IEtherToken.json';
+import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
+import * as MintableERC20Token from '../../generated-artifacts/MintableERC20Token.json';
+import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
+import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
+import * as Token_v1 from '../../generated-artifacts/Token_v1.json';
+import * as UnlimitedAllowanceERC20Token from '../../generated-artifacts/UnlimitedAllowanceERC20Token.json';
+import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/UnlimitedAllowanceToken_v1.json';
+import * as WETH9 from '../../generated-artifacts/WETH9.json';
+import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
+
+export const artifacts = {
+ DummyERC20Token: DummyERC20Token as ContractArtifact,
+ DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
+ DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
+ DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
+ InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
+ DummyERC721Token: DummyERC721Token as ContractArtifact,
+ ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
+ ERC20Token: ERC20Token as ContractArtifact,
+ IERC20Token: IERC20Token as ContractArtifact,
+ MintableERC20Token: MintableERC20Token as ContractArtifact,
+ UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
+ ERC721Token: ERC721Token as ContractArtifact,
+ IERC721Receiver: IERC721Receiver as ContractArtifact,
+ IERC721Token: IERC721Token as ContractArtifact,
+ MintableERC721Token: MintableERC721Token as ContractArtifact,
+ IEtherToken: IEtherToken as ContractArtifact,
+ WETH9: WETH9 as ContractArtifact,
+ ERC20Token_v1: ERC20Token_v1 as ContractArtifact,
+ Token_v1: Token_v1 as ContractArtifact,
+ UnlimitedAllowanceToken_v1: UnlimitedAllowanceToken_v1 as ContractArtifact,
+ // Note(albrow): "as any" hack still required here because ZRXToken does not
+ // conform to the v2 artifact type.
+ ZRXToken: (ZRXToken as any) as ContractArtifact,
+};
diff --git a/contracts/tokens/src/index.ts b/contracts/tokens/src/index.ts
new file mode 100644
index 000000000..91dd7e0e3
--- /dev/null
+++ b/contracts/tokens/src/index.ts
@@ -0,0 +1,2 @@
+export * from './wrappers';
+export * from './artifacts';
diff --git a/contracts/tokens/src/wrappers/index.ts b/contracts/tokens/src/wrappers/index.ts
new file mode 100644
index 000000000..98bf26657
--- /dev/null
+++ b/contracts/tokens/src/wrappers/index.ts
@@ -0,0 +1,21 @@
+export * from '../../generated-wrappers/zrx_token';
+export * from '../../generated-wrappers/weth9';
+export * from '../../generated-wrappers/unlimitedallowancetoken_v1';
+export * from '../../generated-wrappers/unlimited_allowance_erc20_token';
+export * from '../../generated-wrappers/token_v1';
+export * from '../../generated-wrappers/reentrant_erc20_token';
+export * from '../../generated-wrappers/mintable_erc721_token';
+export * from '../../generated-wrappers/mintable_erc20_token';
+export * from '../../generated-wrappers/invalid_erc721_receiver';
+export * from '../../generated-wrappers/i_ether_token';
+export * from '../../generated-wrappers/i_erc721_token';
+export * from '../../generated-wrappers/i_erc721_receiver';
+export * from '../../generated-wrappers/i_erc20_token';
+export * from '../../generated-wrappers/erc721_token';
+export * from '../../generated-wrappers/erc20token_v1';
+export * from '../../generated-wrappers/erc20_token';
+export * from '../../generated-wrappers/dummy_no_return_erc20_token';
+export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
+export * from '../../generated-wrappers/dummy_erc721_token';
+export * from '../../generated-wrappers/dummy_erc721_receiver';
+export * from '../../generated-wrappers/dummy_erc20_token';
diff --git a/contracts/core/test/tokens/erc721_token.ts b/contracts/tokens/test/erc721_token.ts
index 3b0a5f001..13332cd35 100644
--- a/contracts/core/test/tokens/erc721_token.ts
+++ b/contracts/tokens/test/erc721_token.ts
@@ -15,15 +15,13 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import {
+ artifacts,
DummyERC721ReceiverContract,
DummyERC721ReceiverTokenReceivedEventArgs,
-} from '../../generated-wrappers/dummy_erc721_receiver';
-import {
DummyERC721TokenContract,
DummyERC721TokenTransferEventArgs,
-} from '../../generated-wrappers/dummy_erc721_token';
-import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
-import { artifacts } from '../../src/artifacts';
+ InvalidERC721ReceiverContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/tokens/test/global_hooks.ts b/contracts/tokens/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/tokens/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/core/test/tokens/unlimited_allowance_token.ts b/contracts/tokens/test/unlimited_allowance_token.ts
index c3e4072c5..6d5a29b23 100644
--- a/contracts/core/test/tokens/unlimited_allowance_token.ts
+++ b/contracts/tokens/test/unlimited_allowance_token.ts
@@ -11,8 +11,7 @@ import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, DummyERC20TokenContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/core/test/tokens/weth9.ts b/contracts/tokens/test/weth9.ts
index 225481904..6a3948e2c 100644
--- a/contracts/core/test/tokens/weth9.ts
+++ b/contracts/tokens/test/weth9.ts
@@ -12,8 +12,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, WETH9Contract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/core/test/tokens/zrx_token.ts b/contracts/tokens/test/zrx_token.ts
index 6bc5e164c..5dc8447f6 100644
--- a/contracts/core/test/tokens/zrx_token.ts
+++ b/contracts/tokens/test/zrx_token.ts
@@ -4,8 +4,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, ZRXTokenContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/tokens/tsconfig.json b/contracts/tokens/tsconfig.json
new file mode 100644
index 000000000..0d5f98cb8
--- /dev/null
+++ b/contracts/tokens/tsconfig.json
@@ -0,0 +1,33 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/DummyERC20Token.json",
+ "./generated-artifacts/DummyMultipleReturnERC20Token.json",
+ "./generated-artifacts/DummyNoReturnERC20Token.json",
+ "./generated-artifacts/DummyERC721Receiver.json",
+ "./generated-artifacts/InvalidERC721Receiver.json",
+ "./generated-artifacts/DummyERC721Token.json",
+ "./generated-artifacts/ReentrantERC20Token.json",
+ "./generated-artifacts/ERC20Token.json",
+ "./generated-artifacts/IERC20Token.json",
+ "./generated-artifacts/MintableERC20Token.json",
+ "./generated-artifacts/UnlimitedAllowanceERC20Token.json",
+ "./generated-artifacts/ERC721Token.json",
+ "./generated-artifacts/IERC721Receiver.json",
+ "./generated-artifacts/IERC721Token.json",
+ "./generated-artifacts/MintableERC721Token.json",
+ "./generated-artifacts/IEtherToken.json",
+ "./generated-artifacts/WETH9.json",
+ "./generated-artifacts/ERC20Token_v1.json",
+ "./generated-artifacts/Token_v1.json",
+ "./generated-artifacts/UnlimitedAllowanceToken_v1.json",
+ "./generated-artifacts/ZRXToken.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/tokens/tslint.json b/contracts/tokens/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/tokens/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/utils/.solhint.json b/contracts/utils/.solhint.json
deleted file mode 100644
index 076afe9f3..000000000
--- a/contracts/utils/.solhint.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "default",
- "rules": {
- "avoid-low-level-calls": false,
- "avoid-tx-origin": "warn",
- "bracket-align": false,
- "code-complexity": false,
- "const-name-snakecase": "error",
- "expression-indent": "error",
- "function-max-lines": false,
- "func-order": "error",
- "indent": ["error", 4],
- "max-line-length": ["warn", 160],
- "no-inline-assembly": false,
- "quotes": ["error", "double"],
- "separate-by-one-line-in-contract": "error",
- "space-after-comma": "error",
- "statement-indent": "error"
- }
-}
diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/utils/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/utils/CHANGELOG.md b/contracts/utils/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/utils/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/utils/package.json b/contracts/utils/package.json
index c0bc8bfcf..a776bdfbb 100644
--- a/contracts/utils/package.json
+++ b/contracts/utils/package.json
@@ -1,7 +1,6 @@
{
- "private": true,
"name": "@0x/contracts-utils",
- "version": "1.0.0",
+ "version": "1.0.2",
"engines": {
"node": ">=6.12"
},
@@ -19,8 +18,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
- "run_mocha":
- "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile": "sol-compiler --contracts-dir contracts",
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
@@ -30,7 +28,7 @@
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
- "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "generated-artifacts/@(IOwnable|Ownable|LibBytes|ReentrancyGuard|SafeMath|TestConstants|TestLibBytes).json"
@@ -45,13 +43,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
"devDependencies": {
- "@0x/contracts-test-utils": "^1.0.0",
- "@0x/abi-gen": "^1.0.17",
- "@0x/dev-utils": "^1.0.19",
- "@0x/sol-compiler": "^1.1.14",
- "@0x/sol-cov": "^2.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -61,26 +59,26 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
"dirty-chai": "^2.0.1",
- "make-promises-safe": "^1.1.0",
"ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
- "solhint": "^1.2.1",
+ "solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/base-contract": "^3.0.8",
- "@0x/order-utils": "^3.0.4",
- "@0x/contracts-multisig": "^1.0.0",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"
},
diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts
index 985a98943..6fb859c67 100644
--- a/contracts/utils/test/lib_bytes.ts
+++ b/contracts/utils/test/lib_bytes.ts
@@ -25,7 +25,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
// BUG: Ideally we would use Buffer.from(memory).toString('hex')
// https://github.com/Microsoft/TypeScript/issues/23155
-const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + ('00' + v.toString(16)).slice(-2), '0x');
+const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + `00${v.toString(16)}`.slice(-2), '0x');
const fromHex = (str: string): Uint8Array => Uint8Array.from(Buffer.from(str.slice(2), 'hex'));
diff --git a/package.json b/package.json
index 81208dcd2..04fbb5e24 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
}
},
"devDependencies": {
- "@0x-lerna-fork/lerna": "3.0.0-beta.25",
+ "@0x-lerna-fork/lerna": "3.0.0-beta.26",
"@0xproject/npm-cli-login": "^0.0.11",
"async-child-process": "^1.1.1",
"bundlewatch": "^0.2.1",
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 4ee1e92be..32351ad82 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "2.0.6",
"changes": [
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 463ff923d..2923fdf03 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.7 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.0.6 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index aa038c302..2960c9e4b 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "2.0.6",
+ "version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -42,11 +42,11 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
+ "@0x/abi-gen-wrappers": "^2.0.2",
"@0x/contract-addresses": "^2.0.0",
- "@0x/dev-utils": "^1.0.19",
- "@0x/migrations": "^2.2.0",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "*",
@@ -72,18 +72,18 @@
"webpack": "^4.20.2"
},
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/base-contract": "^3.0.8",
- "@0x/contract-wrappers": "^4.1.1",
- "@0x/order-utils": "^3.0.4",
- "@0x/order-watcher": "^2.2.6",
- "@0x/subproviders": "^2.1.6",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/order-watcher": "^2.2.8",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/web3-provider-engine": "^14.0.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"web3-provider-engine": "14.0.6"
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index 6905a7537..d46e828f4 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.0.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "2.0.0",
"changes": [
{
diff --git a/packages/abi-gen-wrappers/CHANGELOG.md b/packages/abi-gen-wrappers/CHANGELOG.md
index 30a10d6bd..c13c7a60f 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.md
+++ b/packages/abi-gen-wrappers/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.2 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.1 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.0.0 - _November 28, 2018_
* Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
index e4f103cf7..25ba3a6e0 100644
--- a/packages/abi-gen-wrappers/package.json
+++ b/packages/abi-gen-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
- "version": "2.0.0",
+ "version": "2.0.2",
"engines": {
"node": ">=6.12"
},
@@ -30,19 +30,19 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
- "@0x/abi-gen": "^1.0.17",
+ "@0x/abi-gen": "^1.0.19",
"@0x/abi-gen-templates": "^1.0.1",
- "@0x/tslint-config": "^1.0.10",
- "@0x/types": "^1.3.0",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
- "@0x/base-contract": "^3.0.8"
+ "@0x/base-contract": "^3.0.10"
},
"publishConfig": {
"access": "public"
diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json
index 2b4455bed..253fb124d 100644
--- a/packages/abi-gen/CHANGELOG.json
+++ b/packages/abi-gen/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.18",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1542821676,
"version": "1.0.17",
"changes": [
diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md
index f939199fd..4ca19ad7e 100644
--- a/packages/abi-gen/CHANGELOG.md
+++ b/packages/abi-gen/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.19 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.18 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.17 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index 485e72730..b122c742d 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
- "version": "1.0.17",
+ "version": "1.0.19",
"engines": {
"node": ">=6.12"
},
@@ -31,10 +31,10 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"chalk": "^2.3.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.5",
@@ -45,7 +45,7 @@
"yargs": "^10.0.3"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/glob": "5.0.35",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json
index 2b3fc68a4..3805a044f 100644
--- a/packages/assert/CHANGELOG.json
+++ b/packages/assert/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.20",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1542821676,
"version": "1.0.18",
"changes": [
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md
index 017b1c6ef..ef84c48d4 100644
--- a/packages/assert/CHANGELOG.md
+++ b/packages/assert/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.20 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.19 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.18 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/assert/package.json b/packages/assert/package.json
index 90b07ae76..cec1748cd 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
- "version": "1.0.18",
+ "version": "1.0.20",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
@@ -44,9 +44,9 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/json-schemas": "^2.1.2",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index 4ff83018e..470d9b03b 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -1,11 +1,21 @@
[
{
+ "version": "3.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "3.0.3",
"changes": [
{
"note": "Update SRA order provider to include Dai"
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"timestamp": 1543401373,
diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md
index be3ef67d1..cadb1acf8 100644
--- a/packages/asset-buyer/CHANGELOG.md
+++ b/packages/asset-buyer/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.3 - _December 11, 2018_
+
+ * Update SRA order provider to include Dai
+
## v3.0.2 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index 780b2e3e2..401aec120 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
- "version": "3.0.2",
+ "version": "3.0.4",
"engines": {
"node": ">=6.12"
},
@@ -36,21 +36,21 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/connect": "^3.0.8",
- "@0x/contract-wrappers": "^4.1.1",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/subproviders": "^2.1.6",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/connect": "^3.0.10",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "^4.14.116",
"@types/mocha": "^2.2.42",
"@types/node": "*",
diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json
index e4dff5530..a4cd17d42 100644
--- a/packages/base-contract/CHANGELOG.json
+++ b/packages/base-contract/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "3.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "3.0.8",
"changes": [
diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md
index f61b6c6ce..a8ce346d7 100644
--- a/packages/base-contract/CHANGELOG.md
+++ b/packages/base-contract/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.10 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.9 - _December 11, 2018_
+
+ * Dependencies updated
+
## v3.0.8 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index 2a331b3cb..87d70dd5f 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
- "version": "3.0.8",
+ "version": "3.0.10",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
"make-promises-safe": "^1.1.0",
@@ -40,10 +40,10 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 3abb895a7..e5bde40ae 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "3.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "3.0.8",
"changes": [
diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md
index 1dfc2672d..a5f95b988 100644
--- a/packages/connect/CHANGELOG.md
+++ b/packages/connect/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.10 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.9 - _December 11, 2018_
+
+ * Dependencies updated
+
## v3.0.8 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 2f3d30d84..4985d0410 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
- "version": "3.0.8",
+ "version": "3.0.10",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",
@@ -57,7 +57,7 @@
"websocket": "^1.0.25"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/fetch-mock": "^6.0.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 006a0904d..9475e5a88 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "4.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "4.1.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "4.1.1",
"changes": [
diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md
index ebdcc9638..595fbcc31 100644
--- a/packages/contract-wrappers/CHANGELOG.md
+++ b/packages/contract-wrappers/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v4.1.3 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v4.1.2 - _December 11, 2018_
+
+ * Dependencies updated
+
## v4.1.1 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index e11d1a63e..f3f7301fd 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
- "version": "4.1.1",
+ "version": "4.1.3",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,10 +37,10 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/migrations": "^2.2.0",
- "@0x/subproviders": "^2.1.6",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "*",
@@ -65,18 +65,18 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
- "@0x/assert": "^1.0.18",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
- "@0x/fill-scenarios": "^1.0.14",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/fill-scenarios": "^1.0.16",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
diff --git a/packages/dev-tools-pages/package.json b/packages/dev-tools-pages/package.json
index 4b13beb01..754db3208 100644
--- a/packages/dev-tools-pages/package.json
+++ b/packages/dev-tools-pages/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-tools-pages",
- "version": "0.0.8",
+ "version": "0.0.10",
"engines": {
"node": ">=6.12"
},
@@ -16,7 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
- "@0x/react-shared": "^1.0.23",
+ "@0x/react-shared": "^1.0.25",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"less": "^2.7.2",
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index 417a3c65e..b6cc74ce7 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.21",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.20",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "1.0.19",
"changes": [
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
index 1842c6824..9a55e4e58 100644
--- a/packages/dev-utils/CHANGELOG.md
+++ b/packages/dev-utils/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.21 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.20 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.19 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index a3b5c9090..a3eb4651a 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-utils",
- "version": "1.0.19",
+ "version": "1.0.21",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"make-promises-safe": "^1.1.0",
@@ -41,14 +41,14 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/subproviders": "^2.1.6",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/web3-provider-engine": "^14.0.0",
"chai": "^4.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json
index 9db75ae9f..9a0f2ad49 100644
--- a/packages/ethereum-types/CHANGELOG.json
+++ b/packages/ethereum-types/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.1.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "1.1.2",
"changes": [
{
diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md
index 6ad7b4cc6..1d27757f3 100644
--- a/packages/ethereum-types/CHANGELOG.md
+++ b/packages/ethereum-types/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.3 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.1.2 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json
index 1630344db..69ae64c2b 100644
--- a/packages/ethereum-types/package.json
+++ b/packages/ethereum-types/package.json
@@ -1,6 +1,6 @@
{
"name": "ethereum-types",
- "version": "1.1.2",
+ "version": "1.1.4",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json
index 58ba49509..ca256399a 100644
--- a/packages/fill-scenarios/CHANGELOG.json
+++ b/packages/fill-scenarios/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "1.0.14",
"changes": [
diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md
index aa7df302e..e9b88547d 100644
--- a/packages/fill-scenarios/CHANGELOG.md
+++ b/packages/fill-scenarios/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.15 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.14 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json
index b29eb674c..7a9d21e0a 100644
--- a/packages/fill-scenarios/package.json
+++ b/packages/fill-scenarios/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
- "version": "1.0.14",
+ "version": "1.0.16",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
@@ -28,15 +28,15 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
- "@0x/base-contract": "^3.0.8",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/base-contract": "^3.0.10",
"@0x/contract-artifacts": "^1.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
- "ethereum-types": "^1.1.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/instant/README.md b/packages/instant/README.md
index 2092b45d9..32abf76e0 100644
--- a/packages/instant/README.md
+++ b/packages/instant/README.md
@@ -1,5 +1,11 @@
## @0x/instant
+## Integration
+
+Looking to integrate 0x Instant into your web application or site? Check out the dedicated [instant documentation](https://0xproject.com/wiki#Get-Started-With-Instant) to get started. The documentation covers instant and related topics in depth. For a more "drag and drop" experience, check out our [configurator tool](https://0xproject.com/instant#configure). For on demand developer support, join our [Discord](https://discordapp.com/invite/d3FTX3M).
+
+Check out a live sample integration [here](https://www.rexrelay.com/instant).
+
## Installation
The package is available as a UMD module named `zeroExInstant` at https://instant.0xproject.com/instant.js.
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 9303276b4..0a5e152ca 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/instant",
- "version": "1.0.2",
+ "version": "1.0.4",
"engines": {
"node": ">=6.12"
},
@@ -24,7 +24,10 @@
},
"config": {
"postpublish": {
- "assets": ["packages/instant/umd/instant.js", "packages/instant/umd/instant.js.map"]
+ "assets": [
+ "packages/instant/umd/instant.js",
+ "packages/instant/umd/instant.js.map"
+ ]
}
},
"repository": {
@@ -38,18 +41,18 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/asset-buyer": "^3.0.2",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/subproviders": "^2.1.6",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/assert": "^1.0.20",
+ "@0x/asset-buyer": "^3.0.4",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"bowser": "^1.9.4",
"copy-to-clipboard": "^3.0.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5",
"polished": "^2.2.0",
"react": "^16.5.2",
@@ -62,7 +65,7 @@
"ts-optchain": "^0.1.1"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@static/discharge": "https://github.com/0xProject/discharge.git",
"@types/enzyme": "^3.1.14",
"@types/enzyme-adapter-react-16": "^1.0.3",
diff --git a/packages/instant/src/components/erc20_token_selector.tsx b/packages/instant/src/components/erc20_token_selector.tsx
index f7d5a4fe4..cb8a8c797 100644
--- a/packages/instant/src/components/erc20_token_selector.tsx
+++ b/packages/instant/src/components/erc20_token_selector.tsx
@@ -7,7 +7,6 @@ import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { SearchInput } from './search_input';
-
import { Circle } from './ui/circle';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
@@ -123,10 +122,20 @@ interface TokenSelectorRowIconProps {
token: ERC20Asset;
}
+const getTokenIcon = (symbol: string): React.StatelessComponent | undefined => {
+ try {
+ return require(`../assets/icons/${symbol}.svg`) as React.StatelessComponent;
+ } catch (e) {
+ // Can't find icon
+ return undefined;
+ }
+};
+
const TokenSelectorRowIcon: React.StatelessComponent<TokenSelectorRowIconProps> = props => {
const { token } = props;
const iconUrlIfExists = token.metaData.iconUrl;
- const TokenIcon = require(`../assets/icons/${token.metaData.symbol}.svg`);
+
+ const TokenIcon = getTokenIcon(token.metaData.symbol);
const displaySymbol = assetUtils.bestNameForAsset(token);
if (!_.isUndefined(iconUrlIfExists)) {
return <img src={iconUrlIfExists} />;
diff --git a/packages/instant/src/components/instant_heading.tsx b/packages/instant/src/components/instant_heading.tsx
index 117f9dd5f..5b1f9592d 100644
--- a/packages/instant/src/components/instant_heading.tsx
+++ b/packages/instant/src/components/instant_heading.tsx
@@ -61,12 +61,19 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
}
private _renderAmountsSection(): React.ReactNode {
- return (
- <Container>
- <Container marginBottom="5px">{this._renderPlaceholderOrAmount(this._renderEthAmount)}</Container>
- <Container opacity={0.7}>{this._renderPlaceholderOrAmount(this._renderDollarAmount)}</Container>
- </Container>
- );
+ if (
+ _.isUndefined(this.props.totalEthBaseUnitAmount) &&
+ this.props.quoteRequestState !== AsyncProcessState.Pending
+ ) {
+ return null;
+ } else {
+ return (
+ <Container>
+ <Container marginBottom="5px">{this._renderPlaceholderOrAmount(this._renderEthAmount)}</Container>
+ <Container opacity={0.7}>{this._renderPlaceholderOrAmount(this._renderDollarAmount)}</Container>
+ </Container>
+ );
+ }
}
private _renderIcon(): React.ReactNode {
@@ -106,20 +113,23 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
}
private readonly _renderEthAmount = (): React.ReactNode => {
+ const ethAmount = format.ethBaseUnitAmount(
+ this.props.totalEthBaseUnitAmount,
+ 4,
+ <AmountPlaceholder isPulsating={false} color={PLACEHOLDER_COLOR} />,
+ );
+
+ const fontSize = _.isString(ethAmount) && ethAmount.length >= 13 ? '14px' : '16px';
return (
<Text
- fontSize="16px"
+ fontSize={fontSize}
textAlign="right"
width="100%"
fontColor={ColorOption.white}
fontWeight={500}
noWrap={true}
>
- {format.ethBaseUnitAmount(
- this.props.totalEthBaseUnitAmount,
- 4,
- <AmountPlaceholder isPulsating={false} color={PLACEHOLDER_COLOR} />,
- )}
+ {ethAmount}
</Text>
);
};
diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx
index a8e0e2513..9c10ef9e6 100644
--- a/packages/instant/src/components/order_details.tsx
+++ b/packages/instant/src/components/order_details.tsx
@@ -4,124 +4,227 @@ import * as _ from 'lodash';
import * as React from 'react';
import { oc } from 'ts-optchain';
-import { BIG_NUMBER_ZERO } from '../constants';
+import { BIG_NUMBER_ZERO, DEFAULT_UNKOWN_ASSET_NAME } from '../constants';
import { ColorOption } from '../style/theme';
+import { BaseCurrency } from '../types';
import { format } from '../util/format';
import { AmountPlaceholder } from './amount_placeholder';
+import { SectionHeader } from './section_header';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
-import { Text } from './ui/text';
+import { Text, TextProps } from './ui/text';
export interface OrderDetailsProps {
buyQuoteInfo?: BuyQuoteInfo;
selectedAssetUnitAmount?: BigNumber;
ethUsdPrice?: BigNumber;
isLoading: boolean;
+ assetName?: string;
+ baseCurrency: BaseCurrency;
+ onBaseCurrencySwitchEth: () => void;
+ onBaseCurrencySwitchUsd: () => void;
}
export class OrderDetails extends React.Component<OrderDetailsProps> {
public render(): React.ReactNode {
- const { buyQuoteInfo, ethUsdPrice, selectedAssetUnitAmount } = this.props;
- const buyQuoteAccessor = oc(buyQuoteInfo);
- const assetEthBaseUnitAmount = buyQuoteAccessor.assetEthAmount();
- const feeEthBaseUnitAmount = buyQuoteAccessor.feeEthAmount();
- const totalEthBaseUnitAmount = buyQuoteAccessor.totalEthAmount();
- const pricePerTokenEth =
- !_.isUndefined(assetEthBaseUnitAmount) &&
- !_.isUndefined(selectedAssetUnitAmount) &&
- !selectedAssetUnitAmount.eq(BIG_NUMBER_ZERO)
- ? assetEthBaseUnitAmount.div(selectedAssetUnitAmount).ceil()
- : undefined;
+ const shouldShowUsdError = this.props.baseCurrency === BaseCurrency.USD && this._hadErrorFetchingUsdPrice();
return (
<Container width="100%" flexGrow={1} padding="20px 20px 0px 20px">
- <Container marginBottom="10px">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- Order Details
- </Text>
- </Container>
- <EthAmountRow
- rowLabel="Token Price"
- ethAmount={pricePerTokenEth}
- ethUsdPrice={ethUsdPrice}
- isLoading={this.props.isLoading}
+ <Container marginBottom="10px">{this._renderHeader()}</Container>
+ {shouldShowUsdError ? this._renderErrorFetchingUsdPrice() : this._renderRows()}
+ </Container>
+ );
+ }
+
+ private _renderRows(): React.ReactNode {
+ const { buyQuoteInfo } = this.props;
+ return (
+ <React.Fragment>
+ <OrderDetailsRow
+ labelText={this._assetAmountLabel()}
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.assetEthAmount)}
/>
- <EthAmountRow
- rowLabel="Fee"
- ethAmount={feeEthBaseUnitAmount}
- ethUsdPrice={ethUsdPrice}
- isLoading={this.props.isLoading}
+ <OrderDetailsRow
+ labelText="Fee"
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.feeEthAmount)}
/>
- <EthAmountRow
- rowLabel="Total Cost"
- ethAmount={totalEthBaseUnitAmount}
- ethUsdPrice={ethUsdPrice}
- shouldEmphasize={true}
- isLoading={this.props.isLoading}
+ <OrderDetailsRow
+ labelText="Total Cost"
+ isLabelBold={true}
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.totalEthAmount)}
+ isPrimaryValueBold={true}
+ secondaryValue={this._totalCostSecondaryValue()}
/>
- </Container>
+ </React.Fragment>
);
}
-}
-export interface EthAmountRowProps {
- rowLabel: string;
- ethAmount?: BigNumber;
- isEthAmountInBaseUnits?: boolean;
- ethUsdPrice?: BigNumber;
- shouldEmphasize?: boolean;
- isLoading: boolean;
+ private _renderErrorFetchingUsdPrice(): React.ReactNode {
+ return (
+ <Text>
+ There was an error fetching the USD price.
+ <Text
+ onClick={this.props.onBaseCurrencySwitchEth}
+ fontWeight={700}
+ fontColor={ColorOption.primaryColor}
+ >
+ Click here
+ </Text>
+ {' to view ETH prices'}
+ </Text>
+ );
+ }
+
+ private _hadErrorFetchingUsdPrice(): boolean {
+ return this.props.ethUsdPrice ? this.props.ethUsdPrice.equals(BIG_NUMBER_ZERO) : false;
+ }
+
+ private _totalCostSecondaryValue(): React.ReactNode {
+ const secondaryCurrency = this.props.baseCurrency === BaseCurrency.USD ? BaseCurrency.ETH : BaseCurrency.USD;
+
+ const canDisplayCurrency =
+ secondaryCurrency === BaseCurrency.ETH ||
+ (secondaryCurrency === BaseCurrency.USD && this.props.ethUsdPrice && !this._hadErrorFetchingUsdPrice());
+
+ if (this.props.buyQuoteInfo && canDisplayCurrency) {
+ return this._displayAmount(secondaryCurrency, this.props.buyQuoteInfo.totalEthAmount);
+ } else {
+ return undefined;
+ }
+ }
+
+ private _displayAmountOrPlaceholder(weiAmount?: BigNumber): React.ReactNode {
+ const { baseCurrency, isLoading } = this.props;
+
+ if (_.isUndefined(weiAmount)) {
+ return (
+ <Container opacity={0.5}>
+ <AmountPlaceholder color={ColorOption.lightGrey} isPulsating={isLoading} />
+ </Container>
+ );
+ }
+
+ return this._displayAmount(baseCurrency, weiAmount);
+ }
+
+ private _displayAmount(currency: BaseCurrency, weiAmount: BigNumber): React.ReactNode {
+ switch (currency) {
+ case BaseCurrency.USD:
+ return format.ethBaseUnitAmountInUsd(weiAmount, this.props.ethUsdPrice, 2, '');
+ case BaseCurrency.ETH:
+ return format.ethBaseUnitAmount(weiAmount, 4, '');
+ }
+ }
+
+ private _assetAmountLabel(): React.ReactNode {
+ const { assetName, baseCurrency } = this.props;
+ const numTokens = this.props.selectedAssetUnitAmount;
+
+ // Display as 0 if we have a selected asset
+ const displayNumTokens =
+ assetName && assetName !== DEFAULT_UNKOWN_ASSET_NAME && _.isUndefined(numTokens)
+ ? new BigNumber(0)
+ : numTokens;
+ if (!_.isUndefined(displayNumTokens)) {
+ let numTokensWithSymbol: React.ReactNode = displayNumTokens.toString();
+ if (assetName) {
+ numTokensWithSymbol += ` ${assetName}`;
+ }
+ const pricePerTokenWei = this._pricePerTokenWei();
+ if (pricePerTokenWei) {
+ const atPriceDisplay = (
+ <Text fontColor={ColorOption.lightGrey}>
+ @ {this._displayAmount(baseCurrency, pricePerTokenWei)}
+ </Text>
+ );
+ numTokensWithSymbol = (
+ <React.Fragment>
+ {numTokensWithSymbol} {atPriceDisplay}
+ </React.Fragment>
+ );
+ }
+ return numTokensWithSymbol;
+ }
+ return 'Token Amount';
+ }
+
+ private _pricePerTokenWei(): BigNumber | undefined {
+ const buyQuoteAccessor = oc(this.props.buyQuoteInfo);
+ const assetTotalInWei = buyQuoteAccessor.assetEthAmount();
+ const selectedAssetUnitAmount = this.props.selectedAssetUnitAmount;
+ return !_.isUndefined(assetTotalInWei) &&
+ !_.isUndefined(selectedAssetUnitAmount) &&
+ !selectedAssetUnitAmount.eq(BIG_NUMBER_ZERO)
+ ? assetTotalInWei.div(selectedAssetUnitAmount).ceil()
+ : undefined;
+ }
+
+ private _baseCurrencyChoice(choice: BaseCurrency): React.ReactNode {
+ const onClick =
+ choice === BaseCurrency.ETH ? this.props.onBaseCurrencySwitchEth : this.props.onBaseCurrencySwitchUsd;
+ const isSelected = this.props.baseCurrency === choice;
+
+ const textStyle: TextProps = { onClick, fontSize: '12px' };
+ if (isSelected) {
+ textStyle.fontColor = ColorOption.primaryColor;
+ textStyle.fontWeight = 700;
+ } else {
+ textStyle.fontColor = ColorOption.lightGrey;
+ }
+ return <Text {...textStyle}>{choice}</Text>;
+ }
+
+ private _renderHeader(): React.ReactNode {
+ return (
+ <Flex justify="space-between">
+ <SectionHeader>Order Details</SectionHeader>
+ <Container>
+ {this._baseCurrencyChoice(BaseCurrency.ETH)}
+ <Container marginLeft="5px" marginRight="5px" display="inline">
+ <Text fontSize="12px" fontColor={ColorOption.feintGrey}>
+ /
+ </Text>
+ </Container>
+ {this._baseCurrencyChoice(BaseCurrency.USD)}
+ </Container>
+ </Flex>
+ );
+ }
}
-export class EthAmountRow extends React.Component<EthAmountRowProps> {
- public static defaultProps = {
- shouldEmphasize: false,
- isEthAmountInBaseUnits: true,
- };
+export interface OrderDetailsRowProps {
+ labelText: React.ReactNode;
+ isLabelBold?: boolean;
+ isPrimaryValueBold?: boolean;
+ primaryValue: React.ReactNode;
+ secondaryValue?: React.ReactNode;
+}
+export class OrderDetailsRow extends React.Component<OrderDetailsRowProps, {}> {
public render(): React.ReactNode {
- const { rowLabel, ethAmount, isEthAmountInBaseUnits, shouldEmphasize, isLoading } = this.props;
-
- const fontWeight = shouldEmphasize ? 700 : 400;
- const ethFormatter = isEthAmountInBaseUnits ? format.ethBaseUnitAmount : format.ethUnitAmount;
return (
<Container padding="10px 0px" borderTop="1px dashed" borderColor={ColorOption.feintGrey}>
<Flex justify="space-between">
- <Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {rowLabel}
+ <Text fontWeight={this.props.isLabelBold ? 700 : 400} fontColor={ColorOption.grey}>
+ {this.props.labelText}
</Text>
- <Container>
- {this._renderUsdSection()}
- <Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {ethFormatter(
- ethAmount,
- 4,
- <Container opacity={0.5}>
- <AmountPlaceholder color={ColorOption.lightGrey} isPulsating={isLoading} />
- </Container>,
- )}
- </Text>
- </Container>
+ <Container>{this._renderValues()}</Container>
</Flex>
</Container>
);
}
- private _renderUsdSection(): React.ReactNode {
- const usdFormatter = this.props.isEthAmountInBaseUnits
- ? format.ethBaseUnitAmountInUsd
- : format.ethUnitAmountInUsd;
- const shouldHideUsdPriceSection = _.isUndefined(this.props.ethUsdPrice) || _.isUndefined(this.props.ethAmount);
- return shouldHideUsdPriceSection ? null : (
+
+ private _renderValues(): React.ReactNode {
+ const secondaryValueNode: React.ReactNode = this.props.secondaryValue && (
<Container marginRight="3px" display="inline-block">
- <Text fontColor={ColorOption.lightGrey}>
- ({usdFormatter(this.props.ethAmount, this.props.ethUsdPrice)})
- </Text>
+ <Text fontColor={ColorOption.lightGrey}>({this.props.secondaryValue})</Text>
</Container>
);
+ return (
+ <React.Fragment>
+ {secondaryValueNode}
+ <Text fontWeight={this.props.isPrimaryValueBold ? 700 : 400}>{this.props.primaryValue}</Text>
+ </React.Fragment>
+ );
}
}
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index 7c93f1d1c..abadf4bd6 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -8,6 +8,7 @@ import { envUtil } from '../util/env';
import { CoinbaseWalletLogo } from './coinbase_wallet_logo';
import { MetaMaskLogo } from './meta_mask_logo';
import { PaymentMethodDropdown } from './payment_method_dropdown';
+import { SectionHeader } from './section_header';
import { Circle } from './ui/circle';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
@@ -29,15 +30,7 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
<Container width="100%" height="120px" padding="20px 20px 0px 20px">
<Container marginBottom="12px">
<Flex justify="space-between">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- {this._renderTitleText()}
- </Text>
+ <SectionHeader>{this._renderTitleText()}</SectionHeader>
{this._renderTitleLabel()}
</Flex>
</Container>
diff --git a/packages/instant/src/components/scaling_amount_input.tsx b/packages/instant/src/components/scaling_amount_input.tsx
index 86aca5a65..4feb0502d 100644
--- a/packages/instant/src/components/scaling_amount_input.tsx
+++ b/packages/instant/src/components/scaling_amount_input.tsx
@@ -58,6 +58,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
const { textLengthThreshold, fontColor, maxFontSizePx, onFontSizeChange } = this.props;
return (
<ScalingInput
+ type="number"
maxFontSizePx={maxFontSizePx}
textLengthThreshold={textLengthThreshold}
onFontSizeChange={onFontSizeChange}
diff --git a/packages/instant/src/components/scaling_input.tsx b/packages/instant/src/components/scaling_input.tsx
index 791692257..00aea37da 100644
--- a/packages/instant/src/components/scaling_input.tsx
+++ b/packages/instant/src/components/scaling_input.tsx
@@ -1,3 +1,4 @@
+import { ObjectMap } from '@0x/types';
import * as _ from 'lodash';
import * as React from 'react';
@@ -13,10 +14,15 @@ export enum ScalingInputPhase {
export interface ScalingSettings {
percentageToReduceFontSizePerCharacter: number;
- constantPxToIncreaseWidthPerCharacter: number;
+ // 1ch = the width of the 0 chararacter.
+ // Allow to customize 'char' length for different characters.
+ characterWidthOverrides: ObjectMap<number>;
+ // How much room to leave to the right of the scaling input.
+ additionalInputSpaceInCh: number;
}
export interface ScalingInputProps {
+ type?: string;
textLengthThreshold: number;
maxFontSizePx: number;
value: string;
@@ -31,32 +37,29 @@ export interface ScalingInputProps {
hasAutofocus: boolean;
}
-export interface ScalingInputState {
- inputWidthPxAtPhaseChange?: number;
-}
-
export interface ScalingInputSnapshot {
inputWidthPx: number;
}
// These are magic numbers that were determined experimentally.
const defaultScalingSettings: ScalingSettings = {
- percentageToReduceFontSizePerCharacter: 0.125,
- constantPxToIncreaseWidthPerCharacter: 4,
+ percentageToReduceFontSizePerCharacter: 0.1,
+ characterWidthOverrides: {
+ '1': 0.7,
+ '.': 0.4,
+ },
+ additionalInputSpaceInCh: 0.4,
};
-export class ScalingInput extends React.Component<ScalingInputProps, ScalingInputState> {
+export class ScalingInput extends React.Component<ScalingInputProps> {
public static defaultProps = {
onChange: util.boundNoop,
onFontSizeChange: util.boundNoop,
- maxLength: 7,
+ maxLength: 9,
scalingSettings: defaultScalingSettings,
isDisabled: false,
hasAutofocus: false,
};
- public state: ScalingInputState = {
- inputWidthPxAtPhaseChange: undefined,
- };
private readonly _inputRef = React.createRef<HTMLInputElement>();
public static getPhase(textLengthThreshold: number, value: string): ScalingInputPhase {
if (value.length <= textLengthThreshold) {
@@ -93,36 +96,15 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
scalingSettings.percentageToReduceFontSizePerCharacter,
);
}
- public getSnapshotBeforeUpdate(): ScalingInputSnapshot {
- return {
- inputWidthPx: this._getInputWidthInPx(),
- };
- }
public componentDidMount(): void {
// Trigger an initial notification of the calculated fontSize.
const currentPhase = ScalingInput.getPhaseFromProps(this.props);
const currentFontSize = ScalingInput.calculateFontSizeFromProps(this.props, currentPhase);
this.props.onFontSizeChange(currentFontSize);
}
- public componentDidUpdate(
- prevProps: ScalingInputProps,
- prevState: ScalingInputState,
- snapshot: ScalingInputSnapshot,
- ): void {
+ public componentDidUpdate(prevProps: ScalingInputProps): void {
const prevPhase = ScalingInput.getPhaseFromProps(prevProps);
const curPhase = ScalingInput.getPhaseFromProps(this.props);
- // if we went from fixed to scaling, save the width from the transition
- if (prevPhase !== ScalingInputPhase.ScalingFontSize && curPhase === ScalingInputPhase.ScalingFontSize) {
- this.setState({
- inputWidthPxAtPhaseChange: snapshot.inputWidthPx,
- });
- }
- // if we went from scaling to fixed, revert back to scaling using `ch`
- if (prevPhase === ScalingInputPhase.ScalingFontSize && curPhase !== ScalingInputPhase.ScalingFontSize) {
- this.setState({
- inputWidthPxAtPhaseChange: undefined,
- });
- }
const prevFontSize = ScalingInput.calculateFontSizeFromProps(prevProps, prevPhase);
const curFontSize = ScalingInput.calculateFontSizeFromProps(this.props, curPhase);
// If font size has changed, notify.
@@ -131,13 +113,14 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
}
}
public render(): React.ReactNode {
- const { hasAutofocus, isDisabled, fontColor, onChange, placeholder, value, maxLength } = this.props;
+ const { type, hasAutofocus, isDisabled, fontColor, placeholder, value, maxLength } = this.props;
const phase = ScalingInput.getPhaseFromProps(this.props);
return (
<Input
+ type={type}
ref={this._inputRef as any}
fontColor={fontColor}
- onChange={onChange}
+ onChange={this._handleChange}
value={value}
placeholder={placeholder}
fontSize={`${this._calculateFontSize(phase)}px`}
@@ -149,32 +132,34 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
);
}
private readonly _calculateWidth = (phase: ScalingInputPhase): string => {
- const { value, textLengthThreshold, scalingSettings } = this.props;
+ const { value, scalingSettings } = this.props;
if (_.isEmpty(value)) {
return `${this.props.emptyInputWidthCh}ch`;
}
- switch (phase) {
- case ScalingInputPhase.FixedFontSize:
- return `${value.length}ch`;
- case ScalingInputPhase.ScalingFontSize:
- const { inputWidthPxAtPhaseChange } = this.state;
- if (!_.isUndefined(inputWidthPxAtPhaseChange)) {
- const charactersOverMax = value.length - textLengthThreshold;
- const scalingAmount = scalingSettings.constantPxToIncreaseWidthPerCharacter * charactersOverMax;
- const width = inputWidthPxAtPhaseChange + scalingAmount;
- return `${width}px`;
+ const lengthInCh = _.reduce(
+ value.split(''),
+ (sum, char) => {
+ const widthOverride = scalingSettings.characterWidthOverrides[char];
+ if (!_.isUndefined(widthOverride)) {
+ // tslint is confused
+ // tslint:disable-next-line:restrict-plus-operands
+ return sum + widthOverride;
}
- return `${textLengthThreshold}ch`;
- }
+ return sum + 1;
+ },
+ scalingSettings.additionalInputSpaceInCh,
+ );
+ return `${lengthInCh}ch`;
};
private readonly _calculateFontSize = (phase: ScalingInputPhase): number => {
return ScalingInput.calculateFontSizeFromProps(this.props, phase);
};
- private readonly _getInputWidthInPx = (): number => {
- const ref = this._inputRef.current;
- if (!ref) {
- return 0;
+ private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ const value = event.target.value;
+ const { maxLength } = this.props;
+ if (!_.isUndefined(value) && !_.isUndefined(maxLength) && value.length > maxLength) {
+ return;
}
- return ref.getBoundingClientRect().width;
+ this.props.onChange(event);
};
}
diff --git a/packages/instant/src/components/section_header.tsx b/packages/instant/src/components/section_header.tsx
new file mode 100644
index 000000000..d0974ebdc
--- /dev/null
+++ b/packages/instant/src/components/section_header.tsx
@@ -0,0 +1,20 @@
+import * as React from 'react';
+
+import { ColorOption } from '../style/theme';
+
+import { Text } from './ui/text';
+
+export interface SectionHeaderProps {}
+export const SectionHeader: React.StatelessComponent<SectionHeaderProps> = props => {
+ return (
+ <Text
+ letterSpacing="1px"
+ fontColor={ColorOption.primaryColor}
+ fontWeight={600}
+ textTransform="uppercase"
+ fontSize="12px"
+ >
+ {props.children}
+ </Text>
+ );
+};
diff --git a/packages/instant/src/components/ui/input.tsx b/packages/instant/src/components/ui/input.tsx
index 62c70f9e1..53c43ea0b 100644
--- a/packages/instant/src/components/ui/input.tsx
+++ b/packages/instant/src/components/ui/input.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
-export interface InputProps {
+export interface InputProps extends React.HTMLAttributes<HTMLInputElement> {
tabIndex?: number;
className?: string;
value?: string;
@@ -32,6 +32,10 @@ export const Input =
color: ${props => props.theme[props.fontColor || 'white']} !important;
opacity: 0.5 !important;
}
+ &::-webkit-outer-spin-button, &::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+ }
}
`;
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx
index 7ae27de23..2de327cd7 100644
--- a/packages/instant/src/components/zero_ex_instant_provider.tsx
+++ b/packages/instant/src/components/zero_ex_instant_provider.tsx
@@ -38,6 +38,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
props.orderSource,
networkId,
props.provider,
+ props.walletDisplayName,
);
// merge the additional additionalAssetMetaDataMap with our default map
const completeAssetMetaDataMap = {
@@ -121,6 +122,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
window,
state.selectedAsset,
this.props.affiliateInfo,
+ state.baseCurrency,
),
);
analytics.trackInstantOpened();
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index f83eb4ac7..975dfcbea 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -17,6 +17,7 @@ export const ONE_MINUTE_MS = ONE_SECOND_MS * 60;
export const GIT_SHA = process.env.GIT_SHA;
export const NODE_ENV = process.env.NODE_ENV;
export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
+export const DEFAULT_UNKOWN_ASSET_NAME = '???';
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15;
export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6);
diff --git a/packages/instant/src/containers/connected_account_payment_method.ts b/packages/instant/src/containers/connected_account_payment_method.ts
index bb68fdd57..f648f0b54 100644
--- a/packages/instant/src/containers/connected_account_payment_method.ts
+++ b/packages/instant/src/containers/connected_account_payment_method.ts
@@ -58,7 +58,7 @@ const mergeProps = (
...ownProps,
network: connectedState.network,
account: connectedState.providerState.account,
- walletDisplayName: connectedState.walletDisplayName || connectedState.providerState.name,
+ walletDisplayName: connectedState.providerState.displayName,
onUnlockWalletClick: () => connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState),
onInstallWalletClick: () => {
const isMobile = envUtil.isMobileOperatingSystem();
diff --git a/packages/instant/src/containers/latest_buy_quote_order_details.ts b/packages/instant/src/containers/latest_buy_quote_order_details.ts
index 5dfe535e7..148735c47 100644
--- a/packages/instant/src/containers/latest_buy_quote_order_details.ts
+++ b/packages/instant/src/containers/latest_buy_quote_order_details.ts
@@ -1,32 +1,41 @@
-import { BuyQuoteInfo } from '@0x/asset-buyer';
-import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
import { oc } from 'ts-optchain';
+import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
-import { OrderDetails } from '../components/order_details';
-import { AsyncProcessState } from '../types';
+import { OrderDetails, OrderDetailsProps } from '../components/order_details';
+import { AsyncProcessState, BaseCurrency, Omit } from '../types';
+import { assetUtils } from '../util/asset';
-export interface LatestBuyQuoteOrderDetailsProps {}
-
-interface ConnectedState {
- buyQuoteInfo?: BuyQuoteInfo;
- selectedAssetUnitAmount?: BigNumber;
- ethUsdPrice?: BigNumber;
- isLoading: boolean;
-}
+type DispatchProperties = 'onBaseCurrencySwitchEth' | 'onBaseCurrencySwitchUsd';
+interface ConnectedState extends Omit<OrderDetailsProps, DispatchProperties> {}
const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({
// use the worst case quote info
buyQuoteInfo: oc(state).latestBuyQuote.worstCaseQuoteInfo(),
selectedAssetUnitAmount: state.selectedAssetUnitAmount,
ethUsdPrice: state.ethUsdPrice,
isLoading: state.quoteRequestState === AsyncProcessState.Pending,
+ assetName: assetUtils.bestNameForAsset(state.selectedAsset),
+ baseCurrency: state.baseCurrency,
});
+interface ConnectedDispatch extends Pick<OrderDetailsProps, DispatchProperties> {}
+const mapDispatchToProps = (dispatch: Dispatch<Action>): ConnectedDispatch => ({
+ onBaseCurrencySwitchEth: () => {
+ dispatch(actions.updateBaseCurrency(BaseCurrency.ETH));
+ },
+ onBaseCurrencySwitchUsd: () => {
+ dispatch(actions.updateBaseCurrency(BaseCurrency.USD));
+ },
+});
+
+export interface LatestBuyQuoteOrderDetailsProps {}
export const LatestBuyQuoteOrderDetails: React.ComponentClass<LatestBuyQuoteOrderDetailsProps> = connect(
mapStateToProps,
+ mapDispatchToProps,
)(OrderDetails);
diff --git a/packages/instant/src/redux/actions.ts b/packages/instant/src/redux/actions.ts
index 77e3dec12..9d7a61fc7 100644
--- a/packages/instant/src/redux/actions.ts
+++ b/packages/instant/src/redux/actions.ts
@@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
-import { ActionsUnion, AddressAndEthBalanceInWei, Asset, StandardSlidingPanelContent } from '../types';
+import { ActionsUnion, AddressAndEthBalanceInWei, Asset, BaseCurrency, StandardSlidingPanelContent } from '../types';
export interface PlainAction<T extends string> {
type: T;
@@ -43,6 +43,7 @@ export enum ActionTypes {
RESET_AMOUNT = 'RESET_AMOUNT',
OPEN_STANDARD_SLIDING_PANEL = 'OPEN_STANDARD_SLIDING_PANEL',
CLOSE_STANDARD_SLIDING_PANEL = 'CLOSE_STANDARD_SLIDING_PANEL',
+ UPDATE_BASE_CURRENCY = 'UPDATE_BASE_CURRENCY',
}
export const actions = {
@@ -72,4 +73,5 @@ export const actions = {
openStandardSlidingPanel: (content: StandardSlidingPanelContent) =>
createAction(ActionTypes.OPEN_STANDARD_SLIDING_PANEL, content),
closeStandardSlidingPanel: () => createAction(ActionTypes.CLOSE_STANDARD_SLIDING_PANEL),
+ updateBaseCurrency: (baseCurrency: BaseCurrency) => createAction(ActionTypes.UPDATE_BASE_CURRENCY, baseCurrency),
};
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index 3f7a51707..a86a16b1a 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -99,6 +99,9 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
analytics.trackInstallWalletModalClosed();
}
break;
+ case ActionTypes.UPDATE_BASE_CURRENCY:
+ analytics.trackBaseCurrencyChanged(curState.baseCurrency);
+ analytics.addEventProperties({ baseCurrency: curState.baseCurrency });
}
return nextAction;
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
index c67b222d1..884ab103d 100644
--- a/packages/instant/src/redux/async_data.ts
+++ b/packages/instant/src/redux/async_data.ts
@@ -4,7 +4,7 @@ import * as _ from 'lodash';
import { Dispatch } from 'redux';
import { BIG_NUMBER_ZERO } from '../constants';
-import { AccountState, ERC20Asset, OrderProcessState, ProviderState, QuoteFetchOrigin } from '../types';
+import { AccountState, BaseCurrency, ERC20Asset, OrderProcessState, ProviderState, QuoteFetchOrigin } from '../types';
import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { buyQuoteUpdater } from '../util/buy_quote_updater';
@@ -24,7 +24,9 @@ export const asyncData = {
const errorMessage = 'Error fetching ETH/USD price';
errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
dispatch(actions.updateEthUsdPrice(BIG_NUMBER_ZERO));
+ dispatch(actions.updateBaseCurrency(BaseCurrency.ETH));
errorReporter.report(e);
+ analytics.trackUsdPriceFailed();
}
},
fetchAvailableAssetDatasAndDispatchToStore: async (state: State, dispatch: Dispatch) => {
@@ -97,6 +99,7 @@ export const asyncData = {
if (
!_.isUndefined(selectedAssetUnitAmount) &&
!_.isUndefined(selectedAsset) &&
+ selectedAssetUnitAmount.greaterThan(BIG_NUMBER_ZERO) &&
buyOrderState.processState === OrderProcessState.None &&
selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20
) {
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index a9a407b7d..8c13c9c72 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -14,6 +14,7 @@ import {
Asset,
AssetMetaData,
AsyncProcessState,
+ BaseCurrency,
DisplayStatus,
Network,
OrderProcessState,
@@ -33,6 +34,7 @@ export interface DefaultState {
latestErrorDisplayStatus: DisplayStatus;
quoteRequestState: AsyncProcessState;
standardSlidingPanelSettings: StandardSlidingPanelSettings;
+ baseCurrency: BaseCurrency;
}
// State that is required but needs to be derived from the props
@@ -64,6 +66,7 @@ export const DEFAULT_STATE: DefaultState = {
animationState: 'none',
content: StandardSlidingPanelContent.None,
},
+ baseCurrency: BaseCurrency.USD,
};
export const createReducer = (initialState: State) => {
@@ -243,6 +246,11 @@ export const createReducer = (initialState: State) => {
animationState: 'slidOut',
},
};
+ case ActionTypes.UPDATE_BASE_CURRENCY:
+ return {
+ ...state,
+ baseCurrency: action.data,
+ };
default:
return state;
}
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index e65961e95..e7c920f36 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -26,6 +26,11 @@ export enum QuoteFetchOrigin {
Heartbeat = 'Heartbeat',
}
+export enum BaseCurrency {
+ USD = 'USD',
+ ETH = 'ETH',
+}
+
export interface SimulatedProgress {
startTimeUnix: number;
expectedEndTimeUnix: number;
@@ -102,6 +107,7 @@ export interface AffiliateInfo {
export interface ProviderState {
name: string;
+ displayName: string;
provider: Provider;
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 6da52db16..6c63907dc 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -6,6 +6,7 @@ import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NODE_ENV, NPM_PACKAGE_
import {
AffiliateInfo,
Asset,
+ BaseCurrency,
Network,
OrderProcessState,
OrderSource,
@@ -37,6 +38,7 @@ enum EventNames {
ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested',
ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied',
ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed',
+ BASE_CURRENCY_CHANGED = 'Base Currency - Changed',
PAYMENT_METHOD_DROPDOWN_OPENED = 'Payment Method - Dropdown Opened',
PAYMENT_METHOD_OPENED_ETHERSCAN = 'Payment Method - Opened Etherscan',
PAYMENT_METHOD_COPIED_ADDRESS = 'Payment Method - Copied Address',
@@ -47,6 +49,7 @@ enum EventNames {
BUY_TX_SUBMITTED = 'Buy - Tx Submitted',
BUY_TX_SUCCEEDED = 'Buy - Tx Succeeded',
BUY_TX_FAILED = 'Buy - Tx Failed',
+ USD_PRICE_FETCH_FAILED = 'USD Price - Fetch Failed',
INSTALL_WALLET_CLICKED = 'Install Wallet - Clicked',
INSTALL_WALLET_MODAL_OPENED = 'Install Wallet - Modal - Opened',
INSTALL_WALLET_MODAL_CLICKED_EXPLANATION = 'Install Wallet - Modal - Clicked Explanation',
@@ -106,6 +109,7 @@ export interface AnalyticsEventOptions {
ethAddress?: string;
networkId?: number;
providerName?: string;
+ providerDisplayName?: string;
gitSha?: string;
npmVersion?: string;
instantEnvironment?: string;
@@ -117,6 +121,7 @@ export interface AnalyticsEventOptions {
selectedAssetSymbol?: string;
selectedAssetData?: string;
selectedAssetDecimals?: number;
+ baseCurrency?: string;
}
export enum TokenSelectorClosedVia {
ClickedX = 'Clicked X',
@@ -140,6 +145,7 @@ export const analytics = {
window: Window,
selectedAsset?: Asset,
affiliateInfo?: AffiliateInfo,
+ baseCurrency?: BaseCurrency,
): AnalyticsEventOptions => {
const affiliateAddress = affiliateInfo ? affiliateInfo.feeRecipient : 'none';
const affiliateFeePercent = affiliateInfo ? parseFloat(affiliateInfo.feePercentage.toFixed(4)) : 0;
@@ -149,6 +155,7 @@ export const analytics = {
embeddedUrl: window.location.href,
networkId: network,
providerName: providerState.name,
+ providerDisplayName: providerState.displayName,
gitSha: GIT_SHA,
npmVersion: NPM_PACKAGE_VERSION,
orderSource: orderSourceName,
@@ -157,6 +164,7 @@ export const analytics = {
selectedAssetName: selectedAsset ? selectedAsset.metaData.name : 'none',
selectedAssetData: selectedAsset ? selectedAsset.assetData : 'none',
instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
+ baseCurrency,
};
return eventOptions;
},
@@ -168,6 +176,8 @@ export const analytics = {
trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED),
trackAccountAddressChanged: (address: string) =>
trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }),
+ trackBaseCurrencyChanged: (currencyChangedTo: BaseCurrency) =>
+ trackingEventFnWithPayload(EventNames.BASE_CURRENCY_CHANGED)({ currencyChangedTo }),
trackPaymentMethodDropdownOpened: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_DROPDOWN_OPENED),
trackPaymentMethodOpenedEtherscan: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_OPENED_ETHERSCAN),
trackPaymentMethodCopiedAddress: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_COPIED_ADDRESS),
@@ -228,4 +238,5 @@ export const analytics = {
fetchOrigin,
});
},
+ trackUsdPriceFailed: trackingEventFnWithoutPayload(EventNames.USD_PRICE_FETCH_FAILED),
};
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index 13f84ef74..faaeb7c22 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -2,6 +2,7 @@ import { AssetBuyerError } from '@0x/asset-buyer';
import { AssetProxyId, ObjectMap } from '@0x/types';
import * as _ from 'lodash';
+import { DEFAULT_UNKOWN_ASSET_NAME } from '../constants';
import { assetDataNetworkMapping } from '../data/asset_data_network_mapping';
import { Asset, AssetMetaData, ERC20Asset, Network, ZeroExInstantError } from '../types';
@@ -71,7 +72,7 @@ export const assetUtils = {
}
return metaData;
},
- bestNameForAsset: (asset?: Asset, defaultName: string = '???'): string => {
+ bestNameForAsset: (asset?: Asset, defaultName: string = DEFAULT_UNKOWN_ASSET_NAME): string => {
if (_.isUndefined(asset)) {
return defaultName;
}
diff --git a/packages/instant/src/util/env.ts b/packages/instant/src/util/env.ts
index 4a32f9cb1..0fda0cc0e 100644
--- a/packages/instant/src/util/env.ts
+++ b/packages/instant/src/util/env.ts
@@ -62,4 +62,11 @@ export const envUtil = {
}
return PROVIDER_TYPE_TO_NAME[providerTypeIfExists];
},
+ getProviderDisplayName(provider: Provider): string {
+ const providerTypeIfExists = envUtil.getProviderType(provider);
+ if (_.isUndefined(providerTypeIfExists)) {
+ return 'Wallet';
+ }
+ return PROVIDER_TYPE_TO_NAME[providerTypeIfExists];
+ },
};
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
index e9c432b2f..4adb63e21 100644
--- a/packages/instant/src/util/format.ts
+++ b/packages/instant/src/util/format.ts
@@ -2,7 +2,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
-import { ETH_DECIMALS } from '../constants';
+import { BIG_NUMBER_ZERO, ETH_DECIMALS } from '../constants';
export const format = {
ethBaseUnitAmount: (
@@ -20,24 +20,38 @@ export const format = {
ethUnitAmount?: BigNumber,
decimalPlaces: number = 4,
defaultText: React.ReactNode = '0 ETH',
+ minUnitAmountToDisplay: BigNumber = new BigNumber('0.00001'),
): React.ReactNode => {
if (_.isUndefined(ethUnitAmount)) {
return defaultText;
}
- const roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
- return `${roundedAmount} ETH`;
+ let roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
+
+ if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.greaterThan(BIG_NUMBER_ZERO)) {
+ // Sometimes for small ETH amounts (i.e. 0.000045) the amount rounded to 4 decimalPlaces is 0
+ // If that is the case, show to 1 significant digit
+ roundedAmount = new BigNumber(ethUnitAmount.toPrecision(1));
+ }
+
+ const displayAmount =
+ roundedAmount.greaterThan(BIG_NUMBER_ZERO) && roundedAmount.lessThan(minUnitAmountToDisplay)
+ ? `< ${minUnitAmountToDisplay.toString()}`
+ : roundedAmount.toString();
+
+ return `${displayAmount} ETH`;
},
ethBaseUnitAmountInUsd: (
ethBaseUnitAmount?: BigNumber,
ethUsdPrice?: BigNumber,
decimalPlaces: number = 2,
defaultText: React.ReactNode = '$0.00',
+ minUnitAmountToDisplay: BigNumber = new BigNumber('0.00001'),
): React.ReactNode => {
if (_.isUndefined(ethBaseUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseUnitAmount, ETH_DECIMALS);
- return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces);
+ return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces, minUnitAmountToDisplay);
},
ethUnitAmountInUsd: (
ethUnitAmount?: BigNumber,
@@ -48,7 +62,13 @@ export const format = {
if (_.isUndefined(ethUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
- return `$${ethUnitAmount.mul(ethUsdPrice).toFixed(decimalPlaces)}`;
+ const rawUsdPrice = ethUnitAmount.mul(ethUsdPrice);
+ const roundedUsdPrice = rawUsdPrice.toFixed(decimalPlaces);
+ if (roundedUsdPrice === '0.00' && rawUsdPrice.gt(BIG_NUMBER_ZERO)) {
+ return '<$0.01';
+ } else {
+ return `$${roundedUsdPrice}`;
+ }
},
ethAddress: (address: string): string => {
return `0x${address.slice(2, 7)}…${address.slice(-5)}`;
diff --git a/packages/instant/src/util/provider_state_factory.ts b/packages/instant/src/util/provider_state_factory.ts
index 7c788dff2..bd2d6dad5 100644
--- a/packages/instant/src/util/provider_state_factory.ts
+++ b/packages/instant/src/util/provider_state_factory.ts
@@ -10,27 +10,40 @@ import { assetBuyerFactory } from './asset_buyer_factory';
import { providerFactory } from './provider_factory';
export const providerStateFactory = {
- getInitialProviderState: (orderSource: OrderSource, network: Network, provider?: Provider): ProviderState => {
+ getInitialProviderState: (
+ orderSource: OrderSource,
+ network: Network,
+ provider?: Provider,
+ walletDisplayName?: string,
+ ): ProviderState => {
if (!_.isUndefined(provider)) {
- return providerStateFactory.getInitialProviderStateFromProvider(orderSource, network, provider);
+ return providerStateFactory.getInitialProviderStateFromProvider(
+ orderSource,
+ network,
+ provider,
+ walletDisplayName,
+ );
}
const providerStateFromWindowIfExits = providerStateFactory.getInitialProviderStateFromWindowIfExists(
orderSource,
network,
+ walletDisplayName,
);
if (providerStateFromWindowIfExits) {
return providerStateFromWindowIfExits;
} else {
- return providerStateFactory.getInitialProviderStateFallback(orderSource, network);
+ return providerStateFactory.getInitialProviderStateFallback(orderSource, network, walletDisplayName);
}
},
getInitialProviderStateFromProvider: (
orderSource: OrderSource,
network: Network,
provider: Provider,
+ walletDisplayName?: string,
): ProviderState => {
const providerState: ProviderState = {
name: envUtil.getProviderName(provider),
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(provider),
provider,
web3Wrapper: new Web3Wrapper(provider),
assetBuyer: assetBuyerFactory.getAssetBuyer(provider, orderSource, network),
@@ -38,11 +51,16 @@ export const providerStateFactory = {
};
return providerState;
},
- getInitialProviderStateFromWindowIfExists: (orderSource: OrderSource, network: Network): Maybe<ProviderState> => {
+ getInitialProviderStateFromWindowIfExists: (
+ orderSource: OrderSource,
+ network: Network,
+ walletDisplayName?: string,
+ ): Maybe<ProviderState> => {
const injectedProviderIfExists = providerFactory.getInjectedProviderIfExists();
if (!_.isUndefined(injectedProviderIfExists)) {
const providerState: ProviderState = {
name: envUtil.getProviderName(injectedProviderIfExists),
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(injectedProviderIfExists),
provider: injectedProviderIfExists,
web3Wrapper: new Web3Wrapper(injectedProviderIfExists),
assetBuyer: assetBuyerFactory.getAssetBuyer(injectedProviderIfExists, orderSource, network),
@@ -53,10 +71,15 @@ export const providerStateFactory = {
return undefined;
}
},
- getInitialProviderStateFallback: (orderSource: OrderSource, network: Network): ProviderState => {
+ getInitialProviderStateFallback: (
+ orderSource: OrderSource,
+ network: Network,
+ walletDisplayName?: string,
+ ): ProviderState => {
const provider = providerFactory.getFallbackNoSigningProvider(network);
const providerState: ProviderState = {
name: 'Fallback',
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(provider),
provider,
web3Wrapper: new Web3Wrapper(provider),
assetBuyer: assetBuyerFactory.getAssetBuyer(provider, orderSource, network),
diff --git a/packages/instant/test/util/format.test.ts b/packages/instant/test/util/format.test.ts
index fe0a63e6e..38bf356ec 100644
--- a/packages/instant/test/util/format.test.ts
+++ b/packages/instant/test/util/format.test.ts
@@ -41,6 +41,18 @@ describe('format', () => {
it('converts BigNumber(5.3014059295032) to the string `5.301 ETH`', () => {
expect(format.ethUnitAmount(BIG_NUMBER_IRRATIONAL)).toBe('5.301 ETH');
});
+ it('shows 1 significant digit when rounded amount would be 0', () => {
+ expect(format.ethUnitAmount(new BigNumber(0.00003))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000034))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000035))).toBe('0.00004 ETH');
+ });
+ it('shows < 0.00001 when hits threshold', () => {
+ expect(format.ethUnitAmount(new BigNumber(0.000011))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.00001))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.0000000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0))).toBe('0 ETH');
+ });
it('returns defaultText param when ethUnitAmount is not defined', () => {
const defaultText = 'defaultText';
expect(format.ethUnitAmount(undefined, 4, defaultText)).toBe(defaultText);
@@ -86,6 +98,12 @@ describe('format', () => {
it('correctly formats 5.3014059295032 ETH to usd according to some price', () => {
expect(format.ethUnitAmountInUsd(BIG_NUMBER_IRRATIONAL, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$13.43');
});
+ it('correctly formats amount that is less than 1 cent', () => {
+ expect(format.ethUnitAmountInUsd(new BigNumber(0.000001), BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('<$0.01');
+ });
+ it('correctly formats exactly 1 cent', () => {
+ expect(format.ethUnitAmountInUsd(new BigNumber(0.0039), BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$0.01');
+ });
it('returns defaultText param when ethUnitAmountInUsd or ethUsdPrice is not defined', () => {
const defaultText = 'defaultText';
expect(format.ethUnitAmountInUsd(undefined, undefined, 2, defaultText)).toBe(defaultText);
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index 17cabc473..201190145 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.1.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1542821676,
"version": "2.1.2",
"changes": [
diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md
index 2f39c9596..7e407bdda 100644
--- a/packages/json-schemas/CHANGELOG.md
+++ b/packages/json-schemas/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.3 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.1.2 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index da3231b57..57dd9dc00 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/json-schemas",
- "version": "2.1.2",
+ "version": "2.1.4",
"engines": {
"node": ">=6.12"
},
@@ -39,14 +39,14 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/typescript-typings": "^3.0.6",
"@types/node": "*",
"jsonschema": "^1.2.0",
"lodash.values": "^4.3.0"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
- "@0x/utils": "^2.0.6",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/utils": "^2.0.8",
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index 7622fa5d4..0e9fa4920 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
- "version": "0.0.30",
+ "version": "0.0.32",
"engines": {
"node": ">=6.12"
},
@@ -29,26 +29,26 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
- "@0x/abi-gen": "^1.0.17",
+ "@0x/abi-gen": "^1.0.19",
"@0x/abi-gen-templates": "^1.0.1",
- "@0x/base-contract": "^3.0.8",
- "@0x/sol-cov": "^2.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/tslint-config": "^1.0.10",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"run-s": "^0.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/sol-compiler": "^1.1.14",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index 56705fc1a..e7b18f12b 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.2.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.2.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "2.2.0",
"changes": [
{
diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md
index 3808b2d3d..0b7b9a364 100644
--- a/packages/migrations/CHANGELOG.md
+++ b/packages/migrations/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.2.2 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.2.1 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.2.0 - _November 28, 2018_
* Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way (#1324)
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
index f4dd1f9f9..72ffe67b2 100644
--- a/packages/migrations/package.json
+++ b/packages/migrations/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/migrations",
- "version": "2.2.0",
+ "version": "2.2.2",
"engines": {
"node": ">=6.12"
},
@@ -26,9 +26,9 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/tslint-config": "^1.0.10",
- "@0x/types": "^1.3.0",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
"@types/yargs": "^10.0.0",
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
@@ -39,18 +39,18 @@
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
- "@0x/base-contract": "^3.0.8",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/base-contract": "^3.0.10",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/sol-compiler": "^1.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@ledgerhq/hw-app-eth": "^4.3.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index 9af18a6b7..0483e87c8 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0x/monorepo-scripts",
- "version": "1.0.14",
+ "version": "1.0.15",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts
index 96875d0f9..5ae13b198 100644
--- a/packages/monorepo-scripts/src/test_installation.ts
+++ b/packages/monorepo-scripts/src/test_installation.ts
@@ -98,7 +98,7 @@ async function testInstallPackageAsync(
const lastChangelogVersion = JSON.parse(fs.readFileSync(changelogPath).toString())[0].version;
const packageName = installablePackage.packageJson.name;
utils.log(`Testing ${packageName}@${lastChangelogVersion}`);
- const packageDirName = path.join(...(packageName + '-test').split('/'));
+ const packageDirName = path.join(...`${packageName}-test`.split('/'));
// NOTE(fabio): The `testDirectory` needs to be somewhere **outside** the monorepo root directory.
// Otherwise, it will have access to the hoisted `node_modules` directory and the Typescript missing
// type errors will not be caught.
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index 6c8fd6239..11889b92e 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,33 @@
[
{
+ "version": "3.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.6",
+ "changes": [
+ {
+ "note": "Fix bug in wallet signature type verification",
+ "pr": 1414
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1544482891,
+ "version": "3.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1543401373,
"version": "3.0.4",
"changes": [
diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md
index 5eae590b5..bc8b48767 100644
--- a/packages/order-utils/CHANGELOG.md
+++ b/packages/order-utils/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.7 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.6 - _December 11, 2018_
+
+ * Fix bug in wallet signature type verification (#1414)
+
+## v3.0.5 - _December 10, 2018_
+
+ * Dependencies updated
+
## v3.0.4 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index 50229dafb..400c9b66f 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-utils",
- "version": "3.0.4",
+ "version": "3.0.7",
"engines": {
"node": ">=6.12"
},
@@ -35,8 +35,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
@@ -53,18 +53,18 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
- "@0x/assert": "^1.0.18",
- "@0x/base-contract": "^3.0.8",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
"@0x/contract-artifacts": "^1.1.2",
- "@0x/json-schemas": "^2.1.2",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/node": "*",
"bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts
index 96d90e21a..131144d48 100644
--- a/packages/order-utils/src/signature_utils.ts
+++ b/packages/order-utils/src/signature_utils.ts
@@ -115,7 +115,7 @@ export const signatureUtils = {
assert.isHexString('signature', signature);
assert.isETHAddressHex('signerAddress', signerAddress);
// tslint:disable-next-line:custom-no-magic-numbers
- const signatureWithoutType = signature.slice(-2);
+ const signatureWithoutType = signature.slice(0, -2);
const walletContract = new IWalletContract(artifacts.IWallet.compilerOutput.abi, signerAddress, provider);
const isValid = await walletContract.isValidSignature.callAsync(data, signatureWithoutType);
return isValid;
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts
index a85d4c81a..30fb15a37 100644
--- a/packages/order-utils/test/order_hash_test.ts
+++ b/packages/order-utils/test/order_hash_test.ts
@@ -70,7 +70,7 @@ describe('Order hashing', () => {
});
it('returns true if order hash is correct', () => {
const orderHashLength = 65;
- const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0'));
+ const isValid = orderHashUtils.isValidOrderHash(`0x${Array(orderHashLength).join('0')}`);
expect(isValid).to.be.true();
});
});
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json
index 4e56dc400..c1fd8d4a9 100644
--- a/packages/order-watcher/CHANGELOG.json
+++ b/packages/order-watcher/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.2.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.2.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "2.2.6",
"changes": [
diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md
index 37b4a7438..4e49b4637 100644
--- a/packages/order-watcher/CHANGELOG.md
+++ b/packages/order-watcher/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.2.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.2.7 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.2.6 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index cfaf5d724..16a46294e 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-watcher",
- "version": "2.2.6",
+ "version": "2.2.8",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -33,9 +33,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/migrations": "^2.2.0",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/tslint-config": "^2.0.0",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -57,21 +57,21 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^2.0.0",
- "@0x/assert": "^1.0.18",
- "@0x/base-contract": "^3.0.8",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
- "@0x/contract-wrappers": "^4.1.1",
- "@0x/fill-scenarios": "^1.0.14",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/fill-scenarios": "^1.0.16",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"bintrees": "^1.0.2",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-blockstream": "6.0.0",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
diff --git a/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts b/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts
new file mode 100644
index 000000000..2e84e0ec8
--- /dev/null
+++ b/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts
@@ -0,0 +1,26 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const erc20ApprovalEvents = new Table({
+ name: 'raw.erc20_approval_events',
+ columns: [
+ { name: 'token_address', type: 'varchar(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'owner_address', type: 'varchar(42)' },
+ { name: 'spender_address', type: 'varchar(42)' },
+ { name: 'amount', type: 'numeric' },
+ ],
+});
+
+export class CreateERC20TokenApprovalEvents1544131464368 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.createTable(erc20ApprovalEvents);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(erc20ApprovalEvents);
+ }
+}
diff --git a/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
new file mode 100644
index 000000000..a501ec6d8
--- /dev/null
+++ b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
@@ -0,0 +1,33 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class TokenOrderbookSnapshotAddOrderType1544131658904 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495",
+ ADD PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address DROP NOT NULL,
+ ALTER COLUMN base_asset_address DROP NOT NULL;
+ `,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address SET NOT NULL,
+ ALTER COLUMN base_asset_address SET NOT NULL;
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT token_orderbook_snapshots_pkey,
+ ADD CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495" PRIMARY KEY (observed_timestamp, source, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ }
+}
diff --git a/packages/pipeline/package.json b/packages/pipeline/package.json
index 0539618d4..a40f3d21c 100644
--- a/packages/pipeline/package.json
+++ b/packages/pipeline/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/pipeline",
- "version": "1.0.0",
+ "version": "1.0.2",
"private": true,
"description": "Data pipeline for offline analysis",
"scripts": {
@@ -27,7 +27,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/tslint-config": "^1.0.9",
+ "@0x/tslint-config": "^2.0.0",
"@types/axios": "^0.14.0",
"@types/ramda": "^0.25.38",
"chai": "^4.1.2",
@@ -39,22 +39,23 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/connect": "^3.0.2",
+ "@0x/connect": "^3.0.10",
+ "@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.0.1",
"@0x/contract-wrappers": "^3.0.0",
- "@0x/dev-utils": "^1.0.13",
+ "@0x/dev-utils": "^1.0.21",
"@0x/order-utils": "^2.0.0",
- "@0x/subproviders": "^2.1.0",
- "@0x/types": "^1.2.0",
- "@0x/utils": "^2.0.3",
- "@0x/web3-wrapper": "^3.1.0",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/dockerode": "^2.5.9",
"@types/p-limit": "^2.0.0",
"async-parallel": "^1.2.3",
"axios": "^0.18.0",
+ "bottleneck": "^2.13.2",
"dockerode": "^2.5.7",
- "ethereum-types": "^1.0.6",
- "p-limit": "^2.0.0",
+ "ethereum-types": "^1.1.4",
"pg": "^7.5.0",
"prettier": "^1.15.3",
"ramda": "^0.25.0",
diff --git a/packages/pipeline/src/data_sources/bloxy/index.ts b/packages/pipeline/src/data_sources/bloxy/index.ts
index 31cd5bfd6..94468d25a 100644
--- a/packages/pipeline/src/data_sources/bloxy/index.ts
+++ b/packages/pipeline/src/data_sources/bloxy/index.ts
@@ -116,7 +116,7 @@ export class BloxySource {
},
});
if (isError(resp.data)) {
- throw new Error('Error in Bloxy API response: ' + resp.data.error);
+ throw new Error(`Error in Bloxy API response: ${resp.data.error}`);
}
return resp.data;
}
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts b/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts
new file mode 100644
index 000000000..e0098122f
--- /dev/null
+++ b/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts
@@ -0,0 +1,45 @@
+import {
+ ContractWrappers,
+ ERC20TokenApprovalEventArgs,
+ ERC20TokenEvents,
+ ERC20TokenWrapper,
+} from '@0x/contract-wrappers';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { LogWithDecodedArgs } from 'ethereum-types';
+
+import { GetEventsFunc, getEventsWithPaginationAsync } from './utils';
+
+export class ERC20EventsSource {
+ private readonly _erc20Wrapper: ERC20TokenWrapper;
+ private readonly _tokenAddress: string;
+ constructor(provider: Web3ProviderEngine, networkId: number, tokenAddress: string) {
+ const contractWrappers = new ContractWrappers(provider, { networkId });
+ this._erc20Wrapper = contractWrappers.erc20Token;
+ this._tokenAddress = tokenAddress;
+ }
+
+ public async getApprovalEventsAsync(
+ startBlock: number,
+ endBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>> {
+ return getEventsWithPaginationAsync(
+ this._getApprovalEventsForRangeAsync.bind(this) as GetEventsFunc<ERC20TokenApprovalEventArgs>,
+ startBlock,
+ endBlock,
+ );
+ }
+
+ // Gets all approval events of for a specific sub-range. This getter
+ // function will be called during each step of pagination.
+ private async _getApprovalEventsForRangeAsync(
+ fromBlock: number,
+ toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>> {
+ return this._erc20Wrapper.getLogsAsync<ERC20TokenApprovalEventArgs>(
+ this._tokenAddress,
+ ERC20TokenEvents.Approval,
+ { fromBlock, toBlock },
+ {},
+ );
+ }
+}
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts b/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts
index 1717eb8b3..58691e2ab 100644
--- a/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts
+++ b/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts
@@ -8,78 +8,52 @@ import {
ExchangeWrapper,
} from '@0x/contract-wrappers';
import { Web3ProviderEngine } from '@0x/subproviders';
-import { Web3Wrapper } from '@0x/web3-wrapper';
import { LogWithDecodedArgs } from 'ethereum-types';
-import { EXCHANGE_START_BLOCK } from '../../utils';
-
-const BLOCK_FINALITY_THRESHOLD = 10; // When to consider blocks as final. Used to compute default toBlock.
-const NUM_BLOCKS_PER_QUERY = 20000; // Number of blocks to query for events at a time.
+import { GetEventsFunc, getEventsWithPaginationAsync } from './utils';
export class ExchangeEventsSource {
private readonly _exchangeWrapper: ExchangeWrapper;
- private readonly _web3Wrapper: Web3Wrapper;
constructor(provider: Web3ProviderEngine, networkId: number) {
- this._web3Wrapper = new Web3Wrapper(provider);
const contractWrappers = new ContractWrappers(provider, { networkId });
this._exchangeWrapper = contractWrappers.exchange;
}
public async getFillEventsAsync(
- fromBlock?: number,
- toBlock?: number,
+ startBlock: number,
+ endBlock: number,
): Promise<Array<LogWithDecodedArgs<ExchangeFillEventArgs>>> {
- return this._getEventsAsync<ExchangeFillEventArgs>(ExchangeEvents.Fill, fromBlock, toBlock);
+ const getFillEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeFillEventArgs>(ExchangeEvents.Fill);
+ return getEventsWithPaginationAsync(getFillEventsForRangeAsync, startBlock, endBlock);
}
public async getCancelEventsAsync(
- fromBlock?: number,
- toBlock?: number,
+ startBlock: number,
+ endBlock: number,
): Promise<Array<LogWithDecodedArgs<ExchangeCancelEventArgs>>> {
- return this._getEventsAsync<ExchangeCancelEventArgs>(ExchangeEvents.Cancel, fromBlock, toBlock);
+ const getCancelEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeCancelEventArgs>(
+ ExchangeEvents.Cancel,
+ );
+ return getEventsWithPaginationAsync(getCancelEventsForRangeAsync, startBlock, endBlock);
}
public async getCancelUpToEventsAsync(
- fromBlock?: number,
- toBlock?: number,
+ startBlock: number,
+ endBlock: number,
): Promise<Array<LogWithDecodedArgs<ExchangeCancelUpToEventArgs>>> {
- return this._getEventsAsync<ExchangeCancelUpToEventArgs>(ExchangeEvents.CancelUpTo, fromBlock, toBlock);
- }
-
- private async _getEventsAsync<ArgsType extends ExchangeEventArgs>(
- eventName: ExchangeEvents,
- fromBlock: number = EXCHANGE_START_BLOCK,
- toBlock?: number,
- ): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
- const calculatedToBlock =
- toBlock === undefined
- ? (await this._web3Wrapper.getBlockNumberAsync()) - BLOCK_FINALITY_THRESHOLD
- : toBlock;
- let events: Array<LogWithDecodedArgs<ArgsType>> = [];
- for (let currFromBlock = fromBlock; currFromBlock <= calculatedToBlock; currFromBlock += NUM_BLOCKS_PER_QUERY) {
- events = events.concat(
- await this._getEventsForRangeAsync<ArgsType>(
- eventName,
- currFromBlock,
- Math.min(currFromBlock + NUM_BLOCKS_PER_QUERY - 1, calculatedToBlock),
- ),
- );
- }
- return events;
+ const getCancelUpToEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeCancelUpToEventArgs>(
+ ExchangeEvents.CancelUpTo,
+ );
+ return getEventsWithPaginationAsync(getCancelUpToEventsForRangeAsync, startBlock, endBlock);
}
- private async _getEventsForRangeAsync<ArgsType extends ExchangeEventArgs>(
- eventName: ExchangeEvents,
- fromBlock: number,
- toBlock: number,
- ): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
- return this._exchangeWrapper.getLogsAsync<ArgsType>(
- eventName,
- {
- fromBlock,
- toBlock,
- },
- {},
- );
+ // Returns a getter function which gets all events of a specific type for a
+ // specific sub-range. This getter function will be called during each step
+ // of pagination.
+ private _makeGetterFuncForEventType<ArgsType extends ExchangeEventArgs>(
+ eventType: ExchangeEvents,
+ ): GetEventsFunc<ArgsType> {
+ return async (fromBlock: number, toBlock: number) =>
+ this._exchangeWrapper.getLogsAsync<ArgsType>(eventType, { fromBlock, toBlock }, {});
}
}
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/utils.ts b/packages/pipeline/src/data_sources/contract-wrappers/utils.ts
new file mode 100644
index 000000000..67660a37e
--- /dev/null
+++ b/packages/pipeline/src/data_sources/contract-wrappers/utils.ts
@@ -0,0 +1,67 @@
+import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types';
+
+const NUM_BLOCKS_PER_QUERY = 10000; // Number of blocks to query for events at a time.
+const NUM_RETRIES = 3; // Number of retries if a request fails or times out.
+
+export type GetEventsFunc<ArgsType extends DecodedLogArgs> = (
+ fromBlock: number,
+ toBlock: number,
+) => Promise<Array<LogWithDecodedArgs<ArgsType>>>;
+
+/**
+ * Gets all events between the given startBlock and endBlock by querying for
+ * NUM_BLOCKS_PER_QUERY at a time. Accepts a getter function in order to
+ * maximize code re-use and allow for getting different types of events for
+ * different contracts. If the getter function throws with a retryable error,
+ * it will automatically be retried up to NUM_RETRIES times.
+ * @param getEventsAsync A getter function which will be called for each step during pagination.
+ * @param startBlock The start of the entire block range to get events for.
+ * @param endBlock The end of the entire block range to get events for.
+ */
+export async function getEventsWithPaginationAsync<ArgsType extends DecodedLogArgs>(
+ getEventsAsync: GetEventsFunc<ArgsType>,
+ startBlock: number,
+ endBlock: number,
+): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
+ let events: Array<LogWithDecodedArgs<ArgsType>> = [];
+ for (let fromBlock = startBlock; fromBlock <= endBlock; fromBlock += NUM_BLOCKS_PER_QUERY) {
+ const toBlock = Math.min(fromBlock + NUM_BLOCKS_PER_QUERY - 1, endBlock);
+ const eventsInRange = await _getEventsWithRetriesAsync(getEventsAsync, NUM_RETRIES, fromBlock, toBlock);
+ events = events.concat(eventsInRange);
+ }
+ return events;
+}
+
+/**
+ * Calls the getEventsAsync function and retries up to numRetries times if it
+ * throws with an error that is considered retryable.
+ * @param getEventsAsync a function that will be called on each iteration.
+ * @param numRetries the maximum number times to retry getEventsAsync if it fails with a retryable error.
+ * @param fromBlock the start of the sub-range of blocks we are getting events for.
+ * @param toBlock the end of the sub-range of blocks we are getting events for.
+ */
+export async function _getEventsWithRetriesAsync<ArgsType extends DecodedLogArgs>(
+ getEventsAsync: GetEventsFunc<ArgsType>,
+ numRetries: number,
+ fromBlock: number,
+ toBlock: number,
+): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
+ let eventsInRange: Array<LogWithDecodedArgs<ArgsType>> = [];
+ for (let i = 0; i <= numRetries; i++) {
+ try {
+ eventsInRange = await getEventsAsync(fromBlock, toBlock);
+ } catch (err) {
+ if (isErrorRetryable(err) && i < numRetries) {
+ continue;
+ } else {
+ throw err;
+ }
+ }
+ break;
+ }
+ return eventsInRange;
+}
+
+function isErrorRetryable(err: Error): boolean {
+ return err.message.includes('network timeout');
+}
diff --git a/packages/pipeline/src/data_sources/idex/index.ts b/packages/pipeline/src/data_sources/idex/index.ts
new file mode 100644
index 000000000..c1e53c08d
--- /dev/null
+++ b/packages/pipeline/src/data_sources/idex/index.ts
@@ -0,0 +1,82 @@
+import { fetchAsync } from '@0x/utils';
+
+const IDEX_BASE_URL = 'https://api.idex.market';
+const MARKETS_URL = `${IDEX_BASE_URL}/returnTicker`;
+const ORDERBOOK_URL = `${IDEX_BASE_URL}/returnOrderBook`;
+const MAX_ORDER_COUNT = 100; // Maximum based on https://github.com/AuroraDAO/idex-api-docs#returnorderbook
+export const IDEX_SOURCE = 'idex';
+
+export interface IdexMarketsResponse {
+ [marketName: string]: IdexMarket;
+}
+
+export interface IdexMarket {
+ last: string;
+ high: string;
+ low: string;
+ lowestAsk: string;
+ highestBid: string;
+ percentChange: string;
+ baseVolume: string;
+ quoteVolume: string;
+}
+
+export interface IdexOrderbook {
+ asks: IdexOrder[];
+ bids: IdexOrder[];
+}
+
+export interface IdexOrder {
+ price: string;
+ amount: string;
+ total: string;
+ orderHash: string;
+ params: IdexOrderParam;
+}
+
+export interface IdexOrderParam {
+ tokenBuy: string;
+ buySymbol: string;
+ buyPrecision: number;
+ amountBuy: string;
+ tokenSell: string;
+ sellSymbol: string;
+ sellPrecision: number;
+ amountSell: string;
+ expires: number;
+ nonce: number;
+ user: string;
+}
+
+// tslint:disable:prefer-function-over-method
+// ^ Keep consistency with other sources and help logical organization
+export class IdexSource {
+ /**
+ * Call Idex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getMarketsAsync(): Promise<string[]> {
+ const params = { method: 'POST' };
+ const resp = await fetchAsync(MARKETS_URL, params);
+ const respJson: IdexMarketsResponse = await resp.json();
+ const markets: string[] = Object.keys(respJson);
+ return markets;
+ }
+
+ /**
+ * Retrieve orderbook from Idex API for a given market.
+ * @param marketId String identifying the market we want data for. Eg. 'REP_AUG'
+ */
+ public async getMarketOrderbookAsync(marketId: string): Promise<IdexOrderbook> {
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ market: marketId,
+ count: MAX_ORDER_COUNT,
+ }),
+ };
+ const resp = await fetchAsync(ORDERBOOK_URL, params);
+ const respJson: IdexOrderbook = await resp.json();
+ return respJson;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/oasis/index.ts b/packages/pipeline/src/data_sources/oasis/index.ts
new file mode 100644
index 000000000..3b30e9dfd
--- /dev/null
+++ b/packages/pipeline/src/data_sources/oasis/index.ts
@@ -0,0 +1,103 @@
+import { fetchAsync } from '@0x/utils';
+
+const OASIS_BASE_URL = 'https://data.makerdao.com/v1';
+const OASIS_MARKET_QUERY = `query {
+ oasisMarkets(period: "1 week") {
+ nodes {
+ id
+ base
+ quote
+ buyVol
+ sellVol
+ price
+ high
+ low
+ }
+ }
+}`;
+const OASIS_ORDERBOOK_QUERY = `query ($market: String!) {
+ allOasisOrders(condition: { market: $market }) {
+ totalCount
+ nodes {
+ market
+ offerId
+ price
+ amount
+ act
+ }
+ }
+}`;
+export const OASIS_SOURCE = 'oasis';
+
+export interface OasisMarket {
+ id: string; // market symbol e.g MKRDAI
+ base: string; // base symbol e.g MKR
+ quote: string; // quote symbol e.g DAI
+ buyVol: number; // total buy volume (base)
+ sellVol: number; // total sell volume (base)
+ price: number; // volume weighted price (quote)
+ high: number; // max sell price
+ low: number; // min buy price
+}
+
+export interface OasisMarketResponse {
+ data: {
+ oasisMarkets: {
+ nodes: OasisMarket[];
+ };
+ };
+}
+
+export interface OasisOrder {
+ offerId: number; // Offer Id
+ market: string; // Market symbol (base/quote)
+ price: string; // Offer price (quote)
+ amount: string; // Offer amount (base)
+ act: string; // Action (ask|bid)
+}
+
+export interface OasisOrderbookResponse {
+ data: {
+ allOasisOrders: {
+ totalCount: number;
+ nodes: OasisOrder[];
+ };
+ };
+}
+
+// tslint:disable:prefer-function-over-method
+// ^ Keep consistency with other sources and help logical organization
+export class OasisSource {
+ /**
+ * Call Ddex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getActiveMarketsAsync(): Promise<OasisMarket[]> {
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ query: OASIS_MARKET_QUERY }),
+ };
+ const resp = await fetchAsync(OASIS_BASE_URL, params);
+ const respJson: OasisMarketResponse = await resp.json();
+ const markets = respJson.data.oasisMarkets.nodes;
+ return markets;
+ }
+
+ /**
+ * Retrieve orderbook from Oasis API for a given market.
+ * @param marketId String identifying the market we want data for. Eg. 'REPAUG'.
+ */
+ public async getMarketOrderbookAsync(marketId: string): Promise<OasisOrder[]> {
+ const input = {
+ market: marketId,
+ };
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ query: OASIS_ORDERBOOK_QUERY, variables: input }),
+ };
+ const resp = await fetchAsync(OASIS_BASE_URL, params);
+ const respJson: OasisOrderbookResponse = await resp.json();
+ return respJson.data.allOasisOrders.nodes;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts b/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts
index 8804c34d0..85042501b 100644
--- a/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts
+++ b/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts
@@ -1,6 +1,6 @@
// tslint:disable:no-duplicate-imports
import { fetchAsync } from '@0x/utils';
-import promiseLimit = require('p-limit');
+import Bottleneck from 'bottleneck';
import { stringify } from 'querystring';
import * as R from 'ramda';
@@ -33,43 +33,41 @@ export interface CryptoCompareOHLCVParams {
toTs?: number;
}
-const ONE_WEEK = 7 * 24 * 60 * 60 * 1000; // tslint:disable-line:custom-no-magic-numbers
const ONE_HOUR = 60 * 60 * 1000; // tslint:disable-line:custom-no-magic-numbers
const ONE_SECOND = 1000;
const ONE_HOUR_AGO = new Date().getTime() - ONE_HOUR;
const HTTP_OK_STATUS = 200;
const CRYPTO_COMPARE_VALID_EMPTY_RESPONSE_TYPE = 96;
+const MAX_PAGE_SIZE = 2000;
export class CryptoCompareOHLCVSource {
- public readonly interval = ONE_WEEK; // the hourly API returns data for one week at a time
- public readonly default_exchange = 'CCCAGG';
public readonly intervalBetweenRecords = ONE_HOUR;
+ public readonly defaultExchange = 'CCCAGG';
+ public readonly interval = this.intervalBetweenRecords * MAX_PAGE_SIZE; // the hourly API returns data for one interval at a time
private readonly _url: string = 'https://min-api.cryptocompare.com/data/histohour?';
// rate-limit for all API calls through this class instance
- private readonly _promiseLimit: (fetchFn: () => Promise<Response>) => Promise<Response>;
- constructor(maxConcurrentRequests: number = 50) {
- this._promiseLimit = promiseLimit(maxConcurrentRequests);
+ private readonly _limiter: Bottleneck;
+ constructor(maxReqsPerSecond: number) {
+ this._limiter = new Bottleneck({
+ minTime: ONE_SECOND / maxReqsPerSecond,
+ reservoir: 30,
+ reservoirRefreshAmount: 30,
+ reservoirRefreshInterval: ONE_SECOND,
+ });
}
// gets OHLCV records starting from pair.latest
public async getHourlyOHLCVAsync(pair: TradingPair): Promise<CryptoCompareOHLCVRecord[]> {
const params = {
- e: this.default_exchange,
+ e: this.defaultExchange,
fsym: pair.fromSymbol,
tsym: pair.toSymbol,
+ limit: MAX_PAGE_SIZE,
toTs: Math.floor((pair.latestSavedTime + this.interval) / ONE_SECOND), // CryptoCompare uses timestamp in seconds. not ms
};
const url = this._url + stringify(params);
-
- // go through the instance-wide rate-limit
- const fetchPromise: Promise<Response> = this._promiseLimit(() => {
- // tslint:disable-next-line:no-console
- console.log(`Scraping Crypto Compare at ${url}`);
- return fetchAsync(url);
- });
-
- const response = await Promise.resolve(fetchPromise);
+ const response = await this._limiter.schedule(() => fetchAsync(url));
if (response.status !== HTTP_OK_STATUS) {
throw new Error(`HTTP error while scraping Crypto Compare: [${response}]`);
}
diff --git a/packages/pipeline/src/data_sources/paradex/index.ts b/packages/pipeline/src/data_sources/paradex/index.ts
index 69a03d553..46d448f4b 100644
--- a/packages/pipeline/src/data_sources/paradex/index.ts
+++ b/packages/pipeline/src/data_sources/paradex/index.ts
@@ -1,9 +1,9 @@
import { fetchAsync, logUtils } from '@0x/utils';
const PARADEX_BASE_URL = 'https://api.paradex.io/consumer/v0';
-const ACTIVE_MARKETS_URL = PARADEX_BASE_URL + '/markets';
-const ORDERBOOK_ENDPOINT = PARADEX_BASE_URL + '/orderbook';
-const TOKEN_INFO_ENDPOINT = PARADEX_BASE_URL + '/tokens';
+const ACTIVE_MARKETS_URL = `${PARADEX_BASE_URL}/markets`;
+const ORDERBOOK_ENDPOINT = `${PARADEX_BASE_URL}/orderbook`;
+const TOKEN_INFO_ENDPOINT = `${PARADEX_BASE_URL}/tokens`;
export const PARADEX_SOURCE = 'paradex';
export type ParadexActiveMarketsResponse = ParadexMarket[];
diff --git a/packages/pipeline/src/entities/erc20_approval_event.ts b/packages/pipeline/src/entities/erc20_approval_event.ts
new file mode 100644
index 000000000..69cdfcb0b
--- /dev/null
+++ b/packages/pipeline/src/entities/erc20_approval_event.ts
@@ -0,0 +1,26 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'erc20_approval_events', schema: 'raw' })
+export class ERC20ApprovalEvent {
+ @PrimaryColumn({ name: 'token_address' })
+ public tokenAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
+
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'owner_address' })
+ public ownerAddress!: string;
+ @Column({ name: 'spender_address' })
+ public spenderAddress!: string;
+ @Column({ name: 'amount', type: 'numeric', transformer: bigNumberTransformer })
+ public amount!: BigNumber;
+}
diff --git a/packages/pipeline/src/entities/index.ts b/packages/pipeline/src/entities/index.ts
index db0814e38..cc3de78bb 100644
--- a/packages/pipeline/src/entities/index.ts
+++ b/packages/pipeline/src/entities/index.ts
@@ -14,5 +14,6 @@ export { SraOrdersObservedTimeStamp, createObservedTimestampForOrder } from './s
export { TokenMetadata } from './token_metadata';
export { TokenOrderbookSnapshot } from './token_order';
export { Transaction } from './transaction';
+export { ERC20ApprovalEvent } from './erc20_approval_event';
export type ExchangeEvent = ExchangeFillEvent | ExchangeCancelEvent | ExchangeCancelUpToEvent;
diff --git a/packages/pipeline/src/entities/token_order.ts b/packages/pipeline/src/entities/token_order.ts
index 557705767..4b8f0abc3 100644
--- a/packages/pipeline/src/entities/token_order.ts
+++ b/packages/pipeline/src/entities/token_order.ts
@@ -10,20 +10,20 @@ export class TokenOrderbookSnapshot {
public observedTimestamp!: number;
@PrimaryColumn({ name: 'source' })
public source!: string;
- @Column({ name: 'order_type' })
+ @PrimaryColumn({ name: 'order_type' })
public orderType!: OrderType;
@PrimaryColumn({ name: 'price', type: 'numeric', transformer: bigNumberTransformer })
public price!: BigNumber;
@PrimaryColumn({ name: 'base_asset_symbol' })
public baseAssetSymbol!: string;
- @Column({ name: 'base_asset_address' })
- public baseAssetAddress!: string;
+ @Column({ nullable: true, type: String, name: 'base_asset_address' })
+ public baseAssetAddress!: string | null;
@Column({ name: 'base_volume', type: 'numeric', transformer: bigNumberTransformer })
public baseVolume!: BigNumber;
@PrimaryColumn({ name: 'quote_asset_symbol' })
public quoteAssetSymbol!: string;
- @Column({ name: 'quote_asset_address' })
- public quoteAssetAddress!: string;
+ @Column({ nullable: true, type: String, name: 'quote_asset_address' })
+ public quoteAssetAddress!: string | null;
@Column({ name: 'quote_volume', type: 'numeric', transformer: bigNumberTransformer })
public quoteVolume!: BigNumber;
}
diff --git a/packages/pipeline/src/ormconfig.ts b/packages/pipeline/src/ormconfig.ts
index 9f7815b4e..fe11d81d5 100644
--- a/packages/pipeline/src/ormconfig.ts
+++ b/packages/pipeline/src/ormconfig.ts
@@ -3,6 +3,7 @@ import { ConnectionOptions } from 'typeorm';
import {
Block,
DexTrade,
+ ERC20ApprovalEvent,
ExchangeCancelEvent,
ExchangeCancelUpToEvent,
ExchangeFillEvent,
@@ -21,6 +22,7 @@ const entities = [
ExchangeCancelEvent,
ExchangeCancelUpToEvent,
ExchangeFillEvent,
+ ERC20ApprovalEvent,
OHLCVExternal,
Relayer,
SraOrder,
diff --git a/packages/pipeline/src/parsers/ddex_orders/index.ts b/packages/pipeline/src/parsers/ddex_orders/index.ts
index 81132e8f0..d7b97efbe 100644
--- a/packages/pipeline/src/parsers/ddex_orders/index.ts
+++ b/packages/pipeline/src/parsers/ddex_orders/index.ts
@@ -1,7 +1,8 @@
import { BigNumber } from '@0x/utils';
-import * as R from 'ramda';
-import { DdexMarket, DdexOrder, DdexOrderbook } from '../../data_sources/ddex';
+import { aggregateOrders } from '../utils';
+
+import { DdexMarket, DdexOrderbook } from '../../data_sources/ddex';
import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
import { OrderType } from '../../types';
@@ -28,19 +29,6 @@ export function parseDdexOrders(
}
/**
- * Aggregates orders by price point for consistency with other exchanges.
- * Querying the Ddex API at level 3 setting returns a breakdown of
- * individual orders at each price point. Other exchanges only give total amount
- * at each price point. Returns an array of <price, amount> tuples.
- * @param ddexOrders A list of Ddex orders awaiting aggregation.
- */
-export function aggregateOrders(ddexOrders: DdexOrder[]): Array<[string, BigNumber]> {
- const sumAmount = (acc: BigNumber, order: DdexOrder): BigNumber => acc.plus(order.amount);
- const aggregatedPricePoints = R.reduceBy(sumAmount, new BigNumber(0), R.prop('price'), ddexOrders);
- return Object.entries(aggregatedPricePoints);
-}
-
-/**
* Parse a single aggregated Ddex order in order to form a tokenOrder entity
* which can be saved into the database.
* @param ddexMarket An object containing information about the market where these
@@ -66,12 +54,14 @@ export function parseDdexOrder(
tokenOrder.orderType = orderType;
tokenOrder.price = price;
- tokenOrder.baseAssetSymbol = ddexMarket.baseToken;
- tokenOrder.baseAssetAddress = ddexMarket.baseTokenAddress;
- tokenOrder.baseVolume = price.times(amount);
+ // ddex currently confuses quote and base assets.
+ // We switch them here to maintain our internal consistency.
+ tokenOrder.baseAssetSymbol = ddexMarket.quoteToken;
+ tokenOrder.baseAssetAddress = ddexMarket.quoteTokenAddress;
+ tokenOrder.baseVolume = amount;
- tokenOrder.quoteAssetSymbol = ddexMarket.quoteToken;
- tokenOrder.quoteAssetAddress = ddexMarket.quoteTokenAddress;
- tokenOrder.quoteVolume = amount;
+ tokenOrder.quoteAssetSymbol = ddexMarket.baseToken;
+ tokenOrder.quoteAssetAddress = ddexMarket.baseTokenAddress;
+ tokenOrder.quoteVolume = price.times(amount);
return tokenOrder;
}
diff --git a/packages/pipeline/src/parsers/events/erc20_events.ts b/packages/pipeline/src/parsers/events/erc20_events.ts
new file mode 100644
index 000000000..caf9984d0
--- /dev/null
+++ b/packages/pipeline/src/parsers/events/erc20_events.ts
@@ -0,0 +1,34 @@
+import { ERC20TokenApprovalEventArgs } from '@0x/contract-wrappers';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as R from 'ramda';
+
+import { ERC20ApprovalEvent } from '../../entities';
+
+/**
+ * Parses raw event logs for an ERC20 approval event and returns an array of
+ * ERC20ApprovalEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseERC20ApprovalEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>,
+) => ERC20ApprovalEvent[] = R.map(_convertToERC20ApprovalEvent);
+
+/**
+ * Converts a raw event log for an ERC20 approval event into an
+ * ERC20ApprovalEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToERC20ApprovalEvent(
+ eventLog: LogWithDecodedArgs<ERC20TokenApprovalEventArgs>,
+): ERC20ApprovalEvent {
+ const erc20ApprovalEvent = new ERC20ApprovalEvent();
+ erc20ApprovalEvent.tokenAddress = eventLog.address as string;
+ erc20ApprovalEvent.blockNumber = eventLog.blockNumber as number;
+ erc20ApprovalEvent.logIndex = eventLog.logIndex as number;
+ erc20ApprovalEvent.rawData = eventLog.data as string;
+ erc20ApprovalEvent.transactionHash = eventLog.transactionHash;
+ erc20ApprovalEvent.ownerAddress = eventLog.args._owner;
+ erc20ApprovalEvent.spenderAddress = eventLog.args._spender;
+ erc20ApprovalEvent.amount = eventLog.args._value;
+ return erc20ApprovalEvent;
+}
diff --git a/packages/pipeline/src/parsers/events/exchange_events.ts b/packages/pipeline/src/parsers/events/exchange_events.ts
new file mode 100644
index 000000000..e18106c75
--- /dev/null
+++ b/packages/pipeline/src/parsers/events/exchange_events.ts
@@ -0,0 +1,133 @@
+import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, ExchangeFillEventArgs } from '@0x/contract-wrappers';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId, ERC721AssetData } from '@0x/types';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as R from 'ramda';
+
+import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities';
+import { bigNumbertoStringOrNull } from '../../utils';
+
+/**
+ * Parses raw event logs for a fill event and returns an array of
+ * ExchangeFillEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeFillEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeFillEventArgs>>,
+) => ExchangeFillEvent[] = R.map(_convertToExchangeFillEvent);
+
+/**
+ * Parses raw event logs for a cancel event and returns an array of
+ * ExchangeCancelEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeCancelEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeCancelEventArgs>>,
+) => ExchangeCancelEvent[] = R.map(_convertToExchangeCancelEvent);
+
+/**
+ * Parses raw event logs for a CancelUpTo event and returns an array of
+ * ExchangeCancelUpToEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeCancelUpToEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeCancelUpToEventArgs>>,
+) => ExchangeCancelUpToEvent[] = R.map(_convertToExchangeCancelUpToEvent);
+
+/**
+ * Converts a raw event log for a fill event into an ExchangeFillEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeFillEvent(eventLog: LogWithDecodedArgs<ExchangeFillEventArgs>): ExchangeFillEvent {
+ const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
+ const makerAssetType = makerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
+ const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
+ const takerAssetType = takerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
+ const exchangeFillEvent = new ExchangeFillEvent();
+ exchangeFillEvent.contractAddress = eventLog.address as string;
+ exchangeFillEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeFillEvent.logIndex = eventLog.logIndex as number;
+ exchangeFillEvent.rawData = eventLog.data as string;
+ exchangeFillEvent.transactionHash = eventLog.transactionHash;
+ exchangeFillEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeFillEvent.takerAddress = eventLog.args.takerAddress;
+ exchangeFillEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
+ exchangeFillEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeFillEvent.makerAssetFilledAmount = eventLog.args.makerAssetFilledAmount;
+ exchangeFillEvent.takerAssetFilledAmount = eventLog.args.takerAssetFilledAmount;
+ exchangeFillEvent.makerFeePaid = eventLog.args.makerFeePaid;
+ exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
+ exchangeFillEvent.orderHash = eventLog.args.orderHash;
+ exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
+ exchangeFillEvent.makerAssetType = makerAssetType;
+ exchangeFillEvent.makerAssetProxyId = makerAssetData.assetProxyId;
+ exchangeFillEvent.makerTokenAddress = makerAssetData.tokenAddress;
+ // tslint has a false positive here. Type assertion is required.
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
+ exchangeFillEvent.rawTakerAssetData = eventLog.args.takerAssetData;
+ exchangeFillEvent.takerAssetType = takerAssetType;
+ exchangeFillEvent.takerAssetProxyId = takerAssetData.assetProxyId;
+ exchangeFillEvent.takerTokenAddress = takerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
+ return exchangeFillEvent;
+}
+
+/**
+ * Converts a raw event log for a cancel event into an ExchangeCancelEvent
+ * entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeCancelEvent(
+ eventLog: LogWithDecodedArgs<ExchangeCancelEventArgs>,
+): ExchangeCancelEvent {
+ const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
+ const makerAssetType = makerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
+ const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
+ const takerAssetType = takerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
+ const exchangeCancelEvent = new ExchangeCancelEvent();
+ exchangeCancelEvent.contractAddress = eventLog.address as string;
+ exchangeCancelEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeCancelEvent.logIndex = eventLog.logIndex as number;
+ exchangeCancelEvent.rawData = eventLog.data as string;
+ exchangeCancelEvent.transactionHash = eventLog.transactionHash;
+ exchangeCancelEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeCancelEvent.takerAddress = eventLog.args.takerAddress;
+ exchangeCancelEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
+ exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeCancelEvent.orderHash = eventLog.args.orderHash;
+ exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
+ exchangeCancelEvent.makerAssetType = makerAssetType;
+ exchangeCancelEvent.makerAssetProxyId = makerAssetData.assetProxyId;
+ exchangeCancelEvent.makerTokenAddress = makerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
+ exchangeCancelEvent.rawTakerAssetData = eventLog.args.takerAssetData;
+ exchangeCancelEvent.takerAssetType = takerAssetType;
+ exchangeCancelEvent.takerAssetProxyId = takerAssetData.assetProxyId;
+ exchangeCancelEvent.takerTokenAddress = takerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
+ return exchangeCancelEvent;
+}
+
+/**
+ * Converts a raw event log for a cancelUpTo event into an
+ * ExchangeCancelUpToEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeCancelUpToEvent(
+ eventLog: LogWithDecodedArgs<ExchangeCancelUpToEventArgs>,
+): ExchangeCancelUpToEvent {
+ const exchangeCancelUpToEvent = new ExchangeCancelUpToEvent();
+ exchangeCancelUpToEvent.contractAddress = eventLog.address as string;
+ exchangeCancelUpToEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeCancelUpToEvent.logIndex = eventLog.logIndex as number;
+ exchangeCancelUpToEvent.rawData = eventLog.data as string;
+ exchangeCancelUpToEvent.transactionHash = eventLog.transactionHash;
+ exchangeCancelUpToEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeCancelUpToEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeCancelUpToEvent.orderEpoch = eventLog.args.orderEpoch;
+ return exchangeCancelUpToEvent;
+}
diff --git a/packages/pipeline/src/parsers/events/index.ts b/packages/pipeline/src/parsers/events/index.ts
index e18106c75..3f9915e8b 100644
--- a/packages/pipeline/src/parsers/events/index.ts
+++ b/packages/pipeline/src/parsers/events/index.ts
@@ -1,133 +1,2 @@
-import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, ExchangeFillEventArgs } from '@0x/contract-wrappers';
-import { assetDataUtils } from '@0x/order-utils';
-import { AssetProxyId, ERC721AssetData } from '@0x/types';
-import { LogWithDecodedArgs } from 'ethereum-types';
-import * as R from 'ramda';
-
-import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities';
-import { bigNumbertoStringOrNull } from '../../utils';
-
-/**
- * Parses raw event logs for a fill event and returns an array of
- * ExchangeFillEvent entities.
- * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
- */
-export const parseExchangeFillEvents: (
- eventLogs: Array<LogWithDecodedArgs<ExchangeFillEventArgs>>,
-) => ExchangeFillEvent[] = R.map(_convertToExchangeFillEvent);
-
-/**
- * Parses raw event logs for a cancel event and returns an array of
- * ExchangeCancelEvent entities.
- * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
- */
-export const parseExchangeCancelEvents: (
- eventLogs: Array<LogWithDecodedArgs<ExchangeCancelEventArgs>>,
-) => ExchangeCancelEvent[] = R.map(_convertToExchangeCancelEvent);
-
-/**
- * Parses raw event logs for a CancelUpTo event and returns an array of
- * ExchangeCancelUpToEvent entities.
- * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
- */
-export const parseExchangeCancelUpToEvents: (
- eventLogs: Array<LogWithDecodedArgs<ExchangeCancelUpToEventArgs>>,
-) => ExchangeCancelUpToEvent[] = R.map(_convertToExchangeCancelUpToEvent);
-
-/**
- * Converts a raw event log for a fill event into an ExchangeFillEvent entity.
- * @param eventLog Raw event log (e.g. returned from contract-wrappers).
- */
-export function _convertToExchangeFillEvent(eventLog: LogWithDecodedArgs<ExchangeFillEventArgs>): ExchangeFillEvent {
- const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
- const makerAssetType = makerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
- const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
- const takerAssetType = takerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
- const exchangeFillEvent = new ExchangeFillEvent();
- exchangeFillEvent.contractAddress = eventLog.address as string;
- exchangeFillEvent.blockNumber = eventLog.blockNumber as number;
- exchangeFillEvent.logIndex = eventLog.logIndex as number;
- exchangeFillEvent.rawData = eventLog.data as string;
- exchangeFillEvent.transactionHash = eventLog.transactionHash;
- exchangeFillEvent.makerAddress = eventLog.args.makerAddress;
- exchangeFillEvent.takerAddress = eventLog.args.takerAddress;
- exchangeFillEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
- exchangeFillEvent.senderAddress = eventLog.args.senderAddress;
- exchangeFillEvent.makerAssetFilledAmount = eventLog.args.makerAssetFilledAmount;
- exchangeFillEvent.takerAssetFilledAmount = eventLog.args.takerAssetFilledAmount;
- exchangeFillEvent.makerFeePaid = eventLog.args.makerFeePaid;
- exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
- exchangeFillEvent.orderHash = eventLog.args.orderHash;
- exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
- exchangeFillEvent.makerAssetType = makerAssetType;
- exchangeFillEvent.makerAssetProxyId = makerAssetData.assetProxyId;
- exchangeFillEvent.makerTokenAddress = makerAssetData.tokenAddress;
- // tslint has a false positive here. Type assertion is required.
- // tslint:disable-next-line:no-unnecessary-type-assertion
- exchangeFillEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
- exchangeFillEvent.rawTakerAssetData = eventLog.args.takerAssetData;
- exchangeFillEvent.takerAssetType = takerAssetType;
- exchangeFillEvent.takerAssetProxyId = takerAssetData.assetProxyId;
- exchangeFillEvent.takerTokenAddress = takerAssetData.tokenAddress;
- // tslint:disable-next-line:no-unnecessary-type-assertion
- exchangeFillEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
- return exchangeFillEvent;
-}
-
-/**
- * Converts a raw event log for a cancel event into an ExchangeCancelEvent
- * entity.
- * @param eventLog Raw event log (e.g. returned from contract-wrappers).
- */
-export function _convertToExchangeCancelEvent(
- eventLog: LogWithDecodedArgs<ExchangeCancelEventArgs>,
-): ExchangeCancelEvent {
- const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
- const makerAssetType = makerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
- const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
- const takerAssetType = takerAssetData.assetProxyId === AssetProxyId.ERC20 ? 'erc20' : 'erc721';
- const exchangeCancelEvent = new ExchangeCancelEvent();
- exchangeCancelEvent.contractAddress = eventLog.address as string;
- exchangeCancelEvent.blockNumber = eventLog.blockNumber as number;
- exchangeCancelEvent.logIndex = eventLog.logIndex as number;
- exchangeCancelEvent.rawData = eventLog.data as string;
- exchangeCancelEvent.transactionHash = eventLog.transactionHash;
- exchangeCancelEvent.makerAddress = eventLog.args.makerAddress;
- exchangeCancelEvent.takerAddress = eventLog.args.takerAddress;
- exchangeCancelEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
- exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
- exchangeCancelEvent.orderHash = eventLog.args.orderHash;
- exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
- exchangeCancelEvent.makerAssetType = makerAssetType;
- exchangeCancelEvent.makerAssetProxyId = makerAssetData.assetProxyId;
- exchangeCancelEvent.makerTokenAddress = makerAssetData.tokenAddress;
- // tslint:disable-next-line:no-unnecessary-type-assertion
- exchangeCancelEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
- exchangeCancelEvent.rawTakerAssetData = eventLog.args.takerAssetData;
- exchangeCancelEvent.takerAssetType = takerAssetType;
- exchangeCancelEvent.takerAssetProxyId = takerAssetData.assetProxyId;
- exchangeCancelEvent.takerTokenAddress = takerAssetData.tokenAddress;
- // tslint:disable-next-line:no-unnecessary-type-assertion
- exchangeCancelEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
- return exchangeCancelEvent;
-}
-
-/**
- * Converts a raw event log for a cancelUpTo event into an
- * ExchangeCancelUpToEvent entity.
- * @param eventLog Raw event log (e.g. returned from contract-wrappers).
- */
-export function _convertToExchangeCancelUpToEvent(
- eventLog: LogWithDecodedArgs<ExchangeCancelUpToEventArgs>,
-): ExchangeCancelUpToEvent {
- const exchangeCancelUpToEvent = new ExchangeCancelUpToEvent();
- exchangeCancelUpToEvent.contractAddress = eventLog.address as string;
- exchangeCancelUpToEvent.blockNumber = eventLog.blockNumber as number;
- exchangeCancelUpToEvent.logIndex = eventLog.logIndex as number;
- exchangeCancelUpToEvent.rawData = eventLog.data as string;
- exchangeCancelUpToEvent.transactionHash = eventLog.transactionHash;
- exchangeCancelUpToEvent.makerAddress = eventLog.args.makerAddress;
- exchangeCancelUpToEvent.senderAddress = eventLog.args.senderAddress;
- exchangeCancelUpToEvent.orderEpoch = eventLog.args.orderEpoch;
- return exchangeCancelUpToEvent;
-}
+export { parseExchangeCancelEvents, parseExchangeCancelUpToEvents, parseExchangeFillEvents } from './exchange_events';
+export { parseERC20ApprovalEvents } from './erc20_events';
diff --git a/packages/pipeline/src/parsers/idex_orders/index.ts b/packages/pipeline/src/parsers/idex_orders/index.ts
new file mode 100644
index 000000000..dfe27455c
--- /dev/null
+++ b/packages/pipeline/src/parsers/idex_orders/index.ts
@@ -0,0 +1,77 @@
+import { BigNumber } from '@0x/utils';
+
+import { aggregateOrders } from '../utils';
+
+import { IdexOrder, IdexOrderbook, IdexOrderParam } from '../../data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook,
+ * 2) Aggregates them by price point,
+ * 3) Parses them into entities which are then saved into the database.
+ * @param idexOrderbook raw orderbook that we pull from the Idex API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'idex'.
+ */
+export function parseIdexOrders(idexOrderbook: IdexOrderbook, observedTimestamp: number, source: string): TokenOrder[] {
+ const aggregatedBids = aggregateOrders(idexOrderbook.bids);
+ // Any of the bid orders' params will work
+ const idexBidOrder = idexOrderbook.bids[0];
+ const parsedBids =
+ aggregatedBids.length > 0
+ ? aggregatedBids.map(order => parseIdexOrder(idexBidOrder.params, observedTimestamp, 'bid', source, order))
+ : [];
+
+ const aggregatedAsks = aggregateOrders(idexOrderbook.asks);
+ // Any of the ask orders' params will work
+ const idexAskOrder = idexOrderbook.asks[0];
+ const parsedAsks =
+ aggregatedAsks.length > 0
+ ? aggregatedAsks.map(order => parseIdexOrder(idexAskOrder.params, observedTimestamp, 'ask', source, order))
+ : [];
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Idex order in order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param idexOrderParam An object containing information about the market where these
+ * trades have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param idexOrder A <price, amount> tuple which we will convert to volume-basis.
+ */
+export function parseIdexOrder(
+ idexOrderParam: IdexOrderParam,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ idexOrder: [string, BigNumber],
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(idexOrder[0]);
+ const amount = idexOrder[1];
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+ tokenOrder.baseVolume = amount;
+ tokenOrder.quoteVolume = price.times(amount);
+
+ if (orderType === 'bid') {
+ tokenOrder.baseAssetSymbol = idexOrderParam.buySymbol;
+ tokenOrder.baseAssetAddress = idexOrderParam.tokenBuy;
+ tokenOrder.quoteAssetSymbol = idexOrderParam.sellSymbol;
+ tokenOrder.quoteAssetAddress = idexOrderParam.tokenSell;
+ } else {
+ tokenOrder.baseAssetSymbol = idexOrderParam.sellSymbol;
+ tokenOrder.baseAssetAddress = idexOrderParam.tokenSell;
+ tokenOrder.quoteAssetSymbol = idexOrderParam.buySymbol;
+ tokenOrder.quoteAssetAddress = idexOrderParam.tokenBuy;
+ }
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/oasis_orders/index.ts b/packages/pipeline/src/parsers/oasis_orders/index.ts
new file mode 100644
index 000000000..13997f31b
--- /dev/null
+++ b/packages/pipeline/src/parsers/oasis_orders/index.ts
@@ -0,0 +1,71 @@
+import { BigNumber } from '@0x/utils';
+import * as R from 'ramda';
+
+import { aggregateOrders } from '../utils';
+
+import { OasisMarket, OasisOrder } from '../../data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook,
+ * 2) Aggregates them according to price point,
+ * 3) Builds TokenOrder entity with other information attached.
+ * @param oasisOrderbook A raw orderbook that we pull from the Oasis API.
+ * @param oasisMarket An object containing market data also directly from the API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'oasis'.
+ */
+export function parseOasisOrders(
+ oasisOrderbook: OasisOrder[],
+ oasisMarket: OasisMarket,
+ observedTimestamp: number,
+ source: string,
+): TokenOrder[] {
+ const aggregatedBids = aggregateOrders(R.filter(R.propEq('act', 'bid'), oasisOrderbook));
+ const aggregatedAsks = aggregateOrders(R.filter(R.propEq('act', 'ask'), oasisOrderbook));
+ const parsedBids = aggregatedBids.map(order =>
+ parseOasisOrder(oasisMarket, observedTimestamp, 'bid', source, order),
+ );
+ const parsedAsks = aggregatedAsks.map(order =>
+ parseOasisOrder(oasisMarket, observedTimestamp, 'ask', source, order),
+ );
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Oasis order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param oasisMarket An object containing information about the market where these
+ * trades have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param oasisOrder A <price, amount> tuple which we will convert to volume-basis.
+ */
+export function parseOasisOrder(
+ oasisMarket: OasisMarket,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ oasisOrder: [string, BigNumber],
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(oasisOrder[0]);
+ const amount = oasisOrder[1];
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+
+ tokenOrder.baseAssetSymbol = oasisMarket.base;
+ tokenOrder.baseAssetAddress = null; // Oasis doesn't provide address information
+ tokenOrder.baseVolume = amount;
+
+ tokenOrder.quoteAssetSymbol = oasisMarket.quote;
+ tokenOrder.quoteAssetAddress = null; // Oasis doesn't provide address information
+ tokenOrder.quoteVolume = price.times(amount);
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/paradex_orders/index.ts b/packages/pipeline/src/parsers/paradex_orders/index.ts
index 7966658a7..5ceeb64a4 100644
--- a/packages/pipeline/src/parsers/paradex_orders/index.ts
+++ b/packages/pipeline/src/parsers/paradex_orders/index.ts
@@ -57,10 +57,10 @@ export function parseParadexOrder(
tokenOrder.baseAssetSymbol = paradexMarket.baseToken;
tokenOrder.baseAssetAddress = paradexMarket.baseTokenAddress as string;
- tokenOrder.baseVolume = price.times(amount);
+ tokenOrder.baseVolume = amount;
tokenOrder.quoteAssetSymbol = paradexMarket.quoteToken;
tokenOrder.quoteAssetAddress = paradexMarket.quoteTokenAddress as string;
- tokenOrder.quoteVolume = amount;
+ tokenOrder.quoteVolume = price.times(amount);
return tokenOrder;
}
diff --git a/packages/pipeline/src/parsers/token_metadata/index.ts b/packages/pipeline/src/parsers/token_metadata/index.ts
index 3b3e05d76..65e0aaa6e 100644
--- a/packages/pipeline/src/parsers/token_metadata/index.ts
+++ b/packages/pipeline/src/parsers/token_metadata/index.ts
@@ -1,9 +1,8 @@
-import { BigNumber } from '@0x/utils';
import * as R from 'ramda';
import { MetamaskTrustedTokenMeta, ZeroExTrustedTokenMeta } from '../../data_sources/trusted_tokens';
import { TokenMetadata } from '../../entities';
-import {} from '../../utils';
+import { toBigNumberOrNull } from '../../utils';
/**
* Parses Metamask's trusted tokens list.
@@ -26,7 +25,7 @@ function parseMetamaskTrustedToken(resp: MetamaskTrustedTokenMeta, address: stri
const trustedToken = new TokenMetadata();
trustedToken.address = address;
- trustedToken.decimals = new BigNumber(resp.decimals);
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
trustedToken.symbol = resp.symbol;
trustedToken.name = resp.name;
trustedToken.authority = 'metamask';
@@ -38,7 +37,7 @@ function parseZeroExTrustedToken(resp: ZeroExTrustedTokenMeta): TokenMetadata {
const trustedToken = new TokenMetadata();
trustedToken.address = resp.address;
- trustedToken.decimals = new BigNumber(resp.decimals);
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
trustedToken.symbol = resp.symbol;
trustedToken.name = resp.name;
trustedToken.authority = '0x';
diff --git a/packages/pipeline/src/parsers/utils.ts b/packages/pipeline/src/parsers/utils.ts
new file mode 100644
index 000000000..860729e9f
--- /dev/null
+++ b/packages/pipeline/src/parsers/utils.ts
@@ -0,0 +1,28 @@
+import { BigNumber } from '@0x/utils';
+
+export interface GenericRawOrder {
+ price: string;
+ amount: string;
+}
+
+/**
+ * Aggregates individual orders by price point. Filters zero amount orders.
+ * @param rawOrders An array of objects that have price and amount information.
+ */
+export function aggregateOrders(rawOrders: GenericRawOrder[]): Array<[string, BigNumber]> {
+ const aggregatedOrders = new Map<string, BigNumber>();
+ rawOrders.forEach(order => {
+ const amount = new BigNumber(order.amount);
+ if (amount.isZero()) {
+ return;
+ }
+ // Use string instead of BigNum to aggregate by value instead of variable.
+ // Convert to BigNumber first to consolidate different string
+ // representations of the same number. Eg. '0.0' and '0.00'.
+ const price = new BigNumber(order.price).toString();
+
+ const existingAmount = aggregatedOrders.get(price) || new BigNumber(0);
+ aggregatedOrders.set(price, amount.plus(existingAmount));
+ });
+ return Array.from(aggregatedOrders.entries());
+}
diff --git a/packages/pipeline/src/scripts/pull_competing_dex_trades.ts b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
index 4e4c12dd0..1478d5615 100644
--- a/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
+++ b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
@@ -15,11 +15,11 @@ let connection: Connection;
(async () => {
connection = await createConnection(ormConfig as ConnectionOptions);
- await getAndSaveTrades();
+ await getAndSaveTradesAsync();
process.exit(0);
})().catch(handleError);
-async function getAndSaveTrades(): Promise<void> {
+async function getAndSaveTradesAsync(): Promise<void> {
const apiKey = process.env.BLOXY_API_KEY;
if (apiKey === undefined) {
throw new Error('Missing required env var: BLOXY_API_KEY');
diff --git a/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts
index 7868e9c5a..4e00f258f 100644
--- a/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts
+++ b/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts
@@ -25,7 +25,7 @@ let connection: Connection;
const markets = await ddexSource.getActiveMarketsAsync();
for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
await Promise.all(
- marketsChunk.map(async (market: DdexMarket) => getAndSaveMarketOrderbook(ddexSource, market)),
+ marketsChunk.map(async (market: DdexMarket) => getAndSaveMarketOrderbookAsync(ddexSource, market)),
);
await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
}
@@ -38,7 +38,7 @@ let connection: Connection;
* @param ddexSource Data source which can query Ddex API.
* @param market Object from Ddex API containing market data.
*/
-async function getAndSaveMarketOrderbook(ddexSource: DdexSource, market: DdexMarket): Promise<void> {
+async function getAndSaveMarketOrderbookAsync(ddexSource: DdexSource, market: DdexMarket): Promise<void> {
const orderBook = await ddexSource.getMarketOrderbookAsync(market.id);
const observedTimestamp = Date.now();
diff --git a/packages/pipeline/src/scripts/pull_erc20_events.ts b/packages/pipeline/src/scripts/pull_erc20_events.ts
new file mode 100644
index 000000000..bd520c610
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_erc20_events.ts
@@ -0,0 +1,96 @@
+import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
+import { web3Factory } from '@0x/dev-utils';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { ERC20EventsSource } from '../data_sources/contract-wrappers/erc20_events';
+import { ERC20ApprovalEvent } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseERC20ApprovalEvents } from '../parsers/events';
+import { handleError, INFURA_ROOT_URL } from '../utils';
+
+const NETWORK_ID = 1;
+const START_BLOCK_OFFSET = 100; // Number of blocks before the last known block to consider when updating fill events.
+const BATCH_SAVE_SIZE = 1000; // Number of events to save at once.
+const BLOCK_FINALITY_THRESHOLD = 10; // When to consider blocks as final. Used to compute default endBlock.
+
+let connection: Connection;
+
+interface Token {
+ // name is used for logging only.
+ name: string;
+ address: string;
+ defaultStartBlock: number;
+}
+
+const tokensToGetApprovalEvents: Token[] = [
+ {
+ name: 'WETH',
+ address: getContractAddressesForNetworkOrThrow(NETWORK_ID).etherToken,
+ defaultStartBlock: 4719568, // Block when the WETH contract was deployed.
+ },
+ {
+ name: 'ZRX',
+ address: getContractAddressesForNetworkOrThrow(NETWORK_ID).zrxToken,
+ defaultStartBlock: 4145415, // Block when the ZRX contract was deployed.
+ },
+ {
+ name: 'DAI',
+ address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
+ defaultStartBlock: 4752008, // Block when the DAI contract was deployed.
+ },
+];
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const provider = web3Factory.getRpcProvider({
+ rpcUrl: INFURA_ROOT_URL,
+ });
+ const endBlock = await calculateEndBlockAsync(provider);
+ for (const token of tokensToGetApprovalEvents) {
+ await getAndSaveApprovalEventsAsync(provider, token, endBlock);
+ }
+ process.exit(0);
+})().catch(handleError);
+
+async function getAndSaveApprovalEventsAsync(
+ provider: Web3ProviderEngine,
+ token: Token,
+ endBlock: number,
+): Promise<void> {
+ logUtils.log(`Getting approval events for ${token.name}...`);
+ logUtils.log('Checking existing approval events...');
+ const repository = connection.getRepository(ERC20ApprovalEvent);
+ const startBlock = (await getStartBlockAsync(token)) || token.defaultStartBlock;
+
+ logUtils.log(`Getting approval events starting at ${startBlock}...`);
+ const eventsSource = new ERC20EventsSource(provider, NETWORK_ID, token.address);
+ const eventLogs = await eventsSource.getApprovalEventsAsync(startBlock, endBlock);
+
+ logUtils.log(`Parsing ${eventLogs.length} approval events...`);
+ const events = parseERC20ApprovalEvents(eventLogs);
+ logUtils.log(`Retrieved and parsed ${events.length} total approval events.`);
+ await repository.save(events, { chunk: Math.ceil(events.length / BATCH_SAVE_SIZE) });
+}
+
+async function calculateEndBlockAsync(provider: Web3ProviderEngine): Promise<number> {
+ const web3Wrapper = new Web3Wrapper(provider);
+ const currentBlock = await web3Wrapper.getBlockNumberAsync();
+ return currentBlock - BLOCK_FINALITY_THRESHOLD;
+}
+
+async function getStartBlockAsync(token: Token): Promise<number | null> {
+ const queryResult = await connection.query(
+ `SELECT block_number FROM raw.erc20_approval_events WHERE token_address = $1 ORDER BY block_number DESC LIMIT 1`,
+ [token.address],
+ );
+ if (queryResult.length === 0) {
+ logUtils.log(`No existing approval events found for ${token.name}.`);
+ return null;
+ }
+ const lastKnownBlock = queryResult[0].block_number;
+ return lastKnownBlock - START_BLOCK_OFFSET;
+}
diff --git a/packages/pipeline/src/scripts/pull_missing_events.ts b/packages/pipeline/src/scripts/pull_exchange_events.ts
index 80abbb8b0..e98fc6629 100644
--- a/packages/pipeline/src/scripts/pull_missing_events.ts
+++ b/packages/pipeline/src/scripts/pull_exchange_events.ts
@@ -1,5 +1,7 @@
// tslint:disable:no-console
import { web3Factory } from '@0x/dev-utils';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import R = require('ramda');
import 'reflect-metadata';
import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
@@ -12,6 +14,7 @@ import { EXCHANGE_START_BLOCK, handleError, INFURA_ROOT_URL } from '../utils';
const START_BLOCK_OFFSET = 100; // Number of blocks before the last known block to consider when updating fill events.
const BATCH_SAVE_SIZE = 1000; // Number of events to save at once.
+const BLOCK_FINALITY_THRESHOLD = 10; // When to consider blocks as final. Used to compute default endBlock.
let connection: Connection;
@@ -20,43 +23,44 @@ let connection: Connection;
const provider = web3Factory.getRpcProvider({
rpcUrl: INFURA_ROOT_URL,
});
+ const endBlock = await calculateEndBlockAsync(provider);
const eventsSource = new ExchangeEventsSource(provider, 1);
- await getFillEventsAsync(eventsSource);
- await getCancelEventsAsync(eventsSource);
- await getCancelUpToEventsAsync(eventsSource);
+ await getFillEventsAsync(eventsSource, endBlock);
+ await getCancelEventsAsync(eventsSource, endBlock);
+ await getCancelUpToEventsAsync(eventsSource, endBlock);
process.exit(0);
})().catch(handleError);
-async function getFillEventsAsync(eventsSource: ExchangeEventsSource): Promise<void> {
+async function getFillEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
console.log('Checking existing fill events...');
const repository = connection.getRepository(ExchangeFillEvent);
const startBlock = await getStartBlockAsync(repository);
console.log(`Getting fill events starting at ${startBlock}...`);
- const eventLogs = await eventsSource.getFillEventsAsync(startBlock);
+ const eventLogs = await eventsSource.getFillEventsAsync(startBlock, endBlock);
console.log('Parsing fill events...');
const events = parseExchangeFillEvents(eventLogs);
console.log(`Retrieved and parsed ${events.length} total fill events.`);
await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
}
-async function getCancelEventsAsync(eventsSource: ExchangeEventsSource): Promise<void> {
+async function getCancelEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
console.log('Checking existing cancel events...');
const repository = connection.getRepository(ExchangeCancelEvent);
const startBlock = await getStartBlockAsync(repository);
console.log(`Getting cancel events starting at ${startBlock}...`);
- const eventLogs = await eventsSource.getCancelEventsAsync(startBlock);
+ const eventLogs = await eventsSource.getCancelEventsAsync(startBlock, endBlock);
console.log('Parsing cancel events...');
const events = parseExchangeCancelEvents(eventLogs);
console.log(`Retrieved and parsed ${events.length} total cancel events.`);
await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
}
-async function getCancelUpToEventsAsync(eventsSource: ExchangeEventsSource): Promise<void> {
+async function getCancelUpToEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
console.log('Checking existing CancelUpTo events...');
const repository = connection.getRepository(ExchangeCancelUpToEvent);
const startBlock = await getStartBlockAsync(repository);
console.log(`Getting CancelUpTo events starting at ${startBlock}...`);
- const eventLogs = await eventsSource.getCancelUpToEventsAsync(startBlock);
+ const eventLogs = await eventsSource.getCancelUpToEventsAsync(startBlock, endBlock);
console.log('Parsing CancelUpTo events...');
const events = parseExchangeCancelUpToEvents(eventLogs);
console.log(`Retrieved and parsed ${events.length} total CancelUpTo events.`);
@@ -134,3 +138,9 @@ async function saveIndividuallyWithFallbackAsync<T extends ExchangeEvent>(
}
}
}
+
+async function calculateEndBlockAsync(provider: Web3ProviderEngine): Promise<number> {
+ const web3Wrapper = new Web3Wrapper(provider);
+ const currentBlock = await web3Wrapper.getBlockNumberAsync();
+ return currentBlock - BLOCK_FINALITY_THRESHOLD;
+}
diff --git a/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts
new file mode 100644
index 000000000..490b17766
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts
@@ -0,0 +1,63 @@
+import { logUtils } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { IDEX_SOURCE, IdexSource } from '../data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseIdexOrders } from '../parsers/idex_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+// Number of markets to retrieve orderbooks for at once.
+const MARKET_ORDERBOOK_REQUEST_BATCH_SIZE = 100;
+
+// Delay between market orderbook requests.
+const MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY = 2000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const idexSource = new IdexSource();
+ logUtils.log('Getting all IDEX markets');
+ const markets = await idexSource.getMarketsAsync();
+ logUtils.log(`Got ${markets.length} markets.`);
+ for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
+ await Promise.all(
+ marketsChunk.map(async (marketId: string) => getAndSaveMarketOrderbookAsync(idexSource, marketId)),
+ );
+ await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
+ }
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Retrieve orderbook from Idex API for a given market. Parse orders and insert
+ * them into our database.
+ * @param idexSource Data source which can query Idex API.
+ * @param marketId String representing market of interest, eg. 'ETH_TIC'.
+ */
+async function getAndSaveMarketOrderbookAsync(idexSource: IdexSource, marketId: string): Promise<void> {
+ logUtils.log(`${marketId}: Retrieving orderbook.`);
+ const orderBook = await idexSource.getMarketOrderbookAsync(marketId);
+ const observedTimestamp = Date.now();
+
+ if (!R.has('bids', orderBook) || !R.has('asks', orderBook)) {
+ logUtils.warn(`${marketId}: Orderbook faulty.`);
+ return;
+ }
+
+ logUtils.log(`${marketId}: Parsing orders.`);
+ const orders = parseIdexOrders(orderBook, observedTimestamp, IDEX_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${marketId}: Saving ${orders.length} orders.`);
+ const TokenOrderRepository = connection.getRepository(TokenOrder);
+ await TokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${marketId}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_missing_blocks.ts b/packages/pipeline/src/scripts/pull_missing_blocks.ts
index b7bd51f08..bb5385126 100644
--- a/packages/pipeline/src/scripts/pull_missing_blocks.ts
+++ b/packages/pipeline/src/scripts/pull_missing_blocks.ts
@@ -9,7 +9,7 @@ import { Web3Source } from '../data_sources/web3';
import { Block } from '../entities';
import * as ormConfig from '../ormconfig';
import { parseBlock } from '../parsers/web3';
-import { EXCHANGE_START_BLOCK, handleError, INFURA_ROOT_URL } from '../utils';
+import { handleError, INFURA_ROOT_URL } from '../utils';
// Number of blocks to save at once.
const BATCH_SAVE_SIZE = 1000;
@@ -24,10 +24,10 @@ let connection: Connection;
(async () => {
connection = await createConnection(ormConfig as ConnectionOptions);
const provider = web3Factory.getRpcProvider({
- rpcUrl: `${INFURA_ROOT_URL}/${process.env.INFURA_API_KEY}`,
+ rpcUrl: INFURA_ROOT_URL,
});
const web3Source = new Web3Source(provider);
- await getAllMissingBlocks(web3Source);
+ await getAllMissingBlocksAsync(web3Source);
process.exit(0);
})().catch(handleError);
@@ -35,35 +35,44 @@ interface MissingBlocksResponse {
block_number: string;
}
-async function getAllMissingBlocks(web3Source: Web3Source): Promise<void> {
+async function getAllMissingBlocksAsync(web3Source: Web3Source): Promise<void> {
const blocksRepository = connection.getRepository(Block);
- let fromBlock = EXCHANGE_START_BLOCK;
while (true) {
- const blockNumbers = await getMissingBlockNumbers(fromBlock);
+ const blockNumbers = await getMissingBlockNumbersAsync();
if (blockNumbers.length === 0) {
// There are no more missing blocks. We're done.
break;
}
- await getAndSaveBlocks(web3Source, blocksRepository, blockNumbers);
- fromBlock = Math.max(...blockNumbers) + 1;
+ await getAndSaveBlocksAsync(web3Source, blocksRepository, blockNumbers);
}
const totalBlocks = await blocksRepository.count();
console.log(`Done saving blocks. There are now ${totalBlocks} total blocks.`);
}
-async function getMissingBlockNumbers(fromBlock: number): Promise<number[]> {
- console.log(`Checking for missing blocks starting at ${fromBlock}...`);
+async function getMissingBlockNumbersAsync(): Promise<number[]> {
+ // Note(albrow): The easiest way to get all the blocks we need is to
+ // consider all the events tables together in a single query. If this query
+ // gets too slow, we should consider re-architecting so that we can work on
+ // getting the blocks for one type of event at a time.
const response = (await connection.query(
- 'SELECT DISTINCT(block_number) FROM raw.exchange_fill_events WHERE block_number NOT IN (SELECT number FROM raw.blocks) AND block_number >= $1 ORDER BY block_number ASC LIMIT $2',
- [fromBlock, MAX_BLOCKS_PER_QUERY],
+ `WITH all_events AS (
+ SELECT block_number FROM raw.exchange_fill_events
+ UNION SELECT block_number FROM raw.exchange_cancel_events
+ UNION SELECT block_number FROM raw.exchange_cancel_up_to_events
+ UNION SELECT block_number FROM raw.erc20_approval_events
+ )
+ SELECT DISTINCT(block_number) FROM all_events
+ WHERE block_number NOT IN (SELECT number FROM raw.blocks)
+ ORDER BY block_number ASC LIMIT $1`,
+ [MAX_BLOCKS_PER_QUERY],
)) as MissingBlocksResponse[];
const blockNumberStrings = R.pluck('block_number', response);
const blockNumbers = R.map(parseInt, blockNumberStrings);
- console.log(`Found ${blockNumbers.length} missing blocks in the given range.`);
+ console.log(`Found ${blockNumbers.length} missing blocks.`);
return blockNumbers;
}
-async function getAndSaveBlocks(
+async function getAndSaveBlocksAsync(
web3Source: Web3Source,
blocksRepository: Repository<Block>,
blockNumbers: number[],
diff --git a/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts
new file mode 100644
index 000000000..c4dcf6c83
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts
@@ -0,0 +1,58 @@
+import { logUtils } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { OASIS_SOURCE, OasisMarket, OasisSource } from '../data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseOasisOrders } from '../parsers/oasis_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+// Number of markets to retrieve orderbooks for at once.
+const MARKET_ORDERBOOK_REQUEST_BATCH_SIZE = 50;
+
+// Delay between market orderbook requests.
+const MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY = 1000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const oasisSource = new OasisSource();
+ logUtils.log('Getting all active Oasis markets');
+ const markets = await oasisSource.getActiveMarketsAsync();
+ logUtils.log(`Got ${markets.length} markets.`);
+ for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
+ await Promise.all(
+ marketsChunk.map(async (market: OasisMarket) => getAndSaveMarketOrderbookAsync(oasisSource, market)),
+ );
+ await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
+ }
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Retrieve orderbook from Oasis API for a given market. Parse orders and insert
+ * them into our database.
+ * @param oasisSource Data source which can query Oasis API.
+ * @param marketId String identifying market we want data for. eg. 'REPAUG'.
+ */
+async function getAndSaveMarketOrderbookAsync(oasisSource: OasisSource, market: OasisMarket): Promise<void> {
+ logUtils.log(`${market.id}: Retrieving orderbook.`);
+ const orderBook = await oasisSource.getMarketOrderbookAsync(market.id);
+ const observedTimestamp = Date.now();
+
+ logUtils.log(`${market.id}: Parsing orders.`);
+ const orders = parseOasisOrders(orderBook, market, observedTimestamp, OASIS_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${market.id}: Saving ${orders.length} orders.`);
+ const TokenOrderRepository = connection.getRepository(TokenOrder);
+ await TokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${market.id}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
index 7377a64d8..d44eb5cc6 100644
--- a/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
+++ b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
@@ -11,7 +11,7 @@ import { fetchOHLCVTradingPairsAsync, TradingPair } from '../utils/get_ohlcv_tra
const SOURCE_NAME = 'CryptoCompare';
const TWO_HOURS_AGO = new Date().getTime() - 2 * 60 * 60 * 1000; // tslint:disable-line:custom-no-magic-numbers
-const MAX_CONCURRENT_REQUESTS = parseInt(process.env.CRYPTOCOMPARE_MAX_CONCURRENT_REQUESTS || '14', 10); // tslint:disable-line:custom-no-magic-numbers
+const MAX_REQS_PER_SECOND = parseInt(process.env.CRYPTOCOMPARE_MAX_REQS_PER_SECOND || '15', 10); // tslint:disable-line:custom-no-magic-numbers
const EARLIEST_BACKFILL_DATE = process.env.OHLCV_EARLIEST_BACKFILL_DATE || '2014-06-01';
const EARLIEST_BACKFILL_TIME = new Date(EARLIEST_BACKFILL_DATE).getTime();
@@ -20,7 +20,7 @@ let connection: Connection;
(async () => {
connection = await createConnection(ormConfig as ConnectionOptions);
const repository = connection.getRepository(OHLCVExternal);
- const source = new CryptoCompareOHLCVSource(MAX_CONCURRENT_REQUESTS);
+ const source = new CryptoCompareOHLCVSource(MAX_REQS_PER_SECOND);
const jobTime = new Date().getTime();
const tradingPairs = await fetchOHLCVTradingPairsAsync(connection, SOURCE_NAME, EARLIEST_BACKFILL_TIME);
@@ -63,7 +63,7 @@ async function fetchAndSaveAsync(
console.log(`Retrieved ${records.length} records for ${JSON.stringify(pair)}`);
if (records.length > 0) {
const metadata: OHLCVMetadata = {
- exchange: source.default_exchange,
+ exchange: source.defaultExchange,
fromSymbol: pair.fromSymbol,
toSymbol: pair.toSymbol,
source: SOURCE_NAME,
diff --git a/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts
index bae1fbede..34345f355 100644
--- a/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts
+++ b/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts
@@ -29,7 +29,7 @@ let connection: Connection;
const tokenInfoResponse = await paradexSource.getTokenInfoAsync();
const extendedMarkets = addTokenAddresses(markets, tokenInfoResponse);
await Promise.all(
- extendedMarkets.map(async (market: ParadexMarket) => getAndSaveMarketOrderbook(paradexSource, market)),
+ extendedMarkets.map(async (market: ParadexMarket) => getAndSaveMarketOrderbookAsync(paradexSource, market)),
);
process.exit(0);
})().catch(handleError);
@@ -70,7 +70,7 @@ function addTokenAddresses(
* @param paradexSource Data source which can query the Paradex API.
* @param market Object from the Paradex API with information about the market in question.
*/
-async function getAndSaveMarketOrderbook(paradexSource: ParadexSource, market: ParadexMarket): Promise<void> {
+async function getAndSaveMarketOrderbookAsync(paradexSource: ParadexSource, market: ParadexMarket): Promise<void> {
const paradexOrderbookResponse = await paradexSource.getMarketOrderbookAsync(market.symbol);
const observedTimestamp = Date.now();
diff --git a/packages/pipeline/src/scripts/pull_trusted_tokens.ts b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
index 1befc4437..5906deee6 100644
--- a/packages/pipeline/src/scripts/pull_trusted_tokens.ts
+++ b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
@@ -16,12 +16,12 @@ let connection: Connection;
(async () => {
connection = await createConnection(ormConfig as ConnectionOptions);
- await getMetamaskTrustedTokens();
- await getZeroExTrustedTokens();
+ await getMetamaskTrustedTokensAsync();
+ await getZeroExTrustedTokensAsync();
process.exit(0);
})().catch(handleError);
-async function getMetamaskTrustedTokens(): Promise<void> {
+async function getMetamaskTrustedTokensAsync(): Promise<void> {
// tslint:disable-next-line:no-console
console.log('Getting latest metamask trusted tokens list ...');
const trustedTokensRepository = connection.getRepository(TokenMetadata);
@@ -37,7 +37,7 @@ async function getMetamaskTrustedTokens(): Promise<void> {
console.log('Done saving metamask trusted tokens.');
}
-async function getZeroExTrustedTokens(): Promise<void> {
+async function getZeroExTrustedTokensAsync(): Promise<void> {
// tslint:disable-next-line:no-console
console.log('Getting latest 0x trusted tokens list ...');
const trustedTokensRepository = connection.getRepository(TokenMetadata);
diff --git a/packages/pipeline/src/scripts/update_relayer_info.ts b/packages/pipeline/src/scripts/update_relayer_info.ts
index f8918728d..41d29b385 100644
--- a/packages/pipeline/src/scripts/update_relayer_info.ts
+++ b/packages/pipeline/src/scripts/update_relayer_info.ts
@@ -17,11 +17,11 @@ let connection: Connection;
(async () => {
connection = await createConnection(ormConfig as ConnectionOptions);
- await getRelayers();
+ await getRelayersAsync();
process.exit(0);
})().catch(handleError);
-async function getRelayers(): Promise<void> {
+async function getRelayersAsync(): Promise<void> {
console.log('Getting latest relayer info...');
const relayerRepository = connection.getRepository(Relayer);
const relayerSource = new RelayerRegistrySource(RELAYER_REGISTRY_URL);
diff --git a/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts b/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts
index 9d3ef2fba..19f81344e 100644
--- a/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts
+++ b/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts
@@ -23,6 +23,18 @@ interface CryptoCompareCoin {
const TO_CURRENCIES = ['USD', 'EUR', 'ETH', 'USDT'];
const ETHEREUM_IDENTIFIER = '7605';
const HTTP_OK_STATUS = 200;
+
+interface StaticPair {
+ fromSymbol: string;
+ toSymbol: string;
+}
+const SPECIAL_CASES: StaticPair[] = [
+ {
+ fromSymbol: 'ETH',
+ toSymbol: 'USD',
+ },
+];
+
/**
* Get trading pairs with latest scraped time for OHLCV records
* @param conn a typeorm Connection to postgres
@@ -44,6 +56,7 @@ export async function fetchOHLCVTradingPairsAsync(
FROM raw.ohlcv_external
GROUP BY from_symbol, to_symbol;`);
+ // build addressable index: { fromsym: { tosym: time }}
const latestTradingPairsIndex: { [fromSym: string]: { [toSym: string]: number } } = {};
latestTradingPairs.forEach(pair => {
const latestIndex: { [toSym: string]: number } = latestTradingPairsIndex[pair.from_symbol] || {};
@@ -51,6 +64,13 @@ export async function fetchOHLCVTradingPairsAsync(
latestTradingPairsIndex[pair.from_symbol] = latestIndex;
});
+ // match time to special cases
+ const specialCases: TradingPair[] = SPECIAL_CASES.map(pair => {
+ const latestSavedTime =
+ R.path<number>([pair.fromSymbol, pair.toSymbol], latestTradingPairsIndex) || earliestBackfillTime;
+ return R.assoc('latestSavedTime', latestSavedTime, pair);
+ });
+
// get token symbols used by Crypto Compare
const allCoinsResp = await fetchAsync(COINLIST_API);
if (allCoinsResp.status !== HTTP_OK_STATUS) {
@@ -66,27 +86,31 @@ export async function fetchOHLCVTradingPairsAsync(
});
// fetch all tokens that are traded on 0x
- const rawTokenAddresses: Array<{ tokenaddress: string }> = await conn.query(
+ const rawEventTokenAddresses: Array<{ tokenaddress: string }> = await conn.query(
`SELECT DISTINCT(maker_token_address) as tokenaddress FROM raw.exchange_fill_events UNION
SELECT DISTINCT(taker_token_address) as tokenaddress FROM raw.exchange_fill_events`,
);
- const tokenAddresses = R.pluck('tokenaddress', rawTokenAddresses);
+
+ // tslint:disable-next-line:no-unbound-method
+ const eventTokenAddresses = R.pluck('tokenaddress', rawEventTokenAddresses).map(R.toLower);
// join token addresses with CC symbols
- const allTokenSymbols: string[] = tokenAddresses
- .map(tokenAddress => erc20CoinsIndex.get(tokenAddress.toLowerCase()) || '')
- .filter(x => x);
+ const eventTokenSymbols: string[] = eventTokenAddresses
+ .filter(tokenAddress => erc20CoinsIndex.has(tokenAddress))
+ .map(tokenAddress => erc20CoinsIndex.get(tokenAddress) as string);
- // generate list of all tokens with time of latest existing record OR default earliest time
- const allTradingPairCombinations: TradingPair[] = R.chain(sym => {
+ // join traded tokens with fiat and latest backfill time
+ const eventTradingPairs: TradingPair[] = R.chain(sym => {
return TO_CURRENCIES.map(fiat => {
- return {
+ const pair = {
fromSymbol: sym,
toSymbol: fiat,
latestSavedTime: R.path<number>([sym, fiat], latestTradingPairsIndex) || earliestBackfillTime,
};
+ return pair;
});
- }, allTokenSymbols);
+ }, eventTokenSymbols);
- return allTradingPairCombinations;
+ // join with special cases
+ return R.concat(eventTradingPairs, specialCases);
}
diff --git a/packages/pipeline/src/utils/index.ts b/packages/pipeline/src/utils/index.ts
index 2096a0a39..094c0178e 100644
--- a/packages/pipeline/src/utils/index.ts
+++ b/packages/pipeline/src/utils/index.ts
@@ -15,6 +15,21 @@ export function bigNumbertoStringOrNull(n: BigNumber): string | null {
}
/**
+ * If value is null or undefined, returns null. Otherwise converts value to a
+ * BigNumber.
+ * @param value A string or number to be converted to a BigNumber
+ */
+export function toBigNumberOrNull(value: string | number | null): BigNumber | null {
+ switch (value) {
+ case null:
+ case undefined:
+ return null;
+ default:
+ return new BigNumber(value);
+ }
+}
+
+/**
* Logs an error by intelligently checking for `message` and `stack` properties.
* Intended for use with top-level immediately invoked asynchronous functions.
* @param e the error to log.
diff --git a/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts b/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts
new file mode 100644
index 000000000..06f1a5e86
--- /dev/null
+++ b/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts
@@ -0,0 +1,109 @@
+// tslint:disable:custom-no-magic-numbers
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import 'mocha';
+
+import { _getEventsWithRetriesAsync } from '../../../src/data_sources/contract-wrappers/utils';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const retryableMessage = 'network timeout: (simulated network timeout error)';
+const retryableError = new Error(retryableMessage);
+
+describe('data_sources/contract-wrappers/utils', () => {
+ describe('_getEventsWithRetriesAsync', () => {
+ it('sends a single request if it was successful', async () => {
+ // Pre-declare values for the fromBlock and toBlock arguments.
+ const expectedFromBlock = 100;
+ const expectedToBlock = 200;
+ const expectedLogs: Array<LogWithDecodedArgs<any>> = [
+ {
+ logIndex: 123,
+ transactionIndex: 456,
+ transactionHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe',
+ blockHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657ff',
+ blockNumber: 789,
+ address: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd3365800',
+ data: 'fake raw data',
+ topics: [],
+ event: 'TEST_EVENT',
+ args: [1, 2, 3],
+ },
+ ];
+
+ // mockGetEventsAsync checks its arguments, increments `callCount`
+ // and returns `expectedLogs`.
+ let callCount = 0;
+ const mockGetEventsAsync = async (
+ fromBlock: number,
+ toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ expect(fromBlock).equals(expectedFromBlock);
+ expect(toBlock).equals(expectedToBlock);
+ callCount += 1;
+ return expectedLogs;
+ };
+
+ // Make sure that we get what we expected and that the mock function
+ // was called exactly once.
+ const gotLogs = await _getEventsWithRetriesAsync(mockGetEventsAsync, 3, expectedFromBlock, expectedToBlock);
+ expect(gotLogs).deep.equals(expectedLogs);
+ expect(callCount).equals(
+ 1,
+ 'getEventsAsync function was called more than once even though it was successful',
+ );
+ });
+ it('retries and eventually succeeds', async () => {
+ const numRetries = 5;
+ let callCount = 0;
+ // mockGetEventsAsync throws unless callCount == numRetries + 1.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ callCount += 1;
+ if (callCount === numRetries + 1) {
+ return [];
+ }
+ throw retryableError;
+ };
+ await _getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300);
+ expect(callCount).equals(numRetries + 1, 'getEventsAsync function was called the wrong number of times');
+ });
+ it('throws for non-retryable errors', async () => {
+ const numRetries = 5;
+ const expectedMessage = 'Non-retryable error';
+ // mockGetEventsAsync always throws a non-retryable error.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ throw new Error(expectedMessage);
+ };
+ // Note(albrow): This does actually return a promise (or at least a
+ // "promise-like object" and is a false positive in TSLint.
+ // tslint:disable-next-line:await-promise
+ await expect(_getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300)).to.be.rejectedWith(
+ expectedMessage,
+ );
+ });
+ it('throws after too many retries', async () => {
+ const numRetries = 5;
+ // mockGetEventsAsync always throws a retryable error.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ throw retryableError;
+ };
+ // Note(albrow): This does actually return a promise (or at least a
+ // "promise-like object" and is a false positive in TSLint.
+ // tslint:disable-next-line:await-promise
+ await expect(_getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300)).to.be.rejectedWith(
+ retryableMessage,
+ );
+ });
+ });
+});
diff --git a/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts b/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts
index cb374bbb1..2efe3f5ec 100644
--- a/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts
+++ b/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts
@@ -13,7 +13,7 @@ const expect = chai.expect;
describe('ohlcv_external data source (Crypto Compare)', () => {
describe('generateBackfillIntervals', () => {
it('generates pairs with intervals to query', () => {
- const source = new CryptoCompareOHLCVSource();
+ const source = new CryptoCompareOHLCVSource(20);
const pair: TradingPair = {
fromSymbol: 'ETH',
toSymbol: 'ZRX',
@@ -31,7 +31,7 @@ describe('ohlcv_external data source (Crypto Compare)', () => {
});
it('returns single pair if no backfill is needed', () => {
- const source = new CryptoCompareOHLCVSource();
+ const source = new CryptoCompareOHLCVSource(20);
const pair: TradingPair = {
fromSymbol: 'ETH',
toSymbol: 'ZRX',
diff --git a/packages/pipeline/test/entities/erc20_approval_events_test.ts b/packages/pipeline/test/entities/erc20_approval_events_test.ts
new file mode 100644
index 000000000..1ecf41ee5
--- /dev/null
+++ b/packages/pipeline/test/entities/erc20_approval_events_test.ts
@@ -0,0 +1,29 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import 'reflect-metadata';
+
+import { ERC20ApprovalEvent } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+// tslint:disable:custom-no-magic-numbers
+describe('ERC20ApprovalEvent entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const event = new ERC20ApprovalEvent();
+ event.tokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ event.blockNumber = 6281577;
+ event.rawData = '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9';
+ event.logIndex = 43;
+ event.transactionHash = '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f';
+ event.ownerAddress = '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04';
+ event.spenderAddress = '0x448a5065aebb8e423f0896e6c5d525c040f59af3';
+ event.amount = new BigNumber('50281464906893835769');
+ const blocksRepository = connection.getRepository(ERC20ApprovalEvent);
+ await testSaveAndFindEntityAsync(blocksRepository, event);
+ });
+});
diff --git a/packages/pipeline/test/parsers/bloxy/index_test.ts b/packages/pipeline/test/parsers/bloxy/index_test.ts
index 2b8d68f98..6aabb091d 100644
--- a/packages/pipeline/test/parsers/bloxy/index_test.ts
+++ b/packages/pipeline/test/parsers/bloxy/index_test.ts
@@ -7,7 +7,6 @@ import * as R from 'ramda';
import { BLOXY_DEX_TRADES_URL, BloxyTrade } from '../../../src/data_sources/bloxy';
import { DexTrade } from '../../../src/entities';
import { _parseBloxyTrade } from '../../../src/parsers/bloxy';
-import { _convertToExchangeFillEvent } from '../../../src/parsers/events';
import { chaiSetup } from '../../utils/chai_setup';
chaiSetup.configure();
diff --git a/packages/pipeline/test/parsers/ddex_orders/index_test.ts b/packages/pipeline/test/parsers/ddex_orders/index_test.ts
index 213100f44..4a4a86bf8 100644
--- a/packages/pipeline/test/parsers/ddex_orders/index_test.ts
+++ b/packages/pipeline/test/parsers/ddex_orders/index_test.ts
@@ -4,7 +4,7 @@ import 'mocha';
import { DdexMarket } from '../../../src/data_sources/ddex';
import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
-import { aggregateOrders, parseDdexOrder } from '../../../src/parsers/ddex_orders';
+import { parseDdexOrder } from '../../../src/parsers/ddex_orders';
import { OrderType } from '../../../src/types';
import { chaiSetup } from '../../utils/chai_setup';
@@ -13,19 +13,6 @@ const expect = chai.expect;
// tslint:disable:custom-no-magic-numbers
describe('ddex_orders', () => {
- describe('aggregateOrders', () => {
- it('aggregates orders by price point', () => {
- const input = [
- { price: '1', amount: '20', orderId: 'testtest' },
- { price: '1', amount: '30', orderId: 'testone' },
- { price: '2', amount: '100', orderId: 'testtwo' },
- ];
- const expected = [['1', new BigNumber(50)], ['2', new BigNumber(100)]];
- const actual = aggregateOrders(input);
- expect(actual).deep.equal(expected);
- });
- });
-
describe('parseDdexOrder', () => {
it('converts ddexOrder to TokenOrder entity', () => {
const ddexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
@@ -52,12 +39,14 @@ describe('ddex_orders', () => {
expected.observedTimestamp = observedTimestamp;
expected.orderType = 'bid';
expected.price = new BigNumber(0.5);
- expected.baseAssetSymbol = 'DEF';
- expected.baseAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
- expected.baseVolume = new BigNumber(5);
- expected.quoteAssetSymbol = 'ABC';
- expected.quoteAssetAddress = '0x0000000000000000000000000000000000000000';
- expected.quoteVolume = new BigNumber(10);
+ // ddex currently confuses base and quote assets.
+ // Switch them to maintain our internal consistency.
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
const actual = parseDdexOrder(ddexMarket, observedTimestamp, orderType, source, ddexOrder);
expect(actual).deep.equal(expected);
diff --git a/packages/pipeline/test/parsers/events/erc20_events_test.ts b/packages/pipeline/test/parsers/events/erc20_events_test.ts
new file mode 100644
index 000000000..962c50f98
--- /dev/null
+++ b/packages/pipeline/test/parsers/events/erc20_events_test.ts
@@ -0,0 +1,54 @@
+import { ERC20TokenApprovalEventArgs } from '@0x/contract-wrappers';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import 'mocha';
+
+import { ERC20ApprovalEvent } from '../../../src/entities';
+import { _convertToERC20ApprovalEvent } from '../../../src/parsers/events/erc20_events';
+import { _convertToExchangeFillEvent } from '../../../src/parsers/events/exchange_events';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('erc20_events', () => {
+ describe('_convertToERC20ApprovalEvent', () => {
+ it('converts LogWithDecodedArgs to ERC20ApprovalEvent entity', () => {
+ const input: LogWithDecodedArgs<ERC20TokenApprovalEventArgs> = {
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ blockHash: '0xd2d7aafaa7102aec0bca8ef026d5a85133e87892334c46ee1e92e42912991c9b',
+ blockNumber: 6281577,
+ data: '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9',
+ logIndex: 43,
+ topics: [
+ '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925',
+ '0x0000000000000000000000000b65c5f6f3a05d6be5588a72b603360773b3fe04',
+ '0x000000000000000000000000448a5065aebb8e423f0896e6c5d525c040f59af3',
+ ],
+ transactionHash: '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f',
+ transactionIndex: 103,
+ event: 'Approval',
+ args: {
+ _owner: '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04',
+ _spender: '0x448a5065aebb8e423f0896e6c5d525c040f59af3',
+ _value: new BigNumber('50281464906893835769'),
+ },
+ };
+
+ const expected = new ERC20ApprovalEvent();
+ expected.tokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.blockNumber = 6281577;
+ expected.rawData = '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9';
+ expected.logIndex = 43;
+ expected.transactionHash = '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f';
+ expected.ownerAddress = '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04';
+ expected.spenderAddress = '0x448a5065aebb8e423f0896e6c5d525c040f59af3';
+ expected.amount = new BigNumber('50281464906893835769');
+
+ const actual = _convertToERC20ApprovalEvent(input);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/events/index_test.ts b/packages/pipeline/test/parsers/events/exchange_events_test.ts
index 7e439ce39..5d4b185a5 100644
--- a/packages/pipeline/test/parsers/events/index_test.ts
+++ b/packages/pipeline/test/parsers/events/exchange_events_test.ts
@@ -5,7 +5,7 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import 'mocha';
import { ExchangeFillEvent } from '../../../src/entities';
-import { _convertToExchangeFillEvent } from '../../../src/parsers/events';
+import { _convertToExchangeFillEvent } from '../../../src/parsers/events/exchange_events';
import { chaiSetup } from '../../utils/chai_setup';
chaiSetup.configure();
diff --git a/packages/pipeline/test/parsers/idex_orders/index_test.ts b/packages/pipeline/test/parsers/idex_orders/index_test.ts
new file mode 100644
index 000000000..d54ecb9a8
--- /dev/null
+++ b/packages/pipeline/test/parsers/idex_orders/index_test.ts
@@ -0,0 +1,87 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { IdexOrderParam } from '../../../src/data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseIdexOrder } from '../../../src/parsers/idex_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('idex_orders', () => {
+ describe('parseIdexOrder', () => {
+ // for market listed as 'DEF_ABC'.
+ it('correctly converts bid type idexOrder to TokenOrder entity', () => {
+ const idexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const idexOrderParam: IdexOrderParam = {
+ tokenBuy: '0x0000000000000000000000000000000000000000',
+ buySymbol: 'ABC',
+ buyPrecision: 2,
+ amountBuy: '10',
+ tokenSell: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ sellSymbol: 'DEF',
+ sellPrecision: 2,
+ amountSell: '5',
+ expires: Date.now() + 100000,
+ nonce: 1,
+ user: '0x212345667543456435324564345643453453333',
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = 'bid';
+ const source: string = 'idex';
+
+ const expected = new TokenOrder();
+ expected.source = 'idex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = 'bid';
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseIdexOrder(idexOrderParam, observedTimestamp, orderType, source, idexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ it('correctly converts ask type idexOrder to TokenOrder entity', () => {
+ const idexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const idexOrderParam: IdexOrderParam = {
+ tokenBuy: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ buySymbol: 'DEF',
+ buyPrecision: 2,
+ amountBuy: '5',
+ tokenSell: '0x0000000000000000000000000000000000000000',
+ sellSymbol: 'ABC',
+ sellPrecision: 2,
+ amountSell: '10',
+ expires: Date.now() + 100000,
+ nonce: 1,
+ user: '0x212345667543456435324564345643453453333',
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = 'ask';
+ const source: string = 'idex';
+
+ const expected = new TokenOrder();
+ expected.source = 'idex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = 'ask';
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseIdexOrder(idexOrderParam, observedTimestamp, orderType, source, idexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/oasis_orders/index_test.ts b/packages/pipeline/test/parsers/oasis_orders/index_test.ts
new file mode 100644
index 000000000..433bfb665
--- /dev/null
+++ b/packages/pipeline/test/parsers/oasis_orders/index_test.ts
@@ -0,0 +1,49 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { OasisMarket } from '../../../src/data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseOasisOrder } from '../../../src/parsers/oasis_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('oasis_orders', () => {
+ describe('parseOasisOrder', () => {
+ it('converts oasisOrder to TokenOrder entity', () => {
+ const oasisOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const oasisMarket: OasisMarket = {
+ id: 'ABCDEF',
+ base: 'DEF',
+ quote: 'ABC',
+ buyVol: 100,
+ sellVol: 200,
+ price: 1,
+ high: 1,
+ low: 0,
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = 'bid';
+ const source: string = 'oasis';
+
+ const expected = new TokenOrder();
+ expected.source = 'oasis';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = 'bid';
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'DEF';
+ expected.baseAssetAddress = null;
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'ABC';
+ expected.quoteAssetAddress = null;
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseOasisOrder(oasisMarket, observedTimestamp, orderType, source, oasisOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/paradex_orders/index_test.ts b/packages/pipeline/test/parsers/paradex_orders/index_test.ts
index 1522806bf..6b811b90d 100644
--- a/packages/pipeline/test/parsers/paradex_orders/index_test.ts
+++ b/packages/pipeline/test/parsers/paradex_orders/index_test.ts
@@ -42,10 +42,10 @@ describe('paradex_orders', () => {
expected.price = new BigNumber(0.1245);
expected.baseAssetSymbol = 'DEF';
expected.baseAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
- expected.baseVolume = new BigNumber(412 * 0.1245);
+ expected.baseVolume = new BigNumber(412);
expected.quoteAssetSymbol = 'ABC';
expected.quoteAssetAddress = '0x0000000000000000000000000000000000000000';
- expected.quoteVolume = new BigNumber(412);
+ expected.quoteVolume = new BigNumber(412 * 0.1245);
const actual = parseParadexOrder(paradexMarket, observedTimestamp, orderType, source, paradexOrder);
expect(actual).deep.equal(expected);
diff --git a/packages/pipeline/test/parsers/utils/index_test.ts b/packages/pipeline/test/parsers/utils/index_test.ts
new file mode 100644
index 000000000..5a0d0f182
--- /dev/null
+++ b/packages/pipeline/test/parsers/utils/index_test.ts
@@ -0,0 +1,30 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { aggregateOrders, GenericRawOrder } from '../../../src/parsers/utils';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('aggregateOrders', () => {
+ it('aggregates order by price point', () => {
+ const input = [
+ { price: '1', amount: '20', orderHash: 'testtest', total: '20' },
+ { price: '1', amount: '30', orderHash: 'testone', total: '30' },
+ { price: '2', amount: '100', orderHash: 'testtwo', total: '200' },
+ ];
+ const expected = [['1', new BigNumber(50)], ['2', new BigNumber(100)]];
+ const actual = aggregateOrders(input);
+ expect(actual).deep.equal(expected);
+ });
+
+ it('handles empty orders gracefully', () => {
+ const input: GenericRawOrder[] = [];
+ const expected: Array<[string, BigNumber]> = [];
+ const actual = aggregateOrders(input);
+ expect(actual).deep.equal(expected);
+ });
+});
diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json
index d456a3b53..9d8b5bc88 100644
--- a/packages/react-docs/CHANGELOG.json
+++ b/packages/react-docs/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.22",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.21",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "1.0.20",
"changes": [
diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md
index e48f43fb8..5c702d562 100644
--- a/packages/react-docs/CHANGELOG.md
+++ b/packages/react-docs/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.22 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.21 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.20 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json
index 968ac4e34..f58a51c90 100644
--- a/packages/react-docs/package.json
+++ b/packages/react-docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-docs",
- "version": "1.0.20",
+ "version": "1.0.22",
"engines": {
"node": ">=6.12"
},
@@ -24,8 +24,8 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"@types/compare-versions": "^3.0.0",
"@types/styled-components": "^4.0.0",
"make-promises-safe": "^1.1.0",
@@ -34,9 +34,9 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/react-shared": "^1.0.23",
- "@0x/types": "^1.3.0",
- "@0x/utils": "^2.0.6",
+ "@0x/react-shared": "^1.0.25",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
"@types/lodash": "4.14.104",
"@types/material-ui": "^0.20.0",
"@types/node": "*",
diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json
index a376bae29..23e0d7f7e 100644
--- a/packages/react-shared/CHANGELOG.json
+++ b/packages/react-shared/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.25",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.24",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "1.0.23",
"changes": [
diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md
index a983e0af2..8afa94e04 100644
--- a/packages/react-shared/CHANGELOG.md
+++ b/packages/react-shared/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.25 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.24 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.23 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index b5816ad98..17defe35a 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-shared",
- "version": "1.0.23",
+ "version": "1.0.25",
"engines": {
"node": ">=6.12"
},
@@ -25,15 +25,15 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "^5.9.1",
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.3.0",
+ "@0x/types": "^1.4.1",
"@material-ui/core": "^3.0.1",
"@types/is-mobile": "0.3.0",
"@types/lodash": "4.14.104",
diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json
index fe077b6cc..0a757f519 100644
--- a/packages/sol-compiler/CHANGELOG.json
+++ b/packages/sol-compiler/CHANGELOG.json
@@ -1,12 +1,22 @@
[
{
+ "version": "1.1.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "1.1.15",
"changes": [
{
"note": "Fix bug where we were appending base path to absolute imports (e.g NPM imports)",
"pr": 1311
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"timestamp": 1543401373,
diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md
index a1782bb3b..b2066448d 100644
--- a/packages/sol-compiler/CHANGELOG.md
+++ b/packages/sol-compiler/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.15 - _December 11, 2018_
+
+ * Fix bug where we were appending base path to absolute imports (e.g NPM imports) (#1311)
+
## v1.1.14 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index d27c0ee31..0ad620b1f 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-compiler",
- "version": "1.1.14",
+ "version": "1.1.16",
"engines": {
"node": ">=6.12"
},
@@ -42,8 +42,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"@types/mkdirp": "^0.5.2",
"@types/require-from-string": "^1.2.0",
"@types/semver": "^5.5.0",
@@ -65,16 +65,16 @@
"zeppelin-solidity": "1.8.0"
},
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/json-schemas": "^2.1.2",
- "@0x/sol-resolver": "^1.0.17",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/sol-resolver": "^1.1.1",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/yargs": "^11.0.0",
"chalk": "^2.3.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index cba67f292..85df8209e 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -400,7 +400,7 @@ export class Compiler {
* while others are absolute ("Token.sol", "@0x/contracts/Wallet.sol")
* And we need to append the base path for relative imports.
*/
- importPath = path.resolve('/' + contractFolder, importPath).replace('/', '');
+ importPath = path.resolve(`/${contractFolder}`, importPath).replace('/', '');
}
if (_.isUndefined(sourcesToAppendTo[importPath])) {
diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json
index bc8aa71e1..b7973c135 100644
--- a/packages/sol-cov/CHANGELOG.json
+++ b/packages/sol-cov/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.1.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "2.1.14",
"changes": [
diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md
index 25ba93026..879ef9c95 100644
--- a/packages/sol-cov/CHANGELOG.md
+++ b/packages/sol-cov/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.15 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.1.14 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index 73c11980f..3ade51c80 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-cov",
- "version": "2.1.14",
+ "version": "2.1.16",
"engines": {
"node": ">=6.12"
},
@@ -42,14 +42,14 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": {
- "@0x/dev-utils": "^1.0.19",
- "@0x/sol-compiler": "^1.1.14",
- "@0x/subproviders": "^2.1.6",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/solidity-parser-antlr": "^0.2.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"glob": "^7.1.2",
"istanbul": "^0.4.5",
@@ -61,7 +61,7 @@
"solidity-parser-antlr": "^0.2.12"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/istanbul": "^0.4.30",
"@types/loglevel": "^1.5.3",
"@types/mkdirp": "^0.5.1",
diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json
index 332aeb025..e8fef746e 100644
--- a/packages/sol-doc/CHANGELOG.json
+++ b/packages/sol-doc/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.11",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "1.0.9",
"changes": [
diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md
index 5a1df59c7..1b4a938af 100644
--- a/packages/sol-doc/CHANGELOG.md
+++ b/packages/sol-doc/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.11 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.10 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.9 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json
index edf1707d6..c83c122df 100644
--- a/packages/sol-doc/package.json
+++ b/packages/sol-doc/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-doc",
- "version": "1.0.9",
+ "version": "1.0.11",
"description": "Solidity documentation generator",
"main": "lib/src/index.js",
"types": "lib/src/index.d.js",
@@ -25,16 +25,16 @@
"author": "F. Eugene Aumson",
"license": "Apache-2.0",
"dependencies": {
- "@0x/sol-compiler": "^1.1.14",
- "@0x/types": "^1.3.0",
- "@0x/utils": "^2.0.6",
- "ethereum-types": "^1.1.2",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.10",
"yargs": "^12.0.2"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.2",
diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json
index 4c9e612d7..85398e624 100644
--- a/packages/sol-resolver/CHANGELOG.json
+++ b/packages/sol-resolver/CHANGELOG.json
@@ -1,12 +1,22 @@
[
{
+ "version": "1.1.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "1.1.0",
"changes": [
{
"note": "NPMResolver now supports scoped packages",
"pr": 1311
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"timestamp": 1542821676,
diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md
index b83275e5a..98435be19 100644
--- a/packages/sol-resolver/CHANGELOG.md
+++ b/packages/sol-resolver/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.0 - _December 11, 2018_
+
+ * NPMResolver now supports scoped packages (#1311)
+
## v1.0.17 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
index 5c5eec2cf..0163765d9 100644
--- a/packages/sol-resolver/package.json
+++ b/packages/sol-resolver/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-resolver",
- "version": "1.0.17",
+ "version": "1.1.1",
"engines": {
"node": ">=6.12"
},
@@ -23,15 +23,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json
index 49d1f1c83..393054465 100644
--- a/packages/sra-spec/CHANGELOG.json
+++ b/packages/sra-spec/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.0.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.12",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1542821676,
"version": "1.0.11",
"changes": [
diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md
index 77b22515f..fd673b837 100644
--- a/packages/sra-spec/CHANGELOG.md
+++ b/packages/sra-spec/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.13 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.12 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.0.11 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json
index 1623e2574..3a6ee96d3 100644
--- a/packages/sra-spec/package.json
+++ b/packages/sra-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sra-spec",
- "version": "1.0.11",
+ "version": "1.0.13",
"engines": {
"node": ">=6.12"
},
@@ -35,11 +35,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md",
"dependencies": {
- "@0x/json-schemas": "^2.1.2",
+ "@0x/json-schemas": "^2.1.4",
"@loopback/openapi-v3-types": "^0.8.2"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/mocha": "^2.2.42",
"@types/node": "^10.5.3",
"chai": "^4.0.1",
diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json
index 6da170be3..938b2a717 100644
--- a/packages/subproviders/CHANGELOG.json
+++ b/packages/subproviders/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.1.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"timestamp": 1543401373,
"version": "2.1.6",
"changes": [
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 01dd8d652..002c76395 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.7 - _December 11, 2018_
+
+ * Dependencies updated
+
## v2.1.6 - _November 28, 2018_
* Dependencies updated
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 86f3738af..90ef6b677 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/subproviders",
- "version": "2.1.6",
+ "version": "2.1.8",
"engines": {
"node": ">=6.12"
},
@@ -29,11 +29,11 @@
}
},
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/assert": "^1.0.20",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@ledgerhq/hw-app-eth": "^4.3.0",
"@ledgerhq/hw-transport-u2f": "4.24.0",
"@types/eth-lightwallet": "^3.0.0",
@@ -43,7 +43,7 @@
"bip39": "^2.5.0",
"bn.js": "^4.11.8",
"eth-lightwallet": "^3.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1",
"ganache-core": "^2.2.1",
@@ -54,7 +54,7 @@
"web3-provider-engine": "14.0.6"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/bip39": "^2.4.0",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-tx": "^1.0.0",
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index 8c4b942a3..70d785c74 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0x/testnet-faucets",
- "version": "1.0.58",
+ "version": "1.0.60",
"engines": {
"node": ">=6.12"
},
@@ -18,13 +18,13 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^2.0.6",
- "@0x/subproviders": "^2.1.6",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "0x.js": "^2.0.8",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"body-parser": "^1.17.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1",
"express": "^4.15.2",
@@ -32,7 +32,7 @@
"rollbar": "^0.6.5"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/body-parser": "^1.16.1",
"@types/express": "^4.0.35",
"@types/lodash": "4.14.104",
diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json
index 9f504216c..0070a5b81 100644
--- a/packages/tslint-config/CHANGELOG.json
+++ b/packages/tslint-config/CHANGELOG.json
@@ -1,5 +1,15 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Improve async-suffix rule to check functions too, not just methods",
+ "pr": 1425
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "1.0.10",
"changes": [
{
diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md
index f5cacb5d1..3cebb1e95 100644
--- a/packages/tslint-config/CHANGELOG.md
+++ b/packages/tslint-config/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.0 - _December 13, 2018_
+
+ * Improve async-suffix rule to check functions too, not just methods (#1425)
+
## v1.0.10 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
index 2914f31e2..64ec1e967 100644
--- a/packages/tslint-config/package.json
+++ b/packages/tslint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/tslint-config",
- "version": "1.0.10",
+ "version": "2.0.0",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/tslint-config/rules/walkers/async_suffix.ts b/packages/tslint-config/rules/walkers/async_suffix.ts
index eaec9c5f6..4e12152e8 100644
--- a/packages/tslint-config/rules/walkers/async_suffix.ts
+++ b/packages/tslint-config/rules/walkers/async_suffix.ts
@@ -3,24 +3,33 @@ import * as Lint from 'tslint';
import * as ts from 'typescript';
export class AsyncSuffixWalker extends Lint.RuleWalker {
- public static FAILURE_STRING = 'async functions must have an Async suffix';
+ public static FAILURE_STRING = 'async functions/methods must have an Async suffix';
+ public visitFunctionDeclaration(node: ts.FunctionDeclaration): void {
+ this._visitFunctionOrMethodDeclaration(node);
+ super.visitFunctionDeclaration(node);
+ }
public visitMethodDeclaration(node: ts.MethodDeclaration): void {
- const methodNameNode = node.name;
- const methodName = methodNameNode.getText();
- if (!_.isUndefined(node.type)) {
- if (node.type.kind === ts.SyntaxKind.TypeReference) {
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
- if (returnTypeName === 'Promise' && !methodName.endsWith('Async')) {
- const failure = this.createFailure(
- methodNameNode.getStart(),
- methodNameNode.getWidth(),
- AsyncSuffixWalker.FAILURE_STRING,
- );
- this.addFailure(failure);
+ this._visitFunctionOrMethodDeclaration(node);
+ super.visitMethodDeclaration(node);
+ }
+ private _visitFunctionOrMethodDeclaration(node: ts.MethodDeclaration | ts.FunctionDeclaration): void {
+ const nameNode = node.name;
+ if (!_.isUndefined(nameNode)) {
+ const name = nameNode.getText();
+ if (!_.isUndefined(node.type)) {
+ if (node.type.kind === ts.SyntaxKind.TypeReference) {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
+ if (returnTypeName === 'Promise' && !name.endsWith('Async')) {
+ const failure = this.createFailure(
+ nameNode.getStart(),
+ nameNode.getWidth(),
+ AsyncSuffixWalker.FAILURE_STRING,
+ );
+ this.addFailure(failure);
+ }
}
}
}
- super.visitMethodDeclaration(node);
}
}
diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json
index fd1849dd0..e8de6221e 100644
--- a/packages/tslint-config/tslint.json
+++ b/packages/tslint-config/tslint.json
@@ -92,6 +92,7 @@
"prefer-function-over-method": true,
"prefer-object-spread": true,
"prefer-readonly": true,
+ "prefer-template": true,
"promise-function-async": true,
"quotemark": [true, "single", "avoid-escape", "jsx-double"],
"restrict-plus-operands": true,
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json
index b09859101..f1cd2f18e 100644
--- a/packages/types/CHANGELOG.json
+++ b/packages/types/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.4.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "1.4.0",
"changes": [
{
@@ -10,7 +19,8 @@
"note": "Add RevertReasons for DutchAuction contract",
"pr": 1225
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"version": "1.3.0",
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index f133c05f1..5170eb4db 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.4.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.4.0 - _December 11, 2018_
+
+ * Add `LengthMismatch` and `LengthGreaterThan3Required` revert reasons (#1224)
+ * Add RevertReasons for DutchAuction contract (#1225)
+
## v1.3.0 - _November 21, 2018_
* Add the `SimpleContractArtifact` type, which describes the artifact format published in the `@0x/contract-artifacts` package (#1298)
diff --git a/packages/types/package.json b/packages/types/package.json
index 46e268a66..3c4bb6fe6 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/types",
- "version": "1.3.0",
+ "version": "1.4.1",
"engines": {
"node": ">=6.12"
},
@@ -23,7 +23,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
@@ -32,7 +32,7 @@
"dependencies": {
"@types/node": "*",
"bignumber.js": "~4.1.0",
- "ethereum-types": "^1.1.2"
+ "ethereum-types": "^1.1.4"
},
"publishConfig": {
"access": "public"
diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json
index 5653b397d..fadf5ad14 100644
--- a/packages/typescript-typings/CHANGELOG.json
+++ b/packages/typescript-typings/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "3.0.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "3.0.4",
"changes": [
{
diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md
index 62e6665be..1663d40af 100644
--- a/packages/typescript-typings/CHANGELOG.md
+++ b/packages/typescript-typings/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.6 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.5 - _December 11, 2018_
+
+ * Dependencies updated
+
## v3.0.4 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json
index 9dbbe1370..c67b660c8 100644
--- a/packages/typescript-typings/package.json
+++ b/packages/typescript-typings/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/typescript-typings",
- "version": "3.0.4",
+ "version": "3.0.6",
"engines": {
"node": ">=6.12"
},
@@ -27,7 +27,7 @@
"@types/bn.js": "^4.11.0",
"@types/react": "*",
"bignumber.js": "~4.1.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"popper.js": "1.14.3"
},
"devDependencies": {
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index 08801a891..fe66d3f31 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,13 +1,22 @@
[
{
- "timestamp": 1543448882,
+ "version": "2.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "2.0.7",
"changes": [
{
"note":
"Optimized ABI Encoder/Decoder. Generates compressed calldata to save gas. Generates human-readable calldata to aid development."
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"timestamp": 1542821676,
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index c5c42161a..c0437392d 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.7 - _December 11, 2018_
+
+ * Optimized ABI Encoder/Decoder. Generates compressed calldata to save gas. Generates human-readable calldata to aid development.
+
## v2.0.6 - _November 21, 2018_
* Dependencies updated
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 1f4d85843..a25dc9cff 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/utils",
- "version": "2.0.6",
+ "version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/detect-node": "2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -44,13 +44,13 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
"@types/node": "*",
"abortcontroller-polyfill": "^1.1.9",
"bignumber.js": "~4.1.0",
"detect-node": "2.0.3",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"isomorphic-fetch": "^2.2.1",
@@ -60,4 +60,4 @@
"publishConfig": {
"access": "public"
}
-} \ No newline at end of file
+}
diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts
index 598ea5fcc..3e6fc9665 100644
--- a/packages/utils/src/abi_utils.ts
+++ b/packages/utils/src/abi_utils.ts
@@ -26,7 +26,7 @@ function parseEthersParams(params: DataItem[]): { names: ParamName[]; types: str
const result = parseEthersParams(param.components);
names.push({ name: param.name || null, names: result.names });
- types.push('tuple(' + result.types.join(',') + ')' + suffix);
+ types.push(`tuple(${result.types.join(',')})${suffix}`);
} else {
names.push(param.name || null);
types.push(param.type);
@@ -120,7 +120,7 @@ function splitTupleTypes(type: string): string[] {
if (_.endsWith(type, '[]')) {
throw new Error('Internal error: array types are not supported');
} else if (!_.startsWith(type, 'tuple(')) {
- throw new Error('Internal error: expected tuple type but got non-tuple type: ' + type);
+ throw new Error(`Internal error: expected tuple type but got non-tuple type: ${type}`);
}
// Trim the outtermost tuple().
const trimmedType = type.substring('tuple('.length, type.length - 1);
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
index 9ef80a560..7185851a8 100644
--- a/packages/utils/test/abi_encoder/evm_data_types_test.ts
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -901,7 +901,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Construct args to be encoded
// Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
const bytesLength = 40;
- const args = '0x' + '61'.repeat(bytesLength);
+ const args = `0x${'61'.repeat(bytesLength)}`;
// Encode Args and validate result
const encodedArgs = dataType.encode(args, encodingRules);
const expectedEncodedArgs =
@@ -993,7 +993,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Construct args to be encoded
// Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
const strLength = 40;
- const args = '0x' + 'a'.repeat(strLength);
+ const args = `0x${'a'.repeat(strLength)}`;
// Encode Args and validate result
const encodedArgs = dataType.encode(args, encodingRules);
const expectedEncodedArgs =
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index ed484c8e8..6b76626a9 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,12 +1,22 @@
[
{
+ "version": "3.2.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "3.2.0",
"changes": [
{
"note": "Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors",
"pr": 1402
}
- ]
+ ],
+ "timestamp": 1544570656
},
{
"version": "3.1.6",
diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md
index fffaf1d0a..76ca80e69 100644
--- a/packages/web3-wrapper/CHANGELOG.md
+++ b/packages/web3-wrapper/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.2.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.2.0 - _December 11, 2018_
+
+ * Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors (#1402)
+
## v3.1.6 - _November 28, 2018_
* Unmarshall mined transaction receipts (#1308)
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 218d85bfc..e5af24965 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/web3-wrapper",
- "version": "3.1.6",
+ "version": "3.2.1",
"engines": {
"node": ">=6.12"
},
@@ -36,7 +36,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/ganache-core": "^2.1.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
@@ -54,11 +54,11 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/assert": "^1.0.18",
- "@0x/json-schemas": "^2.1.2",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "ethereum-types": "^1.1.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
diff --git a/packages/website/package.json b/packages/website/package.json
index 5d2e563e9..c24a0ba6e 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/website",
- "version": "0.0.61",
+ "version": "0.0.63",
"engines": {
"node": ">=6.12"
},
@@ -20,24 +20,24 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "@0x/asset-buyer": "^3.0.2",
+ "@0x/asset-buyer": "^3.0.4",
"@0x/contract-addresses": "^2.0.0",
- "@0x/contract-wrappers": "^4.1.1",
- "@0x/json-schemas": "^2.1.2",
- "@0x/order-utils": "^3.0.4",
- "@0x/react-docs": "^1.0.20",
- "@0x/react-shared": "^1.0.23",
- "@0x/subproviders": "^2.1.6",
- "@0x/types": "^1.3.0",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.6",
- "@0x/web3-wrapper": "^3.1.6",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/react-docs": "^1.0.22",
+ "@0x/react-shared": "^1.0.25",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"accounting": "^0.4.1",
"basscss": "^8.0.3",
"blockies": "^0.0.2",
"bowser": "^1.9.3",
"deep-equal": "^1.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"find-versions": "^2.0.0",
"jsonschema": "^1.2.0",
diff --git a/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg b/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg
new file mode 100644
index 000000000..e9c9278a8
--- /dev/null
+++ b/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg
@@ -0,0 +1,3 @@
+<svg width="32" height="39" viewBox="0 0 32 39" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M16 1L1 23.242H16L16.0412 38L31 15.7159H16V1Z" stroke="#3289F1" stroke-width="1.5" stroke-miterlimit="10" stroke-linejoin="round"/>
+</svg>
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 78f29d0f6..2914ffead 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -92,6 +92,9 @@
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
+ "INTEGRATE_0X_INSTANT": "add seamless purchasing of crypto assets to your website or app",
+ "INTEGRATE_0X_INSTANT_DESCRIPTION":
+ "learn how to use 0x Instant or AssetBuyer to give your users the power of purchasing crypto assets using 0x",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",
diff --git a/packages/website/ts/components/documentation/sidebar_header.tsx b/packages/website/ts/components/documentation/sidebar_header.tsx
index 9ced52c74..0ab24ab5e 100644
--- a/packages/website/ts/components/documentation/sidebar_header.tsx
+++ b/packages/website/ts/components/documentation/sidebar_header.tsx
@@ -24,7 +24,7 @@ export const SidebarHeader: React.StatelessComponent<SidebarHeaderProps> = ({
return (
<Container>
<Container className="flex justify-bottom">
- <Container className="left pl1" width="150px">
+ <Container className="col col-7 pl1">
<Text
fontColor={colors.lightLinkBlue}
fontSize={screenWidth === ScreenWidths.Sm ? '20px' : '22px'}
@@ -37,12 +37,14 @@ export const SidebarHeader: React.StatelessComponent<SidebarHeaderProps> = ({
{!_.isUndefined(docsVersion) &&
!_.isUndefined(availableDocVersions) &&
!_.isUndefined(onVersionSelected) && (
- <div className="right" style={{ alignSelf: 'flex-end', paddingBottom: 4 }}>
- <VersionDropDown
- selectedVersion={docsVersion}
- versions={availableDocVersions}
- onVersionSelected={onVersionSelected}
- />
+ <div className="col col-5 pl1" style={{ alignSelf: 'flex-end', paddingBottom: 4 }}>
+ <Container className="right">
+ <VersionDropDown
+ selectedVersion={docsVersion}
+ versions={availableDocVersions}
+ onVersionSelected={onVersionSelected}
+ />
+ </Container>
</div>
)}
</Container>
diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts
index ac92e6a22..683e1fe9f 100644
--- a/packages/website/ts/containers/order_watcher_documentation.ts
+++ b/packages/website/ts/containers/order_watcher_documentation.ts
@@ -24,7 +24,7 @@ const docsInfoConfig: DocsInfoConfig = {
id: DocPackages.OrderWatcher,
packageName: '@0x/order-watcher',
type: SupportedDocJson.TypeDoc,
- displayName: 'OrderWatcher',
+ displayName: 'Order Watcher',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
markdownMenu: {
'getting-started': [markdownSections.introduction, markdownSections.installation],
diff --git a/packages/website/ts/pages/documentation/docs_home.tsx b/packages/website/ts/pages/documentation/docs_home.tsx
index f68d2892f..9dc779e96 100644
--- a/packages/website/ts/pages/documentation/docs_home.tsx
+++ b/packages/website/ts/pages/documentation/docs_home.tsx
@@ -44,6 +44,14 @@ const TUTORIALS: TutorialInfo[] = [
to: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
},
},
+ {
+ iconUrl: '/images/developers/tutorials/integrate_0x_instant.svg',
+ description: Key.Integrate0xInstantDescription,
+ link: {
+ title: Key.Integrate0xInstant,
+ to: `${WebsitePaths.Wiki}#Get-Started-With-Instant`,
+ },
+ },
];
const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index b20dd7095..2967fdac5 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -474,6 +474,8 @@ export enum Key {
OrderBasicsDescription = 'ORDER_BASICS_DESCRIPTION',
UseNetworkedLiquidity = 'USE_NETWORKED_LIQUIDITY',
UseNetworkedLiquidityDescription = 'USE_NETWORKED_LIQUIDITY_DESCRIPTION',
+ Integrate0xInstant = 'INTEGRATE_0X_INSTANT',
+ Integrate0xInstantDescription = 'INTEGRATE_0X_INSTANT_DESCRIPTION',
ViewAllDocumentation = 'VIEW_ALL_DOCUMENTATION',
Sandbox = 'SANDBOX',
Github = 'GITHUB',
diff --git a/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py b/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
index 1dcfb39a9..4681315a8 100644
--- a/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
+++ b/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
@@ -80,8 +80,6 @@ def assert_is_provider(value: Any, name: str) -> None:
If `value` isn't a Web3 provider, raise a TypeError.
"""
- # TODO: make this provider check more flexible.
- # https://app.asana.com/0/684263176955174/901300863045491/f
if not isinstance(value, BaseProvider):
raise TypeError(
f"Expected variable '{name}' to be an instance of a Web3 provider,"
diff --git a/python-packages/sra_client/README.md b/python-packages/sra_client/README.md
new file mode 100644
index 000000000..ab3939b41
--- /dev/null
+++ b/python-packages/sra_client/README.md
@@ -0,0 +1,303 @@
+# 0x-sra-client
+
+A Python client for interacting with servers conforming to [the Standard Relayer API specification](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-spec).
+
+# Schemas
+
+The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the 0x.js library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).
+
+# Pagination
+
+Requests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:
+
+```bash
+$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20
+```
+
+Page numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.
+
+All endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.
+
+These requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.
+
+# Network Id
+
+All requests should be able to specify a **?networkId** query param for all supported networks. For example:
+
+```bash
+$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1
+```
+
+If the query param is not provided, it should default to **1** (mainnet).
+
+Networks and their Ids:
+
+| Network Id | Network Name |
+| ---------- | ------------ |
+| 1 | Mainnet |
+| 42 | Kovan |
+| 3 | Ropsten |
+| 4 | Rinkeby |
+
+If a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:
+
+```json
+{
+ \"code\": 100,
+ \"reason\": \"Validation failed\",
+ \"validationErrors\": [
+ {
+ \"field\": \"networkId\",
+ \"code\": 1006,
+ \"reason\": \"Network id 42 is not supported\"
+ }
+ ]
+}
+```
+
+# Link Header
+
+A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging
+For example:
+
+```bash
+Link: <https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20>; rel=\"next\",
+<https://api.github.com/user/repos?page=10&perPage=20>; rel=\"last\"
+```
+
+This `Link` response header contains one or more Hypermedia link relations.
+
+The possible `rel` values are:
+
+| Name | Description |
+| ----- | ------------------------------------------------------------- |
+| next | The link relation for the immediate next page of results. |
+| last | The link relation for the last page of results. |
+| first | The link relation for the first page of results. |
+| prev | The link relation for the immediate previous page of results. |
+
+# Rate Limits
+
+Rate limit guidance for clients can be optionally returned in the response headers:
+
+| Header Name | Description |
+| --------------------- | ---------------------------------------------------------------------------- |
+| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |
+| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
+| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |
+
+For example:
+
+```bash
+$ curl -i https://api.example-relayer.com/v2/asset_pairs
+HTTP/1.1 200 OK
+Date: Mon, 20 Oct 2017 12:30:06 GMT
+Status: 200 OK
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 56
+X-RateLimit-Reset: 1372700873
+```
+
+When a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.
+
+# Errors
+
+Unless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.
+
+## Common error codes
+
+| Code | Reason |
+| ---- | --------------------------------------- |
+| 400 | Bad Request – Invalid request format |
+| 404 | Not found |
+| 429 | Too many requests - Rate limit exceeded |
+| 500 | Internal Server Error |
+| 501 | Not Implemented |
+
+## Error reporting format
+
+For all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).
+
+```json
+{
+ \"code\": 101,
+ \"reason\": \"Validation failed\",
+ \"validationErrors\": [
+ {
+ \"field\": \"maker\",
+ \"code\": 1002,
+ \"reason\": \"Invalid address\"
+ }
+ ]
+}
+```
+
+General error codes:
+
+```bash
+100 - Validation Failed
+101 - Malformed JSON
+102 - Order submission disabled
+103 - Throttled
+```
+
+Validation error codes:
+
+```bash
+1000 - Required field
+1001 - Incorrect format
+1002 - Invalid address
+1003 - Address not supported
+1004 - Value out of range
+1005 - Invalid signature or hash
+1006 - Unsupported option
+```
+
+# Asset Data Encoding
+
+As we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).
+
+The identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).
+
+```js
+// ERC20 Proxy ID 0xf47261b0
+bytes4(keccak256('ERC20Token(address)'));
+// ERC721 Proxy ID 0x02571792
+bytes4(keccak256('ERC721Token(address,uint256)'));
+```
+
+Asset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).
+
+For example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:
+
+```bash
+0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48
+```
+
+Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x02571792) would be:
+
+```bash
+0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063
+```
+
+For more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).
+
+# Meta Data in Order Responses
+
+In v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.
+
+A good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).
+
+# Misc.
+
+* All requests and responses should be of **application/json** content type
+* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).
+* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.
+* All parameters are to be written in `lowerCamelCase`.
+
+This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+* API version: 2.0.0
+* Package version: 1.0.0
+* Build package: org.openapitools.codegen.languages.PythonClientCodegen
+
+## Requirements.
+
+Python 2.7 and 3.4+
+
+## Installation & Usage
+
+### pip install
+
+If the python package is hosted on Github, you can install directly from Github
+
+```sh
+pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
+```
+
+(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
+
+Then import the package:
+
+```python
+import sra_client
+```
+
+### Setuptools
+
+Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
+
+```sh
+python setup.py install --user
+```
+
+(or `sudo python setup.py install` to install the package for all users)
+
+Then import the package:
+
+```python
+import sra_client
+```
+
+## Getting Started
+
+Please follow the [installation procedure](#installation--usage) and then run the following:
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi(sra_client.ApiClient(configuration))
+asset_data_a = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | The assetData value for the first asset in the pair. (optional)
+asset_data_b = 0x0257179264389b814a946f3e92105513705ca6b990 # str | The assetData value for the second asset in the pair. (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_asset_pairs: %s\n" % e)
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to _http://localhost_
+
+| Class | Method | HTTP request | Description |
+| ------------ | --------------------------------------------------------------- | ----------------------------- | ----------- |
+| _DefaultApi_ | [**get_asset_pairs**](docs/DefaultApi.md#get_asset_pairs) | **GET** /v2/asset_pairs |
+| _DefaultApi_ | [**get_fee_recipients**](docs/DefaultApi.md#get_fee_recipients) | **GET** /v2/fee_recipients |
+| _DefaultApi_ | [**get_order**](docs/DefaultApi.md#get_order) | **GET** /v2/order/{orderHash} |
+| _DefaultApi_ | [**get_order_config**](docs/DefaultApi.md#get_order_config) | **POST** /v2/order_config |
+| _DefaultApi_ | [**get_orderbook**](docs/DefaultApi.md#get_orderbook) | **GET** /v2/orderbook |
+| _DefaultApi_ | [**get_orders**](docs/DefaultApi.md#get_orders) | **GET** /v2/orders |
+| _DefaultApi_ | [**post_order**](docs/DefaultApi.md#post_order) | **POST** /v2/order |
+
+## Documentation For Models
+
+* [OrderSchema](docs/OrderSchema.md)
+* [PaginatedCollectionSchema](docs/PaginatedCollectionSchema.md)
+* [RelayerApiAssetDataPairsResponseSchema](docs/RelayerApiAssetDataPairsResponseSchema.md)
+* [RelayerApiAssetDataTradeInfoSchema](docs/RelayerApiAssetDataTradeInfoSchema.md)
+* [RelayerApiErrorResponseSchema](docs/RelayerApiErrorResponseSchema.md)
+* [RelayerApiErrorResponseSchemaValidationErrors](docs/RelayerApiErrorResponseSchemaValidationErrors.md)
+* [RelayerApiFeeRecipientsResponseSchema](docs/RelayerApiFeeRecipientsResponseSchema.md)
+* [RelayerApiOrderConfigPayloadSchema](docs/RelayerApiOrderConfigPayloadSchema.md)
+* [RelayerApiOrderConfigResponseSchema](docs/RelayerApiOrderConfigResponseSchema.md)
+* [RelayerApiOrderSchema](docs/RelayerApiOrderSchema.md)
+* [RelayerApiOrderbookResponseSchema](docs/RelayerApiOrderbookResponseSchema.md)
+* [RelayerApiOrdersChannelSubscribePayloadSchema](docs/RelayerApiOrdersChannelSubscribePayloadSchema.md)
+* [RelayerApiOrdersChannelSubscribeSchema](docs/RelayerApiOrdersChannelSubscribeSchema.md)
+* [RelayerApiOrdersChannelUpdateSchema](docs/RelayerApiOrdersChannelUpdateSchema.md)
+* [RelayerApiOrdersResponseSchema](docs/RelayerApiOrdersResponseSchema.md)
+* [SignedOrderSchema](docs/SignedOrderSchema.md)
+
+## Documentation For Authorization
+
+All endpoints do not require authorization.
diff --git a/python-packages/sra_client/docs/DefaultApi.md b/python-packages/sra_client/docs/DefaultApi.md
new file mode 100644
index 000000000..942188bc6
--- /dev/null
+++ b/python-packages/sra_client/docs/DefaultApi.md
@@ -0,0 +1,397 @@
+# sra_client.DefaultApi
+
+All URIs are relative to _http://localhost_
+
+| Method | HTTP request | Description |
+| ---------------------------------------------------------- | ----------------------------- | ----------- |
+| [**get_asset_pairs**](DefaultApi.md#get_asset_pairs) | **GET** /v2/asset_pairs |
+| [**get_fee_recipients**](DefaultApi.md#get_fee_recipients) | **GET** /v2/fee_recipients |
+| [**get_order**](DefaultApi.md#get_order) | **GET** /v2/order/{orderHash} |
+| [**get_order_config**](DefaultApi.md#get_order_config) | **POST** /v2/order_config |
+| [**get_orderbook**](DefaultApi.md#get_orderbook) | **GET** /v2/orderbook |
+| [**get_orders**](DefaultApi.md#get_orders) | **GET** /v2/orders |
+| [**post_order**](DefaultApi.md#post_order) | **POST** /v2/order |
+
+# **get_asset_pairs**
+
+> RelayerApiAssetDataPairsResponseSchema get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+asset_data_a = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | The assetData value for the first asset in the pair. (optional)
+asset_data_b = 0x0257179264389b814a946f3e92105513705ca6b990 # str | The assetData value for the second asset in the pair. (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_asset_pairs: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---------------- | --------- | ----------------------------------------------------- | -------------------------- |
+| **asset_data_a** | **str** | The assetData value for the first asset in the pair. | [optional] |
+| **asset_data_b** | **str** | The assetData value for the second asset in the pair. | [optional] |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiAssetDataPairsResponseSchema**](RelayerApiAssetDataPairsResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_fee_recipients**
+
+> RelayerApiFeeRecipientsResponseSchema get_fee_recipients(network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_fee_recipients(network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_fee_recipients: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | ---------------------------------------------------- | -------------------------- |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiFeeRecipientsResponseSchema**](RelayerApiFeeRecipientsResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_order**
+
+> RelayerApiOrderSchema get_order(order_hash, network_id=network_id)
+
+Retrieves the 0x order with meta info that is associated with the hash.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+order_hash = 0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591 # str | The hash of the desired 0x order.
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+
+try:
+ api_response = api_instance.get_order(order_hash, network_id=network_id)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_order: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | --------------------------------- | ------------------------ |
+| **order_hash** | **str** | The hash of the desired 0x order. |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+
+### Return type
+
+[**RelayerApiOrderSchema**](RelayerApiOrderSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_order_config**
+
+> RelayerApiOrderConfigResponseSchema get_order_config(network_id=network_id, relayer_api_order_config_payload_schema=relayer_api_order_config_payload_schema)
+
+Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+relayer_api_order_config_payload_schema = {"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"1","makerAssetData":"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498","takerAssetData":"0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"} # RelayerApiOrderConfigPayloadSchema | The fields of a 0x order the relayer may want to decide what configuration to send back. (optional)
+
+try:
+ api_response = api_instance.get_order_config(network_id=network_id, relayer_api_order_config_payload_schema=relayer_api_order_config_payload_schema)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_order_config: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------------------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------ |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **relayer_api_order_config_payload_schema** | [**RelayerApiOrderConfigPayloadSchema**](RelayerApiOrderConfigPayloadSchema.md) | The fields of a 0x order the relayer may want to decide what configuration to send back. | [optional] |
+
+### Return type
+
+[**RelayerApiOrderConfigResponseSchema**](RelayerApiOrderConfigResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: application/json
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_orderbook**
+
+> RelayerApiOrderbookResponseSchema get_orderbook(base_asset_data, quote_asset_data, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` \* `perPage` > `total` for a certain collection, the `records` for that collection should just be empty.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+base_asset_data = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.
+quote_asset_data = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_orderbook(base_asset_data, quote_asset_data, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_orderbook: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
+| **base_asset_data** | **str** | assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. |
+| **quote_asset_data** | **str** | assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiOrderbookResponseSchema**](RelayerApiOrderbookResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_orders**
+
+> RelayerApiOrdersResponseSchema get_orders(maker_asset_proxy_id=maker_asset_proxy_id, taker_asset_proxy_id=taker_asset_proxy_id, maker_asset_address=maker_asset_address, taker_asset_address=taker_asset_address, exchange_address=exchange_address, sender_address=sender_address, maker_asset_data=maker_asset_data, taker_asset_data=taker_asset_data, trader_asset_data=trader_asset_data, maker_address=maker_address, taker_address=taker_address, trader_address=trader_address, fee_recipient_address=fee_recipient_address, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+maker_asset_proxy_id = 0xf47261b0 # str | The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721). (optional)
+taker_asset_proxy_id = 0x02571792 # str | The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721). (optional)
+maker_asset_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | The contract address for the maker asset. (optional)
+taker_asset_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | The contract address for the taker asset. (optional)
+exchange_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+sender_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+maker_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+taker_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+trader_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+maker_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+taker_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+trader_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+fee_recipient_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_orders(maker_asset_proxy_id=maker_asset_proxy_id, taker_asset_proxy_id=taker_asset_proxy_id, maker_asset_address=maker_asset_address, taker_asset_address=taker_asset_address, exchange_address=exchange_address, sender_address=sender_address, maker_asset_data=maker_asset_data, taker_asset_data=taker_asset_data, trader_asset_data=trader_asset_data, maker_address=maker_address, taker_address=taker_address, trader_address=trader_address, fee_recipient_address=fee_recipient_address, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_orders: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
+| **maker_asset_proxy_id** | **str** | The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \&quot;0xf47261b0\&quot; for ERC20, \&quot;0x02571792\&quot; for ERC721). | [optional] |
+| **taker_asset_proxy_id** | **str** | The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \&quot;0xf47261b0\&quot; for ERC20, \&quot;0x02571792\&quot; for ERC721). | [optional] |
+| **maker_asset_address** | **str** | The contract address for the maker asset. | [optional] |
+| **taker_asset_address** | **str** | The contract address for the taker asset. | [optional] |
+| **exchange_address** | **str** | Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **sender_address** | **str** | Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **maker_asset_data** | **str** | Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **taker_asset_data** | **str** | Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **trader_asset_data** | **str** | Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **maker_address** | **str** | Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **taker_address** | **str** | Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **trader_address** | **str** | Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **fee_recipient_address** | **str** | Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **post_order**
+
+> post_order(network_id=network_id, signed_order_schema=signed_order_schema)
+
+Submit a signed order to the relayer.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+signed_order_schema = {"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498","takerAssetData":"0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"} # SignedOrderSchema | A valid signed 0x order based on the schema. (optional)
+
+try:
+ api_instance.post_order(network_id=network_id, signed_order_schema=signed_order_schema)
+except ApiException as e:
+ print("Exception when calling DefaultApi->post_order: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ----------------------- | --------------------------------------------- | -------------------------------------------- | ------------------------ |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **signed_order_schema** | [**SignedOrderSchema**](SignedOrderSchema.md) | A valid signed 0x order based on the schema. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: application/json
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/OrderSchema.md b/python-packages/sra_client/docs/OrderSchema.md
new file mode 100644
index 000000000..5378c95f4
--- /dev/null
+++ b/python-packages/sra_client/docs/OrderSchema.md
@@ -0,0 +1,21 @@
+# OrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------------- | ------- | ----------- | ----- |
+| **maker_address** | **str** | |
+| **taker_address** | **str** | |
+| **maker_fee** | **str** | |
+| **taker_fee** | **str** | |
+| **sender_address** | **str** | |
+| **maker_asset_amount** | **str** | |
+| **taker_asset_amount** | **str** | |
+| **maker_asset_data** | **str** | |
+| **taker_asset_data** | **str** | |
+| **salt** | **str** | |
+| **exchange_address** | **str** | |
+| **fee_recipient_address** | **str** | |
+| **expiration_time_seconds** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/PaginatedCollectionSchema.md b/python-packages/sra_client/docs/PaginatedCollectionSchema.md
new file mode 100644
index 000000000..969cbf7b5
--- /dev/null
+++ b/python-packages/sra_client/docs/PaginatedCollectionSchema.md
@@ -0,0 +1,11 @@
+# PaginatedCollectionSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------ | --------- | ----------- | ----- |
+| **total** | **float** | |
+| **per_page** | **float** | |
+| **page** | **float** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md b/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md
new file mode 100644
index 000000000..0e87e8dc0
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiAssetDataPairsResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ---------------- | ----------- | ----- |
+| **records** | **list[object]** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md b/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md
new file mode 100644
index 000000000..15de4e4ad
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiAssetDataTradeInfoSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | ----------- | ---------- |
+| **asset_data** | **str** | |
+| **min_amount** | **str** | | [optional] |
+| **max_amount** | **str** | | [optional] |
+| **precision** | **float** | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md b/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md
new file mode 100644
index 000000000..11e3b32a9
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md
@@ -0,0 +1,11 @@
+# RelayerApiErrorResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------- | ----------------------------------------------------------------------------------------------------------- | ----------- | ---------- |
+| **code** | **int** | |
+| **reason** | **str** | |
+| **validation_errors** | [**list[RelayerApiErrorResponseSchemaValidationErrors]**](RelayerApiErrorResponseSchemaValidationErrors.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md b/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md
new file mode 100644
index 000000000..2147b3822
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md
@@ -0,0 +1,11 @@
+# RelayerApiErrorResponseSchemaValidationErrors
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---------- | ------- | ----------- | ----- |
+| **field** | **str** | |
+| **code** | **int** | |
+| **reason** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md b/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md
new file mode 100644
index 000000000..f12582a81
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiFeeRecipientsResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ------------- | ----------- | ----- |
+| **records** | **list[str]** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md b/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md
new file mode 100644
index 000000000..ee0800066
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md
@@ -0,0 +1,16 @@
+# RelayerApiOrderConfigPayloadSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------------- | ------- | ----------- | ----- |
+| **maker_address** | **str** | |
+| **taker_address** | **str** | |
+| **maker_asset_amount** | **str** | |
+| **taker_asset_amount** | **str** | |
+| **maker_asset_data** | **str** | |
+| **taker_asset_data** | **str** | |
+| **exchange_address** | **str** | |
+| **expiration_time_seconds** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md
new file mode 100644
index 000000000..2ebafdf47
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrderConfigResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------------------- | ------- | ----------- | ----- |
+| **maker_fee** | **str** | |
+| **taker_fee** | **str** | |
+| **fee_recipient_address** | **str** | |
+| **sender_address** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderSchema.md b/python-packages/sra_client/docs/RelayerApiOrderSchema.md
new file mode 100644
index 000000000..bbdffe2f4
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderSchema.md
@@ -0,0 +1,10 @@
+# RelayerApiOrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------- | --------------------------------- | ----------- | ----- |
+| **order** | [**OrderSchema**](OrderSchema.md) | |
+| **meta_data** | [**object**](.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md
new file mode 100644
index 000000000..6fb7c88ff
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md
@@ -0,0 +1,10 @@
+# RelayerApiOrderbookResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------- | ----------------------------------------------------------------------- | ----------- | ----- |
+| **bids** | [**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md) | |
+| **asks** | [**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md
new file mode 100644
index 000000000..97c2cbc21
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md
@@ -0,0 +1,16 @@
+# RelayerApiOrdersChannelSubscribePayloadSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------------------ | --------- | ----------- | ---------- |
+| **maker_asset_proxy_id** | **str** | | [optional] |
+| **taker_asset_proxy_id** | **str** | | [optional] |
+| **network_id** | **float** | | [optional] |
+| **maker_asset_address** | **str** | | [optional] |
+| **taker_asset_address** | **str** | | [optional] |
+| **maker_asset_data** | **str** | | [optional] |
+| **taker_asset_data** | **str** | | [optional] |
+| **trader_asset_data** | **str** | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md
new file mode 100644
index 000000000..5e1c96c24
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrdersChannelSubscribeSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | ----------------------------------------------------------------------------------------------------- | ----------- | ---------- |
+| **type** | **str** | |
+| **channel** | **str** | |
+| **request_id** | **str** | |
+| **payload** | [**RelayerApiOrdersChannelSubscribePayloadSchema**](RelayerApiOrdersChannelSubscribePayloadSchema.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md
new file mode 100644
index 000000000..8d763367a
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrdersChannelUpdateSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | ----------------------------------------------------------- | ----------- | ---------- |
+| **type** | **str** | |
+| **channel** | **str** | |
+| **request_id** | **str** | |
+| **payload** | [**list[RelayerApiOrderSchema]**](RelayerApiOrderSchema.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md
new file mode 100644
index 000000000..8989d346b
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiOrdersResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ----------------------------------------------------------- | ----------- | ----- |
+| **records** | [**list[RelayerApiOrderSchema]**](RelayerApiOrderSchema.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/SignedOrderSchema.md b/python-packages/sra_client/docs/SignedOrderSchema.md
new file mode 100644
index 000000000..4c753e6cc
--- /dev/null
+++ b/python-packages/sra_client/docs/SignedOrderSchema.md
@@ -0,0 +1,9 @@
+# SignedOrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------- | ------- | ----------- | ----- |
+| **signature** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/generate.sh b/python-packages/sra_client/generate.sh
new file mode 100755
index 000000000..91967dee3
--- /dev/null
+++ b/python-packages/sra_client/generate.sh
@@ -0,0 +1,26 @@
+# This file provided not so much to be run but rather more for posterity, as a
+# record of how this generated code was produced.
+
+GENERATOR_JAR=http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.4/openapi-generator-cli-3.3.4.jar
+GENERATOR_JAR_BASENAME=$(basename $GENERATOR_JAR)
+
+if [ -f $GENERATOR_JAR_BASENAME ]; then
+ if [ "$(openssl dgst -sha256 $GENERATOR_JAR_BASENAME)" \
+ != "SHA256($GENERATOR_JAR_BASENAME)= 24cb04939110cffcdd7062d2f50c6f61159dc3e0ca3b8aecbae6ade53ad3dc8c" \
+ ]; then
+ rm $GENERATOR_JAR_BASENAME
+ fi
+fi
+
+if [ ! -f $GENERATOR_JAR_BASENAME ]; then
+ wget $GENERATOR_JAR
+fi
+
+PYTHON_POST_PROCESS_FILE="black --line-length 79" \
+ java -jar openapi-generator-cli-3.3.4.jar \
+ generate \
+ --input-spec http://unpkg.com/@0x/sra-spec@1.0.11/lib/api.json \
+ --output . \
+ --generator-name python \
+ --config openapi-generator-cli-config.json \
+ --enable-post-process-file
diff --git a/python-packages/sra_client/openapi-generator-cli-config.json b/python-packages/sra_client/openapi-generator-cli-config.json
new file mode 100644
index 000000000..cc619e465
--- /dev/null
+++ b/python-packages/sra_client/openapi-generator-cli-config.json
@@ -0,0 +1,4 @@
+{
+ "packageName": "sra_client",
+ "projectName": "0x-sra-client"
+}
diff --git a/python-packages/sra_client/requirements.txt b/python-packages/sra_client/requirements.txt
new file mode 100644
index 000000000..bafdc0753
--- /dev/null
+++ b/python-packages/sra_client/requirements.txt
@@ -0,0 +1,5 @@
+certifi >= 14.05.14
+six >= 1.10
+python_dateutil >= 2.5.3
+setuptools >= 21.0.0
+urllib3 >= 1.15.1
diff --git a/python-packages/sra_client/setup.py b/python-packages/sra_client/setup.py
new file mode 100755
index 000000000..b47f71ae7
--- /dev/null
+++ b/python-packages/sra_client/setup.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+
+import subprocess
+import distutils.command.build_py
+
+from setuptools import setup, find_packages # noqa: H301
+
+NAME = "0x-sra-client"
+VERSION = "1.0.0"
+# To install the library, run the following
+#
+# python setup.py install
+#
+# prerequisite: setuptools
+# http://pypi.python.org/pypi/setuptools
+
+with open("README.md", "r") as file_handle:
+ README_MD = file_handle.read()
+
+REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
+
+class TestPublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to test.pypi.org."""
+
+ description = (
+ "Publish dist/* to test.pypi.org. Run sdist & bdist_wheel first."
+ )
+
+ def run(self):
+ """Run twine to upload to test.pypi.org."""
+ subprocess.check_call( # nosec
+ (
+ "twine upload --repository-url https://test.pypi.org/legacy/"
+ + " --verbose dist/*"
+ ).split()
+ )
+
+
+class PublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to pypi.org."""
+
+ description = "Publish dist/* to pypi.org. Run sdist & bdist_wheel first."
+
+ def run(self):
+ """Run twine to upload to pypi.org."""
+ subprocess.check_call("twine upload dist/*".split()) # nosec
+
+
+setup(
+ name=NAME,
+ version=VERSION,
+ description="Standard Relayer REST API",
+ author_email="",
+ url="https://github.com/0xproject/0x-monorepo/python-packages/sra_client",
+ keywords=["OpenAPI", "OpenAPI-Generator", "Standard Relayer REST API"],
+ install_requires=REQUIRES,
+ packages=find_packages(),
+ include_package_data=True,
+ long_description=README_MD,
+ long_description_content_type="text/markdown",
+ cmdclass={
+ "test_publish": TestPublishCommand,
+ "publish": PublishCommand,
+ },
+)
diff --git a/python-packages/sra_client/sra_client/__init__.py b/python-packages/sra_client/sra_client/__init__.py
new file mode 100644
index 000000000..fc02976a5
--- /dev/null
+++ b/python-packages/sra_client/sra_client/__init__.py
@@ -0,0 +1,59 @@
+# coding: utf-8
+
+# flake8: noqa
+
+
+from __future__ import absolute_import
+
+__version__ = "1.0.0"
+
+# import apis into sdk package
+from sra_client.api.default_api import DefaultApi
+
+# import ApiClient
+from sra_client.api_client import ApiClient
+from sra_client.configuration import Configuration
+
+# import models into sdk package
+from sra_client.models.order_schema import OrderSchema
+from sra_client.models.paginated_collection_schema import (
+ PaginatedCollectionSchema,
+)
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema,
+)
+from sra_client.models.relayer_api_asset_data_trade_info_schema import (
+ RelayerApiAssetDataTradeInfoSchema,
+)
+from sra_client.models.relayer_api_error_response_schema import (
+ RelayerApiErrorResponseSchema,
+)
+from sra_client.models.relayer_api_error_response_schema_validation_errors import (
+ RelayerApiErrorResponseSchemaValidationErrors,
+)
+from sra_client.models.relayer_api_fee_recipients_response_schema import (
+ RelayerApiFeeRecipientsResponseSchema,
+)
+from sra_client.models.relayer_api_order_config_payload_schema import (
+ RelayerApiOrderConfigPayloadSchema,
+)
+from sra_client.models.relayer_api_order_config_response_schema import (
+ RelayerApiOrderConfigResponseSchema,
+)
+from sra_client.models.relayer_api_order_schema import RelayerApiOrderSchema
+from sra_client.models.relayer_api_orderbook_response_schema import (
+ RelayerApiOrderbookResponseSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_payload_schema import (
+ RelayerApiOrdersChannelSubscribePayloadSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_schema import (
+ RelayerApiOrdersChannelSubscribeSchema,
+)
+from sra_client.models.relayer_api_orders_channel_update_schema import (
+ RelayerApiOrdersChannelUpdateSchema,
+)
+from sra_client.models.relayer_api_orders_response_schema import (
+ RelayerApiOrdersResponseSchema,
+)
+from sra_client.models.signed_order_schema import SignedOrderSchema
diff --git a/python-packages/sra_client/sra_client/api/__init__.py b/python-packages/sra_client/sra_client/api/__init__.py
new file mode 100644
index 000000000..b7b206bb1
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api/__init__.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+
+# flake8: noqa
+
+# import apis into api package
+from sra_client.api.default_api import DefaultApi
diff --git a/python-packages/sra_client/sra_client/api/default_api.py b/python-packages/sra_client/sra_client/api/default_api.py
new file mode 100644
index 000000000..2d65db609
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api/default_api.py
@@ -0,0 +1,976 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import re # noqa: F401
+
+# python 2 and python 3 compatibility library
+import six
+
+from sra_client.api_client import ApiClient
+
+
+class DefaultApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def get_asset_pairs(self, **kwargs): # noqa: E501
+ """get_asset_pairs # noqa: E501
+
+ Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_asset_pairs(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str asset_data_a: The assetData value for the first asset in the pair.
+ :param str asset_data_b: The assetData value for the second asset in the pair.
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiAssetDataPairsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_asset_pairs_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_asset_pairs_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_asset_pairs_with_http_info(self, **kwargs): # noqa: E501
+ """get_asset_pairs # noqa: E501
+
+ Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_asset_pairs_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str asset_data_a: The assetData value for the first asset in the pair.
+ :param str asset_data_b: The assetData value for the second asset in the pair.
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiAssetDataPairsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "asset_data_a",
+ "asset_data_b",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_asset_pairs" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "asset_data_a" in local_var_params:
+ query_params.append(
+ ("assetDataA", local_var_params["asset_data_a"])
+ ) # noqa: E501
+ if "asset_data_b" in local_var_params:
+ query_params.append(
+ ("assetDataB", local_var_params["asset_data_b"])
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/asset_pairs",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiAssetDataPairsResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_fee_recipients(self, **kwargs): # noqa: E501
+ """get_fee_recipients # noqa: E501
+
+ Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination). # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_fee_recipients(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiFeeRecipientsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_fee_recipients_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_fee_recipients_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_fee_recipients_with_http_info(self, **kwargs): # noqa: E501
+ """get_fee_recipients # noqa: E501
+
+ Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination). # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_fee_recipients_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiFeeRecipientsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["network_id", "page", "per_page"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_fee_recipients" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/fee_recipients",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiFeeRecipientsResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_order(self, order_hash, **kwargs): # noqa: E501
+ """get_order # noqa: E501
+
+ Retrieves the 0x order with meta info that is associated with the hash. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order(order_hash, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str order_hash: The hash of the desired 0x order. (required)
+ :param float network_id: The id of the Ethereum network
+ :return: RelayerApiOrderSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_order_with_http_info(
+ order_hash, **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_order_with_http_info(
+ order_hash, **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_order_with_http_info(self, order_hash, **kwargs): # noqa: E501
+ """get_order # noqa: E501
+
+ Retrieves the 0x order with meta info that is associated with the hash. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_with_http_info(order_hash, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str order_hash: The hash of the desired 0x order. (required)
+ :param float network_id: The id of the Ethereum network
+ :return: RelayerApiOrderSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["order_hash", "network_id"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_order" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+ # verify the required parameter 'order_hash' is set
+ if (
+ "order_hash" not in local_var_params
+ or local_var_params["order_hash"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `order_hash` when calling `get_order`"
+ ) # noqa: E501
+
+ collection_formats = {}
+
+ path_params = {}
+ if "order_hash" in local_var_params:
+ path_params["orderHash"] = local_var_params[
+ "order_hash"
+ ] # noqa: E501
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order/{orderHash}",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_order_config(self, **kwargs): # noqa: E501
+ """get_order_config # noqa: E501
+
+ Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_config(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param RelayerApiOrderConfigPayloadSchema relayer_api_order_config_payload_schema: The fields of a 0x order the relayer may want to decide what configuration to send back.
+ :return: RelayerApiOrderConfigResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_order_config_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_order_config_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_order_config_with_http_info(self, **kwargs): # noqa: E501
+ """get_order_config # noqa: E501
+
+ Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_config_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param RelayerApiOrderConfigPayloadSchema relayer_api_order_config_payload_schema: The fields of a 0x order the relayer may want to decide what configuration to send back.
+ :return: RelayerApiOrderConfigResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "network_id",
+ "relayer_api_order_config_payload_schema",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_order_config" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ if "relayer_api_order_config_payload_schema" in local_var_params:
+ body_params = local_var_params[
+ "relayer_api_order_config_payload_schema"
+ ]
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # HTTP header `Content-Type`
+ header_params[
+ "Content-Type"
+ ] = self.api_client.select_header_content_type( # noqa: E501
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order_config",
+ "POST",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderConfigResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_orderbook(
+ self, base_asset_data, quote_asset_data, **kwargs
+ ): # noqa: E501
+ """get_orderbook # noqa: E501
+
+ Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orderbook(base_asset_data, quote_asset_data, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str base_asset_data: assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. (required)
+ :param str quote_asset_data: assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). (required)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrderbookResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_orderbook_with_http_info(
+ base_asset_data, quote_asset_data, **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_orderbook_with_http_info(
+ base_asset_data, quote_asset_data, **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_orderbook_with_http_info(
+ self, base_asset_data, quote_asset_data, **kwargs
+ ): # noqa: E501
+ """get_orderbook # noqa: E501
+
+ Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orderbook_with_http_info(base_asset_data, quote_asset_data, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str base_asset_data: assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. (required)
+ :param str quote_asset_data: assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). (required)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrderbookResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "base_asset_data",
+ "quote_asset_data",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_orderbook" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+ # verify the required parameter 'base_asset_data' is set
+ if (
+ "base_asset_data" not in local_var_params
+ or local_var_params["base_asset_data"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `base_asset_data` when calling `get_orderbook`"
+ ) # noqa: E501
+ # verify the required parameter 'quote_asset_data' is set
+ if (
+ "quote_asset_data" not in local_var_params
+ or local_var_params["quote_asset_data"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `quote_asset_data` when calling `get_orderbook`"
+ ) # noqa: E501
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "base_asset_data" in local_var_params:
+ query_params.append(
+ ("baseAssetData", local_var_params["base_asset_data"])
+ ) # noqa: E501
+ if "quote_asset_data" in local_var_params:
+ query_params.append(
+ ("quoteAssetData", local_var_params["quote_asset_data"])
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/orderbook",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderbookResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_orders(self, **kwargs): # noqa: E501
+ """get_orders # noqa: E501
+
+ Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orders(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str maker_asset_proxy_id: The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str taker_asset_proxy_id: The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str maker_asset_address: The contract address for the maker asset.
+ :param str taker_asset_address: The contract address for the taker asset.
+ :param str exchange_address: Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str sender_address: Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_asset_data: Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_asset_data: Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_asset_data: Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_address: Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_address: Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_address: Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str fee_recipient_address: Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrdersResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_orders_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_orders_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def get_orders_with_http_info(self, **kwargs): # noqa: E501
+ """get_orders # noqa: E501
+
+ Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orders_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str maker_asset_proxy_id: The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str taker_asset_proxy_id: The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str maker_asset_address: The contract address for the maker asset.
+ :param str taker_asset_address: The contract address for the taker asset.
+ :param str exchange_address: Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str sender_address: Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_asset_data: Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_asset_data: Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_asset_data: Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_address: Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_address: Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_address: Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str fee_recipient_address: Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrdersResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "maker_asset_proxy_id",
+ "taker_asset_proxy_id",
+ "maker_asset_address",
+ "taker_asset_address",
+ "exchange_address",
+ "sender_address",
+ "maker_asset_data",
+ "taker_asset_data",
+ "trader_asset_data",
+ "maker_address",
+ "taker_address",
+ "trader_address",
+ "fee_recipient_address",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_orders" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "maker_asset_proxy_id" in local_var_params:
+ query_params.append(
+ ("makerAssetProxyId", local_var_params["maker_asset_proxy_id"])
+ ) # noqa: E501
+ if "taker_asset_proxy_id" in local_var_params:
+ query_params.append(
+ ("takerAssetProxyId", local_var_params["taker_asset_proxy_id"])
+ ) # noqa: E501
+ if "maker_asset_address" in local_var_params:
+ query_params.append(
+ ("makerAssetAddress", local_var_params["maker_asset_address"])
+ ) # noqa: E501
+ if "taker_asset_address" in local_var_params:
+ query_params.append(
+ ("takerAssetAddress", local_var_params["taker_asset_address"])
+ ) # noqa: E501
+ if "exchange_address" in local_var_params:
+ query_params.append(
+ ("exchangeAddress", local_var_params["exchange_address"])
+ ) # noqa: E501
+ if "sender_address" in local_var_params:
+ query_params.append(
+ ("senderAddress", local_var_params["sender_address"])
+ ) # noqa: E501
+ if "maker_asset_data" in local_var_params:
+ query_params.append(
+ ("makerAssetData", local_var_params["maker_asset_data"])
+ ) # noqa: E501
+ if "taker_asset_data" in local_var_params:
+ query_params.append(
+ ("takerAssetData", local_var_params["taker_asset_data"])
+ ) # noqa: E501
+ if "trader_asset_data" in local_var_params:
+ query_params.append(
+ ("traderAssetData", local_var_params["trader_asset_data"])
+ ) # noqa: E501
+ if "maker_address" in local_var_params:
+ query_params.append(
+ ("makerAddress", local_var_params["maker_address"])
+ ) # noqa: E501
+ if "taker_address" in local_var_params:
+ query_params.append(
+ ("takerAddress", local_var_params["taker_address"])
+ ) # noqa: E501
+ if "trader_address" in local_var_params:
+ query_params.append(
+ ("traderAddress", local_var_params["trader_address"])
+ ) # noqa: E501
+ if "fee_recipient_address" in local_var_params:
+ query_params.append(
+ (
+ "feeRecipientAddress",
+ local_var_params["fee_recipient_address"],
+ )
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/orders",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrdersResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def post_order(self, **kwargs): # noqa: E501
+ """post_order # noqa: E501
+
+ Submit a signed order to the relayer. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.post_order(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param SignedOrderSchema signed_order_schema: A valid signed 0x order based on the schema.
+ :return: None
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.post_order_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.post_order_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def post_order_with_http_info(self, **kwargs): # noqa: E501
+ """post_order # noqa: E501
+
+ Submit a signed order to the relayer. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.post_order_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param SignedOrderSchema signed_order_schema: A valid signed 0x order based on the schema.
+ :return: None
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["network_id", "signed_order_schema"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method post_order" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ if "signed_order_schema" in local_var_params:
+ body_params = local_var_params["signed_order_schema"]
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # HTTP header `Content-Type`
+ header_params[
+ "Content-Type"
+ ] = self.api_client.select_header_content_type( # noqa: E501
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order",
+ "POST",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type=None, # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
diff --git a/python-packages/sra_client/sra_client/api_client.py b/python-packages/sra_client/sra_client/api_client.py
new file mode 100644
index 000000000..6139fdb42
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api_client.py
@@ -0,0 +1,730 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+
+import datetime
+import json
+import mimetypes
+from multiprocessing.pool import ThreadPool
+import os
+import re
+import tempfile
+
+# python 2 and python 3 compatibility library
+import six
+from six.moves.urllib.parse import quote
+
+from sra_client.configuration import Configuration
+import sra_client.models
+from sra_client import rest
+
+
+class ApiClient(object):
+ """Generic API client for OpenAPI client library builds.
+
+ OpenAPI generic API client. This client handles the client-
+ server communication, and is invariant across implementations. Specifics of
+ the methods and models for each application are generated from the OpenAPI
+ templates.
+
+ NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+
+ :param configuration: .Configuration object for this client
+ :param header_name: a header to pass when making calls to the API.
+ :param header_value: a header value to pass when making calls to
+ the API.
+ :param cookie: a cookie to include in the header when making calls
+ to the API
+ :param pool_threads: The number of threads to use for async requests
+ to the API. More threads means more concurrent API requests.
+ """
+
+ PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
+ NATIVE_TYPES_MAPPING = {
+ "int": int,
+ "long": int if six.PY3 else long, # noqa: F821
+ "float": float,
+ "str": str,
+ "bool": bool,
+ "date": datetime.date,
+ "datetime": datetime.datetime,
+ "object": object,
+ }
+ _pool = None
+
+ def __init__(
+ self,
+ configuration=None,
+ header_name=None,
+ header_value=None,
+ cookie=None,
+ pool_threads=None,
+ ):
+ if configuration is None:
+ configuration = Configuration()
+ self.configuration = configuration
+ self.pool_threads = pool_threads
+
+ self.rest_client = rest.RESTClientObject(configuration)
+ self.default_headers = {}
+ if header_name is not None:
+ self.default_headers[header_name] = header_value
+ self.cookie = cookie
+ # Set default User-Agent.
+ self.user_agent = "OpenAPI-Generator/1.0.0/python"
+
+ def __del__(self):
+ if self._pool:
+ self._pool.close()
+ self._pool.join()
+ self._pool = None
+
+ @property
+ def pool(self):
+ """Create thread pool on first request
+ avoids instantiating unused threadpool for blocking clients.
+ """
+ if self._pool is None:
+ self._pool = ThreadPool(self.pool_threads)
+ return self._pool
+
+ @property
+ def user_agent(self):
+ """User agent for this API client"""
+ return self.default_headers["User-Agent"]
+
+ @user_agent.setter
+ def user_agent(self, value):
+ self.default_headers["User-Agent"] = value
+
+ def set_default_header(self, header_name, header_value):
+ self.default_headers[header_name] = header_value
+
+ def __call_api(
+ self,
+ resource_path,
+ method,
+ path_params=None,
+ query_params=None,
+ header_params=None,
+ body=None,
+ post_params=None,
+ files=None,
+ response_type=None,
+ auth_settings=None,
+ _return_http_data_only=None,
+ collection_formats=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+
+ config = self.configuration
+
+ # header parameters
+ header_params = header_params or {}
+ header_params.update(self.default_headers)
+ if self.cookie:
+ header_params["Cookie"] = self.cookie
+ if header_params:
+ header_params = self.sanitize_for_serialization(header_params)
+ header_params = dict(
+ self.parameters_to_tuples(header_params, collection_formats)
+ )
+
+ # path parameters
+ if path_params:
+ path_params = self.sanitize_for_serialization(path_params)
+ path_params = self.parameters_to_tuples(
+ path_params, collection_formats
+ )
+ for k, v in path_params:
+ # specified safe chars, encode everything
+ resource_path = resource_path.replace(
+ "{%s}" % k,
+ quote(str(v), safe=config.safe_chars_for_path_param),
+ )
+
+ # query parameters
+ if query_params:
+ query_params = self.sanitize_for_serialization(query_params)
+ query_params = self.parameters_to_tuples(
+ query_params, collection_formats
+ )
+
+ # post parameters
+ if post_params or files:
+ post_params = self.prepare_post_parameters(post_params, files)
+ post_params = self.sanitize_for_serialization(post_params)
+ post_params = self.parameters_to_tuples(
+ post_params, collection_formats
+ )
+
+ # auth setting
+ self.update_params_for_auth(header_params, query_params, auth_settings)
+
+ # body
+ if body:
+ body = self.sanitize_for_serialization(body)
+
+ # request url
+ url = self.configuration.host + resource_path
+
+ # perform request and return response
+ response_data = self.request(
+ method,
+ url,
+ query_params=query_params,
+ headers=header_params,
+ post_params=post_params,
+ body=body,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ )
+
+ self.last_response = response_data
+
+ return_data = response_data
+ if _preload_content:
+ # deserialize response data
+ if response_type:
+ return_data = self.deserialize(response_data, response_type)
+ else:
+ return_data = None
+
+ if _return_http_data_only:
+ return return_data
+ else:
+ return (
+ return_data,
+ response_data.status,
+ response_data.getheaders(),
+ )
+
+ def sanitize_for_serialization(self, obj):
+ """Builds a JSON POST object.
+
+ If obj is None, return None.
+ If obj is str, int, long, float, bool, return directly.
+ If obj is datetime.datetime, datetime.date
+ convert to string in iso8601 format.
+ If obj is list, sanitize each element in the list.
+ If obj is dict, return the dict.
+ If obj is OpenAPI model, return the properties dict.
+
+ :param obj: The data to serialize.
+ :return: The serialized form of data.
+ """
+ if obj is None:
+ return None
+ elif isinstance(obj, self.PRIMITIVE_TYPES):
+ return obj
+ elif isinstance(obj, list):
+ return [
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
+ ]
+ elif isinstance(obj, tuple):
+ return tuple(
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
+ )
+ elif isinstance(obj, (datetime.datetime, datetime.date)):
+ return obj.isoformat()
+
+ if isinstance(obj, dict):
+ obj_dict = obj
+ else:
+ # Convert model obj to dict except
+ # attributes `openapi_types`, `attribute_map`
+ # and attributes which value is not None.
+ # Convert attribute name to json key in
+ # model definition for request.
+ obj_dict = {
+ obj.attribute_map[attr]: getattr(obj, attr)
+ for attr, _ in six.iteritems(obj.openapi_types)
+ if getattr(obj, attr) is not None
+ }
+
+ return {
+ key: self.sanitize_for_serialization(val)
+ for key, val in six.iteritems(obj_dict)
+ }
+
+ def deserialize(self, response, response_type):
+ """Deserializes response into an object.
+
+ :param response: RESTResponse object to be deserialized.
+ :param response_type: class literal for
+ deserialized object, or string of class name.
+
+ :return: deserialized object.
+ """
+ # handle file downloading
+ # save response body into a tmp file and return the instance
+ if response_type == "file":
+ return self.__deserialize_file(response)
+
+ # fetch data from response object
+ try:
+ data = json.loads(response.data)
+ except ValueError:
+ data = response.data
+
+ return self.__deserialize(data, response_type)
+
+ def __deserialize(self, data, klass):
+ """Deserializes dict, list, str into an object.
+
+ :param data: dict, list or str.
+ :param klass: class literal, or string of class name.
+
+ :return: object.
+ """
+ if data is None:
+ return None
+
+ if type(klass) == str:
+ if klass.startswith("list["):
+ sub_kls = re.match(r"list\[(.*)\]", klass).group(1)
+ return [
+ self.__deserialize(sub_data, sub_kls) for sub_data in data
+ ]
+
+ if klass.startswith("dict("):
+ sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2)
+ return {
+ k: self.__deserialize(v, sub_kls)
+ for k, v in six.iteritems(data)
+ }
+
+ # convert str to class
+ if klass in self.NATIVE_TYPES_MAPPING:
+ klass = self.NATIVE_TYPES_MAPPING[klass]
+ else:
+ klass = getattr(sra_client.models, klass)
+
+ if klass in self.PRIMITIVE_TYPES:
+ return self.__deserialize_primitive(data, klass)
+ elif klass == object:
+ return self.__deserialize_object(data)
+ elif klass == datetime.date:
+ return self.__deserialize_date(data)
+ elif klass == datetime.datetime:
+ return self.__deserialize_datatime(data)
+ else:
+ return self.__deserialize_model(data, klass)
+
+ def call_api(
+ self,
+ resource_path,
+ method,
+ path_params=None,
+ query_params=None,
+ header_params=None,
+ body=None,
+ post_params=None,
+ files=None,
+ response_type=None,
+ auth_settings=None,
+ async_req=None,
+ _return_http_data_only=None,
+ collection_formats=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Makes the HTTP request (synchronous) and returns deserialized data.
+
+ To make an async_req request, set the async_req parameter.
+
+ :param resource_path: Path to method endpoint.
+ :param method: Method to call.
+ :param path_params: Path parameters in the url.
+ :param query_params: Query parameters in the url.
+ :param header_params: Header parameters to be
+ placed in the request header.
+ :param body: Request body.
+ :param post_params dict: Request post form parameters,
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
+ :param auth_settings list: Auth Settings names for the request.
+ :param response: Response data type.
+ :param files dict: key -> filename, value -> filepath,
+ for `multipart/form-data`.
+ :param async_req bool: execute request asynchronously
+ :param _return_http_data_only: response data without head status code
+ and headers
+ :param collection_formats: dict of collection formats for path, query,
+ header, and post parameters.
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :return:
+ If async_req parameter is True,
+ the request will be called asynchronously.
+ The method will return the request thread.
+ If parameter async_req is False or missing,
+ then the method will return the response directly.
+ """
+ if not async_req:
+ return self.__call_api(
+ resource_path,
+ method,
+ path_params,
+ query_params,
+ header_params,
+ body,
+ post_params,
+ files,
+ response_type,
+ auth_settings,
+ _return_http_data_only,
+ collection_formats,
+ _preload_content,
+ _request_timeout,
+ )
+ else:
+ thread = self.pool.apply_async(
+ self.__call_api,
+ (
+ resource_path,
+ method,
+ path_params,
+ query_params,
+ header_params,
+ body,
+ post_params,
+ files,
+ response_type,
+ auth_settings,
+ _return_http_data_only,
+ collection_formats,
+ _preload_content,
+ _request_timeout,
+ ),
+ )
+ return thread
+
+ def request(
+ self,
+ method,
+ url,
+ query_params=None,
+ headers=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Makes the HTTP request using RESTClient."""
+ if method == "GET":
+ return self.rest_client.GET(
+ url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers,
+ )
+ elif method == "HEAD":
+ return self.rest_client.HEAD(
+ url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers,
+ )
+ elif method == "OPTIONS":
+ return self.rest_client.OPTIONS(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "POST":
+ return self.rest_client.POST(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "PUT":
+ return self.rest_client.PUT(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "PATCH":
+ return self.rest_client.PATCH(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "DELETE":
+ return self.rest_client.DELETE(
+ url,
+ query_params=query_params,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ else:
+ raise ValueError(
+ "http method must be `GET`, `HEAD`, `OPTIONS`,"
+ " `POST`, `PATCH`, `PUT` or `DELETE`."
+ )
+
+ def parameters_to_tuples(self, params, collection_formats):
+ """Get parameters as list of tuples, formatting collections.
+
+ :param params: Parameters as dict or list of two-tuples
+ :param dict collection_formats: Parameter collection formats
+ :return: Parameters as list of tuples, collections formatted
+ """
+ new_params = []
+ if collection_formats is None:
+ collection_formats = {}
+ for k, v in (
+ six.iteritems(params) if isinstance(params, dict) else params
+ ): # noqa: E501
+ if k in collection_formats:
+ collection_format = collection_formats[k]
+ if collection_format == "multi":
+ new_params.extend((k, value) for value in v)
+ else:
+ if collection_format == "ssv":
+ delimiter = " "
+ elif collection_format == "tsv":
+ delimiter = "\t"
+ elif collection_format == "pipes":
+ delimiter = "|"
+ else: # csv is the default
+ delimiter = ","
+ new_params.append(
+ (k, delimiter.join(str(value) for value in v))
+ )
+ else:
+ new_params.append((k, v))
+ return new_params
+
+ def prepare_post_parameters(self, post_params=None, files=None):
+ """Builds form parameters.
+
+ :param post_params: Normal form parameters.
+ :param files: File parameters.
+ :return: Form parameters with files.
+ """
+ params = []
+
+ if post_params:
+ params = post_params
+
+ if files:
+ for k, v in six.iteritems(files):
+ if not v:
+ continue
+ file_names = v if type(v) is list else [v]
+ for n in file_names:
+ with open(n, "rb") as f:
+ filename = os.path.basename(f.name)
+ filedata = f.read()
+ mimetype = (
+ mimetypes.guess_type(filename)[0]
+ or "application/octet-stream"
+ )
+ params.append(
+ tuple([k, tuple([filename, filedata, mimetype])])
+ )
+
+ return params
+
+ def select_header_accept(self, accepts):
+ """Returns `Accept` based on an array of accepts provided.
+
+ :param accepts: List of headers.
+ :return: Accept (e.g. application/json).
+ """
+ if not accepts:
+ return
+
+ accepts = [x.lower() for x in accepts]
+
+ if "application/json" in accepts:
+ return "application/json"
+ else:
+ return ", ".join(accepts)
+
+ def select_header_content_type(self, content_types):
+ """Returns `Content-Type` based on an array of content_types provided.
+
+ :param content_types: List of content-types.
+ :return: Content-Type (e.g. application/json).
+ """
+ if not content_types:
+ return "application/json"
+
+ content_types = [x.lower() for x in content_types]
+
+ if "application/json" in content_types or "*/*" in content_types:
+ return "application/json"
+ else:
+ return content_types[0]
+
+ def update_params_for_auth(self, headers, querys, auth_settings):
+ """Updates header and query params based on authentication setting.
+
+ :param headers: Header parameters dict to be updated.
+ :param querys: Query parameters tuple list to be updated.
+ :param auth_settings: Authentication setting identifiers list.
+ """
+ if not auth_settings:
+ return
+
+ for auth in auth_settings:
+ auth_setting = self.configuration.auth_settings().get(auth)
+ if auth_setting:
+ if not auth_setting["value"]:
+ continue
+ elif auth_setting["in"] == "header":
+ headers[auth_setting["key"]] = auth_setting["value"]
+ elif auth_setting["in"] == "query":
+ querys.append((auth_setting["key"], auth_setting["value"]))
+ else:
+ raise ValueError(
+ "Authentication token must be in `query` or `header`"
+ )
+
+ def __deserialize_file(self, response):
+ """Deserializes body to file
+
+ Saves response body into a file in a temporary folder,
+ using the filename from the `Content-Disposition` header if provided.
+
+ :param response: RESTResponse.
+ :return: file path.
+ """
+ fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
+ os.close(fd)
+ os.remove(path)
+
+ content_disposition = response.getheader("Content-Disposition")
+ if content_disposition:
+ filename = re.search(
+ r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition
+ ).group(1)
+ path = os.path.join(os.path.dirname(path), filename)
+
+ with open(path, "wb") as f:
+ f.write(response.data)
+
+ return path
+
+ def __deserialize_primitive(self, data, klass):
+ """Deserializes string to primitive type.
+
+ :param data: str.
+ :param klass: class literal.
+
+ :return: int, long, float, str, bool.
+ """
+ try:
+ return klass(data)
+ except UnicodeEncodeError:
+ return six.text_type(data)
+ except TypeError:
+ return data
+
+ def __deserialize_object(self, value):
+ """Return an original value.
+
+ :return: object.
+ """
+ return value
+
+ def __deserialize_date(self, string):
+ """Deserializes string to date.
+
+ :param string: str.
+ :return: date.
+ """
+ try:
+ from dateutil.parser import parse
+
+ return parse(string).date()
+ except ImportError:
+ return string
+ except ValueError:
+ raise rest.ApiException(
+ status=0,
+ reason="Failed to parse `{0}` as date object".format(string),
+ )
+
+ def __deserialize_datatime(self, string):
+ """Deserializes string to datetime.
+
+ The string should be in iso8601 datetime format.
+
+ :param string: str.
+ :return: datetime.
+ """
+ try:
+ from dateutil.parser import parse
+
+ return parse(string)
+ except ImportError:
+ return string
+ except ValueError:
+ raise rest.ApiException(
+ status=0,
+ reason=(
+ "Failed to parse `{0}` as datetime object".format(string)
+ ),
+ )
+
+ def __deserialize_model(self, data, klass):
+ """Deserializes list or dict to model.
+
+ :param data: dict, list.
+ :param klass: class literal.
+ :return: model object.
+ """
+
+ if not klass.openapi_types and not hasattr(
+ klass, "get_real_child_model"
+ ):
+ return data
+
+ kwargs = {}
+ if klass.openapi_types is not None:
+ for attr, attr_type in six.iteritems(klass.openapi_types):
+ if (
+ data is not None
+ and klass.attribute_map[attr] in data
+ and isinstance(data, (list, dict))
+ ):
+ value = data[klass.attribute_map[attr]]
+ kwargs[attr] = self.__deserialize(value, attr_type)
+
+ instance = klass(**kwargs)
+
+ if hasattr(instance, "get_real_child_model"):
+ klass_name = instance.get_real_child_model(data)
+ if klass_name:
+ instance = self.__deserialize(data, klass_name)
+ return instance
diff --git a/python-packages/sra_client/sra_client/configuration.py b/python-packages/sra_client/sra_client/configuration.py
new file mode 100644
index 000000000..9b0cc05bb
--- /dev/null
+++ b/python-packages/sra_client/sra_client/configuration.py
@@ -0,0 +1,225 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import copy
+import logging
+import multiprocessing
+import sys
+import urllib3
+
+import six
+from six.moves import http_client as httplib
+
+
+class TypeWithDefault(type):
+ def __init__(cls, name, bases, dct):
+ super(TypeWithDefault, cls).__init__(name, bases, dct)
+ cls._default = None
+
+ def __call__(cls):
+ if cls._default is None:
+ cls._default = type.__call__(cls)
+ return copy.copy(cls._default)
+
+ def set_default(cls, default):
+ cls._default = copy.copy(default)
+
+
+class Configuration(six.with_metaclass(TypeWithDefault, object)):
+ """NOTE: This class is auto generated by OpenAPI Generator
+
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+ """
+
+ def __init__(self):
+ """Constructor"""
+ # Default Base url
+ self.host = "http://localhost:3000"
+ # Temp file folder for downloading files
+ self.temp_folder_path = None
+
+ # Authentication Settings
+ # dict to store API key(s)
+ self.api_key = {}
+ # dict to store API prefix (e.g. Bearer)
+ self.api_key_prefix = {}
+ # Username for HTTP basic authentication
+ self.username = ""
+ # Password for HTTP basic authentication
+ self.password = ""
+
+ # Logging Settings
+ self.logger = {}
+ self.logger["package_logger"] = logging.getLogger("sra_client")
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
+ # Log format
+ self.logger_format = "%(asctime)s %(levelname)s %(message)s"
+ # Log stream handler
+ self.logger_stream_handler = None
+ # Log file handler
+ self.logger_file_handler = None
+ # Debug file location
+ self.logger_file = None
+ # Debug switch
+ self.debug = False
+
+ # SSL/TLS verification
+ # Set this to false to skip verifying SSL certificate when calling API
+ # from https server.
+ self.verify_ssl = True
+ # Set this to customize the certificate file to verify the peer.
+ self.ssl_ca_cert = None
+ # client certificate file
+ self.cert_file = None
+ # client key file
+ self.key_file = None
+ # Set this to True/False to enable/disable SSL hostname verification.
+ self.assert_hostname = None
+
+ # urllib3 connection pool's maximum number of connections saved
+ # per pool. urllib3 uses 1 connection as default value, but this is
+ # not the best value when you are making a lot of possibly parallel
+ # requests to the same host, which is often the case here.
+ # cpu_count * 5 is used as default value to increase performance.
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
+
+ # Proxy URL
+ self.proxy = None
+ # Safe chars for path_param
+ self.safe_chars_for_path_param = ""
+
+ @property
+ def logger_file(self):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ return self.__logger_file
+
+ @logger_file.setter
+ def logger_file(self, value):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ self.__logger_file = value
+ if self.__logger_file:
+ # If set logging file,
+ # then add file handler and remove stream handler.
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
+ self.logger_file_handler.setFormatter(self.logger_formatter)
+ for _, logger in six.iteritems(self.logger):
+ logger.addHandler(self.logger_file_handler)
+
+ @property
+ def debug(self):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ return self.__debug
+
+ @debug.setter
+ def debug(self, value):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ self.__debug = value
+ if self.__debug:
+ # if debug status is True, turn on debug logging
+ for _, logger in six.iteritems(self.logger):
+ logger.setLevel(logging.DEBUG)
+ # turn on httplib debug
+ httplib.HTTPConnection.debuglevel = 1
+ else:
+ # if debug status is False, turn off debug logging,
+ # setting log level to default `logging.WARNING`
+ for _, logger in six.iteritems(self.logger):
+ logger.setLevel(logging.WARNING)
+ # turn off httplib debug
+ httplib.HTTPConnection.debuglevel = 0
+
+ @property
+ def logger_format(self):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ return self.__logger_format
+
+ @logger_format.setter
+ def logger_format(self, value):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ self.__logger_format = value
+ self.logger_formatter = logging.Formatter(self.__logger_format)
+
+ def get_api_key_with_prefix(self, identifier):
+ """Gets API key (with prefix if set).
+
+ :param identifier: The identifier of apiKey.
+ :return: The token for api key authentication.
+ """
+ if self.api_key.get(identifier) and self.api_key_prefix.get(
+ identifier
+ ):
+ return (
+ self.api_key_prefix[identifier]
+ + " "
+ + self.api_key[identifier]
+ ) # noqa: E501
+ elif self.api_key.get(identifier):
+ return self.api_key[identifier]
+
+ def get_basic_auth_token(self):
+ """Gets HTTP basic authentication header (string).
+
+ :return: The token for basic HTTP authentication.
+ """
+ return urllib3.util.make_headers(
+ basic_auth=self.username + ":" + self.password
+ ).get("authorization")
+
+ def auth_settings(self):
+ """Gets Auth Settings dict for api client.
+
+ :return: The Auth Settings information dict.
+ """
+ return {}
+
+ def to_debug_report(self):
+ """Gets the essential information for debugging.
+
+ :return: The report for debugging.
+ """
+ return (
+ "Python SDK Debug Report:\n"
+ "OS: {env}\n"
+ "Python Version: {pyversion}\n"
+ "Version of the API: 2.0.0\n"
+ "SDK Package Version: 1.0.0".format(
+ env=sys.platform, pyversion=sys.version
+ )
+ )
diff --git a/python-packages/sra_client/sra_client/models/__init__.py b/python-packages/sra_client/sra_client/models/__init__.py
new file mode 100644
index 000000000..5e6d1baa3
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/__init__.py
@@ -0,0 +1,49 @@
+# coding: utf-8
+
+# flake8: noqa
+
+from __future__ import absolute_import
+
+# import models into model package
+from sra_client.models.order_schema import OrderSchema
+from sra_client.models.paginated_collection_schema import (
+ PaginatedCollectionSchema,
+)
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema,
+)
+from sra_client.models.relayer_api_asset_data_trade_info_schema import (
+ RelayerApiAssetDataTradeInfoSchema,
+)
+from sra_client.models.relayer_api_error_response_schema import (
+ RelayerApiErrorResponseSchema,
+)
+from sra_client.models.relayer_api_error_response_schema_validation_errors import (
+ RelayerApiErrorResponseSchemaValidationErrors,
+)
+from sra_client.models.relayer_api_fee_recipients_response_schema import (
+ RelayerApiFeeRecipientsResponseSchema,
+)
+from sra_client.models.relayer_api_order_config_payload_schema import (
+ RelayerApiOrderConfigPayloadSchema,
+)
+from sra_client.models.relayer_api_order_config_response_schema import (
+ RelayerApiOrderConfigResponseSchema,
+)
+from sra_client.models.relayer_api_order_schema import RelayerApiOrderSchema
+from sra_client.models.relayer_api_orderbook_response_schema import (
+ RelayerApiOrderbookResponseSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_payload_schema import (
+ RelayerApiOrdersChannelSubscribePayloadSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_schema import (
+ RelayerApiOrdersChannelSubscribeSchema,
+)
+from sra_client.models.relayer_api_orders_channel_update_schema import (
+ RelayerApiOrdersChannelUpdateSchema,
+)
+from sra_client.models.relayer_api_orders_response_schema import (
+ RelayerApiOrdersResponseSchema,
+)
+from sra_client.models.signed_order_schema import SignedOrderSchema
diff --git a/python-packages/sra_client/sra_client/models/order_schema.py b/python-packages/sra_client/sra_client/models/order_schema.py
new file mode 100644
index 000000000..48fef39d8
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/order_schema.py
@@ -0,0 +1,550 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class OrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_address": "str",
+ "taker_address": "str",
+ "maker_fee": "str",
+ "taker_fee": "str",
+ "sender_address": "str",
+ "maker_asset_amount": "str",
+ "taker_asset_amount": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "salt": "str",
+ "exchange_address": "str",
+ "fee_recipient_address": "str",
+ "expiration_time_seconds": "str",
+ }
+
+ attribute_map = {
+ "maker_address": "makerAddress",
+ "taker_address": "takerAddress",
+ "maker_fee": "makerFee",
+ "taker_fee": "takerFee",
+ "sender_address": "senderAddress",
+ "maker_asset_amount": "makerAssetAmount",
+ "taker_asset_amount": "takerAssetAmount",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "salt": "salt",
+ "exchange_address": "exchangeAddress",
+ "fee_recipient_address": "feeRecipientAddress",
+ "expiration_time_seconds": "expirationTimeSeconds",
+ }
+
+ def __init__(
+ self,
+ maker_address=None,
+ taker_address=None,
+ maker_fee=None,
+ taker_fee=None,
+ sender_address=None,
+ maker_asset_amount=None,
+ taker_asset_amount=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ salt=None,
+ exchange_address=None,
+ fee_recipient_address=None,
+ expiration_time_seconds=None,
+ ): # noqa: E501
+ """OrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_address = None
+ self._taker_address = None
+ self._maker_fee = None
+ self._taker_fee = None
+ self._sender_address = None
+ self._maker_asset_amount = None
+ self._taker_asset_amount = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._salt = None
+ self._exchange_address = None
+ self._fee_recipient_address = None
+ self._expiration_time_seconds = None
+ self.discriminator = None
+
+ self.maker_address = maker_address
+ self.taker_address = taker_address
+ self.maker_fee = maker_fee
+ self.taker_fee = taker_fee
+ self.sender_address = sender_address
+ self.maker_asset_amount = maker_asset_amount
+ self.taker_asset_amount = taker_asset_amount
+ self.maker_asset_data = maker_asset_data
+ self.taker_asset_data = taker_asset_data
+ self.salt = salt
+ self.exchange_address = exchange_address
+ self.fee_recipient_address = fee_recipient_address
+ self.expiration_time_seconds = expiration_time_seconds
+
+ @property
+ def maker_address(self):
+ """Gets the maker_address of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_address
+
+ @maker_address.setter
+ def maker_address(self, maker_address):
+ """Sets the maker_address of this OrderSchema.
+
+
+ :param maker_address: The maker_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_address is None:
+ raise ValueError(
+ "Invalid value for `maker_address`, must not be `None`"
+ ) # noqa: E501
+ if maker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_address = maker_address
+
+ @property
+ def taker_address(self):
+ """Gets the taker_address of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_address
+
+ @taker_address.setter
+ def taker_address(self, taker_address):
+ """Sets the taker_address of this OrderSchema.
+
+
+ :param taker_address: The taker_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_address is None:
+ raise ValueError(
+ "Invalid value for `taker_address`, must not be `None`"
+ ) # noqa: E501
+ if taker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_address = taker_address
+
+ @property
+ def maker_fee(self):
+ """Gets the maker_fee of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_fee of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_fee
+
+ @maker_fee.setter
+ def maker_fee(self, maker_fee):
+ """Sets the maker_fee of this OrderSchema.
+
+
+ :param maker_fee: The maker_fee of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_fee is None:
+ raise ValueError(
+ "Invalid value for `maker_fee`, must not be `None`"
+ ) # noqa: E501
+ if maker_fee is not None and not re.search(
+ r"^\\d+$", maker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_fee = maker_fee
+
+ @property
+ def taker_fee(self):
+ """Gets the taker_fee of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_fee of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_fee
+
+ @taker_fee.setter
+ def taker_fee(self, taker_fee):
+ """Sets the taker_fee of this OrderSchema.
+
+
+ :param taker_fee: The taker_fee of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_fee is None:
+ raise ValueError(
+ "Invalid value for `taker_fee`, must not be `None`"
+ ) # noqa: E501
+ if taker_fee is not None and not re.search(
+ r"^\\d+$", taker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_fee = taker_fee
+
+ @property
+ def sender_address(self):
+ """Gets the sender_address of this OrderSchema. # noqa: E501
+
+
+ :return: The sender_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._sender_address
+
+ @sender_address.setter
+ def sender_address(self, sender_address):
+ """Sets the sender_address of this OrderSchema.
+
+
+ :param sender_address: The sender_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if sender_address is None:
+ raise ValueError(
+ "Invalid value for `sender_address`, must not be `None`"
+ ) # noqa: E501
+ if sender_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", sender_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `sender_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._sender_address = sender_address
+
+ @property
+ def maker_asset_amount(self):
+ """Gets the maker_asset_amount of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_asset_amount of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_amount
+
+ @maker_asset_amount.setter
+ def maker_asset_amount(self, maker_asset_amount):
+ """Sets the maker_asset_amount of this OrderSchema.
+
+
+ :param maker_asset_amount: The maker_asset_amount of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_amount is not None and not re.search(
+ r"^\\d+$", maker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_asset_amount = maker_asset_amount
+
+ @property
+ def taker_asset_amount(self):
+ """Gets the taker_asset_amount of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_asset_amount of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_amount
+
+ @taker_asset_amount.setter
+ def taker_asset_amount(self, taker_asset_amount):
+ """Sets the taker_asset_amount of this OrderSchema.
+
+
+ :param taker_asset_amount: The taker_asset_amount of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_amount is not None and not re.search(
+ r"^\\d+$", taker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_asset_amount = taker_asset_amount
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this OrderSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this OrderSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def salt(self):
+ """Gets the salt of this OrderSchema. # noqa: E501
+
+
+ :return: The salt of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._salt
+
+ @salt.setter
+ def salt(self, salt):
+ """Sets the salt of this OrderSchema.
+
+
+ :param salt: The salt of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if salt is None:
+ raise ValueError(
+ "Invalid value for `salt`, must not be `None`"
+ ) # noqa: E501
+ if salt is not None and not re.search(r"^\\d+$", salt): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `salt`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._salt = salt
+
+ @property
+ def exchange_address(self):
+ """Gets the exchange_address of this OrderSchema. # noqa: E501
+
+
+ :return: The exchange_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._exchange_address
+
+ @exchange_address.setter
+ def exchange_address(self, exchange_address):
+ """Sets the exchange_address of this OrderSchema.
+
+
+ :param exchange_address: The exchange_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if exchange_address is None:
+ raise ValueError(
+ "Invalid value for `exchange_address`, must not be `None`"
+ ) # noqa: E501
+ if exchange_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", exchange_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `exchange_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._exchange_address = exchange_address
+
+ @property
+ def fee_recipient_address(self):
+ """Gets the fee_recipient_address of this OrderSchema. # noqa: E501
+
+
+ :return: The fee_recipient_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._fee_recipient_address
+
+ @fee_recipient_address.setter
+ def fee_recipient_address(self, fee_recipient_address):
+ """Sets the fee_recipient_address of this OrderSchema.
+
+
+ :param fee_recipient_address: The fee_recipient_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if fee_recipient_address is None:
+ raise ValueError(
+ "Invalid value for `fee_recipient_address`, must not be `None`"
+ ) # noqa: E501
+ if fee_recipient_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", fee_recipient_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `fee_recipient_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._fee_recipient_address = fee_recipient_address
+
+ @property
+ def expiration_time_seconds(self):
+ """Gets the expiration_time_seconds of this OrderSchema. # noqa: E501
+
+
+ :return: The expiration_time_seconds of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._expiration_time_seconds
+
+ @expiration_time_seconds.setter
+ def expiration_time_seconds(self, expiration_time_seconds):
+ """Sets the expiration_time_seconds of this OrderSchema.
+
+
+ :param expiration_time_seconds: The expiration_time_seconds of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if expiration_time_seconds is None:
+ raise ValueError(
+ "Invalid value for `expiration_time_seconds`, must not be `None`"
+ ) # noqa: E501
+ if expiration_time_seconds is not None and not re.search(
+ r"^\\d+$", expiration_time_seconds
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._expiration_time_seconds = expiration_time_seconds
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, OrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/paginated_collection_schema.py b/python-packages/sra_client/sra_client/models/paginated_collection_schema.py
new file mode 100644
index 000000000..4c73d31f4
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/paginated_collection_schema.py
@@ -0,0 +1,161 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class PaginatedCollectionSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"total": "float", "per_page": "float", "page": "float"}
+
+ attribute_map = {"total": "total", "per_page": "perPage", "page": "page"}
+
+ def __init__(self, total=None, per_page=None, page=None): # noqa: E501
+ """PaginatedCollectionSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._total = None
+ self._per_page = None
+ self._page = None
+ self.discriminator = None
+
+ self.total = total
+ self.per_page = per_page
+ self.page = page
+
+ @property
+ def total(self):
+ """Gets the total of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The total of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._total
+
+ @total.setter
+ def total(self, total):
+ """Sets the total of this PaginatedCollectionSchema.
+
+
+ :param total: The total of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if total is None:
+ raise ValueError(
+ "Invalid value for `total`, must not be `None`"
+ ) # noqa: E501
+
+ self._total = total
+
+ @property
+ def per_page(self):
+ """Gets the per_page of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The per_page of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._per_page
+
+ @per_page.setter
+ def per_page(self, per_page):
+ """Sets the per_page of this PaginatedCollectionSchema.
+
+
+ :param per_page: The per_page of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if per_page is None:
+ raise ValueError(
+ "Invalid value for `per_page`, must not be `None`"
+ ) # noqa: E501
+
+ self._per_page = per_page
+
+ @property
+ def page(self):
+ """Gets the page of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The page of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._page
+
+ @page.setter
+ def page(self, page):
+ """Sets the page of this PaginatedCollectionSchema.
+
+
+ :param page: The page of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if page is None:
+ raise ValueError(
+ "Invalid value for `page`, must not be `None`"
+ ) # noqa: E501
+
+ self._page = page
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, PaginatedCollectionSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py
new file mode 100644
index 000000000..97110b13a
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiAssetDataPairsResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[object]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiAssetDataPairsResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+ :rtype: list[object]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiAssetDataPairsResponseSchema.
+
+
+ :param records: The records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+ :type: list[object]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiAssetDataPairsResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py
new file mode 100644
index 000000000..c449d0a6a
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py
@@ -0,0 +1,209 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiAssetDataTradeInfoSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "asset_data": "str",
+ "min_amount": "str",
+ "max_amount": "str",
+ "precision": "float",
+ }
+
+ attribute_map = {
+ "asset_data": "assetData",
+ "min_amount": "minAmount",
+ "max_amount": "maxAmount",
+ "precision": "precision",
+ }
+
+ def __init__(
+ self, asset_data=None, min_amount=None, max_amount=None, precision=None
+ ): # noqa: E501
+ """RelayerApiAssetDataTradeInfoSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._asset_data = None
+ self._min_amount = None
+ self._max_amount = None
+ self._precision = None
+ self.discriminator = None
+
+ self.asset_data = asset_data
+ if min_amount is not None:
+ self.min_amount = min_amount
+ if max_amount is not None:
+ self.max_amount = max_amount
+ if precision is not None:
+ self.precision = precision
+
+ @property
+ def asset_data(self):
+ """Gets the asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._asset_data
+
+ @asset_data.setter
+ def asset_data(self, asset_data):
+ """Sets the asset_data of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param asset_data: The asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if asset_data is None:
+ raise ValueError(
+ "Invalid value for `asset_data`, must not be `None`"
+ ) # noqa: E501
+ if asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._asset_data = asset_data
+
+ @property
+ def min_amount(self):
+ """Gets the min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._min_amount
+
+ @min_amount.setter
+ def min_amount(self, min_amount):
+ """Sets the min_amount of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param min_amount: The min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if min_amount is not None and not re.search(
+ r"^\\d+$", min_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `min_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._min_amount = min_amount
+
+ @property
+ def max_amount(self):
+ """Gets the max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._max_amount
+
+ @max_amount.setter
+ def max_amount(self, max_amount):
+ """Sets the max_amount of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param max_amount: The max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if max_amount is not None and not re.search(
+ r"^\\d+$", max_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `max_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._max_amount = max_amount
+
+ @property
+ def precision(self):
+ """Gets the precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._precision
+
+ @precision.setter
+ def precision(self, precision):
+ """Sets the precision of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param precision: The precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: float
+ """
+
+ self._precision = precision
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiAssetDataTradeInfoSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py
new file mode 100644
index 000000000..fd06bb9f4
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py
@@ -0,0 +1,176 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiErrorResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "code": "int",
+ "reason": "str",
+ "validation_errors": "list[RelayerApiErrorResponseSchemaValidationErrors]",
+ }
+
+ attribute_map = {
+ "code": "code",
+ "reason": "reason",
+ "validation_errors": "validationErrors",
+ }
+
+ def __init__(
+ self, code=None, reason=None, validation_errors=None
+ ): # noqa: E501
+ """RelayerApiErrorResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._code = None
+ self._reason = None
+ self._validation_errors = None
+ self.discriminator = None
+
+ self.code = code
+ self.reason = reason
+ if validation_errors is not None:
+ self.validation_errors = validation_errors
+
+ @property
+ def code(self):
+ """Gets the code of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The code of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: int
+ """
+ return self._code
+
+ @code.setter
+ def code(self, code):
+ """Sets the code of this RelayerApiErrorResponseSchema.
+
+
+ :param code: The code of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: int
+ """
+ if code is None:
+ raise ValueError(
+ "Invalid value for `code`, must not be `None`"
+ ) # noqa: E501
+ if code is not None and code > 103: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value less than or equal to `103`"
+ ) # noqa: E501
+ if code is not None and code < 100: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value greater than or equal to `100`"
+ ) # noqa: E501
+
+ self._code = code
+
+ @property
+ def reason(self):
+ """Gets the reason of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The reason of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._reason
+
+ @reason.setter
+ def reason(self, reason):
+ """Sets the reason of this RelayerApiErrorResponseSchema.
+
+
+ :param reason: The reason of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: str
+ """
+ if reason is None:
+ raise ValueError(
+ "Invalid value for `reason`, must not be `None`"
+ ) # noqa: E501
+
+ self._reason = reason
+
+ @property
+ def validation_errors(self):
+ """Gets the validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: list[RelayerApiErrorResponseSchemaValidationErrors]
+ """
+ return self._validation_errors
+
+ @validation_errors.setter
+ def validation_errors(self, validation_errors):
+ """Sets the validation_errors of this RelayerApiErrorResponseSchema.
+
+
+ :param validation_errors: The validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: list[RelayerApiErrorResponseSchemaValidationErrors]
+ """
+
+ self._validation_errors = validation_errors
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiErrorResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py
new file mode 100644
index 000000000..ee344bbf7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py
@@ -0,0 +1,171 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiErrorResponseSchemaValidationErrors(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"field": "str", "code": "int", "reason": "str"}
+
+ attribute_map = {"field": "field", "code": "code", "reason": "reason"}
+
+ def __init__(self, field=None, code=None, reason=None): # noqa: E501
+ """RelayerApiErrorResponseSchemaValidationErrors - a model defined in OpenAPI""" # noqa: E501
+
+ self._field = None
+ self._code = None
+ self._reason = None
+ self.discriminator = None
+
+ self.field = field
+ self.code = code
+ self.reason = reason
+
+ @property
+ def field(self):
+ """Gets the field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: str
+ """
+ return self._field
+
+ @field.setter
+ def field(self, field):
+ """Sets the field of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param field: The field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: str
+ """
+ if field is None:
+ raise ValueError(
+ "Invalid value for `field`, must not be `None`"
+ ) # noqa: E501
+
+ self._field = field
+
+ @property
+ def code(self):
+ """Gets the code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: int
+ """
+ return self._code
+
+ @code.setter
+ def code(self, code):
+ """Sets the code of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param code: The code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: int
+ """
+ if code is None:
+ raise ValueError(
+ "Invalid value for `code`, must not be `None`"
+ ) # noqa: E501
+ if code is not None and code > 1006: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value less than or equal to `1006`"
+ ) # noqa: E501
+ if code is not None and code < 1000: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value greater than or equal to `1000`"
+ ) # noqa: E501
+
+ self._code = code
+
+ @property
+ def reason(self):
+ """Gets the reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: str
+ """
+ return self._reason
+
+ @reason.setter
+ def reason(self, reason):
+ """Sets the reason of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param reason: The reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: str
+ """
+ if reason is None:
+ raise ValueError(
+ "Invalid value for `reason`, must not be `None`"
+ ) # noqa: E501
+
+ self._reason = reason
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(
+ other, RelayerApiErrorResponseSchemaValidationErrors
+ ):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py
new file mode 100644
index 000000000..002eb00d7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiFeeRecipientsResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[str]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiFeeRecipientsResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+ :rtype: list[str]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiFeeRecipientsResponseSchema.
+
+
+ :param records: The records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+ :type: list[str]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiFeeRecipientsResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py
new file mode 100644
index 000000000..8d19d80e2
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py
@@ -0,0 +1,372 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderConfigPayloadSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_address": "str",
+ "taker_address": "str",
+ "maker_asset_amount": "str",
+ "taker_asset_amount": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "exchange_address": "str",
+ "expiration_time_seconds": "str",
+ }
+
+ attribute_map = {
+ "maker_address": "makerAddress",
+ "taker_address": "takerAddress",
+ "maker_asset_amount": "makerAssetAmount",
+ "taker_asset_amount": "takerAssetAmount",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "exchange_address": "exchangeAddress",
+ "expiration_time_seconds": "expirationTimeSeconds",
+ }
+
+ def __init__(
+ self,
+ maker_address=None,
+ taker_address=None,
+ maker_asset_amount=None,
+ taker_asset_amount=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ exchange_address=None,
+ expiration_time_seconds=None,
+ ): # noqa: E501
+ """RelayerApiOrderConfigPayloadSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_address = None
+ self._taker_address = None
+ self._maker_asset_amount = None
+ self._taker_asset_amount = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._exchange_address = None
+ self._expiration_time_seconds = None
+ self.discriminator = None
+
+ self.maker_address = maker_address
+ self.taker_address = taker_address
+ self.maker_asset_amount = maker_asset_amount
+ self.taker_asset_amount = taker_asset_amount
+ self.maker_asset_data = maker_asset_data
+ self.taker_asset_data = taker_asset_data
+ self.exchange_address = exchange_address
+ self.expiration_time_seconds = expiration_time_seconds
+
+ @property
+ def maker_address(self):
+ """Gets the maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_address
+
+ @maker_address.setter
+ def maker_address(self, maker_address):
+ """Sets the maker_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_address: The maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_address is None:
+ raise ValueError(
+ "Invalid value for `maker_address`, must not be `None`"
+ ) # noqa: E501
+ if maker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_address = maker_address
+
+ @property
+ def taker_address(self):
+ """Gets the taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_address
+
+ @taker_address.setter
+ def taker_address(self, taker_address):
+ """Sets the taker_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_address: The taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_address is None:
+ raise ValueError(
+ "Invalid value for `taker_address`, must not be `None`"
+ ) # noqa: E501
+ if taker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_address = taker_address
+
+ @property
+ def maker_asset_amount(self):
+ """Gets the maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_amount
+
+ @maker_asset_amount.setter
+ def maker_asset_amount(self, maker_asset_amount):
+ """Sets the maker_asset_amount of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_asset_amount: The maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_amount is not None and not re.search(
+ r"^\\d+$", maker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_asset_amount = maker_asset_amount
+
+ @property
+ def taker_asset_amount(self):
+ """Gets the taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_amount
+
+ @taker_asset_amount.setter
+ def taker_asset_amount(self, taker_asset_amount):
+ """Sets the taker_asset_amount of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_asset_amount: The taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_amount is not None and not re.search(
+ r"^\\d+$", taker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_asset_amount = taker_asset_amount
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def exchange_address(self):
+ """Gets the exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._exchange_address
+
+ @exchange_address.setter
+ def exchange_address(self, exchange_address):
+ """Sets the exchange_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param exchange_address: The exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if exchange_address is None:
+ raise ValueError(
+ "Invalid value for `exchange_address`, must not be `None`"
+ ) # noqa: E501
+ if exchange_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", exchange_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `exchange_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._exchange_address = exchange_address
+
+ @property
+ def expiration_time_seconds(self):
+ """Gets the expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._expiration_time_seconds
+
+ @expiration_time_seconds.setter
+ def expiration_time_seconds(self, expiration_time_seconds):
+ """Sets the expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param expiration_time_seconds: The expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if expiration_time_seconds is None:
+ raise ValueError(
+ "Invalid value for `expiration_time_seconds`, must not be `None`"
+ ) # noqa: E501
+ if expiration_time_seconds is not None and not re.search(
+ r"^\\d+$", expiration_time_seconds
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._expiration_time_seconds = expiration_time_seconds
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderConfigPayloadSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py
new file mode 100644
index 000000000..a6bfcf32b
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py
@@ -0,0 +1,228 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderConfigResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_fee": "str",
+ "taker_fee": "str",
+ "fee_recipient_address": "str",
+ "sender_address": "str",
+ }
+
+ attribute_map = {
+ "maker_fee": "makerFee",
+ "taker_fee": "takerFee",
+ "fee_recipient_address": "feeRecipientAddress",
+ "sender_address": "senderAddress",
+ }
+
+ def __init__(
+ self,
+ maker_fee=None,
+ taker_fee=None,
+ fee_recipient_address=None,
+ sender_address=None,
+ ): # noqa: E501
+ """RelayerApiOrderConfigResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_fee = None
+ self._taker_fee = None
+ self._fee_recipient_address = None
+ self._sender_address = None
+ self.discriminator = None
+
+ self.maker_fee = maker_fee
+ self.taker_fee = taker_fee
+ self.fee_recipient_address = fee_recipient_address
+ self.sender_address = sender_address
+
+ @property
+ def maker_fee(self):
+ """Gets the maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_fee
+
+ @maker_fee.setter
+ def maker_fee(self, maker_fee):
+ """Sets the maker_fee of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param maker_fee: The maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if maker_fee is None:
+ raise ValueError(
+ "Invalid value for `maker_fee`, must not be `None`"
+ ) # noqa: E501
+ if maker_fee is not None and not re.search(
+ r"^\\d+$", maker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_fee = maker_fee
+
+ @property
+ def taker_fee(self):
+ """Gets the taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_fee
+
+ @taker_fee.setter
+ def taker_fee(self, taker_fee):
+ """Sets the taker_fee of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param taker_fee: The taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if taker_fee is None:
+ raise ValueError(
+ "Invalid value for `taker_fee`, must not be `None`"
+ ) # noqa: E501
+ if taker_fee is not None and not re.search(
+ r"^\\d+$", taker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_fee = taker_fee
+
+ @property
+ def fee_recipient_address(self):
+ """Gets the fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._fee_recipient_address
+
+ @fee_recipient_address.setter
+ def fee_recipient_address(self, fee_recipient_address):
+ """Sets the fee_recipient_address of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param fee_recipient_address: The fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if fee_recipient_address is None:
+ raise ValueError(
+ "Invalid value for `fee_recipient_address`, must not be `None`"
+ ) # noqa: E501
+ if fee_recipient_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", fee_recipient_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `fee_recipient_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._fee_recipient_address = fee_recipient_address
+
+ @property
+ def sender_address(self):
+ """Gets the sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._sender_address
+
+ @sender_address.setter
+ def sender_address(self, sender_address):
+ """Sets the sender_address of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param sender_address: The sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if sender_address is None:
+ raise ValueError(
+ "Invalid value for `sender_address`, must not be `None`"
+ ) # noqa: E501
+ if sender_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", sender_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `sender_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._sender_address = sender_address
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderConfigResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py
new file mode 100644
index 000000000..5ee45cb30
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py
@@ -0,0 +1,134 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"order": "OrderSchema", "meta_data": "object"}
+
+ attribute_map = {"order": "order", "meta_data": "metaData"}
+
+ def __init__(self, order=None, meta_data=None): # noqa: E501
+ """RelayerApiOrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._order = None
+ self._meta_data = None
+ self.discriminator = None
+
+ self.order = order
+ self.meta_data = meta_data
+
+ @property
+ def order(self):
+ """Gets the order of this RelayerApiOrderSchema. # noqa: E501
+
+
+ :return: The order of this RelayerApiOrderSchema. # noqa: E501
+ :rtype: OrderSchema
+ """
+ return self._order
+
+ @order.setter
+ def order(self, order):
+ """Sets the order of this RelayerApiOrderSchema.
+
+
+ :param order: The order of this RelayerApiOrderSchema. # noqa: E501
+ :type: OrderSchema
+ """
+ if order is None:
+ raise ValueError(
+ "Invalid value for `order`, must not be `None`"
+ ) # noqa: E501
+
+ self._order = order
+
+ @property
+ def meta_data(self):
+ """Gets the meta_data of this RelayerApiOrderSchema. # noqa: E501
+
+
+ :return: The meta_data of this RelayerApiOrderSchema. # noqa: E501
+ :rtype: object
+ """
+ return self._meta_data
+
+ @meta_data.setter
+ def meta_data(self, meta_data):
+ """Sets the meta_data of this RelayerApiOrderSchema.
+
+
+ :param meta_data: The meta_data of this RelayerApiOrderSchema. # noqa: E501
+ :type: object
+ """
+ if meta_data is None:
+ raise ValueError(
+ "Invalid value for `meta_data`, must not be `None`"
+ ) # noqa: E501
+
+ self._meta_data = meta_data
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py
new file mode 100644
index 000000000..364785b03
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py
@@ -0,0 +1,137 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderbookResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "bids": "RelayerApiOrdersResponseSchema",
+ "asks": "RelayerApiOrdersResponseSchema",
+ }
+
+ attribute_map = {"bids": "bids", "asks": "asks"}
+
+ def __init__(self, bids=None, asks=None): # noqa: E501
+ """RelayerApiOrderbookResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._bids = None
+ self._asks = None
+ self.discriminator = None
+
+ self.bids = bids
+ self.asks = asks
+
+ @property
+ def bids(self):
+ """Gets the bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+
+
+ :return: The bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :rtype: RelayerApiOrdersResponseSchema
+ """
+ return self._bids
+
+ @bids.setter
+ def bids(self, bids):
+ """Sets the bids of this RelayerApiOrderbookResponseSchema.
+
+
+ :param bids: The bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :type: RelayerApiOrdersResponseSchema
+ """
+ if bids is None:
+ raise ValueError(
+ "Invalid value for `bids`, must not be `None`"
+ ) # noqa: E501
+
+ self._bids = bids
+
+ @property
+ def asks(self):
+ """Gets the asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+
+
+ :return: The asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :rtype: RelayerApiOrdersResponseSchema
+ """
+ return self._asks
+
+ @asks.setter
+ def asks(self, asks):
+ """Sets the asks of this RelayerApiOrderbookResponseSchema.
+
+
+ :param asks: The asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :type: RelayerApiOrdersResponseSchema
+ """
+ if asks is None:
+ raise ValueError(
+ "Invalid value for `asks`, must not be `None`"
+ ) # noqa: E501
+
+ self._asks = asks
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderbookResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py
new file mode 100644
index 000000000..f6bb758f9
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py
@@ -0,0 +1,344 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelSubscribePayloadSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_asset_proxy_id": "str",
+ "taker_asset_proxy_id": "str",
+ "network_id": "float",
+ "maker_asset_address": "str",
+ "taker_asset_address": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "trader_asset_data": "str",
+ }
+
+ attribute_map = {
+ "maker_asset_proxy_id": "makerAssetProxyId",
+ "taker_asset_proxy_id": "takerAssetProxyId",
+ "network_id": "networkId",
+ "maker_asset_address": "makerAssetAddress",
+ "taker_asset_address": "takerAssetAddress",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "trader_asset_data": "traderAssetData",
+ }
+
+ def __init__(
+ self,
+ maker_asset_proxy_id=None,
+ taker_asset_proxy_id=None,
+ network_id=None,
+ maker_asset_address=None,
+ taker_asset_address=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ trader_asset_data=None,
+ ): # noqa: E501
+ """RelayerApiOrdersChannelSubscribePayloadSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_asset_proxy_id = None
+ self._taker_asset_proxy_id = None
+ self._network_id = None
+ self._maker_asset_address = None
+ self._taker_asset_address = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._trader_asset_data = None
+ self.discriminator = None
+
+ if maker_asset_proxy_id is not None:
+ self.maker_asset_proxy_id = maker_asset_proxy_id
+ if taker_asset_proxy_id is not None:
+ self.taker_asset_proxy_id = taker_asset_proxy_id
+ if network_id is not None:
+ self.network_id = network_id
+ if maker_asset_address is not None:
+ self.maker_asset_address = maker_asset_address
+ if taker_asset_address is not None:
+ self.taker_asset_address = taker_asset_address
+ if maker_asset_data is not None:
+ self.maker_asset_data = maker_asset_data
+ if taker_asset_data is not None:
+ self.taker_asset_data = taker_asset_data
+ if trader_asset_data is not None:
+ self.trader_asset_data = trader_asset_data
+
+ @property
+ def maker_asset_proxy_id(self):
+ """Gets the maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_proxy_id
+
+ @maker_asset_proxy_id.setter
+ def maker_asset_proxy_id(self, maker_asset_proxy_id):
+ """Sets the maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_proxy_id: The maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_proxy_id is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_proxy_id
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_proxy_id`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_proxy_id = maker_asset_proxy_id
+
+ @property
+ def taker_asset_proxy_id(self):
+ """Gets the taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_proxy_id
+
+ @taker_asset_proxy_id.setter
+ def taker_asset_proxy_id(self, taker_asset_proxy_id):
+ """Sets the taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_proxy_id: The taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_proxy_id is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_proxy_id
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_proxy_id`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_proxy_id = taker_asset_proxy_id
+
+ @property
+ def network_id(self):
+ """Gets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._network_id
+
+ @network_id.setter
+ def network_id(self, network_id):
+ """Sets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param network_id: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: float
+ """
+
+ self._network_id = network_id
+
+ @property
+ def maker_asset_address(self):
+ """Gets the maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_address
+
+ @maker_asset_address.setter
+ def maker_asset_address(self, maker_asset_address):
+ """Sets the maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_address: The maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_asset_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_asset_address = maker_asset_address
+
+ @property
+ def taker_asset_address(self):
+ """Gets the taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_address
+
+ @taker_asset_address.setter
+ def taker_asset_address(self, taker_asset_address):
+ """Sets the taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_address: The taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_asset_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_asset_address = taker_asset_address
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def trader_asset_data(self):
+ """Gets the trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._trader_asset_data
+
+ @trader_asset_data.setter
+ def trader_asset_data(self, trader_asset_data):
+ """Sets the trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param trader_asset_data: The trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if trader_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", trader_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `trader_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._trader_asset_data = trader_asset_data
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(
+ other, RelayerApiOrdersChannelSubscribePayloadSchema
+ ):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py
new file mode 100644
index 000000000..2f72d5307
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py
@@ -0,0 +1,211 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelSubscribeSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "type": "str",
+ "channel": "str",
+ "request_id": "str",
+ "payload": "RelayerApiOrdersChannelSubscribePayloadSchema",
+ }
+
+ attribute_map = {
+ "type": "type",
+ "channel": "channel",
+ "request_id": "requestId",
+ "payload": "payload",
+ }
+
+ def __init__(
+ self, type=None, channel=None, request_id=None, payload=None
+ ): # noqa: E501
+ """RelayerApiOrdersChannelSubscribeSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._type = None
+ self._channel = None
+ self._request_id = None
+ self._payload = None
+ self.discriminator = None
+
+ self.type = type
+ self.channel = channel
+ self.request_id = request_id
+ if payload is not None:
+ self.payload = payload
+
+ @property
+ def type(self):
+ """Gets the type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._type
+
+ @type.setter
+ def type(self, type):
+ """Sets the type of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param type: The type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if type is None:
+ raise ValueError(
+ "Invalid value for `type`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["subscribe"] # noqa: E501
+ if type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501
+ type, allowed_values
+ )
+ )
+
+ self._type = type
+
+ @property
+ def channel(self):
+ """Gets the channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._channel
+
+ @channel.setter
+ def channel(self, channel):
+ """Sets the channel of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param channel: The channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if channel is None:
+ raise ValueError(
+ "Invalid value for `channel`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["orders"] # noqa: E501
+ if channel not in allowed_values:
+ raise ValueError(
+ "Invalid value for `channel` ({0}), must be one of {1}".format( # noqa: E501
+ channel, allowed_values
+ )
+ )
+
+ self._channel = channel
+
+ @property
+ def request_id(self):
+ """Gets the request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._request_id
+
+ @request_id.setter
+ def request_id(self, request_id):
+ """Sets the request_id of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param request_id: The request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if request_id is None:
+ raise ValueError(
+ "Invalid value for `request_id`, must not be `None`"
+ ) # noqa: E501
+
+ self._request_id = request_id
+
+ @property
+ def payload(self):
+ """Gets the payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: RelayerApiOrdersChannelSubscribePayloadSchema
+ """
+ return self._payload
+
+ @payload.setter
+ def payload(self, payload):
+ """Sets the payload of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param payload: The payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: RelayerApiOrdersChannelSubscribePayloadSchema
+ """
+
+ self._payload = payload
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersChannelSubscribeSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py
new file mode 100644
index 000000000..68aa2fddb
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py
@@ -0,0 +1,211 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelUpdateSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "type": "str",
+ "channel": "str",
+ "request_id": "str",
+ "payload": "list[RelayerApiOrderSchema]",
+ }
+
+ attribute_map = {
+ "type": "type",
+ "channel": "channel",
+ "request_id": "requestId",
+ "payload": "payload",
+ }
+
+ def __init__(
+ self, type=None, channel=None, request_id=None, payload=None
+ ): # noqa: E501
+ """RelayerApiOrdersChannelUpdateSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._type = None
+ self._channel = None
+ self._request_id = None
+ self._payload = None
+ self.discriminator = None
+
+ self.type = type
+ self.channel = channel
+ self.request_id = request_id
+ if payload is not None:
+ self.payload = payload
+
+ @property
+ def type(self):
+ """Gets the type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._type
+
+ @type.setter
+ def type(self, type):
+ """Sets the type of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param type: The type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if type is None:
+ raise ValueError(
+ "Invalid value for `type`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["update"] # noqa: E501
+ if type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501
+ type, allowed_values
+ )
+ )
+
+ self._type = type
+
+ @property
+ def channel(self):
+ """Gets the channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._channel
+
+ @channel.setter
+ def channel(self, channel):
+ """Sets the channel of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param channel: The channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if channel is None:
+ raise ValueError(
+ "Invalid value for `channel`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["orders"] # noqa: E501
+ if channel not in allowed_values:
+ raise ValueError(
+ "Invalid value for `channel` ({0}), must be one of {1}".format( # noqa: E501
+ channel, allowed_values
+ )
+ )
+
+ self._channel = channel
+
+ @property
+ def request_id(self):
+ """Gets the request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._request_id
+
+ @request_id.setter
+ def request_id(self, request_id):
+ """Sets the request_id of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param request_id: The request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if request_id is None:
+ raise ValueError(
+ "Invalid value for `request_id`, must not be `None`"
+ ) # noqa: E501
+
+ self._request_id = request_id
+
+ @property
+ def payload(self):
+ """Gets the payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: list[RelayerApiOrderSchema]
+ """
+ return self._payload
+
+ @payload.setter
+ def payload(self, payload):
+ """Sets the payload of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param payload: The payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: list[RelayerApiOrderSchema]
+ """
+
+ self._payload = payload
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersChannelUpdateSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py
new file mode 100644
index 000000000..d72b74cb7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[RelayerApiOrderSchema]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiOrdersResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiOrdersResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiOrdersResponseSchema. # noqa: E501
+ :rtype: list[RelayerApiOrderSchema]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiOrdersResponseSchema.
+
+
+ :param records: The records of this RelayerApiOrdersResponseSchema. # noqa: E501
+ :type: list[RelayerApiOrderSchema]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/signed_order_schema.py b/python-packages/sra_client/sra_client/models/signed_order_schema.py
new file mode 100644
index 000000000..8c71bff89
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/signed_order_schema.py
@@ -0,0 +1,113 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class SignedOrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"signature": "str"}
+
+ attribute_map = {"signature": "signature"}
+
+ def __init__(self, signature=None): # noqa: E501
+ """SignedOrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._signature = None
+ self.discriminator = None
+
+ self.signature = signature
+
+ @property
+ def signature(self):
+ """Gets the signature of this SignedOrderSchema. # noqa: E501
+
+
+ :return: The signature of this SignedOrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._signature
+
+ @signature.setter
+ def signature(self, signature):
+ """Sets the signature of this SignedOrderSchema.
+
+
+ :param signature: The signature of this SignedOrderSchema. # noqa: E501
+ :type: str
+ """
+ if signature is None:
+ raise ValueError(
+ "Invalid value for `signature`, must not be `None`"
+ ) # noqa: E501
+ if signature is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", signature
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `signature`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._signature = signature
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, SignedOrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/rest.py b/python-packages/sra_client/sra_client/rest.py
new file mode 100644
index 000000000..b38cabd70
--- /dev/null
+++ b/python-packages/sra_client/sra_client/rest.py
@@ -0,0 +1,421 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import io
+import json
+import logging
+import re
+import ssl
+
+import certifi
+
+# python 2 and python 3 compatibility library
+import six
+from six.moves.urllib.parse import urlencode
+
+try:
+ import urllib3
+except ImportError:
+ raise ImportError("OpenAPI Python client requires urllib3.")
+
+
+logger = logging.getLogger(__name__)
+
+
+class RESTResponse(io.IOBase):
+ def __init__(self, resp):
+ self.urllib3_response = resp
+ self.status = resp.status
+ self.reason = resp.reason
+ self.data = resp.data
+
+ def getheaders(self):
+ """Returns a dictionary of the response headers."""
+ return self.urllib3_response.getheaders()
+
+ def getheader(self, name, default=None):
+ """Returns a given response header."""
+ return self.urllib3_response.getheader(name, default)
+
+
+class RESTClientObject(object):
+ def __init__(self, configuration, pools_size=4, maxsize=None):
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
+ # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
+
+ # cert_reqs
+ if configuration.verify_ssl:
+ cert_reqs = ssl.CERT_REQUIRED
+ else:
+ cert_reqs = ssl.CERT_NONE
+
+ # ca_certs
+ if configuration.ssl_ca_cert:
+ ca_certs = configuration.ssl_ca_cert
+ else:
+ # if not set certificate file, use Mozilla's root certificates.
+ ca_certs = certifi.where()
+
+ addition_pool_args = {}
+ if configuration.assert_hostname is not None:
+ addition_pool_args[
+ "assert_hostname"
+ ] = configuration.assert_hostname # noqa: E501
+
+ if maxsize is None:
+ if configuration.connection_pool_maxsize is not None:
+ maxsize = configuration.connection_pool_maxsize
+ else:
+ maxsize = 4
+
+ # https pool manager
+ if configuration.proxy:
+ self.pool_manager = urllib3.ProxyManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=ca_certs,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ proxy_url=configuration.proxy,
+ **addition_pool_args
+ )
+ else:
+ self.pool_manager = urllib3.PoolManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=ca_certs,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ **addition_pool_args
+ )
+
+ def request(
+ self,
+ method,
+ url,
+ query_params=None,
+ headers=None,
+ body=None,
+ post_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Perform requests.
+
+ :param method: http request method
+ :param url: http request url
+ :param query_params: query parameters in the url
+ :param headers: http request headers
+ :param body: request json body, for `application/json`
+ :param post_params: request post parameters,
+ `application/x-www-form-urlencoded`
+ and `multipart/form-data`
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ """
+ method = method.upper()
+ assert method in [
+ "GET",
+ "HEAD",
+ "DELETE",
+ "POST",
+ "PUT",
+ "PATCH",
+ "OPTIONS",
+ ]
+
+ if post_params and body:
+ raise ValueError(
+ "body parameter cannot be used with post_params parameter."
+ )
+
+ post_params = post_params or {}
+ headers = headers or {}
+
+ timeout = None
+ if _request_timeout:
+ if isinstance(
+ _request_timeout, (int,) if six.PY3 else (int, long)
+ ): # noqa: E501,F821
+ timeout = urllib3.Timeout(total=_request_timeout)
+ elif (
+ isinstance(_request_timeout, tuple)
+ and len(_request_timeout) == 2
+ ):
+ timeout = urllib3.Timeout(
+ connect=_request_timeout[0], read=_request_timeout[1]
+ )
+
+ if "Content-Type" not in headers:
+ headers["Content-Type"] = "application/json"
+
+ try:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
+ if query_params:
+ url += "?" + urlencode(query_params)
+ if re.search("json", headers["Content-Type"], re.IGNORECASE):
+ request_body = None
+ if body is not None:
+ request_body = json.dumps(body)
+ r = self.pool_manager.request(
+ method,
+ url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ elif (
+ headers["Content-Type"]
+ == "application/x-www-form-urlencoded"
+ ): # noqa: E501
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=post_params,
+ encode_multipart=False,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ elif headers["Content-Type"] == "multipart/form-data":
+ # must del headers['Content-Type'], or the correct
+ # Content-Type which generated by urllib3 will be
+ # overwritten.
+ del headers["Content-Type"]
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=post_params,
+ encode_multipart=True,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ # Pass a `string` parameter directly in the body to support
+ # other content types than Json when `body` argument is
+ # provided in serialized form
+ elif isinstance(body, str):
+ request_body = body
+ r = self.pool_manager.request(
+ method,
+ url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ else:
+ # Cannot generate the request from given parameters
+ msg = """Cannot prepare a request message for provided
+ arguments. Please check that your arguments match
+ declared content type."""
+ raise ApiException(status=0, reason=msg)
+ # For `GET`, `HEAD`
+ else:
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=query_params,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ except urllib3.exceptions.SSLError as e:
+ msg = "{0}\n{1}".format(type(e).__name__, str(e))
+ raise ApiException(status=0, reason=msg)
+
+ if _preload_content:
+ r = RESTResponse(r)
+
+ # In the python 3, the response.data is bytes.
+ # we need to decode it to string.
+ if six.PY3:
+ r.data = r.data.decode("utf8")
+
+ # log response body
+ logger.debug("response body: %s", r.data)
+
+ if not 200 <= r.status <= 299:
+ raise ApiException(http_resp=r)
+
+ return r
+
+ def GET(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "GET",
+ url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params,
+ )
+
+ def HEAD(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "HEAD",
+ url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params,
+ )
+
+ def OPTIONS(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "OPTIONS",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def DELETE(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "DELETE",
+ url,
+ headers=headers,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def POST(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "POST",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def PUT(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "PUT",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def PATCH(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "PATCH",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+
+class ApiException(Exception):
+ def __init__(self, status=None, reason=None, http_resp=None):
+ if http_resp:
+ self.status = http_resp.status
+ self.reason = http_resp.reason
+ self.body = http_resp.data
+ self.headers = http_resp.getheaders()
+ else:
+ self.status = status
+ self.reason = reason
+ self.body = None
+ self.headers = None
+
+ def __str__(self):
+ """Custom error messages for exception"""
+ error_message = "({0})\n" "Reason: {1}\n".format(
+ self.status, self.reason
+ )
+ if self.headers:
+ error_message += "HTTP response headers: {0}\n".format(
+ self.headers
+ )
+
+ if self.body:
+ error_message += "HTTP response body: {0}\n".format(self.body)
+
+ return error_message
diff --git a/python-packages/sra_client/test-requirements.txt b/python-packages/sra_client/test-requirements.txt
new file mode 100644
index 000000000..2702246c0
--- /dev/null
+++ b/python-packages/sra_client/test-requirements.txt
@@ -0,0 +1,5 @@
+coverage>=4.0.3
+nose>=1.3.7
+pluggy>=0.3.1
+py>=1.4.31
+randomize>=0.13
diff --git a/python-packages/sra_client/test/__init__.py b/python-packages/sra_client/test/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/sra_client/test/__init__.py
diff --git a/python-packages/sra_client/test/test_default_api.py b/python-packages/sra_client/test/test_default_api.py
new file mode 100644
index 000000000..d23c6173f
--- /dev/null
+++ b/python-packages/sra_client/test/test_default_api.py
@@ -0,0 +1,35 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import sra_client
+from sra_client.api.default_api import DefaultApi # noqa: E501
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema
+)
+from sra_client.rest import ApiException
+
+
+class TestDefaultApi(unittest.TestCase):
+ """DefaultApi unit test stubs"""
+
+ def setUp(self):
+ self.api = sra_client.api.default_api.DefaultApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_get_asset_pairs(self):
+ """Test case for get_asset_pairs
+
+ """
+ expected = RelayerApiAssetDataPairsResponseSchema([])
+ actual = self.api.get_asset_pairs()
+ self.assertEqual(actual, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/python-packages/sra_client/tox.ini b/python-packages/sra_client/tox.ini
new file mode 100644
index 000000000..3d0be613c
--- /dev/null
+++ b/python-packages/sra_client/tox.ini
@@ -0,0 +1,10 @@
+[tox]
+envlist = py27, py3
+
+[testenv]
+deps=-r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
+commands=
+ nosetests \
+ []
diff --git a/tsconfig.json b/tsconfig.json
index b8b795aab..751115554 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -20,9 +20,18 @@
// any top-level TypeScript code.
"include": [],
"references": [
+ { "path": "./contracts/examples" },
+ { "path": "./contracts/extensions" },
+ { "path": "./contracts/interfaces" },
+ { "path": "./contracts/libs" },
+ { "path": "./contracts/multisig" },
+ { "path": "./contracts/protocol" },
+ { "path": "./contracts/test-utils" },
+ { "path": "./contracts/tokens" },
+ { "path": "./contracts/utils" },
{ "path": "./packages/0x.js" },
- { "path": "./packages/abi-gen" },
{ "path": "./packages/abi-gen-wrappers" },
+ { "path": "./packages/abi-gen" },
{ "path": "./packages/assert" },
{ "path": "./packages/asset-buyer" },
{ "path": "./packages/base-contract" },
@@ -30,7 +39,6 @@
{ "path": "./packages/contract-addresses" },
{ "path": "./packages/contract-artifacts" },
{ "path": "./packages/contract-wrappers" },
- { "path": "./contracts/core" },
{ "path": "./packages/dev-utils" },
{ "path": "./packages/ethereum-types" },
{ "path": "./packages/fill-scenarios" },
diff --git a/yarn.lock b/yarn.lock
index f391c8f97..8327a4ee8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -51,14 +51,14 @@
read-package-tree "^5.1.6"
semver "^5.5.0"
-"@0x-lerna-fork/changed@^3.0.0-beta.25":
- version "3.0.0-beta.25"
- resolved "https://registry.yarnpkg.com/@0x-lerna-fork/changed/-/changed-3.0.0-beta.25.tgz#68fec3a4bf2b0808561db2d13d0b117659fb3242"
+"@0x-lerna-fork/changed@^3.0.0-beta.26":
+ version "3.0.0-beta.26"
+ resolved "https://registry.yarnpkg.com/@0x-lerna-fork/changed/-/changed-3.0.0-beta.26.tgz#23559565bea7811baf24566b8cb6c160044f79ae"
dependencies:
"@0x-lerna-fork/collect-updates" "^3.0.0-beta.22"
"@0x-lerna-fork/command" "^3.0.0-beta.22"
"@0x-lerna-fork/output" "^3.0.0-beta.22"
- "@0x-lerna-fork/publish" "^3.0.0-beta.25"
+ "@0x-lerna-fork/publish" "^3.0.0-beta.26"
chalk "^2.3.1"
"@0x-lerna-fork/child-process@^3.0.0-beta.22":
@@ -81,13 +81,13 @@
p-map-series "^1.0.0"
p-waterfall "^1.0.0"
-"@0x-lerna-fork/cli@^3.0.0-beta.25":
- version "3.0.0-beta.25"
- resolved "https://registry.yarnpkg.com/@0x-lerna-fork/cli/-/cli-3.0.0-beta.25.tgz#1becdaf2cf2cbbbda7e2fcc96c3058398d7ed802"
+"@0x-lerna-fork/cli@^3.0.0-beta.26":
+ version "3.0.0-beta.26"
+ resolved "https://registry.yarnpkg.com/@0x-lerna-fork/cli/-/cli-3.0.0-beta.26.tgz#26c2e11481129e77f44275e1c56f9a7f06f9ae70"
dependencies:
"@0x-lerna-fork/add" "^3.0.0-beta.22"
"@0x-lerna-fork/bootstrap" "^3.0.0-beta.22"
- "@0x-lerna-fork/changed" "^3.0.0-beta.25"
+ "@0x-lerna-fork/changed" "^3.0.0-beta.26"
"@0x-lerna-fork/clean" "^3.0.0-beta.22"
"@0x-lerna-fork/create" "^3.0.0-beta.22"
"@0x-lerna-fork/diff" "^3.0.0-beta.22"
@@ -97,7 +97,7 @@
"@0x-lerna-fork/init" "^3.0.0-beta.22"
"@0x-lerna-fork/link" "^3.0.0-beta.22"
"@0x-lerna-fork/list" "^3.0.0-beta.22"
- "@0x-lerna-fork/publish" "^3.0.0-beta.25"
+ "@0x-lerna-fork/publish" "^3.0.0-beta.26"
"@0x-lerna-fork/run" "^3.0.0-beta.22"
dedent "^0.7.0"
is-ci "^1.0.10"
@@ -250,11 +250,11 @@
p-map "^1.2.0"
write-json-file "^2.3.0"
-"@0x-lerna-fork/lerna@3.0.0-beta.25":
- version "3.0.0-beta.25"
- resolved "https://registry.yarnpkg.com/@0x-lerna-fork/lerna/-/lerna-3.0.0-beta.25.tgz#0b5b85b4af3741863937f85ef130500e23325593"
+"@0x-lerna-fork/lerna@3.0.0-beta.26":
+ version "3.0.0-beta.26"
+ resolved "https://registry.yarnpkg.com/@0x-lerna-fork/lerna/-/lerna-3.0.0-beta.26.tgz#d54e506b6e16a83279c6350470ecced2d8acf092"
dependencies:
- "@0x-lerna-fork/cli" "^3.0.0-beta.25"
+ "@0x-lerna-fork/cli" "^3.0.0-beta.26"
import-local "^1.0.0"
npmlog "^4.1.2"
@@ -363,9 +363,9 @@
inquirer "^5.1.0"
npmlog "^4.1.2"
-"@0x-lerna-fork/publish@^3.0.0-beta.25":
- version "3.0.0-beta.25"
- resolved "https://registry.yarnpkg.com/@0x-lerna-fork/publish/-/publish-3.0.0-beta.25.tgz#edcb6d68b441b8456ceafb3073509da20fa2af0c"
+"@0x-lerna-fork/publish@^3.0.0-beta.26":
+ version "3.0.0-beta.26"
+ resolved "https://registry.yarnpkg.com/@0x-lerna-fork/publish/-/publish-3.0.0-beta.26.tgz#d1e36cf325b3a40e3c9dc0d02ac93a1c17ce50fb"
dependencies:
"@0x-lerna-fork/batch-packages" "^3.0.0-beta.22"
"@0x-lerna-fork/child-process" "^3.0.0-beta.22"
@@ -3312,6 +3312,10 @@ boom@5.x.x:
dependencies:
hoek "4.x.x"
+bottleneck@^2.13.2:
+ version "2.13.2"
+ resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.13.2.tgz#f3f28f0ddf82cdd3e44072aee3104a42adcca352"
+
bowser@^1.7.3, bowser@^1.9.3:
version "1.9.3"
resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.3.tgz#6643ae4d783f31683f6d23156976b74183862162"
@@ -14445,9 +14449,9 @@ solc@^0.4.24:
semver "^5.3.0"
yargs "^4.7.1"
-solhint@^1.2.1:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/solhint/-/solhint-1.4.0.tgz#59018cfc86e2fc268c8b520322ab1e0db1fdb94b"
+solhint@^1.4.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/solhint/-/solhint-1.4.1.tgz#921ef9fed83dc945853079865140730d4d2140b2"
dependencies:
antlr4 "4.7.1"
commander "2.18.0"