Skip to content

Commit

Permalink
tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Dec 29, 2022
1 parent b08c8f6 commit cd1d282
Show file tree
Hide file tree
Showing 61 changed files with 1,774 additions and 931 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ jobs:
run: |
npm install ts-mocha -g
npm install --global mocha
- name: build sdk
run: cd sdk/ && yarn && yarn build && cd ..

Expand Down
2 changes: 1 addition & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ pyth = "gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s"

[[test.genesis]]
address = "DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY"
program = "./deps/serum-dex/dex/target/deploy/serum_dex.so"
program = "./deps/serum_dex.so"
Binary file added deps/serum_dex.so
Binary file not shown.
31 changes: 28 additions & 3 deletions sdk/src/accounts/pollingDriftClientAccountSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,21 +344,46 @@ export class PollingDriftClientAccountSubscriber
}

async addSpotMarket(marketIndex: number): Promise<boolean> {
const marketPublicKey = await getSpotMarketPublicKey(
this.program.programId,
marketIndex
);

if (this.accountsToPoll.has(marketPublicKey.toString())) {
return true;
}

await this.addSpotMarketAccountToPoll(marketIndex);
const accountToPoll = this.accountsToPoll.get(marketIndex.toString());

const accountToPoll = this.accountsToPoll.get(marketPublicKey.toString());
this.addAccountToAccountLoader(accountToPoll);

return true;
}

async addPerpMarket(marketIndex: number): Promise<boolean> {
const marketPublicKey = await getPerpMarketPublicKey(
this.program.programId,
marketIndex
);

if (this.accountsToPoll.has(marketPublicKey.toString())) {
return true;
}

await this.addPerpMarketAccountToPoll(marketIndex);
const accountToPoll = this.accountsToPoll.get(marketIndex.toString());

const accountToPoll = this.accountsToPoll.get(marketPublicKey.toString());
this.addAccountToAccountLoader(accountToPoll);

return true;
}

async addOracle(oracleInfo: OracleInfo): Promise<boolean> {
if (oracleInfo.publicKey.equals(PublicKey.default)) {
if (
oracleInfo.publicKey.equals(PublicKey.default) ||
this.oraclesToPoll.has(oracleInfo.publicKey.toString())
) {
return true;
}

Expand Down
Loading

0 comments on commit cd1d282

Please sign in to comment.