Only listen for whirlpool changes (#9)

This commit is contained in:
Britt Cyr 2023-11-02 01:41:45 +01:00 committed by GitHub
parent 6030dd78ae
commit e8c0ee62c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -383,6 +383,9 @@ export class Router {
// setup a websocket connection to refresh all whirpool program accounts
const idl = this.whirlpoolClient.getContext().program.idl;
const whirlpoolCoder = new BorshAccountsCoder(idl as Idl);
const whirlpoolInfoDiscriminator = Buffer.from(
sha256("account:Whirlpool")
).slice(0, 8);
this.whirlpoolSub = this.whirlpoolClient
.getContext()
.connection.onProgramAccountChange(
@ -396,7 +399,8 @@ export class Router {
value,
};
},
"processed"
"processed",
[{ memcmp: { offset: 0, bytes: bs58.encode(whirlpoolInfoDiscriminator) } }]
);
await this.indexRaydium();