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

update explorer to add mainnet endpoint, inflation params, ... #79

Merged
merged 1 commit into from
Jul 23, 2024
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
3 changes: 0 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
GOLDBERG_URL=
GOLDBERG_LC=

TURING_URL=
TURING_LC=

Expand Down
3 changes: 0 additions & 3 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# docker run ... --env-file .env ...
WS_URL=ws://localhost:9944
POLKADOT_UI_SAMPLE=42
GOLDBERG_URL=
GOLDBERG_LC=

TURING_URL=
TURING_LC=

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ jobs:
tags: availj/explorer:${{ steps.prepare.outputs.tag_name }}
build-args: |
TURING_URL=wss://turing-rpc.avail.so/ws
GOLDBERG_URL=wss://goldberg-testnet-rpc.avail.tools/ws
MAINNET_URL=wss://mainnet-rpc.avail.so/ws
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get install --no-install-recommends -y nodejs && \
rm -rf /var/lib/apt/lists/*

ARG TURING_URL
ARG GOLDBERG_URL
ARG MAINNET_URL
RUN npm install yarn -g

WORKDIR /apps
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"test:skipped": "echo 'tests skipped'"
},
"dependencies": {
"avail-js-sdk": "^0.2.12",
"avail-js-sdk": "^0.2.13",
"axios": "^1.4.0",
"dotenv": "^16.3.1",
"patch-package": "^8.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/apps-config/src/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ export const CERE_NETWORK_GENESIS = '0x81443836a9a24caaa23f1241897d1235717535711

export const CERE_NETWORK_TESTNET_GENESIS = '0x42b9b44b4950b6c1edae543a7696caf8d0a160e9bc0424ab4ab217f7a8ba30dc';

export const AVAIL_NETWORK_GENESIS = '0x'; // TODO-mainnet
export const AVAIL_NETWORK_GENESIS = '0xb91746b45e0346cc2f815a520b9c6cb4d5c0902af848db0a80f85932d2e8276a';

export const TURING_NETWORK_TESTNET_GENESIS = '0xd3d2f3a3495dc597434a99d7d449ebad6616db45e4e4f178f31cc6fa14378b70';

export const GOLDBERG_NETWORK_TESTNET_GENESIS = '0x6f09966420b2608d1947ccfb0f2a362450d1fc7fd902c29b67c906eaa965a7ae';

export const VARA_NETWORK_GENESIS = '0xfe1b4c55fd4d668101126434206571a7838a8b6b93a6d1b95d607e78e6c53763';

export const VARA_NETWORK_TESTNET_GENESIS = '0x525639f713f397dcf839bd022cd821f367ebcf179de7b9253531f8adbe5436d6';
3 changes: 1 addition & 2 deletions packages/apps-config/src/api/params/inflation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { ApiPromise } from '@polkadot/api';

import { AVAIL_NETWORK_GENESIS, CERE_NETWORK_GENESIS, CERE_NETWORK_TESTNET_GENESIS, DOCK_POS_TESTNET_GENESIS, GOLDBERG_NETWORK_TESTNET_GENESIS, KUSAMA_GENESIS, NEATCOIN_GENESIS, NFTMART_GENESIS, POLKADOT_GENESIS, TURING_NETWORK_TESTNET_GENESIS, VARA_NETWORK_GENESIS, VARA_NETWORK_TESTNET_GENESIS } from '../constants.js';
import { AVAIL_NETWORK_GENESIS, CERE_NETWORK_GENESIS, CERE_NETWORK_TESTNET_GENESIS, DOCK_POS_TESTNET_GENESIS, KUSAMA_GENESIS, NEATCOIN_GENESIS, NFTMART_GENESIS, POLKADOT_GENESIS, TURING_NETWORK_TESTNET_GENESIS, VARA_NETWORK_GENESIS, VARA_NETWORK_TESTNET_GENESIS } from '../constants.js';

interface InflationParams {
auctionAdjust: number;
Expand Down Expand Up @@ -37,7 +37,6 @@ const KNOWN_PARAMS: Record<string, InflationParams> = {
[CERE_NETWORK_GENESIS]: CERE_NETWORK_INFLATION_PARAMS,
[CERE_NETWORK_TESTNET_GENESIS]: CERE_NETWORK_INFLATION_PARAMS,
[DOCK_POS_TESTNET_GENESIS]: { ...DEFAULT_PARAMS, stakeTarget: 0.75 },
[GOLDBERG_NETWORK_TESTNET_GENESIS]: AVAIL_NETWORK_INFLATION_PARAMS,
// 30% for up to 60 slots, see
// https://github.com/paritytech/polkadot/blob/816cb64ea16102c6c79f6be2a917d832d98df757/runtime/kusama/src/lib.rs#L526-L527
// 75% ideal target, see
Expand Down
27 changes: 13 additions & 14 deletions packages/apps-config/src/endpoints/production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import type { EndpointOption } from './types.js';

import { nodesAvailPNG } from '../ui/logos/nodes/index.js';
// import { chains3dpassSVG, chainsAlephSVG, chainsBittensorPNG, chainsChainflipPNG, chainsCreditcoinPNG, chainsDebioSVG, chainsFragnovaPNG, chainsJurPNG, chainsLiberlandPNG, chainsLogionPNG, chainsMyriadPNG, chainsSpannerPNG, chainsVaraPNG, chainsVtbPNG } from '../ui/logos/chains/index.js';
// import { nodesAresOdysseySVG, nodesAutomataPNG, nodesCentrifugePNG, nodesCereSVG, nodesChainxSVG, nodesCompetitorsClubPNG, nodesCrownSterlingPNG, nodesCrustSVG, nodesDatahighwayPNG, nodesDockPNG, nodesEdgewareWhitePNG, nodesEfinitySVG, nodesHanyonycashPNG, nodesHumanodePNG, nodesInnovatorPNG, nodesJoystreamSVG, nodesKulupuSVG, nodesKusariSVG, nodesMathSVG, nodesMinixPNG, nodesNftmartPNG, nodesNodleSVG, nodesPolkadexSVG, nodesPolymeshSVG, nodesRiochainSVG, nodesRobonomicsSVG, nodesSherpaxPNG, nodesSoraSubstrateSVG, nodesStafiPNG, nodesSubgameSVG, nodesSubsocialSVG, nodesSwapdexSVG, nodesTernoaSVG, nodesThebifrostPNG, nodesUniartsPNG, nodesUnitnetworkPNG } from '../ui/logos/nodes/index.js';
// import config from '../variables/config.js';
// import { nodesAvailPNG } from '../ui/logos/nodes/index.js';
import config from '../variables/config.js';

export * from './productionRelayKusama.js';
export * from './productionRelayPolkadot.js';
Expand All @@ -18,17 +18,16 @@ export * from './productionRelayPolkadot.js';
// providers: The actual hosted secure websocket endpoint
//
// IMPORTANT: Alphabetical based on text
// TODO-mainnet
export const prodChains: Omit<EndpointOption, 'teleport'>[] = [
// {
// info: 'avail',
// providers: {
// AVAIL: config.mainnet.url
// },
// text: 'Avail network',
// ui: {
// color: '#1B1E26',
// logo: nodesAvailPNG
// }
// },
{
info: 'avail',
providers: {
AVAIL: config.mainnet.url
},
text: 'Avail network',
ui: {
color: '#1B1E26',
logo: nodesAvailPNG
}
}
];
11 changes: 0 additions & 11 deletions packages/apps-config/src/endpoints/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,5 @@ export const testChains: Omit<EndpointOption, 'teleport'>[] = [
color: '#5e6067',
logo: nodesAvailPNG
}
},
{
info: 'avail',
providers: {
AVAIL: config.goldberg.url
},
text: 'Avail Goldberg Testnet',
ui: {
color: '#5e6067',
logo: nodesAvailPNG
}
}
];
14 changes: 4 additions & 10 deletions packages/apps-config/src/variables/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line
const config: { [network: string]: { url: `wss://${string}`, lcUrl: string } } = {
goldberg: {
lcUrl: process.env.GOLDBERG_LC || 'https://api.lightclient.goldberg.avail.tools/v1',
url: process.env.GOLDBERG_URL as `wss://${string}` || 'wss://rpc-testnet.avail.tools/ws'
mainnet: {
lcUrl: process.env.MAINNET_LC || 'https://api.lightclient.mainnet.avail.tools/v1',
url: process.env.MAINNET_URL as `wss://${string}` || 'wss://mainnet-rpc.avail.so/ws'
},
turing: {
lcUrl: process.env.TURING_LC || 'https://api.lightclient.turing.avail.so/v1',
url: process.env.TURING_URL as `wss://${string}` || 'wss://turing-rpc.avail.so/ws'
}
// mainnet: { // TODO-mainnet
// lcUrl: process.env.MAINNET_LC as string || 'https://api.lightclient.mainnet.avail.tools/v1',
// url: process.env.MAINNET_URL as `wss://${string}` || 'wss://mainnet-rpc.avail.so'
// }
};

export const getLCFromUrl = (apiUrl: string) => {
if (apiUrl.includes('turing')) {
return config.turing.lcUrl;
} else if (apiUrl.includes('goldberg') || apiUrl === 'wss://rpc-testnet.avail.tools/ws') {
return config.goldberg.lcUrl;
} else {
return config.turing.lcUrl; // TODO-mainnet
return config.turing.lcUrl;
}
};

Expand Down
2 changes: 0 additions & 2 deletions packages/apps/webpack.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ function createWebpack (context, mode = 'production') {
}),
new webpack.DefinePlugin({
'process.env': {
GOLDBERG_LC: JSON.stringify(process.env.GOLDBERG_LC),
GOLDBERG_URL: JSON.stringify(process.env.GOLDBERG_URL),
MAINNET_LC: JSON.stringify(process.env.MAINNET_LC),
MAINNET_URL: JSON.stringify(process.env.MAINNET_URL),
NODE_ENV: JSON.stringify(mode),
Expand Down
10 changes: 6 additions & 4 deletions patches/@polkadot+hw-ledger+12.6.2.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
diff --git a/node_modules/@polkadot/hw-ledger/cjs/defaults.js b/node_modules/@polkadot/hw-ledger/cjs/defaults.js
index 94cf3de..939134b 100644
index 94cf3de..141b22b 100644
--- a/node_modules/@polkadot/hw-ledger/cjs/defaults.js
+++ b/node_modules/@polkadot/hw-ledger/cjs/defaults.js
@@ -6,6 +6,7 @@ exports.ledgerApps = {
@@ -6,6 +6,8 @@ exports.ledgerApps = {
ajuna: 'Ajuna',
'aleph-node': 'AlephZero',
astar: 'Astar',
+ avail: 'Avail',
+ 'avail-turing': 'Avail',
bifrost: 'Bifrost',
'bifrost-kusama': 'BifrostKusama',
centrifuge: 'Centrifuge',
diff --git a/node_modules/@polkadot/hw-ledger/defaults.js b/node_modules/@polkadot/hw-ledger/defaults.js
index 9f06432..334edfc 100644
index 9f06432..9d913d1 100644
--- a/node_modules/@polkadot/hw-ledger/defaults.js
+++ b/node_modules/@polkadot/hw-ledger/defaults.js
@@ -3,6 +3,7 @@ export const ledgerApps = {
@@ -3,6 +3,8 @@ export const ledgerApps = {
ajuna: 'Ajuna',
'aleph-node': 'AlephZero',
astar: 'Astar',
+ avail: 'Avail',
+ 'avail-turing': 'Avail',
bifrost: 'Bifrost',
'bifrost-kusama': 'BifrostKusama',
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5189,12 +5189,12 @@ __metadata:
languageName: node
linkType: hard

"avail-js-sdk@npm:^0.2.12":
version: 0.2.12
resolution: "avail-js-sdk@npm:0.2.12"
"avail-js-sdk@npm:^0.2.13":
version: 0.2.13
resolution: "avail-js-sdk@npm:0.2.13"
dependencies:
"@polkadot/api": "npm:^10.11.3"
checksum: 10/4f54f6e6244b8aba6f74b6d8e1da9553f119311e014492dfca5691a81cd826bc59eef8eead5ef5455f163b5a4381e4445b78df21093713a486090bbbc204095e
checksum: 10/f8207373f6c0d2700403cc3349241b1fb51bd74e9ae7cfb681fc5af2f487700c668c6169b43767679e1ab5095f2a4e56278b608eba8dd2bbf506761b04cc2fbb
languageName: node
linkType: hard

Expand Down Expand Up @@ -14007,7 +14007,7 @@ __metadata:
"@types/react-dom": "npm:^18.2.18"
"@types/react-router-dom": "npm:^5.3.3"
"@types/store": "npm:^2.0.5"
avail-js-sdk: "npm:^0.2.12"
avail-js-sdk: "npm:^0.2.13"
axios: "npm:^1.4.0"
concurrently: "npm:^8.2.2"
devtron: "npm:^1.4.0"
Expand Down