Compare commits

...

108 Commits

Author SHA1 Message Date
Jacob Evans
4861e48059 Publish
- 0x.js@2.0.6
 - @0x/abi-gen-templates@1.0.1
 - @0x/abi-gen-wrappers@2.0.0
 - @0x/asset-buyer@3.0.2
 - @0x/base-contract@3.0.8
 - @0x/connect@3.0.8
 - @0x/contract-addresses@2.0.0
 - @0x/contract-artifacts@1.1.2
 - @0x/contract-wrappers@4.1.1
 - contracts@2.1.56
 - @0x/dev-tools-pages@0.0.8
 - @0x/dev-utils@1.0.19
 - @0x/fill-scenarios@1.0.14
 - @0x/instant@1.0.2
 - @0x/metacoin@0.0.30
 - @0x/migrations@2.2.0
 - @0x/order-utils@3.0.4
 - @0x/order-watcher@2.2.6
 - @0x/react-docs@1.0.20
 - @0x/react-shared@1.0.23
 - @0x/sol-compiler@1.1.14
 - @0x/sol-cov@2.1.14
 - @0x/sol-doc@1.0.9
 - @0x/subproviders@2.1.6
 - @0x/testnet-faucets@1.0.58
 - @0x/web3-wrapper@3.1.6
 - @0x/website@0.0.61
