Skip to content

Improve the multi network integration #791

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

Draft
wants to merge 47 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c333866
Update env variables
evandrosaturnino Nov 12, 2024
86711bd
Update tbtc sdk version in package json
evandrosaturnino Nov 12, 2024
17d11d0
Update explorer links based on network
evandrosaturnino Nov 12, 2024
a54ccb5
Fix ledger support
evandrosaturnino Nov 12, 2024
722badd
Add networks centralized folder
evandrosaturnino Nov 12, 2024
921f48e
Update contract initialization handling
evandrosaturnino Nov 12, 2024
770ffbd
Refactor connector logic to handle multi network
evandrosaturnino Nov 12, 2024
cf6e808
Add switch support to multiple networks
evandrosaturnino Nov 12, 2024
8daf9bc
Fix subgraph issue by migrating to studio services
evandrosaturnino Nov 12, 2024
ac14cd3
Fix cooldown period for different apps
evandrosaturnino Nov 12, 2024
d63a208
Update threshold class to accommodate multiple networks
evandrosaturnino Nov 12, 2024
d229352
Update local storage logic handling
evandrosaturnino Nov 12, 2024
d6e5a0c
Update minting flow to accommodate multiple networks
evandrosaturnino Nov 12, 2024
3649ff4
update depositor property in minting process
evandrosaturnino Nov 15, 2024
c3bfaad
add tbtc subgraph api secret in github workflow
evandrosaturnino Nov 15, 2024
87c57e8
Update yarn lock to reflect the tbtc sdk version
evandrosaturnino Nov 15, 2024
5989ba1
Update bitcoin electrum credentials logic
evandrosaturnino Nov 21, 2024
de89ae0
Update block explorer url in some tbtc components
evandrosaturnino Nov 21, 2024
092e58c
Add chainid to redux effects to avoid incompatibility
evandrosaturnino Nov 21, 2024
6508d9d
Add readme file in networks folder
evandrosaturnino Nov 21, 2024
c1b293e
Improve minting flow for multiple networks
evandrosaturnino Nov 21, 2024
2ca26a4
Run prettier in networks readme file
evandrosaturnino Nov 21, 2024
4e47fcf
Update effects to validate connected network
evandrosaturnino Nov 25, 2024
9ff1563
Add new step for crosschain minting process
evandrosaturnino Nov 25, 2024
28f2de6
Update contracts connection by chain ID
evandrosaturnino Nov 27, 2024
c09a273
Improve redemption flow with multiple networks
evandrosaturnino Nov 27, 2024
95916a1
Add crosschain fee for arbitrum
evandrosaturnino Nov 28, 2024
b249a87
Handle multicall absence in unsupported networks
evandrosaturnino Nov 28, 2024
3f8c237
Fix tbtc minting percentage fees formats
evandrosaturnino Nov 28, 2024
3eca3d3
Fix staking app name variable
evandrosaturnino Nov 29, 2024
adbe05e
Fix typos in app pages
evandrosaturnino Dec 10, 2024
0d796b5
Fix memory leak in use send transaction hook
evandrosaturnino Dec 10, 2024
29e0f38
update mainnet taco application artifact source
evandrosaturnino Dec 17, 2024
97ec4dc
update testnet taco registry artifacts import
evandrosaturnino Jan 6, 2025
7dca90f
Fix testnet taco registry artifact application import
evandrosaturnino Jan 7, 2025
247a2f3
Update nucypher contracts module version
evandrosaturnino Jan 17, 2025
764d57f
convert coinbase chainid hex to number format
evandrosaturnino Jan 17, 2025
786cebd
update arbitrum minting fee
evandrosaturnino Jan 23, 2025
9e7ba9e
improve readability of minting fees calculation
evandrosaturnino Jan 24, 2025
8d6b4f9
Add networks centralized folder
evandrosaturnino Nov 12, 2024
acfa2ba
Update contract initialization handling
evandrosaturnino Nov 12, 2024
2cd71d1
implements generic rpc service support
evandrosaturnino Dec 13, 2024
a34f77e
get public rpc url in case of missing rpc service
evandrosaturnino Dec 17, 2024
46e51d7
add loyalty program url if arbitrum is connected
evandrosaturnino Dec 17, 2024
2e843c7
fixes the coinbase wallet rpc url
evandrosaturnino Feb 10, 2025
6832c2a
remove hardcoded taco registry artifacts
evandrosaturnino Feb 10, 2025
05bc24c
Merge branch 'main' into improve-the-multi-network-integration
evandrosaturnino Mar 3, 2025
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: 11 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REACT_APP_SUPPORTED_CHAIN_ID=1337
REACT_APP_ETH_HOSTNAME_HTTP=http://localhost:8545
REACT_APP_ETH_HOSTNAME_WS=ws://localhost:8545
REACT_APP_DEFAULT_PROVIDER_CHAIN_ID=1337
REACT_APP_RPC_SERVICE_API=$RPC_SERVICE_API
REACT_APP_RPC_SERVICE_NAME=$RPC_SERVICE_NAME
REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS
REACT_APP_DAPP_DEVELOPMENT_TESTNET_CONTRACTS=$DAPP_DEVELOPMENT_TESTNET_CONTRACTS

