Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to master for 2.6.4 #315

Merged
merged 88 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
adf500a
Now includes ability to set DEV_PASSWORD
tombeckenham Dec 8, 2024
ecf73ca
Move pnpm settings to .npmrc
tombeckenham Dec 8, 2024
4bed659
refactor: enhance PrivateRoute component with async wallet state checks
tombeckenham Dec 9, 2024
897457d
Merge pull request #261 from Outblock:259-feature-autofill-pw-in-dev-…
tombeckenham Dec 9, 2024
8d1d8ce
Merge pull request #263 from Outblock:262-feature-update-pnpm-settings
tombeckenham Dec 9, 2024
f3303e2
Merge pull request #265 from Outblock:260-bug-async-issue-with-privat…
tombeckenham Dec 9, 2024
9be071a
Updated free gas algo
tombeckenham Dec 9, 2024
f922461
fixed: turn back on
zzggo Dec 9, 2024
5b3ac07
Small refactor of code that was looping
tombeckenham Dec 9, 2024
07d0f98
Corrected flag in TransferConfirmation. Updated react-devtools
tombeckenham Dec 9, 2024
a25755d
[FEATURE] Add unit testing framework and util tests
tombeckenham Dec 9, 2024
db8a61b
Adding test step to CI
tombeckenham Dec 9, 2024
136d94f
Added setting to ensure default branch for PRs is set to dev
tombeckenham Dec 9, 2024
7c62816
Removed unnecessary tsc check
tombeckenham Dec 9, 2024
a4c4f6b
Merge pull request #271 from Outblock:269-feature-add-unit-testing-fr…
tombeckenham Dec 9, 2024
a8c3276
Merge branch 'dev' into 266-feature-update-gas-estimate-in-storage-check
tombeckenham Dec 9, 2024
b0d6945
Updated lock file
tombeckenham Dec 9, 2024
e81a2ef
chore: update .gitignore and add Playwright testing framework
tombeckenham Dec 10, 2024
ba78dd6
Updated eslint for e2e tests
tombeckenham Dec 10, 2024
cd399ca
Added basic check to check the extension loads and welcome is shown
tombeckenham Dec 10, 2024
e1c0003
chore: update .env.example and README for improved development setup
tombeckenham Dec 11, 2024
ba22390
Merge pull request #273 from Outblock:272-feature-update-readme
tombeckenham Dec 11, 2024
e96e175
Refactor test configuration and structure:
tombeckenham Dec 11, 2024
879a236
Removed test.yml for the moment
tombeckenham Dec 11, 2024
c2c9d70
Corrected some config
tombeckenham Dec 11, 2024
48e38e1
Merge remote-tracking branch 'origin/dev' into 243-feature-end-to-end…
tombeckenham Dec 11, 2024
d23a826
fixed: update nft png
zzggo Dec 11, 2024
7bf1c5e
Adding FlowAddress and ActiveChildType types
tombeckenham Dec 11, 2024
bd0e969
Updated and individually validated all movingBetweenEvmAndFlow params
tombeckenham Dec 11, 2024
9d16edc
Merge remote-tracking branch 'origin/dev' into 266-feature-update-gas…
tombeckenham Dec 11, 2024
1a8618e
Added switchunlock as well
tombeckenham Dec 11, 2024
16fe000
Merge pull request #282 from Outblock:master
tombeckenham Dec 12, 2024
a752a5f
[release] 2.6.3
zzggo Dec 12, 2024
e0789d7
Merge pull request #284 from Outblock/pump-version
lmcmz Dec 12, 2024
640e4ba
Merge pull request #276 from Outblock/update-move-nft-icon
lmcmz Dec 12, 2024
74bbc2a
Merge pull request #279 from Outblock:259-feature-autofill-pw-in-dev-…
tombeckenham Dec 12, 2024
cff6423
Uses feature flag for tx_warning_prediction, and checks balance as we…
tombeckenham Dec 13, 2024
5b79d01
Removed console message
tombeckenham Dec 13, 2024
757c241
Created some scripts to analyze
tombeckenham Dec 13, 2024
9dbbada
[FEATURE] Call mixpanel from background
tombeckenham Dec 16, 2024
4f6bbdf
Added ip address geo location
tombeckenham Dec 16, 2024
7765bc1
Merge pull request #267 from Outblock:266-feature-update-gas-estimate…
tombeckenham Dec 16, 2024
d296b71
Merge pull request #290 from Outblock:289-feature-analyze-imports-and…
tombeckenham Dec 16, 2024
ca377b7
Updated package.json
tombeckenham Dec 16, 2024
dabcd94
Merge
tombeckenham Dec 16, 2024
7a35698
Merge branch 'dev' into 288-feature-call-mixpanel-from-background
tombeckenham Dec 16, 2024
ca2a651
Merge pull request #275 from Outblock:243-feature-end-to-end-testing
tombeckenham Dec 16, 2024
6851afc
Removed mixpanel dependencies
tombeckenham Dec 16, 2024
b8f4e98
[FEATURE] firebase auth for web extensions
tombeckenham Dec 16, 2024
735120d
Merge pull request #291 from Outblock:288-feature-call-mixpanel-from-…
tombeckenham Dec 16, 2024
e5af6bc
Removed firebase fix webpack plugin as it is no longer needed
tombeckenham Dec 16, 2024
27d555e
Merge branch 'dev' into 233-feature-firebase-auth-for-web-extensions
tombeckenham Dec 16, 2024
491d4b5
[BUG] Storage error alert not showing
tombeckenham Dec 16, 2024
9d2e0da
feat: decode call contract data
zzggo Dec 16, 2024
9032963
Merge branch 'dev' into 232-feature-decode-evm-transaction-call-data-…
zzggo Dec 16, 2024
95afbac
fixed: remove unused import
zzggo Dec 16, 2024
fef0ee8
fixed: style
zzggo Dec 16, 2024
aefa24b
Merge pull request #294 from Outblock:293-bug-storage-error-alert-not…
tombeckenham Dec 17, 2024
6489535
Moved news and config APIs
tombeckenham Dec 17, 2024
48797ff
Merge pull request #292 from Outblock:233-feature-firebase-auth-for-w…
tombeckenham Dec 17, 2024
6ed7b59
Fixed url click through in news items
tombeckenham Dec 17, 2024
5855aff
Corrected conditional news
tombeckenham Dec 17, 2024
2731ca9
Merge pull request #300 from Outblock:299-feature-move-news-api
tombeckenham Dec 17, 2024
b3c2d93
Merge branch 'dev' into 232-feature-decode-evm-transaction-call-data-…
zzggo Dec 17, 2024
47636b1
fixed: add tooltip for long address
zzggo Dec 17, 2024
ba4b9fd
fixed: managing value with array
zzggo Dec 17, 2024
7a24fc2
Moved passkey to background services
tombeckenham Dec 17, 2024
9c26934
Renamed passkey to publicPrivateKey as it was confusing
tombeckenham Dec 17, 2024
1f174cf
Separated passkey out. Added wallet functions for pk functions called…
tombeckenham Dec 18, 2024
d895b0e
Updated imports to use wallet
tombeckenham Dec 18, 2024
b5416eb
[BUG]App Shows Pending Transaction After Signing Message Despite Tran…
tombeckenham Dec 18, 2024
d5f4164
Merge pull request #304 from Outblock:303-bugapp-shows-pending-transa…
tombeckenham Dec 18, 2024
44904bd
Merge pull request #296 from Outblock/232-feature-decode-evm-transact…
zzggo Dec 18, 2024
9b3d7f5
Removed direct background service imports
tombeckenham Dec 18, 2024
7186bd1
jsonToPrivateKey now returns Hex as we can't pass a class object from…
tombeckenham Dec 18, 2024
241e090
Minor upgrade of trustconnect library
tombeckenham Dec 18, 2024
69ffbf9
[FEATURE] Update CI to speed up pnpm
tombeckenham Dec 18, 2024
b946482
Removed pnpm version. Will use version in package
tombeckenham Dec 18, 2024
b5d9728
fixed: convert hex to readable value
zzggo Dec 18, 2024
7f27200
Merge pull request #308 from Outblock:306-feature-update-ci-to-speed-…
tombeckenham Dec 19, 2024
6b9f0a3
Merge pull request #307 from Outblock:298-feature-move-trustconnect-t…
tombeckenham Dec 19, 2024
535b1b6
feat: add new test files
zzggo Dec 19, 2024
6484d99
Convert build scripts to Typescript
tombeckenham Dec 19, 2024
53a5889
Fixed up vitest config
tombeckenham Dec 19, 2024
9902223
Merge pull request #309 from Outblock/decode-signtype-amount
zzggo Dec 19, 2024
04bb1fe
[IMPROVEMENT] Update Storage Warning Text Content
tombeckenham Dec 19, 2024
22a08cb
Merge pull request #313 from Outblock:312-improvement-update-storage-…
tombeckenham Dec 19, 2024
bffed50
Merge pull request #311 from Outblock:310-feature-ts-webpack-and-build
tombeckenham Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ GD_FOLDER=""
GD_AES_KEY=""
GD_IV=""
GOOGLE_API=""

