confirm order was placed

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-04-04 10:20:51 +02:00
parent 5f89a2d581
commit 53becd681b
1 changed files with 13 additions and 3 deletions

View File

@ -298,7 +298,7 @@ async function main() {
let freshAccount = await getMangoAccount(userClient, mangoAccount.publicKey);
console.log(
`Mango account ${freshAccount.getNativeDeposit(
`- Mango account ${freshAccount.getNativeDeposit(
freshBank,
)} Deposits for bank ${freshBank.tokenIndex}`,
);
@ -324,6 +324,7 @@ async function main() {
],
serumProgramId,
);
const clientOrderId = Date.now();
await serum3PlaceOrder(
userClient,
group.publicKey,
@ -346,15 +347,24 @@ async function main() {
btcBank.vault,
healthRemainingAccounts,
Serum3Side.bid,
400000,
40000,
1,
1000000,
Serum3SelfTradeBehavior.decrementTake,
Serum3OrderType.limit,
0,
clientOrderId,
10,
);
const ordersForOwner = await serum3MarketExternal.loadOrdersForOwner(
userClient.program.provider.connection,
group.publicKey,
);
const orderJustPlaced = ordersForOwner.filter(
(order) => order.clientId?.toNumber() === clientOrderId,
)[0];
console.log(`- Serum3 order orderId ${orderJustPlaced.orderId}`);
process.exit(0);
}