2018-11-28 21:49:55 +11:00
Jacob Evans
c0b9214138 Updated CHANGELOGS 2018-11-28 21:49:26 +11:00
Jacob Evans
9266df43a4 chore: Add Ganache to NetworkId enum 2018-11-28 20:08:34 +11:00
Jacob Evans
dac0bee95c Merge pull request #1318 from 0xProject/bug/testnets/rinkeby-exchange
[testnet][contract-addresses] Rinkeby and Ganache
2018-11-28 16:06:44 +11:00
Jacob Evans
494adedeef chore: Update CHANGELOG 2018-11-28 10:17:15 +11:00
Jacob Evans
f0ed0c6a35 chore: Redeploy Rinkeby using testnet Exchange contract. Add Ganache contract addresses back 2018-11-28 10:17:09 +11:00
Steve Klebanoff
47a87e57f1 Merge pull request #1335 from 0xProject/feature/instant/dropdown-analytics
[instant] Add analytics events for payment dropdown
2018-11-27 13:31:02 -08:00
F. Eugene Aumson
768c28f328 fix(order_utils.py): unpin pylint version (#1337)
The version was pinned in order to work around a bug in pylint.  That
bug has been fixed and released.
2018-11-27 14:49:28 -05:00
Steve Klebanoff
96a46bcb4b Merge branch 'development' into feature/instant/dropdown-analytics 2018-11-27 11:10:20 -08:00
Steve Klebanoff
4653e4c011 Merge pull request #1336 from 0xProject/fix/instant/clipboard
[instant] Fix copy to clipboard
2018-11-27 10:48:26 -08:00
Brandon Millman
372a242ea2 Merge pull request #1327 from 0xProject/feature/instant/events-buy
[instant] Add buy events to instant
2018-11-27 10:46:10 -08:00
Steve Klebanoff
fb1893626f Merge pull request #1330 from 0xProject/feature/instant/stable-css-classes
[instant] Add stable CSS classes
2018-11-27 10:42:05 -08:00
Steve Klebanoff
5fd837cc4f Merge branch 'development' into feature/instant/dropdown-analytics 2018-11-27 10:38:26 -08:00
Steve Klebanoff
435e62a94d fix(instant): Fix copy to clipboard 2018-11-27 10:32:54 -08:00
Brandon Millman
598db72523 Merge branch 'development' into feature/instant/events-buy
* development:
  Make explicit functions
  Linting
  Fix props
  Set selected asset to none
  Track numberAvailableAssets, selectedAssetName, selectedAssetData event properties
  Fix dupe merge issue
  feat(instant): Event tracking for token selector
  Token selector searched
  Token Selector open, closed, chose
2018-11-27 10:29:45 -08:00
Steve Klebanoff
4ebc561986 Merge branch 'development' into feature/instant/stable-css-classes 2018-11-27 10:24:12 -08:00
Steve Klebanoff
d23fd23e91 Merge pull request #1329 from 0xProject/feature/instant/token-picker-events
[instant] Token Selector events
2018-11-27 10:23:28 -08:00
Brandon Millman
6e2523625f feat(instant): change event properties to ms times instead of unix timestamps 2018-11-27 10:17:59 -08:00
Steve Klebanoff
23274f9b48 Merge branch 'development' into feature/instant/token-picker-events 2018-11-27 10:10:22 -08:00
Brandon Millman
7efa71eaf6 Merge branch 'development' into feature/instant/events-buy
* development:
  fix(instant): make package private
  Add stale bot config
2018-11-27 10:06:39 -08:00
Steve Klebanoff
9c27feeff6 Make explicit functions 2018-11-27 10:00:21 -08:00
Steve Klebanoff
be787a0fd1 feat(instant): Add analytics events for payment dropdown 2018-11-27 09:50:56 -08:00
Steve Klebanoff
ee5b6ad77f Linting 2018-11-27 09:16:26 -08:00
Steve Klebanoff
e08fb72cf1 Use constants 2018-11-27 09:01:49 -08:00
Leonid Logvinov
fdc4a4e5fa Merge pull request #1325 from 0xProject/feature/stale
Add stale bot config
2018-11-27 13:21:43 +01:00
Brandon Millman
ef2c5159dd fix(instant): make package private 2018-11-27 01:20:09 -08:00
Brandon Millman
f0f991245c Merge branch 'development' into feature/instant/events-buy
* development:
  fix: add --exclude-missing flag to yarn clean command
  Update CHANGELOG
  fix: remove getApproved check from OrderValidator since approval is removed after a single transfer
  Add comment
  Force scaling input component to rerender when a different asset is chosen
  Send in explicit props
  feat(instant): Add more event properties to heap
  Move out generating of event properties, and send in orderSource
  autofocus -> hasAutoFocus
  fix(instant): Right align amounts
  fix(instant): Autofocus text amount input
2018-11-26 23:11:05 -08:00
Brandon Millman
d3b0162dc9 feat(instant): add expectedEndTimeUnix and actualEndTimeUnix to buy events 2018-11-26 23:08:20 -08:00
Steve Klebanoff
f3d08c13eb Add stable CSS classes 2018-11-26 17:13:35 -08:00
Amir Bandeali
10cc46779e Merge pull request #1149 from 0xProject/fix/contracts/orderValidator
fix: remove getApproved check from OrderValidator
2018-11-26 17:06:10 -08:00
Steve Klebanoff
80a53aedf2 Fix props 2018-11-26 16:53:50 -08:00
Steve Klebanoff
1b96867df8 Merge pull request #1294 from 0xProject/feature/header-tweaks
[instant] Header tweaks
2018-11-26 16:01:04 -08:00
Steve Klebanoff
0192127e5d Set selected asset to none 2018-11-26 15:53:39 -08:00
Steve Klebanoff
7610130f73 Track numberAvailableAssets, selectedAssetName, selectedAssetData event properties 2018-11-26 15:51:40 -08:00
Amir Bandeali
218c0d9f51 Merge pull request #1326 from 0xProject/fix/yarnClean
fix: add --exclude-missing flag to yarn clean command
2018-11-26 15:29:43 -08:00
Steve Klebanoff
d5898a3a05 Fix dupe merge issue 2018-11-26 15:12:51 -08:00
Steve Klebanoff
b055055253 Merge branch 'development' into feature/instant/token-picker-events 2018-11-26 15:11:16 -08:00
Steve Klebanoff
6e3d70af56 Merge pull request #1299 from 0xProject/feature/instant/open-close-events
[instant] Add more event properties
2018-11-26 15:10:50 -08:00
Steve Klebanoff
ae570dba05 feat(instant): Event tracking for token selector 2018-11-26 15:04:02 -08:00
Brandon Millman
2795849dd3 feat(instant): add buyQuote properties to buy events 2018-11-26 14:49:50 -08:00
Brandon Millman
fad48b8b6c feat(instant): add txHash to relevant buy events 2018-11-26 14:48:07 -08:00
Brandon Millman
685d83d6d0 feat(instant): implement buy events without associated properties 2018-11-26 14:48:07 -08:00
Steve Klebanoff
9206f2d288 Token selector searched 2018-11-26 13:27:40 -08:00
Steve Klebanoff
2fec7613c4 Token Selector open, closed, chose 2018-11-26 13:20:16 -08:00
Amir Bandeali
2f026cd1b6 fix: add --exclude-missing flag to yarn clean command 2018-11-26 13:11:30 -08:00
Steve Klebanoff
6eec84d21b Merge branch 'development' into feature/instant/open-close-events 2018-11-26 13:07:02 -08:00
Steve Klebanoff
5f6a5e28e7 Merge branch 'development' into feature/header-tweaks 2018-11-26 13:06:36 -08:00
fragosti
825911ed89 feat: Add Xianny to about page 2018-11-26 13:15:32 -05:00
Leonid Logvinov
a72d418ddb Add stale bot config 2018-11-26 19:07:55 +01:00
Amir Bandeali
cf5fd8ff42 Update CHANGELOG 2018-11-26 09:47:55 -08:00
Amir Bandeali
994c6032bb fix: remove getApproved check from OrderValidator since approval is removed after a single transfer 2018-11-26 09:45:38 -08:00
Steve Klebanoff
1494a70bad Merge branch 'development' into feature/instant/open-close-events 2018-11-26 09:02:16 -08:00
Fabio B
6d565f4bff Merge pull request #1324 from 0xProject/addCommandLineInterfaceToMigrations
Add CLI interface to @0x/migrations
2018-11-26 16:14:16 +00:00
Fabio Berger
c6592148a7 Rename node-endpoint to rpc-url for clarity 2018-11-26 15:57:49 +00:00
Fabio Berger
6e39f11db1 Merge branch 'development' into addCommandLineInterfaceToMigrations
* development:
  fix(order_utils.py): work aroud pylint bug (#1322)
2018-11-26 15:18:41 +00:00
F. Eugene Aumson
ee86cd1dcc fix(order_utils.py): work aroud pylint bug (#1322) 2018-11-26 10:18:02 -05:00
Fabio Berger
420a677828 merge development 2018-11-26 15:08:57 +00:00
Fabio Berger
9da43878b1 Add CHANGELOG entry to migrations 2018-11-26 15:04:27 +00:00
Fabio Berger
527f074e59 Fix typo 2018-11-26 15:03:58 +00:00
Fabio Berger
eefd9d9dd2 Add command-line interface to @0x/migrations 2018-11-26 14:59:27 +00:00
Leonid Logvinov
2648f5ba65 Merge pull request #1323 from 0xProject/feature/contributing-autolabeler
Remove the instruction to prefix PRs with package name from PULL_REQUEST_TEMPLATE.md
2018-11-26 15:54:50 +01:00
Leonid Logvinov
1b45aa5974 Remove the instruction to prefix PRs with package name from a/PULL_REQUEST_TEMPLATE.md 2018-11-26 15:52:04 +01:00
Leonid Logvinov
dcf19e5226 Merge pull request #1320 from 0xProject/feature/autolabeler
Add autolabeler config
2018-11-26 15:42:48 +01:00
Leonid Logvinov
c5c852f54f Add autolabeler config 2018-11-26 15:38:18 +01:00
Leonid Logvinov
7b15217694 Merge pull request #1305 from 0xProject/feature/contract-templates
[@0x/contract-templates] Make contract-templates an npm package
2018-11-26 14:12:13 +01:00
Leonid Logvinov
8caded1d1d Merge pull request #1319 from 0xProject/revert-1312-feature/build-fix-instant
Revert "[@0x/instant] Fix CI build broken by instant installation tests"
2018-11-26 14:11:04 +01:00
Leonid Logvinov
ebc3116909 Revert "[@0x/instant] Fix CI build broken by instant installation tests" 2018-11-26 14:09:24 +01:00
Leonid Logvinov
387d7199d1 Merge pull request #1312 from 0xProject/feature/build-fix-instant
[@0x/instant] Fix CI build broken by instant installation tests
2018-11-26 14:00:25 +01:00
Jacob Evans
dc965da64e Merge pull request #1309 from 0xProject/bug/contract-artifacts/testnet-exchange
[contract-artifacts] Use Testnet Exchange artifact
2018-11-26 21:23:19 +11:00
Jacob Evans
1d83d99d87 Merge pull request #1308 from 0xProject/bug/web3-wrapper/unmarshall-parity-receipt
[web3-wrapper] Only unmarshall receipt if blockNumber present
2018-11-26 21:21:36 +11:00
Jacob Evans
09a683557b chore: Update CHANGELOGS use mainnet ZRX amount in Forwarder. 2018-11-26 09:57:43 +11:00
Jacob Evans
99e92a346b chore: Fund forwarder in migrations 2018-11-26 09:37:31 +11:00
Leonid Logvinov
9ddd45e2c6 Rename contract-templates to abi-gen-templates 2018-11-23 15:22:16 +01:00
Leonid Logvinov
0c0a1db114 Fix the lerna paremeter name from cdVersions to cd-versions 2018-11-23 14:51:21 +01:00
Leonid Logvinov
b1474973cd Copy assets in referenced in instant on commonjs build 2018-11-23 14:48:49 +01:00
Jacob Evans
f0f6b26c3b bug: Use Testnet Exchange over mainnet 2018-11-23 18:17:51 +11:00
Jacob Evans
03b3b80a65 bug: Only unmarshall receipt if blockNumber present.
https://github.com/paritytech/parity-ethereum/issues/1180
Parity can return a pending transaction receipt with a number of null values
2018-11-23 15:31:00 +11:00
Leonid Logvinov
06cc66005c Make contract-templates an npm package 2018-11-22 14:48:15 +01:00
Steve Klebanoff
b0792a85a4 Add comment 2018-11-21 14:33:12 -08:00
Francesco Agosti
a5359df002 Merge pull request #1281 from 0xProject/feature/instant/push-to-history
[instant] Close/open Instant on correct history changes. Provide option to disable.
2018-11-21 17:24:48 -05:00
Steve Klebanoff
10c9d0b723 Force scaling input component to rerender when a different asset is chosen 2018-11-21 14:24:13 -08:00
Brandon Millman
5c81f07d46 Merge pull request #1300 from 0xProject/feature/instant/events-account
[instant] Implement account related events
2018-11-21 14:20:01 -08:00
Steve Klebanoff
0adc8f5053 Merge branch 'development' into feature/header-tweaks 2018-11-21 14:14:27 -08:00
Brandon Millman
804de89796 chore(instant): revert usage of event properties 2018-11-21 13:52:55 -08:00
Brandon Millman
6604e2db20 chore(instant): refactor usage of event properties in heap 2018-11-21 13:16:34 -08:00
Brandon Millman
31d1b4ba67 chore(instant): refactor account tracking logic in middleware to be more readable 2018-11-21 12:30:52 -08:00
Steve Klebanoff
d750225554 Send in explicit props 2018-11-21 11:10:17 -08:00
fragosti
ed91c6c874 fix: multiple render and closes edge case for onpopstate render 2018-11-21 12:44:28 -05:00
fragosti
b494a4a4db chore: clean up index.umd.ts a bit 2018-11-21 11:55:32 -05:00
fragosti
e0beb7fb38 feat: add more to instant dev env 2018-11-21 11:42:07 -05:00
fragosti
fc123871ad Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/push-to-history 2018-11-21 10:43:36 -05:00
Brandon Millman
351e0e6f5f feat(instant): implement account related events 2018-11-20 22:38:49 -08:00
Steve Klebanoff
1593b94aac feat(instant): Add more event properties to heap 2018-11-20 15:07:37 -08:00
Steve Klebanoff
6124d80c89 Move out generating of event properties, and send in orderSource 2018-11-20 14:59:23 -08:00
Steve Klebanoff
eca63b1a58 Merge branch 'development' into feature/header-tweaks 2018-11-20 13:26:00 -08:00
Steve Klebanoff
2bda6dd719 autofocus -> hasAutoFocus 2018-11-20 10:36:23 -08:00
Steve Klebanoff
cd4600b081 fix(instant): Right align amounts 2018-11-20 10:20:16 -08:00
Steve Klebanoff
83f4fa92a5 fix(instant): Autofocus text amount input 2018-11-20 10:19:59 -08:00
fragosti
b62fbd0b13 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/push-to-history 2018-11-19 16:30:11 -08:00
fragosti
9384c507ac feat: add isInstantRendered check to safeguard against double renders and double removes 2018-11-16 16:33:02 -08:00
fragosti
ac942faa25 chore: use lodash where relevant 2018-11-16 16:14:10 -08:00
fragosti
654c13df8a fix: bug where we did not call onClose config 2018-11-16 16:07:37 -08:00
fragosti
6e2fbcdb3e feat: add URL override param 2018-11-16 15:58:41 -08:00
fragosti
51dce30088 feat: add assert for shouldDisablePushToHistory 2018-11-16 15:48:55 -08:00
fragosti
a4f6cd21bd feat: be more specific with callback name 2018-11-16 15:45:02 -08:00
fragosti
9a53a29b1f feat: allow integrator to disable pushstate logic 2018-11-16 15:41:21 -08:00
fragosti
f7914af9c5 feat: rename props to config 2018-11-16 15:23:44 -08:00
fragosti
848193074a feat: close and open instant based on history changes 2018-11-16 15:21:04 -08:00
114 changed files with 1191 additions and 372 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.

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",

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "2.0.5",
"version": "2.0.6",
"engines": {
"node": ">=6.12"
},
@@ -42,11 +42,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen": "^1.0.17",
"@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/abi-gen-wrappers": "^2.0.0",
"@0x/contract-addresses": "^2.0.0",
"@0x/dev-utils": "^1.0.19",
"@0x/migrations": "^2.2.0",
"@0x/tslint-config": "^1.0.10",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -74,15 +73,15 @@
},
"dependencies": {
"@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/base-contract": "^3.0.8",
"@0x/contract-wrappers": "^4.1.1",
"@0x/order-utils": "^3.0.4",
"@0x/order-watcher": "^2.2.6",
"@0x/subproviders": "^2.1.6",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",

View File

@@ -0,0 +1,20 @@
[
{
"timestamp": 1543401373,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.0",
"changes": [
{
"note": "Initial publish",
"pr": 1305
}
]
}
]

View File

@@ -0,0 +1,14 @@
<!--
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 28, 2018_
* Dependencies updated
## v1.0.0 - _Invalid date_
* Initial publish (#1305)

View File

@@ -0,0 +1,20 @@
{
"name": "@0x/abi-gen-templates",
"version": "1.0.1",
"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,14 @@
[
{
"version": "2.0.0",
"changes": [
{
"pr": 1309,
"note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
}
],
"timestamp": 1543401373
},
{
"version": "1.1.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.0 - _November 28, 2018_
* Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)
## v1.1.0 - _November 21, 2018_
* `deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface (#1298)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
"version": "1.1.0",
"version": "2.0.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"
@@ -31,17 +31,18 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.17",
"@0x/abi-gen-templates": "^1.0.1",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.3.0",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
"@0x/base-contract": "^3.0.7"
"@0x/base-contract": "^3.0.8"
},
"publishConfig": {
"access": "public"

View File

@@ -3028,29 +3028,35 @@ export class ExchangeContract extends BaseContract {
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},
@@ -3062,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

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "3.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.1",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.2 - _November 28, 2018_
* Dependencies updated
## v3.0.1 - _November 21, 2018_
* Dependencies updated (#1276)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
"version": "3.0.1",
"version": "3.0.2",
"engines": {
"node": ">=6.12"
},
@@ -37,15 +37,15 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
"@0x/assert": "^1.0.18",
"@0x/connect": "^3.0.7",
"@0x/contract-wrappers": "^4.1.0",
"@0x/connect": "^3.0.8",
"@0x/contract-wrappers": "^4.1.1",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/subproviders": "^2.1.5",
"@0x/order-utils": "^3.0.4",
"@0x/subproviders": "^2.1.6",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"ethereum-types": "^1.1.2",
"lodash": "^4.17.5"
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
"version": "3.0.7",
"version": "3.0.8",
"engines": {
"node": ">=6.12"
},
@@ -46,7 +46,7 @@
"dependencies": {
"@0x/assert": "^1.0.18",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/order-utils": "^3.0.4",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",

View File

@@ -1,4 +1,18 @@
[
{
"version": "2.0.0",
"changes": [
{
"note": "Redeployed Rinkeby with testnet Exchange artifact",
"pr": 1318
},
{
"note": "Added Ganache snapshot addresses for network 50",
"pr": 1318
}
],
"timestamp": 1543401373
},
{
"version": "1.2.0",
"changes": [

View File

@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.0 - _November 28, 2018_
* Redeployed Rinkeby with testnet Exchange artifact (#1318)
* Added Ganache snapshot addresses for network 50 (#1318)
## v1.2.0 - _November 21, 2018_
* Rinkeby Deployment

View File

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

View File

@@ -16,6 +16,7 @@ export enum NetworkId {
Ropsten = 3,
Rinkeby = 4,
Kovan = 42,
Ganache = 50,
}
const networkToAddresses: { [networkId: number]: ContractAddresses } = {
@@ -40,14 +41,14 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
},
4: {
erc20Proxy: '0x3e809c563c15a295e832e37053798ddc8d6c8dab',
erc721Proxy: '0x8e1ff02637cb5e39f2fa36c14706aa348b065b09',
zrxToken: '0x2727e688b8fd40b198cd5fe6e408e00494a06f07',
exchange: '0xbce0b5f6eb618c565c3e5f5cd69652bbc279f44e',
erc20Proxy: '0x2f5ae4f6106e89b4147651688a92256885c5f410',
erc721Proxy: '0x7656d773e11ff7383a14dcf09a9c50990481cd10',
zrxToken: '0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa',
etherToken: '0xc778417e063141139fce010982780140aa0cd5ab',
exchange: '0x22ebc052f43a88efa06379426120718170f2204e',
assetProxyOwner: '0x1da52d1d3a3acfa0a1836b737393b4e9931268fc',
forwarder: '0xd2dbf3250a764eaaa94fa0c84ed87c0edc8ed04e',
orderValidator: '0x39c3fc9f4d8430af2713306ce80c584752d9e1c7',
assetProxyOwner: '0xe1703da878afcebff5b7624a826902af475b9c03',
forwarder: '0x2d40589abbdee84961f3a7656b9af7adb0ee5ab4',
orderValidator: '0x0c5173a51e26b29d6126c686756fb9fbef71f762',
},
42: {
erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
@@ -59,6 +60,17 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
forwarder: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
},
// NetworkId 50 represents our Ganache snapshot generated from migrations.
50: {
exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
erc20Proxy: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
erc721Proxy: '0x1d7022f5b17d2f8b695918fb48fa1089c9f85401',
zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c',
etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082',
assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
},
};
/**

View File

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

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.2 - _November 28, 2018_
* Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)
## v1.1.0 - _November 9, 2018_
* Update Forwarder artifact (#1192)

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "4.1.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "4.1.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.1 - _November 28, 2018_
* Dependencies updated
## 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)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "4.1.0",
"version": "4.1.1",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,9 +37,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/migrations": "^2.1.0",
"@0x/subproviders": "^2.1.5",
"@0x/dev-utils": "^1.0.19",
"@0x/migrations": "^2.2.0",
"@0x/subproviders": "^2.1.6",
"@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.1.0",
"@0x/abi-gen-wrappers": "^2.0.0",
"@0x/assert": "^1.0.18",
"@0x/contract-addresses": "^1.2.0",
"@0x/contract-artifacts": "^1.1.0",
"@0x/fill-scenarios": "^1.0.13",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
"@0x/fill-scenarios": "^1.0.14",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/order-utils": "^3.0.4",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"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.55",
"version": "2.1.56",
"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",
@@ -46,10 +46,10 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": {
"@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/dev-utils": "^1.0.19",
"@0x/sol-compiler": "^1.1.14",
"@0x/sol-cov": "^2.1.14",
"@0x/subproviders": "^2.1.6",
"@0x/tslint-config": "^1.0.10",
"@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.7",
"@0x/order-utils": "^3.0.3",
"@0x/base-contract": "^3.0.8",
"@0x/order-utils": "^3.0.4",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@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.7",
"version": "0.0.8",
"engines": {
"node": ">=6.12"
},
@@ -16,7 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@0x/react-shared": "^1.0.22",
"@0x/react-shared": "^1.0.23",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"less": "^2.7.2",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
"version": "1.0.13",
"version": "1.0.14",
"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.1.0",
"@0x/base-contract": "^3.0.7",
"@0x/contract-artifacts": "^1.1.0",
"@0x/order-utils": "^3.0.3",
"@0x/abi-gen-wrappers": "^2.0.0",
"@0x/base-contract": "^3.0.8",
"@0x/contract-artifacts": "^1.1.2",
"@0x/order-utils": "^3.0.4",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -1,9 +1,10 @@
{
"name": "@0x/instant",
"version": "1.0.1",
"version": "1.0.2",
"engines": {
"node": ">=6.12"
},
"private": true,
"description": "0x Instant React Component",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -45,14 +46,14 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
"@0x/assert": "^1.0.18",
"@0x/asset-buyer": "^3.0.1",
"@0x/asset-buyer": "^3.0.2",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/subproviders": "^2.1.5",
"@0x/order-utils": "^3.0.4",
"@0x/subproviders": "^2.1.6",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"bowser": "^1.9.4",
"copy-to-clipboard": "^3.0.8",
"ethereum-types": "^1.1.2",

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

@@ -8,6 +8,7 @@ import { oc } from 'ts-optchain';
import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants';
import { ColorOption } from '../style/theme';
import { AffiliateInfo, ZeroExInstantError } from '../types';
import { analytics } from '../util/analytics';
import { gasPriceEstimator } from '../util/gas_price_estimator';
import { util } from '../util/util';
@@ -59,6 +60,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
// if we don't have a balance for the user, let the transaction through, it will be handled by the wallet
const hasSufficientEth = _.isUndefined(accountEthBalanceInWei) || accountEthBalanceInWei.gte(ethNeededForBuy);
if (!hasSufficientEth) {
analytics.trackBuyNotEnoughEth(buyQuote);
this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientETH);
return;
}
@@ -66,6 +68,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
const gasInfo = await gasPriceEstimator.getGasInfoAsync();
const feeRecipient = oc(affiliateInfo).feeRecipient();
try {
analytics.trackBuyStarted(buyQuote);
txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote, {
feeRecipient,
takerAddress: accountAddress,
@@ -74,9 +77,11 @@ export class BuyButton extends React.Component<BuyButtonProps> {
} catch (e) {
if (e instanceof Error) {
if (e.message === AssetBuyerError.SignatureRequestDenied) {
analytics.trackBuySignatureDenied(buyQuote);
this.props.onSignatureDenied(buyQuote);
return;
} else if (e.message === AssetBuyerError.TransactionValueTooLow) {
analytics.trackBuySimulationFailed(buyQuote);
this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow);
return;
}
@@ -87,14 +92,17 @@ export class BuyButton extends React.Component<BuyButtonProps> {
const expectedEndTimeUnix = startTimeUnix + gasInfo.estimatedTimeMs;
this.props.onBuyProcessing(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
try {
analytics.trackBuyTxSubmitted(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
} catch (e) {
if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) {
analytics.trackBuyTxFailed(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
this.props.onBuyFailure(buyQuote, txHash);
return;
}
throw e;
}
analytics.trackBuyTxSucceeded(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
this.props.onBuySuccess(buyQuote, txHash);
};
}

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

@@ -3,6 +3,7 @@ import * as React from 'react';
import { ColorOption } from '../style/theme';
import { ERC20Asset } from '../types';
import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { SearchInput } from './search_input';
@@ -57,6 +58,7 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
this.setState({
searchQuery,
});
analytics.trackTokenSelectorSearched(searchQuery);
};
private readonly _isTokenQueryMatch = (token: ERC20Asset): boolean => {
const { searchQuery } = this.state;

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

@@ -1,8 +1,9 @@
import { BigNumber } from '@0x/utils';
import copy from 'copy-to-clipboard';
import * as copy from 'copy-to-clipboard';
import * as React from 'react';
import { Network } from '../types';
import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
import { etherscanUtil } from '../util/etherscan';
import { format } from '../util/format';
@@ -20,7 +21,14 @@ export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdown
const { accountAddress, accountEthBalanceInWei } = this.props;
const value = format.ethAddress(accountAddress);
const label = format.ethBaseUnitAmount(accountEthBalanceInWei, 4, '') as string;
return <Dropdown value={value} label={label} items={this._getDropdownItemConfigs()} />;
return (
<Dropdown
value={value}
label={label}
items={this._getDropdownItemConfigs()}
onOpen={analytics.trackPaymentMethodDropdownOpened}
/>
);
}
private readonly _getDropdownItemConfigs = (): DropdownItemConfig[] => {
if (envUtil.isMobileOperatingSystem()) {
@@ -37,11 +45,15 @@ export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdown
return [viewOnEtherscan, copyAddressToClipboard];
};
private readonly _handleEtherscanClick = (): void => {
analytics.trackPaymentMethodOpenedEtherscan();
const { accountAddress, network } = this.props;
const etherscanUrl = etherscanUtil.getEtherScanEthAddressIfExists(accountAddress, network);
window.open(etherscanUrl, '_blank');
};
private readonly _handleCopyToClipboardClick = (): void => {
analytics.trackPaymentMethodCopiedAddress();
const { accountAddress } = this.props;
copy(accountAddress);
};

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

@@ -19,6 +19,7 @@ export interface DropdownProps {
value: string;
label?: string;
items: DropdownItemConfig[];
onOpen?: () => void;
}
export interface DropdownState {
@@ -97,9 +98,14 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> {
if (_.isEmpty(this.props.items)) {
return;
}
const isOpen = !this.state.isOpen;
this.setState({
isOpen: !this.state.isOpen,
isOpen,
});
if (isOpen && this.props.onOpen) {
this.props.onOpen();
}
};
private readonly _closeDropdown = (): void => {
this.setState({

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

@@ -11,21 +11,20 @@ import { SelectedAssetBuyOrderStateButtons } from '../containers/selected_asset_
import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
import { ColorOption } from '../style/theme';
import { zIndex } from '../style/z_index';
import { OrderProcessState, SlideAnimationState } from '../types';
import { SlideAnimationState } from '../types';
import { analytics, TokenSelectorClosedVia } from '../util/analytics';
import { CSSReset } from './css_reset';
import { SlidingPanel } from './sliding_panel';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
export interface ZeroExInstantContainerProps {
orderProcessState: OrderProcessState;
}
export interface ZeroExInstantContainerProps {}
export interface ZeroExInstantContainerState {
tokenSelectionPanelAnimationState: SlideAnimationState;
}
export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantContainerState> {
export class ZeroExInstantContainer extends React.Component<ZeroExInstantContainerProps, ZeroExInstantContainerState> {
public state = {
tokenSelectionPanelAnimationState: 'none' as SlideAnimationState,
};
@@ -60,9 +59,9 @@ export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantCon
</Flex>
<SlidingPanel
animationState={this.state.tokenSelectionPanelAnimationState}
onClose={this._handlePanelClose}
onClose={this._handlePanelCloseClickedX}
>
<AvailableERC20TokenSelector onTokenSelect={this._handlePanelClose} />
<AvailableERC20TokenSelector onTokenSelect={this._handlePanelCloseAfterChose} />
</SlidingPanel>
<CurrentStandardSlidingPanel />
</Container>
@@ -82,11 +81,19 @@ export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantCon
);
}
private readonly _handleSymbolClick = (): void => {
analytics.trackTokenSelectorOpened();
this.setState({
tokenSelectionPanelAnimationState: 'slidIn',
});
};
private readonly _handlePanelClose = (): void => {
private readonly _handlePanelCloseClickedX = (): void => {
this._handlePanelClose(TokenSelectorClosedVia.ClickedX);
};
private readonly _handlePanelCloseAfterChose = (): void => {
this._handlePanelClose(TokenSelectorClosedVia.TokenChose);
};
private readonly _handlePanelClose = (closedVia: TokenSelectorClosedVia): void => {
analytics.trackTokenSelectorClosed(closedVia);
this.setState({
tokenSelectionPanelAnimationState: 'slidOut',
});

View File

@@ -1,6 +1,7 @@
import * as React from 'react';
import { ZeroExInstantContainer } from '../components/zero_ex_instant_container';
import { MAIN_CONTAINER_DIV_CLASS, OVERLAY_DIV_CLASS } from '../constants';
import { ColorOption } from '../style/theme';
import { Container } from './ui/container';
@@ -18,7 +19,7 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
const { onClose, zIndex, ...rest } = props;
return (
<ZeroExInstantProvider {...rest}>
<Overlay zIndex={zIndex}>
<Overlay zIndex={zIndex} className={OVERLAY_DIV_CLASS}>
<Flex height="100vh">
<Container position="absolute" top="0px" right="0px" display={{ default: 'initial', sm: 'none' }}>
<Icon
@@ -30,7 +31,11 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
padding="2em 2em"
/>
</Container>
<Container width={{ default: 'auto', sm: '100%' }} height={{ default: 'auto', sm: '100%' }}>
<Container
width={{ default: 'auto', sm: '100%' }}
height={{ default: 'auto', sm: '100%' }}
className={MAIN_CONTAINER_DIV_CLASS}
>
<ZeroExInstantContainer />
</Container>
</Flex>

View File

@@ -125,14 +125,16 @@ 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,
state.selectedAsset,
this.props.affiliateInfo,
),
);
analytics.trackInstantOpened();
}
public componentWillUnmount(): void {

View File

@@ -7,6 +7,8 @@ export const ETH_DECIMALS = 18;
export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer';
export const INJECTED_DIV_CLASS = 'zeroExInstantResetRoot';
export const INJECTED_DIV_ID = 'zeroExInstant';
export const OVERLAY_DIV_CLASS = 'zeroExInstantOverlay';
export const MAIN_CONTAINER_DIV_CLASS = 'zeroExInstantMainContainer';
export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction failed';
export const GWEI_IN_WEI = new BigNumber(1000000000);
export const ONE_SECOND_MS = 1000;

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:
@@ -53,6 +53,30 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
).toString();
analytics.addUserProperties({ ethBalanceInUnitAmount });
}
break;
case ActionTypes.UPDATE_SELECTED_ASSET:
const selectedAsset = curState.selectedAsset;
if (selectedAsset) {
const assetName = selectedAsset.metaData.name;
const assetData = selectedAsset.assetData;
analytics.trackTokenSelectorChose({
assetName,
assetData,
});
analytics.addEventProperties({
selectedAssetName: assetName,
selectedAssetData: assetData,
});
}
break;
case ActionTypes.SET_AVAILABLE_ASSETS:
const availableAssets = curState.availableAssets;
if (availableAssets) {
analytics.addEventProperties({
numberAvailableAssets: availableAssets.length,
});
}
break;
}
return nextAction;

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,9 @@
import { ObjectMap } from '@0x/types';
import { BuyQuote } from '@0x/asset-buyer';
import * as _ from 'lodash';
import { heapUtil } from './heap';
import { AffiliateInfo, Asset, Network, OrderSource, ProviderState } from '../types';
import { EventProperties, heapUtil } from './heap';
let isDisabled = false;
export const disableAnalytics = (shouldDisableAnalytics: boolean) => {
@@ -15,11 +18,30 @@ 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',
PAYMENT_METHOD_DROPDOWN_OPENED = 'Payment Method - Dropdown Opened',
PAYMENT_METHOD_OPENED_ETHERSCAN = 'Payment Method - Opened Etherscan',
PAYMENT_METHOD_COPIED_ADDRESS = 'Payment Method - Copied Address',
BUY_NOT_ENOUGH_ETH = 'Buy - Not Enough Eth',
BUY_STARTED = 'Buy - Started',
BUY_SIGNATURE_DENIED = 'Buy - Signature Denied',
BUY_SIMULATION_FAILED = 'Buy - Simulation Failed',
BUY_TX_SUBMITTED = 'Buy - Tx Submitted',
BUY_TX_SUCCEEDED = 'Buy - Tx Succeeded',
BUY_TX_FAILED = 'Buy - Tx Failed',
TOKEN_SELECTOR_OPENED = 'Token Selector - Opened',
TOKEN_SELECTOR_CLOSED = 'Token Selector - Closed',
TOKEN_SELECTOR_CHOSE = 'Token Selector - Chose',
TOKEN_SELECTOR_SEARCHED = 'Token Selector - Searched',
}
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 +50,31 @@ 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);
};
}
const buyQuoteEventProperties = (buyQuote: BuyQuote) => {
const assetBuyAmount = buyQuote.assetBuyAmount.toString();
const assetEthAmount = buyQuote.worstCaseQuoteInfo.assetEthAmount.toString();
const feeEthAmount = buyQuote.worstCaseQuoteInfo.feeEthAmount.toString();
const totalEthAmount = buyQuote.worstCaseQuoteInfo.totalEthAmount.toString();
const feePercentage = !_.isUndefined(buyQuote.feePercentage) ? buyQuote.feePercentage.toString() : 0;
const hasFeeOrders = !_.isEmpty(buyQuote.feeOrders) ? 'true' : 'false';
return {
assetBuyAmount,
assetEthAmount,
feeEthAmount,
totalEthAmount,
feePercentage,
hasFeeOrders,
};
};
export interface AnalyticsUserOptions {
ethAddress?: string;
lastKnownEthAddress?: string;
ethBalanceInUnitAmount?: string;
}
export interface AnalyticsEventOptions {
@@ -47,6 +84,16 @@ export interface AnalyticsEventOptions {
providerName?: string;
gitSha?: string;
npmVersion?: string;
orderSource?: string;
affiliateAddress?: string;
affiliateFeePercent?: number;
numberAvailableAssets?: number;
selectedAssetName?: string;
selectedAssetData?: string;
}
export enum TokenSelectorClosedVia {
ClickedX = 'Clicked X',
TokenChose = 'Token Chose',
}
export const analytics = {
addUserProperties: (properties: AnalyticsUserOptions): void => {
@@ -59,6 +106,75 @@ export const analytics = {
heapUtil.evaluateHeapCall(heap => heap.addEventProperties(properties));
});
},
trackWalletReady: trackingEventFnWithoutPayload(EventNames.WALLET_READY),
generateEventProperties: (
network: Network,
orderSource: OrderSource,
providerState: ProviderState,
window: Window,
selectedAsset?: Asset,
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';
const eventOptions: AnalyticsEventOptions = {
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,
selectedAssetName: selectedAsset ? selectedAsset.metaData.name : 'none',
selectedAssetData: selectedAsset ? selectedAsset.assetData : 'none',
};
return eventOptions;
},
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 }),
trackPaymentMethodDropdownOpened: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_DROPDOWN_OPENED),
trackPaymentMethodOpenedEtherscan: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_OPENED_ETHERSCAN),
trackPaymentMethodCopiedAddress: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_COPIED_ADDRESS),
trackBuyNotEnoughEth: (buyQuote: BuyQuote) =>
trackingEventFnWithPayload(EventNames.BUY_NOT_ENOUGH_ETH)(buyQuoteEventProperties(buyQuote)),
trackBuyStarted: (buyQuote: BuyQuote) =>
trackingEventFnWithPayload(EventNames.BUY_STARTED)(buyQuoteEventProperties(buyQuote)),
trackBuySignatureDenied: (buyQuote: BuyQuote) =>
trackingEventFnWithPayload(EventNames.BUY_SIGNATURE_DENIED)(buyQuoteEventProperties(buyQuote)),
trackBuySimulationFailed: (buyQuote: BuyQuote) =>
trackingEventFnWithPayload(EventNames.BUY_SIMULATION_FAILED)(buyQuoteEventProperties(buyQuote)),
trackBuyTxSubmitted: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({
...buyQuoteEventProperties(buyQuote),
txHash,
expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
}),
trackBuyTxSucceeded: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({
...buyQuoteEventProperties(buyQuote),
txHash,
expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
actualTxTimeMs: new Date().getTime() - startTimeUnix,
}),
trackBuyTxFailed: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({
...buyQuoteEventProperties(buyQuote),
txHash,
expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
actualTxTimeMs: new Date().getTime() - startTimeUnix,
}),
trackTokenSelectorOpened: trackingEventFnWithoutPayload(EventNames.TOKEN_SELECTOR_OPENED),
trackTokenSelectorClosed: (closedVia: TokenSelectorClosedVia) =>
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CLOSED)({ closedVia }),
trackTokenSelectorChose: (payload: { assetName: string; assetData: string }) =>
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CHOSE)(payload),
trackTokenSelectorSearched: (searchText: string) =>
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_SEARCHED)({ searchText }),
};

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

@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
"version": "0.0.29",
"version": "0.0.30",
"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",
@@ -30,14 +30,15 @@
"license": "Apache-2.0",
"dependencies": {
"@0x/abi-gen": "^1.0.17",
"@0x/base-contract": "^3.0.7",
"@0x/sol-cov": "^2.1.13",
"@0x/subproviders": "^2.1.5",
"@0x/abi-gen-templates": "^1.0.1",
"@0x/base-contract": "^3.0.8",
"@0x/sol-cov": "^2.1.14",
"@0x/subproviders": "^2.1.6",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@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.18",
"@0x/sol-compiler": "^1.1.13",
"@0x/dev-utils": "^1.0.19",
"@0x/sol-compiler": "^1.1.14",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",

View File

@@ -1,4 +1,22 @@
[
{
"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
}
],
"timestamp": 1543401373
},
{
"version": "2.1.0",
"changes": [

View File

@@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.0 - _November 28, 2018_
* Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way (#1324)
* Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed. (#1309)
* Fund the Forwarder with ZRX for fees. (#1309)
## v2.1.0 - _November 21, 2018_
* Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping (#1301)

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.1.0",
"version": "2.2.0",
"engines": {
"node": ">=6.12"
},
@@ -21,9 +21,12 @@
"assets": []
}
},
"bin": {
"0x-migrate": "bin/0x-migrate.js"
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/dev-utils": "^1.0.19",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.3.0",
"@types/yargs": "^10.0.0",
@@ -36,16 +39,16 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@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.3",
"@0x/sol-compiler": "^1.1.13",
"@0x/subproviders": "^2.1.5",
"@0x/abi-gen-wrappers": "^2.0.0",
"@0x/base-contract": "^3.0.8",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
"@0x/order-utils": "^3.0.4",
"@0x/sol-compiler": "^1.1.14",
"@0x/subproviders": "^2.1.6",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@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

@@ -47,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
);
// Multisigs
@@ -140,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,

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "3.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "3.0.3",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/order-utils",
"version": "3.0.3",
"version": "3.0.4",
"engines": {
"node": ">=6.12"
},
@@ -35,7 +35,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/dev-utils": "^1.0.19",
"@0x/tslint-config": "^1.0.10",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -53,15 +53,15 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/abi-gen-wrappers": "^2.0.0",
"@0x/assert": "^1.0.18",
"@0x/base-contract": "^3.0.7",
"@0x/contract-artifacts": "^1.1.0",
"@0x/base-contract": "^3.0.8",
"@0x/contract-artifacts": "^1.1.2",
"@0x/json-schemas": "^2.1.2",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@types/node": "*",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "2.2.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "2.2.5",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/order-watcher",
"version": "2.2.5",
"version": "2.2.6",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -33,8 +33,8 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/migrations": "^2.1.0",
"@0x/dev-utils": "^1.0.19",
"@0x/migrations": "^2.2.0",
"@0x/tslint-config": "^1.0.10",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
@@ -57,19 +57,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^1.1.0",
"@0x/abi-gen-wrappers": "^2.0.0",
"@0x/assert": "^1.0.18",
"@0x/base-contract": "^3.0.7",
"@0x/contract-addresses": "^1.2.0",
"@0x/contract-artifacts": "^1.1.0",
"@0x/contract-wrappers": "^4.1.0",
"@0x/fill-scenarios": "^1.0.13",
"@0x/base-contract": "^3.0.8",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
"@0x/contract-wrappers": "^4.1.1",
"@0x/fill-scenarios": "^1.0.14",
"@0x/json-schemas": "^2.1.2",
"@0x/order-utils": "^3.0.3",
"@0x/order-utils": "^3.0.4",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"bintrees": "^1.0.2",
"ethereum-types": "^1.1.2",
"ethereumjs-blockstream": "6.0.0",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "1.0.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "1.0.19",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/react-docs",
"version": "1.0.19",
"version": "1.0.20",
"engines": {
"node": ">=6.12"
},
@@ -24,7 +24,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/dev-utils": "^1.0.19",
"@0x/tslint-config": "^1.0.10",
"@types/compare-versions": "^3.0.0",
"@types/styled-components": "^4.0.0",
@@ -34,7 +34,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/react-shared": "^1.0.22",
"@0x/react-shared": "^1.0.23",
"@0x/types": "^1.3.0",
"@0x/utils": "^2.0.6",
"@types/lodash": "4.14.104",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "1.0.23",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "1.0.22",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/react-shared",
"version": "1.0.22",
"version": "1.0.23",
"engines": {
"node": ">=6.12"
},
@@ -25,7 +25,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/dev-utils": "^1.0.19",
"@0x/tslint-config": "^1.0.10",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "1.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "1.1.13",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/sol-compiler",
"version": "1.1.13",
"version": "1.1.14",
"engines": {
"node": ">=6.12"
},
@@ -42,7 +42,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/dev-utils": "^1.0.19",
"@0x/tslint-config": "^1.0.10",
"@types/mkdirp": "^0.5.2",
"@types/require-from-string": "^1.2.0",
@@ -71,7 +71,7 @@
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@types/yargs": "^11.0.0",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1543401373,
"version": "2.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1542821676,
"version": "2.1.13",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/sol-cov",
"version": "2.1.13",
"version": "2.1.14",
"engines": {
"node": ">=6.12"
},
@@ -42,12 +42,12 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": {
"@0x/dev-utils": "^1.0.18",
"@0x/sol-compiler": "^1.1.13",
"@0x/subproviders": "^2.1.5",
"@0x/dev-utils": "^1.0.19",
"@0x/sol-compiler": "^1.1.14",
"@0x/subproviders": "^2.1.6",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
"@0x/web3-wrapper": "^3.1.5",
"@0x/web3-wrapper": "^3.1.6",
"@types/solidity-parser-antlr": "^0.2.0",
"ethereum-types": "^1.1.2",
"ethereumjs-util": "^5.1.1",

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