feat: add express server to serve React build and update blockchain utility for token approval
This commit is contained in:
@@ -21,17 +21,17 @@ export const multisend = async (tokenAddress, provider, from, toArray, amountArr
|
||||
{
|
||||
try {
|
||||
const tokenContract = new ethers.Contract(tokenAddress, tokenAbi, signer);
|
||||
|
||||
let allowance = isToken ? await tokenContract.allowance(from, contractAddress) : 0;
|
||||
let balance = isToken ? await tokenContract.balanceOf(from) : await provider.getBalance(from);
|
||||
|
||||
if(balance >= parseEther(totalAmount.toString())){
|
||||
if(isToken)
|
||||
{
|
||||
////token approve
|
||||
// const tx = await tokenContract.approve(
|
||||
// contractAddress,
|
||||
// parseEther(totalAmount.toString())
|
||||
// )
|
||||
// await provider.waitForTransaction(tx.hash);
|
||||
if( isToken && allowance < parseEther(totalAmount.toString()))
|
||||
{
|
||||
const tx = await tokenContract.approve(
|
||||
contractAddress,
|
||||
parseEther(totalAmount.toString())
|
||||
)
|
||||
await provider.waitForTransaction(tx.hash);
|
||||
}
|
||||
} else {
|
||||
throw new Error("잔액부족")
|
||||
|
||||
Reference in New Issue
Block a user