Skip to content

Commit

Permalink
Merge pull request #1478 from Conflux-Chain/firefox-1
Browse files Browse the repository at this point in the history
fix: Replace @fluent-wallet/spec and @fluent-wallet/db provided by  y…
  • Loading branch information
iosh authored Dec 17, 2024
2 parents f411125 + 37b69f4 commit 6d5063a
Show file tree
Hide file tree
Showing 170 changed files with 551 additions and 352 deletions.
169 changes: 168 additions & 1 deletion .yarn/versions/7f49ff5b.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,169 @@
releases:
helios: patch

declined:
- helios
- helios-background
- "@fluent-wallet/rpc-engine"
- "@fluent-wallet/cfx_accounts"
- "@fluent-wallet/cfx_call"
- "@fluent-wallet/cfx_chain-id"
- "@fluent-wallet/cfx_check-balance-against-transaction"
- "@fluent-wallet/cfx_client-version"
- "@fluent-wallet/cfx_epoch-number"
- "@fluent-wallet/cfx_estimate-gas-and-collateral"
- "@fluent-wallet/cfx_gas-price"
- "@fluent-wallet/cfx_get-account"
- "@fluent-wallet/cfx_get-account-pending-info"
- "@fluent-wallet/cfx_get-account-pending-transactions"
- "@fluent-wallet/cfx_get-accumulate-interest-rate"
- "@fluent-wallet/cfx_get-admin"
- "@fluent-wallet/cfx_get-balance"
- "@fluent-wallet/cfx_get-best-block-hash"
- "@fluent-wallet/cfx_get-block-by-block-number"
- "@fluent-wallet/cfx_get-block-by-epoch-number"
- "@fluent-wallet/cfx_get-block-by-hash"
- "@fluent-wallet/cfx_get-block-by-hash-with-pivot-assumption"
- "@fluent-wallet/cfx_get-block-reward-info"
- "@fluent-wallet/cfx_get-blocks-by-epoch"
- "@fluent-wallet/cfx_get-code"
- "@fluent-wallet/cfx_get-collateral-for-storage"
- "@fluent-wallet/cfx_get-confirmation-risk-by-hash"
- "@fluent-wallet/cfx_get-deposit-list"
- "@fluent-wallet/cfx_get-interest-rate"
- "@fluent-wallet/cfx_get-logs"
- "@fluent-wallet/cfx_get-max-gas-limit"
- "@fluent-wallet/cfx_get-next-nonce"
- "@fluent-wallet/cfx_get-next-usable-nonce"
- "@fluent-wallet/cfx_get-pos-economics"
- "@fluent-wallet/cfx_get-pos-reward-by-epoch"
- "@fluent-wallet/cfx_get-skipped-blocks-by-epoch"
- "@fluent-wallet/cfx_get-sponsor-info"
- "@fluent-wallet/cfx_get-staking-balance"
- "@fluent-wallet/cfx_get-status"
- "@fluent-wallet/cfx_get-storage-at"
- "@fluent-wallet/cfx_get-storage-root"
- "@fluent-wallet/cfx_get-supply-info"
- "@fluent-wallet/cfx_get-transaction-by-hash"
- "@fluent-wallet/cfx_get-transaction-receipt"
- "@fluent-wallet/cfx_get-vote-list"
- "@fluent-wallet/cfx_net-version"
- "@fluent-wallet/cfx_opened-method-groups"
- "@fluent-wallet/cfx_request-accounts"
- "@fluent-wallet/cfx_send-raw-transaction"
- "@fluent-wallet/cfx_send-transaction"
- "@fluent-wallet/cfx_sign-tx-with-ledger-nano-s"
- "@fluent-wallet/cfx_sign-typed-data_v4"
- "@fluent-wallet/eth_accounts"
- "@fluent-wallet/eth_block-number"
- "@fluent-wallet/eth_call"
- "@fluent-wallet/eth_chain-id"
- "@fluent-wallet/eth_estimate-1559-fee"
- "@fluent-wallet/eth_estimate-gas"
- "@fluent-wallet/eth_fee-history"
- "@fluent-wallet/eth_gas-price"
- "@fluent-wallet/eth_get-balance"
- "@fluent-wallet/eth_get-block-by-hash"
- "@fluent-wallet/eth_get-block-by-number"
- "@fluent-wallet/eth_get-code"
- "@fluent-wallet/eth_get-logs"
- "@fluent-wallet/eth_get-transaction-by-hash"
- "@fluent-wallet/eth_get-transaction-count"
- "@fluent-wallet/eth_get-transaction-receipt"
- "@fluent-wallet/eth_max-priority-fee-per-gas"
- "@fluent-wallet/eth_request-accounts"
- "@fluent-wallet/eth_send-raw-transaction"
- "@fluent-wallet/eth_send-transaction"
- "@fluent-wallet/eth_sign-transaction"
- "@fluent-wallet/eth_sign-tx-with-ledger-nano-s"
- "@fluent-wallet/net_version"
- "@fluent-wallet/personal_sign"
- "@fluent-wallet/txpool_next-nonce"
- "@fluent-wallet/wallet_accounts"
- "@fluent-wallet/wallet_add-ethereum-chain"
- "@fluent-wallet/wallet_add-hd-path"
- "@fluent-wallet/wallet_add-network"
- "@fluent-wallet/wallet_add-pending-user-auth-request"
- "@fluent-wallet/wallet_add-vault"
- "@fluent-wallet/wallet_after-unlock"
- "@fluent-wallet/wallet_chain-id"
- "@fluent-wallet/wallet_cleanup-tx"
- "@fluent-wallet/wallet_create-account"
- "@fluent-wallet/wallet_create-address"
- "@fluent-wallet/wallet_db-query"
- "@fluent-wallet/wallet_delete-account"
- "@fluent-wallet/wallet_delete-account-group"
- "@fluent-wallet/wallet_delete-app"
- "@fluent-wallet/wallet_delete-memo"
- "@fluent-wallet/wallet_delete-network"
- "@fluent-wallet/wallet_detect-address-type"
- "@fluent-wallet/wallet_detect-network-type"
- "@fluent-wallet/wallet_discover-accounts"
- "@fluent-wallet/wallet_enrich-conflux-tx"
- "@fluent-wallet/wallet_enrich-ethereum-tx"
- "@fluent-wallet/wallet_enrich-txs"
- "@fluent-wallet/wallet_export-account"
- "@fluent-wallet/wallet_export-account-group"
- "@fluent-wallet/wallet_export-all"
- "@fluent-wallet/wallet_generate-address"
- "@fluent-wallet/wallet_generate-private-key"
- "@fluent-wallet/wallet_get-account-address-by-network"
- "@fluent-wallet/wallet_get-account-group"
- "@fluent-wallet/wallet_get-account-group-vault-value"
- "@fluent-wallet/wallet_get-address-private-key"
- "@fluent-wallet/wallet_get-balance"
- "@fluent-wallet/wallet_get-block-or-epoch-number"
- "@fluent-wallet/wallet_get-block-time"
- "@fluent-wallet/wallet_get-blockchain-explorer-url"
- "@fluent-wallet/wallet_get-current-account"
- "@fluent-wallet/wallet_get-current-network"
- "@fluent-wallet/wallet_get-current-viewing-app"
- "@fluent-wallet/wallet_get-fluent-metadata"
- "@fluent-wallet/wallet_get-import-hardware-wallet-info"
- "@fluent-wallet/wallet_get-network"
- "@fluent-wallet/wallet_get-next-nonce"
- "@fluent-wallet/wallet_get-next-usable-nonce"
- "@fluent-wallet/wallet_get-pending-auth-request"
- "@fluent-wallet/wallet_get-permissions"
- "@fluent-wallet/wallet_get-preferences"
- "@fluent-wallet/wallet_handle-unfinished-cfx-tx"
- "@fluent-wallet/wallet_handle-unfinished-eth-tx"
- "@fluent-wallet/wallet_handle-unfinished-txs"
- "@fluent-wallet/wallet_import-address"
- "@fluent-wallet/wallet_import-all"
- "@fluent-wallet/wallet_import-hardware-wallet-account-group-or-account"
- "@fluent-wallet/wallet_import-mnemonic"
- "@fluent-wallet/wallet_import-private-key"
- "@fluent-wallet/wallet_metadata-for-popup"
- "@fluent-wallet/wallet_network1559compatible"
- "@fluent-wallet/wallet_refetch-balance"
- "@fluent-wallet/wallet_refetch-token-list"
- "@fluent-wallet/wallet_refetch-tx-list"
- "@fluent-wallet/wallet_register-site-metadata"
- "@fluent-wallet/wallet_request-accounts"
- "@fluent-wallet/wallet_request-permissions"
- "@fluent-wallet/wallet_request-unlock-ui"
- "@fluent-wallet/wallet_send-transaction"
- "@fluent-wallet/wallet_send-transaction-with-action"
- "@fluent-wallet/wallet_set-app-current-account"
- "@fluent-wallet/wallet_set-app-current-network"
- "@fluent-wallet/wallet_set-current-account"
- "@fluent-wallet/wallet_set-current-network"
- "@fluent-wallet/wallet_set-preferences"
- "@fluent-wallet/wallet_switch-ethereum-chain"
- "@fluent-wallet/wallet_unlock"
- "@fluent-wallet/wallet_unwatch-asset"
- "@fluent-wallet/wallet_update-account"
- "@fluent-wallet/wallet_update-account-group"
- "@fluent-wallet/wallet_update-network"
- "@fluent-wallet/wallet_update-token-list"
- "@fluent-wallet/wallet_upsert-memo"
- "@fluent-wallet/wallet_user-approved-auth-request"
- "@fluent-wallet/wallet_user-rejected-auth-request"
- "@fluent-wallet/wallet_validate20token"
- "@fluent-wallet/wallet_validate-app-permissions"
- "@fluent-wallet/wallet_validate-mnemonic"
- "@fluent-wallet/wallet_validate-password"
- "@fluent-wallet/wallet_validate-private-key"
- "@fluent-wallet/wallet_watch-asset"
- "@fluent-wallet/wallet_zero-account-group"
- workspace-tools
2 changes: 1 addition & 1 deletion packages/background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@fluent-wallet/cfx_sign-tx-with-ledger-nano-s": "workspace:*",
"@fluent-wallet/cfx_sign-typed-data_v4": "workspace:packages/rpcs/cfx_signTypedData_v4",
"@fluent-wallet/consts": "workspace:packages/consts",
"@fluent-wallet/db": "workspace:packages/db",
"@fluent-wallet/db": "1.0.76",
"@fluent-wallet/eth_accounts": "workspace:packages/rpcs/eth_accounts",
"@fluent-wallet/eth_block-number": "workspace:packages/rpcs/eth_blockNumber",
"@fluent-wallet/eth_call": "workspace:packages/rpcs/eth_call",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// // # imports
import {IS_PROD_MODE, IS_TEST_MODE} from '@fluent-wallet/inner-utils'
import {EXT_STORAGE} from '@fluent-wallet/consts'
import {isManifestV3} from './env'
import {isManifestV3} from './env.js'
import {defRpcEngine} from '@fluent-wallet/rpc-engine'
import {persist as persistToExtStorageHandler} from '../background/src/persist-db-to-ext-storage'
import {persist as persistToExtStorageHandler} from './persist-db-to-ext-storage.js'

