Skip to content

Commit 5c6a892

Browse files
authored
Merge branch 'main' into bp/fix-lighthouse-issues
2 parents 9faf8d3 + 239a424 commit 5c6a892

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

frontend/src/common/consts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const walletConnectProjectId = import.meta.env.VITE_WALLET_CONNECT_ID ||
2323
export const filecoinId = filecoin.id;
2424
export const calibrationChainId = filecoinCalibration.id;
2525
export const filecoinChainRpc = filecoin.rpcUrls.default.http[0];
26-
export const calibrationChainRpc = filecoinCalibration.rpcUrls.default.http[0];
26+
// export const calibrationChainRpc = filecoinCalibration.rpcUrls.default.http[0];
27+
export const calibrationChainRpc = "https://calibration.deerane.com:27924";
2728
export const githubApi = 'https://avatars.githubusercontent.com';
2829
export const baseUrl = import.meta.env.VITE_BASE_API_URL || ''
2930
export const proposalListApi = `${baseUrl}/proposal/list`;

frontend/src/index.tsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import ReactDOM from "react-dom/client"
16-
import { type Wallet, connectorsForWallets } from "@rainbow-me/rainbowkit"
16+
import { type Wallet, getDefaultConfig } from "@rainbow-me/rainbowkit"
1717
import { metaMaskWallet } from "@rainbow-me/rainbowkit/wallets"
1818
import "@rainbow-me/rainbowkit/styles.css"
1919
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
@@ -22,7 +22,7 @@ import { WalletAdapterFilsnap, WalletAdapterLedger } from 'iso-filecoin-wallets'
2222
import TransportWebUSB from '@ledgerhq/hw-transport-webusb'
2323
import { Buffer } from 'buffer';
2424
import Eth from "@ledgerhq/hw-app-eth";
25-
import { WagmiProvider, http, createConfig, createConnector } from "wagmi"
25+
import { WagmiProvider, http, createConnector } from "wagmi"
2626
import { getProvider } from "filsnap-adapter"
2727
import { getAddress } from "viem"
2828
import { filecoin } from "wagmi/chains"
@@ -360,37 +360,42 @@ const ledger = (): Wallet => ({
360360
}
361361
})
362362

363-
const connectors = connectorsForWallets(
364-
[
363+
const testnetConfig = getDefaultConfig({
364+
appName: 'power-voting',
365+
projectId: walletConnectProjectId,
366+
chains: [filecoinCalibrationChain],
367+
transports: {
368+
[filecoinCalibrationChain.id]: http(),
369+
},
370+
wallets: [
365371
{
366-
groupName: "Recommended",
372+
groupName: 'Recommended',
367373
wallets: [
368374
metaMaskWallet,
369375
filSnap,
370376
ledger
371377
]
372-
}
378+
},
373379
],
374-
{
375-
appName: "power-voting",
376-
projectId: walletConnectProjectId,
377-
}
378-
)
380+
})
379381

380-
const config = createConfig(network === 'testnet' ?{
381-
chains: [filecoinCalibrationChain],
382-
transports: {
383-
[filecoinCalibrationChain.id]: http(),
384-
},
385-
multiInjectedProviderDiscovery: true,
386-
connectors: [...connectors],
387-
} : {
382+
const mainnetConfig = getDefaultConfig({
383+
appName: 'power-voting',
384+
projectId: walletConnectProjectId,
388385
chains: [filecoin],
389386
transports: {
390387
[filecoin.id]: http(),
391388
},
392-
multiInjectedProviderDiscovery: true,
393-
connectors: [...connectors],
389+
wallets: [
390+
{
391+
groupName: 'Recommended',
392+
wallets: [
393+
metaMaskWallet,
394+
filSnap,
395+
ledger
396+
]
397+
},
398+
],
394399
})
395400

396401
//dynamic add font
@@ -407,7 +412,7 @@ document.head.appendChild(style)
407412

408413
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
409414
<BrowserRouter>
410-
<WagmiProvider config={config}>
415+
<WagmiProvider config={network === 'testnet' ? testnetConfig : mainnetConfig}>
411416
<FilecoinProvider
412417
adapters={[filSnapAdapter, ledgerAdapter]}
413418
network={network}

frontend/src/pages/Home/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import ListFilter from "../../components/ListFilter";
4949
import Loading from "../../components/Loading";
5050
import { getBlockExplorers, isFilAddress, markdownToText } from "../../utils"
5151
dayjs.extend(utc);
52-
dayjs.extend(timezone);
52+
dayjs.extend(timezone)
5353

5454
const Home = () => {
5555
const navigate = useNavigate();
@@ -152,6 +152,10 @@ const Home = () => {
152152
* @param item
153153
*/
154154
const handleJump = (item: VotingList) => {
155+
if (!isConnected) {
156+
openConnectModal && openConnectModal();
157+
return false;
158+
}
155159
if (item.status === STORING_STATUS) {
156160
messageApi.open({
157161
type: 'warning',

0 commit comments

Comments
 (0)