Skip to content

Commit

Permalink
Improve chains support and error messages
Browse files Browse the repository at this point in the history
Closes #19, fixes #21.
  • Loading branch information
gabmontes committed Apr 15, 2024
1 parent 30aac02 commit a400936
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion site/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"error-no-ethereum-provider": "No Ethereum browser extension detected, install MetaMask on desktop or visit from a dApp browser on mobile.",
"error-rejected-wallet-connection": "Please authorize this website to access your Ethereum account.",
"error-unknown": "An unknown error occurred.",
"error-unsupported-network": "You're connected to an unsupported network. Switch to Ethereum (net id: 1).",
"error-unsupported-network": "You're connected to an unsupported network.",
"error": "Error",
"estimated-tx-fee": "Estimated network fee",
"floored": "Floored",
Expand Down
2 changes: 1 addition & 1 deletion site/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"error-no-ethereum-provider": "未检测到以太坊浏览器扩展,请在桌面上安装 MetaMask 或从移动设备上的 dApp 浏览器访问。",
"error-rejected-wallet-connection": "请授权本网站访问您的以太坊账户。",
"error-unknown": "出现未知错误。",
"error-unsupported-network": "您连接到不受支持的网络。切换到以太坊(网络 ID:1)。",
"error-unsupported-network": "您连接到不受支持的网络。",
"error": "错误",
"estimated-tx-fee": "预估网络费用",
"floored": "有地板的",
Expand Down
11 changes: 8 additions & 3 deletions site/utils/connectors.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { InjectedConnector } from '@web3-react/injected-connector'
import { WalletLinkConnector } from '@web3-react/walletlink-connector'

import utilsConfig from './utilsConfig.json'

const supportedChainIds = Object.keys(utilsConfig).map(k => Number.parseInt(k))

const environment = process.env.NEXT_PUBLIC_ENVIRONMENT
const nodeUrl = process.env.NEXT_PUBLIC_NODE_URL
export const injected = new InjectedConnector({
supportedChainIds: [43111, 743111]
supportedChainIds
})

export const walletlink = new WalletLinkConnector({
url: nodeUrl,
appName: `Pure Finance${environment ? ` ${environment}` : ''}`
appName: `Pure Finance${environment ? ` ${environment}` : ''}`,
supportedChainIds,
url: nodeUrl
})

0 comments on commit a400936

Please sign in to comment.