import browser from 'webextension-polyfill'
import SCHEMA from '../background/src//db-schema'
import SCHEMA from './db-schema.js'
import {listen} from '@fluent-wallet/extension-runtime/background.js'
import fillInitialDBData from '../background/src/init-db.js'
import fillInitialDBData from './init-db.js'
import * as bb from '@fluent-wallet/webextension'

import {rpcEngineOpts} from '../background/src/rpc-engine-opts'
import {rpcEngineOpts} from './rpc-engine-opts.js'

// # setup
// ## dev helper
Expand Down Expand Up @@ -56,9 +56,8 @@ async function initDB(initDBFn, skipRestore) {

// ## init rpc engine
async function initRPCEngine(dbConnection) {

const {request} = defRpcEngine(dbConnection, rpcEngineOpts)
const protectedRequest = (req = {} as any) =>
const protectedRequest = (req = {}) =>
request({
id: req.id,
jsonrpc: req.jsonrpc,
Expand Down Expand Up @@ -125,8 +124,7 @@ function saveTimestamp() {
// # initialize

async function initApp() {
const {request, db} = await initBG()

const {request} = await initBG()

// ## start long running jobs
if (!IS_TEST_MODE) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error",
"@fluent-wallet/random-id": "workspace:packages/random-id",
"@fluent-wallet/rpc-epoch-ref": "workspace:packages/rpc-epoch-ref",
"@fluent-wallet/spec": "workspace:packages/spec",
"@fluent-wallet/spec": "1.0.6",
"@fluent-wallet/transducers": "workspace:packages/transducers",
"@thi.ng/atom": "4.1.42",
"@thi.ng/rstream": "6.0.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"main": "index.js",
"version": "3.0.0",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.6",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_chainId/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"main": "index.js",
"version": "1.0.2",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.5",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_clientVersion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.3",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_epochNumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"main": "index.js",
"version": "0.0.11",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_estimateGasAndCollateral/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.8",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_gasPrice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.0.15",
"dependencies": {
"@fluent-wallet/consts": "workspace:*",
"@fluent-wallet/spec": "workspace:packages/spec",
"@fluent-wallet/spec": "1.0.6",
"@thi.ng/cache": "2.1.9"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getAccount/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"main": "index.js",
"version": "0.0.11",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getAccountPendingInfo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.1.0",
"version": "0.0.2",
"dependencies": {
"@fluent-wallet/spec": "workspace:*"
"@fluent-wallet/spec": "1.0.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.1.0",
"version": "0.0.2",
"dependencies": {
"@fluent-wallet/spec": "workspace:*"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getAccumulateInterestRate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.4",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getAdmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.4",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBalance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"main": "index.js",
"version": "0.0.9",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBestBlockHash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.4",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBlockByBlockNumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.1.0",
"version": "0.0.1",
"dependencies": {
"@fluent-wallet/spec": "workspace:*"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBlockByEpochNumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.4",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBlockByHash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.4",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.3",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/rpcs/cfx_getBlockRewardInfo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"packageManager": "yarn@3.0.1",
"version": "0.0.3",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
"@fluent-wallet/spec": "1.0.6"
}
}
Loading

0 comments on commit 6d5063a

Please sign in to comment.