Teleport Feature Enhancement (#11699)

* feat: teleport support enhancement for paseo

* feat: allow relay to bridge hub teleport

* feat: allow teleport for all system chains from assethub westend

* feat: added support from system chains to asset hub

* feat: allow teleport to kusama system chains

* feat: allow teleport to polkadot system chains

* fix: upgraded XCM version to V4 and fix multilocations
This commit is contained in:
Arjun Porwal 2025-07-23 17:32:46 +05:30 committed by GitHub
parent 0db7d32800
commit e9d8a5ee96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 57 additions and 42 deletions

View File

@ -893,7 +893,7 @@ export const prodParasKusamaCommon: EndpointOption[] = [
Stakeworld: 'wss://ksm-rpc.stakeworld.io/assethub'
},
relayName: 'kusama',
teleport: [-1],
teleport: [-1, 1002, 1005, 1001, 1004],
text: 'AssetHub',
ui: {
color: '#113911',
@ -916,7 +916,7 @@ export const prodParasKusamaCommon: EndpointOption[] = [
Stakeworld: 'wss://ksm-rpc.stakeworld.io/bridgehub'
},
relayName: 'kusama',
teleport: [-1],
teleport: [-1, 1000],
text: 'BridgeHub',
ui: {
logo: nodesBridgeHubBlackSVG
@ -936,7 +936,7 @@ export const prodParasKusamaCommon: EndpointOption[] = [
Stakeworld: 'wss://ksm-rpc.stakeworld.io/coretime'
},
relayName: 'kusama',
teleport: [-1],
teleport: [-1, 1000],
text: 'Coretime',
ui: {
color: '#113911',
@ -958,7 +958,7 @@ export const prodParasKusamaCommon: EndpointOption[] = [
// Stakeworld: 'wss://ksm-rpc.stakeworld.io/encointer'
},
relayName: 'kusama',
teleport: [-1],
teleport: [-1, 1000],
text: 'Encointer Network',
ui: {
color: '#0000cc',
@ -981,7 +981,7 @@ export const prodParasKusamaCommon: EndpointOption[] = [
Stakeworld: 'wss://ksm-rpc.stakeworld.io/people'
},
relayName: 'kusama',
teleport: [-1],
teleport: [-1, 1000],
text: 'People',
ui: {
color: '#36454F',

View File

@ -909,7 +909,7 @@ export const prodParasPolkadotCommon: EndpointOption[] = [
Stakeworld: 'wss://dot-rpc.stakeworld.io/assethub'
},
relayName: 'polkadot',
teleport: [-1],
teleport: [-1, 1002, 1001, 1005, 1004],
text: 'AssetHub',
ui: {
color: '#86e62a',
@ -932,7 +932,7 @@ export const prodParasPolkadotCommon: EndpointOption[] = [
Stakeworld: 'wss://dot-rpc.stakeworld.io/bridgehub'
},
relayName: 'polkadot',
teleport: [-1],
teleport: [-1, 1000],
text: 'BridgeHub',
ui: {
logo: nodesBridgeHubSVG
@ -954,7 +954,7 @@ export const prodParasPolkadotCommon: EndpointOption[] = [
Stakeworld: 'wss://dot-rpc.stakeworld.io/collectives'
},
relayName: 'polkadot',
teleport: [-1],
teleport: [-1, 1000],
text: 'Collectives',
ui: {
color: '#e6777a',
@ -975,7 +975,7 @@ export const prodParasPolkadotCommon: EndpointOption[] = [
Stakeworld: 'wss://dot-rpc.stakeworld.io/coretime'
},
relayName: 'polkadot',
teleport: [-1],
teleport: [-1, 1000],
text: 'Coretime',
ui: {}
},
@ -995,7 +995,7 @@ export const prodParasPolkadotCommon: EndpointOption[] = [
Stakeworld: 'wss://dot-rpc.stakeworld.io/people'
},
relayName: 'polkadot',
teleport: [-1],
teleport: [-1, 1000],
text: 'People',
ui: {
color: '#e84366',

View File

@ -423,7 +423,7 @@ export const testParasPaseoCommon: EndpointOption[] = [
TurboFlakes: 'wss://sys.turboflakes.io/asset-hub-paseo'
},
relayName: 'paseo',
teleport: [-1],
teleport: [-1, 1002, 1111],
text: 'AssetHub',
ui: {
color: '#77bb77',
@ -439,7 +439,7 @@ export const testParasPaseoCommon: EndpointOption[] = [
IBP2: 'wss://bridge-hub-paseo.dotters.network'
},
relayName: 'paseo',
teleport: [-1],
teleport: [-1, 1000],
text: 'BridgeHub',
ui: {
color: '#AAADD7',
@ -473,7 +473,7 @@ export const testParasPaseoCommon: EndpointOption[] = [
Parity: 'wss://testnet-passet-hub.polkadot.io'
},
relayName: 'paseo',
teleport: [-1],
teleport: [-1, 1000],
text: 'PAssetHub - Contracts',
ui: {
color: '#77bb77',

View File

@ -137,7 +137,7 @@ export const testParasWestendCommon: EndpointOption[] = [
// Stakeworld: 'wss://wnd-rpc.stakeworld.io/assethub'
},
relayName: 'westend',
teleport: [-1],
teleport: [-1, 1002, 1001, 1005, 1004],
text: 'AssetHub',
ui: {
color: '#77bb77',
@ -155,6 +155,7 @@ export const testParasWestendCommon: EndpointOption[] = [
Parity: 'wss://westend-bridge-hub-rpc.polkadot.io'
},
relayName: 'westend',
teleport: [-1, 1000],
text: 'BridgeHub',
ui: {
logo: nodesBridgeHubSVG
@ -170,7 +171,7 @@ export const testParasWestendCommon: EndpointOption[] = [
Parity: 'wss://westend-collectives-rpc.polkadot.io'
},
relayName: 'westend',
teleport: [-1],
teleport: [-1, 1000],
text: 'Collectives',
ui: {
color: '#e6777a',
@ -186,7 +187,7 @@ export const testParasWestendCommon: EndpointOption[] = [
Parity: 'wss://westend-coretime-rpc.polkadot.io'
},
relayName: 'westend',
teleport: [-1],
teleport: [-1, 1000],
text: 'Coretime',
ui: {
color: '#f19135'
@ -202,7 +203,7 @@ export const testParasWestendCommon: EndpointOption[] = [
Parity: 'wss://westend-people-rpc.polkadot.io'
},
relayName: 'westend',
teleport: [-1],
teleport: [-1, 1000],
text: 'People',
ui: {
color: '#ec03fc',

View File

@ -23,6 +23,36 @@ interface Props {
const INVALID_PARAID = Number.MAX_SAFE_INTEGER;
const XCM_LOC = ['xcm', 'xcmPallet', 'polkadotXcm'];
function getDestMultilocation (isParaTeleport: boolean | undefined, recipientParaId: number) {
if (isParaTeleport) {
if (recipientParaId === -1) { // para -> relay
return {
interior: 'Here',
parents: 1
};
} else { // para -> para
return {
interior: {
X1: [{
ParaChain: recipientParaId
}]
},
parents: 1
};
}
}
// relay -> para
return {
interior: {
X1: [{
ParaChain: recipientParaId
}]
},
parents: 0
};
}
function createOption ({ paraId, text, ui }: LinkOption): Option {
return {
text: (
@ -79,46 +109,30 @@ function Teleport ({ onClose }: Props): React.ReactElement<Props> | null {
const params = useMemo(
() => [
{ V4: getDestMultilocation(isParaTeleport, recipientParaId) },
{
V3: isParaTeleport
? {
interior: 'Here',
parents: 1
}
: {
interior: {
X1: {
ParaChain: recipientParaId
}
},
parents: 0
}
},
{
V3: {
V4: {
interior: {
X1: {
X1: [{
AccountId32: {
id: api.createType('AccountId32', recipientId).toHex(),
network: null
}
}
}]
},
parents: 0
}
},
{
V3: [{
V4: [{
fun: {
Fungible: amount
},
id: {
Concrete: {
interior: 'Here',
parents: isParaTeleport
? 1
: 0
}
interior: 'Here',
parents: isParaTeleport
? 1
: 0
}
}]
},