1
1
---
2
2
import { ChainConfig } from " @config/data/ccip/types"
3
3
import { loadReferenceData , Environment , Version } from " @config/data/ccip/"
4
- import { SupportedChain } from " @config"
5
4
import { Address , CopyText , Accordion } from " @components"
6
5
import {
7
6
getTitle ,
@@ -15,19 +14,23 @@ import LaneConfig from "./LaneConfig.astro"
15
14
16
15
type ConfigProps = {
17
16
chainConfig: ChainConfig
18
- sourceChain: SupportedChain // key in SupportedChain
19
17
sourceChainRefId: string // id in reference directory
20
18
environment: Environment
21
19
version: Version
22
20
}
23
21
24
- const { chainConfig, sourceChain, environment, sourceChainRefId, version } = Astro .props as ConfigProps
22
+ const { chainConfig, environment, sourceChainRefId, version } = Astro .props as ConfigProps
25
23
const { router, chainSelector, feeTokens } = chainConfig
26
- const explorerUrl = getExplorer (sourceChain )
27
- if (! explorerUrl ) throw Error (` Explorer url not found for ${sourceChain } ` )
24
+ const sourceChainKey = directoryToSupportedChain (sourceChainRefId )
25
+ const sourceChainTitle = getTitle (sourceChainKey )
26
+ if (! sourceChainTitle ) throw Error (` Title not found for chain ${sourceChainKey } ` )
27
+ const sourceChainIcon = getChainIcon (sourceChainKey )
28
+ if (! sourceChainIcon ) throw Error (` Icon not found for chain ${sourceChainKey } ` )
29
+ const explorerUrl = getExplorer (sourceChainKey )
30
+ if (! explorerUrl ) throw Error (` Explorer url not found for ${sourceChainKey } ` )
28
31
const routerExplorerUrl = getExplorerAddressUrl (explorerUrl )(router )
29
- const nativeCurrency = getNativeCurrency (sourceChain )
30
- if (! nativeCurrency ) throw Error (` Native currency not found for ${sourceChain } ` )
32
+ const nativeCurrency = getNativeCurrency (sourceChainKey )
33
+ if (! nativeCurrency ) throw Error (` Native currency not found for ${sourceChainKey } ` )
31
34
// sort tokens - LINK first
32
35
feeTokens .sort ((feeToken1 , feeToken2 ) => {
33
36
if (feeToken1 === " LINK" ) {
@@ -68,11 +71,11 @@ const laneReferenceData = loadReferenceData({ environment, version }).lanesRefer
68
71
<td ><Address contractUrl ={ routerExplorerUrl } /></td >
69
72
</tr >
70
73
<tr >
71
- <td >Chain Selector </td >
74
+ <td >Chain selector </td >
72
75
<td ><CopyText text ={ chainSelector } code /></td >
73
76
</tr >
74
77
<tr >
75
- <td >Supported Fee tokens</td >
78
+ <td >Supported fee tokens</td >
76
79
<td >
77
80
<table >
78
81
<tbody >
@@ -89,7 +92,10 @@ const laneReferenceData = loadReferenceData({ environment, version }).lanesRefer
89
92
</tr >
90
93
))
91
94
}
92
- <tr ><td >{ nativeCurrency .symbol } </td ></tr >
95
+ <tr >
96
+ <td >{ nativeCurrency .symbol } </td >
97
+ <td >Native gas token</td >
98
+ </tr >
93
99
</tbody >
94
100
</table >
95
101
</td >
@@ -100,35 +106,36 @@ const laneReferenceData = loadReferenceData({ environment, version }).lanesRefer
100
106
101
107
{
102
108
Object .entries (laneReferenceData ).map (([destinationChainRefId , laneConfig ], index ) => {
103
- const chainKey = directoryToSupportedChain (destinationChainRefId )
104
- const chainTitle = getTitle (chainKey )
105
- if (! chainTitle ) throw Error (` Title not found for chain ${chainKey } ` )
106
- const chainIcon = getChainIcon (chainKey )
107
- if (! chainIcon ) throw Error (` Icon not found for chain ${chainKey } ` )
108
- const sourceChainKey = directoryToSupportedChain ( sourceChainRefId )
109
- const sourceChainTitle = getTitle ( sourceChainKey )
110
- if ( ! sourceChainTitle ) throw Error ( ` Title not found for chain ${ sourceChainKey } ` )
111
- const sourceChainIcon = getChainIcon ( sourceChainKey )
112
- if (! sourceChainIcon ) throw Error (` Icon not found for chain ${sourceChainKey }` )
113
- const id = ` ${ sourceChain }-${ chainKey } ` . replace ( / _ / g , " - " ). toLowerCase ()
109
+ const destinationChainKey = directoryToSupportedChain (destinationChainRefId )
110
+ const destinationChainTitle = getTitle (destinationChainKey )
111
+ if (! destinationChainTitle ) throw Error (` Title not found for chain ${destinationChainKey } ` )
112
+ const destinationChainIcon = getChainIcon (destinationChainKey )
113
+ if (! destinationChainIcon ) throw Error (` Icon not found for chain ${destinationChainKey } ` )
114
+ const id = ` ${ sourceChainKey }-${ destinationChainKey } ` . replace ( / _ / g , " - " ). toLowerCase ( )
115
+ const destinationChainSelector = loadReferenceData ({ environment , version }). chainsReferenceData [
116
+ destinationChainRefId
117
+ ]. chainSelector
118
+ if (! destinationChainSelector ) throw Error (` Chain selector not found for chain ${destinationChainKey }` )
119
+
114
120
return (
115
121
<>
116
- <Accordion title = { ` From ${sourceChainTitle } to ${chainTitle } ` } contentReference = { id } >
122
+ <Accordion title = { ` From ${sourceChainTitle } to ${destinationChainTitle } ` } contentReference = { id } >
117
123
<div slot = " title" style = " display: flex; align-items: center;" >
118
124
<div class = " logo-title-container" >
119
125
<img src = { sourceChainIcon } class = " logo-image" />
120
126
<span >{ sourceChainTitle } </span >
121
127
</div >
122
128
<span class = " arrow" >➡️</span >
123
129
<div class = " logo-title-container" >
124
- <img src = { chainIcon } class = " logo-image" />
125
- <span >{ chainTitle } </span >
130
+ <img src = { destinationChainIcon } class = " logo-image" />
131
+ <span >{ destinationChainTitle } </span >
126
132
</div >
127
133
</div >
128
134
<LaneConfig
129
135
laneConfig = { laneConfig }
130
- sourceChain = { sourceChain }
136
+ sourceChain = { sourceChainKey }
131
137
sourceChainRefId = { sourceChainRefId }
138
+ destinationChainSelector = { destinationChainSelector }
132
139
environment = { environment }
133
140
version = { version }
134
141
/>
0 commit comments