Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:

- name: Build
run: yarn run build
env:
CI: false

# TO-DO: Uncomment when tests are ready to be run on CI (such as those in issues #129-#131)
# - name: Test
Expand Down
4 changes: 2 additions & 2 deletions e2e/etherlink-postdeploy-banner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test"

test("shows post-deploy banner with explorer link", async ({ page }) => {
const tx = `0x${"a".repeat(64)}`
await page.goto(`/explorer/daos?postDeploy=dao-created&network=etherlink_testnet&tx=${tx}`)
await page.goto(`/explorer/daos?postDeploy=dao-created&network=etherlink_shadownet&tx=${tx}`)

await page.waitForLoadState("domcontentloaded")

Expand All @@ -14,7 +14,7 @@ test("shows post-deploy banner with explorer link", async ({ page }) => {
await expect(viewTx).toBeVisible()

const href = await viewTx.getAttribute("href")
expect(href).toContain("https://testnet.explorer.etherlink.com")
expect(href).toContain("https://shadownet.explorer.etherlink.com")
expect(href).toContain("/tx/")
})

8 changes: 4 additions & 4 deletions e2e/etherlink.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "@playwright/test"

test("shows v4 daos on switching to etherlink testnet", async ({ page }) => {
test("shows v4 daos on switching to etherlink shadownet", async ({ page }) => {
await page.goto(`/explorer/daos`)

await page.waitForLoadState("domcontentloaded")
Expand All @@ -13,10 +13,10 @@ test("shows v4 daos on switching to etherlink testnet", async ({ page }) => {
console.log("Modal Title", modalTitleText)
await expect(modalTitleText).toContain("Choose Network")

const etherlinkTestnet = await modalTitle.locator("text=Etherlink Testnet")
await expect(etherlinkTestnet).toBeVisible()
const etherlinkShadownet = await modalTitle.locator("text=Etherlink Shadownet")
await expect(etherlinkShadownet).toBeVisible()

await etherlinkTestnet.click()
await etherlinkShadownet.click()

await page.waitForTimeout(10000)
await page.reload()
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/etherlink/batchActions.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useEvmProposalOps } from "services/contracts/etherlinkDAO/hooks/useEvmP
import { EtherlinkContext } from "services/wagmi/context"

jest.mock("services/beacon/hooks/useTezos", () => ({
useTezos: () => ({ etherlink: {}, network: "etherlink_testnet" })
useTezos: () => ({ etherlink: {}, network: "etherlink_shadownet" })
}))

jest.mock("services/wagmi/etherlink/hooks/useProposalUiOverride", () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/etherlink/transferAssets.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ethers } from "ethers"

// Mock hooks that require wallet/providers
jest.mock("services/beacon/hooks/useTezos", () => ({
useTezos: () => ({ etherlink: {}, network: "etherlink_testnet" })
useTezos: () => ({ etherlink: {}, network: "etherlink_shadownet" })
}))

jest.mock("services/wagmi/etherlink/hooks/useProposalUiOverride", () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/modules/etherlink/bridge/components/TxStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TxStatus = ({
<Typography variant="caption">
{label}:{" "}
<Link
href={`https://testnet.explorer.etherlink.com/tx/${hash}`}
href={`https://shadownet.explorer.etherlink.com/tx/${hash}`}
target="_blank"
rel="noopener noreferrer"
style={{ color: "#4FC3F7" }}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/etherlink/creator/EvmDaoVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export const EvmDaoVoting: React.FC<EvmDaoVotingProps> = ({ onSubmit: _onSubmit
const defaultsAppliedRef = React.useRef(false)

React.useEffect(() => {
const isEtherlinkTestnet = network === "etherlink_testnet"
const isEtherlinkShadownet = network === "etherlink_shadownet"
const isEtherlinkMainnet = network === "etherlink_mainnet"

if (!(isEtherlinkTestnet || isEtherlinkMainnet)) return
if (!(isEtherlinkShadownet || isEtherlinkMainnet)) return
if (defaultsAppliedRef.current) return

const delayDays = Number(daoData.voting.votingBlocksDay) || 0
Expand Down
4 changes: 2 additions & 2 deletions src/modules/etherlink/creator/votingDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export interface VotingDefaults {

/**
* Get network-specific voting defaults based on the Etherlink network.
* @param network - The network identifier ("etherlink_testnet" | "etherlink_mainnet")
* @param network - The network identifier ("etherlink_shadownet" | "etherlink_mainnet")
* @returns VotingDefaults object or undefined for unrecognized networks
*/
export function getVotingDefaults(network: string): VotingDefaults | undefined {
switch (network) {
case "etherlink_testnet":
case "etherlink_shadownet":
return {
voting: {
// Voting Delay: 1 minute
Expand Down
2 changes: 1 addition & 1 deletion src/modules/etherlink/explorer/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const EtherlinkDAOProvider: React.FC<{ daoId: string }> = ({ daoId, children })
// If not found and we have a list, try alternate network once.
if (daos.length > 0 && !isLoadingDaos && !attemptedSwitchRef.current) {
attemptedSwitchRef.current = true
const alt = network === "etherlink_testnet" ? "etherlink_mainnet" : "etherlink_testnet"
const alt = network === "etherlink_shadownet" ? "etherlink_mainnet" : "etherlink_shadownet"
switchToNetwork?.(alt)
}
}, [daoId, daos, isLoadingDaos, network, selectDao, switchToNetwork, daoSelected?.id])
Expand Down
16 changes: 8 additions & 8 deletions src/modules/etherlink/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { proposalInterfaces } from "./config"
import { IContractWriteMethod, IProposalType } from "./types"

export const networkConfig = {
etherlink_testnet: {
network: "testnet",
explorerUrl: "https://testnet.explorer.etherlink.com",
explorerApiUrl: "https://testnet.explorer.etherlink.com/api/v2",
firebaseRootCollection: "idaosEtherlink-Testnet",
firebaseRootTokenCollection: "tokensEtherlink-Testnet",
firebaseMemberCollection: "iMembersEtherlink-Testnet"
etherlink_shadownet: {
network: "shadownet",
explorerUrl: "https://shadownet.explorer.etherlink.com",
explorerApiUrl: "https://shadownet.explorer.etherlink.com/api/v2",
firebaseRootCollection: "idaosEtherlink-Shadownet",
firebaseRootTokenCollection: "tokensEtherlink-Shadownet",
firebaseMemberCollection: "iMembersEtherlink-Shadownet"
},
etherlink_mainnet: {
network: "mainnet",
Expand All @@ -22,7 +22,7 @@ export const networkConfig = {
}

export function getFirestoreNetworkName(internalNetwork: string): string {
if (internalNetwork === "etherlink_testnet") return "Etherlink-Testnet"
if (internalNetwork === "etherlink_shadownet") return "Etherlink-Shadownet"
if (internalNetwork === "etherlink_mainnet") return "Etherlink"
if (internalNetwork === "localhost") return "Localhost"
return internalNetwork
Expand Down
6 changes: 3 additions & 3 deletions src/services/beacon/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { MichelCodecPacker, TezosToolkit } from "@taquito/taquito"
import { Tzip16Module } from "@taquito/tzip16"
import { EnvKey, getEnv } from "services/config"

export type Network = "mainnet" | "ghostnet" | "etherlink_testnet" | "etherlink_mainnet"
export type Network = "mainnet" | "ghostnet" | "etherlink_shadownet" | "etherlink_mainnet"

export const rpcNodes: Record<Network, string> = {
mainnet: getEnv(EnvKey.REACT_APP_RPC_NETWORK_MAINNET) || "https://mainnet.api.tez.ie",
ghostnet: getEnv(EnvKey.REACT_APP_RPC_NETWORK_GHOSTNET) || "https://ghostnet.smartpy.io",
etherlink_testnet: "https://node.ghostnet.etherlink.com",
etherlink_shadownet: "https://node.shadownet.etherlink.com",
etherlink_mainnet: "https://node.mainnet.etherlink.com"
}

export const networkDotColorMap: Record<Network, string> = {
mainnet: "#9EEE5D",
ghostnet: "#291F79",
etherlink_mainnet: "#9EEE5D",
etherlink_testnet: "#291F79"
etherlink_shadownet: "#291F79"
}

// Infer the initial network from URL when no user selection exists yet
Expand Down
34 changes: 29 additions & 5 deletions src/services/wagmi/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
import { createConfig, http } from "wagmi"
import { etherlink, etherlinkTestnet, hardhat } from "wagmi/chains"
import { etherlink, hardhat } from "wagmi/chains"
import { defineChain } from "viem"
import { metaMask, injected, safe } from "wagmi/connectors"

import { DeployContract } from "./token"
import { getDefaultConfig } from "connectkit"

// Custom chain definition for Etherlink Shadownet
export const etherlinkShadownet = defineChain({
id: 127823,
name: "Etherlink Shadownet",
nativeCurrency: {
decimals: 18,
name: "XTZ",
symbol: "XTZ"
},
rpcUrls: {
default: {
http: ["https://node.shadownet.etherlink.com"]
}
},
blockExplorers: {
default: {
name: "Etherlink Shadownet Explorer",
url: "https://shadownet.explorer.etherlink.com"
}
},
testnet: true
})

// Keep Etherlink chains plus local hardhat for dev parity with the last known-good commit
const wagmiChains = [etherlink, etherlinkTestnet, hardhat] as const
const wagmiChains = [etherlink, etherlinkShadownet, hardhat] as const

// Allow overriding Etherlink Testnet RPC via env (optional)
const etherlinkTestnetRpc = process.env.REACT_APP_RPC_ETHERLINK_TESTNET?.trim()
// Allow overriding Etherlink Shadownet RPC via env (optional)
const etherlinkShadownetRpc = process.env.REACT_APP_RPC_ETHERLINK_SHADOWNET?.trim()

// WalletConnect Cloud project ID for ConnectKit default config
const projectId = "7dd66fecc485693b67e6921c580e7040"
Expand All @@ -19,7 +43,7 @@ export const config = createConfig(
chains: wagmiChains,
transports: {
[etherlink.id]: http(),
[etherlinkTestnet.id]: etherlinkTestnetRpc ? http(etherlinkTestnetRpc) : http()
[etherlinkShadownet.id]: etherlinkShadownetRpc ? http(etherlinkShadownetRpc) : http()
},
walletConnectProjectId: projectId,
appName: "Homebase",
Expand Down
14 changes: 7 additions & 7 deletions src/services/wagmi/context.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState, createContext, ReactNode, useMemo, useEffect, useCallback, useRef } from "react"
import { useSwitchChain, useAccount as useWagmiAccount } from "wagmi"
import { disconnect as disconnectEtherlink } from "@wagmi/core"
import { config as wagmiConfig } from "services/wagmi/config"
import { etherlink, etherlinkTestnet } from "wagmi/chains"
import { config as wagmiConfig, etherlinkShadownet } from "services/wagmi/config"
import { etherlink } from "wagmi/chains"
import { useModal } from "connectkit"
import { useEthersProvider, useEthersSigner } from "./ethers"
import { useNetwork } from "services/useNetwork"
Expand Down Expand Up @@ -43,11 +43,11 @@ export const EtherlinkProvider: React.FC<{ children: ReactNode }> = ({ children
if (chain?.id === etherlink.id || chain?.name === "Etherlink") {
return "etherlink_mainnet"
}
if (chain?.id === etherlinkTestnet.id || chain?.name === "Etherlink Testnet") {
return "etherlink_testnet"
if (chain?.id === etherlinkShadownet.id || chain?.name === "Etherlink Shadownet") {
return "etherlink_shadownet"
}
// Default to testnet when no explicit app selection or wallet chain
return "etherlink_testnet"
// Default to shadownet when no explicit app selection or wallet chain
return "etherlink_shadownet"
}, [chain?.id, chain?.name, contextNetwork])

// Bind provider/signer to the wallet's active chain to avoid
Expand All @@ -57,7 +57,7 @@ export const EtherlinkProvider: React.FC<{ children: ReactNode }> = ({ children

const switchToNetwork = useCallback(
(network: string) => {
const networkId = network === "etherlink_mainnet" ? etherlink.id : etherlinkTestnet.id
const networkId = network === "etherlink_mainnet" ? etherlink.id : etherlinkShadownet.id
// Switch wallet chain
switchChain({ chainId: networkId })

Expand Down
8 changes: 4 additions & 4 deletions src/services/wagmi/web3provider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactNode, useMemo } from "react"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { WagmiProvider } from "wagmi"
import { config } from "./config"
import { config, etherlinkShadownet } from "./config"
import { ConnectKitProvider } from "connectkit"
import { etherlink, etherlinkTestnet } from "wagmi/chains"
import { etherlink } from "wagmi/chains"
import { useNetwork } from "services/useNetwork"

const queryClient = new QueryClient()
Expand All @@ -12,9 +12,9 @@ export const Web3Provider = ({ children }: { children: ReactNode }) => {
const { network: currentNetwork } = useNetwork()
const ethInitialChainId = useMemo(() => {
const network = currentNetwork || "etherlink_mainnet"
if (!network?.startsWith("etherlink")) return etherlinkTestnet.id
if (!network?.startsWith("etherlink")) return etherlinkShadownet.id
if (network?.includes("mainnet")) return etherlink.id
return etherlinkTestnet.id
return etherlinkShadownet.id
}, [currentNetwork])
const connectkitOptions = useMemo(() => ({ initialChainId: ethInitialChainId }), [ethInitialChainId])

Expand Down
Loading