= ({
- {transfers && (
-
- {transfers.map((t, i) => (
-
- ))}
-
+ {internalTransfers && (
+ <>
+
+ {internalTransfers.transfers.map((t, i) => (
+
+ ))}
+
+
+ {internalTransfers.selfDestructs.map((t, i) => (
+
+ ))}
+
+ >
)}
diff --git a/src/types.ts b/src/types.ts
index 9ee8d3d..2e572bd 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -68,6 +68,11 @@ export type Transfer = {
value: BigNumber;
};
+export type InternalTransfers = {
+ transfers: Transfer[];
+ selfDestructs: Transfer[];
+};
+
export type TokenTransfer = {
token: string;
from: string;
diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts
index 2d3aa9b..589ec34 100644
--- a/src/useErigonHooks.ts
+++ b/src/useErigonHooks.ts
@@ -1,13 +1,16 @@
import { ethers } from "ethers";
import { useState, useEffect } from "react";
-import { getTransactionTransfers } from "./nodeFunctions";
-import { TransactionData, Transfer } from "./types";
+import {
+ getTransactionSelfDestructs,
+ getTransactionTransfers,
+} from "./nodeFunctions";
+import { InternalTransfers, TransactionData } from "./types";
export const useInternalTransfers = (
provider: ethers.providers.JsonRpcProvider | undefined,
txData: TransactionData | undefined
-) => {
- const [transfers, setTransfers] = useState();
+): InternalTransfers | undefined => {
+ const [intTransfers, setIntTransfers] = useState();
useEffect(() => {
const traceTransfers = async () => {
@@ -16,10 +19,17 @@ export const useInternalTransfers = (
}
const _transfers = await getTransactionTransfers(provider, txData);
- setTransfers(_transfers);
+ const _selfDestructs = await getTransactionSelfDestructs(
+ provider,
+ txData
+ );
+ for (const s of _selfDestructs) {
+ s.value = provider.formatter.bigNumber(s.value);
+ }
+ setIntTransfers({ transfers: _transfers, selfDestructs: _selfDestructs });
};
traceTransfers();
}, [provider, txData]);
- return transfers;
+ return intTransfers;
};