Skip to content

Latest commit

 

History

History
141 lines (105 loc) · 3.71 KB

local_development.md

File metadata and controls

141 lines (105 loc) · 3.71 KB

Local Development

These steps will setup this repo on your machine for local development for the majority of the components in this repo. By default the extension will connect to contracts already deployed on Arbitrum Nitro testnet and a public Aggregator running on https://arbitrum-goerli.blswallet.org/ If you would like to target a remote network instead, add the addtional steps in Remote Development as well.

Dependencies

Required

Optional (Recomended)

Setup

Install the latest Node 16. If using nvm to manage node versions, run this in the root directory:

nvm install

Run the repo setup script

./setup.ts

Then choose to target either a local Hardhat node or the Arbitrum Testnet. If you choose to run on Arbitrum Goerli skip ahead until tests.

Chain (RPC Node)

Start a local Hardhat node for RPC use.

cd ./contracts
yarn hardhat node

Contracts

Fund the create2Deployer.

yarn hardhat fundDeployer --network gethDev

Deploy all bls-wallet contracts.

yarn hardhat run scripts/deploy_all.ts --network gethDev

Aggregator

make these changes in aggregator > .env

RPC_URL=http://localhost:8545 NETWORK_CONFIG_PATH=../contracts/networks/local.json

In a seperate terminal/shell instance

docker-compose up -d postgres # Or see local postgres instructions in ./aggregator/README.md#PostgreSQL
cd ./aggregator
./programs/aggregator.ts

In a seperate terminal/shell instance

cd ./extension
yarn run dev:chrome # or dev:firefox, dev:opera

Extension

make these changes in extension > .env

AGGREGATOR_URL=http://localhost:3000/
DEFAULT_CHAIN_ID=31337
NETWORK_CONFIG=./contracts/networks/local.json

Chrome

  1. Go to Chrome's extension page.
  2. Enable Developer mode.
  3. Either click Load unpacked extension... and select ./extension/extension/chrome or drag that folder into the page.

Firefox

  1. Go to Firefox's debugging page.
  2. Click Load Temporary Add-on....
  3. Select ./extension/extension/firefox/manifest.json.

Tests

See each components README.md for how to run tests.

Testing/using updates to ./clients

extension

cd ./contracts/clients
yarn build
yarn link
cd ../extension
yarn link bls-wallet-clients

If you would like live updates to from the clients package to trigger reloads of the extension, be sure to comment out this section of ./extension/weback.config.js:

...
module.exports = {
  ...
  watchOptions: {
    // Remove this if you want to watch for changes
    // from a linked package, such as bls-wallet-clients.
    ignored: /node_modules/,
  },
  ...
};

aggregator

You will need to push up an @experimental version to 'bls-wallet-clients' on npm and update the version in ./aggregtor/src/deps.ts until a local linking solution for deno is found. See esm-dev/esm.sh#216 for details. You will need write access to the npmjs project to do this. You can request access or request one of the BLS Wallet project developers push up your client changes in the Discussions section of this repo.

In ./contracts/clients with your changes:

yarn publish-experimental

Note the x.y.z-abc1234 version that was output.

Then in ./aggregtor/deps.ts, change all from references for that package.

...
} from "https://esm.sh/[email protected]";
...