refactor: move all app state into a common folder
This commit is contained in:
@@ -0,0 +1,283 @@
|
||||
import { getDynamicBuilder, getLookupFn } from "@polkadot-api/metadata-builders"
|
||||
import { getObservableClient } from "@polkadot-api/observable-client"
|
||||
import { decAnyMetadata, HexString } from "@polkadot-api/substrate-bindings"
|
||||
import {
|
||||
createClient as createSubstrateClient,
|
||||
JsonRpcProvider,
|
||||
} from "@polkadot-api/substrate-client"
|
||||
import { toHex } from "@polkadot-api/utils"
|
||||
import { sinkSuspense, state, SUSPENSE } from "@react-rxjs/core"
|
||||
import { createSignal } from "@react-rxjs/utils"
|
||||
import { createClient } from "polkadot-api"
|
||||
import { withLogsRecorder } from "polkadot-api/logs-provider"
|
||||
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat"
|
||||
import { getSmProvider } from "polkadot-api/sm-provider"
|
||||
import { Chain } from "polkadot-api/smoldot"
|
||||
import { startFromWorker } from "polkadot-api/smoldot/from-worker"
|
||||
import SmWorker from "polkadot-api/smoldot/worker?worker"
|
||||
import { getWsProvider } from "polkadot-api/ws-provider/web"
|
||||
import {
|
||||
concat,
|
||||
EMPTY,
|
||||
filter,
|
||||
finalize,
|
||||
map,
|
||||
NEVER,
|
||||
Observable,
|
||||
of,
|
||||
startWith,
|
||||
switchMap,
|
||||
tap,
|
||||
} from "rxjs"
|
||||
import ksmRawNetworks from "./networks/kusama.json"
|
||||
import paseoRawNetworks from "./networks/paseo.json"
|
||||
import polkadotRawNetworks from "./networks/polkadot.json"
|
||||
import westendRawNetworks from "./networks/westend.json"
|
||||
|
||||
const [dotChainSpec, ksmChainSpec, paseoChainSpec, westendChainSpec] = [
|
||||
import("polkadot-api/chains/polkadot"),
|
||||
import("polkadot-api/chains/ksmcc3"),
|
||||
import("polkadot-api/chains/paseo"),
|
||||
import("polkadot-api/chains/westend2"),
|
||||
].map((x) => x.then((y) => y.chainSpec))
|
||||
const smoldot = startFromWorker(new SmWorker(), {
|
||||
logCallback: (level, target, message) => {
|
||||
console.debug("smoldot[%s(%s)] %s", target, level, message)
|
||||
},
|
||||
})
|
||||
const relayChains: Record<
|
||||
string,
|
||||
{ chainSpec: Promise<string>; chain: Promise<Chain> | null }
|
||||
> = {
|
||||
polkadot: { chainSpec: dotChainSpec, chain: null },
|
||||
kusama: { chainSpec: ksmChainSpec, chain: null },
|
||||
paseo: { chainSpec: paseoChainSpec, chain: null },
|
||||
westend: { chainSpec: westendChainSpec, chain: null },
|
||||
}
|
||||
const getRelayChain = async (name: string) => {
|
||||
if (!relayChains[name].chain) {
|
||||
relayChains[name].chain = smoldot.addChain({
|
||||
chainSpec: await relayChains[name].chainSpec,
|
||||
})
|
||||
}
|
||||
return relayChains[name].chain
|
||||
}
|
||||
|
||||
export type ChainSource = { id: string } & (
|
||||
| {
|
||||
type: "chainSpec"
|
||||
value: {
|
||||
chainSpec: string
|
||||
relayChain?: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
type: "websocket"
|
||||
value: string
|
||||
}
|
||||
)
|
||||
|
||||
export type Network = {
|
||||
id: string
|
||||
display: string
|
||||
endpoints: Record<string, string>
|
||||
lightclient: boolean
|
||||
relayChain?: string
|
||||
}
|
||||
|
||||
export type NetworkCategory = {
|
||||
name: string
|
||||
networks: Network[]
|
||||
}
|
||||
export type SelectedChain = {
|
||||
network: Network
|
||||
endpoint: string
|
||||
}
|
||||
|
||||
const [Polkadot, Kusama, Paseo, Westend] = (
|
||||
[
|
||||
polkadotRawNetworks,
|
||||
ksmRawNetworks,
|
||||
paseoRawNetworks,
|
||||
westendRawNetworks,
|
||||
] as const
|
||||
).map((n): Network[] =>
|
||||
n.map((x) => ({
|
||||
endpoints: x.rpcs as any,
|
||||
lightclient: x.hasChainSpecs,
|
||||
id: x.id,
|
||||
display: x.display,
|
||||
relayChain: x.relayChainInfo?.id,
|
||||
})),
|
||||
)
|
||||
|
||||
const networks = {
|
||||
Polkadot,
|
||||
Kusama,
|
||||
Paseo,
|
||||
Westend,
|
||||
Development: [
|
||||
{
|
||||
id: "localhost",
|
||||
display: "Localhost",
|
||||
lightclient: false,
|
||||
endpoints: {
|
||||
"Local (ws://127.0.0.1:9944)": "ws://127.0.0.1:9944",
|
||||
},
|
||||
} as Network,
|
||||
],
|
||||
}
|
||||
|
||||
export const networkCategories: NetworkCategory[] = Object.entries(
|
||||
networks,
|
||||
).map(([name, networks]) => ({ name, networks }))
|
||||
|
||||
export const [selectedChainChanged$, onChangeChain] =
|
||||
createSignal<SelectedChain>()
|
||||
export const selectedChain$ = state<SelectedChain>(selectedChainChanged$, {
|
||||
network: Polkadot[0],
|
||||
endpoint: "light-client",
|
||||
})
|
||||
selectedChain$.subscribe()
|
||||
|
||||
const selectedSource$ = selectedChain$.pipe(
|
||||
switchMap(
|
||||
({ endpoint, network }): Observable<ChainSource> | Promise<ChainSource> => {
|
||||
const { id } = network
|
||||
if (endpoint !== "light-client")
|
||||
return of({
|
||||
id,
|
||||
type: "websocket",
|
||||
value: endpoint,
|
||||
})
|
||||
if (id in relayChains) {
|
||||
return relayChains[id].chainSpec.then((chainSpec) => ({
|
||||
id,
|
||||
type: "chainSpec",
|
||||
value: { chainSpec },
|
||||
}))
|
||||
}
|
||||
return import(`./chainspecs/${id}.ts`).then(({ chainSpec }) => {
|
||||
const parsed = JSON.parse(chainSpec)
|
||||
return {
|
||||
id,
|
||||
type: "chainSpec",
|
||||
value: {
|
||||
chainSpec,
|
||||
relayChain:
|
||||
network.relayChain || parsed.relayChain || parsed.relay_chain,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
export const chainClient$ = state(
|
||||
selectedSource$.pipe(
|
||||
map((src) => [src.id, getProvider(src)] as const),
|
||||
switchMap(([id, provider], i) => {
|
||||
const substrateClient = createSubstrateClient(provider)
|
||||
const observableClient = getObservableClient(substrateClient)
|
||||
const chainHead = observableClient.chainHead$(2)
|
||||
const client = createClient(provider)
|
||||
return concat(
|
||||
i === 0 ? EMPTY : of(SUSPENSE),
|
||||
of({ id, client, substrateClient, observableClient, chainHead }),
|
||||
NEVER,
|
||||
).pipe(
|
||||
finalize(() => {
|
||||
chainHead.unfollow()
|
||||
client.destroy()
|
||||
observableClient.destroy()
|
||||
}),
|
||||
)
|
||||
}),
|
||||
sinkSuspense(),
|
||||
),
|
||||
)
|
||||
export const chainHead$ = state(
|
||||
chainClient$.pipe(map(({ chainHead }) => chainHead)),
|
||||
)
|
||||
|
||||
export const unsafeApi$ = chainClient$.pipeState(
|
||||
map(({ client }) => client.getUnsafeApi()),
|
||||
)
|
||||
|
||||
const uncachedRuntimeCtx$ = chainClient$.pipeState(
|
||||
switchMap(({ chainHead }) => chainHead.runtime$),
|
||||
filter((v) => !!v),
|
||||
)
|
||||
|
||||
const getMetadataCache = () => {
|
||||
const cached = localStorage.getItem(`metadata-cache`)
|
||||
return new Map<string, { time: number; data: HexString }>(
|
||||
cached ? JSON.parse(cached) : [],
|
||||
)
|
||||
}
|
||||
const getCachedMetadata = (id: string) =>
|
||||
getMetadataCache().get(id)?.data ?? null
|
||||
const setCachedMetadata = (id: string, data: HexString) => {
|
||||
const cached = getMetadataCache()
|
||||
cached.set(id, { time: Date.now(), data })
|
||||
if (cached.size > 3) {
|
||||
const oldest = [...cached.entries()].reduce((a, b) =>
|
||||
a[1].time < b[1].time ? a : b,
|
||||
)[0]
|
||||
cached.delete(oldest)
|
||||
}
|
||||
localStorage.setItem("metadata-cache", JSON.stringify([...cached.entries()]))
|
||||
}
|
||||
export const runtimeCtx$ = chainClient$.pipeState(
|
||||
switchMap(({ id }) => {
|
||||
const cached = getCachedMetadata(id)
|
||||
|
||||
const realCtx$ = uncachedRuntimeCtx$.pipe(
|
||||
tap((v) => {
|
||||
setCachedMetadata(id, toHex(v.metadataRaw))
|
||||
}),
|
||||
)
|
||||
|
||||
if (cached) {
|
||||
const metadata = decAnyMetadata(cached)
|
||||
const lookup = getLookupFn(metadata.metadata.value as any)
|
||||
const dynamicBuilder = getDynamicBuilder(lookup)
|
||||
|
||||
return realCtx$.pipe(
|
||||
startWith({
|
||||
lookup,
|
||||
dynamicBuilder,
|
||||
}),
|
||||
)
|
||||
}
|
||||
return realCtx$
|
||||
}),
|
||||
)
|
||||
|
||||
export const lookup$ = runtimeCtx$.pipeState(map((ctx) => ctx.lookup))
|
||||
export const metadata$ = lookup$.pipeState(map((lookup) => lookup.metadata))
|
||||
export const dynamicBuilder$ = runtimeCtx$.pipeState(
|
||||
map((ctx) => ctx.dynamicBuilder),
|
||||
)
|
||||
|
||||
export function getProvider(source: ChainSource): JsonRpcProvider {
|
||||
if (source.type === "websocket") {
|
||||
return withPolkadotSdkCompat(getWsProvider(source.value))
|
||||
}
|
||||
|
||||
const chain = source.value.relayChain
|
||||
? getRelayChain(source.value.relayChain).then((chain) =>
|
||||
smoldot.addChain({
|
||||
chainSpec: source.value.chainSpec,
|
||||
potentialRelayChains: [chain],
|
||||
}),
|
||||
)
|
||||
: smoldot.addChain({
|
||||
chainSpec: source.value.chainSpec,
|
||||
})
|
||||
|
||||
return withLogsRecorder(
|
||||
(v) => v.includes("initialized") && console.debug(v),
|
||||
getSmProvider(chain),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export const chainSpec = JSON.stringify({
|
||||
name: "Acala",
|
||||
id: "acala",
|
||||
chainType: "Live",
|
||||
bootNodes: [
|
||||
"/dns/acala-bootnode-4.aca-api.network/tcp/30333/p2p/12D3KooWBLwm4oKY5fsbkdSdipHzYJJHSHhuoyb1eTrH31cidrnY",
|
||||
"/dns/acala-bootnode-4.aca-api.network/tcp/30334/ws/p2p/12D3KooWBLwm4oKY5fsbkdSdipHzYJJHSHhuoyb1eTrH31cidrnY",
|
||||
"/dns/acala-bootnode-5.aca-api.network/tcp/80/ws/p2p/12D3KooWN6ZZ2LFSJo2vDci3hqmmcvqMcKJAbREvuYCdvoBvV2D4",
|
||||
"/dns/acala-bootnode-5.aca-api.network/tcp/443/wss/p2p/12D3KooWN6ZZ2LFSJo2vDci3hqmmcvqMcKJAbREvuYCdvoBvV2D4",
|
||||
"/dns/acala-bootnode-6.aca-api.network/tcp/80/ws/p2p/12D3KooWEBniruZHpoVj8RUtAFPahaN8UaGP6UtQb5Bdp4MVYbLc",
|
||||
"/dns/acala-bootnode-6.aca-api.network/tcp/443/wss/p2p/12D3KooWEBniruZHpoVj8RUtAFPahaN8UaGP6UtQb5Bdp4MVYbLc",
|
||||
"/dns/acala-bootnode-7.aca-api.network/tcp/80/ws/p2p/12D3KooWMq7AtHFx3ZboMT92HQw8BvhZFzJh8UrPCZeMB3yFLe1V",
|
||||
],
|
||||
properties: {
|
||||
ss58Format: 10,
|
||||
tokenDecimals: [12, 12, 10, 10],
|
||||
tokenSymbol: ["ACA", "AUSD", "DOT", "LDOT"],
|
||||
},
|
||||
relayChain: "polkadot",
|
||||
paraId: 2000,
|
||||
consensusEngine: null,
|
||||
codeSubstitutes: {},
|
||||
badBlocks: [
|
||||
"0xa820d0e6b3babb3a7023a229cfe61c32ceb68602f5339e2d416d7fbca5e82aa7",
|
||||
],
|
||||
genesis: {
|
||||
stateRootHash:
|
||||
"0x010c5745a5d42bcfbe0a644d5a2a4e22e2ff0fd378d48208ecfacea5b7e05a74",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,28 @@
|
||||
export const chainSpec = JSON.stringify({
|
||||
name: "Ajuna Polkadot",
|
||||
id: "ajuna_polkadot",
|
||||
chainType: "Live",
|
||||
bootNodes: [
|
||||
"/dns4/boot-node.helikon.io/tcp/8510/p2p/12D3KooWA1zjoSfN1CWRMY4nRxD94sSnNAj8UkhD7tsh4K6rwYSX",
|
||||
"/dns4/boot-node.helikon.io/tcp/8512/wss/p2p/12D3KooWA1zjoSfN1CWRMY4nRxD94sSnNAj8UkhD7tsh4K6rwYSX",
|
||||
"/dns4/node-7135141363928633344-0.p2p.onfinality.io/tcp/20256/ws/p2p/12D3KooWS8wVu6hmDwZvqDXJWnBX5sKb9edR1HWv5hYKD1Ysc2ud",
|
||||
"/dns4/node-7163299142418038784-0.p2p.onfinality.io/tcp/20806/ws/p2p/12D3KooWKNTJ5zQr3SK2DphVxEzbBWW9wSqd64ruad1uiiZd6E1Y",
|
||||
"/dns/ajuna.boot.stake.plus/tcp/30332/wss/p2p/12D3KooWRyAHbMPNL7CuQtm987a6iLKftME3eQpVqBC6fUsjWuof",
|
||||
"/dns/ajuna.boot.stake.plus/tcp/31332/wss/p2p/12D3KooWLXSQdRNS5EXuhpFYiRKHufRsQtb64t4CYj2ah7zx86jA",
|
||||
"/dns/rpc-para.ajuna.network/tcp/30332/p2p/12D3KooWLFfa4J2T3JGZft74q3Wu6kSYHPJHNzLsVhdLPGbAZ9Wf",
|
||||
"/dns/rpc-para.ajuna.network/tcp/30333/ws/p2p/12D3KooWLFfa4J2T3JGZft74q3Wu6kSYHPJHNzLsVhdLPGbAZ9Wf",
|
||||
"/dns/ajuna-polkadot-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWAPXggzmvxX8pefwGMNXDzUwigHEKCmrwZzMpySJbYwUK",
|
||||
"/dns/ajuna-polkadot-boot-ng.dwellir.com/tcp/30363/p2p/12D3KooWAPXggzmvxX8pefwGMNXDzUwigHEKCmrwZzMpySJbYwUK",
|
||||
"/dns/ajuna-polkadot-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWAPXggzmvxX8pefwGMNXDzUwigHEKCmrwZzMpySJbYwUK",
|
||||
"/dns/ajuna-bootnode.radiumblock.com/tcp/30333/p2p/12D3KooWCfjWNEmYcGJwF8S1xizhSHyFHwwDLmQxQCr2Wu9JUTYw",
|
||||
"/dns/ajuna-bootnode.radiumblock.com/tcp/30336/wss/p2p/12D3KooWCfjWNEmYcGJwF8S1xizhSHyFHwwDLmQxQCr2Wu9JUTYw",
|
||||
],
|
||||
properties: { ss58Format: 1328, tokenDecimals: 12, tokenSymbol: "AJUN" },
|
||||
relay_chain: "polkadot",
|
||||
para_id: 2051,
|
||||
codeSubstitutes: {},
|
||||
genesis: {
|
||||
stateRootHash:
|
||||
"0x6e666a1df855628a99876f9f876b94d6d20a397fb1b5d92a3747df75e29c61b1",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,24 @@
|
||||
export const chainSpec = JSON.stringify({
|
||||
name: "Astar",
|
||||
id: "astar",
|
||||
chainType: "Live",
|
||||
bootNodes: [
|
||||
"/ip4/109.238.14.102/tcp/30333/ws/p2p/12D3KooWPH9bkXRkPcHGKd7DSgYfLLVE1Cw7QNr2M4kKwdVwGZXN",
|
||||
"/ip4/199.85.208.179/tcp/30333/ws/p2p/12D3KooWMwrAXhSuzCrtiwfVQuB4oLAZj3CLxVzMrqBJB4GKjnQa",
|
||||
"/ip4/131.153.79.50/tcp/30333/ws/p2p/12D3KooWB2XY9Uw1ZR8qtD5DQ4TKivJkQdqM5c6hyY9ixSDAASBa",
|
||||
"/dns/bootnode-01.astar.network/tcp/443/wss/p2p/12D3KooWPH9bkXRkPcHGKd7DSgYfLLVE1Cw7QNr2M4kKwdVwGZXN",
|
||||
"/dns/bootnode-02.astar.network/tcp/443/wss/p2p/12D3KooWMwrAXhSuzCrtiwfVQuB4oLAZj3CLxVzMrqBJB4GKjnQa",
|
||||
"/dns/bootnode-03.astar.network/tcp/443/wss/p2p/12D3KooWB2XY9Uw1ZR8qtD5DQ4TKivJkQdqM5c6hyY9ixSDAASBa",
|
||||
"/dns4/astar-bootnode-1-tls.p2p.onfinality.io/tcp/443/wss/p2p/12D3KooWERrQFE8ss7zYfcHp8ULVCc1N7gur7GqZ8ESuZB1Nmioh",
|
||||
],
|
||||
properties: { ss58Format: 5, tokenDecimals: 18, tokenSymbol: "ASTR" },
|
||||
relayChain: "polkadot",
|
||||
paraId: 2006,
|
||||
consensusEngine: null,
|
||||
codeSubstitutes: {},
|
||||
badBlocks: [],
|
||||
genesis: {
|
||||
stateRootHash:
|
||||
"0xc9451593261d67c47e14c5cbefeeffff5b5a1707cf81800becfc79e6df354da9",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
export const chainSpec = JSON.stringify({
|
||||
name: "Hydration",
|
||||
id: "hydra",
|
||||
chainType: "Live",
|
||||
bootNodes: [
|
||||
"/dns/p2p-01.hydra.hydradx.io/tcp/30333/p2p/12D3KooWHzv7XVVBwY4EX1aKJBU6qzEjqGk6XtoFagr5wEXx6MsH",
|
||||
"/dns/p2p-02.hydra.hydradx.io/tcp/30333/p2p/12D3KooWR72FwHrkGNTNes6U5UHQezWLmrKu6b45MvcnRGK8J3S6",
|
||||
"/dns/p2p-03.hydra.hydradx.io/tcp/30333/p2p/12D3KooWFDwxZinAjgmLVgsideCmdB2bz911YgiQdLEiwKovezUz",
|
||||
"/dns4/boot.helikon.io/tcp/15120/p2p/12D3KooWDcQY1L2ny3F7YPyP4snCZZYc4eKWgPLEzdBvWBUjH5Yt",
|
||||
"/dns4/boot.helikon.io/tcp/15125/wss/p2p/12D3KooWDcQY1L2ny3F7YPyP4snCZZYc4eKWgPLEzdBvWBUjH5Yt",
|
||||
"/dns/hydration.boot.stake.plus/tcp/30332/wss/p2p/12D3KooWGZaDfqPyzVxhA3k1qv72P7xqYTJS8W9U7GWUEdXYhtUU",
|
||||
"/dns/hydration.boot.stake.plus/tcp/31332/wss/p2p/12D3KooWBJMG8LCh6pLYbGapA3SNzjhQWE87ieGux41jKQrrf5js",
|
||||
"/dns/hydration-bootnode.radiumblock.com/tcp/30333/p2p/12D3KooWCtrMH4H2p5XkGHkU7K4CcbSmErouNuN3j7Bysj4a8hJX",
|
||||
"/dns/hydration-bootnode.radiumblock.com/tcp/30336/wss/p2p/12D3KooWCtrMH4H2p5XkGHkU7K4CcbSmErouNuN3j7Bysj4a8hJX",
|
||||
],
|
||||
properties: { tokenDecimals: 12, tokenSymbol: "HDX" },
|
||||
relay_chain: "polkadot",
|
||||
para_id: 2034,
|
||||
consensusEngine: null,
|
||||
codeSubstitutes: {},
|
||||
genesis: {
|
||||
stateRootHash:
|
||||
"0x33a542156b00e7dd467e2b7704563abd84f888ccbc6afd6f1a1802a55db1d4de",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
export const chainSpec = JSON.stringify({
|
||||
name: "InvArch Network",
|
||||
id: "invarch_polkadot",
|
||||
chainType: "Live",
|
||||
bootNodes: [
|
||||
"/dns/invarch-boot.dwellir.com/tcp/443/wss/p2p/12D3KooWHWLn81PF8T29cxeeq12hpJoaPNbJbuvtZ6pJxJ8asnTY",
|
||||
"/dns/invarch-boot.dwellir.com/tcp/30363/p2p/12D3KooWHWLn81PF8T29cxeeq12hpJoaPNbJbuvtZ6pJxJ8asnTY",
|
||||
"/dns/invarch.boot.stake.plus/tcp/30332/wss/p2p/12D3KooWJ7dgREmmhiA5skqEf1C7N43ex9uawaXuyQumhxg66Zoa",
|
||||
"/dns/invarch.boot.stake.plus/tcp/31332/wss/p2p/12D3KooWLLHBRKvbRgWA5eD2DSFEeEz7i5V9zPVCkCeMdyT966Ui",
|
||||
],
|
||||
properties: {
|
||||
ss58Format: 117,
|
||||
tokenDecimals: 12,
|
||||
tokenSymbol: "VARCH",
|
||||
},
|
||||
relay_chain: "polkadot",
|
||||
para_id: 3340,
|
||||
codeSubstitutes: {},
|
||||
genesis: {
|
||||
stateRootHash:
|
||||
"0x64d77bb0ea342ea5b053fba4fd29248b1c3a5b20a8a9ef0cfc14cf45b0c5a4fb",
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/ksmcc3"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/ksmcc3_asset_hub"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/ksmcc3_encointer"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/ksmcc3_people"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/paseo"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/paseo_asset_hub"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/polkadot"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/polkadot_asset_hub"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/polkadot_bridge_hub"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/polkadot_collectives"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/polkadot_people"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/westend2"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/westend2_asset_hub"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/westend2_collectives"
|
||||
@@ -0,0 +1 @@
|
||||
export { chainSpec } from "polkadot-api/chains/westend2_people"
|
||||
@@ -0,0 +1,434 @@
|
||||
[
|
||||
{
|
||||
"id": "kusama",
|
||||
"display": "Kusama Relay Chain",
|
||||
"hasChainSpecs": true,
|
||||
"rpcs": {
|
||||
"Allnodes": "wss://kusama-rpc.publicnode.com",
|
||||
"Dwellir": "wss://kusama-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://kusama-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://rpc.ibp.network/kusama",
|
||||
"IBP2": "wss://kusama.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-kusama.luckyfriday.io",
|
||||
"OnFinality": "wss://kusama.api.onfinality.io/public-ws",
|
||||
"RockX": "wss://rockx-ksm.w3node.com/polka-public-ksm/ws",
|
||||
"Stakeworld": "wss://ksm-rpc.stakeworld.io",
|
||||
"SubQuery": "wss://kusama.rpc.subquery.network/public/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "kusama_asset_hub",
|
||||
"display": "Kusama AssetHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://asset-hub-kusama-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://statemine-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/statemine",
|
||||
"IBP2": "wss://asset-hub-kusama.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-asset-hub-kusama.luckyfriday.io",
|
||||
"Parity": "wss://kusama-asset-hub-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://statemine.public.curie.radiumblock.co/ws",
|
||||
"Stakeworld": "wss://ksm-rpc.stakeworld.io/assethub"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": true,
|
||||
"parachain": 1000
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "kusama_bridge_hub",
|
||||
"display": "Kusama BridgeHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://bridge-hub-kusama-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://kusama-bridge-hub-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/bridgehub-kusama",
|
||||
"IBP2": "wss://bridge-hub-kusama.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-bridge-hub-kusama.luckyfriday.io",
|
||||
"Parity": "wss://kusama-bridge-hub-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://bridgehub-kusama.public.curie.radiumblock.co/ws",
|
||||
"Stakeworld": "wss://ksm-rpc.stakeworld.io/bridgehub"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": true,
|
||||
"parachain": 1002
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "kusama_core_time",
|
||||
"display": "Kusama Coretime",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://coretime-kusama-rpc.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/coretime-kusama",
|
||||
"IBP2": "wss://coretime-kusama.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-coretime-kusama.luckyfriday.io",
|
||||
"Parity": "wss://kusama-coretime-rpc.polkadot.io",
|
||||
"Stakeworld": "wss://ksm-rpc.stakeworld.io/coretime"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": true,
|
||||
"parachain": 1005
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "kusama_people",
|
||||
"display": "People",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://people-kusama-rpc.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/people-kusama",
|
||||
"IBP2": "wss://people-kusama.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-people-kusama.luckyfriday.io",
|
||||
"Parity": "wss://kusama-people-rpc.polkadot.io",
|
||||
"Stakeworld": "wss://ksm-rpc.stakeworld.io/people"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": true,
|
||||
"parachain": 1004
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "kusama_encointer",
|
||||
"display": "Encointer Network",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://encointer-kusama-rpc.dwellir.com",
|
||||
"Encointer Association": "wss://kusama.api.encointer.org",
|
||||
"IBP1": "wss://sys.ibp.network/encointer-kusama",
|
||||
"IBP2": "wss://encointer-kusama.dotters.network"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": true,
|
||||
"parachain": 1001
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "altair",
|
||||
"display": "Altair",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2088
|
||||
},
|
||||
"rpcs": {
|
||||
"Centrifuge": "wss://fullnode.altair.centrifuge.io",
|
||||
"OnFinality": "wss://altair.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "AIR",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "amplitude",
|
||||
"display": "Amplitude",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2124
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://amplitude-rpc.dwellir.com",
|
||||
"PendulumChain": "wss://rpc-amplitude.pendulumchain.tech"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "AMPE",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "bajun",
|
||||
"display": "Bajun Network",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2119
|
||||
},
|
||||
"rpcs": {
|
||||
"AjunaNetwork": "wss://rpc-parachain.bajun.network",
|
||||
"OnFinality": "wss://bajun.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://bajun.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BAJU",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "basilisk",
|
||||
"display": "Basilisk",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2090
|
||||
},
|
||||
"rpcs": {
|
||||
"Basilisk": "wss://rpc.basilisk.cloud",
|
||||
"Dwellir": "wss://basilisk-rpc.dwellir.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BSX",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "bifrost",
|
||||
"display": "Bifrost",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2001
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://bifrost-rpc.dwellir.com",
|
||||
"Liebi": "wss://bifrost-rpc.liebi.com/ws",
|
||||
"LiebiUS": "wss://us.bifrost-rpc.liebi.com/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BNC",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "calamari",
|
||||
"display": "Calamari",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2084
|
||||
},
|
||||
"rpcs": {
|
||||
"Manta Network": "wss://calamari.systems"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KMA",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "crab",
|
||||
"display": "Crab",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2105
|
||||
},
|
||||
"rpcs": {
|
||||
"Darwinia": "wss://crab-rpc.darwinia.network/",
|
||||
"Dcdao": "wss://crab-rpc.dcdao.box",
|
||||
"Dwellir": "wss://darwiniacrab-rpc.dwellir.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "CRAB",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "imbue",
|
||||
"display": "Imbue Network",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2121
|
||||
},
|
||||
"rpcs": {
|
||||
"Imbue Network 0": "wss://kusama.imbuenetwork.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "IMBU",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "integritee",
|
||||
"display": "Integritee Network",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2015
|
||||
},
|
||||
"rpcs": {
|
||||
"Integritee": "wss://kusama.api.integritee.network",
|
||||
"OnFinality": "wss://integritee-kusama.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "TEER",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "tinker",
|
||||
"display": "InvArch Tinkernet",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2125
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://tinkernet-rpc.dwellir.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "TNKR",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "karura",
|
||||
"display": "Karura",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2000
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://karura-rpc.dwellir.com",
|
||||
"OnFinality": "wss://karura.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KAR",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "khala",
|
||||
"display": "Khala Network",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2004
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://khala-rpc.dwellir.com",
|
||||
"Helikon": "wss://rpc.helikon.io/khala",
|
||||
"OnFinality": "wss://khala.api.onfinality.io/public-ws",
|
||||
"Phala": "wss://khala-api.phala.network/ws",
|
||||
"RadiumBlock": "wss://khala.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PHA",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "kreivo",
|
||||
"display": "Kreivo - By Virto",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2281
|
||||
},
|
||||
"rpcs": {
|
||||
"Virto": "wss://kreivo.io/"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KSM",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "moonriver",
|
||||
"display": "Moonriver",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2023
|
||||
},
|
||||
"rpcs": {
|
||||
"Moonbeam Foundation": "wss://wss.api.moonriver.moonbeam.network",
|
||||
"Allnodes": "wss://moonriver-rpc.publicnode.com",
|
||||
"Dwellir": "wss://moonriver-rpc.dwellir.com",
|
||||
"OnFinality": "wss://moonriver.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://moonriver.public.curie.radiumblock.co/ws",
|
||||
"UnitedBloc": "wss://moonriver.unitedbloc.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "MOVR",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "quartz",
|
||||
"display": "QUARTZ by UNIQUE",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2095
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://quartz-rpc.dwellir.com",
|
||||
"Geo Load Balancer": "wss://ws-quartz.unique.network",
|
||||
"Unique America": "wss://us-ws-quartz.unique.network",
|
||||
"Unique Asia": "wss://asia-ws-quartz.unique.network",
|
||||
"Unique Europe": "wss://eu-ws-quartz.unique.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "QTZ",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "shiden",
|
||||
"display": "Shiden",
|
||||
"relayChainInfo": {
|
||||
"id": "kusama",
|
||||
"isSystem": false,
|
||||
"parachain": 2007
|
||||
},
|
||||
"rpcs": {
|
||||
"Astar": "wss://rpc.shiden.astar.network",
|
||||
"Dwellir": "wss://shiden-rpc.dwellir.com",
|
||||
"OnFinality": "wss://shiden.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://shiden.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "SDN",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,350 @@
|
||||
[
|
||||
{
|
||||
"id": "paseo",
|
||||
"display": "Paseo Relay Chain",
|
||||
"hasChainSpecs": true,
|
||||
"rpcs": {
|
||||
"Amforc": "wss://paseo.rpc.amforc.com",
|
||||
"Dwellir": "wss://paseo-rpc.dwellir.com",
|
||||
"IBP1": "wss://rpc.ibp.network/paseo",
|
||||
"IBP2": "wss://paseo.dotters.network",
|
||||
"StakeWorld": "wss://pas-rpc.stakeworld.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paseo_asset_hub",
|
||||
"display": "AssetHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://asset-hub-paseo-rpc.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/asset-hub-paseo",
|
||||
"IBP2": "wss://asset-hub-paseo.dotters.network",
|
||||
"StakeWorld": "wss://pas-rpc.stakeworld.io/assethub",
|
||||
"TurboFlakes": "wss://sys.turboflakes.io/asset-hub-paseo"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": true,
|
||||
"parachain": 1000
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "paseo_bridge_hub",
|
||||
"display": "BridgeHub",
|
||||
"rpcs": {
|
||||
"IBP2": "wss://bridge-hub-paseo.dotters.network"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": true,
|
||||
"parachain": 1002
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_core_time",
|
||||
"display": "Coretime",
|
||||
"rpcs": {
|
||||
"IBP2": "wss://coretime-paseo.dotters.network",
|
||||
"ParaNodes": "wss://paseo-coretime.paranodes.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": true,
|
||||
"parachain": 1005
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_people_chain",
|
||||
"display": "People",
|
||||
"rpcs": {
|
||||
"Amforc": "wss://people-paseo.rpc.amforc.com",
|
||||
"IBP2": "wss://people-paseo.dotters.network"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": true,
|
||||
"parachain": 1004
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_ajuna",
|
||||
"display": "Ajuna Network (Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2051
|
||||
},
|
||||
"rpcs": {
|
||||
"BajunNetwork": "wss://rpc-paseo.ajuna.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "AJUN",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_amplitude",
|
||||
"display": "Amplitude testnet (Foucoco)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2124
|
||||
},
|
||||
"rpcs": {
|
||||
"PendulumChain": "wss://rpc-foucoco.pendulumchain.tech"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "AMPE",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_bifrost",
|
||||
"display": "Bifrost(Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2030
|
||||
},
|
||||
"rpcs": {
|
||||
"Liebi": "wss://bifrost-rpc.paseo.liebi.com/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BNC",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "darwinia_koi",
|
||||
"display": "Darwinia Koi",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2105
|
||||
},
|
||||
"rpcs": {
|
||||
"Darwinia": "wss://koi-rpc.darwinia.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KRING",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_frequency",
|
||||
"display": "Frequency(Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4000
|
||||
},
|
||||
"rpcs": {
|
||||
"Amplica Labs": "wss://0.rpc.testnet.amplica.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "XRQCY",
|
||||
"decimals": 8
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_hyperbridge",
|
||||
"display": "Hyperbridge (Gargantua)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4009
|
||||
},
|
||||
"rpcs": {
|
||||
"BlockOps": "wss://hyperbridge-paseo-rpc.blockops.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "tBRIDGE",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_integritee",
|
||||
"display": "Integritee Network (Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2039
|
||||
},
|
||||
"rpcs": {
|
||||
"Integritee": "wss://paseo.api.integritee.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "TEER",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_kilt",
|
||||
"display": "KILT Peregrine",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2086
|
||||
},
|
||||
"rpcs": {
|
||||
"BOTLabs": "wss://peregrine.kilt.io/parachain-public-ws/"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PILT",
|
||||
"decimals": 15
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_laos_sigma",
|
||||
"display": "Laos Sigma",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4006
|
||||
},
|
||||
"rpcs": {
|
||||
"freeverse.io": "wss://rpc.laossigma.laosfoundation.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "SIGMA",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_myriad",
|
||||
"display": "Myriad Social Testnet",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4005
|
||||
},
|
||||
"rpcs": {
|
||||
"myriadPaseo": "wss://ws-rpc.paseo.myriad.social"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "MYRIA",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_niskala",
|
||||
"display": "Niskala(Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4022
|
||||
},
|
||||
"rpcs": {
|
||||
"Baliola 1": "wss://mlg1.mandalachain.io",
|
||||
"Baliola 2": "wss://mlg2.mandalachain.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KPGT",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "paseo_nodle",
|
||||
"display": "Nodle(Paseo)",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2026
|
||||
},
|
||||
"rpcs": {
|
||||
"OnFinality": "wss://node-6957502816543653888.lh.onfinality.io/ws?apikey=09b04494-3139-4b57-a5d1-e1c4c18748ce"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "notNodl",
|
||||
"decimals": 11
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "Pop Network",
|
||||
"display": "Pop Network",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4001
|
||||
},
|
||||
"rpcs": {
|
||||
"R0GUE-RPC1": "wss://rpc1.paseo.popnetwork.xyz",
|
||||
"R0GUE-RPC2": "wss://rpc2.paseo.popnetwork.xyz",
|
||||
"R0GUE-RPC3": "wss://rpc3.paseo.popnetwork.xyz"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PAS",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "Xcavate",
|
||||
"display": "Xcavate",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 4003
|
||||
},
|
||||
"rpcs": {
|
||||
"Xcavate": "wss://rpc-paseo.xcavate.io:443"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "XCAV",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "ZeitgeistBatteryStation",
|
||||
"display": "Zeitgeist Battery Station",
|
||||
"relayChainInfo": {
|
||||
"id": "paseo",
|
||||
"isSystem": false,
|
||||
"parachain": 2101
|
||||
},
|
||||
"rpcs": {
|
||||
"Zeitgeist": "wss://bsr.zeitgeist.pm"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "ZBS",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,659 @@
|
||||
[
|
||||
{
|
||||
"id": "polkadot",
|
||||
"display": "Polkadot Relay Chain",
|
||||
"hasChainSpecs": true,
|
||||
"rpcs": {
|
||||
"Allnodes": "wss://polkadot-rpc.publicnode.com",
|
||||
"Blockops": "wss://polkadot-public-rpc.blockops.network/ws",
|
||||
"Dwellir": "wss://polkadot-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://polkadot-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://rpc.ibp.network/polkadot",
|
||||
"IBP2": "wss://polkadot.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-polkadot.luckyfriday.io",
|
||||
"OnFinality": "wss://polkadot.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://polkadot.public.curie.radiumblock.co/ws",
|
||||
"RockX": "wss://rockx-dot.w3node.com/polka-public-dot/ws",
|
||||
"Stakeworld": "wss://dot-rpc.stakeworld.io",
|
||||
"SubQuery": "wss://polkadot.rpc.subquery.network/public/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "polkadot_asset_hub",
|
||||
"display": "AssetHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://asset-hub-polkadot-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://statemint-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/asset-hub-polkadot",
|
||||
"IBP2": "wss://asset-hub-polkadot.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-asset-hub-polkadot.luckyfriday.io",
|
||||
"OnFinality": "wss://statemint.api.onfinality.io/public-ws",
|
||||
"Parity": "wss://polkadot-asset-hub-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://statemint.public.curie.radiumblock.co/ws",
|
||||
"Stakeworld": "wss://dot-rpc.stakeworld.io/assethub"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": true,
|
||||
"parachain": 1000
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "polkadot_bridge_hub",
|
||||
"display": "BridgeHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://bridge-hub-polkadot-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://polkadot-bridge-hub-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/bridgehub-polkadot",
|
||||
"IBP2": "wss://bridge-hub-polkadot.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-bridge-hub-polkadot.luckyfriday.io",
|
||||
"OnFinality": "wss://bridgehub-polkadot.api.onfinality.io/public-ws",
|
||||
"Parity": "wss://polkadot-bridge-hub-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://bridgehub-polkadot.public.curie.radiumblock.co/ws",
|
||||
"Stakeworld": "wss://dot-rpc.stakeworld.io/bridgehub"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": true,
|
||||
"parachain": 1002
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "polkadot_collectives",
|
||||
"display": "Collectives",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://collectives-polkadot-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://polkadot-collectives-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/collectives-polkadot",
|
||||
"IBP2": "wss://collectives-polkadot.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-collectives-polkadot.luckyfriday.io",
|
||||
"OnFinality": "wss://collectives.api.onfinality.io/public-ws",
|
||||
"Parity": "wss://polkadot-collectives-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://collectives.public.curie.radiumblock.co/ws",
|
||||
"Stakeworld": "wss://dot-rpc.stakeworld.io/collectives"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": true,
|
||||
"parachain": 1001
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "polkadot_core_time",
|
||||
"display": "Coretime",
|
||||
"rpcs": {
|
||||
"IBP2": "wss://coretime-polkadot.dotters.network",
|
||||
"Parity": "wss://polkadot-coretime-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": true,
|
||||
"parachain": 1005
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "polkadot_people",
|
||||
"display": "People",
|
||||
"rpcs": {
|
||||
"IBP1": "wss://sys.ibp.network/people-polkadot",
|
||||
"IBP2": "wss://people-polkadot.dotters.network",
|
||||
"LuckyFriday": "wss://rpc-people-polkadot.luckyfriday.io",
|
||||
"Parity": "wss://polkadot-people-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://people-polkadot.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": true,
|
||||
"parachain": 1004
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "DOT",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "acala",
|
||||
"display": "Acala",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2000
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://acala-rpc.dwellir.com",
|
||||
"OnFinality": "wss://acala-polkadot.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "ACA",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "ajuna",
|
||||
"display": "Ajuna Network",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2051
|
||||
},
|
||||
"rpcs": {
|
||||
"AjunaNetwork": "wss://rpc-para.ajuna.network",
|
||||
"IBP1": "wss://ajuna.ibp.network",
|
||||
"IBP2": "wss://ajuna.dotters.network",
|
||||
"OnFinality": "wss://ajuna.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://ajuna.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "AJUN",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "astar",
|
||||
"display": "Astar",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2006
|
||||
},
|
||||
"rpcs": {
|
||||
"Astar": "wss://rpc.astar.network",
|
||||
"Automata 1RPC": "wss://1rpc.io/astr",
|
||||
"Dwellir": "wss://astar-rpc.dwellir.com",
|
||||
"OnFinality": "wss://astar.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://astar.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "ASTR",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "bifrost",
|
||||
"display": "Bifrost",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2030
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://bifrost-polkadot-rpc.dwellir.com",
|
||||
"IBP1": "wss://bifrost-polkadot.ibp.network",
|
||||
"IBP2": "wss://bifrost-polkadot.dotters.network",
|
||||
"Liebi": "wss://hk.p.bifrost-rpc.liebi.com/ws",
|
||||
"LiebiEU": "wss://eu.bifrost-polkadot-rpc.liebi.com/ws",
|
||||
"RadiumBlock": "wss://bifrost.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BNC",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "bitgreen",
|
||||
"display": "Bitgreen",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2048
|
||||
},
|
||||
"rpcs": {
|
||||
"Bitgreen": "wss://mainnet.bitgreen.org"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BBB",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "centrifuge",
|
||||
"display": "Centrifuge",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2031
|
||||
},
|
||||
"rpcs": {
|
||||
"Centrifuge": "wss://fullnode.centrifuge.io",
|
||||
"Dwellir": "wss://centrifuge-rpc.dwellir.com",
|
||||
"LuckyFriday": "wss://rpc-centrifuge.luckyfriday.io",
|
||||
"OnFinality": "wss://centrifuge-parachain.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "CFG",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "crustParachain",
|
||||
"display": "Crust",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2008
|
||||
},
|
||||
"rpcs": {
|
||||
"Crust": "wss://crust-parachain.crustapps.net",
|
||||
"Crust APP": "wss://crust-parachain.crustnetwork.app",
|
||||
"Crust CC": "wss://crust-parachain.crustnetwork.cc",
|
||||
"Crust XYZ": "wss://crust-parachain.crustnetwork.xyz"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "CRU",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "darwinia",
|
||||
"display": "Darwinia",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2046
|
||||
},
|
||||
"rpcs": {
|
||||
"Darwinia": "wss://rpc.darwinia.network",
|
||||
"Dcdao": "wss://darwinia-rpc.dcdao.box",
|
||||
"Dwellir": "wss://darwinia-rpc.dwellir.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "RING",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "frequency",
|
||||
"display": "Frequency",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2091
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://frequency-rpc.dwellir.com",
|
||||
"Frequency 0": "wss://0.rpc.frequency.xyz",
|
||||
"Frequency 1": "wss://1.rpc.frequency.xyz",
|
||||
"OnFinality": "wss://frequency-polkadot.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "FRQCY",
|
||||
"decimals": 8
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "hydradx",
|
||||
"display": "Hydration",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2034
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://hydradx-rpc.dwellir.com",
|
||||
"Galactic Council": "wss://rpc.hydradx.cloud",
|
||||
"Helikon": "wss://rpc.helikon.io/hydradx",
|
||||
"IBP1": "wss://hydradx.paras.ibp.network",
|
||||
"IBP2": "wss://hydration.dotters.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "HDX",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "hyperbridge",
|
||||
"display": "Hyperbridge (Nexus)",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3367
|
||||
},
|
||||
"rpcs": {
|
||||
"BlockOps": "wss://hyperbridge-nexus-rpc.blockops.network",
|
||||
"IBP1": "wss://nexus.ibp.network",
|
||||
"IBP2": "wss://nexus.dotters.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "BRIDGE",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "integritee",
|
||||
"display": "Integritee Network",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3359
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://integritee-rpc.dwellir.com",
|
||||
"Integritee": "wss://polkadot.api.integritee.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "TEER",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "invarch",
|
||||
"display": "Invarch Network",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3340
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://invarch-rpc.dwellir.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "VARCH",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "kilt",
|
||||
"display": "KILT Spiritnet",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2086
|
||||
},
|
||||
"rpcs": {
|
||||
"BOTLabs": "wss://spiritnet.kilt.io/",
|
||||
"Dwellir": "wss://kilt-rpc.dwellir.com",
|
||||
"IBP1": "wss://kilt.ibp.network",
|
||||
"IBP2": "wss://kilt.dotters.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "KILT",
|
||||
"decimals": 15
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "laos",
|
||||
"display": "Laos",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3370
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://laos-rpc.dwellir.com",
|
||||
"freeverse.io": "wss://rpc.laos.laosfoundation.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "LAOS",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "litentry",
|
||||
"display": "Litentry",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2013
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://litentry-rpc.dwellir.com",
|
||||
"Litentry": "wss://rpc.litentry-parachain.litentry.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "LIT",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "logion",
|
||||
"display": "Logion",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3354
|
||||
},
|
||||
"rpcs": {
|
||||
"Logion 1": "wss://para-rpc01.logion.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "LGNT",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "manta",
|
||||
"display": "Manta",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2104
|
||||
},
|
||||
"rpcs": {
|
||||
"Manta Network": "wss://ws.manta.systems"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "MANTA",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "moonbeam",
|
||||
"display": "Moonbeam",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2004
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://moonbeam-rpc.dwellir.com",
|
||||
"IBP1": "wss://moonbeam.ibp.network",
|
||||
"IBP2": "wss://moonbeam.dotters.network",
|
||||
"Moonbeam Foundation": "wss://wss.api.moonbeam.network",
|
||||
"OnFinality": "wss://moonbeam.api.onfinality.io/public-ws",
|
||||
"RadiumBlock": "wss://moonbeam.public.curie.radiumblock.co/ws",
|
||||
"UnitedBloc": "wss://moonbeam.unitedbloc.com",
|
||||
"Allnodes": "wss://moonbeam-rpc.publicnode.com"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "GLMR",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "mythos",
|
||||
"display": "Mythos",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3369
|
||||
},
|
||||
"rpcs": {
|
||||
"parity": "wss://polkadot-mythos-rpc.polkadot.io"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "MYTH",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "neuroweb",
|
||||
"display": "NeuroWeb",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2043
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://neuroweb-rpc.dwellir.com",
|
||||
"TraceLabs": "wss://parachain-rpc.origin-trail.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "NEURO",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "nodle",
|
||||
"display": "Nodle",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2026
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://nodle-rpc.dwellir.com",
|
||||
"OnFinality": "wss://nodle-parachain.api.onfinality.io/public-ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "NODL",
|
||||
"decimals": 11
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "pendulum",
|
||||
"display": "Pendulum",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2094
|
||||
},
|
||||
"rpcs": {
|
||||
"PendulumChain": "wss://rpc-pendulum.prd.pendulumchain.tech"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PEN",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "phala",
|
||||
"display": "Phala Network",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2035
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://phala-rpc.dwellir.com",
|
||||
"Helikon": "wss://rpc.helikon.io/phala",
|
||||
"OnFinality": "wss://phala.api.onfinality.io/public-ws",
|
||||
"Phala": "wss://api.phala.network/ws",
|
||||
"RadiumBlock": "wss://phala.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PHA",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "polimec",
|
||||
"display": "Polimec",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 3344
|
||||
},
|
||||
"rpcs": {
|
||||
"Amforc": "wss://polimec.rpc.amforc.com",
|
||||
"Helikon": "wss://rpc.helikon.io/polimec",
|
||||
"IBP1": "wss://polimec.ibp.network",
|
||||
"IBP2": "wss://polimec.dotters.network",
|
||||
"Polimec Foundation": "wss://rpc.polimec.org"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "PLMC",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "unique",
|
||||
"display": "Unique Network",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2037
|
||||
},
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://unique-rpc.dwellir.com",
|
||||
"Geo Load Balancer": "wss://ws.unique.network",
|
||||
"IBP1": "wss://unique.ibp.network",
|
||||
"IBP2": "wss://unique.dotters.network",
|
||||
"Unique America": "wss://us-ws.unique.network",
|
||||
"Unique Asia": "wss://asia-ws.unique.network",
|
||||
"Unique Europe": "wss://eu-ws.unique.network"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "UNQ",
|
||||
"decimals": 18
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "zeitgeist",
|
||||
"display": "Zeitgeist",
|
||||
"relayChainInfo": {
|
||||
"id": "polkadot",
|
||||
"isSystem": false,
|
||||
"parachain": 2092
|
||||
},
|
||||
"rpcs": {
|
||||
"OnFinality": "wss://zeitgeist.api.onfinality.io/public-ws",
|
||||
"ZeitgeistPM": "wss://main.rpc.zeitgeist.pm/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "ZTG",
|
||||
"decimals": 10
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,123 @@
|
||||
[
|
||||
{
|
||||
"id": "westend",
|
||||
"display": "Westend Relay Chain",
|
||||
"hasChainSpecs": true,
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://westend-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://westend-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://rpc.ibp.network/westend",
|
||||
"IBP2": "wss://westend.dotters.network",
|
||||
"OnFinality": "wss://westend.api.onfinality.io/public-ws",
|
||||
"Parity": "wss://westend-rpc.polkadot.io",
|
||||
"RadiumBlock": "wss://westend.public.curie.radiumblock.co/ws"
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "westend_asset_hub",
|
||||
"display": "AssetHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://asset-hub-westend-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://westmint-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/westmint",
|
||||
"IBP2": "wss://asset-hub-westend.dotters.network",
|
||||
"Parity": "wss://westend-asset-hub-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "westend",
|
||||
"isSystem": true,
|
||||
"parachain": 1000
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "westend_bridge_hub",
|
||||
"display": "BridgeHub",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://bridge-hub-westend-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://westend-bridge-hub-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/bridgehub-westend",
|
||||
"IBP2": "wss://bridge-hub-westend.dotters.network",
|
||||
"Parity": "wss://westend-bridge-hub-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "westend",
|
||||
"isSystem": true,
|
||||
"parachain": 1002
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "westend_collectives",
|
||||
"display": "Collectives",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://collectives-westend-rpc.dwellir.com",
|
||||
"Dwellir Tunisia": "wss://westend-collectives-rpc-tn.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/collectives-westend",
|
||||
"IBP2": "wss://collectives-westend.dotters.network",
|
||||
"Parity": "wss://westend-collectives-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "westend",
|
||||
"isSystem": true,
|
||||
"parachain": 1001
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": true
|
||||
},
|
||||
{
|
||||
"id": "westend_core_time",
|
||||
"display": "Coretime",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://coretime-westend-rpc.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/coretime-westend",
|
||||
"IBP2": "wss://coretime-westend.dotters.network",
|
||||
"Parity": "wss://westend-coretime-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "westend",
|
||||
"isSystem": true,
|
||||
"parachain": 1005
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
},
|
||||
{
|
||||
"id": "westend_people_chain",
|
||||
"display": "People",
|
||||
"rpcs": {
|
||||
"Dwellir": "wss://people-westend-rpc.dwellir.com",
|
||||
"IBP1": "wss://sys.ibp.network/people-westend",
|
||||
"IBP2": "wss://people-westend.dotters.network",
|
||||
"Parity": "wss://westend-people-rpc.polkadot.io"
|
||||
},
|
||||
"relayChainInfo": {
|
||||
"id": "westend",
|
||||
"isSystem": true,
|
||||
"parachain": 1004
|
||||
},
|
||||
"nativeToken": {
|
||||
"symbol": "WND",
|
||||
"decimals": 12
|
||||
},
|
||||
"hasChainSpecs": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,201 @@
|
||||
import { state, withDefault } from "@react-rxjs/core"
|
||||
import { combineKeys, createKeyedSignal } from "@react-rxjs/utils"
|
||||
import { Binary, getSs58AddressInfo } from "polkadot-api"
|
||||
import {
|
||||
connectInjectedExtension,
|
||||
getInjectedExtensions,
|
||||
InjectedExtension,
|
||||
InjectedPolkadotAccount,
|
||||
} from "polkadot-api/pjs-signer"
|
||||
import {
|
||||
catchError,
|
||||
concat,
|
||||
defer,
|
||||
filter,
|
||||
interval,
|
||||
map,
|
||||
NEVER,
|
||||
Observable,
|
||||
of,
|
||||
scan,
|
||||
startWith,
|
||||
switchMap,
|
||||
take,
|
||||
tap,
|
||||
timer,
|
||||
} from "rxjs"
|
||||
|
||||
export const availableExtensions$ = state(
|
||||
concat(
|
||||
timer(0, 100).pipe(
|
||||
map(getInjectedExtensions),
|
||||
filter((v) => v.length > 0),
|
||||
take(1),
|
||||
),
|
||||
interval(2000).pipe(map(getInjectedExtensions)),
|
||||
),
|
||||
[],
|
||||
)
|
||||
|
||||
const [toggleExtension$, onToggleExtension] = createKeyedSignal<string>()
|
||||
export { onToggleExtension }
|
||||
|
||||
export const enum ConnectStatus {
|
||||
Connecting,
|
||||
Disconnected,
|
||||
Connected,
|
||||
}
|
||||
export type ExtensionState =
|
||||
| {
|
||||
type: ConnectStatus.Disconnected
|
||||
}
|
||||
| { type: ConnectStatus.Connecting }
|
||||
| { type: ConnectStatus.Connected; value: InjectedExtension }
|
||||
|
||||
const SELECTED_EXTENSIONS_KEY = "selected-extensions"
|
||||
const getPreselectedExtensions = () => {
|
||||
try {
|
||||
const res = JSON.parse(localStorage.getItem(SELECTED_EXTENSIONS_KEY)!)
|
||||
if (Array.isArray(res)) return res
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (_) {}
|
||||
return null
|
||||
}
|
||||
const extensionIsPreselected = (extension: string) =>
|
||||
getPreselectedExtensions()?.includes(extension) ?? false
|
||||
const setPreselectedExtension = (extension: string, selected: boolean) => {
|
||||
const preselectedExtensions = getPreselectedExtensions() ?? []
|
||||
const result = selected
|
||||
? [...new Set([...preselectedExtensions, extension])]
|
||||
: preselectedExtensions.filter((v) => v !== extension)
|
||||
localStorage.setItem(SELECTED_EXTENSIONS_KEY, JSON.stringify(result))
|
||||
}
|
||||
|
||||
const extension$ = (name: string) => {
|
||||
const connect$ = defer(() => connectInjectedExtension(name)).pipe(
|
||||
map((extension) => ({
|
||||
type: ConnectStatus.Connected as const,
|
||||
extension,
|
||||
})),
|
||||
catchError(() => of({ type: ConnectStatus.Disconnected as const })),
|
||||
startWith({ type: ConnectStatus.Connecting as const }),
|
||||
)
|
||||
|
||||
const connectWithCleanup$ = defer(() => {
|
||||
let disconnected = false
|
||||
let extension: InjectedExtension | null = null
|
||||
return concat(connect$, NEVER).pipe(
|
||||
tap({
|
||||
next(value) {
|
||||
if (value.type === ConnectStatus.Connected) {
|
||||
if (disconnected) {
|
||||
value.extension.disconnect()
|
||||
} else {
|
||||
extension = value.extension
|
||||
}
|
||||
}
|
||||
},
|
||||
unsubscribe() {
|
||||
if (extension) {
|
||||
extension.disconnect()
|
||||
} else {
|
||||
disconnected = true
|
||||
}
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
const initialSelected = extensionIsPreselected(name)
|
||||
return toggleExtension$(name).pipe(
|
||||
scan((acc) => !acc, initialSelected),
|
||||
startWith(initialSelected),
|
||||
switchMap((selected) =>
|
||||
selected
|
||||
? connectWithCleanup$
|
||||
: of({
|
||||
type: ConnectStatus.Disconnected as const,
|
||||
}),
|
||||
),
|
||||
tap((v) => {
|
||||
if (v.type === ConnectStatus.Connected) {
|
||||
setPreselectedExtension(name, true)
|
||||
} else if (v.type === ConnectStatus.Disconnected) {
|
||||
setPreselectedExtension(name, false)
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export const extensions$ = state(combineKeys(availableExtensions$, extension$))
|
||||
|
||||
export const selectedExtensions$ = extensions$.pipeState(
|
||||
map(
|
||||
(extensions) =>
|
||||
new Map(
|
||||
[...extensions.entries()]
|
||||
.filter(([, v]) => v.type !== ConnectStatus.Disconnected)
|
||||
.map(([k, v]) => [
|
||||
k,
|
||||
v.type === ConnectStatus.Connected ? v.extension : null,
|
||||
]),
|
||||
),
|
||||
),
|
||||
withDefault(new Map<string, InjectedExtension | null>()),
|
||||
)
|
||||
|
||||
export const extensionAccounts$ = state(
|
||||
(name: string) =>
|
||||
extension$(name).pipe(
|
||||
switchMap((x) => {
|
||||
if (x.type !== ConnectStatus.Connected) return of([])
|
||||
return new Observable<InjectedPolkadotAccount[]>((observer) =>
|
||||
x.extension.subscribe((accounts) => {
|
||||
observer.next(accounts)
|
||||
}),
|
||||
)
|
||||
}),
|
||||
),
|
||||
[],
|
||||
)
|
||||
|
||||
export const accountsByExtension$ = state(
|
||||
combineKeys(availableExtensions$, extensionAccounts$),
|
||||
new Map<string, InjectedPolkadotAccount[]>(),
|
||||
)
|
||||
|
||||
export const getPublicKey = (address: string) => {
|
||||
const info = getSs58AddressInfo(address)
|
||||
return info.isValid ? info.publicKey : null
|
||||
}
|
||||
export const getAccountMapKey = (address: string) => {
|
||||
const pk = getPublicKey(address)
|
||||
return pk ? Binary.fromBytes(pk).asHex() : address
|
||||
}
|
||||
|
||||
export const accounts$ = state(
|
||||
accountsByExtension$.pipe(
|
||||
map(
|
||||
(extensionAccounts) =>
|
||||
new Map(
|
||||
Array.from(extensionAccounts.entries()).flatMap(
|
||||
([extension, accounts]) =>
|
||||
accounts.map((account) => [
|
||||
getAccountMapKey(account.address),
|
||||
{
|
||||
...account,
|
||||
extension,
|
||||
},
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
new Map<string, InjectedPolkadotAccount & { extension: string }>(),
|
||||
)
|
||||
|
||||
export const accountDetail$ = state(
|
||||
(account: string) =>
|
||||
accounts$.pipe(map((v) => v.get(getAccountMapKey(account)) ?? null)),
|
||||
null,
|
||||
)
|
||||
@@ -0,0 +1,76 @@
|
||||
import {
|
||||
IdentityData,
|
||||
IdentityJudgement,
|
||||
polkadot_people,
|
||||
} from "@polkadot-api/descriptors"
|
||||
import { state } from "@react-rxjs/core"
|
||||
import { Binary, createClient, SS58String } from "polkadot-api"
|
||||
import { chainSpec } from "./chains/chainspecs/polkadot_people"
|
||||
import { catchError, map, of, tap } from "rxjs"
|
||||
import { getProvider } from "./chains/chain.state"
|
||||
import { localStorageSubject } from "@/utils/localStorageSubject"
|
||||
|
||||
export interface Identity {
|
||||
displayName: string
|
||||
judgments: Array<{
|
||||
registrar: number
|
||||
judgement: IdentityJudgement["type"]
|
||||
}>
|
||||
}
|
||||
export const isVerified = (identity: Identity | null) =>
|
||||
identity?.judgments.some((j) => j.judgement === "Reasonable")
|
||||
|
||||
const cache = localStorageSubject<Record<string, Identity>>(
|
||||
"identity-cache",
|
||||
JSON,
|
||||
{},
|
||||
)
|
||||
|
||||
const client = createClient(
|
||||
getProvider({
|
||||
id: "polkadot_people",
|
||||
type: "chainSpec",
|
||||
value: {
|
||||
chainSpec,
|
||||
relayChain: "polkadot",
|
||||
},
|
||||
}),
|
||||
)
|
||||
const typedApi = client.getTypedApi(polkadot_people)
|
||||
|
||||
export const identity$ = state(
|
||||
(address: SS58String) =>
|
||||
typedApi.query.Identity.IdentityOf.watchValue(address).pipe(
|
||||
map((res): Identity | null => {
|
||||
const displayName = res && readIdentityData(res[0].info.display)
|
||||
return displayName
|
||||
? {
|
||||
displayName: displayName.asText(),
|
||||
judgments: res[0].judgements.map(([registrar, judgement]) => ({
|
||||
registrar,
|
||||
judgement: judgement.type,
|
||||
})),
|
||||
}
|
||||
: null
|
||||
}),
|
||||
tap((v) =>
|
||||
cache.setValue((c) => {
|
||||
if (v) {
|
||||
return { ...c, [address]: v }
|
||||
} else {
|
||||
delete c[address]
|
||||
return c
|
||||
}
|
||||
}),
|
||||
),
|
||||
catchError(() => of(null)),
|
||||
),
|
||||
(address) => cache.getValue()[address] ?? null,
|
||||
)
|
||||
|
||||
const readIdentityData = (identityData: IdentityData): Binary | null => {
|
||||
if (identityData.type === "None" || identityData.type === "Raw0") return null
|
||||
if (identityData.type === "Raw1")
|
||||
return Binary.fromBytes(new Uint8Array(identityData.value))
|
||||
return identityData.value
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
import { state, withDefault } from "@react-rxjs/core"
|
||||
import { createSignal } from "@react-rxjs/utils"
|
||||
import { WalletConnectModal } from "@walletconnect/modal"
|
||||
import { SessionTypes } from "@walletconnect/types"
|
||||
import UniversalProvider from "@walletconnect/universal-provider"
|
||||
import { getSdkError } from "@walletconnect/utils"
|
||||
import {
|
||||
getPolkadotSignerFromPjs,
|
||||
PolkadotSigner,
|
||||
} from "polkadot-api/pjs-signer"
|
||||
import {
|
||||
catchError,
|
||||
defer,
|
||||
EMPTY,
|
||||
filter,
|
||||
finalize,
|
||||
firstValueFrom,
|
||||
from,
|
||||
fromEventPattern,
|
||||
ignoreElements,
|
||||
map,
|
||||
Observable,
|
||||
of,
|
||||
scan,
|
||||
startWith,
|
||||
switchMap,
|
||||
take,
|
||||
takeUntil,
|
||||
tap,
|
||||
} from "rxjs"
|
||||
import { localStorageSubject } from "./utils/localStorageSubject"
|
||||
|
||||
// https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide
|
||||
const chains = [
|
||||
"polkadot:91b171bb158e2d3848fa23a9f1c25182", // Polkadot
|
||||
"polkadot:e143f23803ac50e8f6f8e62695d1ce9e", // Westend
|
||||
]
|
||||
const projectId = import.meta.env.VITE_REOWN_PROJECT_ID
|
||||
const walletConnectModal = new WalletConnectModal({
|
||||
projectId,
|
||||
chains,
|
||||
})
|
||||
|
||||
const provider$ = state(
|
||||
defer(() =>
|
||||
UniversalProvider.init({
|
||||
projectId,
|
||||
relayUrl: "wss://relay.walletconnect.com",
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
interface InitializedSession {
|
||||
uri?: string
|
||||
approval: () => Promise<SessionTypes.Struct>
|
||||
}
|
||||
const initializeSession$ = () =>
|
||||
provider$.pipe(
|
||||
take(1),
|
||||
switchMap(
|
||||
(provider): Promise<InitializedSession> =>
|
||||
provider.client.connect({
|
||||
requiredNamespaces: {
|
||||
polkadot: {
|
||||
methods: ["polkadot_signTransaction", "polkadot_signMessage"],
|
||||
chains,
|
||||
events: ["chainChanged", "accountsChanged"],
|
||||
},
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
const sessionSubject = localStorageSubject<SessionTypes.Struct>(
|
||||
"wallet-connect",
|
||||
JSON,
|
||||
)
|
||||
|
||||
type WalletConnectStatus =
|
||||
| {
|
||||
type: "disconnected"
|
||||
}
|
||||
| {
|
||||
type: "connecting"
|
||||
}
|
||||
| {
|
||||
type: "connected"
|
||||
session: SessionTypes.Struct
|
||||
}
|
||||
|
||||
const connect$ = defer(initializeSession$).pipe(
|
||||
switchMap(({ uri, approval }) => {
|
||||
if (!uri) return approval()
|
||||
|
||||
walletConnectModal.openModal({ uri })
|
||||
const modal$ = fromEventPattern<{ open: boolean }>(
|
||||
(handler) => walletConnectModal.subscribeModal(handler),
|
||||
(_, fn) => fn(),
|
||||
)
|
||||
const closed$ = modal$.pipe(
|
||||
tap((v) => console.log("modal event", v)),
|
||||
filter(({ open }) => !open),
|
||||
)
|
||||
|
||||
return from(approval()).pipe(
|
||||
takeUntil(closed$),
|
||||
finalize(() => walletConnectModal.closeModal()),
|
||||
)
|
||||
}),
|
||||
map((session): WalletConnectStatus => ({ type: "connected", session })),
|
||||
catchError((err) => {
|
||||
console.log("connect WalletConnect error", err)
|
||||
return of(EMPTY) as any as Observable<WalletConnectStatus>
|
||||
}),
|
||||
startWith({ type: "connecting" } satisfies WalletConnectStatus),
|
||||
)
|
||||
const disconnect$ = provider$.pipe(
|
||||
take(1),
|
||||
switchMap((provider) =>
|
||||
provider.session
|
||||
? provider.client.disconnect({
|
||||
topic: provider.session.topic,
|
||||
reason: getSdkError("USER_DISCONNECTED"),
|
||||
})
|
||||
: EMPTY,
|
||||
),
|
||||
ignoreElements(),
|
||||
startWith({
|
||||
type: "disconnected",
|
||||
} satisfies WalletConnectStatus),
|
||||
)
|
||||
|
||||
export const [toggleConnect$, toggleWalletConnect] = createSignal<void>()
|
||||
|
||||
export const walletConnectStatus$ = state(
|
||||
sessionSubject.stream$.pipe(
|
||||
take(1),
|
||||
switchMap((session): Observable<WalletConnectStatus> => {
|
||||
const connectState$ = toggleConnect$.pipe(
|
||||
scan((acc) => !acc, !!session),
|
||||
switchMap((connect) =>
|
||||
connect
|
||||
? connect$.pipe(
|
||||
tapOnLast((v) => {
|
||||
// hack! if connect$ didn't actually complete, toggle it off
|
||||
if (v?.type !== "connected") {
|
||||
toggleWalletConnect()
|
||||
}
|
||||
}),
|
||||
)
|
||||
: disconnect$,
|
||||
),
|
||||
tap((v) => {
|
||||
if (v.type === "connected") {
|
||||
sessionSubject.setValue(v.session)
|
||||
} else {
|
||||
sessionSubject.clear()
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
return connectState$.pipe(
|
||||
startWith(
|
||||
(session
|
||||
? {
|
||||
type: "connected",
|
||||
session,
|
||||
}
|
||||
: {
|
||||
type: "disconnected",
|
||||
}) satisfies WalletConnectStatus,
|
||||
),
|
||||
)
|
||||
}),
|
||||
),
|
||||
{
|
||||
type: "disconnected",
|
||||
},
|
||||
)
|
||||
|
||||
const getAccounts = (session: SessionTypes.Struct) =>
|
||||
Object.values(session.namespaces)
|
||||
.map((namespace) => namespace.accounts)
|
||||
.flat()
|
||||
.map((wcAccount) => wcAccount.split(":")[2])
|
||||
|
||||
const getSigner = (session: SessionTypes.Struct, address: string) =>
|
||||
getPolkadotSignerFromPjs(
|
||||
address,
|
||||
async (transactionPayload) => {
|
||||
const provider = await firstValueFrom(provider$)
|
||||
|
||||
console.log("Topic to check chainId below", session.topic)
|
||||
|
||||
return provider.client.request({
|
||||
topic: session.topic,
|
||||
chainId: `polkadot:${transactionPayload.genesisHash.substring(2, 34)}`,
|
||||
request: {
|
||||
method: "polkadot_signTransaction",
|
||||
params: {
|
||||
address,
|
||||
transactionPayload,
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
async ({ address, data }) => {
|
||||
const provider = await firstValueFrom(provider$)
|
||||
|
||||
// const chainId = provider.session.topic.split(":")[1];
|
||||
const chainId = session.topic.split(":")[1]
|
||||
|
||||
return provider.client.request({
|
||||
topic: session.topic,
|
||||
chainId: `polkadot:${chainId}`,
|
||||
request: {
|
||||
method: "polkadot_signMessage",
|
||||
params: {
|
||||
address,
|
||||
message: data,
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
const getSignersFromSession = (
|
||||
session: SessionTypes.Struct,
|
||||
): Record<string, PolkadotSigner> => {
|
||||
const accounts = getAccounts(session)
|
||||
return Object.fromEntries(
|
||||
accounts.map((address) => [address, getSigner(session, address)]),
|
||||
)
|
||||
}
|
||||
|
||||
export const walletConnectAccounts$ = walletConnectStatus$.pipeState(
|
||||
map((status) =>
|
||||
status.type === "connected" ? getSignersFromSession(status.session) : {},
|
||||
),
|
||||
withDefault({} as Record<string, PolkadotSigner>),
|
||||
)
|
||||
|
||||
const tapOnLast =
|
||||
<T>(onLast: (value: T | null) => void) =>
|
||||
(source$: Observable<T>) =>
|
||||
defer(() => {
|
||||
let value: T | null = null
|
||||
return source$.pipe(
|
||||
tap({
|
||||
next(v) {
|
||||
value = v
|
||||
},
|
||||
complete() {
|
||||
onLast(value)
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user