# Firebase
FB_TOKEN=""
# firebase
FB_APIKEY=""
FB_API_KEY=""
FB_AUTH_DOMAIN="url.firebaseapp.com"
FB_DATABASE_URL="https://url.firebasedatabase.app"
FB_PROJECTID=""
Expand All @@ -15,7 +16,17 @@ FB_MESSAGING_SENDER_ID=""
FB_APP_ID=""
FB_MEASUREMENT_ID=""
FB_FUNCTIONS=""
# manifest

# Manifest
OAUTH2_CLIENT_ID=""
OAUTH2_SCOPES=""
WC_PROJECTID=""
MANIFEST_KEY=""

# Development
DEV_PASSWORD=""
MIXPANEL_TOKEN=""

# API URLs (optional - defaults exist in code)
INITIAL_OPENAPI_URL=""
WEB_NEXT_URL=""
33 changes: 12 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,23 @@ jobs:
node-version: [22.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false
uses: pnpm/action-setup@v4

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test

- name: Create .env.pro file
run: |
cat << EOF > .env.pro
Expand All @@ -71,6 +59,9 @@ jobs:
FB_APP_ID="${{ secrets.FB_APP_ID }}"
FB_MEASUREMENT_ID="${{ secrets.FB_MEASUREMENT_ID }}"
FB_FUNCTIONS="${{ secrets.FB_FUNCTIONS }}"
API_NEWS_PATH="${{ vars.API_NEWS_PATH }}"
API_CONFIG_PATH="${{ vars.API_CONFIG_PATH }}"
API_BASE_URL="${{ vars.API_BASE_URL }}"
# manifest
OAUTH2_CLIENT_ID="${{ secrets.OAUTH2_CLIENT_ID }}"
OAUTH2_SCOPES="${{ vars.OAUTH2_SCOPES }}"
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ src/background/utils/firebase.config.json
dist.rar
dist.7z
.cursorrules
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
dependency-usage.md
extension-dependencies.md
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
shamefully-hoist=true
node-linker=hoisted
strict-peer-dependencies=false
auto-install-peers=true
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
},
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
"eslint.useFlatConfig": true
"eslint.useFlatConfig": true,
"githubPullRequests.overrideDefaultBranch": "dev",
"githubIssues.issueBranchTitle": "${issueNumber}-${sanitizedIssueTitle}",
"cSpell.words": ["Cbor", "secp"]
}
111 changes: 101 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,120 @@
## Contribution

