Skip to content

Commit

Permalink
Emit user operation hash in event
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwalsh0 committed Jan 12, 2024
1 parent c6c62cc commit a0d96e0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bundler/BundlerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ import {
erc4337RuntimeVersion,
RpcError,
} from '../utils';
import EventEmitter from 'events';

const debug = Debug('aa.rpc');
export class BundlerServer {
app: Express;

hub: EventEmitter;

private readonly httpServer: Server;

constructor(
Expand All @@ -35,6 +38,8 @@ export class BundlerServer {
readonly wallet: Signer,
) {
this.app = express();
this.hub = new EventEmitter();

this.app.use(cors());
this.app.use(bodyParser.json());

Expand Down Expand Up @@ -185,6 +190,11 @@ export class BundlerServer {
params[0],
params[1],
);

if (result?.length) {
this.hub.emit('user-operation-added', result);
}

break;
case 'eth_estimateUserOperationGas':
result = await this.methodHandler.estimateUserOperationGas(
Expand Down

0 comments on commit a0d96e0

Please sign in to comment.