Merge remote-tracking branch 'upstream/development' into website

This commit is contained in:
Fred Carlsen
2018-11-27 16:19:36 +01:00
157 changed files with 1431 additions and 525 deletions

39
.github/autolabeler.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
python: ['python-packages']
contracts: ['contracts']
sol-doc: ['packages/sol-doc']
sol-resolver: ['packages/sol-resolver']
sra-spec: ['packages/sra-spec']
subproviders: ['packages/subproviders']
contract-addresses: ['packages/contract-addresses']
migrations: ['packages/migrations']
web3-wrapper: ['packages/web3-wrapper']
sol-compiler: ['packages/sol-compiler']
types: ['packages/types']
instant: ['packages/instant']
abi-gen-templates: ['packages/abi-gen-templates']
abi-gen: ['packages/abi-gen']
website: ['packages/website']
sol-cov: ['packages/sol-cov']
utils: ['packages/utils']
tslint-config: ['packages/tslint-config']
asset-buyer: ['packages/asset-buyer']
order-watcher: ['packages/order-watcher']
react-docs: ['packages/react-docs']
order-utils: ['packages/order-utils']
react-shared: ['packages/react-shared']
assert: ['packages/assert']
base-contract: ['packages/base-contract']
typescript-typings: ['packages/typescript-typings']
0x.js: ['packages/0x.js']
abi-gen-wrappers: ['packages/abi-gen-wrappers']
metacoin: ['packages/metacoin']
contract-artifacts: ['packages/contract-artifacts']
dev-utils: ['packages/dev-utils']
contract-wrappers: ['packages/contract-wrappers']
json-schemas: ['packages/json-schemas']
ethereum-types: ['ethereum-types']
connect: ['packages/connect']
fill-scenarios: ['packages/fill-scenarios']
dev-tools-pages: ['packages/dev-tools-pages']
testnet-faucets: ['packages/testnet-faucets']
monorepo-scripts: ['packages/monorepo-scripts']

19
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you
for your contributions.

View File

@@ -21,7 +21,6 @@
<!--- The following points should be used to indicate the progress of your PR. Put an `x` in all the boxes that apply right now, and come back over time and check them off as you make progress. If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
* [ ] Prefix PR title with `[WIP]` if necessary.
* [ ] Prefix PR title with bracketed package name(s) corresponding to the changed package(s). For example: `[sol-cov] Fixed bug`.
* [ ] Add tests to cover changes as needed.
* [ ] Update documentation as needed.
* [ ] Add new entries to the relevant CHANGELOG.jsons.

111
README.md
View File