Expand All @@ -19,11 +19,16 @@ REACT_APP_FEATURE_FLAG_SENTRY=false
REACT_APP_SENTRY_DSN=$SENTRY_DSN
REACT_APP_FEATURE_FLAG_TRM=false

REACT_APP_ELECTRUM_PROTOCOL=$ELECTRUM_PROTOCOL
REACT_APP_ELECTRUM_HOST=$ELECTRUM_HOST
REACT_APP_ELECTRUM_PORT=$ELECTRUM_PORT
REACT_APP_MAINNET_ELECTRUM_PROTOCOL=$MAINNET_ELECTRUM_PROTOCOL
REACT_APP_MAINNET_ELECTRUM_HOST=$MAINNET_ELECTRUM_HOST
REACT_APP_MAINNET_ELECTRUM_PORT=$MAINNET_ELECTRUM_PORT
REACT_APP_TESTNET_ELECTRUM_PROTOCOL=$TESTNET_ELECTRUM_PROTOCOL
REACT_APP_TESTNET_ELECTRUM_HOST=$TESTNET_ELECTRUM_HOST
REACT_APP_TESTNET_ELECTRUM_PORT=$TESTNET_ELECTRUM_PORT
REACT_APP_MOCK_BITCOIN_CLIENT=true

REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID

REACT_APP_TBTC_SUBGRAPH_API=$TBTC_SUBGRAPH_API

REACT_APP_TACO_DOMAIN=dashboard
18 changes: 12 additions & 6 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REACT_APP_SUPPORTED_CHAIN_ID=$CHAIN_ID
REACT_APP_ETH_HOSTNAME_HTTP=$ETH_HOSTNAME_HTTP
REACT_APP_ETH_HOSTNAME_WS=$ETH_HOSTNAME_WS
REACT_APP_DEFAULT_PROVIDER_CHAIN_ID=$CHAIN_ID
REACT_APP_RPC_SERVICE_API=$RPC_SERVICE_API
REACT_APP_RPC_SERVICE_NAME=$RPC_SERVICE_NAME
REACT_APP_DAPP_DEVELOPMENT_TESTNET_CONTRACTS=$DAPP_DEVELOPMENT_TESTNET_CONTRACTS

REACT_APP_FEATURE_FLAG_TBTC_V2=true
Expand All @@ -20,10 +20,16 @@ REACT_APP_FEATURE_FLAG_SENTRY=$SENTRY_SUPPORT
REACT_APP_SENTRY_DSN=$SENTRY_DSN
REACT_APP_FEATURE_FLAG_TRM=$TRM_SUPPORT

REACT_APP_ELECTRUM_PROTOCOL=$ELECTRUM_PROTOCOL
REACT_APP_ELECTRUM_HOST=$ELECTRUM_HOST
REACT_APP_ELECTRUM_PORT=$ELECTRUM_PORT
REACT_APP_MAINNET_ELECTRUM_PROTOCOL=$MAINNET_ELECTRUM_PROTOCOL
REACT_APP_MAINNET_ELECTRUM_HOST=$MAINNET_ELECTRUM_HOST
REACT_APP_MAINNET_ELECTRUM_PORT=$MAINNET_ELECTRUM_PORT
REACT_APP_TESTNET_ELECTRUM_PROTOCOL=$TESTNET_ELECTRUM_PROTOCOL
REACT_APP_TESTNET_ELECTRUM_HOST=$TESTNET_ELECTRUM_HOST
REACT_APP_TESTNET_ELECTRUM_PORT=$TESTNET_ELECTRUM_PORT
REACT_APP_MOCK_BITCOIN_CLIENT=false

REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID

REACT_APP_TBTC_SUBGRAPH_API=$TBTC_SUBGRAPH_API

REACT_APP_TACO_DOMAIN=mainnet
5 changes: 3 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REACT_APP_SUPPORTED_CHAIN_ID=1337
REACT_APP_MULTICALL_ADDRESS=0x086813525A7dC7dafFf015Cdf03896Fd276eab60
REACT_APP_DEFAULT_PROVIDER_CHAIN_ID=1337
REACT_APP_MULTICALL_ADDRESS=0xcA11bde05977b3631167028862bE2a173976CA11
REACT_APP_RPC_SERVICE_NAME=alchemy
REACT_APP_TACO_DOMAIN=dashboard
31 changes: 19 additions & 12 deletions .github/workflows/dashboard-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /${{ github.head_ref }}
CHAIN_ID: 11155111
ETH_HOSTNAME_HTTP: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
DEFAULT_PROVIDER_CHAIN_ID: 11155111
RPC_SERVICE_API: ${{ secrets.RPC_SERVICE_API }}
RPC_SERVICE_NAME: ${{ secrets.RPC_SERVICE_NAME }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
ELECTRUM_HOST: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
ELECTRUM_PORT: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
MAINNET_ELECTRUM_PROTOCOL: ${{ secrets.MAINNET_ELECTRUMX_PROTOCOL }}
MAINNET_ELECTRUM_HOST: ${{ secrets.MAINNET_ELECTRUMX_HOST }}
MAINNET_ELECTRUM_PORT: ${{ secrets.MAINNET_ELECTRUMX_PORT }}
TESTNET_ELECTRUM_PROTOCOL: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
TESTNET_ELECTRUM_HOST: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
TESTNET_ELECTRUM_PORT: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
TBTC_SUBGRAPH_API: ${{ secrets.TBTC_SUBGRAPH_API }}

# FIXME: Tests are missing, will this step be needed?
# - name: Test
Expand Down Expand Up @@ -121,14 +125,15 @@ jobs:
gcpBucketPath: ${{ github.head_ref }}
preview: true
secrets:
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
rpcServiceApi: ${{ secrets.RPC_SERVICE_API }}
rpcServiceName: ${{ secrets.RPC_SERVICE_NAME }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
electrumPort: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
sentryDsn: ${{ secrets.TESTNET_SENTRY_DSN }}
walletConnectProjectId: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
tbtcSubgraphApi: ${{ secrets.TBTC_SUBGRAPH_API }}

# This job will be triggered via the `workflow_dispatch` event, as part of the
# CI flow, which gets triggered manually after changes in the contracts,
Expand All @@ -152,14 +157,15 @@ jobs:
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
rpcServiceApi: ${{ secrets.RPC_SERVICE_API }}
rpcServiceName: ${{ secrets.RPC_SERVICE_NAME }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
electrumPort: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
sentryDsn: ${{ secrets.TESTNET_SENTRY_DSN }}
walletConnectProjectId: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
tbtcSubgraphApi: ${{ secrets.TBTC_SUBGRAPH_API }}

# This job will be triggered after merges of PRs to the `main` branch. As the
# triggering is not related to the changes in the contracts / client code, we
Expand All @@ -178,11 +184,12 @@ jobs:
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
rpcServiceApi: ${{ secrets.RPC_SERVICE_API }}
rpcServiceName: ${{ secrets.RPC_SERVICE_NAME }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
electrumPort: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
sentryDsn: ${{ secrets.TESTNET_SENTRY_DSN }}
walletConnectProjectId: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
tbtcSubgraphApi: ${{ secrets.TBTC_SUBGRAPH_API }}
23 changes: 14 additions & 9 deletions .github/workflows/dashboard-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,21 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /${{ github.ref_name }}
CHAIN_ID: 1
ETH_HOSTNAME_HTTP: ${{ secrets.MAINNET_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.MAINNET_ETH_HOSTNAME_WS }}
DEFAULT_PROVIDER_CHAIN_ID: 1
RPC_SERVICE_API: ${{ secrets.RPC_SERVICE_API }}
RPC_SERVICE_NAME: ${{ secrets.RPC_SERVICE_NAME }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.MAINNET_ELECTRUMX_PROTOCOL }}
ELECTRUM_HOST: ${{ secrets.MAINNET_ELECTRUMX_HOST }}
ELECTRUM_PORT: ${{ secrets.MAINNET_ELECTRUMX_PORT }}
MAINNET_ELECTRUM_PROTOCOL: ${{ secrets.MAINNET_ELECTRUMX_PROTOCOL }}
MAINNET_ELECTRUM_HOST: ${{ secrets.MAINNET_ELECTRUMX_HOST }}
MAINNET_ELECTRUM_PORT: ${{ secrets.MAINNET_ELECTRUMX_PORT }}
TESTNET_ELECTRUM_PROTOCOL: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
TESTNET_ELECTRUM_HOST: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
TESTNET_ELECTRUM_PORT: ${{ secrets.TESTNET_ELECTRUMX_PORT }}
SENTRY_SUPPORT: true
SENTRY_DSN: ${{ secrets.MAINNET_SENTRY_DSN }}
TRM_SUPPORT: ${{ secrets.TRM_SUPPORT }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
TBTC_SUBGRAPH_API: ${{ secrets.TBTC_SUBGRAPH_API }}
GOOGLE_TAG_MANAGER_SUPPORT: false
GOOGLE_TAG_MANAGER_ID: ${{ secrets.GOOGLE_TAG_MANAGER_ID }}

Expand All @@ -67,9 +71,9 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /
CHAIN_ID: 1
ETH_HOSTNAME_HTTP: ${{ secrets.MAINNET_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.MAINNET_ETH_HOSTNAME_WS }}
DEFAULT_PROVIDER_CHAIN_ID: 1
RPC_SERVICE_API: ${{ secrets.RPC_SERVICE_API }}
RPC_SERVICE_NAME: ${{ secrets.RPC_SERVICE_NAME }}
NODE_OPTIONS: --max_old_space_size=4096
POSTHOG_SUPPORT: true
POSTHOG_API_KEY: ${{ secrets.MAINNET_POSTHOG_API_KEY }}
Expand All @@ -81,6 +85,7 @@ jobs:
SENTRY_DSN: ${{ secrets.MAINNET_SENTRY_DSN }}
TRM_SUPPORT: ${{ secrets.TRM_SUPPORT }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
TBTC_SUBGRAPH_API: ${{ secrets.TBTC_SUBGRAPH_API }}
GOOGLE_TAG_MANAGER_SUPPORT: true
GOOGLE_TAG_MANAGER_ID: ${{ secrets.GOOGLE_TAG_MANAGER_ID }}

Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/reusable-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ on:
default: false
type: boolean
secrets:
ethUrlHttp:
description: The HTTP ETH API URL.
rpcServiceApi:
description: The RPC service API Key.
required: true
ethUrlWS:
description: The WebSocket ETH API URL.
rpcServiceName:
description: The RPC service name.
required: true
gcpServiceKey:
description: JSON key for Google Cloud Platform service account.
Expand All @@ -75,6 +75,9 @@ on:
Project Id gathered from WalletConnect cloud. Required for
WalletConnect v2.
required: true
tbtcSubgraphApi:
description: The API endpoint for the tBTC subgraph.
required: true

jobs:
build-and-publish:
Expand Down Expand Up @@ -161,16 +164,20 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /
CHAIN_ID: ${{ env.NETWORK_ID }}
ETH_HOSTNAME_HTTP: ${{ secrets.ethUrlHttp }}
ETH_HOSTNAME_WS: ${{ secrets.ethUrlWS }}
DEFAULT_PROVIDER_CHAIN_ID: ${{ env.NETWORK_ID }}
RPC_SERVICE_API: ${{ secrets.rpcServiceApi }}
RPC_SERVICE_NAME: ${{ secrets.rpcServiceName }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.electrumProtocol }}
ELECTRUM_HOST: ${{ secrets.electrumHost }}
ELECTRUM_PORT: ${{ secrets.electrumPort }}
MAINNET_ELECTRUM_PROTOCOL: ${{ secrets.mainnetElectrumProtocol }}
MAINNET_ELECTRUM_HOST: ${{ secrets.mainnetElectrumHost }}
MAINNET_ELECTRUM_PORT: ${{ secrets.mainnetElectrumPort }}
TESTNET_ELECTRUM_PROTOCOL: ${{ secrets.testnetElectrumProtocol }}
TESTNET_ELECTRUM_HOST: ${{ secrets.testnetElectrumHost }}
TESTNET_ELECTRUM_PORT: ${{ secrets.testnetElectrumPort }}
SENTRY_SUPPORT: true
SENTRY_DSN: ${{ secrets.sentryDsn }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.walletConnectProjectId }}
TBTC_SUBGRAPH_API: ${{ secrets.tbtcSubgraphApi }}
DAPP_DEVELOPMENT_TESTNET_CONTRACTS: ${{ inputs.preview == true }}

- name: Build
Expand All @@ -179,16 +186,20 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /${{ inputs.gcpBucketPath }}
CHAIN_ID: ${{ env.NETWORK_ID }}
ETH_HOSTNAME_HTTP: ${{ secrets.ethUrlHttp }}
ETH_HOSTNAME_WS: ${{ secrets.ethUrlWS }}
DEFAULT_PROVIDER_CHAIN_ID: ${{ env.NETWORK_ID }}
RPC_SERVICE_API: ${{ secrets.rpcServiceApi }}
RPC_SERVICE_NAME: ${{ secrets.rpcServiceName }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.electrumProtocol }}
ELECTRUM_HOST: ${{ secrets.electrumHost }}
ELECTRUM_PORT: ${{ secrets.electrumPort }}
MAINNET_ELECTRUM_PROTOCOL: ${{ secrets.mainnetElectrumProtocol }}
MAINNET_ELECTRUM_HOST: ${{ secrets.mainnetElectrumHost }}
MAINNET_ELECTRUM_PORT: ${{ secrets.mainnetElectrumPort }}
TESTNET_ELECTRUM_PROTOCOL: ${{ secrets.testnetElectrumProtocol }}
TESTNET_ELECTRUM_HOST: ${{ secrets.testnetElectrumHost }}
TESTNET_ELECTRUM_PORT: ${{ secrets.testnetElectrumPort }}
SENTRY_SUPPORT: true
SENTRY_DSN: ${{ secrets.sentryDsn }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.walletConnectProjectId }}
TBTC_SUBGRAPH_API: ${{ secrets.tbtcSubgraphApi }}
DAPP_DEVELOPMENT_TESTNET_CONTRACTS: ${{ inputs.preview == true }}

- name: Deploy to GCP
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
## Update the `.env` file:

```
REACT_APP_SUPPORTED_CHAIN_ID=11155111
REACT_APP_ETH_HOSTNAME_HTTP=<your http ETH hostname- eg. Infura>
REACT_APP_ETH_HOSTNAME_WS=<your ws ETH hostname- eg. Infura>
REACT_APP_DEFAULT_PROVIDER_CHAIN_ID=11155111
REACT_APP_RPC_SERVICE_API=<your RPC service API key>
REACT_APP_RPC_SERVICE_NAME=<the RPC service name - Expected in RpcServices enum format e.g. "alchemy" or "infura">
// We can skip this env variable- the dapp uses the correct address
// of Multicall contract for Sepolia under the hood.
REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS
Expand Down Expand Up @@ -109,9 +109,9 @@ The following procedure allows to deploy T token dashboard to production:
Update `.env` to contain:

```
REACT_APP_SUPPORTED_CHAIN_ID=11155111
REACT_APP_ETH_HOSTNAME_HTTP=https://sepolia.infura.io/v3/<your API key here>
REACT_APP_ETH_HOSTNAME_WS=wss://sepolia.infura.io/v3/<your API key here>
REACT_APP_DEFAULT_PROVIDER_CHAIN_ID=11155111
REACT_APP_RPC_SERVICE_API=<your RPC service API key here>
REACT_APP_RPC_SERVICE_NAME=<your RPC service name here>
REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS

REACT_APP_FEATURE_FLAG_TBTC_V2=true
Expand All @@ -129,13 +129,18 @@ REACT_APP_FEATURE_FLAG_SENTRY=false
REACT_APP_SENTRY_DSN=$SENTRY_DSN
REACT_APP_FEATURE_FLAG_TRM=false

REACT_APP_ELECTRUM_PROTOCOL=wss
REACT_APP_ELECTRUM_HOST=electrumx-server.test.tbtc.network
REACT_APP_ELECTRUM_PORT=8443
REACT_APP_MAINNET_ELECTRUM_PROTOCOL=$MAINNET_ELECTRUM_PROTOCOL
REACT_APP_MAINNET_ELECTRUM_HOST=$MAINNET_ELECTRUM_HOST
REACT_APP_MAINNET_ELECTRUM_PORT=$MAINNET_ELECTRUM_PORT
REACT_APP_TESTNET_ELECTRUM_PROTOCOL=wss
REACT_APP_TESTNET_ELECTRUM_HOST=electrumx-server.test.tbtc.network
REACT_APP_TESTNET_ELECTRUM_PORT=8443
REACT_APP_MOCK_BITCOIN_CLIENT=false

REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID

REACT_APP_TBTC_SUBGRAPH_API=$TBTC_SUBGRAPH_API

REACT_APP_TACO_DOMAIN=dashboard
```

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"@keep-network/keep-ecdsa": "development",
"@keep-network/random-beacon": "development",
"@keep-network/tbtc": "development",
"@keep-network/tbtc-v2.ts": "^2.4.1",
"@keep-network/tbtc-v2.ts": "^2.5.0-dev.8",
"@ledgerhq/connect-kit-loader": "1.1.8",
"@ledgerhq/wallet-api-client": "^1.2.0",
"@ledgerhq/wallet-api-client-react": "^1.1.1",
"@nucypher/nucypher-contracts": "0.13.0",
"@nucypher/nucypher-contracts": "0.23.0",
"@reduxjs/toolkit": "^1.6.1",
"@rehooks/local-storage": "^2.4.4",
"@sentry/react": "^7.33.0",
Expand Down
21 changes: 14 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { useSubscribeToToppedUpEvent } from "./hooks/useSubscribeToToppedUpEvent
import { pages } from "./pages"
import { useCheckBonusEligibility } from "./hooks/useCheckBonusEligibility"
import { useFetchStakingRewards } from "./hooks/useFetchStakingRewards"
import { isSameChainId, isSameETHAddress } from "./web3/utils"
import { isSameETHAddress } from "./web3/utils"
import { ThresholdProvider } from "./contexts/ThresholdContext"
import { LedgerLiveAppProvider } from "./contexts/LedgerLiveAppContext"
import {
Expand All @@ -63,6 +63,9 @@ import { useIsEmbed } from "./hooks/useIsEmbed"
import TBTC from "./pages/tBTC"
import { useDetectIfEmbed } from "./hooks/useDetectIfEmbed"
import { useGoogleTagManager } from "./hooks/google-tag-manager"
import { hexToNumber, isSameChainId } from "./networks/utils"
import { walletConnected } from "./store/account"
import { useIsActive } from "./hooks/useIsActive"

const Web3EventHandlerComponent = () => {
useSubscribeToVendingMachineContractEvents()
Expand Down Expand Up @@ -133,15 +136,19 @@ const useSubscribeToVendingMachineContractEvents = () => {

const AppBody = () => {
const dispatch = useDispatch()
const { connector, account, chainId, deactivate } = useWeb3React()
const { connector, account, chainId } = useIsActive()

useEffect(() => {
const updateHandler = (update: ConnectorUpdate) => {
// if chain is changed then just deactivate the current provider and reset
// store
// if chain is changed then just update the redux store for the wallet
// connection
if (update.chainId && !isSameChainId(update.chainId, chainId as number)) {
dispatch(resetStoreAction())
deactivate()
dispatch(
walletConnected({
address: account || "",
chainId: hexToNumber(update.chainId),
})
)
} else if (
update.account &&
!isSameETHAddress(update.account, account as string)
Expand Down Expand Up @@ -169,7 +176,7 @@ const AppBody = () => {
connector?.removeListener(ConnectorEvent.Update, updateHandler)
connector?.removeListener(ConnectorEvent.Deactivate, deactivateHandler)
}
}, [connector, dispatch, account])
}, [connector, dispatch, account, chainId])

useEffect(() => {
dispatch(fetchETHPriceUSD())
Expand Down
2 changes: 1 addition & 1 deletion src/components/CopyToClipboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import shortenAddress from "../../utils/shortenAddress"
import ViewInBlockExplorer, {
ViewInBlockExplorerProps,
} from "../ViewInBlockExplorer"
import { ExplorerDataType } from "../../utils/createEtherscanLink"
import { ExplorerDataType } from "../../networks/enums/networks"

type CopyToClipboardProps = {
textToCopy: string
Expand Down
Loading