Skip to content

Commit

Permalink
add: payment
Browse files Browse the repository at this point in the history
  • Loading branch information
mayur-samrutwar committed Nov 14, 2022
1 parent ce47f17 commit 715fac3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions NEUTRAL/comps/SendTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export function SendTransaction() {
});
}

useEffect(() => {
setTimeout(() => redirectToResult(), 15000);
});

const { config } = usePrepareContractWrite({
address: "0x1Da87eA2610CAF5192804407EeeA840C670bF0E1",
abi: [
Expand Down Expand Up @@ -63,11 +67,6 @@ export function SendTransaction() {
hash: data?.hash,
});

useEffect(() => {
console.log("called");
redirectToResult();
}, isSuccess);

return (
<div>
<button
Expand All @@ -77,6 +76,8 @@ export function SendTransaction() {
>
{isLoading ? "Retiring..." : "Retire Carbon"}
</button>

{isSuccess && redirectToResult}
</div>
);
}
6 changes: 3 additions & 3 deletions NEUTRAL/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Home() {
setIsLoading(true);
const totalTransactions = await axios
.get(
`https://api.polygonscan.com/api?module=account&action=txlist&address=${address}&apikey=DF3AFFV14R6G68FFTM331SNMR4QW56ZVVK&startblock=0&endblock=99999999&page=1&offset=10&sort=asc`
`https://api.polygonscan.com/api?module=account&action=txlist&address=0xfd2A47A6C6eEFfb2Acce043c3Ac06D3f53C4e22B&apikey=DF3AFFV14R6G68FFTM331SNMR4QW56ZVVK&startblock=0&endblock=99999999&page=1&offset=10&sort=asc`
)
.then((res) => {
setIsLoading(false);
Expand All @@ -47,8 +47,8 @@ export default function Home() {
router.push({
pathname: "/result",
query: {
address: addressC ? addressC : address,
totalCo2: totalCo2,
address: "0xfd2A47A6C6eEFfb2Acce043c3Ac06D3f53C4e22B",
totalCo2: 0.000003,
percentage: 10,
},
});
Expand Down

0 comments on commit 715fac3

Please sign in to comment.