Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"homepage": "https://github.com/project-serum/permissioned-markets-quickstart#readme",
"devDependencies": {
"@project-serum/anchor": "^0.13.2",
"@project-serum/anchor-cli": "^0.13.2",
"@project-serum/anchor": "^0.14.0",
"@project-serum/anchor-cli": "^0.14.0",
"@project-serum/common": "^0.0.1-beta.3",
"@project-serum/serum": "^0.13.55",
"@solana/spl-token": "^0.1.6",
Expand Down
18 changes: 16 additions & 2 deletions tests/permissioned-markets.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe("permissioned-markets", () => {

// Need to crank the cancel so that we can close later.
it("Cranks the cancel transaction", async () => {
await crankEventQueue(provider, marketProxy);
await crankEventQueuePermissioned(provider, marketProxy);
});

it("Closes an open orders account", async () => {
Expand Down Expand Up @@ -304,7 +304,7 @@ describe("permissioned-markets", () => {
});

it("Cranks the prune transaction", async () => {
await crankEventQueue(provider, marketProxy);
await crankEventQueuePermissioned(provider, marketProxy);
});

it("Closes an open orders account", async () => {
Expand Down Expand Up @@ -349,3 +349,17 @@ async function crankEventQueue(provider, marketProxy) {
eq = await marketProxy.market.loadEventQueue(provider.connection);
}
}

async function crankEventQueuePermissioned(provider, marketProxy) {
// TODO: can do this in a single transaction if we covert the pubkey bytes
// into a [u64; 4] array and sort. I'm lazy though.
let eq = await marketProxy.market.loadEventQueue(provider.connection);
while (eq.length > 0) {
const tx = new Transaction();
tx.add(
marketProxy.market.makeConsumeEventsPermissionedInstruction([eq[0].openOrders], provider.wallet.publicKey, 1)
);
await provider.send(tx);
eq = await marketProxy.market.loadEventQueue(provider.connection);
}
}
1 change: 1 addition & 0 deletions tests/utils/market-lister.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async function list({
DEX_PID,
proxyProgramId
),
consumeEventsAuthority: wallet.publicKey,
})
);

Expand Down
8 changes: 7 additions & 1 deletion tests/utils/market-maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ async function initOpenOrders(provider, marketProxy, marketMakerAccounts) {
)
);
let signers = [marketMakerAccounts.account];
await provider.send(tx, signers);
try {
await provider.send(tx, signers);
}
catch (e) {
console.log("failed to generate OOA");
throw e;
}
}

async function postOrders(provider, marketProxy, marketMakerAccounts) {
Expand Down
Loading