From 006412ed453ddfd9e8d8ad588677d523562abc39 Mon Sep 17 00:00:00 2001 From: Nick Borsuk Date: Fri, 22 Nov 2019 17:16:09 +0300 Subject: [PATCH 1/2] migrate to echo-web3-polyfill --- package.json | 7 +------ src/config.json | 14 +++++++------- src/services/web3_wrapper.ts | 3 +++ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index e24581150..80699c8cc 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "react-scripts": "3.0.0", "react-svg": "^10.0.9", "react-timeago": "^4.4.0", + "echo-web3": "^0.1.5", "react-tooltip": "^3.10.0", "recharts": "^1.6.2", "redux": "^4.0.1", @@ -50,12 +51,6 @@ "eslintConfig": { "extends": "react-app" }, - "husky": { - "hooks": { - "pre-commit": "npm run prettier-check", - "pre-push": "npm run lint && npm run test-once" - } - }, "jest": { "collectCoverageFrom": [ "src/**/*.{js,jsx,ts,tsx}", diff --git a/src/config.json b/src/config.json index fde5f33a4..bdb465253 100644 --- a/src/config.json +++ b/src/config.json @@ -10,7 +10,7 @@ "icon": "assets/icons/zrx.svg", "addresses": { "1": "0xE41d2489571d322189246DaFA5ebDe1F4699F498", - "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00", + "3": "0x010000000000000000000000000000000000002f", "4": "0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa", "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa", "50": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" @@ -25,7 +25,7 @@ "icon": "assets/icons/weth.svg", "addresses": { "1": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "3": "0xc778417e063141139fce010982780140aa0cd5ab", + "3": "0x0100000000000000000000000000000000000030", "4": "0xc778417e063141139fce010982780140aa0cd5ab", "42": "0xd0a1e359811322d97991e03f863a0c30c2cf029c", "50": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" @@ -41,7 +41,7 @@ "primaryColor": "#DEA349", "addresses": { "1": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", - "3": "0xfc8862446cd3e4a2e7167e7d97df738407fead07", + "3": "0x0100000000000000000000000000000000000032", "4": "0x6f2d6ff85efca691aad23d549771160a12f0a0fc", "42": "0xc4375b7de8af5a38a93548eb8453a498222c4ff2", "50": "0xbe0037eaf2d64fe5529bca93c18c9702d3930376" @@ -55,7 +55,7 @@ "icon": "assets/icons/mkr.svg", "addresses": { "1": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", - "3": "0x06732516acd125b6e83c127752ed5f027e1b276e", + "3": "0x0100000000000000000000000000000000000033", "4": "0xb763e26cd6dd09d16f52dc3c60ebb77e46b03290", "42": "0x7B6B10CAa9E8E9552bA72638eA5b47c25afea1f3", "50": "0x34d402f14d58e001d8efbe6585051bf9706aa064" @@ -69,7 +69,7 @@ "primaryColor": "#512D80", "addresses": { "1": "0x1985365e9f78359a9B6AD760e32412f4a445E862", - "3": "0xb0b443fe0e8a04c4c85e8fda9c5c1ccc057d6653", + "3": "0x0100000000000000000000000000000000000034", "4": "0x6a732d537daf79d75efaeae286d30fc578fa98d0", "42": "0x8CB3971b8EB709C14616BD556Ff6683019E90d9C", "50": "0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3" @@ -83,7 +83,7 @@ "primaryColor": "#E1AA3E", "addresses": { "1": "0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A", - "3": "0xc4895a5aafa2708d6bc1294e20ec839aad156b1d", + "3": "0x0100000000000000000000000000000000000035", "4": "0xc40a46ca4bc8e6057ed571e39cf400f3f935e4d5", "42": "0xA4f468c9c692eb6B4b8b06270dAe7A2CfeedcDe9", "50": "0xcdb594a32b1cc3479d8746279712c39d18a07fc0" @@ -97,7 +97,7 @@ "primaryColor": "#333333", "addresses": { "1": "0xec67005c4E498Ec7f55E092bd1d35cbC47C91892", - "3": "0x823ebe83d39115536274a8617e00a1ff3544fd63", + "3": "0x0100000000000000000000000000000000000036", "4": "0x521c0941300a18a4edc697368f43a6a870be1f3d", "42": "0x17e394D1Df6cE29d042195Ea38411A98ff3Ead94", "50": "0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d" diff --git a/src/services/web3_wrapper.ts b/src/services/web3_wrapper.ts index 985a0ea29..b7cf0b8a7 100644 --- a/src/services/web3_wrapper.ts +++ b/src/services/web3_wrapper.ts @@ -1,4 +1,6 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; +//@ts-ignore +import { EchoPolyfill } from 'echo-web3'; import { sleep } from '../util/sleep'; @@ -10,6 +12,7 @@ export const isMetamaskInstalled = (): boolean => { }; export const initializeWeb3Wrapper = async (): Promise => { + await EchoPolyfill(); const { ethereum, web3, location } = window; if (web3Wrapper) { From 2d8f10aa378b4b34d5eb0b5ed56c3646e590fac5 Mon Sep 17 00:00:00 2001 From: Nick Borsuk Date: Fri, 22 Nov 2019 19:15:59 +0300 Subject: [PATCH 2/2] add new network --- src/config.json | 37 ++++++++++++++++++++++--------------- src/util/types.ts | 1 + 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/config.json b/src/config.json index bdb465253..bd2a6e70c 100644 --- a/src/config.json +++ b/src/config.json @@ -10,10 +10,11 @@ "icon": "assets/icons/zrx.svg", "addresses": { "1": "0xE41d2489571d322189246DaFA5ebDe1F4699F498", - "3": "0x010000000000000000000000000000000000002f", + "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00", "4": "0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa", "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa", - "50": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" + "50": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c", + "103": "0x010000000000000000000000000000000000002f" }, "decimals": 18, "displayDecimals": 2 @@ -25,10 +26,11 @@ "icon": "assets/icons/weth.svg", "addresses": { "1": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "3": "0x0100000000000000000000000000000000000030", + "3": "0xc778417e063141139fce010982780140aa0cd5ab", "4": "0xc778417e063141139fce010982780140aa0cd5ab", "42": "0xd0a1e359811322d97991e03f863a0c30c2cf029c", - "50": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" + "50": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082", + "103": "0x0100000000000000000000000000000000000030" }, "decimals": 18, "displayDecimals": 2 @@ -41,10 +43,11 @@ "primaryColor": "#DEA349", "addresses": { "1": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", - "3": "0x0100000000000000000000000000000000000032", + "3": "0xfc8862446cd3e4a2e7167e7d97df738407fead07", "4": "0x6f2d6ff85efca691aad23d549771160a12f0a0fc", "42": "0xc4375b7de8af5a38a93548eb8453a498222c4ff2", - "50": "0xbe0037eaf2d64fe5529bca93c18c9702d3930376" + "50": "0xbe0037eaf2d64fe5529bca93c18c9702d3930376", + "103": "0x0100000000000000000000000000000000000032" } }, { @@ -55,10 +58,11 @@ "icon": "assets/icons/mkr.svg", "addresses": { "1": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", - "3": "0x0100000000000000000000000000000000000033", + "3": "0x06732516acd125b6e83c127752ed5f027e1b276e", "4": "0xb763e26cd6dd09d16f52dc3c60ebb77e46b03290", "42": "0x7B6B10CAa9E8E9552bA72638eA5b47c25afea1f3", - "50": "0x34d402f14d58e001d8efbe6585051bf9706aa064" + "50": "0x34d402f14d58e001d8efbe6585051bf9706aa064", + "103": "0x0100000000000000000000000000000000000033" } }, { @@ -69,10 +73,11 @@ "primaryColor": "#512D80", "addresses": { "1": "0x1985365e9f78359a9B6AD760e32412f4a445E862", - "3": "0x0100000000000000000000000000000000000034", + "3": "0xb0b443fe0e8a04c4c85e8fda9c5c1ccc057d6653", "4": "0x6a732d537daf79d75efaeae286d30fc578fa98d0", "42": "0x8CB3971b8EB709C14616BD556Ff6683019E90d9C", - "50": "0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3" + "50": "0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3", + "103": "0x0100000000000000000000000000000000000034" } }, { @@ -83,10 +88,11 @@ "primaryColor": "#E1AA3E", "addresses": { "1": "0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A", - "3": "0x0100000000000000000000000000000000000035", + "3": "0xc4895a5aafa2708d6bc1294e20ec839aad156b1d", "4": "0xc40a46ca4bc8e6057ed571e39cf400f3f935e4d5", "42": "0xA4f468c9c692eb6B4b8b06270dAe7A2CfeedcDe9", - "50": "0xcdb594a32b1cc3479d8746279712c39d18a07fc0" + "50": "0xcdb594a32b1cc3479d8746279712c39d18a07fc0", + "103": "0x0100000000000000000000000000000000000035" } }, { @@ -97,10 +103,11 @@ "primaryColor": "#333333", "addresses": { "1": "0xec67005c4E498Ec7f55E092bd1d35cbC47C91892", - "3": "0x0100000000000000000000000000000000000036", + "3": "0x823ebe83d39115536274a8617e00a1ff3544fd63", "4": "0x521c0941300a18a4edc697368f43a6a870be1f3d", "42": "0x17e394D1Df6cE29d042195Ea38411A98ff3Ead94", - "50": "0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d" + "50": "0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d", + "103": "0x0100000000000000000000000000000000000036" } } ], @@ -140,4 +147,4 @@ "value": "dai" } ] -} +} \ No newline at end of file diff --git a/src/util/types.ts b/src/util/types.ts index 2d07bbf59..945e0d946 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -19,6 +19,7 @@ export enum Network { Rinkeby = 4, Kovan = 42, Ganache = 50, + EchoTestnet = 103, } export interface Token {