feat: add express server to serve React build and update blockchain utility for token approval

This commit is contained in:
2026-01-05 13:55:37 +09:00
parent 108b78bf64
commit 729d2a7fd3
16 changed files with 114 additions and 12 deletions

View File

@@ -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("잔액부족")