### Install dependency
If you'd like to contribute to the extension, you'll need to install Node.js, pnpm, and get access to the development environment.

1. Install Node.js version v22.11 or later
2. Install pnpm `npm install -g pnpm`
### Install Node & Dependencies

1. Install Node.js version v22.11 or later using a [package manager](https://nodejs.org/en/download/package-manager)
2. Install pnpm `corepack enable pnpm`
3. Run `pnpm i` to install dependencies

### Configure google-services.json
Mac / Linux

```
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Install Node.js version v22.11 or later
nvm install 22

# Use the version of Node.js specifcied in .nvmrc
nvm use 22
# install pnpm
corepack enable pnpm

# checkout dev branch
git checkout dev

# install dependencies
pnpm i
```

Windows

```
# installs fnm (Fast Node Manager)
winget install Schniz.fnm

# configure fnm environment
fnm env --use-on-cd | Out-String | Invoke-Expression

The google services.json file is required to enable Firebase services such as Firebase Authentication and Firebase Cloud Messaging. To use these services, you need obtain the service.json file through firebase and fill in the information in .env.example.
# download and install Node.js
fnm use --install-if-missing 22

You should have three different versions of the .env file: one for debug, one for development, and one for release. Please place them in the following directories:
# install pnpm
corepack enable pnpm

# install dependencies
pnpm i
```

### Configure Environment Variables

Environment variables are needed to interact with certain services. There are two versions of the .env file: one for development, one for release.

- .env
- .env.dev
- .env.prd

### Development
You should only ever need the development version of the .env file as the release version is built using GitHub Actions. The best thing to do is get a copy of the .env.dev file from a developer and add it to the project but **be sure to remove the `DEV_PASSWORD` variable from the file before sharing it.** Never commit the .env.dev file to the repository.

The .env.example file includes all the variables that are needed for the extension to work.

### Building for Development

- (Optional) Run `pnpm react-devtools` to open the React DevTools in your browser. If this is running when you start the development build, the extension will include the React DevTools code. The code is downloaded statically and built into the extension as extensions cannot load external scripts.
- Run `pnpm build:dev` on Mac / Linux, `pnpm winBuild:dev` on Windows. This will build the extension with file watching and console logging.
- Open Chrome, go to `chrome://extensions`, enable "Developer mode", click "Load unpacked", and select the `dist` folder.

### Wallets

Run `pnpm build:dev` or `pnpm winBuild:dev` for Windows environment to develop with file watching and development log.
During development, you'll often be unlocking the wallet. As Chrome extensions cannot use many password managers, we have included a way for developers to set a default password for wallets. This password will be pre-filled in the wallet unlock popup when in development mode.

Run `pnpm build:pro` or `pnpm winBuild:pro` for Windows environment to build a production package, the output extension package is located in the dist folder.
In .env.dev, set the `DEV_PASSWORD` variable to the password you want to use. This can be any password you want but it must pass the password policy. DO NOT SHARE THIS PASSWORD WITH ANYONE.

You can then create a wallet or import an existing wallet to start using the extension. If you go to the settings page in the extension, you can turn on Developer Mode which will allow you to switch between mainnet and testnet chains.

### Testing & development

- `pnpm test` will run the tests in watch mode.
- As you code, VS Code or Cursor will automatically lint and format your code when you save files.
- When you check in code using git, the linter will run to check and format your code.

_NOTE: We are working to create a test environment for the extension. This will allow you to test the with emulated transactions and wallets._

### Folder Structure

- `src/` contains the source code for the extension.
- `_raw/` contains the raw files for the extension.
- `dist/` contains the built extension.
- `_locales/` contains the locale files for the extension.
- `build/` contains the webpack build files for the extension.
- `__tests__/` contains tests

The source code is written in TypeScript and uses React on the UI. We have separated the code into the following folders:

- `src/ui/` contains the UI code for the extension popup.
- `src/background/` contains the background code for the extension service worker.
- `src/content-script/` contains the content scripts for the extension.
- `src/shared/` contains the shared utils and types between the different parts of the extension.

There are lint rules in place to ensure, the background code never includes any UI code, and that the service worker doesn't directly interact with globals such as `window` or `document`.

The UI communicates with the background service worker using the `chrome.runtime.sendMessage` and `chrome.runtime.onMessage` APIs. There is a WalletController class that handles the communication with the background service worker. This is the main way the UI interacts with the background service worker. The WalletController proxies the wallet methods in the background service worker using messaging to act as controller for the UI.

### Workflow

We work on the `dev` branch of the repository. Before you start working on the extension, create a branch for the feature you're working on from the `dev` branch. We then have a Github project that co-ordinates features between the iOS, Android, and web extension teams. Please link the issue to the Flow Wallet project and update status as you work on the feature.

1. Always create a new branch from the `dev` branch.
2. When you're ready to merge your branch into `dev`, create a pull request from your branch to the `dev` branch.
3. When the pull request is approved, merge it into the `dev` branch.
4. When you're ready to release a new version of the extension, create a pull request from the `dev` branch to the `master` branch.
5. When the pull request is approved, merge it into the `master` branch.
6. When the release is ready to be built, the `master` branch will be built and released to the Chrome Web Store.

### Language

The extension supports multiple languages. The language files are stored in the `_raw/_locales/` folder. You should put any new strings into these files.

1. Copy `_raw/_locales/en/messages.json` to `_raw/_locales/${localCode}/messages.json` (Find your locale code in [https://en.wikipedia.org/wiki/Language_localisation#Language_tags_and_codes](https://en.wikipedia.org/wiki/Language_localisation#Language_tags_and_codes))
2. Replace content in `message` property to appropriate locale language

Expand Down
2 changes: 1 addition & 1 deletion _raw/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@
"message": "Import Profile"
},
"Insufficient_Storage": {
"message": "Insufficient storage."
"message": "Almost run out of account storage."
},
"Insufficient_storage_after_action": {
"message": "Insufficient storage after this action."
Expand Down
2 changes: 1 addition & 1 deletion _raw/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@
"message": "プロファイルをインポート"
},
"Insufficient_Storage": {
"message": "ストレージが不足しています"
"message": "アカウントのストレージが不足しています"
},
"Transaction_failed_storage_exceeded": {
"message": "取引が失敗しました。アカウントのストレージ使用量により、アカウントの最低FLOW残高を下回ったためです。"
Expand Down
2 changes: 1 addition & 1 deletion _raw/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@
"message": "Импортировать профиль"
},
"Insufficient_Storage": {
"message": "Недостаточно памяти"
"message": "В вашем аккаунте недостаточно места для хранения данных"
},
"Transaction_failed_storage_exceeded": {
"message": "Ваша транзакция не выполнена, так как ваш баланс упал ниже минимального значения FLOW для использования памяти вашего аккаунта."
Expand Down
2 changes: 1 addition & 1 deletion _raw/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@
"message": "导入账户"
},
"Insufficient_Storage": {
"message": "存储不足"
"message": "帐户存储空间几乎耗尽"
},
"Transaction_failed_storage_exceeded": {
"message": "您的交易失败,因为它导致您的账户余额低于账户存储使用的最低FLOW余额。"
Expand Down
3 changes: 2 additions & 1 deletion _raw/manifest/manifest.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "FlowWallet-dev",
"short_name": "__MSG_appName__",
"version": "2.6.2",
"version": "2.6.3",
"default_locale": "en",
"description": "__MSG_appDescription__",
"icons": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera"],
"host_permissions": ["https://api.mixpanel.com/*"],
"web_accessible_resources": [
{
"resources": [
Expand Down
3 changes: 2 additions & 1 deletion _raw/manifest/manifest.pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "2.6.2",
"version": "2.6.3",
"default_locale": "en",
"description": "__MSG_appDescription__",
"icons": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera", "*://*/*"],
"host_permissions": ["https://api.mixpanel.com/*"],
"web_accessible_resources": [
{
"resources": [
Expand Down
Loading
Loading