Adjust teleport Ids (#8202)

* Adjust teleport Ids

* Auto-extract teleport ids
This commit is contained in:
Jaco 2022-10-04 12:42:27 +03:00 committed by GitHub
parent 5525e4b3c0
commit 10b12267e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 4 deletions

View File

@ -4,6 +4,7 @@
import type { EndpointOption } from './types';
import { KUSAMA_GENESIS } from '../api/constants';
import { getTeleports } from './util';
/* eslint-disable sort-keys */
@ -542,7 +543,7 @@ export const prodRelayKusama: EndpointOption = {
// NOTE: Keep this as the last entry, nothing after it
'light client': 'light://substrate-connect/kusama' // NOTE: Keep last
},
teleport: [1000, 1001],
teleport: getTeleports(prodParasKusamaCommon),
linked: [
...prodParasKusamaCommon,
...prodParasKusama

View File

@ -4,6 +4,7 @@
import type { EndpointOption } from './types';
import { POLKADOT_GENESIS } from '../api/constants';
import { getTeleports } from './util';
/* eslint-disable sort-keys */
@ -417,7 +418,7 @@ export const prodRelayPolkadot: EndpointOption = {
// NOTE: Keep this as the last entry, nothing after it
'light client': 'light://substrate-connect/polkadot' // NOTE: Keep last
},
teleport: [1000],
teleport: getTeleports(prodParasPolkadotCommon),
linked: [
...prodParasPolkadotCommon,
...prodParasPolkadot

View File

@ -4,6 +4,7 @@
import type { EndpointOption } from './types';
import { ROCOCO_GENESIS } from '../api/constants';
import { getTeleports } from './util';
/* eslint-disable sort-keys */
@ -406,7 +407,7 @@ export const testRelayRococo: EndpointOption = {
// NOTE: Keep this as the last entry, nothing after it
'light client': 'light://substrate-connect/rococo' // NOTE: Keep last
},
teleport: [1000, 1002],
teleport: getTeleports(testParasRococoCommon),
linked: [
...testParasRococoCommon,
...testParasRococo

View File

@ -4,6 +4,7 @@
import type { EndpointOption } from './types';
import { WESTEND_GENESIS } from '../api/constants';
import { getTeleports } from './util';
/* eslint-disable sort-keys */
@ -141,7 +142,7 @@ export const testRelayWestend: EndpointOption = {
// NOTE: Keep this as the last entry, nothing after it
'light client': 'light://substrate-connect/westend' // NOTE: Keep last
},
teleport: [1000, 1002],
teleport: getTeleports(testParasWestendCommon),
linked: [
...testParasWestendCommon,
...testParasWestend

View File

@ -108,3 +108,10 @@ export function expandEndpoints (t: TFunction, input: EndpointOption[], firstOnl
.reduce((all: LinkOption[], e) =>
all.concat(expandEndpoint(t, e, firstOnly, withSort)), []);
}
export function getTeleports (input: EndpointOption[]): number[] {
return input
.filter(({ teleport }) => !!teleport && teleport[0] === -1)
.map(({ paraId }) => paraId)
.filter((id): id is number => !!id);
}