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

feat: set fastest endpoint for assethub #11287

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ sitemap.xml


queries/clients/*.d.ts
libs/static/src/endpoints.json
11 changes: 0 additions & 11 deletions libs/static/justfile

This file was deleted.

21 changes: 2 additions & 19 deletions libs/static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,18 @@
"name": "@kodadot1/static",
"version": "0.0.7",
"description": "Static constants in the KodaDot development",
"repository": "kodadot/nft-gallery",
"repository": "https://github.com/kodadot/nft-gallery/tree/main/libs/static",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"main": "./src/index.ts",
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"prepack": "pnpm run build",
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "vitest run"
},
"devDependencies": {
"@vitest/coverage-c8": "^0.33.0",
"changelogen": "^0.5.5",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"vitest": "^1.6.0"
}
}
35 changes: 7 additions & 28 deletions libs/static/src/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import endpoints from './endpoints.json'
import type { Config } from './types'

type WS_URL = `wss://${string}` | `ws://${string}`
type HTTP_URL = `https://${string}` | `http://${string}`

type ENDPOINT_URL = WS_URL | HTTP_URL

const KUSAMA_ENDPOINTS: WS_URL[] = [
'wss://rpc.ibp.network/kusama',
'wss://rpc.dotters.network/kusama',
'wss://1rpc.io/ksm',
'wss://kusama-rpc.dwellir.com',
]

const POLKADOT_ENDPOINTS: WS_URL[] = [
'wss://rpc.dotters.network/polkadot',
'wss://polkadot.public.curie.radiumblock.co/ws',
Expand All @@ -20,27 +14,12 @@ const POLKADOT_ENDPOINTS: WS_URL[] = [
'wss://polkadot-rpc.dwellir.com',
]

const AHP_ENDPOINTS: WS_URL[] = [
'wss://statemint.api.onfinality.io/public-ws',
'wss://polkadot-asset-hub-rpc.polkadot.io',
'wss://sys.ibp.network/statemint',
'wss://statemint-rpc.dwellir.com',
'wss://statemint-rpc-tn.dwellir.com',
'wss://sys.dotters.network/statemint',
]

// Someone from HydraDX team told me that Polkadot API takes Array of endpoints
export const ALTERNATIVE_ENDPOINT_MAP: Config<ENDPOINT_URL[]> = {
ksm: KUSAMA_ENDPOINTS,
ahk: [
'wss://sys.ibp.network/statemine',
'wss://statemine-rpc.dwellir.com',
'wss://sys.dotters.network/statemine',
'wss://rpc-asset-hub-kusama.luckyfriday.io',
'wss://statemine.public.curie.radiumblock.co/ws',
],
ksm: endpoints.ahk.providers as ENDPOINT_URL[],
ahk: endpoints.ahk.providers as ENDPOINT_URL[],
dot: POLKADOT_ENDPOINTS,
ahp: AHP_ENDPOINTS,
ahp: endpoints.ahp.providers as ENDPOINT_URL[],
imx: ['https://rpc.immutable.com'],
base: ['https://mainnet.base.org'],
mnt: ['https://rpc.mantle.xyz'],
Expand All @@ -50,10 +29,10 @@ export const ALTERNATIVE_ENDPOINT_MAP: Config<ENDPOINT_URL[]> = {
}

export const ENDPOINT_MAP: Config<ENDPOINT_URL> = {
ksm: KUSAMA_ENDPOINTS[0],
ahk: 'wss://sys.ibp.network/statemine',
ksm: endpoints.ahk.endpoint as ENDPOINT_URL,
ahk: endpoints.ahk.endpoint as ENDPOINT_URL,
dot: POLKADOT_ENDPOINTS[0],
ahp: AHP_ENDPOINTS[0],
ahp: endpoints.ahp.endpoint as ENDPOINT_URL,
imx: 'https://rpc.immutable.com',
base: 'https://mainnet.base.org',
mnt: 'https://rpc.mantle.xyz',
Expand Down
1 change: 1 addition & 0 deletions libs/static/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"esModuleInterop": true,
"strict": true
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"version": "3.0.0",
"private": true,
"scripts": {
"dev": "nuxi prepare && cross-env NODE_OPTIONS=--openssl-legacy-provider PORT=9090 nuxi dev",
"dev": "pnpm run prepare && cross-env NODE_OPTIONS=--openssl-legacy-provider PORT=9090 nuxi dev",
"dev-docker": "npx nuxi dev",
"dev-experimental": "nuxi dev --hostname localhost --port 9090",
"build": "nuxi build --modern",
Expand All @@ -36,7 +36,7 @@
"test:watch": "vitest --reporter verbose",
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test --ui",
"prepare": "pnpm -F static build && nuxi prepare && husky"
"prepare": "node ./script/polkadot-endpoint.mjs && nuxi prepare && husky"
},
"lint-staged": {
"*": [
Expand Down Expand Up @@ -67,7 +67,7 @@
"@pinia/nuxt": "^0.5.4",
"@polkadot/api": "^11.2.1",
"@polkadot/api-base": "^11.2.1",
"@polkadot/apps-config": "^0.138.1",
"@polkadot/apps-config": "^0.146.1",
"@polkadot/extension-dapp": "^0.47.1",
"@polkadot/extension-inject": "^0.47.1",
"@polkadot/types": "^11.2.1",
Expand Down
Loading
Loading