Skip to content

Commit

Permalink
Merge pull request #326 from Once-Upon/feature/export-pseudotransactions
Browse files Browse the repository at this point in the history
Export util for 4337
  • Loading branch information
pcowgill authored Apr 18, 2024
2 parents 59ca0ac + caf5ce0 commit c636050
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/transformers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { AssetTransfer, NetAssetTransfers, RawBlock } from 'src/types';
import {
AssetTransfer,
NetAssetTransfers,
PartialTransaction,
PseudoTransaction,
RawBlock,
} from 'src/types';
import { makeTransform } from '../helpers/utils';
import * as pseudoTransactionsFromUserOps from './_common/accountAbstraction';
import * as transactionAssetTransfers from './_common/assetTransfers';
Expand Down Expand Up @@ -30,9 +36,11 @@ const children = {
transactionForks,
};

const utils = {
const utils: Utils = {
extractNetAssetTransfers:
transactionNetAssetTransfers.extractNetAssetTransfers,
unpackERC4337Transactions:
pseudoTransactionsFromUserOps.unpackERC4337Transactions,
};

const transformers = Object.fromEntries(
Expand All @@ -41,14 +49,19 @@ const transformers = Object.fromEntries(

const transform = makeTransform(transformers);

type Utils = {
extractNetAssetTransfers: (
assetTransfers: AssetTransfer[],
) => NetAssetTransfers;
unpackERC4337Transactions: (
transaction: PartialTransaction,
) => PseudoTransaction[];
};

type UsabilityTransformer = {
transform: (block: RawBlock) => RawBlock;
children: Record<string, unknown>;
utils: {
extractNetAssetTransfers: (
assetTransfers: AssetTransfer[],
) => NetAssetTransfers;
};
utils: Utils;
};

export const transformer: UsabilityTransformer = {
Expand Down

0 comments on commit c636050

Please sign in to comment.