Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-08-04 09:53:38 +02:00
parent c39cbc660b
commit 325e29c9a3
16 changed files with 27 additions and 21 deletions

View File

@ -46,7 +46,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
// collect mappings &
// collect pubkeys

View File

@ -33,7 +33,7 @@ async function main() {
MANGO_V4_ID['devnet'],
);
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`Group ${group.publicKey}`);
let sig;

View File

@ -63,7 +63,7 @@ async function main() {
} catch (error) {
console.log(error);
}
const group = await client.getGroupForAdmin(admin.publicKey, GROUP_NUM);
const group = await client.getGroupForCreator(admin.publicKey, GROUP_NUM);
console.log(`...registered group ${group.publicKey}`);
// stub oracle + register token 0

View File

@ -36,7 +36,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
console.log(`Found group ${group.publicKey.toBase58()}`);
// create + fetch account

View File

@ -31,7 +31,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
console.log(`Found group ${group.publicKey.toBase58()}`);
process.exit();
}

View File

@ -43,12 +43,12 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
console.log(`Found group ${group.publicKey.toBase58()}`);
// fetch account
const mangoAccount = (
await client.getMangoAccountsForOwner(group, user.publicKey)[0]
await client.getMangoAccountsForOwner(group, user.publicKey)
)[0];
console.log(`...found mangoAccount ${mangoAccount.publicKey}`);
console.log(mangoAccount.toString());
@ -109,7 +109,7 @@ async function main() {
group.findBank(token.tokenIndex)!.name,
nativeFlooredNumber,
false,
user
user,
);
}

View File

@ -79,7 +79,12 @@ async function main() {
if (true) {
// set delegate, and change name
console.log(`...changing mango account name, and setting a delegate`);
await client.editMangoAccount(group, 'my_changed_name', delegate.publicKey);
await client.editMangoAccount(
group,
mangoAccount,
'my_changed_name',
delegate.publicKey,
);
await mangoAccount.reload(client, group);
console.log(mangoAccount.toString());
}

View File

@ -50,7 +50,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, GROUP_NUM);
const group = await client.getGroupForCreator(admin.publicKey, GROUP_NUM);
console.log(group.toString());
// create + fetch account
@ -72,6 +72,7 @@ async function main() {
const randomKey = new PublicKey(
'4ZkS7ZZkxfsC3GtvvsHP3DFcUeByU9zzZELS4r8HCELo',
);
await client.editMangoAccount(
group,
mangoAccount,

View File

@ -35,7 +35,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey, GROUP_NUM);
const group = await client.getGroupForCreator(admin.publicKey, GROUP_NUM);
console.log(group.toString());
// create + fetch account

View File

@ -47,7 +47,7 @@ async function main() {
);
console.log(`Admin ${admin.publicKey.toBase58()}`);
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
// collect mappings &
// collect pubkeys

View File

@ -34,7 +34,7 @@ async function main() {
MANGO_V4_ID['mainnet-beta'],
);
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`Group ${group.publicKey}`);
let sig;

View File

@ -46,7 +46,7 @@ async function main() {
} catch (error) {
console.log(error);
}
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`...registered group ${group.publicKey}`);
// register token 1

View File

@ -38,7 +38,7 @@ async function main() {
console.log(`Admin ${admin.publicKey.toBase58()}`);
// fetch group
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`Found group ${group.publicKey.toBase58()}`);
// account

View File

@ -10,7 +10,7 @@ import {
import BN from 'bn.js';
import fs from 'fs';
import { QUOTE_DECIMALS } from '../accounts/bank';
import { MangoClient, AccountSize } from '../index';
import { AccountSize, MangoClient } from '../index';
import { getAssociatedTokenAddress } from '../utils';
const CLUSTER_URL =
@ -51,7 +51,7 @@ async function main() {
console.log(`Admin ${admin.publicKey.toBase58()}`);
// fetch group
const group = await client.getGroupForAdmin(admin.publicKey, 0);
const group = await client.getGroupForCreator(admin.publicKey, 0);
console.log(`Found group ${group.publicKey.toBase58()}`);
console.log(`start btc bank ${group.banksMap.get('BTC').toString()}`);

View File

@ -1,8 +1,8 @@
import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair } from '@solana/web3.js';
import fs from 'fs';
import { MangoClient, AccountSize } from '../../index';
import { MANGO_V4_ID } from '../../constants';
import { AccountSize, MangoClient } from '../../index';
//
// An example for users based on high level api i.e. the client
@ -37,7 +37,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`Found group ${group.publicKey.toBase58()}`);
// create + fetch account

View File

@ -2,8 +2,8 @@ import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair } from '@solana/web3.js';
import fs from 'fs';
import { TokenPosition } from '../../accounts/mangoAccount';
import { MangoClient, AccountSize } from '../../index';
import { MANGO_V4_ID } from '../../constants';
import { AccountSize, MangoClient } from '../../index';
//
// An example for users based on high level api i.e. the client
@ -38,7 +38,7 @@ async function main() {
JSON.parse(fs.readFileSync(process.env.ADMIN_KEYPAIR!, 'utf-8')),
),
);
const group = await client.getGroupForAdmin(admin.publicKey);
const group = await client.getGroupForCreator(admin.publicKey);
console.log(`Found group ${group.publicKey.toBase58()}`);
// create + fetch account