Skip to content

Commit

Permalink
feat: created a web component for the bridge deposit and withdraw com…
Browse files Browse the repository at this point in the history
…ponent
  • Loading branch information
luizoamorim authored and IlyasRidhuan committed Mar 3, 2022
1 parent f26b0ec commit 7d23ffa
Show file tree
Hide file tree
Showing 32 changed files with 25,467 additions and 912 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules/*
cli/build/*
wallet/src/index.js
wallet/cli/*
wallet/build
/**/*.d.ts
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
extends: ['codfish', 'eslint:recommended', 'plugin:react/recommended'],
extends: [
'codfish',
'eslint:recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
],
rules: {
'no-underscore-dangle': 'off',
'no-console': 'off',
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
run: |
npm ci
npm run lint
ganache-test:
runs-on: ubuntu-18.04
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
node_modules
cli/build
.*swp

.vscode/*

# wallet
wallet/build
Expand Down
3 changes: 1 addition & 2 deletions cli/lib/index.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* ignore unused exports */
import Nf3 from './nf3.mjs';
import getAbi from './abi.mjs';
import * as Constants from './constants.mjs';
import * as Tokens from './tokens.mjs';
import * as Units from './units.mjs';
import * as Environment from './environment.mjs';

export { Nf3, Constants, Tokens, Units, Environment, getAbi };
export { Nf3, Constants, Tokens, Units, Environment };
4 changes: 0 additions & 4 deletions cli/lib/tokens.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ Get decimals configured in ERC token
*/
async function getDecimals(ercAddress, tokenType, provider) {
const abi = getAbi(tokenType);
console.log(`TOken Type DEC: ${tokenType}`);
const ercContract = new provider.eth.Contract(abi, ercAddress);
switch (tokenType) {
case TOKEN_TYPE.ERC20: {
Expand Down Expand Up @@ -112,7 +111,6 @@ async function getERCInfo(ercAddress, ethereumAddress, provider, options) {
let decimals = 0;
const tokenIds = [];

console.log(`TOken Type: ${tokenTypeFilter}`);
if (tokenTypeFilter) {
switch (tokenTypeFilter.toUpperCase()) {
case 'ERC721':
Expand Down Expand Up @@ -217,9 +215,7 @@ async function getERCInfo(ercAddress, ethereumAddress, provider, options) {
} else {
// expected ERC20
try {
console.log(`TOken TypeBEFORE FAILURE: ${TOKEN_TYPE.ERC20}`);
const abi = getAbi(TOKEN_TYPE.ERC20);
console.log(`TOken TypeAfter ABIT: ${abi}`);
const ercContract = new provider.eth.Contract(abi, ercAddress);
balance = await ercContract.methods.balanceOf(ethereumAddress).call();
decimals = await getDecimals(ercAddress, TOKEN_TYPE.ERC20, provider);
Expand Down
1 change: 0 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = {
USE_INFURA: process.env.USE_INFURA === 'true',
ETH_PRIVATE_KEY: process.env.ETH_PRIVATE_KEY, // owner's/deployer's private key
ETH_ADDRESS: process.env.ETH_ADDRESS,
USE_ROPSTEN_NODE: process.env.USE_ROPSTEN_NODE === 'true',
OPTIMIST_HOST: process.env.OPTIMIST_HOST || 'optimist',
OPTIMIST_PORT: process.env.OPTIMIST_PORT || 80,
clientBaseUrl: `http://${process.env.CLIENT_HOST}:${process.env.CLIENT_PORT}`,
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -o errexit
set -o pipefail

if [ -z "${USE_INFURA}" ] && [ -z "${ETH_PRIVATE_KEY}" ] && [ -z "${USE_ROPSTEN_NODE}" ]; then
if [ -z "${USE_INFURA}" ] && [ -z "${ETH_PRIVATE_KEY}" ]; then
# wait until there's a blockchain client up
while ! nc -z ${BLOCKCHAIN_WS_HOST} ${BLOCKCHAIN_PORT}; do sleep 3; done
fi
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/src/circuit-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async function setupCircuits() {

// when deploying on infura - do serial tx execution to avoid nonce issue
// when using a private key, we shouldn't assume an unlocked account and we sign the transaction directly
if (config.USE_INFURA || config.ETH_PRIVATE_KEY || config.USE_ROPSTEN_NODE) {
if (config.USE_INFURA || config.ETH_PRIVATE_KEY) {
await Web3.submitRawTransaction(await tx.encodeABI(), keyRegistryAddress);
} else await tx.send();
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/src/contract-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function setupCircuits() {
// when deploying on infura
// do serial registration to predict nonce
// or, if we have the owner's private key, sign with that, rather than use an unlocked account
if (config.USE_INFURA || config.ETH_PRIVATE_KEY || config.USE_ROPSTEN_NODE) {
if (config.USE_INFURA || config.ETH_PRIVATE_KEY || config.USE_HOSTED_GETH) {
await Web3.submitRawTransaction(
(await waitForContract('Proposers')).methods
.setStateContract(stateInstance.options.address)
Expand Down
108 changes: 71 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
"config": "^3.3.1",
"eslint": "^7.25.0",
"eslint-config-codfish": "^10.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"fast-check": "^2.18.0",
"find-unused-exports": "^2.0.0",
"general-number": "^1.0.1",
"husky": "^6.0.0",
"jsdoc": "^3.6.10",
"jsdoc": "^3.6.7",
"mocha": "^8.3.2",
"prettier": "^2.2.1",
"prettier-plugin-solidity": "^1.0.0-beta.10",
Expand Down
2 changes: 1 addition & 1 deletion wallet/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SKIP_PREFLIGHT_CHECK=true
OPTIMIST_API_URL=http://ohio.nightfall3.com:80
OPTIMIST_API_URL=https://vqxy02tr5e.execute-api.us-east-2.amazonaws.com/Dev
LOCAL_API_URL=http://localhost:8081
LOCAL_OPTIMIST=true
OPTIMIST_WS_URL=wss://af3ys26lpe.execute-api.us-east-2.amazonaws.com/dev
Expand Down
Loading

0 comments on commit 7d23ffa

Please sign in to comment.