Skip to content

Commit

Permalink
fix: eth transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ponyjackal committed Nov 29, 2023
1 parent 5d30d8c commit e24a24a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/heuristics/ethTransfer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Transaction } from '../types';

export async function ethTransferContextualizer(
export function ethTransferContextualizer(
transaction: Transaction,
): Promise<Transaction> {
const isEthTransfer = await detectETHTransfer(transaction);
): Transaction {
const isEthTransfer = detectETHTransfer(transaction);
if (!isEthTransfer) return transaction;

return generateETHTransferContext(transaction);
}

async function detectETHTransfer(transaction: Transaction): Promise<boolean> {
export function detectETHTransfer(transaction: Transaction): boolean {
// TODO; check logs from transaction
if (
(transaction.input === '0x' || transaction.input === '') &&
Expand All @@ -22,7 +22,9 @@ async function detectETHTransfer(transaction: Transaction): Promise<boolean> {
return false;
}

function generateETHTransferContext(transaction: Transaction): Transaction {
export function generateETHTransferContext(
transaction: Transaction,
): Transaction {
transaction.context = {
variables: {
sender: {
Expand Down

0 comments on commit e24a24a

Please sign in to comment.