Skip to content

Commit 58f2847

Browse files
authored
Add new version mooncake program id (#18518)
1 parent efead37 commit 58f2847

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

projects/mooncake/index.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes');
66
async function tvl(api) {
77
const connection = getConnection();
88

9-
const marketStateAccounts = await connection.getProgramAccounts(
10-
new PublicKey('mnCk3moW6q9UszVev3C9JjtE4YoviXgLwiLCnUy3c4D'),
11-
{
12-
filters: [
13-
{
14-
memcmp: {
15-
offset: 0,
16-
bytes: bs58.encode(crypto.createHash('sha256').update("account:MarketState").digest().slice(0, 8)),
9+
const programIds = [
10+
'mnCk3moW6q9UszVev3C9JjtE4YoviXgLwiLCnUy3c4D',
11+
'mNckKuED6PTxgdQQgnXYLuFQFDjb3urdTfXDSSUwydJ',
12+
];
13+
const marketStateAccounts = [];
14+
15+
for (const programId of programIds) {
16+
const accounts = await connection.getProgramAccounts(
17+
new PublicKey(programId),
18+
{
19+
filters: [
20+
{
21+
memcmp: {
22+
offset: 0,
23+
bytes: bs58.encode(crypto.createHash('sha256').update("account:MarketState").digest().slice(0, 8)),
24+
},
1725
},
18-
},
19-
]
20-
}
21-
);
26+
]
27+
}
28+
);
29+
marketStateAccounts.push(...accounts);
30+
}
2231

2332
const tokenAccounts = []
2433

0 commit comments

Comments
 (0)