Skip to content

Commit

Permalink
Merge pull request #4 from bnb-chain/feat/meson
Browse files Browse the repository at this point in the history
feat: Tron support
  • Loading branch information
Halibao-Lala authored Oct 24, 2024
2 parents e7b4a1a + e267ab8 commit 9558225
Show file tree
Hide file tree
Showing 121 changed files with 6,034 additions and 1,092 deletions.
4 changes: 2 additions & 2 deletions .github/actions/gh-pages/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ runs:
- name: Install & build
shell: bash
run: |
node common/scripts/install-run-rush.js install -t @bnb-chain/canonical-bridge-ui
node common/scripts/install-run-rush.js build -t @bnb-chain/canonical-bridge-ui
node common/scripts/install-run-rush.js install -t canonical-bridge-ui
node common/scripts/install-run-rush.js build -t canonical-bridge-ui
- name: Pushes to another repository
uses: cpina/github-action-push-to-another-repository@main
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ common/autoinstallers/*/.npmrc
.env*.local

.pnpm-store
.release/.npmrc
6 changes: 6 additions & 0 deletions .release/.changeset/fluffy-rocks-count.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
---

Only show supported networks in status popup
6 changes: 6 additions & 0 deletions .release/.changeset/great-jars-float.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
---

Support switch network for tron & fix issues
6 changes: 6 additions & 0 deletions .release/.changeset/odd-lies-design.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
---

Only show supported networks in status popup
15 changes: 15 additions & 0 deletions .release/.changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@bnb-chain/canonical-bridge-sdk": "0.1.6",
"@bnb-chain/canonical-bridge-widget": "0.1.6"
},
"changesets": [
"fluffy-rocks-count",
"great-jars-float",
"odd-lies-design",
"stupid-mugs-push",
"tiny-lizards-cross"
]
}
6 changes: 6 additions & 0 deletions .release/.changeset/stupid-mugs-push.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 tips for switching network in tronLink
6 changes: 6 additions & 0 deletions .release/.changeset/tiny-lizards-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": minor
"@bnb-chain/canonical-bridge-sdk": minor
---

Support tron
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const colorModeManager = createLocalStorageManager(`${env.APP_NAME}-color-mode`)
export const ThemeProvider = ({ children }: ThemeProviderProps) => {
const customTheme = {
...theme,
breakpoints: {
...theme.breakpoints,
lg: '1080px',
},
config: {
...theme.config,
initialColorMode: 'dark',
Expand All @@ -20,7 +24,6 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
global: ({ colorMode }: { colorMode: ColorMode }) => ({
body: {
bg: theme.colors[colorMode].background[3],
minWidth: '998px',
},
}),
},
Expand Down
18 changes: 17 additions & 1 deletion apps/canonical-bridge-ui/core/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ export const en = {
'to.section.title': 'To',
'to.section.estimated-amount': 'Est. Amount Receive',
'to.section.account.label': 'Destination Address',
'to.section.account.placeholder': 'Enter Destination Address',
'to.section.account.placeholder': 'Enter {network} Address',
'to.section.account.invalid': 'Invalid address.',
'to.section.confirm.text':
'I confirmed the address is correct and not an exchange or contract address. Any tokens sent to an incorrect address will be unrecoverable.',

'you.send.title': 'You Send',
'you.receive.title': 'You Receive',
Expand All @@ -36,6 +38,7 @@ export const en = {
'route.option.deBridge.title': 'deBridge',
'route.option.stargate.title': 'Stargate',
'route.option.layerZero.title': 'LayerZero',
'route.option.meson.title': 'Meson',
'route.option.tag.best-time': 'Fastest',
'route.option.tag.highest-amount': 'Best Return',
'route.option.info.estimated-time': 'Est. Time:',
Expand All @@ -44,8 +47,14 @@ export const en = {
'route.option.info.debridge-fee': 'deBridge Fee:',
'route.option.info.market-maker-fee': 'Market Maker Gas Costs:',
'route.option.info.base-fee': 'Base Fee:',
'route.option.info.lp-fee': 'Liquidity Providers:',
'route.option.info.service-fee': 'Service Fee:',
'route.option.info.protocol-fee': 'Protocol Fee:',

'route.error.amount.max': 'Your send amount must be less than {max}',
'route.error.amount.min': 'Your send amount must be greater than {min}',
'route.error.amount.digits': 'The send amount must be less than 6 digits',

'transfer.button.confirm': 'Send',
'transfer.button.approve': 'Approve',
'transfer.button.switch-network': 'Switch Network',
Expand Down Expand Up @@ -87,8 +96,15 @@ export const en = {
'select-modal.destination.incompatible.tooltip':
'The token you’ve selected is incompatible with this network. Please select another token.',

'wallet.button.connect-wallet': 'Connect Wallet',
'wallet.network.wrong-network': 'Wrong network',
'wallet.error.switch-network':
'An error occurred when attempting to switch the network. Please select another network or try again.',
'wallet.popover.disconnect': 'Disconnect',
'wallet.preventing-modal.title': 'Oops!',
'wallet.preventing-modal.desc':
'Opening an app is not allowed on this site. Please go to BNB Chain Bridge site on your mobile browser to continue.',
'wallet.switching-modal.title': 'Switch Network in Wallet',
'wallet.switching-modal.desc':
'Please go to the settings page and switch the network to TRON Mainnet',
};
40 changes: 40 additions & 0 deletions apps/canonical-bridge-ui/data-testnet/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useEffect, useState } from 'react';
import { ITransferConfig } from '@bnb-chain/canonical-bridge-widget';

import mesonConfigTestnet from '@/data-testnet/meson/config.json';

export function useTestnetTransferConfig() {
const [transferConfig, setTransferConfig] = useState<ITransferConfig>();

useEffect(() => {
const initConfig = async () => {
const transferConfig: ITransferConfig = {
defaultSelectedInfo: {
fromChainId: 97,
toChainId: 3448148188,
tokenSymbol: 'USDT', // USDT
amount: '',
},
order: {
chains: [],
tokens: ['USDC', 'USDT'],
},
displayTokenSymbols: {},
meson: {
config: mesonConfigTestnet.result as any,
exclude: {
chains: [],
tokens: {},
},
bridgedTokenGroups: [],
},
};

setTransferConfig(transferConfig);
};

initConfig();
}, []);

return transferConfig;
}
118 changes: 118 additions & 0 deletions apps/canonical-bridge-ui/data-testnet/meson/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"result": [
{
"id": "arb-sepolia",
"name": "Arbitrum Sepolia",
"chainId": "0x66eee",
"address": "0x0d12d15b26a32e72A3330B2ac9016A22b1410CB6",
"tokens": [
{
"id": "usdc",
"addr": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
"min": "0.5",
"max": "20000",
"decimals": 6
},
{
"id": "eth",
"decimals": 18,
"min": "0.001",
"max": "2"
}
]
},
{
"id": "sepolia",
"name": "Sepolia Testnet",
"chainId": "0xaa36a7",
"address": "0x0d12d15b26a32e72A3330B2ac9016A22b1410CB6",
"tokens": [
{
"id": "usdc",
"addr": "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
"decimals": 6,
"min": "0.5",
"max": "20000"
},
{
"id": "usdt",
"addr": "0xd53e9530107a8d8856099d7d80126478d48e06dA",
"decimals": 6,
"min": "0.5",
"max": "20000"
},
{
"id": "eth",
"decimals": 18,
"min": "0.001",
"max": "2"
}
]
},
{
"id": "bnb-testnet",
"name": "BNB Testnet",
"chainId": "0x61",
"address": "0x0d12d15b26a32e72A3330B2ac9016A22b1410CB6",
"tokens": [
{
"id": "usdc",
"addr": "0x64544969ed7EBf5f083679233325356EbE738930",
"decimals": 18,
"min": "0.5",
"max": "20000"
},
{
"id": "usdt",
"addr": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
"decimals": 18,
"min": "0.5",
"max": "20000"
}
]
},
{
"id": "opt-sepolia",
"name": "OP Sepolia",
"chainId": "0xaa37dc",
"address": "0x0d12d15b26a32e72A3330B2ac9016A22b1410CB6",
"tokens": [
{
"id": "usdc",
"addr": "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
"decimals": 6,
"min": "0.5",
"max": "20000"
},
{
"id": "eth",
"decimals": 18,
"min": "0.001",
"max": "2"
}
]
},
{
"id": "tron-testnet",
"name": "Tron Nile Testnet",
"chainId": "3448148188",
"address": "TAp1rBTjC4tefEMR54vT2NDwLEhDL7E7Jo",
"tokens": [
{
"id": "usdc",
"addr": "TNavP4dSwhGssWjX4gR8NvrMsgAQvBWoyY",
"decimals": 6,
"min": "0.5",
"max": "20000"
},
{
"id": "usdt",
"addr": "THkCEyw2uaJYPfxb2BNizGuiosCkyAsbWW",
"decimals": 6,
"min": "0.5",
"max": "20000"
}
]
}
]
}
90 changes: 90 additions & 0 deletions apps/canonical-bridge-ui/data-testnet/testnetChains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { IChainConfig } from '@bnb-chain/canonical-bridge-widget';

export const testnetChains: IChainConfig[] = [
{
id: 97,
name: 'BSC Testnet',
nativeCurrency: {
name: 'BNB',
symbol: 'BNB',
decimals: 18,
},
rpcUrl: 'https://bsc-testnet.bnbchain.org',
explorer: {
name: 'BSC Testnet',
url: 'https://testnet.bscscan.com',
},
},
{
id: 1001,
name: 'Klaytn Testnet Baobab',
nativeCurrency: {
name: 'KLAY',
symbol: 'KLAY',
decimals: 18,
},
rpcUrl: 'https://public-en-baobab.klaytn.net',
explorer: {
name: 'Klaytn Scope',
url: 'https://baobab.klaytnscope.com',
},
},
{
id: 11155111,
name: 'Sepolia',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
explorer: {
name: 'Sepolia Scan',
url: 'https://sepolia.etherscan.io',
},
},
{
id: 421614,
name: 'Arbitrum Sepolia Testnet',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
explorer: {
name: 'Sepolia ArbiScan',
url: 'https://sepolia.arbiscan.io/',
},
},
{
id: 11155420,
name: 'OP Sepolia',
nativeCurrency: {
name: 'ETH',
symbol: 'ETH',
decimals: 18,
},
rpcUrl: 'https://sepolia.optimism.io',
explorer: {
name: 'OP Sepolia Scan',
url: 'https://sepolia-optimistic.etherscan.io',
},
},
{
id: 3448148188,
name: 'Tron Nile Testnet',
nativeCurrency: {
name: 'TRX',
symbol: 'TRX',
decimals: 6,
},
rpcUrl: 'https://api.nileex.io',
explorer: {
name: 'Tron Nile Scan',
url: 'https://nile.tronscan.org/',
tokenUrlPattern: 'https://nile.tronscan.org/#/token20/{0}',
},
chainType: 'tron',
},
];
Loading

0 comments on commit 9558225

Please sign in to comment.