Skip to content

Commit

Permalink
Merge pull request #203 from bnb-chain/wenty/pancake
Browse files Browse the repository at this point in the history
feat: pancake involves changes to widgets
  • Loading branch information
wenty22 authored Dec 18, 2024
2 parents 83d01a2 + 0a61381 commit cc2b6c7
Show file tree
Hide file tree
Showing 52 changed files with 897 additions and 442 deletions.
5 changes: 5 additions & 0 deletions .release/.changeset/cold-baboons-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Add attribute `data-address` to all routes
5 changes: 5 additions & 0 deletions .release/.changeset/gorgeous-lies-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Use rpc in chainsConfig to get balance
5 changes: 5 additions & 0 deletions .release/.changeset/happy-insects-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Add more customizable configs
5 changes: 5 additions & 0 deletions .release/.changeset/hip-news-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Keep the previous selected route after routes refreshing
5 changes: 5 additions & 0 deletions .release/.changeset/honest-adults-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Fixed an issue caused by sdk not building
5 changes: 5 additions & 0 deletions .release/.changeset/large-jeans-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Support custom toast for errors
5 changes: 5 additions & 0 deletions .release/.changeset/lazy-vans-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Split `TransferWidget` into `BridgeTransfer` and `BridgeRoutes`
5 changes: 5 additions & 0 deletions .release/.changeset/long-rivers-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

AlertIcon supports customize color
5 changes: 5 additions & 0 deletions .release/.changeset/lovely-terms-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Add blocked rules to celer bridge
5 changes: 5 additions & 0 deletions .release/.changeset/metal-scissors-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Add to token address to route
24 changes: 24 additions & 0 deletions .release/.changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@bnb-chain/canonical-bridge-sdk": "0.4.2",
"@bnb-chain/canonical-bridge-widget": "0.5.9"
},
"changesets": [
"cold-baboons-serve",
"gorgeous-lies-dance",
"happy-insects-give",
"hip-news-reflect",
"honest-adults-mate",
"large-jeans-jam",
"lazy-vans-applaud",
"long-rivers-type",
"lovely-terms-walk",
"metal-scissors-repeat",
"quiet-hotels-accept",
"silent-keys-fold",
"small-mangos-lay",
"tough-carrots-report"
]
}
5 changes: 5 additions & 0 deletions .release/.changeset/quiet-hotels-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Support custom toast for errors
5 changes: 5 additions & 0 deletions .release/.changeset/silent-keys-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Support custom toast for errors
5 changes: 5 additions & 0 deletions .release/.changeset/small-mangos-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Remove bridge bottom element if `routeContentBottom` not setted
5 changes: 5 additions & 0 deletions .release/.changeset/tough-carrots-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bnb-chain/canonical-bridge-widget": patch
---

