Skip to content

Commit

Permalink
APT-1653: ZQ2 protomainnet connected #738
Browse files Browse the repository at this point in the history
* zq2 protomainnet connected

* staging set to protomainnet

---------

Co-authored-by: Lukasz Kosiak <[email protected]>
  • Loading branch information
lukozill and uHappyLogic authored Jan 22, 2025
1 parent 2f8f7c8 commit 966768d
Show file tree
Hide file tree
Showing 31 changed files with 457 additions and 405 deletions.
1 change: 0 additions & 1 deletion products/zillion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
]
}
},
blockchain_explorer_config: "viewblock",
refresh_rate_config: 3000,
api_max_retry_attempt: 10,
environment_config: "dev"
Expand Down
10 changes: 9 additions & 1 deletion products/zillion/cd/base/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ data:
"https://staking-zil.kucoin.com/api",
]
},
zq2_protomainnet: {
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zq2-protomainnet.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://api.zq2-protomainnet.zilliqa.com",
]
},
isolated_server: {
proxy: "0x0578B8e9D9c2493D4a2E98f364c7ed311F7a0d71",
impl: "",
Expand All @@ -39,7 +48,6 @@ data:
]
}
},
blockchain_explorer_config: "viewblock",
refresh_rate_config: 10000,
api_max_retry_attempt: 10,
environment_config: "stage"
Expand Down
10 changes: 9 additions & 1 deletion products/zillion/cd/overlays/production/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ patches:
"https://staking-zil.kucoin.com/api",
]
},
zq2_protomainnet: {
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zq2-protomainnet.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://api.zq2-protomainnet.zilliqa.com",
]
},
isolated_server: {
proxy: "0x0578B8e9D9c2493D4a2E98f364c7ed311F7a0d71",
impl: "",
Expand All @@ -68,7 +77,6 @@ patches:
]
}
},
blockchain_explorer_config: "viewblock",
refresh_rate_config: 300000,
api_max_retry_attempt: 10,
environment_config: "prod"
Expand Down
58 changes: 58 additions & 0 deletions products/zillion/cd/overlays/staging/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,62 @@ patches:
kubernetes.io/ingress.global-static-ip-name: zillion-zilstg-dev
networking.gke.io/managed-certificates: zillion
- target:
kind: ConfigMap
name: zillion-config
patch: |-
- op: replace
path: "/data/config.js"
value: |
window['config'] = {
networks_config: {
testnet: {
proxy: "",
impl: "",
blockchain: "https://dev-api.zilliqa.com",
node_status: "https://testnet-viewer.zilliqa.com",
api_list: [
"https://bumblebee-api.zilliqa.network",
"https://dev-api.zilliqa.com",
]
},
mainnet: {
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://api.zilliqa.com",
"https://ssn-zilliqa.cex.io/api",
"https://ssn.ignitedao.io/api",
"https://ssn.zillet.io",
"https://zil-staking.ezil.me/api",
"https://staking-zil.kucoin.com/api",
]
},
zq2_protomainnet: {
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zq2-protomainnet.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://api.zq2-protomainnet.zilliqa.com",
]
},
isolated_server: {
proxy: "0x0578B8e9D9c2493D4a2E98f364c7ed311F7a0d71",
impl: "",
blockchain: "https://zilliqa-isolated-server.zilliqa.com",
node_status: "",
api_list : [
"https://zilliqa-isolated-server.zilliqa.com"
]
}
},
refresh_rate_config: 300000,
api_max_retry_attempt: 10,
environment_config: "stage_zq2_protomainnet"
}
namespace: zillion-stg
24 changes: 14 additions & 10 deletions products/zillion/public/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/* config file
*
* blockchain_explorer_config: [viewblock (default) | devex]
* - domain link to blockchain explorer
*
* node_status
* - link to staking viewer
Expand Down Expand Up @@ -45,18 +42,26 @@ window['config'] = {
]
},
mainnet: {
proxy: "",
impl: "",
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://ssn.zillacracy.com/api",
"https://api.zilliqa.com",
"https://ssn-zilliqa.cex.io/api",
// "https://ssn.ignitedao.io/api",
"https://ssn.zillet.io",
"https://zil-staking.ezil.me/api",
"https://staking-zil.kucoin.com/api",
"https://stakingseed-api.seed.zilliqa.com",
"https://api.zilliqa.com",
]
},
zq2_protomainnet: {
proxy: "0x62A9d5D611CDCaE8D78005F31635898330e06B93",
impl: "0xa7C67D49C82c7dc1B73D231640B2e4d0661D37c1",
blockchain: "https://api.zq2-protomainnet.zilliqa.com",
node_status: "https://staking-viewer.zilliqa.com",
api_list : [
"https://api.zq2-protomainnet.zilliqa.com",
]
},
isolated_server: {
Expand All @@ -69,8 +74,7 @@ window['config'] = {
]
}
},
blockchain_explorer_config: "viewblock",
refresh_rate_config: 300000,
api_max_retry_attempt: 10,
environment_config: "stage"
environment_config: "stage_zq2_protomainnet"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import ModalPending from '../contract-calls-modal/modal-pending';
import ModalSent from '../contract-calls-modal/modal-sent';
import { useAppSelector } from '../../store/hooks';
import { ZilSigner } from '../../zilliqa-signer';
import { units } from '@zilliqa-js/zilliqa';
import BigNumber from 'bignumber.js';
import GasSettings from './gas-settings';

import { BN } from '@zilliqa-js/util';
import { BN, units } from '@zilliqa-js/util';

function CompleteWithdrawModal(props: any) {
const proxy = useAppSelector(state => state.blockchain.proxy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ import { useAppSelector } from '../../store/hooks';
import { SwapDelegModalData } from '../../util/interface';
import { ZilSigner } from '../../zilliqa-signer';
import { ZilSdk } from '../../zilliqa-api';
import { units } from '@zilliqa-js/zilliqa';
import BigNumber from 'bignumber.js';
import GasSettings from './gas-settings';
import { BN, validation } from '@zilliqa-js/util';
import { BN, validation, units } from '@zilliqa-js/util';


function SwapDelegModal(props: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import ModalPending from '../contract-calls-modal/modal-pending';
import ModalSent from '../contract-calls-modal/modal-sent';
import { useAppSelector } from '../../store/hooks';
import { ZilSigner } from '../../zilliqa-signer';
import { units } from '@zilliqa-js/zilliqa';
import BigNumber from 'bignumber.js';
import GasSettings from './gas-settings';
import { logger } from '../../util/logger';

import { BN } from '@zilliqa-js/util';
import { BN, units } from '@zilliqa-js/util';

function UpdateCommRateModal(props: any) {
const proxy = useAppSelector(state => state.blockchain.proxy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import ModalPending from '../contract-calls-modal/modal-pending';
import ModalSent from '../contract-calls-modal/modal-sent';
import { useAppSelector } from '../../store/hooks';
import { ZilSigner } from '../../zilliqa-signer';
import { units } from '@zilliqa-js/zilliqa';
import BigNumber from 'bignumber.js';
import GasSettings from './gas-settings';

import { BN } from '@zilliqa-js/util';
import { BN, units } from '@zilliqa-js/util';


function UpdateReceiverAddress(props: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import ModalPending from '../contract-calls-modal/modal-pending';
import ModalSent from '../contract-calls-modal/modal-sent';
import { useAppSelector } from '../../store/hooks';
import { ZilSigner } from '../../zilliqa-signer';
import { units } from '@zilliqa-js/zilliqa';
import BigNumber from 'bignumber.js';
import GasSettings from './gas-settings';
import { BN } from '@zilliqa-js/util';
import { BN, units } from '@zilliqa-js/util';

function WithdrawCommModal(props: any) {
const proxy = useAppSelector(state => state.blockchain.proxy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function WithdrawStakeModal(props: any) {
// check if deleg has unwithdrawn rewards or buffered deposits for this ssn address
const hasRewards = await hasRewardToWithdraw();
if (hasRewards) {
Alert('info', "Withdraw rewards first", "Withdraw your rewards before withdrawing your staked amount.");
setIsPending('');
return null;
}
Expand Down
44 changes: 14 additions & 30 deletions products/zillion/src/components/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { ToastContainer, toast } from 'react-toastify';
import ReactTooltip from 'react-tooltip';

import { Role, NetworkURL, Network as NetworkLabel, AccountType, Environment, Constants, TransactionType, ButtonText, ContractState, OperationStatus } from '../util/enum';
import { Role, NetworkURL, Network, AccountType, Environment, Constants, TransactionType, ButtonText, ContractState, OperationStatus } from '../util/enum';
import { convertQaToCommaStr, getAddressLink } from '../util/utils';
import StakingPortfolio from './staking-portfolio';
import SsnTable from './ssn-table';
Expand Down Expand Up @@ -49,10 +49,11 @@ import WarningDashboardBanner from './warning-dashboard-banner';
import { POLL_USER_DATA_STOP, QUERY_AND_UPDATE_USER_STATS, RESET_USER_STATE, UPDATE_ADDRESS } from '../store/userSlice';
import { useAppDispatch, useAppSelector } from '../store/hooks';
import { logger } from '../util/logger';
import { getEnvironment, getNetworks, NetworkConfig, Networks } from '../util/config-json-helper';
import { getEnvironment, getNetworks, NetworkConfig, Networks, tryGetNetworkLabelByApiUrl } from '../util/config-json-helper';
import { RESET_BLOCKCHAIN_STATE, UPDATE_CHAIN_INFO } from '../store/blockchainSlice';
import { ZilSigner } from '../zilliqa-signer';
import { QUERY_AND_UPDATE_STAKING_STATS } from '../store/stakingSlice';
import { networkStringToNetwork } from '../util/config-helper';


function Dashboard(props: any) {
Expand Down Expand Up @@ -146,32 +147,12 @@ function Dashboard(props: any) {

// for zilpay to toggle different network
const networkChanger = (net: string) => {
let label;

switch (net) {
case NetworkLabel.MAINNET:
// do nothing
Alert("info", "Info", "You are on Mainnet.");
label = NetworkLabel.MAINNET;
break;
case NetworkLabel.TESTNET:
label = NetworkLabel.TESTNET;
if (env === Environment.PROD) {
// warn users not to switch to testnet on production
Alert("warn", "Testnet not supported", "Please switch to Mainnet via ZilPay.");
}
break;
case NetworkLabel.ISOLATED_SERVER:
case NetworkLabel.PRIVATE:
label = NetworkLabel.ISOLATED_SERVER;
if (env === Environment.PROD) {
// warn users not to switch to testnet on production
Alert("warn", "Private network not supported", "Please switch to Mainnet via ZilPay.");
}
break;
default:
label = NetworkLabel.TESTNET;
break;
const label = networkStringToNetwork(net);

if (label === Network.MAINNET) {
Alert("info", "Info", "You are on Mainnet.");
} else if (env === Environment.PROD) {
Alert("warn", "Warning", "Currently connected network is not supported. Please switch to Mainnet via ZilPay.");
}

const networkConfig: NetworkConfig = networks[label];
Expand All @@ -191,9 +172,12 @@ function Dashboard(props: any) {
if (userState.account_type === AccountType.ZILPAY) {
const zilPay = (window as any).zilPay;

console.log({ zilpay_data: zilPay.wallet });

if (zilPay) {
// switch to the zilpay network on load
networkChanger(zilPay.wallet.net);
networkChanger(
tryGetNetworkLabelByApiUrl(zilPay.wallet.http) || zilPay.wallet.net
);

const accountStreamChanged = zilPay.wallet.observableAccount().subscribe((account: any) => {
console.log("zil pay account changing...");
Expand Down
33 changes: 16 additions & 17 deletions products/zillion/src/components/explorer.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { trackPromise } from 'react-promise-tracker';
import DisclaimerModal from './disclaimer';
import Footer from './footer';

import { Environment, Network, PromiseArea, ContractState, OperationStatus } from '../util/enum';
import { DelegStats, DelegStakingPortfolioStats, initialDelegStats, PendingWithdrawStats } from '../util/interface';
import { ContractState, OperationStatus, PromiseArea } from '../util/enum';
import { DelegStakingPortfolioStats, DelegStats, initialDelegStats, PendingWithdrawStats } from '../util/interface';

import { fromBech32Address, toBech32Address } from '@zilliqa-js/crypto';
import { validation } from "@zilliqa-js/util";
import { computeDelegRewards } from '../util/reward-calculator';
import useDarkMode from '../util/use-dark-mode';
import { convertQaToCommaStr, isRespOk } from '../util/utils';
import Spinner from './spinner';
import useDarkMode from '../util/use-dark-mode';

import ZillionLogo from '../static/zillion.svg';
import { BigNumber } from 'bignumber.js';
import ZillionLightLogo from '../static/light/zillion.svg';
import IconSun from './icons/sun';
import ZillionLogo from '../static/zillion.svg';
import { useAppSelector } from '../store/hooks';
import { getDefaultNetworkForCurrentEnv } from '../util/config-helper';
import { ZilSdk } from '../zilliqa-api';
import ExplorerPendingWithdrawalTable from './explorer-pending-withdrawal-table';
import ExplorerStakingPortfolio from './explorer-staking-portfolio';
import IconMoon from './icons/moon';
import IconSearch from './icons/search';
import ExplorerStakingPortfolio from './explorer-staking-portfolio';
import WarningBanner from './warning-banner';
import ExplorerPendingWithdrawalTable from './explorer-pending-withdrawal-table';
import IconSun from './icons/sun';
import RewardCountdownTable from './reward-countdown-table';
import { getEnvironment } from '../util/config-json-helper';
import { useAppSelector } from '../store/hooks';
import { ZilSdk } from '../zilliqa-api';
import { BigNumber } from 'bignumber.js';
import WarningBanner from './warning-banner';

function Explorer(props: any) {
const address = props.match.params.address; // bech32 wallet address;
Expand All @@ -39,8 +39,8 @@ function Explorer(props: any) {

// config.js from public folder
const impl = useAppSelector(state => state.blockchain.impl);
const env = getEnvironment();
const network = env === Environment.PROD ? Network.MAINNET : Network.TESTNET;

const network = getDefaultNetworkForCurrentEnv();

const mountedRef = useRef(true);

Expand Down Expand Up @@ -268,8 +268,7 @@ function Explorer(props: any) {
</div>

{
( env === Environment.STAGE || env === Environment.PROD ) &&
<span className="mr-2">{network}</span>
network && <span className="mr-2">{network}</span>
}

</div>
Expand Down
Loading

0 comments on commit 966768d

Please sign in to comment.