@@ -2,7 +2,7 @@
---
[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. A full description of the protocol may be found in our [whitepaper][whitepaper-url].
[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. For more information on how it works, check out the [0x protocol specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
This repository is a monorepo including the 0x protocol smart contracts and numerous developer tools. Each public sub-package is independently published to NPM.
@@ -18,71 +18,72 @@ If you're developing on 0x now or are interested in using 0x infrastructure in t
[![Join the chat at https://gitter.im/0xProject/Lobby](https://badges.gitter.im/0xProject/Lobby.svg)](https://gitter.im/0xProject/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
### Published Packages
## Packages
#### TypeScript/JavaScript
Visit our [developer portal](https://0xproject.com/docs/order-utils) for a comprehensive list of core & community maintained packages. All packages maintained with this monorepo are listed below.
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using @0x/abi-gen |
| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | Used to get known addresses of deployed 0x contracts |
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | Smart TS wrappers for 0x smart contracts |
| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [![npm](https://img.shields.io/npm/v/@0x/fill-scenarios.svg)](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generation |
| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related json schemas |
| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | 0x smart contract migrations |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/order-watcher`](/packages/order-watcher) | [![npm](https://img.shields.io/npm/v/@0x/order-watcher.svg)](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
| [`@0x/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0x/react-docs.svg)](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0x/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0x/react-shared.svg)](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties |
| [`@0x/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0x/sol-cov.svg)](https://www.npmjs.com/package/@0x/sol-cov) | Solidity test coverage tool |
| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the standard relayer API |
| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g. LedgerSubprovider) |
| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom 0x development TSLint rules |
| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
| [`@0x/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0x/utils.svg)](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0x/web3-wrapper.svg)](https://www.npmjs.com/package/@0x/web3-wrapper) | Web3 wrapper |
#### Python
### 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 |
### Private Packages
### Typescript/Javascript Packages
| Package | Description |
| -------------------------------------------------------- | ---------------------------------------------------------------- |
| [`@0x/contracts`](/packages/contracts) | 0x solidity smart contracts & tests |
| [`@0x/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0x/react-docs` |
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
| [`@0x/website`](/packages/website) | 0x website & Portal DApp |
#### 0x-specific packages
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | An aggregate package combining many smaller utility packages for interacting with the 0x protocol |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related JSON schemas |
| [`@0x/order-watcher`](/packages/order-watcher) | [![npm](https://img.shields.io/npm/v/@0x/order-watcher.svg)](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using `@0x/abi-gen` |
| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the Standard Relayer API |
| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | An HTTP/WS client for interacting with the Standard Relayer API |
| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
#### Ethereum tooling
| Package | Version | Description |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0x/web3-wrapper.svg)](https://www.npmjs.com/package/@0x/web3-wrapper) | An Ethereum JSON RPC client |
| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A wrapper around solc-js that adds smart re-compilation, ability to compile an entire project, Solidity version specific compilation, standard input description support and much more. |
| [`@0x/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0x/sol-cov.svg)](https://www.npmjs.com/package/@0x/sol-cov) | A solidity test coverage tool |
| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Web3 provider middlewares (e.g. LedgerSubprovider) |
| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
#### Utilities
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom TSLint rules used by the 0x core team |
| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
| [`@0x/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0x/utils.svg)](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
| [`@0x/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0x/react-docs.svg)](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & sol-doc generated JSON |
| [`@0x/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0x/react-shared.svg)](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x packages |
| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [![npm](https://img.shields.io/npm/v/@0x/fill-scenarios.svg)](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generator |
#### Private Packages
| Package | Description |
| -------------------------------------------------- | ---------------------------------------------------------------- |
| [`@0x/contracts`](/packages/contracts) | 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 |
## Usage
Dedicated documentation pages:
* [0x.js Library](https://0xproject.com/docs/0xjs)
* [0x Connect](https://0xproject.com/docs/connect)
* [Smart contracts](https://0xproject.com/docs/contracts)
* [Subproviders](https://0xproject.com/docs/subproviders)
* [Sol Compiler](https://0xproject.com/docs/sol-compiler)
* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
* [JSON-schemas](https://0xproject.com/docs/json-schemas)
* [Sol-cov](https://0xproject.com/docs/sol-cov)
* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
Node version >= 6.12 is required.
Most of the packages require additional typings for external dependencies.

View File

@@ -22,13 +22,13 @@
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna": "lerna",
"build": "wsrun build $PKG --fast-exit -r --stages",
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0x/website",
"build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website",
"build": "wsrun build $PKG --fast-exit -r --stages --exclude-missing",
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing",
"build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing",
"build:monorepo_scripts": "PKG=@0x/monorepo-scripts yarn build",
"build:ts": "tsc -b",
"watch:ts": "tsc -b -w",
"clean": "wsrun clean $PKG --fast-exit -r --parallel",
"clean": "wsrun clean $PKG --fast-exit -r --parallel --exclude-missing",
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
"rebuild": "run-s clean build",
"rebuild:no_website": "run-s clean build:no_website",
@@ -40,7 +40,7 @@
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer"
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer migrations"
},
"bundlewatch": {
"files": [

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "2.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "2.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.5 - _November 21, 2018_
* Dependencies updated
## v2.0.4 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "2.0.4",
"version": "2.0.5",
"engines": {
"node": ">=6.12"
},
@@ -42,11 +42,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen": "^1.0.16",
"@0x/abi-gen-wrappers": "^1.0.5",
"@0x/contract-addresses": "^1.1.0",
"@0x/dev-utils": "^1.0.17",
"@0x/migrations": "^2.0.4",
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/contract-addresses": "^1.2.0",
"@0x/dev-utils": "^1.0.18",
"@0x/migrations": "^2.1.0",
"@0x/tslint-config": "^1.0.10",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -73,16 +72,16 @@
"webpack": "^4.20.2"
},
"dependencies": {
"@0x/assert": "^1.0.17",
"@0x/base-contract": "^3.0.6",
"@0x/contract-wrappers": "^4.0.2",
"@0x/order-utils": "^3.0.2",
"@0x/order-watcher": "^2.2.4",
"@0x/subproviders": "^2.1.4",
"@0x/types": "^1.2.1",
"@0x/assert": "^1.0.18",
"@0x/base-contract": "^3.0.7",
"@0x/contract-wrappers": "^4.1.0",
"@0x/order-utils": "^3.0.3",
"@0x/order-watcher": "^2.2.5",
"@0x/subproviders": "^2.1.5",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",

View File

@@ -0,0 +1,11 @@
[
{
"version": "1.0.0",
"changes": [
{
"note": "Initial publish",
"pr": 1305
}
]
}
]

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -40,7 +41,7 @@ export class {{contractName}}Contract extends BaseContract {
{{/this.constant}}
{{/each}}
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}

View File

@@ -0,0 +1,20 @@
{
"name": "@0x/abi-gen-templates",
"version": "1.0.0",
"engines": {
"node": ">=6.12"
},
"description": "Handlebars templates used by abi-gen to generate contract-wrappers",
"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/packages/abi-gen-templates/README.md",
"publishConfig": {
"access": "public"
}
}

View File

@@ -1,4 +1,24 @@
[
{
"version": "2.0.0",
"changes": [
{
"pr": 1309,
"note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
}
]
},
{
"version": "1.1.0",
"changes": [
{
"note":
"`deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface",
"pr": 1298
}
],
"timestamp": 1542821676
},
{
"timestamp": 1542208198,
"version": "1.0.5",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.0 - _November 21, 2018_
* `deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface (#1298)
## v1.0.5 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
"version": "1.0.5",
"version": "1.1.0",
"engines": {
"node": ">=6.12"
},
@@ -15,7 +15,7 @@
"lint": "tslint --format stylish --project .",
"pre_build": "yarn generate_contract_wrappers",
"clean": "shx rm -rf lib wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
"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 src/generated-wrappers --backend ethers"
},
"config": {
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
@@ -30,17 +30,19 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.16",
"@0x/abi-gen": "^1.0.17",
"@0x/abi-gen-templates": "^1.0.0",
"@0x/tslint-config": "^1.0.10",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/types": "^1.3.0",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
"@0x/base-contract": "^3.0.6"
"@0x/base-contract": "^3.0.7"
},
"publishConfig": {
"access": "public"

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -1800,7 +1801,7 @@ export class AssetProxyOwnerContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_owners: string[],

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -968,7 +969,7 @@ export class DummyERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -1264,7 +1265,7 @@ export class DummyERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -601,7 +602,7 @@ export class ERC20ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20ProxyContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -508,7 +509,7 @@ export class ERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20TokenContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -601,7 +602,7 @@ export class ERC721ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721ProxyContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -845,7 +846,7 @@ export class ERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721TokenContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -3024,32 +3025,38 @@ export class ExchangeContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_zrxAssetData: string,
): Promise<ExchangeContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, );
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_zrxAssetData: string,
): Promise<ExchangeContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[] = BaseContract._formatABIDataItemList(
[_zrxAssetData
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[],
[_zrxAssetData
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, []);
const txData = deployInfo.encode(bytecode, [_zrxAssetData
]);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
@@ -3061,7 +3068,8 @@ export class ExchangeContract extends BaseContract {
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [];
contractInstance.constructorArgs = [_zrxAssetData
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -661,7 +662,7 @@ export class ForwarderContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -60,7 +61,7 @@ export class IValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IValidatorContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -55,7 +56,7 @@ export class IWalletContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IWalletContract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -295,7 +296,7 @@ export class OrderValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -787,7 +788,7 @@ export class WETH9Contract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<WETH9Contract> {

View File

@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -598,7 +599,7 @@ export class ZRXTokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ZRXTokenContract> {

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "1.0.17",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "1.0.16",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.17 - _November 21, 2018_
* Dependencies updated
## v1.0.16 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
"version": "1.0.16",
"version": "1.0.17",
"engines": {
"node": ">=6.12"
},
@@ -32,7 +32,7 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/utils": "^2.0.6",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.2",
"glob": "^7.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "1.0.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "1.0.17",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.18 - _November 21, 2018_
* Dependencies updated
## v1.0.17 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
"version": "1.0.17",
"version": "1.0.18",
"engines": {
"node": ">=6.12"
},
@@ -44,9 +44,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/json-schemas": "^2.1.1",
"@0x/json-schemas": "^2.1.2",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/utils": "^2.0.6",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},

View File

@@ -6,7 +6,8 @@
"note": "Dependencies updated",
"pr": 1276
}
]
],
"timestamp": 1542821676
},
{
"version": "3.0.0",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.1 - _November 21, 2018_
* Dependencies updated (#1276)
## v3.0.0 - _November 14, 2018_
* update `getBuyQuoteAsync` to return eth spent on assets instead of per unit amount (#1252)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
"version": "3.0.0",
"version": "3.0.1",
"engines": {
"node": ">=6.12"
},
@@ -36,16 +36,16 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
"@0x/assert": "^1.0.17",
"@0x/connect": "^3.0.6",
"@0x/contract-wrappers": "^4.0.2",
"@0x/json-schemas": "^2.1.1",
"@0x/order-utils": "^3.0.2",
"@0x/subproviders": "^2.1.4",
"@0x/types": "^1.2.1",
"@0x/assert": "^1.0.18",
"@0x/connect": "^3.0.7",
"@0x/contract-wrappers": "^4.1.0",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/subproviders": "^2.1.5",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"ethereum-types": "^1.1.2",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "3.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "3.0.6",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.7 - _November 21, 2018_
* Dependencies updated
## v3.0.6 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
"version": "3.0.6",
"version": "3.0.7",
"engines": {
"node": ">=6.12"
},
@@ -41,8 +41,8 @@
},
"dependencies": {
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "3.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "3.0.6",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.7 - _November 21, 2018_
* Dependencies updated
## v3.0.6 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
"version": "3.0.6",
"version": "3.0.7",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
"@0x/assert": "^1.0.17",
"@0x/json-schemas": "^2.1.1",
"@0x/order-utils": "^3.0.2",
"@0x/types": "^1.2.1",
"@0x/assert": "^1.0.18",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/utils": "^2.0.6",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",

View File

@@ -5,7 +5,8 @@
{
"note": "Rinkeby Deployment"
}
]
],
"timestamp": 1542821676
},
{
"version": "1.1.0",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.2.0 - _November 21, 2018_
* Rinkeby Deployment
## v1.1.0 - _November 9, 2018_
* Update Forwarder addresses (#1192)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "1.1.0",
"version": "1.2.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,13 @@
[
{
"version": "1.1.2",
"changes": [
{
"pr": 1309,
"note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
}
]
},
{
"version": "1.1.0",
"changes": [

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,8 @@
"Add a `nonce` field for `TxOpts` so that it's now possible to re-broadcast stuck transactions with a higher gas amount",
"pr": 1292
}
]
],
"timestamp": 1542821676
},
{
"timestamp": 1542208198,

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.0 - _November 21, 2018_
* Add a `nonce` field for `TxOpts` so that it's now possible to re-broadcast stuck transactions with a higher gas amount (#1292)
## v4.0.2 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "4.0.2",
"version": "4.1.0",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,9 +37,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.17",
"@0x/migrations": "^2.0.4",
"@0x/subproviders": "^2.1.4",
"@0x/dev-utils": "^1.0.18",
"@0x/migrations": "^2.1.0",
"@0x/subproviders": "^2.1.5",
"@0x/tslint-config": "^1.0.10",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -65,17 +65,17 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^1.0.5",
"@0x/assert": "^1.0.17",
"@0x/contract-addresses": "^1.1.0",
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/assert": "^1.0.18",
"@0x/contract-addresses": "^1.2.0",
"@0x/contract-artifacts": "^1.1.0",
"@0x/fill-scenarios": "^1.0.12",
"@0x/json-schemas": "^2.1.1",
"@0x/order-utils": "^3.0.2",
"@0x/types": "^1.2.1",
"@0x/fill-scenarios": "^1.0.13",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"ethereum-types": "^1.1.2",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",

View File

@@ -1,4 +1,14 @@
[
{
"name": "OrderValidator",
"version": "1.0.1",
"changes": [
{
"note": "remove `getApproved` check from ERC721 approval query",
"pr": 1149
}
]
},
{
"name": "Forwarder",
"version": "1.1.0",

View File

@@ -148,7 +148,7 @@ contract OrderValidator {
balance = target == owner ? 1 : 0;
// Check if ERC721Proxy is approved to spend tokenId
bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy) || IERC721Token(token).getApproved(tokenId) == assetProxy;
bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy);
// Set alowance to 1 if ERC721Proxy is approved to spend tokenId
allowance = isApproved ? 1 : 0;

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "contracts",
"version": "2.1.54",
"version": "2.1.55",
"engines": {
"node": ">=6.12"
},
@@ -22,7 +22,7 @@
"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 ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"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",
@@ -45,11 +45,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.16",
"@0x/dev-utils": "^1.0.17",
"@0x/sol-compiler": "^1.1.12",
"@0x/sol-cov": "^2.1.12",
"@0x/subproviders": "^2.1.4",
"@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",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -71,12 +71,12 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.6",
"@0x/order-utils": "^3.0.2",
"@0x/types": "^1.2.1",
"@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.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.2",

View File

@@ -198,7 +198,7 @@ describe('OrderValidator', () => {
);
expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
});
it('should return an allowance of 1 when ERC721Proxy is approved for specific tokenId', async () => {
it('should return an allowance of 0 when ERC721Proxy is approved for specific tokenId', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
constants.AWAIT_TRANSACTION_MINED_MS,
@@ -213,7 +213,7 @@ describe('OrderValidator', () => {
makerAddress,
erc721AssetData,
);
expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
expect(newAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
});
});
});
@@ -248,8 +248,9 @@ describe('OrderValidator', () => {
await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
from: makerAddress,
}),
constants.AWAIT_TRANSACTION_MINED_MS,
@@ -311,8 +312,9 @@ describe('OrderValidator', () => {
await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
from: takerAddress,
}),
constants.AWAIT_TRANSACTION_MINED_MS,
@@ -465,8 +467,9 @@ describe('OrderValidator', () => {
await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
from: takerAddress,
}),
constants.AWAIT_TRANSACTION_MINED_MS,

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/dev-tools-pages",
"version": "0.0.6",
"version": "0.0.7",
"engines": {
"node": ">=6.12"
},
@@ -16,7 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@0x/react-shared": "^1.0.21",
"@0x/react-shared": "^1.0.22",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"less": "^2.7.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "1.0.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "1.0.17",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.18 - _November 21, 2018_
* Dependencies updated
## v1.0.17 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/dev-utils",
"version": "1.0.17",
"version": "1.0.18",
"engines": {
"node": ">=6.12"
},
@@ -41,11 +41,11 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/subproviders": "^2.1.4",
"@0x/types": "^1.2.1",
"@0x/subproviders": "^2.1.5",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@types/web3-provider-engine": "^14.0.0",
"chai": "^4.0.1",
"ethereum-types": "^1.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "1.0.12",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _November 21, 2018_
* Dependencies updated
## v1.0.12 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
"version": "1.0.12",
"version": "1.0.13",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -28,14 +28,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^1.0.5",
"@0x/base-contract": "^3.0.6",
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/base-contract": "^3.0.7",
"@0x/contract-artifacts": "^1.1.0",
"@0x/order-utils": "^3.0.2",
"@0x/types": "^1.2.1",
"@0x/order-utils": "^3.0.3",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -1,5 +1,5 @@
.*
*
*/
!lib/src/**/*
!lib/**/*
!umd/**/*

View File

@@ -1 +1,11 @@
[]
[
{
"timestamp": 1542821676,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
}
]

View File

@@ -1 +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.1 - _November 21, 2018_
* Dependencies updated

View File

@@ -1,13 +1,13 @@
{
"name": "@0x/instant",
"version": "1.0.0",
"version": "1.0.1",
"engines": {
"node": ">=6.12"
},
"description": "0x Instant React Component",
"private": true,
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"description": "0x Instant React Component",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "yarn build:all",
"build:all": "run-p build:umd:prod build:commonjs",
@@ -45,15 +45,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
"@0x/assert": "^1.0.17",
"@0x/asset-buyer": "^3.0.0",
"@0x/json-schemas": "^2.1.1",
"@0x/order-utils": "^3.0.2",
"@0x/subproviders": "^2.1.4",
"@0x/types": "^1.2.1",
"@0x/assert": "^1.0.18",
"@0x/asset-buyer": "^3.0.1",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/subproviders": "^2.1.5",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"bowser": "^1.9.4",
"copy-to-clipboard": "^3.0.8",
"ethereum-types": "^1.1.2",
@@ -99,6 +99,6 @@
"webpack-dev-server": "^3.1.9"
},
"publishConfig": {
"access": "private"
"access": "public"
}
}

View File

@@ -1,137 +1,206 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>0x Instant Dev Environment</title>
<link rel="stylesheet" href="/external.css">
<script type="text/javascript" src="/instant.js" charset="utf-8"></script>
<script type="text/javascript" src="https://unpkg.com/jsuri@1.3.1/Uri.js" charset="utf-8"></script>
<script type="text/javascript" src="https://unpkg.com/bignumber.js@4.1.0/bignumber.js" charset="utf-8"></script>
<style>
#zeroExInstantContainer {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
body {
margin: 0;
background-color: rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<div id="zeroExInstantContainer"></div>
<script>
const removeUndefined = (obj) => {
for (let k in obj) if (obj[k] === undefined) delete obj[k];
return obj;
}
BigNumber.config({
EXPONENTIAL_AT: 1000,
DECIMAL_PLACES: 78,
});
const providedOrders = [
// Order selling REP
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('200000000000000000000'),
takerAssetAmount: new BigNumber('10000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber('3101985707338942582579795423923841749956600670712030922928319824580764688653'),
signature: '0x1bd4d5686fea801fe33c68c4944356085e7e6cb553eb7073160abd815609f714e85fb47f44b7ffd0a2a1321ac40d72d55163869d0a50fdb5a402132150fe33a08403',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
},
// Order selling ZRX
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('300000000000000000000'),
takerAssetAmount: new BigNumber('31000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('2524636800'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber('64592004666704945574675477805199411288137454783320798602050822322450089238268'),
signature: '0x1c13cacddca8d7d8248e91f412377e68f8f1f9891a59a6c1b2eea9f7b33558c30c4fb86a448e08ab7def40a28fb3a3062dcb33bb3c45302447fce5c4288b7c7f5b03',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
},
// Order selling GNT
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('250000000000000000000'),
takerAssetAmount: new BigNumber('10000000000000000000'),
makerAssetData: '0xf47261b000000000000000000000000031fb614e223706f15d0d3c5f4b08bdf0d5c78623',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber('40204378562212615907903051460421336779451270522691667164301816101569427926606'),
signature: '0x1c788bf4b93769da1e8f195f52f0f59b4a298ac6da30cf6d05a87ed4be5ee974f61352ed1bc6a0844d0962b8c894c9ca08e452431255958a4e98dd93cbe1fbc73803',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
},
// Order selling MKR
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('200000000000000000000'),
takerAssetAmount: new BigNumber('5000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000007b6b10caa9e8e9552ba72638ea5b47c25afea1f3',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber('71338269924068280039932133924198049371838034090153601678083172009862985793828'),
signature: '0x1bb3151d57ee1e8fa697767ce83ee4ba77d1ceb8cc1e79c7d77126b3687517704c50c6b3d9cb42c7e7d4478d574b297dfbd1626c5c18a7bc9c2a792c4c07f0797c03',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>0x Instant Dev Environment</title>
<link rel="stylesheet" href="/external.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" />
<script type="text/javascript" src="/instant.js" charset="utf-8"></script>
<script type="text/javascript" src="https://unpkg.com/jsuri@1.3.1/Uri.js" charset="utf-8"></script>
<script type="text/javascript" src="https://unpkg.com/bignumber.js@4.1.0/bignumber.js" charset="utf-8"></script>
<style>
.flex-center {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
}
];
const queryParams = new Uri(window.location.search);
const renderOptionsDefaults = {
orderSource: 'https://api.radarrelay.com/0x/v2/',
onClose: () => { console.log('0x Instant Closed') }
}
const orderSourceOverride = queryParams.getQueryParamValue('orderSource');
const availableAssetDatasString = queryParams.getQueryParamValue('availableAssetDatas');
const feeRecipientOverride = queryParams.getQueryParamValue('feeRecipient');
const feePercentageOverride = +queryParams.getQueryParamValue('feePercentage');
let affiliateInfoOverride;
if (feeRecipientOverride !== undefined && feePercentageOverride !== undefined) {
affiliateInfoOverride = {
feeRecipient: feeRecipientOverride,
feePercentage: feePercentageOverride
};
}
const renderOptionsOverrides = {
orderSource: orderSourceOverride === 'provided' ? providedOrders : orderSourceOverride,
networkId: +queryParams.getQueryParamValue('networkId') || undefined,
defaultAssetBuyAmount: +queryParams.getQueryParamValue('defaultAssetBuyAmount') || undefined,
availableAssetDatas: availableAssetDatasString ? JSON.parse(availableAssetDatasString) : undefined,
defaultSelectedAssetData: queryParams.getQueryParamValue('defaultSelectedAssetData'),
affiliateInfo: affiliateInfoOverride,
}
const renderOptions = Object.assign({}, renderOptionsDefaults, removeUndefined(renderOptionsOverrides));
zeroExInstant.render(renderOptions);
</script>
</body>
</html>
.flex-center--column {
flex-direction: column;
}
.button {
margin: 10px;
}
body {
margin: 0;
height: 100vh;
background-color: rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<div class="flex-center flex-center--column">
<div><button class="button is-large" onClick="renderWithUrlDefaults()">Open</button></div>
<div>
<button
class="button is-danger"
onClick="renderWithAssetData('0xf47261b00000000000000000000000001985365e9f78359a9b6ad760e32412f4a445e862')"
>
Buy REP
</button>
<button
class="button is-black"
onClick="renderWithAssetData('0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498')"
>
Buy ZRX
</button>
<button
class="button is-info"
onClick="renderWithAssetData('0xf47261b00000000000000000000000006810e776880c02933d47db1b9fc05908e5386b96')"
>
Buy GNO
</button>
</div>
</div>
<div id="zeroExInstantContainer"></div>
<script>
// Simulate history
window.history.pushState({ page: 1 }, '0x Instant');
window.history.pushState({ page: 2 }, '0x Instant');
window.history.pushState({ page: 3 }, '0x Instant');
window.onpopstate = () => console.log("Integrator's onpopstate called");
const removeUndefined = obj => {
for (let k in obj) if (obj[k] === undefined) delete obj[k];
return obj;
};
BigNumber.config({
EXPONENTIAL_AT: 1000,
DECIMAL_PLACES: 78,
});
const providedOrders = [
// Order selling REP
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('200000000000000000000'),
takerAssetAmount: new BigNumber('10000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber('3101985707338942582579795423923841749956600670712030922928319824580764688653'),
signature:
'0x1bd4d5686fea801fe33c68c4944356085e7e6cb553eb7073160abd815609f714e85fb47f44b7ffd0a2a1321ac40d72d55163869d0a50fdb5a402132150fe33a08403',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
},
// Order selling ZRX
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('300000000000000000000'),
takerAssetAmount: new BigNumber('31000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('2524636800'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber(
'64592004666704945574675477805199411288137454783320798602050822322450089238268',
),
signature:
'0x1c13cacddca8d7d8248e91f412377e68f8f1f9891a59a6c1b2eea9f7b33558c30c4fb86a448e08ab7def40a28fb3a3062dcb33bb3c45302447fce5c4288b7c7f5b03',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
},
// Order selling GNT
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('250000000000000000000'),
takerAssetAmount: new BigNumber('10000000000000000000'),
makerAssetData: '0xf47261b000000000000000000000000031fb614e223706f15d0d3c5f4b08bdf0d5c78623',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber(
'40204378562212615907903051460421336779451270522691667164301816101569427926606',
),
signature:
'0x1c788bf4b93769da1e8f195f52f0f59b4a298ac6da30cf6d05a87ed4be5ee974f61352ed1bc6a0844d0962b8c894c9ca08e452431255958a4e98dd93cbe1fbc73803',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
},
// Order selling MKR
{
senderAddress: '0x0000000000000000000000000000000000000000',
makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
takerAddress: '0x0000000000000000000000000000000000000000',
makerFee: new BigNumber('0'),
takerFee: new BigNumber('0'),
makerAssetAmount: new BigNumber('200000000000000000000'),
takerAssetAmount: new BigNumber('5000000000000000000'),
makerAssetData: '0xf47261b00000000000000000000000007b6b10caa9e8e9552ba72638ea5b47c25afea1f3',
takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
expirationTimeSeconds: new BigNumber('1601535600'),
feeRecipientAddress: '0x0000000000000000000000000000000000000000',
salt: new BigNumber(
'71338269924068280039932133924198049371838034090153601678083172009862985793828',
),
signature:
'0x1bb3151d57ee1e8fa697767ce83ee4ba77d1ceb8cc1e79c7d77126b3687517704c50c6b3d9cb42c7e7d4478d574b297dfbd1626c5c18a7bc9c2a792c4c07f0797c03',
exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
},
];
const getRenderOptionsOverridesFromUrl = () => {
const queryParams = new Uri(window.location.search);
const orderSourceOverride = queryParams.getQueryParamValue('orderSource');
const availableAssetDatasString = queryParams.getQueryParamValue('availableAssetDatas');
const feeRecipientOverride = queryParams.getQueryParamValue('feeRecipient');
const feePercentageOverride = +queryParams.getQueryParamValue('feePercentage');
let affiliateInfoOverride;
if (feeRecipientOverride !== undefined && feePercentageOverride !== undefined) {
affiliateInfoOverride = {
feeRecipient: feeRecipientOverride,
feePercentage: feePercentageOverride,
};
}
const renderOptionsOverrides = {
orderSource: orderSourceOverride === 'provided' ? providedOrders : orderSourceOverride,
networkId: +queryParams.getQueryParamValue('networkId') || undefined,
defaultAssetBuyAmount: +queryParams.getQueryParamValue('defaultAssetBuyAmount') || undefined,
availableAssetDatas: availableAssetDatasString ? JSON.parse(availableAssetDatasString) : undefined,
defaultSelectedAssetData: queryParams.getQueryParamValue('defaultSelectedAssetData'),
affiliateInfo: affiliateInfoOverride,
shouldDisablePushToHistory: !!queryParams.getQueryParamValue('shouldDisablePushToHistory'),
};
return renderOptionsOverrides;
};
const render = renderOptionsOverrides => {
const renderOptionsDefaults = {
orderSource: 'https://api.radarrelay.com/0x/v2/',
onClose: () => {
console.log('0x Instant Closed');
},
};
const renderOptions = Object.assign({}, renderOptionsDefaults, removeUndefined(renderOptionsOverrides));
zeroExInstant.render(renderOptions);
};
const renderWithUrlDefaults = (renderOptions = {}) => {
const finalOptions = {
...getRenderOptionsOverridesFromUrl(),
...renderOptions,
};
render(finalOptions);
};
renderWithUrlDefaults();
const renderWithAssetData = assetData => {
renderWithUrlDefaults({
defaultSelectedAssetData: assetData,
});
};
</script>
</body>
</html>

View File

@@ -64,6 +64,9 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
maxFontSizePx={this.props.startingFontSizePx}
onAmountChange={this._handleChange}
onFontSizeChange={this._handleFontSizeChange}
hasAutofocus={true}
/* We send in a key of asset data to force a rerender of this component when the user selects a new asset. We do this so the autofocus attribute will bring focus onto this input */
key={asset.assetData}
/>
</Container>
<Container

View File

@@ -107,7 +107,7 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
private readonly _renderEthAmount = (): React.ReactNode => {
return (
<Text fontSize="16px" fontColor={ColorOption.white} fontWeight={500}>
<Text fontSize="16px" textAlign="right" width="100%" fontColor={ColorOption.white} fontWeight={500}>
{format.ethBaseUnitAmount(
this.props.totalEthBaseUnitAmount,
4,
@@ -119,7 +119,7 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
private readonly _renderDollarAmount = (): React.ReactNode => {
return (
<Text fontSize="16px" fontColor={ColorOption.white}>
<Text fontSize="16px" textAlign="right" width="100%" fontColor={ColorOption.white}>
{format.ethBaseUnitAmountInUsd(
this.props.totalEthBaseUnitAmount,
this.props.ethUsdPrice,

View File

@@ -18,6 +18,7 @@ export interface ScalingAmountInputProps {
value?: BigNumber;
onAmountChange: (value?: BigNumber) => void;
onFontSizeChange: (fontSizePx: number) => void;
hasAutofocus: boolean;
}
interface ScalingAmountInputState {
stringValue: string;
@@ -29,6 +30,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
onAmountChange: util.boundNoop,
onFontSizeChange: util.boundNoop,
isDisabled: false,
hasAutofocus: false,
};
public constructor(props: ScalingAmountInputProps) {
super(props);
@@ -64,6 +66,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
placeholder="0.00"
emptyInputWidthCh={3.5}
isDisabled={this.props.isDisabled}
hasAutofocus={this.props.hasAutofocus}
/>
);
}

View File

@@ -28,6 +28,7 @@ export interface ScalingInputProps {
maxLength?: number;
scalingSettings: ScalingSettings;
isDisabled: boolean;
hasAutofocus: boolean;
}
export interface ScalingInputState {
@@ -51,6 +52,7 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
maxLength: 7,
scalingSettings: defaultScalingSettings,
isDisabled: false,
hasAutofocus: false,
};
public state: ScalingInputState = {
inputWidthPxAtPhaseChange: undefined,
@@ -123,7 +125,7 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
}
}
public render(): React.ReactNode {
const { isDisabled, fontColor, onChange, placeholder, value, maxLength } = this.props;
const { hasAutofocus, isDisabled, fontColor, onChange, placeholder, value, maxLength } = this.props;
const phase = ScalingInput.getPhaseFromProps(this.props);
return (
<Input
@@ -136,6 +138,7 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
width={this._calculateWidth(phase)}
maxLength={maxLength}
disabled={isDisabled}
autoFocus={hasAutofocus}
/>
);
}

View File

@@ -11,6 +11,7 @@ export interface TextProps {
fontSize?: string;
opacity?: number;
letterSpacing?: string;
textAlign?: string;
textTransform?: string;
lineHeight?: string;
className?: string;
@@ -22,6 +23,7 @@ export interface TextProps {
noWrap?: boolean;
display?: string;
href?: string;
width?: string;
}
export const Text: React.StatelessComponent<TextProps> = ({ href, onClick, ...rest }) => {
@@ -51,6 +53,8 @@ export const StyledText =
${props => (props.display ? `display: ${props.display}` : '')};
${props => (props.letterSpacing ? `letter-spacing: ${props.letterSpacing}` : '')};
${props => (props.textTransform ? `text-transform: ${props.textTransform}` : '')};
${props => (props.textAlign ? `text-align: ${props.textAlign}` : '')};
${props => (props.width ? `width: ${props.width}` : '')};
&:hover {
${props =>
props.onClick ? `color: ${darken(darkenOnHoverAmount, props.theme[props.fontColor || 'white'])}` : ''};

View File

@@ -20,8 +20,6 @@ import { Heartbeater } from '../util/heartbeater';
import { generateAccountHeartbeater, generateBuyQuoteHeartbeater } from '../util/heartbeater_factory';
import { providerStateFactory } from '../util/provider_state_factory';
fonts.include();
export type ZeroExInstantProviderProps = ZeroExInstantProviderRequiredProps &
Partial<ZeroExInstantProviderOptionalProps>;
@@ -88,6 +86,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
}
constructor(props: ZeroExInstantProviderProps) {
super(props);
fonts.include();
const initialAppState = ZeroExInstantProvider._mergeDefaultStateWithProps(this.props);
this._store = store.create(initialAppState);
}
@@ -126,14 +125,15 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
// Analytics
disableAnalytics(this.props.shouldDisableAnalyticsTracking || false);
analytics.addEventProperties({
embeddedHost: window.location.host,
embeddedUrl: window.location.href,
networkId: state.network,
providerName: state.providerState.name,
gitSha: process.env.GIT_SHA,
npmVersion: process.env.NPM_PACKAGE_VERSION,
});
analytics.addEventProperties(
analytics.generateEventProperties(
state.network,
this.props.orderSource,
state.providerState,
window,
this.props.affiliateInfo,
),
);
analytics.trackInstantOpened();
}
public componentWillUnmount(): void {

View File

@@ -12,6 +12,7 @@ import { Action, actions } from '../redux/actions';
import { asyncData } from '../redux/async_data';
import { State } from '../redux/reducer';
import { Network, Omit, OperatingSystem, ProviderState, StandardSlidingPanelContent } from '../types';
import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
export interface ConnectedAccountPaymentMethodProps {}
@@ -40,8 +41,11 @@ const mapDispatchToProps = (
ownProps: ConnectedAccountPaymentMethodProps,
): ConnectedDispatch => ({
openInstallWalletPanel: () => dispatch(actions.openStandardSlidingPanel(StandardSlidingPanelContent.InstallWallet)),
unlockWalletAndDispatchToStore: async (providerState: ProviderState) =>
asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true),
unlockWalletAndDispatchToStore: (providerState: ProviderState) => {
analytics.trackAccountUnlockRequested();
// tslint:disable-next-line:no-floating-promises
asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true);
},
});
const mergeProps = (

View File

@@ -5,40 +5,50 @@ import * as ReactDOM from 'react-dom';
import { DEFAULT_ZERO_EX_CONTAINER_SELECTOR, INJECTED_DIV_CLASS, INJECTED_DIV_ID } from './constants';
import { ZeroExInstantOverlay, ZeroExInstantOverlayProps } from './index';
import { assert } from './util/assert';
import { util } from './util/util';
export const render = (props: ZeroExInstantOverlayProps, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => {
assert.isValidOrderSource('orderSource', props.orderSource);
if (!_.isUndefined(props.defaultSelectedAssetData)) {
assert.isHexString('defaultSelectedAssetData', props.defaultSelectedAssetData);
const isInstantRendered = (): boolean => !!document.getElementById(INJECTED_DIV_ID);
const validateInstantRenderConfig = (config: ZeroExInstantConfig, selector: string) => {
assert.isValidOrderSource('orderSource', config.orderSource);
if (!_.isUndefined(config.defaultSelectedAssetData)) {
assert.isHexString('defaultSelectedAssetData', config.defaultSelectedAssetData);
}
if (!_.isUndefined(props.additionalAssetMetaDataMap)) {
assert.isValidAssetMetaDataMap('props.additionalAssetMetaDataMap', props.additionalAssetMetaDataMap);
if (!_.isUndefined(config.additionalAssetMetaDataMap)) {
assert.isValidAssetMetaDataMap('additionalAssetMetaDataMap', config.additionalAssetMetaDataMap);
}
if (!_.isUndefined(props.defaultAssetBuyAmount)) {
assert.isNumber('props.defaultAssetBuyAmount', props.defaultAssetBuyAmount);
if (!_.isUndefined(config.defaultAssetBuyAmount)) {
assert.isNumber('defaultAssetBuyAmount', config.defaultAssetBuyAmount);
}
if (!_.isUndefined(props.networkId)) {
assert.isNumber('props.networkId', props.networkId);
if (!_.isUndefined(config.networkId)) {
assert.isNumber('networkId', config.networkId);
}
if (!_.isUndefined(props.availableAssetDatas)) {
assert.areValidAssetDatas('availableAssetDatas', props.availableAssetDatas);
if (!_.isUndefined(config.availableAssetDatas)) {
assert.areValidAssetDatas('availableAssetDatas', config.availableAssetDatas);
}
if (!_.isUndefined(props.onClose)) {
assert.isFunction('props.onClose', props.onClose);
if (!_.isUndefined(config.onClose)) {
assert.isFunction('onClose', config.onClose);
}
if (!_.isUndefined(props.zIndex)) {
assert.isNumber('props.zIndex', props.zIndex);
if (!_.isUndefined(config.zIndex)) {
assert.isNumber('zIndex', config.zIndex);
}
if (!_.isUndefined(props.affiliateInfo)) {
assert.isValidAffiliateInfo('props.affiliateInfo', props.affiliateInfo);
if (!_.isUndefined(config.affiliateInfo)) {
assert.isValidAffiliateInfo('affiliateInfo', config.affiliateInfo);
}
if (!_.isUndefined(props.provider)) {
assert.isWeb3Provider('props.provider', props.provider);
if (!_.isUndefined(config.provider)) {
assert.isWeb3Provider('provider', config.provider);
}
if (!_.isUndefined(props.shouldDisableAnalyticsTracking)) {
assert.isBoolean('props.shouldDisableAnalyticsTracking', props.shouldDisableAnalyticsTracking);
if (!_.isUndefined(config.shouldDisablePushToHistory)) {
assert.isBoolean('shouldDisablePushToHistory', config.shouldDisablePushToHistory);
}
if (!_.isUndefined(config.shouldDisableAnalyticsTracking)) {
assert.isBoolean('shouldDisableAnalyticsTracking', config.shouldDisableAnalyticsTracking);
}
assert.isString('selector', selector);
};
// Render instant and return a callback that allows you to remove it from the DOM.
const renderInstant = (config: ZeroExInstantConfig, selector: string) => {
const appendToIfExists = document.querySelector(selector);
assert.assert(!_.isNull(appendToIfExists), `Could not find div with selector: ${selector}`);
const appendTo = appendToIfExists as Element;
@@ -46,14 +56,57 @@ export const render = (props: ZeroExInstantOverlayProps, selector: string = DEFA
injectedDiv.setAttribute('id', INJECTED_DIV_ID);
injectedDiv.setAttribute('class', INJECTED_DIV_CLASS);
appendTo.appendChild(injectedDiv);
const closeInstant = () => {
if (!_.isUndefined(config.onClose)) {
config.onClose();
}
appendTo.removeChild(injectedDiv);
};
const instantOverlayProps = {
...props,
onClose: () => {
appendTo.removeChild(injectedDiv);
if (!_.isUndefined(props.onClose)) {
props.onClose();
}
},
...config,
// If we are using the history API, just go back to close
onClose: () => (config.shouldDisablePushToHistory ? closeInstant() : window.history.back()),
};
ReactDOM.render(React.createElement(ZeroExInstantOverlay, instantOverlayProps), injectedDiv);
return closeInstant;
};
export interface ZeroExInstantConfig extends ZeroExInstantOverlayProps {
shouldDisablePushToHistory?: boolean;
}
export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => {
validateInstantRenderConfig(config, selector);
if (config.shouldDisablePushToHistory) {
if (!isInstantRendered()) {
renderInstant(config, selector);
}
return;
}
// Before we render, push to history saying that instant is showing for this part of the history.
window.history.pushState({ zeroExInstantShowing: true }, '0x Instant');
let removeInstant = renderInstant(config, selector);
// If the integrator defined a popstate handler, save it to __zeroExInstantIntegratorsPopStateHandler
// unless we have already done so on a previous render.
const anyWindow = window as any;
if (window.onpopstate && !anyWindow.__zeroExInstantIntegratorsPopStateHandler) {
anyWindow.__zeroExInstantIntegratorsPopStateHandler = window.onpopstate.bind(window);
}
const integratorsOnPopStateHandler = anyWindow.__zeroExInstantIntegratorsPopStateHandler || util.boundNoop;
const onPopStateHandler = (e: PopStateEvent) => {
integratorsOnPopStateHandler(e);
const newState = e.state;
if (newState && newState.zeroExInstantShowing) {
// We have returned to a history state that expects instant to be rendered.
if (!isInstantRendered()) {
removeInstant = renderInstant(config, selector);
}
} else {
// History has changed to a different state.
if (isInstantRendered()) {
removeInstant();
}
}
};
window.onpopstate = onPopStateHandler;
};

View File

@@ -10,20 +10,6 @@ import { Action, ActionTypes } from './actions';
import { State } from './reducer';
const shouldTriggerWalletReady = (prevAccount: Account, curAccount: Account): boolean => {
const didJustTurnReady = curAccount.state === AccountState.Ready && prevAccount.state !== AccountState.Ready;
if (didJustTurnReady) {
return true;
}
if (curAccount.state === AccountState.Ready && prevAccount.state === AccountState.Ready) {
// Account was ready, and is now ready again, but address has changed
return curAccount.address !== prevAccount.address;
}
return false;
};
export const analyticsMiddleware: Middleware = store => next => middlewareAction => {
const prevState = store.getState() as State;
const prevAccount = prevState.providerState.account;
@@ -35,10 +21,24 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
switch (nextAction.type) {
case ActionTypes.SET_ACCOUNT_STATE_READY:
if (curAccount.state === AccountState.Ready && shouldTriggerWalletReady(prevAccount, curAccount)) {
if (curAccount.state === AccountState.Ready) {
const didJustTurnReady = prevAccount.state !== AccountState.Ready;
const didJustUpdateAddress =
prevAccount.state === AccountState.Ready && prevAccount.address !== curAccount.address;
const ethAddress = curAccount.address;
analytics.addUserProperties({ ethAddress });
analytics.trackWalletReady();
if (didJustTurnReady) {
analytics.trackAccountReady(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
} else if (didJustUpdateAddress) {
analytics.trackAccountAddressChanged(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
}
}
break;
case ActionTypes.SET_ACCOUNT_STATE_LOCKED:
if (prevAccount.state !== AccountState.Locked && curAccount.state === AccountState.Locked) {
// if we are moving from account not locked to account locked, track `Account - Locked`
analytics.trackAccountLocked();
}
break;
case ActionTypes.UPDATE_ACCOUNT_ETH_BALANCE:

View File

@@ -5,6 +5,7 @@ import { Dispatch } from 'redux';
import { BIG_NUMBER_ZERO } from '../constants';
import { AccountState, ERC20Asset, OrderProcessState, ProviderState } from '../types';
import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { buyQuoteUpdater } from '../util/buy_quote_updater';
import { coinbaseApi } from '../util/coinbase_api';
@@ -58,6 +59,7 @@ export const asyncData = {
? await (provider as any).enable()
: await web3Wrapper.getAvailableAddressesAsync();
} catch (e) {
analytics.trackAccountUnlockDenied();
dispatch(actions.setAccountStateLocked());
return;
}

View File

@@ -1,6 +1,6 @@
import { ObjectMap } from '@0x/types';
import { AffiliateInfo, Network, OrderSource, ProviderState } from '../types';
import { heapUtil } from './heap';
import { EventProperties, heapUtil } from './heap';
let isDisabled = false;
export const disableAnalytics = (shouldDisableAnalytics: boolean) => {
@@ -15,11 +15,15 @@ export const evaluateIfEnabled = (fnCall: () => void) => {
enum EventNames {
INSTANT_OPENED = 'Instant - Opened',
WALLET_READY = 'Wallet - Ready',
ACCOUNT_LOCKED = 'Account - Locked',
ACCOUNT_READY = 'Account - Ready',
ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested',
ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied',
ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed',
}
const track = (eventName: EventNames, eventData: ObjectMap<string | number> = {}): void => {
const track = (eventName: EventNames, eventProperties: EventProperties = {}): void => {
evaluateIfEnabled(() => {
heapUtil.evaluateHeapCall(heap => heap.track(eventName, eventData));
heapUtil.evaluateHeapCall(heap => heap.track(eventName, eventProperties));
});
};
function trackingEventFnWithoutPayload(eventName: EventNames): () => void {
@@ -28,16 +32,14 @@ function trackingEventFnWithoutPayload(eventName: EventNames): () => void {
};
}
// tslint:disable-next-line:no-unused-variable
function trackingEventFnWithPayload<T extends ObjectMap<string | number>>(
eventName: EventNames,
): (eventDataProperties: T) => void {
return (eventDataProperties: T) => {
track(eventName, eventDataProperties);
function trackingEventFnWithPayload(eventName: EventNames): (eventProperties: EventProperties) => void {
return (eventProperties: EventProperties) => {
track(eventName, eventProperties);
};
}
export interface AnalyticsUserOptions {
ethAddress?: string;
lastKnownEthAddress?: string;
ethBalanceInUnitAmount?: string;
}
export interface AnalyticsEventOptions {
@@ -47,7 +49,11 @@ export interface AnalyticsEventOptions {
providerName?: string;
gitSha?: string;
npmVersion?: string;
orderSource?: string;
affiliateAddress?: string;
affiliateFeePercent?: number;
}
export const analytics = {
addUserProperties: (properties: AnalyticsUserOptions): void => {
evaluateIfEnabled(() => {
@@ -59,6 +65,33 @@ export const analytics = {
heapUtil.evaluateHeapCall(heap => heap.addEventProperties(properties));
});
},
trackWalletReady: trackingEventFnWithoutPayload(EventNames.WALLET_READY),
generateEventProperties: (
network: Network,
orderSource: OrderSource,
providerState: ProviderState,
window: Window,
affiliateInfo?: AffiliateInfo,
): AnalyticsEventOptions => {
const affiliateAddress = affiliateInfo ? affiliateInfo.feeRecipient : 'none';
const affiliateFeePercent = affiliateInfo ? parseFloat(affiliateInfo.feePercentage.toFixed(4)) : 0;
const orderSourceName = typeof orderSource === 'string' ? orderSource : 'provided';
return {
embeddedHost: window.location.host,
embeddedUrl: window.location.href,
networkId: network,
providerName: providerState.name,
gitSha: process.env.GIT_SHA,
npmVersion: process.env.NPM_PACKAGE_VERSION,
orderSource: orderSourceName,
affiliateAddress,
affiliateFeePercent,
};
},
trackInstantOpened: trackingEventFnWithoutPayload(EventNames.INSTANT_OPENED),
trackAccountLocked: trackingEventFnWithoutPayload(EventNames.ACCOUNT_LOCKED),
trackAccountReady: (address: string) => trackingEventFnWithPayload(EventNames.ACCOUNT_READY)({ address }),
trackAccountUnlockRequested: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_REQUESTED),
trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED),
trackAccountAddressChanged: (address: string) =>
trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }),
};

View File

@@ -6,11 +6,13 @@ import { HEAP_ANALYTICS_ID } from '../constants';
import { AnalyticsEventOptions, AnalyticsUserOptions } from './analytics';
export type EventProperties = ObjectMap<string | number>;
export interface HeapAnalytics {
loaded: boolean;
appid: string;
identify(id: string, idType: string): void;
track(eventName: string, eventProperties?: ObjectMap<string | number>): void;
track(eventName: string, eventProperties?: EventProperties): void;
resetIdentity(): void;
addUserProperties(properties: AnalyticsUserOptions): void;
addEventProperties(properties: AnalyticsEventOptions): void;

View File

@@ -2,16 +2,11 @@
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib",
"rootDir": ".",
"rootDir": "src",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"module": "ESNext",
"moduleResolution": "node",
"lib": ["es2015", "dom"],
"target": "es5",
"sourceMap": true
"allowSyntheticDefaultImports": true
},
"include": ["./src/**/*", "./test/**/*"],
"include": ["./src/**/*"],
"exclude": ["./src/index.umd.ts"]
}

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1542821676,
"version": "2.1.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542208198,
"version": "2.1.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.2 - _November 21, 2018_
* Dependencies updated
## v2.1.1 - _November 14, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/json-schemas",
"version": "2.1.1",
"version": "2.1.2",
"engines": {
"node": ">=6.12"
},
@@ -46,7 +46,7 @@
},
"devDependencies": {
"@0x/tslint-config": "^1.0.10",
"@0x/utils": "^2.0.5",
"@0x/utils": "^2.0.6",
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
"version": "0.0.28",
"version": "0.0.29",
"engines": {
"node": ">=6.12"
},
@@ -18,7 +18,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profile": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --bail --exit --timeout 10000",
"generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers",
"generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers",
"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",
@@ -29,15 +29,16 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@0x/abi-gen": "^1.0.16",
"@0x/base-contract": "^3.0.6",
"@0x/sol-cov": "^2.1.12",
"@0x/subproviders": "^2.1.4",
"@0x/abi-gen": "^1.0.17",
"@0x/abi-gen-templates": "^1.0.0",
"@0x/base-contract": "^3.0.7",
"@0x/sol-cov": "^2.1.13",
"@0x/subproviders": "^2.1.5",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.2.1",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
"ethereum-types": "^1.1.2",
@@ -46,8 +47,8 @@
"run-s": "^0.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.17",
"@0x/sol-compiler": "^1.1.12",
"@0x/dev-utils": "^1.0.18",
"@0x/sol-compiler": "^1.1.13",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",

View File

@@ -1,4 +1,32 @@
[
{
"version": "2.2.0",
"changes": [
{
"note": "Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way",
"pr": 1324
},
{
"note": "Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed.",
"pr": 1309
},
{
"note": "Fund the Forwarder with ZRX for fees.",
"pr": 1309
}
]
},
{
"version": "2.1.0",
"changes": [
{
"note":
"Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping",
"pr": 1301
}
],
"timestamp": 1542821676
},
{
"timestamp": 1542208198,
"version": "2.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.0 - _November 21, 2018_
* Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping (#1301)
## v2.0.4 - _November 14, 2018_
* Dependencies updated

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../lib/cli.js');

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/migrations",
"version": "2.0.4",
"version": "2.1.0",
"engines": {
"node": ">=6.12"
},
@@ -13,32 +13,42 @@
"clean": "shx rm -rf lib",
"lint": "tslint --format stylish --project .",
"migrate:v2": "run-s build script:migrate:v2",
"script:migrate:v2": "node ./lib/migrate.js --contracts-version 2.0.0"
"script:migrate:v2": "node ./lib/migrate.js",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"postpublish": {
"assets": []
}
},
"bin": {
"0x-migrate": "bin/0x-migrate.js"
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/dev-utils": "^1.0.17",
"@0x/dev-utils": "^1.0.18",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.2.1",
"@0x/types": "^1.3.0",
"@types/yargs": "^10.0.0",
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typedoc": "0.13.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^1.0.5",
"@0x/base-contract": "^3.0.6",
"@0x/contract-addresses": "^1.1.0",
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/base-contract": "^3.0.7",
"@0x/contract-addresses": "^1.2.0",
"@0x/contract-artifacts": "^1.1.0",
"@0x/order-utils": "^3.0.2",
"@0x/sol-compiler": "^1.1.12",
"@0x/subproviders": "^2.1.4",
"@0x/order-utils": "^3.0.3",
"@0x/sol-compiler": "^1.1.13",
"@0x/subproviders": "^2.1.5",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@ledgerhq/hw-app-eth": "^4.3.0",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env node
import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
import { logUtils } from '@0x/utils';
import * as yargs from 'yargs';
import { runMigrationsAsync } from './migration';
const args = yargs
.option('rpc-url', {
describe: 'Endpoint where backing Ethereum JSON RPC interface is available',
type: 'string',
demandOption: false,
default: 'http://localhost:8545',
})
.option('from', {
describe: 'Ethereum address from which to deploy the contracts',
type: 'string',
demandOption: true,
})
.example(
'$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631',
'Full usage example',
).argv;
(async () => {
const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
const provider = new Web3ProviderEngine();
provider.addProvider(rpcSubprovider);
provider.start();
const txDefaults = {
from: args.from,
};
await runMigrationsAsync(provider, txDefaults);
process.exit(0);
})().catch(err => {
logUtils.log(err);
process.exit(1);
});

View File

@@ -1 +1,11 @@
export {
Provider,
TxData,
JSONRPCRequestPayload,
JSONRPCErrorCallback,
TxDataPayable,
JSONRPCResponsePayload,
JSONRPCResponseError,
} from 'ethereum-types';
export { ContractAddresses } from '@0x/contract-addresses';
export { runMigrationsAsync, runMigrationsOnceAsync } from './migration';

View File

@@ -11,10 +11,9 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
/**
* Creates and deploys all the contracts that are required for the latest
* version of the 0x protocol. Custom migrations can be defined here. This will
* be called with the CLI 'migrate:v2' command.
* @param provider Web3 provider instance.
* @param txDefaults Default transaction values to use when deploying contracts.
* version of the 0x protocol.
* @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
@@ -48,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
);
// Multisigs
@@ -141,6 +141,13 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
zrxAssetData,
);
// Fund the Forwarder with ZRX
const zrxDecimals = await zrxToken.decimals.callAsync();
const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
await web3Wrapper.awaitTransactionSuccessAsync(
await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults),
);
return {
erc20Proxy: erc20Proxy.address,
erc721Proxy: erc721Proxy.address,
@@ -159,8 +166,8 @@ let _cachedContractAddresses: ContractAddresses;
* Exactly like runMigrationsAsync but will only run the migrations the first
* time it is called. Any subsequent calls will return the cached contract
* addresses.
* @param provider Web3 provider instance.
* @param txDefaults Default transaction values to use when deploying contracts.
* @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsOnceAsync(

View File

@@ -0,0 +1,7 @@
{
"extends": "../../typedoc-tsconfig",
"compilerOptions": {
"outDir": "lib"
},
"include": ["./src/**/*", "./test/**/*"]
}

Some files were not shown because too many files have changed in this diff Show More