Skip to content

Commit

Permalink
(fix) Fix typescript compile
Browse files Browse the repository at this point in the history
  • Loading branch information
rrw-zilliqa committed Aug 30, 2024
1 parent 5e06a93 commit 7187511
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 6 additions & 6 deletions bridge-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ function App() {
const { data: contractDecimals } = useContractRead({
abi: erc20ABI,
functionName: "decimals",
address: token.address,
address: token.address ?? zeroAddress,
enabled: !!token.address,
});
const { data: contractSymbol } = useContractRead({
abi: erc20ABI,
functionName: "symbol",
address: token.address,
address: token.address ?? zeroAddress,
enabled: !!token.address,
});
const { data: fees } = useContractRead({
Expand All @@ -123,7 +123,7 @@ function App() {
abi: erc20ABI,
functionName: "balanceOf",
args: account ? [account!] : undefined,
address: token.address,
address: token.address ?? zeroAddress,
enabled: !!account && !!token.address,
watch: true,
});
Expand All @@ -143,7 +143,7 @@ function App() {
const { data: allowance } = useContractRead({
abi: erc20ABI,
functionName: "allowance",
address: token.address,
address: token.address ?? zeroAddress,
args: [account!, token.tokenManagerAddress],
enabled:
!isNative && !!account && !!token.address && !!token.tokenManagerAddress,
Expand All @@ -168,7 +168,7 @@ function App() {

let addressForTokenManager = isNative
? zeroAddress
: getAddress(token.address);
: getAddress(token.address ?? zeroAddress);
const { config: transferConfig } = usePrepareContractWrite({
address: token.tokenManagerAddress,
abi: tokenManagerAbi,
Expand Down Expand Up @@ -219,7 +219,7 @@ function App() {

// Approvals
const { config: approveConfig } = usePrepareContractWrite({
address: token.address,
address: token.address ?? zeroAddress,
abi: erc20ABI,
args: [
token.tokenManagerAddress,
Expand Down
16 changes: 9 additions & 7 deletions bridge-web/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export const chainConfigs: Partial<Record<Chains, ChainConfig>> =
"zq-testnet": {
chain: "zq-testnet",
name: "Zilliqa Testnet",
tokenManagerAddress: "0x1509988c41f02014aA59d455c6a0D67b5b50f129",
tokenManagerType: TokenManagerType.LockAndRelease,
chainGatewayAddress: "0x7370e69565BB2313C4dA12F9062C282513919230",
wagmiChain: zilliqaTestnet,
tokens: [
Expand Down Expand Up @@ -198,8 +196,6 @@ export const chainConfigs: Partial<Record<Chains, ChainConfig>> =
bscTestnet,
`${import.meta.env.VITE_BSC_TESTNET_API}/${import.meta.env.VITE_BSC_TESTNET_KEY}`,
),
tokenManagerAddress: "0xA6D73210AF20a59832F264fbD991D2abf28401d0",
tokenManagerType: TokenManagerType.MintAndBurn,
chainGatewayAddress: "0xa9A14C90e53EdCD89dFd201A3bF94D867f8098fE",
tokens: [
{
Expand All @@ -208,20 +204,26 @@ export const chainConfigs: Partial<Record<Chains, ChainConfig>> =
blockExplorer:
"https://testnet.bscscan.com/address/0x486722DbA2F76aeFb9977641D11f3aC3e5bA281f",
logo: seed_token,
tokenManagerAddress: "0xA6D73210AF20a59832F264fbD991D2abf28401d0",
tokenManagerType: TokenManagerType.MintAndBurn,
},
{
name: "TST",
address: "0x5190e8b4Bbe8C3a732BAdB600b57fD42ACbB9F4B",
blockExplorer:
"https://testnet.bscscan.com/address/0x5190e8b4Bbe8C3a732BAdB600b57fD42ACbB9F4B",
logo: fps_token,
tokenManagerAddress: "0xA6D73210AF20a59832F264fbD991D2abf28401d0",
tokenManagerType: TokenManagerType.MintAndBurn,
},
{
name: "TSLM B",
address: "0x7Cc585de659E8938Aa7d5709BeaF34bD108bdC03",
blockExplorer:
"https://testnet.bscscan.com/address/0x7Cc585de659E8938Aa7d5709BeaF34bD108bdC03",
logo: test_hrse_token,
tokenManagerAddress: "0xA6D73210AF20a59832F264fbD991D2abf28401d0",
tokenManagerType: TokenManagerType.MintAndBurn,
},
{
name: "TST",
Expand Down Expand Up @@ -270,9 +272,7 @@ export type ChainConfig = {
name: string;
chain: Chains;
wagmiChain: Chain;
tokenManagerAddress: `0x${string}`;
chainGatewayAddress: `0x${string}`;
tokenManagerType: TokenManagerType;
tokens: TokenConfig[];
chainId: number;
isZilliqa: boolean;
Expand All @@ -282,9 +282,11 @@ export type ChainConfig = {

export type TokenConfig = {
name: string;
address: `0x${string}`;
address: `0x${string}` | null;
blockExplorer: string;
logo?: string;
tokenManagerAddress: `0x${string}`;
tokenManagerType: TokenManagerType;
};

export type SiteConfig = {
Expand Down

0 comments on commit 7187511

Please sign in to comment.