update bank related client code

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-05-10 08:03:46 +02:00
parent e74760d677
commit 02580097de
4 changed files with 132 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import { BN } from '@project-serum/anchor';
import { utf8 } from '@project-serum/anchor/dist/cjs/utils/bytes';
import { PublicKey } from '@solana/web3.js';
import bs58 from 'bs58';
@ -21,6 +22,15 @@ export class Bank {
borrowIndex: I80F48Dto;
indexedTotalDeposits: I80F48Dto;
indexedTotalBorrows: I80F48Dto;
lastUpdated: BN;
util0: I80F48Dto;
rate0: I80F48Dto;
util1: I80F48Dto;
rate1: I80F48Dto;
maxRate: I80F48Dto;
collectedFeesNative: I80F48Dto;
loanOriginationFeeRate: I80F48Dto;
loanFeeRate: I80F48Dto;
maintAssetWeight: I80F48Dto;
initAssetWeight: I80F48Dto;
maintLiabWeight: I80F48Dto;
@ -41,6 +51,15 @@ export class Bank {
obj.borrowIndex,
obj.indexedTotalDeposits,
obj.indexedTotalBorrows,
obj.lastUpdated,
obj.util0,
obj.rate0,
obj.util1,
obj.rate1,
obj.maxRate,
obj.collectedFeesNative,
obj.loanOriginationFeeRate,
obj.loanFeeRate,
obj.maintAssetWeight,
obj.initAssetWeight,
obj.maintLiabWeight,
@ -62,6 +81,15 @@ export class Bank {
borrowIndex: I80F48Dto,
indexedTotalDeposits: I80F48Dto,
indexedTotalBorrows: I80F48Dto,
last_updated: BN,
util0: I80F48Dto,
rate0: I80F48Dto,
util1: I80F48Dto,
rate1: I80F48Dto,
max_rate: I80F48Dto,
collected_fees_native: I80F48Dto,
loan_origination_fee_rate: I80F48Dto,
loan_fee_rate: I80F48Dto,
maintAssetWeight: I80F48Dto,
initAssetWeight: I80F48Dto,
maintLiabWeight: I80F48Dto,

View File

@ -82,6 +82,8 @@ export class MangoClient {
util1: number,
rate1: number,
maxRate: number,
loanFeeRate: number,
loanOriginationFeeRate: number,
maintAssetWeight: number,
initAssetWeight: number,
maintLiabWeight: number,
@ -93,6 +95,8 @@ export class MangoClient {
tokenIndex,
name,
{ util0, rate0, util1, rate1, maxRate },
loanFeeRate,
loanOriginationFeeRate,
maintAssetWeight,
initAssetWeight,
maintLiabWeight,

View File

@ -174,6 +174,14 @@ export type MangoV4 = {
"defined": "InterestRateParams"
}
},
{
"name": "loanFeeRate",
"type": "f32"
},
{
"name": "loanOriginationFeeRate",
"type": "f32"
},
{
"name": "maintAssetWeight",
"type": "f32"
@ -1173,6 +1181,10 @@ export type MangoV4 = {
"name": "perpMarketIndex",
"type": "u16"
},
{
"name": "name",
"type": "string"
},
{
"name": "baseTokenIndexOpt",
"type": {
@ -1427,6 +1439,24 @@ export type MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "collectedFeesNative",
"type": {
"defined": "I80F48"
}
},
{
"name": "loanOriginationFeeRate",
"type": {
"defined": "I80F48"
}
},
{
"name": "loanFeeRate",
"type": {
"defined": "I80F48"
}
},
{
"name": "maintAssetWeight",
"type": {
@ -1724,6 +1754,15 @@ export type MangoV4 = {
"type": {
"kind": "struct",
"fields": [
{
"name": "name",
"type": {
"array": [
"u8",
16
]
}
},
{
"name": "group",
"type": "publicKey"
@ -1812,6 +1851,15 @@ export type MangoV4 = {
"name": "bump",
"type": "u8"
},
{
"name": "reserved",
"type": {
"array": [
"u8",
1
]
}
},
{
"name": "perpMarketIndex",
"type": "u16"
@ -2690,6 +2738,14 @@ export const IDL: MangoV4 = {
"defined": "InterestRateParams"
}
},
{
"name": "loanFeeRate",
"type": "f32"
},
{
"name": "loanOriginationFeeRate",
"type": "f32"
},
{
"name": "maintAssetWeight",
"type": "f32"
@ -3689,6 +3745,10 @@ export const IDL: MangoV4 = {
"name": "perpMarketIndex",
"type": "u16"
},
{
"name": "name",
"type": "string"
},
{
"name": "baseTokenIndexOpt",
"type": {
@ -3943,6 +4003,24 @@ export const IDL: MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "collectedFeesNative",
"type": {
"defined": "I80F48"
}
},
{
"name": "loanOriginationFeeRate",
"type": {
"defined": "I80F48"
}
},
{
"name": "loanFeeRate",
"type": {
"defined": "I80F48"
}
},
{
"name": "maintAssetWeight",
"type": {
@ -4240,6 +4318,15 @@ export const IDL: MangoV4 = {
"type": {
"kind": "struct",
"fields": [
{
"name": "name",
"type": {
"array": [
"u8",
16
]
}
},
{
"name": "group",
"type": "publicKey"
@ -4328,6 +4415,15 @@ export const IDL: MangoV4 = {
"name": "bump",
"type": "u8"
},
{
"name": "reserved",
"type": {
"array": [
"u8",
1
]
}
},
{
"name": "perpMarketIndex",
"type": "u16"

View File

@ -64,6 +64,8 @@ async function main() {
0.07,
0.8,
0.9,
0.0005,
0.0005,
1.5,
0.8,
0.6,
@ -92,6 +94,8 @@ async function main() {
0.07,
0.8,
0.9,
0.0005,
0.0005,
1.5,
0.8,
0.6,