Support specific wallets to exclude unsupported chains
7 changes: 4 additions & 3 deletions apps/canonical-bridge-ui/core/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export function Layout({ children }: React.PropsWithChildren) {
<Header />
<Flex
as="main"
flexDir="column"
flex={1}
w={['100%', '100%', '100%', 'auto']}
p={['24px 20px', '24px 20px', '40px']}
alignItems="center"
w={['100%']}
mb={['120px', '120px', '160px']}
alignItems={'flex-start'}
justifyContent={'center'}
>
{children}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion apps/canonical-bridge-ui/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
30 changes: 27 additions & 3 deletions apps/canonical-bridge-ui/pages/mainnet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {
CanonicalBridgeProvider,
ICanonicalBridgeConfig,
TransferWidget,
BridgeTransfer,
BridgeRoutes,
} from '@bnb-chain/canonical-bridge-widget';
import { useMemo } from 'react';
import { useAccount } from 'wagmi';

import { useTransferConfig } from '@/token-config/mainnet/useTransferConfig';
import { chains } from '@/token-config/mainnet/chains';
Expand All @@ -13,6 +16,13 @@ import { useWalletModal } from '@/core/wallet/hooks/useWalletModal';
import { WalletProvider } from '@/core/wallet/WalletProvider';
import { Layout } from '@/core/components/Layout';

const unsupportedChainsInWallets = [
{
wallets: ['BinanceW3WSDK', 'binanceWeb3Wallet'],
chains: [1101],
},
];

export const bridgeConfig: ICanonicalBridgeConfig = {
appName: env.APP_NAME,
assetPrefix: env.ASSET_PREFIX,
Expand Down Expand Up @@ -43,15 +53,29 @@ function BridgeWidget() {
const transferConfig = useTransferConfig();
const { onOpen } = useWalletModal();

const { connector } = useAccount();
const supportedChains = useMemo(() => {
return chains.filter((e) => {
if (connector) {
const unsupportedChains = unsupportedChainsInWallets.find((e) =>
e.wallets.includes(connector.id),
)?.chains;
return !unsupportedChains?.includes(e.id);
}
return true;
});
}, [connector]);

return (
<CanonicalBridgeProvider
config={bridgeConfig}
transferConfig={transferConfig}
chains={chains}
chains={supportedChains}
onClickConnectWalletButton={onOpen}
>
<Layout>
<TransferWidget />
<BridgeTransfer />
<BridgeRoutes />
</Layout>
</CanonicalBridgeProvider>
);
Expand Down
6 changes: 4 additions & 2 deletions apps/canonical-bridge-ui/pages/testnet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
CanonicalBridgeProvider,
ICanonicalBridgeConfig,
TransferWidget,
BridgeTransfer,
BridgeRoutes,
} from '@bnb-chain/canonical-bridge-widget';

import { useTestnetTransferConfig } from '@/token-config/testnet/useTestnetTransferConfig';
Expand Down Expand Up @@ -52,7 +53,8 @@ function BridgeWidget() {
onClickConnectWalletButton={onOpen}
>
<Layout>
<TransferWidget />
<BridgeTransfer />
<BridgeRoutes />
</Layout>
</CanonicalBridgeProvider>
);
Expand Down
Binary file modified apps/canonical-bridge-ui/public/images/tokens/CAKE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export function useTransferConfig() {
'0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4': 'USDC',
'0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4': 'USDC.e',
},
1101: {
'0x37eAA0eF3549a5Bb7D431be78a3D99BD360d19e5': 'USDC.e',
},
42161: {
'0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8': 'USDC.e',
},
Expand Down Expand Up @@ -129,11 +132,15 @@ export function useTransferConfig() {
56: [
'0x67d66e8ec1fd25d98b3ccd3b19b7dc4b4b7fc493',
'0x0000000000000000000000000000000000000000',
'0x9c7beba8f6ef6643abd725e45a4e8387ef260649',
],
137: ['cUSDCv3'],
42161: ['cUSDCv3'],
43114: ['BNB'],
7565164: ['So11111111111111111111111111111111111111112'],
7565164: [
'So11111111111111111111111111111111111111112',
'FmqVMWXBESyu4g6FT1uz1GABKdJ4j6wbuuLFwPJtqpmu',
],
},
},
bridgedTokenGroups: [
Expand Down
85 changes: 85 additions & 0 deletions packages/canonical-bridge-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,90 @@
# @bnb-chain/canonical-bridge-widget

## 0.5.14-alpha.5

### Patch Changes

- Use rpc in chainsConfig to get balance

## 0.5.14-alpha.4

### Patch Changes

- Add blocked rules to celer bridge

## 0.5.14-alpha.3

### Patch Changes

- Add attribute `data-address` to all routes

## 0.5.14-alpha.2

### Patch Changes

- Fixed an issue caused by sdk not building

## 0.5.14-alpha.1

### Patch Changes

- Support specific wallets to exclude unsupported chains

## 0.5.14-alpha.0

### Patch Changes

- Add to token address to route

## 0.5.12-alpha.3

### Patch Changes

- Support custom toast for errors

## 0.5.12-alpha.2

### Patch Changes

- Support custom toast for errors

## 0.5.12-alpha.1

### Patch Changes

- Support custom toast for errors

## 0.5.12-alpha.0

### Patch Changes

- Keep the previous selected route after routes refreshing

## 0.5.10-alpha.4

### Patch Changes

- Remove bridge bottom element if `routeContentBottom` not setted

## 0.5.10-alpha.3

### Patch Changes

- Split `TransferWidget` into `BridgeTransfer` and `BridgeRoutes`

## 0.5.10-alpha.2

### Patch Changes

- 2849332: Add more customizable configs
- AlertIcon supports customize color

## 0.5.10-alpha.0

### Patch Changes

- Add more customizable configs

## 0.5.12

### 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.5.12",
"version": "0.5.14-alpha.5",
"description": "canonical bridge widget",
"author": "bnb-chain",
"private": false,
Expand Down
Loading

0 comments on commit cc2b6c7

Please sign in to comment.