gov-ix: create an idl-resize instruction (#752)
This commit is contained in:
parent
c354f55423
commit
5809281f24
|
@ -8,6 +8,7 @@ import {
|
||||||
PublicKey,
|
PublicKey,
|
||||||
SYSVAR_RENT_PUBKEY,
|
SYSVAR_RENT_PUBKEY,
|
||||||
SystemProgram,
|
SystemProgram,
|
||||||
|
TransactionInstruction,
|
||||||
} from '@solana/web3.js';
|
} from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { TokenIndex } from '../src/accounts/bank';
|
import { TokenIndex } from '../src/accounts/bank';
|
||||||
|
@ -381,15 +382,46 @@ async function createMangoAccount(): Promise<void> {
|
||||||
console.log(await serializeInstructionToBase64(ix));
|
console.log(await serializeInstructionToBase64(ix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function idlResize(): Promise<void> {
|
||||||
|
// anchor constant for all idl-specific instructions
|
||||||
|
const idlIxBytes = [0x40, 0xf4, 0xbc, 0x78, 0xa7, 0xe9, 0x69, 0x0a];
|
||||||
|
const idlIxNum = 6; // resize
|
||||||
|
const newSize = new BN(19000);
|
||||||
|
const ix = new TransactionInstruction({
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
pubkey: new PublicKey('3foqXduY5PabCn6LjNrLo3waNf3Hy6vQgqavoVUCsUN9'), // idl account
|
||||||
|
isSigner: false,
|
||||||
|
isWritable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pubkey: new PublicKey('FP4PxqHTVzeG2c6eZd7974F9WvKUSdBeduUK3rjYyvBw'), // authority
|
||||||
|
isSigner: true,
|
||||||
|
isWritable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pubkey: new PublicKey('11111111111111111111111111111111'), // system program
|
||||||
|
isSigner: false,
|
||||||
|
isWritable: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
programId: MANGO_V4_ID['mainnet-beta'],
|
||||||
|
data: Buffer.from(idlIxBytes.concat([idlIxNum], newSize.toArray('le', 8))),
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(await serializeInstructionToBase64(ix));
|
||||||
|
}
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// await tokenRegister();
|
// await tokenRegister();
|
||||||
// await tokenEdit();
|
// await tokenEdit();
|
||||||
// await perpCreate();
|
// await perpCreate();
|
||||||
await perpEdit();
|
// await perpEdit();
|
||||||
// await serum3Register();
|
// await serum3Register();
|
||||||
// await ixDisable();
|
// await ixDisable();
|
||||||
// await createMangoAccount();
|
// await createMangoAccount();
|
||||||
|
await idlResize();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue