Generalize parameter

This commit is contained in:
Willian Mitsuda 2021-08-01 23:10:32 -03:00
parent ad29cbdc5d
commit 32ea63a3d0
2 changed files with 7 additions and 4 deletions

View File

@ -1,12 +1,12 @@
import { ethers } from "ethers"; import { ethers } from "ethers";
import { TransactionData, InternalOperation } from "./types"; import { InternalOperation } from "./types";
export const getInternalOperations = async ( export const getInternalOperations = async (
provider: ethers.providers.JsonRpcProvider, provider: ethers.providers.JsonRpcProvider,
txData: TransactionData txHash: string
) => { ) => {
const rawTransfers = await provider.send("ots_getInternalOperations", [ const rawTransfers = await provider.send("ots_getInternalOperations", [
txData.transactionHash, txHash,
]); ]);
const _transfers: InternalOperation[] = []; const _transfers: InternalOperation[] = [];

View File

@ -190,7 +190,10 @@ export const useInternalOperations = (
return; return;
} }
const _transfers = await getInternalOperations(provider, txData); const _transfers = await getInternalOperations(
provider,
txData.transactionHash
);
for (const t of _transfers) { for (const t of _transfers) {
t.from = provider.formatter.address(t.from); t.from = provider.formatter.address(t.from);
t.to = provider.formatter.address(t.to); t.to = provider.formatter.address(t.to);