match latest changes in group creation

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-07-31 09:36:46 +02:00
parent 45fd36642e
commit 0c3efe21a9
4 changed files with 85 additions and 10 deletions

View File

@ -169,9 +169,9 @@ export class Bank {
'\n cachedIndexedTotalBorrows - ' + '\n cachedIndexedTotalBorrows - ' +
this.cachedIndexedTotalBorrows.toNumber() + this.cachedIndexedTotalBorrows.toNumber() +
'\n indexLastUpdated - ' + '\n indexLastUpdated - ' +
new Date(this.indexLastUpdated * 1000) + new Date(this.indexLastUpdated.toNumber() * 1000) +
'\n bankRateLastUpdated - ' + '\n bankRateLastUpdated - ' +
new Date(this.bankRateLastUpdated * 1000) + new Date(this.bankRateLastUpdated.toNumber() * 1000) +
'\n avgUtilization - ' + '\n avgUtilization - ' +
this.avgUtilization.toNumber() + this.avgUtilization.toNumber() +
'\n adjustmentFactor - ' + '\n adjustmentFactor - ' +

View File

@ -12,11 +12,18 @@ import { Serum3Market } from './serum3';
export class Group { export class Group {
static from( static from(
publicKey: PublicKey, publicKey: PublicKey,
obj: { admin: PublicKey; groupNum: number }, obj: {
creator: PublicKey;
admin: PublicKey;
fastListingAdmin: PublicKey;
groupNum: number;
},
): Group { ): Group {
return new Group( return new Group(
publicKey, publicKey,
obj.creator,
obj.admin, obj.admin,
obj.fastListingAdmin,
obj.groupNum, obj.groupNum,
new Map(), new Map(),
new Map(), new Map(),
@ -29,7 +36,9 @@ export class Group {
constructor( constructor(
public publicKey: PublicKey, public publicKey: PublicKey,
public creator: PublicKey,
public admin: PublicKey, public admin: PublicKey,
public fastListingAdmin: PublicKey,
public groupNum: number, public groupNum: number,
public banksMap: Map<string, Bank>, public banksMap: Map<string, Bank>,
public serum3MarketsMap: Map<string, Serum3Market>, public serum3MarketsMap: Map<string, Serum3Market>,

View File

@ -82,7 +82,7 @@ export class MangoClient {
return await this.program.methods return await this.program.methods
.groupCreate(groupNum, testing ? 1 : 0) .groupCreate(groupNum, testing ? 1 : 0)
.accounts({ .accounts({
admin: adminPk, creator: adminPk,
payer: adminPk, payer: adminPk,
insuranceMint: insuranceMintPk, insuranceMint: insuranceMintPk,
}) })

View File

@ -19,7 +19,7 @@ export type MangoV4 = {
{ {
"kind": "account", "kind": "account",
"type": "publicKey", "type": "publicKey",
"path": "admin" "path": "creator"
}, },
{ {
"kind": "arg", "kind": "arg",
@ -30,7 +30,7 @@ export type MangoV4 = {
} }
}, },
{ {
"name": "admin", "name": "creator",
"isMut": false, "isMut": false,
"isSigner": true "isSigner": true
}, },
@ -90,6 +90,31 @@ export type MangoV4 = {
} }
] ]
}, },
{
"name": "groupEdit",
"accounts": [
{
"name": "group",
"isMut": true,
"isSigner": false
},
{
"name": "admin",
"isMut": false,
"isSigner": true
}
],
"args": [
{
"name": "newAdmin",
"type": "publicKey"
},
{
"name": "newFastListingAdmin",
"type": "publicKey"
}
]
},
{ {
"name": "groupClose", "name": "groupClose",
"accounts": [ "accounts": [
@ -2795,13 +2820,21 @@ export type MangoV4 = {
"kind": "struct", "kind": "struct",
"fields": [ "fields": [
{ {
"name": "admin", "name": "creator",
"type": "publicKey" "type": "publicKey"
}, },
{ {
"name": "groupNum", "name": "groupNum",
"type": "u32" "type": "u32"
}, },
{
"name": "admin",
"type": "publicKey"
},
{
"name": "fastListingAdmin",
"type": "publicKey"
},
{ {
"name": "padding", "name": "padding",
"type": { "type": {
@ -4890,7 +4923,7 @@ export const IDL: MangoV4 = {
{ {
"kind": "account", "kind": "account",
"type": "publicKey", "type": "publicKey",
"path": "admin" "path": "creator"
}, },
{ {
"kind": "arg", "kind": "arg",
@ -4901,7 +4934,7 @@ export const IDL: MangoV4 = {
} }
}, },
{ {
"name": "admin", "name": "creator",
"isMut": false, "isMut": false,
"isSigner": true "isSigner": true
}, },
@ -4961,6 +4994,31 @@ export const IDL: MangoV4 = {
} }
] ]
}, },
{
"name": "groupEdit",
"accounts": [
{
"name": "group",
"isMut": true,
"isSigner": false
},
{
"name": "admin",
"isMut": false,
"isSigner": true
}
],
"args": [
{
"name": "newAdmin",
"type": "publicKey"
},
{
"name": "newFastListingAdmin",
"type": "publicKey"
}
]
},
{ {
"name": "groupClose", "name": "groupClose",
"accounts": [ "accounts": [
@ -7666,13 +7724,21 @@ export const IDL: MangoV4 = {
"kind": "struct", "kind": "struct",
"fields": [ "fields": [
{ {
"name": "admin", "name": "creator",
"type": "publicKey" "type": "publicKey"
}, },
{ {
"name": "groupNum", "name": "groupNum",
"type": "u32" "type": "u32"
}, },
{
"name": "admin",
"type": "publicKey"
},
{
"name": "fastListingAdmin",
"type": "publicKey"
},
{ {
"name": "padding", "name": "padding",
"type": { "type": {