add validations to search tokens form, also implemented core functions
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com> Co-authored-by: Esio Freitas <esio.gustavo@gmail.com>
This commit is contained in:
@@ -45,7 +45,6 @@ const connectProvider = async () => {
|
||||
const events = await p2pContract.queryFilter(filter);
|
||||
|
||||
console.log(events)
|
||||
|
||||
etherStore.setDepositList(events);
|
||||
|
||||
connection.on("accountsChanged", (accounts: string[]) => {
|
||||
@@ -129,6 +128,11 @@ const formatEther = (balance: string) => {
|
||||
return formatted;
|
||||
};
|
||||
|
||||
const verifyDepositAmmount = (ammountBigNumber: BigNumber) => {
|
||||
return ethers.utils.formatEther(ammountBigNumber)
|
||||
}
|
||||
|
||||
|
||||
const getProvider = (): ethers.providers.Web3Provider | null => {
|
||||
const window_ = window as any;
|
||||
const connection = window_.ethereum;
|
||||
@@ -138,4 +142,4 @@ const getProvider = (): ethers.providers.Web3Provider | null => {
|
||||
return new ethers.providers.Web3Provider(connection);
|
||||
};
|
||||
|
||||
export default { connectProvider, formatEther, splitTokens, mockDeposit, countDeposit, mapDeposits };
|
||||
export default { connectProvider, formatEther, splitTokens, mockDeposit, countDeposit, mapDeposits, verifyDepositAmmount };
|
||||
|
||||
9
src/utils/debounce.ts
Normal file
9
src/utils/debounce.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export const debounce = (func: any, delay: number) => {
|
||||
let timer: any = null
|
||||
return function (this: unknown, ...args: any) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
func.apply(this, args)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user