Updated test to use permissioned cranks
This commit is contained in:
parent
4349947eb6
commit
415ed85424
|
@ -1 +1 @@
|
|||
Subproject commit 1527aa7f9617561bd24f7f79ceff731136c3285c
|
||||
Subproject commit e5a58080dcca9c0b3a245dbf4a93b5cd7cb13839
|
|
@ -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",
|
||||
|
|
|
@ -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 () => {
|
||||
|
@ -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 () => {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,6 +136,7 @@ async function list({
|
|||
DEX_PID,
|
||||
proxyProgramId
|
||||
),
|
||||
consumeEventsAuthority: wallet.publicKey,
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -80,8 +80,14 @@ async function initOpenOrders(provider, marketProxy, marketMakerAccounts) {
|
|||
)
|
||||
);
|
||||
let signers = [marketMakerAccounts.account];
|
||||
try {
|
||||
await provider.send(tx, signers);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("failed to generate OOA");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async function postOrders(provider, marketProxy, marketMakerAccounts) {
|
||||
const asks = [
|
||||
|
|
Loading…
Reference in New Issue