Skip to content

Commit

Permalink
fix: Fix tron allowance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Halibao-Lala committed Oct 18, 2024
1 parent e843af3 commit 9c333cc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions apps/canonical-bridge-ui/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export function useTransferConfig() {

const transferConfig: ITransferConfig = {
defaultSelectedInfo: {
fromChainId: 1,
toChainId: 56,
fromChainId: 728126427,
toChainId: 11155111,
tokenSymbol: 'USDT', // USDT
amount: '',
},
Expand Down
6 changes: 3 additions & 3 deletions apps/canonical-bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"@types/node": "^20",
"@types/react": "~18.3.8",
"@types/react-dom": "~18.3.0",
"encoding": "~0.1.13",
"eslint": "^8.8.0",
"eslint-config-next": "14.2.3",
"lint-staged": "~13.0.3",
"prettier": "~2.7.1",
"typescript": "5.5.4",
"encoding": "~0.1.13",
"supports-color": "8.1.1"
"supports-color": "8.1.1",
"typescript": "5.5.4"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
2 changes: 1 addition & 1 deletion apps/canonical-bridge-ui/pages/testnet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const bridgeConfig: ICanonicalBridgeConfig = {
assetPrefix: env.ASSET_PREFIX,

appearance: {
bridgeTitle: 'BNB Chain Cross-Chain Bridge',
bridgeTitle: 'BNB Chain Cross-Chain Bridge Testnet',
locale: 'en',
messages,
mode: 'dark',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BaseAdapter, ITransferTokenPair } from '@/modules/aggregator/shared/Bas
import { IMesonChain, IMesonToken } from '@/modules/aggregator/adapters/meson/types';

const SUPPORTED_CHAIN_IDS = [56, 97, 728126427, 728126428];
const SUPPORTED_TOKENS = ['USDT'];
const SUPPORTED_TOKENS = ['USDT', 'USDC'];

export class MesonAdapter extends BaseAdapter<IMesonChain[], IMesonChain, IMesonToken> {
public bridgeType: BridgeType = 'meson';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const useGetTronAllowance = () => {
trc20Address: selectedToken?.address,
tronBridgeAddress: transferActionInfo?.bridgeAddress,
});
if (typeof allowance === 'bigint' && !!allowance) setAllowance(allowance);
if (typeof allowance === 'bigint' && allowance !== null) {
setAllowance(allowance);
} else if (typeof allowance?.[0] === 'bigint') {
setAllowance(allowance?.[0]);
}
// eslint-disable-next-line no-console
console.log('Tron token allowance', allowance);
return { allowance };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useIntl,
InputGroup,
InputRightElement,
Checkbox,
} from '@bnb-chain/space';
import { ChangeEvent, useRef, useState } from 'react';

Expand All @@ -22,7 +23,7 @@ export function ToAccount(props: FlexProps) {
const { formatMessage } = useIntl();
const dispatch = useAppDispatch();

// const [isChecked, setIsChecked] = useState(false);
const [isChecked, setIsChecked] = useState(false);

const toAccount = useAppSelector((state) => state.transfer.toAccount);
const toChain = useAppSelector((state) => state.transfer.toChain);
Expand Down Expand Up @@ -51,13 +52,13 @@ export function ToAccount(props: FlexProps) {

const isInvalid = !isAvailableAccount && !!toAccount.address;

// const onCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// if (e.target.checked === true) {
// setIsChecked(true);
// } else {
// setIsChecked(false);
// }
// };
const onCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.checked === true) {
setIsChecked(true);
} else {
setIsChecked(false);
}
};

return (
<Flex
Expand Down

0 comments on commit 9c333cc

Please sign in to comment.