adapt to program side renaming

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-04-02 19:18:46 +02:00
parent 227f03b125
commit 8210e9bc00
3 changed files with 29 additions and 30 deletions

View File

@ -29,6 +29,7 @@ fi
# build npm package
tsc
# yarn clean && yarn build && cp package.json ./dist/
# publish the npm package

View File

@ -1475,21 +1475,21 @@ export type MangoV4 = {
"type": "publicKey"
},
{
"name": "tokenAccountMap",
"name": "tokens",
"type": {
"defined": "TokenAccountMap"
"defined": "MangoAccountTokens"
}
},
{
"name": "serum3AccountMap",
"name": "serum3",
"type": {
"defined": "Serum3AccountMap"
"defined": "MangoAccountSerum3"
}
},
{
"name": "perp",
"name": "perps",
"type": {
"defined": "PerpData"
"defined": "MangoAccountPerps"
}
},
{
@ -1825,7 +1825,7 @@ export type MangoV4 = {
}
},
{
"name": "TokenAccountMap",
"name": "MangoAccountTokens",
"type": {
"kind": "struct",
"fields": [
@ -1877,7 +1877,7 @@ export type MangoV4 = {
}
},
{
"name": "Serum3AccountMap",
"name": "MangoAccountSerum3",
"type": {
"kind": "struct",
"fields": [
@ -1943,7 +1943,7 @@ export type MangoV4 = {
}
},
{
"name": "PerpData",
"name": "MangoAccountPerps",
"type": {
"kind": "struct",
"fields": [
@ -3822,21 +3822,21 @@ export const IDL: MangoV4 = {
"type": "publicKey"
},
{
"name": "tokenAccountMap",
"name": "tokens",
"type": {
"defined": "TokenAccountMap"
"defined": "MangoAccountTokens"
}
},
{
"name": "serum3AccountMap",
"name": "serum3",
"type": {
"defined": "Serum3AccountMap"
"defined": "MangoAccountSerum3"
}
},
{
"name": "perp",
"name": "perps",
"type": {
"defined": "PerpData"
"defined": "MangoAccountPerps"
}
},
{
@ -4172,7 +4172,7 @@ export const IDL: MangoV4 = {
}
},
{
"name": "TokenAccountMap",
"name": "MangoAccountTokens",
"type": {
"kind": "struct",
"fields": [
@ -4224,7 +4224,7 @@ export const IDL: MangoV4 = {
}
},
{
"name": "Serum3AccountMap",
"name": "MangoAccountSerum3",
"type": {
"kind": "struct",
"fields": [
@ -4290,7 +4290,7 @@ export const IDL: MangoV4 = {
}
},
{
"name": "PerpData",
"name": "MangoAccountPerps",
"type": {
"kind": "struct",
"fields": [

View File

@ -88,9 +88,9 @@ export class MangoAccount {
group: PublicKey;
owner: PublicKey;
delegate: PublicKey;
tokenAccountMap: unknown;
serum3AccountMap: Object;
perp: unknown;
tokens: unknown;
serum3: Object;
perps: unknown;
beingLiquidated: number;
isBankrupt: number;
accountNum: number;
@ -103,9 +103,9 @@ export class MangoAccount {
obj.group,
obj.owner,
obj.delegate,
obj.tokenAccountMap as { values: TokenAccountDto[] },
obj.serum3AccountMap,
obj.perp,
obj.tokens as { values: TokenAccountDto[] },
obj.serum3,
obj.perps,
obj.beingLiquidated,
obj.isBankrupt,
obj.accountNum,
@ -119,18 +119,16 @@ export class MangoAccount {
group: PublicKey,
owner: PublicKey,
delegate: PublicKey,
tokenAccountMap: { values: TokenAccountDto[] },
serum3AccountMap: Object,
perp: unknown,
tokens: { values: TokenAccountDto[] },
serum3: Object,
perps: unknown,
beingLiquidated: number,
isBankrupt: number,
accountNum: number,
bump: number,
reserved: number[],
) {
this.tokenAccountMap = tokenAccountMap.values.map((dto) =>
TokenAccount.from(dto),
);
this.tokenAccountMap = tokens.values.map((dto) => TokenAccount.from(dto));
}
find(tokenIndex: number): TokenAccount | undefined {