trying to parse tx data

master
lza_menace 2 years ago
parent f9adcafc6e
commit 98dc0d076f

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { ethers, BigNumber } from 'ethers';
import { useAccount, useContractReads, usePrepareContractWrite, useContractWrite } from 'wagmi';
import { useAccount, useContractReads, usePrepareContractWrite, useContractWrite, useTransaction } from 'wagmi';
import Typewriter from 'react-ts-typewriter';
import Slider from 'rc-slider';
import { Parallax } from 'react-parallax';
@ -180,7 +180,9 @@ function Section3() {
unaboomerSupply: 0,
bombSupply: 0,
bombsExploded: 0,
unaboomersKilled: 0
unaboomersKilled: 0,
results: [],
tokensKilled: []
});
const handleStateChange = (obj) =>{
setOptions(preState => ({...preState , ...obj}))
@ -286,6 +288,17 @@ function Section3() {
args: [options.sendBombAmount]
});
const sendBombsWrite = useContractWrite(sendBombsPrepare.config);
const { data: tx } = useTransaction({ ...sendBombsWrite.data, enabled: sendBombsWrite.isSuccess });
if (tx) {
// let r;
const iface = new ethers.utils.Interface(MainABI);
console.log(tx)
// let txRes = iface.decodeFunctionResult("sendBombs", tx.data);
// console.log(txRes)
// const {0: results, 1: tokensKilled} = txRes.functionFragment.outputs;
// console.log(results);
// console.log(tokensKilled);
}
return (
<section className="section" id="mintSection">
{isConnected &&

Loading…
Cancel
Save