Skip to content

Commit

Permalink
Merge pull request #116 from lidofinance/develop
Browse files Browse the repository at this point in the history
Minor fix
  • Loading branch information
Jeday authored Dec 13, 2023
2 parents 2fc1faa + b6b9887 commit c14630d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/react/src/factories/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,45 @@ import { SWRConfiguration } from 'swr';
export const hooksFactory = (
getTokenAddress: (chainId: CHAINS) => string,
): {
useTokenBalance: () => SWRResponse<BigNumber>;
useTotalSupply: () => SWRResponse<BigNumber>;
useDecimals: () => SWRResponse<number>;
useAllowance: (spender: string) => SWRResponse<BigNumber>;
useTokenBalance: (
config?: SWRConfiguration<BigNumber>,
) => SWRResponse<BigNumber>;
useTotalSupply: (
config?: SWRConfiguration<BigNumber>,
) => SWRResponse<BigNumber>;
useDecimals: (config?: SWRConfiguration<number>) => SWRResponse<number>;
useAllowance: (
spender: string,
config?: SWRConfiguration<BigNumber>,
) => SWRResponse<BigNumber>;
useApprove: (
amount: BigNumber,
spender: string,
wrapper: UseApproveWrapper,
) => UseApproveResponse;
} => {
return {
useTokenBalance: (config?: SWRConfiguration<BigNumber>) => {
useTokenBalance: (config) => {
const { chainId } = useSDK();
const tokenAddress = getTokenAddress(chainId);
return useTokenBalance(tokenAddress, undefined, config);
},
useTotalSupply: (config?: SWRConfiguration<BigNumber>) => {
useTotalSupply: (config) => {
const { chainId } = useSDK();
const tokenAddress = getTokenAddress(chainId);
return useTotalSupply(tokenAddress, config);
},
useDecimals: (config?: SWRConfiguration<number>) => {
useDecimals: (config) => {
const { chainId } = useSDK();
const tokenAddress = getTokenAddress(chainId);
return useDecimals(tokenAddress, config);
},
useAllowance: (spender: string, config?: SWRConfiguration<BigNumber>) => {
useAllowance: (spender, config) => {
const { chainId } = useSDK();
const tokenAddress = getTokenAddress(chainId);
return useAllowance(tokenAddress, spender, undefined, config);
},
useApprove: (
amount: BigNumber,
spender: string,
wrapper?: UseApproveWrapper,
) => {
useApprove: (amount, spender, wrapper) => {
const { chainId, account } = useSDK();
const tokenAddress = getTokenAddress(chainId);
return useApprove(amount, tokenAddress, spender, account, wrapper);
Expand Down

0 comments on commit c14630d

Please sign in to comment.