Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix issues #311

Merged
merged 5 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .release/.changeset/clean-items-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": patch
"@bnb-chain/canonical-bridge-sdk": patch
---

Fix verification error on cBridge
6 changes: 6 additions & 0 deletions .release/.changeset/eight-spoons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": patch
"@bnb-chain/canonical-bridge-sdk": patch
---

Modify polygon nativeCurrency
6 changes: 5 additions & 1 deletion .release/.changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
"big-candles-breathe",
"blue-goats-shave",
"brown-suits-matter",
"clean-items-search",
"curvy-dingos-end",
"eight-spoons-divide",
"large-years-cover",
"modern-toys-give",
"shaggy-boats-rest",
"short-ants-love",
"smooth-vans-work",
"thick-donkeys-kneel"
"thick-donkeys-kneel",
"tidy-days-add"
]
}
6 changes: 6 additions & 0 deletions .release/.changeset/shaggy-boats-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": patch
"@bnb-chain/canonical-bridge-sdk": patch
---

Fix could not jump to the app & toToken requiring two clicks on mobile
6 changes: 6 additions & 0 deletions .release/.changeset/tidy-days-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": patch
"@bnb-chain/canonical-bridge-sdk": patch
---

Add timeout to meson api
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const chains: IServerChainConfig[] = [
chainType: 'evm',
id: 137,
name: 'Polygon',
nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 },
nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
rpcUrls: { default: { http: ['https://polygon-rpc.com'] } },
blockExplorers: {
default: { name: 'polygonscan', url: 'https://polygonscan.com' },
Expand Down
20 changes: 19 additions & 1 deletion apps/canonical-bridge-ui/core/wallet/WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as allChains from 'viem/chains';
import { defaultTronConfig, tronLink } from '@node-real/walletkit/tron';
import {
defaultSolanaConfig,
phantomWallet,
phantomWallet as solanaPhantomWallet,
trustWallet as solanaTrustWallet,
} from '@node-real/walletkit/solana';
Expand Down Expand Up @@ -62,11 +63,28 @@ export function WalletProvider(props: WalletProviderProps) {
const isInDappBrowser = evmWallets.some((e) => e.isInstalled());

if (isInDappBrowser) {
if (
binanceWeb3Wallet().isInstalled() &&
phantomWallet().isInstalled() &&
wallet.id === phantomWallet().id
) {
onOpen();
return false;
}
if (
phantomWallet().isInstalled() &&
metaMask().isInstalled() &&
wallet.id === metaMask().id
) {
onOpen();
return false;
}

// Some wallets will set `isMetaMask=true`
const counter = evmWallets.filter((e) => e.isInstalled()).length;
if (
(counter === 1 && wallet.isInstalled()) ||
(counter > 1 && wallet.isInstalled() && wallet.id !== 'metaMask')
(counter > 1 && wallet.isInstalled() && wallet.id !== metaMask().id)
) {
return true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion apps/canonical-bridge-ui/token-config/mainnet/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const chains: IChainConfig[] = [
chainType: 'evm',
id: 137,
name: 'Polygon',
nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 },
nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
rpcUrls: { default: { http: ['https://polygon-rpc.com'] } },
blockExplorers: {
default: { name: 'polygonscan', url: 'https://polygonscan.com' },
Expand Down
24 changes: 24 additions & 0 deletions packages/canonical-bridge-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @bnb-chain/canonical-bridge-sdk

## 0.5.0-alpha.16

### Patch Changes

- Modify polygon nativeCurrency

## 0.5.0-alpha.15

### Patch Changes

- Fix verification error on cBridge

## 0.5.0-alpha.14

### Patch Changes

- Fix could not jump to the app & toToken requiring two clicks on mobile

## 0.5.0-alpha.13

### Patch Changes

- Add timeout to meson api

## 0.5.0-alpha.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/canonical-bridge-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bnb-chain/canonical-bridge-sdk",
"version": "0.5.0-alpha.12",
"version": "0.5.0-alpha.16",
"description": "canonical bridge sdk",
"author": "bnb-chain",
"private": false,
Expand Down
32 changes: 32 additions & 0 deletions packages/canonical-bridge-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# @bnb-chain/canonical-bridge-widget

## 0.6.0-alpha.24

### Patch Changes

- Modify polygon nativeCurrency
- Updated dependencies
- @bnb-chain/canonical-bridge-sdk@0.5.0-alpha.16

## 0.6.0-alpha.23

### Patch Changes

- Fix verification error on cBridge
- Updated dependencies
- @bnb-chain/canonical-bridge-sdk@0.5.0-alpha.15

## 0.6.0-alpha.22

### Patch Changes

- Fix could not jump to the app & toToken requiring two clicks on mobile
- Updated dependencies
- @bnb-chain/canonical-bridge-sdk@0.5.0-alpha.14

## 0.6.0-alpha.21

### Patch Changes

- Add timeout to meson api
- Updated dependencies
- @bnb-chain/canonical-bridge-sdk@0.5.0-alpha.13

## 0.6.0-alpha.20

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions 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.20",
"version": "0.6.0-alpha.24",
"description": "canonical bridge widget",
"author": "bnb-chain",
"private": false,
Expand Down Expand Up @@ -46,7 +46,7 @@
"@solana/web3.js": "^1",
"tronweb": "^6",
"@tronweb3/tronwallet-adapter-react-hooks": "^1",
"@bnb-chain/canonical-bridge-sdk": "^0.5.0-alpha.12"
"@bnb-chain/canonical-bridge-sdk": "^0.5.0-alpha.16"
},
"devDependencies": {
"@bnb-chain/canonical-bridge-sdk": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import { useMemo } from 'react';
interface InfoTooltipProps extends Omit<TooltipProps, 'children'> {
iconProps?: IconProps;
children?: React.ReactElement;
isDisabled?: boolean;
}

export const InfoTooltip = (props: InfoTooltipProps) => {
const { iconProps, children, ...restProps } = props;
const { iconProps, children, isDisabled = false, ...restProps } = props;
// Make tooltip controlled on mobile devices, default tooltip doesn't work.
const isBase = useBreakpointValue({ base: true, md: false }) ?? false;
const { isOpen, onOpen, onToggle, onClose } = useDisclosure();
Expand All @@ -36,6 +37,8 @@ export const InfoTooltip = (props: InfoTooltipProps) => {
}, [children, iconProps, isBase, onClose, onOpen, onToggle]);

if (!restProps.label) return null;
if (isDisabled) return <>{clone}</>;

return (
<Tooltip
hasArrow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export const useBridgeSDK = () => {
bridgeType: 'layerZero',
endpoint: '',
},
{ bridgeType: 'meson', endpoint: bridgeConfig.http.mesonEndpoint! },
{
bridgeType: 'meson',
endpoint: bridgeConfig.http.mesonEndpoint!,
timeout,
},
],
});
}, [bridgeConfig.http.apiTimeOut, bridgeConfig.http.mesonEndpoint]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const TransferConfirmButton = ({
toTokenSymbol: toToken?.cBridge?.raw?.token.symbol,
toTokenDecimals: toToken?.cBridge?.raw?.token.decimal as number,
amount: Number(sendValue),
cBridgeEndpoint: `${CBRIDGE_ENDPOINT}/getTransferConfigsForAll`,
cBridgeEndpoint: `${CBRIDGE_ENDPOINT}/v2/getTransferConfigsForAll`,
});

if (!isValidToken) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function ToTokenItem({ token, isSelected }: { token: IBridgeToken; isSelected: b
const tokenUrl = formatTokenUrl(toChain?.tokenUrlPattern, token.address);

return (
<InfoTooltip label={token.name}>
<InfoTooltip label={token.name} isDisabled={isMobile}>
<Flex
className="bccb-widget-to-token-item"
data-available-to-name={token.name}
Expand Down