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

feat: Tron support #4

Merged
merged 51 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
83a50ad
feat: Support meson
wenty22 Oct 18, 2024
a6eaaaa
feat: Add meson
wenty22 Oct 18, 2024
120a609
fix: Fix tron allowance issue
Halibao-Lala Oct 18, 2024
d55d6eb
fix: Display other meson API messages
Halibao-Lala Oct 21, 2024
320ea2b
feat: To address confirmed checkbox
Halibao-Lala Oct 21, 2024
e448127
fix: Fix default chain
Halibao-Lala Oct 21, 2024
cc9ba0d
Merge pull request #18 from bnb-chain/fix/meson
wenty22 Oct 21, 2024
a7876c7
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
5de8636
chore: Update gh-pages cicd
wenty22 Oct 21, 2024
b4f402d
fix: Clear destination account input value after switching from chain
Halibao-Lala Oct 21, 2024
f31d505
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
d683210
feat: Tron address validation
Halibao-Lala Oct 21, 2024
e6d5da1
Merge pull request #27 from bnb-chain/fix/meson
Halibao-Lala Oct 21, 2024
6f4bb69
fix: Fix route error zindex issue
Halibao-Lala Oct 21, 2024
03c7a9d
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
2b888d5
fix: Tron contract verification
Halibao-Lala Oct 21, 2024
4d549b0
Merge pull request #28 from bnb-chain/fix/meson
Halibao-Lala Oct 21, 2024
827529a
fix(canonical-bridge-widget): Fix tron token balances
wenty22 Oct 21, 2024
6372232
fix: Disable send button on invalid to address
Halibao-Lala Oct 21, 2024
56de81f
Merge pull request #29 from bnb-chain/fix/meson
Halibao-Lala Oct 21, 2024
535bb24
fix(canonical-bridge-widget): Fix tron icon display issue on mobile
wenty22 Oct 21, 2024
2e48e91
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
2aaf374
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
2350056
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
5e9eaa0
Merge branch 'main' into feat/meson
wenty22 Oct 21, 2024
045def0
chore: Update cicd
wenty22 Oct 21, 2024
54c492f
fix: Fix typo
Halibao-Lala Oct 21, 2024
1d1c540
Merge pull request #34 from bnb-chain/fix/meson
Halibao-Lala Oct 21, 2024
5b3417e
fix(canonical-bridge-widget): Show error tips for tron if is insuffic…
wenty22 Oct 22, 2024
5828a43
fix(canonical-bridge-widget): Hide balance if chain type is different…
wenty22 Oct 22, 2024
825c689
fix: Fix max balance issue
wenty22 Oct 22, 2024
804004e
feat: Evm to account address verification
Halibao-Lala Oct 22, 2024
69c46cd
Merge pull request #35 from bnb-chain/fix/meson
Halibao-Lala Oct 22, 2024
df5643c
fix: Preventing jumping to another wallet app on mobile
wenty22 Oct 23, 2024
d921729
fix: Preventing jumping to another wallet app on mobile
wenty22 Oct 23, 2024
e7a1f51
chore: Add alpha publish
wenty22 Oct 23, 2024
7bc4528
docs: Publish alpha version
wenty22 Oct 23, 2024
7ac1f08
feat: Support switch network for tron
wenty22 Oct 23, 2024
5ce28b8
feat: Support switch network for tron
wenty22 Oct 23, 2024
f88a7af
feat: Add tips for meson route error
wenty22 Oct 23, 2024
79d82b8
fix: Convert balance to string avoid scientific notation issue
wenty22 Oct 23, 2024
4a4f56b
fix: Add switching tips for tron
wenty22 Oct 23, 2024
1f5f89f
fix: Avoid multiple clicks for approve button
wenty22 Oct 23, 2024
8218b07
feat: Support tron wallet auto connect
wenty22 Oct 23, 2024
819a8f9
docs: Update version
wenty22 Oct 23, 2024
69b6d3a
fix: Only show supported networks in status popup
wenty22 Oct 23, 2024
1eccdf2
fix: Only show supported networks in status popup
wenty22 Oct 23, 2024
7214478
fix: Fix input error message style
Halibao-Lala Oct 24, 2024
656c59a
Merge pull request #46 from bnb-chain/fix/meson
Halibao-Lala Oct 24, 2024
3790485
feat: Get native token balance based on selected chain
Halibao-Lala Oct 24, 2024
e267ab8
Merge pull request #47 from bnb-chain/fix/meson
Halibao-Lala Oct 24, 2024
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
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
Loading