Skip to content
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

Mainnet prep #439

Merged
merged 4 commits into from
Feb 4, 2025
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
28 changes: 26 additions & 2 deletions background/constants/base-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NetworkBaseAsset } from "../networks"
import { COIN_TYPES_BY_ASSET_SYMBOL } from "./coin-types"

export const QI: NetworkBaseAsset = {
chainID: "9000",
chainID: "9",
name: "Quai Network",
symbol: "Qi",
decimals: 3,
Expand All @@ -13,7 +13,7 @@ export const QI: NetworkBaseAsset = {
},
}
export const QUAI: NetworkBaseAsset = {
chainID: "9000",
chainID: "9",
name: "Quai Network",
symbol: "QUAI",
decimals: 18,
Expand All @@ -24,6 +24,29 @@ export const QUAI: NetworkBaseAsset = {
},
}

export const QI_GOLDEN_AGE: NetworkBaseAsset = {
chainID: "9000",
name: "Quai Network Golden Age",
symbol: "QI",
decimals: 3,
coinType: COIN_TYPES_BY_ASSET_SYMBOL.QI,
metadata: {
tokenLists: [],
websiteURL: "https://qu.ai/",
},
}

export const QUAI_GOLDEN_AGE: NetworkBaseAsset = {
chainID: "9000",
name: "Quai Network Golden Age",
symbol: "QUAI",
decimals: 18,
coinType: COIN_TYPES_BY_ASSET_SYMBOL.QUAI,
metadata: {
tokenLists: [],
websiteURL: "https://qu.ai/",
},
}
export const QUAI_ORCHARD: NetworkBaseAsset = {
chainID: "15000",
name: "Quai Network Orchard",
Expand Down Expand Up @@ -51,6 +74,7 @@ export const QUAI_LOCAL: NetworkBaseAsset = {
export const BASE_ASSETS_BY_CUSTOM_NAME = {
QI,
QUAI,
QUAI_GOLDEN_AGE,
QUAI_ORCHARD,
QUAI_LOCAL,
}
Expand Down
51 changes: 42 additions & 9 deletions background/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ import { NetworkInterface } from "./networks/networkTypes"
export const QUAI_SCAN_URL = "https://quaiscan.io"
export const ORCHARD_QUAI_SCAN_URL = "https://orchard.quaiscan.io"

export const HTTPS_RPC_URL = "https://goldenage.rpc.quai.network"
export const WSS_RPC_URL = "wss://goldenage.rpc.quai.network"
// Mainnet
export const HTTPS_RPC_URL = "https://rpc.quai.network"
export const WSS_RPC_URL = "wss://rpc.quai.network"

// Golden Age
export const GOLDEN_AGE_HTTPS_RPC_URL = "https://goldenage.rpc.quai.network"
export const GOLDEN_AGE_WSS_RPC_URL = "wss://goldenage.rpc.quai.network"

// Orchard
export const ORCHARD_HTTPS_RPC_URL = "https://orchard.rpc.quai.network"
export const ORCHARD_WSS_RPC_URL = "wss://orchard.rpc.quai.network"

Expand Down Expand Up @@ -45,10 +52,10 @@ export const VALID_ZONES_NAMES: Array<string> = [
"Hydra 3",
]

export const DEFAULT_QUAI_TESTNET = {
name: "Colosseum",
export const DEFAULT_QUAI_MAINNET = {
name: "Quai Network",
chainCode: 994,
chainID: 9000,
chainID: 9,
isCustom: false,
chains: [
{
Expand All @@ -60,6 +67,21 @@ export const DEFAULT_QUAI_TESTNET = {
],
} as Network

export const DEFAULT_QUAI_GOLDEN_AGE = {
name: "Golden Age",
chainCode: 994,
chainID: 9000,
isCustom: false,
chains: [
{
name: "Cyprus One",
shard: "cyprus-1",
rpc: GOLDEN_AGE_HTTPS_RPC_URL,
blockExplorerUrl: QUAI_SCAN_URL,
},
],
} as Network

export const DEFAULT_QUAI_ORCHARD = {
name: "Orchard",
chainCode: 994,
Expand Down Expand Up @@ -150,15 +172,25 @@ export const DEFAULT_QUAI_LOCAL = {
export const QUAI_NETWORK: EVMNetwork = {
name: "Quai Network",
baseAsset: QUAI,
chainID: "9",
family: "EVM",
chains: DEFAULT_QUAI_MAINNET.chains,
derivationPath: "m/44'/994'/0'/0",
isQuai: true,
}

export const QUAI_NETWORK_GOLDEN_AGE: EVMNetwork = {
name: "Golden Age Testnet",
baseAsset: QUAI,
chainID: "9000",
family: "EVM",
chains: DEFAULT_QUAI_TESTNET.chains,
chains: DEFAULT_QUAI_GOLDEN_AGE.chains,
derivationPath: "m/44'/994'/0'/0",
isQuai: true,
}

export const QUAI_NETWORK_ORCHARD: EVMNetwork = {
name: "Quai Network Orchard",
name: "Orchard Testnet",
baseAsset: QUAI,
chainID: "15000",
family: "EVM",
Expand All @@ -168,9 +200,9 @@ export const QUAI_NETWORK_ORCHARD: EVMNetwork = {
}

export const QUAI_NETWORK_LOCAL: EVMNetwork = {
name: "Quai Network Local",
name: "Local Node",
baseAsset: QUAI_LOCAL,
chainID: "17000",
chainID: "1337",
family: "EVM",
chains: DEFAULT_QUAI_LOCAL.chains,
derivationPath: "m/44'/994'/0'/0",
Expand All @@ -181,6 +213,7 @@ export const DEFAULT_TEST_NETWORKS = [QUAI_NETWORK_ORCHARD, QUAI_NETWORK_LOCAL]

export const NETWORK_BY_CHAIN_ID = {
[QUAI_NETWORK.chainID]: QUAI_NETWORK,
[QUAI_NETWORK_GOLDEN_AGE.chainID]: QUAI_NETWORK_GOLDEN_AGE,
[QUAI_NETWORK_ORCHARD.chainID]: QUAI_NETWORK_ORCHARD,
[QUAI_NETWORK_LOCAL.chainID]: QUAI_NETWORK_LOCAL,
}
Expand Down
25 changes: 23 additions & 2 deletions background/constants/networks/networks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
import { QUAI_SCAN_URL, ORCHARD_QUAI_SCAN_URL } from "../networks"
import { NetworkInterface } from "./networkTypes"

export const QuaiMainnet: NetworkInterface = {
chainID: "9",
baseAsset: { name: "Quai Network", symbol: "QUAI", decimals: 18 },
family: "EVM",
isDisabled: false,
isTestNetwork: false,
isLocalNode: false,
jsonRpcUrls: ["https://rpc.quai.network"],
webSocketRpcUrls: ["wss://rpc.quai.network"],
blockExplorerURL: QUAI_SCAN_URL,
chains: [
{
name: "Cyprus One",
shard: "cyprus-1",
blockExplorerUrl: QUAI_SCAN_URL,
multicall: "",
},
],
}

export const QuaiGoldenAgeTestnet: NetworkInterface = {
chainID: "9000",
baseAsset: { name: "Quai Network", symbol: "QUAI", decimals: 18 },
baseAsset: { name: "Golden Age Testnet", symbol: "QUAI", decimals: 18 },
family: "EVM",
isDisabled: false,
isTestNetwork: false,
Expand All @@ -23,7 +43,7 @@ export const QuaiGoldenAgeTestnet: NetworkInterface = {

export const QuaiOrchardTestnet: NetworkInterface = {
chainID: "15000",
baseAsset: { name: "Quai Network Orchard", symbol: "QUAI", decimals: 18 },
baseAsset: { name: "Orchard Testnet", symbol: "QUAI", decimals: 18 },
family: "EVM",
isDisabled: false,
isTestNetwork: true,
Expand Down Expand Up @@ -112,6 +132,7 @@ export const QuaiLocalNodeNetwork: NetworkInterface = {
export const DEFAULT_PELAGUS_NETWORK = QuaiGoldenAgeTestnet

export const PELAGUS_NETWORKS = [
QuaiMainnet,
QuaiGoldenAgeTestnet,
QuaiOrchardTestnet,
QuaiLocalNodeNetwork,
Expand Down
2 changes: 1 addition & 1 deletion background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"emittery": "^0.9.2",
"ethers": "^6.13.4",
"lodash": "^4.17.21",
"quais": "^1.0.0-alpha.35",
"quais": "^1.0.0-alpha.36",
"sinon": "^14.0.0",
"siwe": "^1.1.0",
"util": "^0.12.4",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"webpack": "^5.58.1",
"webpack-cli": "4.5.0",
"webpack-livereload-plugin": "^3.0.1",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.8.0",
"yarn-audit-fix": "^10.1.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ const QiAccountOptionMenu = ({ paymentCode }: { paymentCode: string }) => {
}

useEffect(() => {
if (currentSelectedAccount.network.chainID === "9000") {
// Only show copy option for mainnet and Golden Age
if (
currentSelectedAccount.network.chainID === "9" ||
currentSelectedAccount.network.chainID === "9000"
) {
setOptions([
{
key: "copy",
Expand Down
9 changes: 7 additions & 2 deletions ui/components/Wallet/WalletAccountBalanceControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ function ActionButtons(props: ActionButtonsProps): ReactElement {
size={55}
iconWidth="12"
iconHeight="18"
disabled={currentSelectedAccount.network.chainID === "9000"}
disabled={
currentSelectedAccount.network.chainID === "9" ||
currentSelectedAccount.network.chainID === "9000"
}
>
{t("send")}
</SharedCircleButton>
Expand All @@ -82,7 +85,9 @@ function ActionButtons(props: ActionButtonsProps): ReactElement {
iconWidth="20"
iconHeight="18"
disabled={
!isQiWalletInit || currentSelectedAccount.network.chainID === "9000"
!isQiWalletInit ||
currentSelectedAccount.network.chainID === "9" ||
currentSelectedAccount.network.chainID === "9000"
}
>
{t("swap")}
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"history": "^4.9.0",
"i18next": "^21.8.10",
"lodash": "^4.17.21",
"quais": "^1.0.0-alpha.35",
"quais": "^1.0.0-alpha.36",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-error-boundary": "^3.1.4",
Expand Down
Binary file added ui/public/images/networks/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/public/images/networks/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui/public/images/networks/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui/public/images/networks/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ui/public/images/networks/[email protected]
Binary file not shown.
29 changes: 19 additions & 10 deletions ui/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import {
QUAI_NETWORK_ORCHARD,
QUAI_NETWORK_LOCAL,
QUAI_NETWORK_GOLDEN_AGE,
QUAI_NETWORK,
} from "@pelagus/pelagus-background/constants"
import { NetworkFeeTypeChosen } from "@pelagus/pelagus-background/redux-slices/transaction-construction"
import { QuaiGoldenAgeTestnet } from "@pelagus/pelagus-background/constants/networks/networks"
import { i18n } from "../_locales/i18n"

export const blockExplorer = {
[QuaiGoldenAgeTestnet.chainID]: {
title: "Quai Blockscout",
url: QuaiGoldenAgeTestnet?.chains
? QuaiGoldenAgeTestnet.chains[0].blockExplorerUrl
: "",
[QUAI_NETWORK.chainID]: {
title: "Quaiscan",
url:
QUAI_NETWORK.chains !== undefined
? QUAI_NETWORK.chains[0].blockExplorerUrl
: "",
},
[QUAI_NETWORK_GOLDEN_AGE.chainID]: {
title: "Quaiscan",
url:
QUAI_NETWORK_GOLDEN_AGE.chains !== undefined
? QUAI_NETWORK_GOLDEN_AGE.chains[0].blockExplorerUrl
: "",
},
[QUAI_NETWORK_ORCHARD.chainID]: {
title: "Orchard Quai Blockscout",
title: "Quaiscan Orchard",
url:
QUAI_NETWORK_ORCHARD.chains != undefined
QUAI_NETWORK_ORCHARD.chains !== undefined
? QUAI_NETWORK_ORCHARD.chains[0].blockExplorerUrl
: "",
},
[QUAI_NETWORK_LOCAL.chainID]: {
title: "Quai Blockscout",
title: "Quaiscan",
url:
QUAI_NETWORK_LOCAL.chains != undefined
QUAI_NETWORK_LOCAL.chains !== undefined
? QUAI_NETWORK_LOCAL.chains[0].blockExplorerUrl
: "", // Do we want this to be colosseum explorer?
},
Expand Down
17 changes: 12 additions & 5 deletions ui/utils/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ export const getBlockExplorerURL = (
network: NetworkInterface,
address: string
): string | undefined => {
return PELAGUS_NETWORKS.find((net) => net.chainID === network.chainID)
? isQuaiHandle(network)
? CurrentShardToExplorer(network, address)
: blockExplorer[network.chainID].url
: network.blockExplorerURL
const matchingNetwork = PELAGUS_NETWORKS.find(
(net) => net.chainID === network.chainID
)
if (!matchingNetwork) {
return network.blockExplorerURL
}

if (isQuaiHandle(network)) {
return CurrentShardToExplorer(network, address)
}

return blockExplorer[network.chainID].url
}
Loading