ts: fix scripts

- group create
- perp event queue + book side sizes
This commit is contained in:
Christian Kamm 2022-08-01 18:35:26 +02:00
parent c22590302a
commit 157b322635
4 changed files with 12 additions and 8 deletions

View File

@ -1116,12 +1116,14 @@ export class MangoClient {
})
.preInstructions([
// TODO: try to pick up sizes of bookside and eventqueue from IDL, so we can stay in sync with program
// book sides
SystemProgram.createAccount({
programId: this.program.programId,
space: 8 + 90136,
space: 8 + 98584,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
90144,
8 + 98584,
),
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,
@ -1129,21 +1131,22 @@ export class MangoClient {
}),
SystemProgram.createAccount({
programId: this.program.programId,
space: 8 + 90136,
space: 8 + 98584,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
90144,
8 + 98584,
),
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,
newAccountPubkey: asks.publicKey,
}),
// event queue
SystemProgram.createAccount({
programId: this.program.programId,
space: 8 + 102416,
space: 8 + 4 * 2 + 8 + 488 * 208,
lamports:
await this.program.provider.connection.getMinimumBalanceForRentExemption(
102424,
8 + 4 * 2 + 8 + 488 * 208,
),
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,

View File

@ -57,7 +57,7 @@ async function main() {
console.log(`Creating Group...`);
const insuranceMint = new PublicKey(DEVNET_MINTS.get('USDC')!);
try {
await client.groupCreate(GROUP_NUM, true, insuranceMint, 0);
await client.groupCreate(GROUP_NUM, true, 0, insuranceMint);
} catch (error) {
console.log(error);
}

View File

@ -42,7 +42,7 @@ async function main() {
console.log(`Creating Group...`);
try {
const insuranceMint = new PublicKey(MAINNET_MINTS.get('USDC')!);
await client.groupCreate(0, true, insuranceMint, 0);
await client.groupCreate(0, true, 0, insuranceMint);
} catch (error) {
console.log(error);
}

View File

@ -1,6 +1,7 @@
import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair } from '@solana/web3.js';
import fs from 'fs';
import { AccountSize } from '../../accounts/mangoAccount';
import { MangoClient } from '../../client';
import { MANGO_V4_ID } from '../../constants';