Skip to content

Commit

Permalink
ts: add commitment param to addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
livthomas committed Jun 26, 2024
1 parent 70d4f48 commit 58b3b56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The minor version will be incremented upon a breaking change and the patch versi

### Fixes

- ts: add optional `commitment` parameter to `Program.addEventListener` ([#3052](https://github.com/coral-xyz/anchor/pull/3052))

### Breaking

## [0.30.1] - 2024-06-20
Expand Down
12 changes: 7 additions & 5 deletions ts/packages/anchor/src/program/event.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PublicKey } from "@solana/web3.js";
import { IdlEvent, IdlField } from "../idl.js";
import { Commitment, PublicKey } from "@solana/web3.js";
import { Coder } from "../coder/index.js";
import { DecodeType } from "./namespace/types.js";
import { IdlEvent, IdlField } from "../idl.js";
import Provider from "../provider.js";
import { DecodeType } from "./namespace/types.js";

const PROGRAM_LOG = "Program log: ";
const PROGRAM_DATA = "Program data: ";
Expand Down Expand Up @@ -73,7 +73,8 @@ export class EventManager {

public addEventListener(
eventName: string,
callback: (event: any, slot: number, signature: string) => void
callback: (event: any, slot: number, signature: string) => void,
commitment?: Commitment
): number {
let listener = this._listenerIdCount;
this._listenerIdCount += 1;
Expand Down Expand Up @@ -116,7 +117,8 @@ export class EventManager {
});
}
}
}
},
commitment
);

return listener;
Expand Down

0 comments on commit 58b3b56

Please sign in to comment.