Skip to content

Commit

Permalink
Merge pull request #307 from bnb-chain/wenty/aggregator
Browse files Browse the repository at this point in the history
fix: Fix issues
  • Loading branch information
wenty22 authored Feb 7, 2025
2 parents 7ab76cc + 74fb8b4 commit f6d0b70
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .release/.changeset/large-years-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Fix issues
1 change: 1 addition & 0 deletions .release/.changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"blue-goats-shave",
"brown-suits-matter",
"curvy-dingos-end",
"large-years-cover",
"modern-toys-give",
"short-ants-love",
"smooth-vans-work",
Expand Down
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
// "**/node_modules": true,
// "**/.next": true,
"**/node_modules": true,
"**/.next": true,
"**/*.log": true,
// "**/dist": true,
// "**/.rush": true,
// "**/temp": true,
"**/dist": true,
"**/.rush": true,
"**/temp": true,
"**/tsconfig.tsbuildinfo": true
},
"[typescript]": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ export class BridgeProcessor extends WorkerHost {

async fetchDeBridge() {
const config = await this.web3Service.getDebridgeChains();

if (!config) return;

const tokenMap: Record<string, IDeBridgeToken[]> = {};

for (const chain of config.chains) {
const data = await this.web3Service.getDebridgeChainTokens(chain.chainId);
tokenMap[chain.chainId] = Object.values(data.tokens);
if (data) {
tokenMap[chain.chainId] = Object.values(data.tokens);
}
}

const data = { chains: config.chains, tokens: tokenMap };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ export class TokenService {

const cmcPrices = await this.cache.get(`${CACHE_KEY.CMC_CONFIG_V2}`);
const llamaPrices = await this.cache.get(`${CACHE_KEY.CMC_CONFIG_V2}`);
const key = `${chainId}:${tokenSymbol}`;
const key = `1:${tokenSymbol?.toLowerCase()}`;

return cmcPrices?.[key] ?? llamaPrices?.[key];
const price = cmcPrices?.[key]?.price ?? llamaPrices?.[key]?.price;
return price;
}
}
6 changes: 6 additions & 0 deletions packages/canonical-bridge-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @bnb-chain/canonical-bridge-widget

## 0.6.0-alpha.19

### Patch Changes

- d70611c: Fix issues

## 0.6.0-alpha.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/canonical-bridge-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bnb-chain/canonical-bridge-widget",
"version": "0.6.0-alpha.18",
"version": "0.6.0-alpha.19",
"description": "canonical bridge widget",
"author": "bnb-chain",
"private": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function CanonicalBridgeProvider(props: CanonicalBridgeProviderProps) {
brandChains: [],
externalChains: [],

dollarUpperLimit: 500000,
dollarUpperLimit: 200000,

chainOrders: [],
tokenOrders: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
setFromChain,
setSelectedToken,
setSendValue,
setToAccount,
setToChain,
setToToken,
setToTokens,
Expand Down Expand Up @@ -206,6 +207,7 @@ export function useSelection() {

const exchange = async () => {
dispatch(setSendValue(''));
dispatch(setToAccount({ address: '' }));

const fromChainId = toChain!.id;
const toChainId = fromChain!.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import { MIN_SOL_TO_ENABLED_TX } from '@/core/constants';
import { FailedToGetQuoteModal } from '@/modules/transfer/components/Modal/FailedToGetQuoteModal';
import { FeeTimeoutModal } from '@/modules/transfer/components/Modal/FeeTimeoutModal';
import { useFailGetQuoteModal } from '@/modules/transfer/hooks/modal/useFailGetQuoteModal';
import { useAppSelector } from '@/modules/store/StoreProvider';
import { useAppDispatch, useAppSelector } from '@/modules/store/StoreProvider';
import { useSummaryModal } from '@/modules/transfer/hooks/modal/useSummaryModal';
import { useFeeLoadTimeout } from '@/modules/transfer/hooks/modal/useFeeLoadTimeout';
import { setSendValue } from '@/modules/transfer/action';

export const TransferButtonGroup = () => {
const [hash, setHash] = useState<string | null>(null);
Expand All @@ -28,6 +29,8 @@ export const TransferButtonGroup = () => {
const isFeeTimeoutModalOpen = useAppSelector((state) => state.transfer.isFeeTimeoutModalOpen);
const isSummaryModalOpen = useAppSelector((state) => state.transfer.isSummaryModalOpen);

const dispatch = useAppDispatch();

const {
isOpen: isSubmittedModalOpen,
onOpen: onOpenSubmittedModal,
Expand Down Expand Up @@ -103,7 +106,13 @@ export const TransferButtonGroup = () => {
isOpen={isFailedGetQuoteModalOpen}
onClose={onCloseFailedGetQuoteModal}
/>
<FeeTimeoutModal isOpen={isFeeTimeoutModalOpen} onClose={onCloseFeeTimeoutModal} />
<FeeTimeoutModal
isOpen={isFeeTimeoutModalOpen}
onClose={() => {
dispatch(setSendValue(''));
onCloseFeeTimeoutModal();
}}
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export const useInputValidation = () => {
};
}

if (priceInfo?.upperLimit && Number(value) >= Number(priceInfo?.upperLimit)) {
if (priceInfo?.upperLimit && Number(value) > Number(priceInfo?.upperLimit)) {
return {
text: `Transfer value over $${formatNumber(dollarUpperLimit)} (${formatNumber(
priceInfo.upperLimit,
)} ${selectedToken?.symbol}) or equivalent is not allowed`,
)} ${selectedToken?.symbol}) is not allowed`,
isError: true,
};
}
Expand Down

0 comments on commit f6d0b70

Please sign in to comment.