Skip to content

Commit

Permalink
ETH for bsc WETH (#760)
Browse files Browse the repository at this point in the history
* ETH for bsc WETH

* clean code while debugging (#761)

* update ui kit
  • Loading branch information
Thykof authored Jul 29, 2024
1 parent e16f870 commit 6683ea8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@dusalabs/sdk": "^0.5.28",
"@massalabs/massa-web3": "^4.0.2-dev",
"@massalabs/react-ui-kit": "^0.0.5-dev",
"@massalabs/react-ui-kit": "^0.0.6-dev",
"@massalabs/wallet-provider": "^2.0.1-dev",
"@rainbow-me/rainbowkit": "^2.0.0-beta.4",
"@tanstack/query-core": "^5.18.1",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
"claim": {
"error": {
"rejected": "Claim rejected by user, try again",
"timeout": "Claim timeout out.",
"unknown": "Unknown error, Try again."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ export function PendingOperationLayout() {

const { box } = useGlobalStatusesStore();

const IS_BOX_SUCCESS = box === Status.Success;
const IS_BOX_WARNING = box === Status.Warning;
const IS_BOX_ERROR = box === Status.Error;
const isBoxSuccess = box === Status.Success;
const isBoxWarning = box === Status.Warning;
const isBoxError = box === Status.Error;

const displaySubtitle = !IS_BOX_SUCCESS && !IS_BOX_WARNING && !IS_BOX_ERROR;
const displaySubtitle = !isBoxSuccess && !isBoxWarning && !isBoxError;

const isNotProcessing = IS_BOX_SUCCESS || IS_BOX_WARNING || IS_BOX_ERROR;
const isNotProcessing = isBoxSuccess || isBoxWarning || isBoxError;

function getLoadingBoxHeader() {
if (IS_BOX_SUCCESS) return Intl.t('index.loading-box.success');
else if (IS_BOX_ERROR) {
if (isBoxSuccess) return Intl.t('index.loading-box.success');
if (isBoxError) {
return massaToEvm
? Intl.t('index.loading-box.title-redeem-error')
: Intl.t('index.loading-box.title-bridge-error');
} else if (IS_BOX_WARNING) {
}
if (isBoxWarning) {
return massaToEvm ? (
<>
{Intl.t('index.loading-box.title-redeem-warning-1')}
Expand All @@ -54,9 +55,9 @@ export function PendingOperationLayout() {

function getLoadingBoxContent() {
switch (true) {
case IS_BOX_SUCCESS:
case isBoxSuccess:
return <SuccessLayout />;
case IS_BOX_WARNING:
case isBoxWarning:
return <WarningLayout />;
case massaToEvm:
return <RedeemLayout />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ export function ClaimRedeem() {
[burnTxId, updateBurnRedeemOperationById],
);

const setLoadingToError = useCallback(() => {
setClaim(Status.Error);
setBox(Status.Error);
}, [setClaim, setBox]);

// Updates current redeem operation state based on claim status
useEffect(() => {
if (hash) setClaimTxId(hash);
Expand All @@ -76,7 +71,8 @@ export function ClaimRedeem() {
claimState: ClaimState.REJECTED,
});
} else {
setLoadingToError();
setClaim(Status.Error);
setBox(Status.Error);
updateCurrentRedeemOperation({
claimState: ClaimState.ERROR,
});
Expand All @@ -91,7 +87,6 @@ export function ClaimRedeem() {
refreshBalances,
setClaim,
updateCurrentRedeemOperation,
setLoadingToError,
setClaimTxId,
]);

Expand Down
1 change: 1 addition & 0 deletions src/store/helpers/tokenSymbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export function getMASSASymbol(symbol: string) {
}
export function getEVMSymbol(symbol: string) {
// removes any ". + alphanumeric " from string
if (symbol === 'WETH.b') return 'ETH';
return symbol.replace(/\.[^.]+$/, '');
}
4 changes: 1 addition & 3 deletions src/utils/lambdaApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { useAccount } from 'wagmi';
import { ClaimState } from './const';
import { config } from '../const';
import { useBridgeModeStore, useGlobalStatusesStore } from '../store/store';
import { useBridgeModeStore } from '../store/store';
import { useResource } from '@/custom/api/useResource';
import { BurnRedeemOperation, useOperationStore } from '@/store/operationStore';

Expand Down Expand Up @@ -143,7 +143,6 @@ function getClaimState(
export function useFetchSignatures() {
const { burnTxId, getCurrentRedeemOperation, updateBurnRedeemOperationById } =
useOperationStore();
const { setBox } = useGlobalStatusesStore();
const { currentMode } = useBridgeModeStore();
const { address: evmAddress } = useAccount();

Expand Down Expand Up @@ -181,7 +180,6 @@ export function useFetchSignatures() {
}, [
burnTxId,
burnOperations,
setBox,
getCurrentRedeemOperation,
updateBurnRedeemOperationById,
]);
Expand Down

0 comments on commit 6683ea8

Please sign in to comment.