Skip to content

Commit

Permalink
feat: migrate zKatana to zKyoto (#1183)
Browse files Browse the repository at this point in the history
* feat: migrate zKatana to zKyoto

* feat: add support for the new changes in the Bridge API

* debug: check log

* fix: clean up
  • Loading branch information
impelcrypto authored Feb 15, 2024
1 parent e0bf6a4 commit 225ab62
Show file tree
Hide file tree
Showing 34 changed files with 346 additions and 131 deletions.
2 changes: 1 addition & 1 deletion src/boot/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default boot(async ({ store }) => {
watchPostEffect(async () => {
store.commit('general/setChainInfo', chainInfo.value);
const networkIdx = store.getters['general/networkIdx'];
const isZkEvm = networkIdx === endpointKey.ZKATANA || networkIdx === endpointKey.ASTAR_ZKEVM;
const isZkEvm = networkIdx === endpointKey.ZKYOTO || networkIdx === endpointKey.ASTAR_ZKEVM;

if (isZkEvm) {
await setWeb3(networkIdx);
Expand Down
8 changes: 4 additions & 4 deletions src/components/assets/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- zkEVM -->
<template v-if="isZkEvm">
<a class="btn" href="/shibuya-testnet/assets"> Shibuya EVM (L1) </a>
<div v-if="isZkEvm" class="btn active">Astar zKatana</div>
<div v-if="isZkEvm" class="btn active">Astar zKyoto</div>
</template>

<!-- Astar EVM -->
Expand All @@ -20,8 +20,8 @@
{{ currentNetworkName.replace('Network', '') }}
EVM (L1)
</div>
<a v-if="currentNetworkIdx === 2" class="btn" href="/zkatana-testnet/assets">
Astar zKatana
<a v-if="currentNetworkIdx === 2" class="btn" href="/zkyoto-testnet/assets">
Astar zKyoto
</a>
<a v-else-if="currentNetworkIdx !== 1" class="btn" disabled>Astar zkEVM</a>
</template>
Expand Down Expand Up @@ -282,7 +282,7 @@ export default defineComponent({
return bg_img.native;
} else if (currentNetworkIdx.value === endpointKey.SHIDEN) {
return bg_img.shiden;
} else if (currentNetworkIdx.value === endpointKey.ZKATANA) {
} else if (currentNetworkIdx.value === endpointKey.ZKYOTO) {
return bg_img.testnet_zk;
}
return bg_img.testnet;
Expand Down
6 changes: 3 additions & 3 deletions src/components/assets/EvmNativeToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</q-tooltip>
</a>

<a v-if="isZkatana" :href="faucetSethLink" target="_blank" rel="noopener noreferrer">
<a v-if="isZkyoto" :href="faucetSethLink" target="_blank" rel="noopener noreferrer">
<button class="btn btn--icon">
<astar-icon-faucet />
</button>
Expand Down Expand Up @@ -105,7 +105,7 @@ export default defineComponent({
const isFaucet = ref<boolean>(false);
const isModalFaucet = ref<boolean>(false);
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isZkatana } = useNetworkInfo();
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isZkyoto } = useNetworkInfo();
const { currentAccount } = useAccount();
const { nativeTokenUsd } = usePrice();
const store = useStore();
Expand Down Expand Up @@ -161,7 +161,7 @@ export default defineComponent({
isFaucet,
isModalFaucet,
isZkEvm,
isZkatana,
isZkyoto,
faucetSethLink,
width,
screenSize,
Expand Down
4 changes: 2 additions & 2 deletions src/components/assets/styles/account.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}
}

// zKatana
// zKyoto
&.network-4 {
.text--address {
background: linear-gradient(90deg, #6c6c6c 25%, #b7b7b7 100%);
Expand Down Expand Up @@ -334,7 +334,7 @@
}
}

// zKatana
// zKyoto
&.network-4 {
.wallet-tab {
.btn {
Expand Down
8 changes: 4 additions & 4 deletions src/components/bridge/BridgeSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ export default defineComponent({
const { isZkEvm, currentNetworkName, networkNameSubstrate, isMainnet } = useNetworkInfo();
const l1Name = computed<string>(() => {
return currentNetworkName.value === EthBridgeNetworkName.Zkatana
return currentNetworkName.value === EthBridgeNetworkName.Zkyoto
? EthBridgeNetworkName.Sepolia
: EthBridgeNetworkName.Ethereum;
});
const l2Name = computed<string>(() => {
return currentNetworkName.value === EthBridgeNetworkName.Zkatana
? EthBridgeNetworkName.Zkatana
return currentNetworkName.value === EthBridgeNetworkName.Zkyoto
? EthBridgeNetworkName.Zkyoto
: EthBridgeNetworkName.AstarZk;
});
const substrateNetwork = computed<string>(() => {
return currentNetworkName.value === EthBridgeNetworkName.Zkatana ? 'Shibuya' : 'Astar';
return currentNetworkName.value === EthBridgeNetworkName.Zkyoto ? 'Shibuya' : 'Astar';
});
const cbridgeNetworkName = computed<string>(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/bridge/common/ImportTokenInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ export default defineComponent({
return String(blockExplorerUrls[EVM.SEPOLIA_TESTNET][0]);
case EthBridgeNetworkName.AstarZk:
return String(blockExplorerUrls[EVM.ASTAR_ZKEVM_MAINNET][0]);
case EthBridgeNetworkName.Zkatana:
return String(blockExplorerUrls[EVM.ZKATANA_TESTNET][0]);
case EthBridgeNetworkName.Zkyoto:
return String(blockExplorerUrls[EVM.ZKYOTO_TESTNET][0]);
default:
return String(blockExplorerUrls[EVM.ZKATANA_TESTNET][0]);
return String(blockExplorerUrls[EVM.ZKYOTO_TESTNET][0]);
}
};
Expand Down
11 changes: 5 additions & 6 deletions src/components/bridge/ethereum/L1Bridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,15 @@ export default defineComponent({
isHandling.value = false;
};
// Watching the 'isApproved' prop
// When 'isApproved' changes and becomes true, stop loading animation
watch(
() => props.isApproved,
async (newVal, oldVal) => {
if (newVal === true) {
[props],
() => {
if (props.isApproved) {
props.setIsApproving(false);
store.commit('general/setLoading', false, { root: true });
}
}
},
{ immediate: false }
);
return {
Expand Down
4 changes: 2 additions & 2 deletions src/components/bridge/ethereum/L1History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ export default defineComponent({
return blockExplorerUrls[EVM.ETHEREUM_MAINNET] + txUrl;
case EthBridgeNetworkName.Sepolia:
return blockExplorerUrls[EVM.SEPOLIA_TESTNET] + txUrl;
case EthBridgeNetworkName.Zkatana:
return blockExplorerUrls[EVM.ZKATANA_TESTNET] + txUrl;
case EthBridgeNetworkName.Zkyoto:
return blockExplorerUrls[EVM.ZKYOTO_TESTNET] + txUrl;
case EthBridgeNetworkName.AstarZk:
return blockExplorerUrls[EVM.SEPOLIA_TESTNET] + txUrl;
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/ClaimWarningBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default defineComponent({
padding: 4px 16px 8px 16px;
}
// shibuya, zKatana, local
// shibuya, zkyoto, local
background: linear-gradient(90deg, #6c6c6c 25%, #b7b7b7 100%);
// astar native
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/HeaderComp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default defineComponent({
height: 6rem;
}
// shibuya, zKatana, local
// shibuya, zkyoto, local
border-image: linear-gradient(90deg, #6c6c6c 25%, #b7b7b7 100%);
border-image-slice: 1;
Expand Down
6 changes: 3 additions & 3 deletions src/components/header/mobile/MobileNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</router-link>

<button
v-if="isZkatana"
v-if="isZkyoto"
:disabled="true"
:class="['link', path === 'dashboard' && 'active-link']"
>
Expand Down Expand Up @@ -114,7 +114,7 @@ export default defineComponent({
const showNav = ref<boolean>(false);
const router = useRouter();
const path = computed(() => router.currentRoute.value.path.split('/')[2]);
const { isZkatana } = useNetworkInfo();
const { isZkyoto } = useNetworkInfo();
const store = useStore();
const currentNetworkIdx = computed(() => store.getters['general/networkIdx']);
Expand All @@ -127,7 +127,7 @@ export default defineComponent({
path,
RoutePath,
network,
isZkatana,
isZkyoto,
};
},
});
Expand Down
28 changes: 14 additions & 14 deletions src/components/header/modals/ModalNetworkWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default defineComponent({
const selEndpointShiden = ref<string>('');
const selEndpointShibuya = ref<string>('');
const selEndpointAstarZkevm = ref<string>('');
const selEndpointZkatana = ref<string>('');
const selEndpointZkyoto = ref<string>('');
const setIsAnimatedIn = (result: boolean): void => {
isAnimatedIn.value = result;
Expand All @@ -183,7 +183,7 @@ export default defineComponent({
const isH160 = computed<boolean>(() => store.getters['general/isH160Formatted']);
const isZkEvm = computed<boolean>(
() =>
selNetworkId.value === endpointKey.ASTAR_ZKEVM || selNetworkId.value === endpointKey.ZKATANA
selNetworkId.value === endpointKey.ASTAR_ZKEVM || selNetworkId.value === endpointKey.ZKYOTO
);
const setInitialCustomEndpoint = (): string => {
Expand Down Expand Up @@ -218,8 +218,8 @@ export default defineComponent({
return selEndpointShiden.value;
case endpointKey.SHIBUYA:
return selEndpointShibuya.value;
case endpointKey.ZKATANA:
return selEndpointZkatana.value;
case endpointKey.ZKYOTO:
return selEndpointZkyoto.value;
case endpointKey.ASTAR_ZKEVM:
return selEndpointAstarZkevm.value;
Expand Down Expand Up @@ -318,7 +318,7 @@ export default defineComponent({
? selEndpointShibuya.value === endpoint
: index === endpointKey.ASTAR_ZKEVM
? selEndpointAstarZkevm.value === endpoint
: selEndpointZkatana.value === endpoint;
: selEndpointZkyoto.value === endpoint;
};
const setSelNetwork = (networkId: number): void => {
Expand All @@ -340,8 +340,8 @@ export default defineComponent({
selEndpointShibuya.value = endpointObj.endpoint;
} else if (networkIdx === endpointKey.ASTAR_ZKEVM) {
selEndpointAstarZkevm.value = endpointObj.endpoint;
} else if (networkIdx === endpointKey.ZKATANA) {
selEndpointZkatana.value = endpointObj.endpoint;
} else if (networkIdx === endpointKey.ZKYOTO) {
selEndpointZkyoto.value = endpointObj.endpoint;
}
};
Expand All @@ -365,8 +365,8 @@ export default defineComponent({
if (networkIdx === endpointKey.ASTAR_ZKEVM) {
selEndpointAstarZkevm.value = getRandomizedEndpoint(endpointKey.ASTAR_ZKEVM);
}
if (networkIdx === endpointKey.ZKATANA) {
selEndpointZkatana.value = getRandomizedEndpoint(endpointKey.ZKATANA);
if (networkIdx === endpointKey.ZKYOTO) {
selEndpointZkyoto.value = getRandomizedEndpoint(endpointKey.ZKYOTO);
}
};
Expand All @@ -376,7 +376,7 @@ export default defineComponent({
randomizedEndpoint(endpointKey.SHIDEN);
randomizedEndpoint(endpointKey.SHIBUYA);
randomizedEndpoint(endpointKey.ASTAR_ZKEVM);
randomizedEndpoint(endpointKey.ZKATANA);
randomizedEndpoint(endpointKey.ZKYOTO);
return;
}
Expand All @@ -385,7 +385,7 @@ export default defineComponent({
randomizedEndpoint(endpointKey.ASTAR);
randomizedEndpoint(endpointKey.SHIBUYA);
randomizedEndpoint(endpointKey.ASTAR_ZKEVM);
randomizedEndpoint(endpointKey.ZKATANA);
randomizedEndpoint(endpointKey.ZKYOTO);
return;
}
Expand All @@ -394,18 +394,18 @@ export default defineComponent({
randomizedEndpoint(endpointKey.ASTAR);
randomizedEndpoint(endpointKey.SHIDEN);
randomizedEndpoint(endpointKey.ASTAR_ZKEVM);
randomizedEndpoint(endpointKey.ZKATANA);
randomizedEndpoint(endpointKey.ZKYOTO);
return;
}
if (networkIdx === endpointKey.ASTAR_ZKEVM) {
selEndpointShibuya.value = setInitialSelEndpoint();
randomizedEndpoint(endpointKey.ASTAR);
randomizedEndpoint(endpointKey.SHIDEN);
randomizedEndpoint(endpointKey.SHIBUYA);
randomizedEndpoint(endpointKey.ZKATANA);
randomizedEndpoint(endpointKey.ZKYOTO);
return;
}
if (networkIdx === endpointKey.ZKATANA) {
if (networkIdx === endpointKey.ZKYOTO) {
selEndpointShibuya.value = setInitialSelEndpoint();
randomizedEndpoint(endpointKey.ASTAR);
randomizedEndpoint(endpointKey.SHIDEN);
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/modals/SelectNetwork.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
</button>
<button
class="row--network box--hover--active"
:class="selNetworkId === endpointKey.ZKATANA && 'border--active'"
@click="setSelNetwork(endpointKey.ZKATANA)"
:class="selNetworkId === endpointKey.ZKYOTO && 'border--active'"
@click="setSelNetwork(endpointKey.ZKYOTO)"
>
<img
class="img--network-logo"
Expand Down
6 changes: 3 additions & 3 deletions src/components/sidenav/SidebarDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<div>
<button
v-if="isZkatana"
v-if="isZkyoto"
:disabled="true"
class="link--disabled"
:class="['link', $route.path.split('/')[2] === 'dashboard' ? 'activeLink' : '']"
Expand Down Expand Up @@ -143,7 +143,7 @@ export default defineComponent({
},
setup() {
const { isOpen } = useSidebar();
const { isZkEvm, isZkatana } = useNetworkInfo();
const { isZkEvm, isZkyoto } = useNetworkInfo();
const store = useStore();
const currentNetworkIdx = computed<number>(() => store.getters['general/networkIdx']);
Expand Down Expand Up @@ -179,7 +179,7 @@ export default defineComponent({
path,
RoutePath,
socialUrl,
isZkatana,
isZkyoto,
};
},
});
Expand Down
8 changes: 4 additions & 4 deletions src/config/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export enum astarChain {
ASTAR = 'Astar',
DEVELOPMENT = 'Development',
ASTAR_ZKEVM = 'Astar zkEVM',
ZKATANA = 'zKatana Testnet',
ZKYOTO = 'zKyoto Testnet',
ROCSTAR = 'Rocstar Testnet',
}

Expand All @@ -15,7 +15,7 @@ export type ASTAR_CHAIN =
| astarChain.ASTAR
| astarChain.SHIBUYA
| astarChain.ASTAR_ZKEVM
| astarChain.ZKATANA
| astarChain.ZKYOTO
| astarChain.DEVELOPMENT
| astarChain.ROCSTAR;

Expand All @@ -24,12 +24,12 @@ export type ASTAR_NETWORK_IDX =
| endpointKey.SHIDEN
| endpointKey.SHIBUYA
| endpointKey.ASTAR_ZKEVM
| endpointKey.ZKATANA
| endpointKey.ZKYOTO
| endpointKey.LOCAL
| endpointKey.ROCSTAR;

//Todo: add Astar zkEVM
export type ASTAR_EVM_NETWORK_IDX = 592 | 336 | 81 | 4369 | 692 | 7759;
export type ASTAR_EVM_NETWORK_IDX = 592 | 336 | 81 | 4369 | 692 | 7759 | 6038361;

export type ASTAR_NATIVE_TOKEN = 'ASTR' | 'SDN' | 'SBY' | 'LOC' | 'RSTR' | 'ETH';
export const astarMainnetNativeToken: ASTAR_NATIVE_TOKEN[] = ['ASTR', 'SDN'];
Loading

0 comments on commit 225ab62

Please sign in to comment.