Skip to content

Commit 99e9628

Browse files
authored
CCIP integration (#1431)
* feat: added mainnet configuration * feat: updatated EvmNativeToken.vue * fix: refactoring * fix: updated styling * feat: updated chain information * fix: updated ccipBridgeEnabled condition
1 parent 1b264eb commit 99e9628

File tree

18 files changed

+155
-91
lines changed

18 files changed

+155
-91
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ astar-collator
5353

5454
# Chopstick binaries
5555
db.sqlite*
56-
.vercel
56+
.vercel

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"@types/validator": "^13.7.11",
118118
"@typescript-eslint/eslint-plugin": "^4.16.1",
119119
"@typescript-eslint/parser": "^4.16.1",
120+
"dotenv": "^16.4.7",
120121
"eslint": "^7.14.0",
121122
"eslint-config-prettier": "^8.1.0",
122123
"eslint-plugin-jest": "^25.2.2",

quasar.conf.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const { configure } = require('quasar/wrappers');
1212
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
1313
const ESLintPlugin = require('eslint-webpack-plugin');
1414
const path = require('path');
15+
require('dotenv').config()
16+
1517

1618
module.exports = configure(function (ctx) {
1719
return {
@@ -53,7 +55,10 @@ module.exports = configure(function (ctx) {
5355
// Full list of options: https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
5456
build: {
5557
vueRouterMode: 'history', // available values: 'hash', 'history'
56-
58+
// Memo: Create .env file in root directory to set environment variables
59+
// env: {
60+
// SONEIUM_CCIP_ROUTER:process.env.SONEIUM_CCIP_ROUTER,
61+
// },
5762
// transpile: false,
5863

5964
// Add dependencies for transpiling with Babel (Array of string/regex)
Lines changed: 4 additions & 0 deletions
Loading

src/components/assets/EvmNativeToken.vue

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,30 @@
4545

4646
<div class="box--ccip">
4747
<custom-router-link
48-
v-if="isShibuyaEvm"
48+
v-if="isShibuyaEvm || isAstarEvm"
4949
:to="buildCcipBridgePageLink()"
50-
:is-disabled="!ccipMinatoBridgeEnabled"
50+
:is-disabled="!isEnableCcipBridge"
5151
>
52-
<button class="btn btn--icon">
52+
<button
53+
v-if="width >= screenSize.sm"
54+
class="btn btn--icon"
55+
@mouseover="isSoneiumButtonHover = true"
56+
@mouseleave="isSoneiumButtonHover = false"
57+
>
5358
<img
5459
class="img--logo-soneium"
55-
:src="require('src/assets/img/chain/soneium-color.svg')"
60+
:src="
61+
isSoneiumButtonHover
62+
? require('src/assets/img/chain/soneium-white.svg')
63+
: require('src/assets/img/chain/soneium-color.svg')
64+
"
65+
alt="soneium"
66+
/>
67+
</button>
68+
<button v-else class="btn btn--icon">
69+
<img
70+
class="img--logo-soneium"
71+
:src="require('src/assets/img/chain/soneium-white.svg')"
5672
alt="soneium"
5773
/>
5874
</button>
@@ -78,9 +94,9 @@
7894
:is-disabled="!layerZeroBridgeEnabled"
7995
>
8096
<button class="btn btn--icon"><astar-icon-bridge /></button>
81-
<span class="text--mobile-menu">{{ $t('assets.bridge') }}</span>
97+
<span class="text--mobile-menu">{{ $t('assets.bridgeToZkEvm') }}</span>
8298
<q-tooltip>
83-
<span class="text--tooltip">{{ $t('assets.bridge') }}</span>
99+
<span class="text--tooltip">{{ $t('assets.bridgeToZkEvm') }}</span>
84100
</q-tooltip>
85101
</custom-router-link>
86102

@@ -144,7 +160,12 @@ import { cbridgeAppLink } from 'src/c-bridge';
144160
import ModalFaucet from 'src/components/assets/modals/ModalFaucet.vue';
145161
import Balloon from 'src/components/common/Balloon.vue';
146162
import { LOCAL_STORAGE } from 'src/config/localStorage';
147-
import { ccipMinatoBridgeEnabled, layerZeroBridgeEnabled, nativeBridgeEnabled } from 'src/features';
163+
import {
164+
ccipMinatoBridgeEnabled,
165+
layerZeroBridgeEnabled,
166+
nativeBridgeEnabled,
167+
ccipSoneiumBridgeEnabled,
168+
} from 'src/features';
148169
import { useAccount, useBreakpoints, useFaucet, useNetworkInfo } from 'src/hooks';
149170
import { faucetSethLink } from 'src/links';
150171
import { getTokenImage } from 'src/modules/token';
@@ -156,6 +177,7 @@ import {
156177
} from 'src/router/routes';
157178
import { useStore } from 'src/store';
158179
import { computed, defineComponent, ref, watch, watchEffect } from 'vue';
180+
159181
import CustomRouterLink from '../common/CustomRouterLink.vue';
160182
161183
export default defineComponent({
@@ -177,8 +199,9 @@ export default defineComponent({
177199
178200
const isCcipBalloon = ref<boolean>(false);
179201
const isBalloonClosing = ref<boolean>(false);
202+
const isSoneiumButtonHover = ref<boolean>(false);
180203
181-
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isAstar, isShibuyaEvm } =
204+
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isAstar, isShibuyaEvm, isAstarEvm } =
182205
useNetworkInfo();
183206
184207
const closeCcipBalloon = () => {
@@ -229,16 +252,34 @@ export default defineComponent({
229252
230253
const isTruncate = !nativeTokenSymbol.value.toUpperCase().includes('BTC');
231254
255+
const isEnableCcipBridge = computed<boolean>(() => {
256+
return (
257+
(isShibuyaEvm.value && ccipMinatoBridgeEnabled) ||
258+
(isAstarEvm.value && ccipSoneiumBridgeEnabled)
259+
);
260+
});
261+
232262
// Memo: display the balloon animation
233263
watch(
234-
[isShibuyaEvm],
264+
[isShibuyaEvm, isAstarEvm],
235265
async () => {
236-
const isBallonDisplayed = Boolean(localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA));
237-
if (isShibuyaEvm.value && !isBallonDisplayed) {
266+
const isBallonShibuyaDisplayed = Boolean(
267+
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA)
268+
);
269+
const isBallonAstarDisplayed = Boolean(
270+
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR)
271+
);
272+
if (isShibuyaEvm.value && !isBallonShibuyaDisplayed) {
238273
await wait(1000);
239274
isCcipBalloon.value = true;
240275
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA, 'true');
241276
}
277+
278+
if (isAstarEvm.value && !isBallonAstarDisplayed) {
279+
await wait(1000);
280+
isCcipBalloon.value = true;
281+
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR, 'true');
282+
}
242283
},
243284
{ immediate: true }
244285
);
@@ -261,9 +302,11 @@ export default defineComponent({
261302
nativeBridgeEnabled,
262303
layerZeroBridgeEnabled,
263304
isShibuyaEvm,
264-
ccipMinatoBridgeEnabled,
305+
isEnableCcipBridge,
265306
isCcipBalloon,
266307
isBalloonClosing,
308+
isAstarEvm,
309+
isSoneiumButtonHover,
267310
closeCcipBalloon,
268311
buildCcipBridgePageLink,
269312
truncate,

src/components/assets/styles/asset-list.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@
441441
display: block;
442442
text-align: center;
443443
margin-top: 10px;
444+
width: 80px;
444445
@media (min-width: $sm) {
445446
display: none;
446447
}

src/components/bridge/BridgeSelection.vue

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</div>
77
<div class="container--selection">
88
<div class="column--selection">
9-
<button :disabled="!isEnableMinatoBridge">
9+
<button :disabled="!isEnableCcipBridge">
1010
<component
11-
:is="isEnableMinatoBridge ? 'router-link' : 'div'"
11+
:is="isEnableCcipBridge ? 'router-link' : 'div'"
1212
:to="buildCcipBridgePageLink()"
1313
class="button--bridge"
1414
>
@@ -24,20 +24,38 @@
2424
<div class="row--bridge-title">
2525
<div class="text--bridge-tag">
2626
<q-chip outline>
27-
{{ $t('bridge.ccipMinatoBridge.tag') }}
27+
{{
28+
$t(
29+
isShibuyaEvm
30+
? 'bridge.ccipMinatoBridge.tag'
31+
: 'bridge.ccipSoneiumBridge.tag'
32+
)
33+
}}
2834
</q-chip>
2935
</div>
30-
<span class="text--bridge-title">{{ $t('bridge.ccipMinatoBridge.title') }}</span>
36+
<span class="text--bridge-title">{{
37+
$t(
38+
isShibuyaEvm
39+
? 'bridge.ccipMinatoBridge.title'
40+
: 'bridge.ccipSoneiumBridge.title'
41+
)
42+
}}</span>
3143
<div class="box--text-bridge">
3244
<span class="text--bridge">
33-
{{ $t('bridge.ccipMinatoBridge.text') }}
45+
{{
46+
$t(
47+
isShibuyaEvm
48+
? 'bridge.ccipMinatoBridge.text'
49+
: 'bridge.ccipSoneiumBridge.text'
50+
)
51+
}}
3452
</span>
3553
</div>
3654
</div>
3755
</component>
3856
</button>
39-
<p v-if="!isShibuyaEvm" class="text--bridge-details">
40-
{{ $t('bridge.ccipMinatoBridge.remark') }}
57+
<p v-if="!isAstarEvm && !isShibuyaEvm" class="text--bridge-details">
58+
{{ $t('bridge.ccipSoneiumBridge.remark') }}
4159
</p>
4260
</div>
4361

@@ -232,6 +250,7 @@ import {
232250
celerBridgeEnabled,
233251
layerSwapBridgeEnabled,
234252
layerZeroBridgeEnabled,
253+
ccipSoneiumBridgeEnabled,
235254
nativeBridgeEnabled,
236255
} from 'src/features';
237256
import { useAccount, useNetworkInfo } from 'src/hooks';
@@ -259,6 +278,7 @@ export default defineComponent({
259278
isAstar,
260279
isH160,
261280
isShibuyaEvm,
281+
isAstarEvm,
262282
nativeTokenSymbol,
263283
} = useNetworkInfo();
264284
@@ -280,8 +300,11 @@ export default defineComponent({
280300
return isH160.value && (isAstar.value || isAstarZkEvm.value);
281301
});
282302
283-
const isEnableMinatoBridge = computed<boolean>(() => {
284-
return isShibuyaEvm.value && ccipMinatoBridgeEnabled;
303+
const isEnableCcipBridge = computed<boolean>(() => {
304+
return (
305+
(isShibuyaEvm.value && ccipMinatoBridgeEnabled) ||
306+
(isAstarEvm.value && ccipSoneiumBridgeEnabled)
307+
);
285308
});
286309
287310
return {
@@ -300,8 +323,9 @@ export default defineComponent({
300323
layerSwapBridgeEnabled,
301324
nativeBridgeEnabled,
302325
layerZeroBridgeEnabled,
303-
isEnableMinatoBridge,
326+
isEnableCcipBridge,
304327
isShibuyaEvm,
328+
isAstarEvm,
305329
buildEthereumBridgePageLink,
306330
buildLzBridgePageLink,
307331
navigateInNewTab,

src/components/bridge/ccip/CcipBridge.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ import { EthBridgeNetworkName } from 'src/modules/zk-evm-bridge';
162162
import { useStore } from 'src/store';
163163
import { PropType, computed, defineComponent, ref, watch } from 'vue';
164164
import Jazzicon from 'vue3-jazzicon/src/components';
165-
import { ccipMinatoBridgeEnabled } from 'src/features';
165+
import { ccipMinatoBridgeEnabled, ccipSoneiumBridgeEnabled } from 'src/features';
166166
import {
167167
ccipBridgeIcon,
168168
CCIP_TOKEN,
@@ -255,7 +255,7 @@ export default defineComponent({
255255
},
256256
setup(props) {
257257
const { currentAccount } = useAccount();
258-
const { nativeTokenSymbol } = useNetworkInfo();
258+
const { nativeTokenSymbol, isShibuyaEvm, isAstarEvm } = useNetworkInfo();
259259
const store = useStore();
260260
const isHandling = ref<boolean>(false);
261261
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
@@ -318,9 +318,12 @@ export default defineComponent({
318318
isHandling.value = false;
319319
};
320320
321-
// Todo: update for Soneium
322321
const ccipBridgeEnabled = computed<boolean>(() => {
323-
return ccipMinatoBridgeEnabled;
322+
return isShibuyaEvm.value
323+
? ccipMinatoBridgeEnabled
324+
: isAstarEvm.value
325+
? ccipSoneiumBridgeEnabled
326+
: false;
324327
});
325328
326329
watch(

src/config/localStorage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export enum LOCAL_STORAGE {
1818
XVM_TX_HISTORIES = 'xvmTxHistories',
1919
BALLOON_NATIVE_TOKEN = 'balloonNativeToken',
2020
BALLOON_CCIP_SHIBUYA = 'balloonCcipShibuya',
21+
BALLOON_CCIP_ASTAR = 'balloonCcipAstar',
2122
THEME_COLOR = 'themeColor',
2223
MULTISIG = 'multisig',
2324
CLOSE_DAPP_STAKING_V3_ONBOARDING = 'closeDappStakingV3Onboarding',

src/config/web3/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ export enum EVM {
4949
MOONRIVER = 1285,
5050
MOONBEAM = 1284,
5151
SONEIUM_MINATO_TESTNET = 1946,
52-
// Todo: update
53-
SONEIUM = 9999,
52+
SONEIUM = 1868,
5453
}
5554

5655
export const chainName = {
@@ -166,8 +165,7 @@ export const rpcUrls = {
166165
[EVM.MOONRIVER]: ['https://rpc.api.moonriver.moonbeam.network'],
167166
[EVM.MOONBEAM]: ['https://rpc.api.moonbeam.network'],
168167
[EVM.SONEIUM_MINATO_TESTNET]: ['https://rpc.minato.soneium.org'],
169-
// Todo: update
170-
[EVM.SONEIUM]: ['https://rpc.minato.soneium.org'],
168+
[EVM.SONEIUM]: ['https://rpc.soneium.org/'],
171169
};
172170

173171
export const blockExplorerUrls = {
@@ -184,8 +182,7 @@ export const blockExplorerUrls = {
184182
[EVM.MOONRIVER]: ['https://moonriver.moonscan.io'],
185183
[EVM.MOONBEAM]: ['https://moonbeam.moonscan.io'],
186184
[EVM.SONEIUM_MINATO_TESTNET]: ['https://soneium-minato.blockscout.com'],
187-
// Todo: update
188-
[EVM.SONEIUM]: ['https://soneium-minato.blockscout.com'],
185+
[EVM.SONEIUM]: ['https://soneium.blockscout.com'],
189186
};
190187

191188
export const CHAIN_INFORMATION = {

0 commit comments

Comments
 (0)