Skip to content

Commit

Permalink
Extension: Update to Firefox docs (#1398)
Browse files Browse the repository at this point in the history
* fix: make even more explicit instructions for FF

* docs: add environment details

* fix: accept REVISION as env var, specify in instructions

* fix: update CI to provide revision env var, docs

* fix: update .env overrides
  • Loading branch information
jurevans authored Dec 11, 2024
1 parent e8f0b39 commit e44a285
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 54 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/release-wallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
required: true
type: string
default: "main"
NAMADA_INTERFACE_NAMADA_CHAIN_ID:
required: true
type: string

env:
CI: false
jobs:
setup:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
VERSION: ${{ steps.set-environment-variables.outputs.VERSION }}
steps:
Expand All @@ -37,7 +34,7 @@ jobs:

build-extension-chrome:
needs: setup
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -61,9 +58,7 @@ jobs:

- name: Build the extension
working-directory: ./apps/extension
run: yarn build:chrome
env:
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
run: REVISION=$SHA yarn build:chrome

- uses: actions/upload-artifact@v3
with:
Expand All @@ -72,7 +67,7 @@ jobs:

build-extension-firefox:
needs: setup
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -96,9 +91,7 @@ jobs:

- name: Build the extension
working-directory: ./apps/extension
run: yarn build:firefox
env:
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
run: REVISION=$SHA yarn build:firefox

- uses: actions/upload-artifact@v3
with:
Expand All @@ -107,7 +100,7 @@ jobs:

release:
needs: [setup, build-extension-chrome, build-extension-firefox]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Download Chrome extension build
uses: actions/download-artifact@v3
Expand All @@ -129,9 +122,9 @@ jobs:
- name: Make release body text
run: |
echo "NAMADA_INTERFACE_NAMADA_CHAIN_ID: $NAMADA_INTERFACE_NAMADA_CHAIN_ID" >> RELEASE
echo "REVISION: $REVISION" >> RELEASE
env:
NAMADA_INTERFACE_NAMADA_CHAIN_ID: ${{ inputs.NAMADA_INTERFACE_NAMADA_CHAIN_ID }}
REVISION: ${{ github.sha }}

- name: Create release
id: create-release
Expand Down
7 changes: 5 additions & 2 deletions apps/extension/.env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Specify the following if you wish to override the defaults defined in @namada/chains:
# Specify the following if you wish to override the defaults:

# NAMADA
# Override default approved signing chain ID
NAMADA_INTERFACE_NAMADA_CHAIN_ID=namada-testnet.ddf12d74622ca25f3ad6fe14

# Override revision - useful if building source outside of a git repo
NAMADA_INTERFACE_REVISION=8916680a2bcd43f1ef54b47e2d0213d1d02abbfb

100 changes: 72 additions & 28 deletions apps/extension/FIREFOX_README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,105 @@
# NOTICE FOR FIREFOX ADD-ON REVIEWERS

This is the monorepo which contains the source code for Namada Extension.
This is the monorepo which contains the source code for Namada Extension. Please follow the instructions
exactly as they are described below.

## Source code
## Table of Contents

The main extension source code is located in `apps/extension/src`. We also use
several local packages; their sources are in:

- `packages/chains/src`
- `packages/components/src`
- `packages/hooks/src`
- `packages/sdk/src`
- `packages/storage/src`
- `packages/types/src`
- `packages/utils/src`
- `packages/shared/lib` (shared package Rust code compiled to WebAssembly)
- `packages/shared/src` (shared package TypeScript glue code)
- `packages/crypto/lib` (crypto package Rust code compiled to WebAssembly)
- `packages/crypto/src` (crypto package TypeScript glue code)
- [Build Instructions](#build-instructions)
- [Notes](#notes)
- [Environment](#environment)
- [Setting up Node & NPM](#setting-up-node-and-npm)
- [Source Code](#source-code)

## Build instructions

If you don't already have Node v20 LTS and NPM v10, install now via `nvm`:

```bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

# Enable nvm in current shell
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
**NOTE**: You _must_ use `yarn` to install dependencies! This is due to the fact that this is configured as a monorepo
using yarn workspaces. If you install via `npm install` or `npm i`, it will not resolve dependencies correctly.

# Install v20 LTS
nvm install v20.9.0
```
If you don't already have Node v22 LTS and NPM v10, please follow these [instructions](#setting-up-node-and-npm)

These instructions should work for the default reviewer build environment.

```bash
sudo apt install protobuf-compiler build-essential curl pkg-config libssl-dev binaryen
sudo apt install protobuf-compiler build-essential curl pkg-config libssl-dev binaryen -y
curl https://sh.rustup.rs -sSf | sh

# Proceed with standard installation when prompted

# Make sure to pull cargo into your current environment:
. "$HOME/.cargo/env"

# You must use yarn to install dependencies:
npm install -g yarn
export PUPPETEER_SKIP_DOWNLOAD=true

# Run yarn to install dependencies
yarn

# Move into extension app directory
cd apps/extension

# Build wasm dependency:
yarn wasm:build
```

Then, issue the final build command for the Firefox add-on:

```bash
# Build the addon:
yarn build:firefox
```

The resulting extension is the ZIP file in `apps/extension/build/firefox`.

[ [Table of Contents](#table-of-contents) ]

## Notes

### Environment

This build was produced using the following environment:

- Ubuntu 24.04 LTS (Desktop edition)
- 10GB of system memory (RAM)
- 6 cores of vCPU
- Node 22 LTS and npm 10
- 35GB of storage

Please ensure that this matches your environment!

[ [Table of Contents](#table-of-contents) ]

### Setting up Node and NPM

```bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

# Enable nvm in current shell
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Install v22 LTS
nvm install v22.0.0
```

[ [Table of Contents](#table-of-contents) ]

### Source code

The main extension source code is located in `apps/extension/src`. We also use
several local packages; their sources are in:

- `packages/chains/src`
- `packages/components/src`
- `packages/hooks/src`
- `packages/sdk/src`
- `packages/storage/src`
- `packages/types/src`
- `packages/utils/src`
- `packages/shared/lib` (shared package Rust code compiled to WebAssembly)
- `packages/shared/src` (shared package TypeScript glue code)
- `packages/crypto/lib` (crypto package Rust code compiled to WebAssembly)
- `packages/crypto/src` (crypto package TypeScript glue code)

[ [Table of Contents](#table-of-contents) ]
12 changes: 7 additions & 5 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@
"clean:chrome": "rimraf ./build/chrome",
"clean:firefox": "rimraf ./build/firefox",
"build": "yarn wasm:build && yarn clean && yarn build:chrome && yarn build:firefox",
"build:chrome": "yarn clean:chrome && NODE_ENV=production TARGET=chrome REVISION=$(git rev-parse HEAD) webpack-cli && yarn run web-ext build --s ./build/chrome -a ./build/chrome",
"build:chrome": "yarn clean:chrome && NODE_ENV=production TARGET=chrome webpack-cli && yarn run web-ext build --s ./build/chrome -a ./build/chrome",
"build:chrome:revision": "NAMADA_INTERFACE_REVISION=$(git rev-parse HEAD) yarn build:chrome",
"build:chrome:beta": "yarn clean:chrome && NODE_ENV=production BETA_RELEASE=true TARGET=chrome REVISION=$(git rev-parse HEAD) webpack-cli && yarn run web-ext build --s ./build/chrome -a ./build/chrome",
"build:firefox": "yarn clean:firefox && NODE_ENV=production TARGET=firefox REVISION=$(git rev-parse HEAD) webpack-cli && yarn run web-ext build --s ./build/firefox -a ./build/firefox",
"build:firefox:beta": "yarn clean:firefox && NODE_ENV=production BETA_RELEASE=true TARGET=firefox REVISION=$(git rev-parse HEAD) webpack-cli && yarn run web-ext build --s ./build/firefox -a ./build/firefox",
"build:firefox": "yarn clean:firefox && NODE_ENV=production TARGET=firefox webpack-cli && yarn run web-ext build --s ./build/firefox -a ./build/firefox",
"build:firefox:revision": "NAMADA_INTERFACE_REVISION=$(git rev-parse HEAD) yarn build:firefox",
"build:firefox:beta": "yarn clean:firefox && NODE_ENV=production BETA_RELEASE=true TARGET=firefox webpack-cli && yarn run web-ext build --s ./build/firefox -a ./build/firefox",
"lint": "eslint src --ext .ts,.tsx",
"lint:fix": "yarn lint -- --fix",
"lint:ci": "yarn lint --max-warnings 0",
"start": "yarn start:chrome",
"start:chrome": "yarn clean:chrome && NODE_ENV=development TARGET=chrome REVISION=$(git rev-parse HEAD) yarn watch",
"start:chrome": "yarn clean:chrome && NODE_ENV=development TARGET=chrome NAMADA_INTERFACE_REVISION=$(git rev-parse HEAD) yarn watch",
"start:chrome:proxy": "NAMADA_INTERFACE_PROXY=true yarn start:chrome",
"start:firefox": "yarn clean:firefox && NODE_ENV=development TARGET=firefox REVISION=$(git rev-parse HEAD) yarn watch",
"start:firefox": "yarn clean:firefox && NODE_ENV=development TARGET=firefox NAMADA_INTERFACE_REVISION=$(git rev-parse HEAD) yarn watch",
"start:firefox:proxy": "NAMADA_INTERFACE_PROXY=true yarn start:firefox",
"test": "yarn wasm:build:test && yarn jest --coverage",
"test:only": "yarn jest --coverage",
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/App/Common/AppHeaderNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useNavigate } from "react-router-dom";
import sdkPackage from "../../../../../packages/sdk/package.json";
import extensionPackage from "../../../package.json";

const { REVISION: revision = "" } = process.env;
const { NAMADA_INTERFACE_REVISION: revision = "" } = process.env;

type AppHeaderNavigationProps = {
open: boolean;
Expand Down
8 changes: 6 additions & 2 deletions apps/extension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const { getProcessEnv } = require("@namada/config/webpack.js");
// Load .env from namadillo:
require("dotenv").config({ path: "./.env" });

const { NODE_ENV, TARGET, BUNDLE_ANALYZE, BETA_RELEASE: isBeta } = process.env;
const {
NODE_ENV,
TARGET,
BUNDLE_ANALYZE,
BETA_RELEASE: isBeta,
} = process.env;

const OUTPUT_PATH = resolve(__dirname, `./build/${TARGET}`);
const MANIFEST_VERSION = TARGET === "firefox" ? "v2" : "v3";
Expand Down Expand Up @@ -106,7 +111,6 @@ const plugins = [
env: JSON.stringify(
getProcessEnv("NAMADA_INTERFACE", [
"TARGET",
"REVISION",
"NODE_ENV",
"npm_package_version",
])
Expand Down
2 changes: 1 addition & 1 deletion packages/chains/src/chains/namada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BridgeType, Chain, Extensions } from "@namada/types";
import { ProxyMappings } from "../types";

const DEFAULT_ALIAS = "Namada";
const DEFAULT_CHAIN_ID = "public-testnet-15.0dacadb8d663";
const DEFAULT_CHAIN_ID = "namada.5f5de2dd1b88cba30586420";
const DEFAULT_RPC = "https://proxy.heliax.click/public-testnet-15.0dacadb8d663";
const DEFAULT_BECH32_PREFIX = "tnam";

Expand Down

1 comment on commit e44a285

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.