@exponent-labs/kamino-reserve-deserializer 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/types/Obligation.d.ts +201 -0
- package/build/types/Obligation.js +280 -0
- package/build/types/Obligation.js.map +1 -0
- package/build/types/ObligationCollateral.d.ts +70 -0
- package/build/types/ObligationCollateral.js +108 -0
- package/build/types/ObligationCollateral.js.map +1 -0
- package/build/types/ObligationLiquidity.d.ts +83 -0
- package/build/types/ObligationLiquidity.js +128 -0
- package/build/types/ObligationLiquidity.js.map +1 -0
- package/build/types/ObligationOrder.d.ts +282 -0
- package/build/types/ObligationOrder.js +195 -0
- package/build/types/ObligationOrder.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { PublicKey, Connection } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
import * as types from "../types";
|
|
4
|
+
import { ObligationOrder, ObligationOrderFields, ObligationOrderJSON } from "./ObligationOrder";
|
|
5
|
+
import { ObligationCollateral, ObligationCollateralFields, ObligationCollateralJSON } from "./ObligationCollateral";
|
|
6
|
+
import { ObligationLiquidity, ObligationLiquidityFields, ObligationLiquidityJSON } from "./ObligationLiquidity";
|
|
7
|
+
export interface ObligationFields {
|
|
8
|
+
/** Version of the struct */
|
|
9
|
+
tag: BN;
|
|
10
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
11
|
+
lastUpdate: types.LastUpdateFields;
|
|
12
|
+
/** Lending market address */
|
|
13
|
+
lendingMarket: PublicKey;
|
|
14
|
+
/** Owner authority which can borrow liquidity */
|
|
15
|
+
owner: PublicKey;
|
|
16
|
+
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
17
|
+
deposits: Array<ObligationCollateralFields>;
|
|
18
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
19
|
+
lowestReserveDepositLiquidationLtv: BN;
|
|
20
|
+
/** Market value of deposits (scaled fraction) */
|
|
21
|
+
depositedValueSf: BN;
|
|
22
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
23
|
+
borrows: Array<ObligationLiquidityFields>;
|
|
24
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
25
|
+
borrowFactorAdjustedDebtValueSf: BN;
|
|
26
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
27
|
+
borrowedAssetsMarketValueSf: BN;
|
|
28
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
29
|
+
allowedBorrowValueSf: BN;
|
|
30
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
31
|
+
unhealthyBorrowValueSf: BN;
|
|
32
|
+
/** The asset tier of the deposits */
|
|
33
|
+
depositsAssetTiers: Array<number>;
|
|
34
|
+
/** The asset tier of the borrows */
|
|
35
|
+
borrowsAssetTiers: Array<number>;
|
|
36
|
+
/** The elevation group id the obligation opted into. */
|
|
37
|
+
elevationGroup: number;
|
|
38
|
+
/** The number of obsolete reserves the obligation has a deposit in */
|
|
39
|
+
numOfObsoleteDepositReserves: number;
|
|
40
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
41
|
+
hasDebt: number;
|
|
42
|
+
/** Wallet address of the referrer */
|
|
43
|
+
referrer: PublicKey;
|
|
44
|
+
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
45
|
+
borrowingDisabled: number;
|
|
46
|
+
/**
|
|
47
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
48
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
49
|
+
*/
|
|
50
|
+
autodeleverageTargetLtvPct: number;
|
|
51
|
+
/** The lowest max LTV found amongst the collateral deposits */
|
|
52
|
+
lowestReserveDepositMaxLtvPct: number;
|
|
53
|
+
/** The number of obsolete reserves the obligation has a borrow in */
|
|
54
|
+
numOfObsoleteBorrowReserves: number;
|
|
55
|
+
reserved: Array<number>;
|
|
56
|
+
highestBorrowFactorPct: BN;
|
|
57
|
+
/**
|
|
58
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
59
|
+
* Zero if not currently subject to deleveraging.
|
|
60
|
+
*/
|
|
61
|
+
autodeleverageMarginCallStartedTimestamp: BN;
|
|
62
|
+
/**
|
|
63
|
+
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
64
|
+
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
65
|
+
*/
|
|
66
|
+
orders: Array<ObligationOrderFields>;
|
|
67
|
+
padding3: Array<BN>;
|
|
68
|
+
}
|
|
69
|
+
export interface ObligationJSON {
|
|
70
|
+
/** Version of the struct */
|
|
71
|
+
tag: string;
|
|
72
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
73
|
+
lastUpdate: types.LastUpdateJSON;
|
|
74
|
+
/** Lending market address */
|
|
75
|
+
lendingMarket: string;
|
|
76
|
+
/** Owner authority which can borrow liquidity */
|
|
77
|
+
owner: string;
|
|
78
|
+
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
79
|
+
deposits: Array<ObligationCollateralJSON>;
|
|
80
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
81
|
+
lowestReserveDepositLiquidationLtv: string;
|
|
82
|
+
/** Market value of deposits (scaled fraction) */
|
|
83
|
+
depositedValueSf: string;
|
|
84
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
85
|
+
borrows: Array<ObligationLiquidityJSON>;
|
|
86
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
87
|
+
borrowFactorAdjustedDebtValueSf: string;
|
|
88
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
89
|
+
borrowedAssetsMarketValueSf: string;
|
|
90
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
91
|
+
allowedBorrowValueSf: string;
|
|
92
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
93
|
+
unhealthyBorrowValueSf: string;
|
|
94
|
+
/** The asset tier of the deposits */
|
|
95
|
+
depositsAssetTiers: Array<number>;
|
|
96
|
+
/** The asset tier of the borrows */
|
|
97
|
+
borrowsAssetTiers: Array<number>;
|
|
98
|
+
/** The elevation group id the obligation opted into. */
|
|
99
|
+
elevationGroup: number;
|
|
100
|
+
/** The number of obsolete reserves the obligation has a deposit in */
|
|
101
|
+
numOfObsoleteDepositReserves: number;
|
|
102
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
103
|
+
hasDebt: number;
|
|
104
|
+
/** Wallet address of the referrer */
|
|
105
|
+
referrer: string;
|
|
106
|
+
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
107
|
+
borrowingDisabled: number;
|
|
108
|
+
/**
|
|
109
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
110
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
111
|
+
*/
|
|
112
|
+
autodeleverageTargetLtvPct: number;
|
|
113
|
+
/** The lowest max LTV found amongst the collateral deposits */
|
|
114
|
+
lowestReserveDepositMaxLtvPct: number;
|
|
115
|
+
/** The number of obsolete reserves the obligation has a borrow in */
|
|
116
|
+
numOfObsoleteBorrowReserves: number;
|
|
117
|
+
reserved: Array<number>;
|
|
118
|
+
highestBorrowFactorPct: string;
|
|
119
|
+
/**
|
|
120
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
121
|
+
* Zero if not currently subject to deleveraging.
|
|
122
|
+
*/
|
|
123
|
+
autodeleverageMarginCallStartedTimestamp: string;
|
|
124
|
+
/**
|
|
125
|
+
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
126
|
+
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
127
|
+
*/
|
|
128
|
+
orders: Array<ObligationOrderJSON>;
|
|
129
|
+
padding3: Array<string>;
|
|
130
|
+
}
|
|
131
|
+
/** Lending market obligation state */
|
|
132
|
+
export declare class Obligation {
|
|
133
|
+
/** Version of the struct */
|
|
134
|
+
readonly tag: BN;
|
|
135
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
136
|
+
readonly lastUpdate: types.LastUpdate;
|
|
137
|
+
/** Lending market address */
|
|
138
|
+
readonly lendingMarket: PublicKey;
|
|
139
|
+
/** Owner authority which can borrow liquidity */
|
|
140
|
+
readonly owner: PublicKey;
|
|
141
|
+
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
142
|
+
readonly deposits: Array<ObligationCollateral>;
|
|
143
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
144
|
+
readonly lowestReserveDepositLiquidationLtv: BN;
|
|
145
|
+
/** Market value of deposits (scaled fraction) */
|
|
146
|
+
readonly depositedValueSf: BN;
|
|
147
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
148
|
+
readonly borrows: Array<ObligationLiquidity>;
|
|
149
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
150
|
+
readonly borrowFactorAdjustedDebtValueSf: BN;
|
|
151
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
152
|
+
readonly borrowedAssetsMarketValueSf: BN;
|
|
153
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
154
|
+
readonly allowedBorrowValueSf: BN;
|
|
155
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
156
|
+
readonly unhealthyBorrowValueSf: BN;
|
|
157
|
+
/** The asset tier of the deposits */
|
|
158
|
+
readonly depositsAssetTiers: Array<number>;
|
|
159
|
+
/** The asset tier of the borrows */
|
|
160
|
+
readonly borrowsAssetTiers: Array<number>;
|
|
161
|
+
/** The elevation group id the obligation opted into. */
|
|
162
|
+
readonly elevationGroup: number;
|
|
163
|
+
/** The number of obsolete reserves the obligation has a deposit in */
|
|
164
|
+
readonly numOfObsoleteDepositReserves: number;
|
|
165
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
166
|
+
readonly hasDebt: number;
|
|
167
|
+
/** Wallet address of the referrer */
|
|
168
|
+
readonly referrer: PublicKey;
|
|
169
|
+
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
170
|
+
readonly borrowingDisabled: number;
|
|
171
|
+
/**
|
|
172
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
173
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
174
|
+
*/
|
|
175
|
+
readonly autodeleverageTargetLtvPct: number;
|
|
176
|
+
/** The lowest max LTV found amongst the collateral deposits */
|
|
177
|
+
readonly lowestReserveDepositMaxLtvPct: number;
|
|
178
|
+
/** The number of obsolete reserves the obligation has a borrow in */
|
|
179
|
+
readonly numOfObsoleteBorrowReserves: number;
|
|
180
|
+
readonly reserved: Array<number>;
|
|
181
|
+
readonly highestBorrowFactorPct: BN;
|
|
182
|
+
/**
|
|
183
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
184
|
+
* Zero if not currently subject to deleveraging.
|
|
185
|
+
*/
|
|
186
|
+
readonly autodeleverageMarginCallStartedTimestamp: BN;
|
|
187
|
+
/**
|
|
188
|
+
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
189
|
+
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
190
|
+
*/
|
|
191
|
+
readonly orders: Array<ObligationOrder>;
|
|
192
|
+
readonly padding3: Array<BN>;
|
|
193
|
+
static readonly discriminator: Buffer;
|
|
194
|
+
static readonly layout: any;
|
|
195
|
+
constructor(fields: ObligationFields);
|
|
196
|
+
static fetch(c: Connection, address: PublicKey, programId?: PublicKey): Promise<Obligation | null>;
|
|
197
|
+
static fetchMultiple(c: Connection, addresses: PublicKey[], programId?: PublicKey): Promise<Array<Obligation | null>>;
|
|
198
|
+
static decode(data: Buffer): Obligation;
|
|
199
|
+
toJSON(): ObligationJSON;
|
|
200
|
+
static fromJSON(obj: ObligationJSON): Obligation;
|
|
201
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Obligation = void 0;
|
|
30
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
31
|
+
const bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
32
|
+
const borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
33
|
+
const types = __importStar(require("../types")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
34
|
+
const index_1 = require("../index");
|
|
35
|
+
const ObligationOrder_1 = require("./ObligationOrder");
|
|
36
|
+
const ObligationCollateral_1 = require("./ObligationCollateral");
|
|
37
|
+
const ObligationLiquidity_1 = require("./ObligationLiquidity");
|
|
38
|
+
/** Lending market obligation state */
|
|
39
|
+
class Obligation {
|
|
40
|
+
/** Version of the struct */
|
|
41
|
+
tag;
|
|
42
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
43
|
+
lastUpdate;
|
|
44
|
+
/** Lending market address */
|
|
45
|
+
lendingMarket;
|
|
46
|
+
/** Owner authority which can borrow liquidity */
|
|
47
|
+
owner;
|
|
48
|
+
/** Deposited collateral for the obligation, unique by deposit reserve address */
|
|
49
|
+
deposits;
|
|
50
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
51
|
+
lowestReserveDepositLiquidationLtv;
|
|
52
|
+
/** Market value of deposits (scaled fraction) */
|
|
53
|
+
depositedValueSf;
|
|
54
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
55
|
+
borrows;
|
|
56
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
57
|
+
borrowFactorAdjustedDebtValueSf;
|
|
58
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
59
|
+
borrowedAssetsMarketValueSf;
|
|
60
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
61
|
+
allowedBorrowValueSf;
|
|
62
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
63
|
+
unhealthyBorrowValueSf;
|
|
64
|
+
/** The asset tier of the deposits */
|
|
65
|
+
depositsAssetTiers;
|
|
66
|
+
/** The asset tier of the borrows */
|
|
67
|
+
borrowsAssetTiers;
|
|
68
|
+
/** The elevation group id the obligation opted into. */
|
|
69
|
+
elevationGroup;
|
|
70
|
+
/** The number of obsolete reserves the obligation has a deposit in */
|
|
71
|
+
numOfObsoleteDepositReserves;
|
|
72
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
73
|
+
hasDebt;
|
|
74
|
+
/** Wallet address of the referrer */
|
|
75
|
+
referrer;
|
|
76
|
+
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
77
|
+
borrowingDisabled;
|
|
78
|
+
/**
|
|
79
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
80
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
81
|
+
*/
|
|
82
|
+
autodeleverageTargetLtvPct;
|
|
83
|
+
/** The lowest max LTV found amongst the collateral deposits */
|
|
84
|
+
lowestReserveDepositMaxLtvPct;
|
|
85
|
+
/** The number of obsolete reserves the obligation has a borrow in */
|
|
86
|
+
numOfObsoleteBorrowReserves;
|
|
87
|
+
reserved;
|
|
88
|
+
highestBorrowFactorPct;
|
|
89
|
+
/**
|
|
90
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
91
|
+
* Zero if not currently subject to deleveraging.
|
|
92
|
+
*/
|
|
93
|
+
autodeleverageMarginCallStartedTimestamp;
|
|
94
|
+
/**
|
|
95
|
+
* Owner-defined, liquidator-executed orders applicable to this obligation.
|
|
96
|
+
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
97
|
+
*/
|
|
98
|
+
orders;
|
|
99
|
+
padding3;
|
|
100
|
+
static discriminator = Buffer.from([168, 206, 141, 106, 88, 76, 172, 167]);
|
|
101
|
+
static layout = borsh.struct([
|
|
102
|
+
borsh.u64("tag"),
|
|
103
|
+
types.LastUpdate.layout("lastUpdate"),
|
|
104
|
+
borsh.publicKey("lendingMarket"),
|
|
105
|
+
borsh.publicKey("owner"),
|
|
106
|
+
borsh.array(ObligationCollateral_1.ObligationCollateral.layout(), 8, "deposits"),
|
|
107
|
+
borsh.u64("lowestReserveDepositLiquidationLtv"),
|
|
108
|
+
borsh.u128("depositedValueSf"),
|
|
109
|
+
borsh.array(ObligationLiquidity_1.ObligationLiquidity.layout(), 5, "borrows"),
|
|
110
|
+
borsh.u128("borrowFactorAdjustedDebtValueSf"),
|
|
111
|
+
borsh.u128("borrowedAssetsMarketValueSf"),
|
|
112
|
+
borsh.u128("allowedBorrowValueSf"),
|
|
113
|
+
borsh.u128("unhealthyBorrowValueSf"),
|
|
114
|
+
borsh.array(borsh.u8(), 8, "depositsAssetTiers"),
|
|
115
|
+
borsh.array(borsh.u8(), 5, "borrowsAssetTiers"),
|
|
116
|
+
borsh.u8("elevationGroup"),
|
|
117
|
+
borsh.u8("numOfObsoleteDepositReserves"),
|
|
118
|
+
borsh.u8("hasDebt"),
|
|
119
|
+
borsh.publicKey("referrer"),
|
|
120
|
+
borsh.u8("borrowingDisabled"),
|
|
121
|
+
borsh.u8("autodeleverageTargetLtvPct"),
|
|
122
|
+
borsh.u8("lowestReserveDepositMaxLtvPct"),
|
|
123
|
+
borsh.u8("numOfObsoleteBorrowReserves"),
|
|
124
|
+
borsh.array(borsh.u8(), 4, "reserved"),
|
|
125
|
+
borsh.u64("highestBorrowFactorPct"),
|
|
126
|
+
borsh.u64("autodeleverageMarginCallStartedTimestamp"),
|
|
127
|
+
borsh.array(ObligationOrder_1.ObligationOrder.layout(), 2, "orders"),
|
|
128
|
+
borsh.array(borsh.u64(), 93, "padding3"),
|
|
129
|
+
]);
|
|
130
|
+
constructor(fields) {
|
|
131
|
+
this.tag = fields.tag;
|
|
132
|
+
this.lastUpdate = new types.LastUpdate({ ...fields.lastUpdate });
|
|
133
|
+
this.lendingMarket = fields.lendingMarket;
|
|
134
|
+
this.owner = fields.owner;
|
|
135
|
+
this.deposits = fields.deposits.map((item) => new ObligationCollateral_1.ObligationCollateral({ ...item }));
|
|
136
|
+
this.lowestReserveDepositLiquidationLtv = fields.lowestReserveDepositLiquidationLtv;
|
|
137
|
+
this.depositedValueSf = fields.depositedValueSf;
|
|
138
|
+
this.borrows = fields.borrows.map((item) => new ObligationLiquidity_1.ObligationLiquidity({ ...item }));
|
|
139
|
+
this.borrowFactorAdjustedDebtValueSf = fields.borrowFactorAdjustedDebtValueSf;
|
|
140
|
+
this.borrowedAssetsMarketValueSf = fields.borrowedAssetsMarketValueSf;
|
|
141
|
+
this.allowedBorrowValueSf = fields.allowedBorrowValueSf;
|
|
142
|
+
this.unhealthyBorrowValueSf = fields.unhealthyBorrowValueSf;
|
|
143
|
+
this.depositsAssetTiers = fields.depositsAssetTiers;
|
|
144
|
+
this.borrowsAssetTiers = fields.borrowsAssetTiers;
|
|
145
|
+
this.elevationGroup = fields.elevationGroup;
|
|
146
|
+
this.numOfObsoleteDepositReserves = fields.numOfObsoleteDepositReserves;
|
|
147
|
+
this.hasDebt = fields.hasDebt;
|
|
148
|
+
this.referrer = fields.referrer;
|
|
149
|
+
this.borrowingDisabled = fields.borrowingDisabled;
|
|
150
|
+
this.autodeleverageTargetLtvPct = fields.autodeleverageTargetLtvPct;
|
|
151
|
+
this.lowestReserveDepositMaxLtvPct = fields.lowestReserveDepositMaxLtvPct;
|
|
152
|
+
this.numOfObsoleteBorrowReserves = fields.numOfObsoleteBorrowReserves;
|
|
153
|
+
this.reserved = fields.reserved;
|
|
154
|
+
this.highestBorrowFactorPct = fields.highestBorrowFactorPct;
|
|
155
|
+
this.autodeleverageMarginCallStartedTimestamp = fields.autodeleverageMarginCallStartedTimestamp;
|
|
156
|
+
this.orders = fields.orders.map((item) => new ObligationOrder_1.ObligationOrder({ ...item }));
|
|
157
|
+
this.padding3 = fields.padding3;
|
|
158
|
+
}
|
|
159
|
+
static async fetch(c, address, programId = index_1.PROGRAM_ID) {
|
|
160
|
+
const info = await c.getAccountInfo(address);
|
|
161
|
+
if (info === null) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
if (!info.owner.equals(programId)) {
|
|
165
|
+
throw new Error("account doesn't belong to this program");
|
|
166
|
+
}
|
|
167
|
+
return this.decode(info.data);
|
|
168
|
+
}
|
|
169
|
+
static async fetchMultiple(c, addresses, programId = index_1.PROGRAM_ID) {
|
|
170
|
+
const infos = await c.getMultipleAccountsInfo(addresses);
|
|
171
|
+
return infos.map((info) => {
|
|
172
|
+
if (info === null) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
if (!info.owner.equals(programId)) {
|
|
176
|
+
throw new Error("account doesn't belong to this program");
|
|
177
|
+
}
|
|
178
|
+
return this.decode(info.data);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
static decode(data) {
|
|
182
|
+
if (!data.slice(0, 8).equals(Obligation.discriminator)) {
|
|
183
|
+
throw new Error("invalid account discriminator");
|
|
184
|
+
}
|
|
185
|
+
const dec = Obligation.layout.decode(data.slice(8));
|
|
186
|
+
return new Obligation({
|
|
187
|
+
tag: dec.tag,
|
|
188
|
+
lastUpdate: types.LastUpdate.fromDecoded(dec.lastUpdate),
|
|
189
|
+
lendingMarket: dec.lendingMarket,
|
|
190
|
+
owner: dec.owner,
|
|
191
|
+
deposits: dec.deposits.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => ObligationCollateral_1.ObligationCollateral.fromDecoded(item)),
|
|
192
|
+
lowestReserveDepositLiquidationLtv: dec.lowestReserveDepositLiquidationLtv,
|
|
193
|
+
depositedValueSf: dec.depositedValueSf,
|
|
194
|
+
borrows: dec.borrows.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => ObligationLiquidity_1.ObligationLiquidity.fromDecoded(item)),
|
|
195
|
+
borrowFactorAdjustedDebtValueSf: dec.borrowFactorAdjustedDebtValueSf,
|
|
196
|
+
borrowedAssetsMarketValueSf: dec.borrowedAssetsMarketValueSf,
|
|
197
|
+
allowedBorrowValueSf: dec.allowedBorrowValueSf,
|
|
198
|
+
unhealthyBorrowValueSf: dec.unhealthyBorrowValueSf,
|
|
199
|
+
depositsAssetTiers: dec.depositsAssetTiers,
|
|
200
|
+
borrowsAssetTiers: dec.borrowsAssetTiers,
|
|
201
|
+
elevationGroup: dec.elevationGroup,
|
|
202
|
+
numOfObsoleteDepositReserves: dec.numOfObsoleteDepositReserves,
|
|
203
|
+
hasDebt: dec.hasDebt,
|
|
204
|
+
referrer: dec.referrer,
|
|
205
|
+
borrowingDisabled: dec.borrowingDisabled,
|
|
206
|
+
autodeleverageTargetLtvPct: dec.autodeleverageTargetLtvPct,
|
|
207
|
+
lowestReserveDepositMaxLtvPct: dec.lowestReserveDepositMaxLtvPct,
|
|
208
|
+
numOfObsoleteBorrowReserves: dec.numOfObsoleteBorrowReserves,
|
|
209
|
+
reserved: dec.reserved,
|
|
210
|
+
highestBorrowFactorPct: dec.highestBorrowFactorPct,
|
|
211
|
+
autodeleverageMarginCallStartedTimestamp: dec.autodeleverageMarginCallStartedTimestamp,
|
|
212
|
+
orders: dec.orders.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => ObligationOrder_1.ObligationOrder.fromDecoded(item)),
|
|
213
|
+
padding3: dec.padding3,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
toJSON() {
|
|
217
|
+
return {
|
|
218
|
+
tag: this.tag.toString(),
|
|
219
|
+
lastUpdate: this.lastUpdate.toJSON(),
|
|
220
|
+
lendingMarket: this.lendingMarket.toString(),
|
|
221
|
+
owner: this.owner.toString(),
|
|
222
|
+
deposits: this.deposits.map((item) => item.toJSON()),
|
|
223
|
+
lowestReserveDepositLiquidationLtv: this.lowestReserveDepositLiquidationLtv.toString(),
|
|
224
|
+
depositedValueSf: this.depositedValueSf.toString(),
|
|
225
|
+
borrows: this.borrows.map((item) => item.toJSON()),
|
|
226
|
+
borrowFactorAdjustedDebtValueSf: this.borrowFactorAdjustedDebtValueSf.toString(),
|
|
227
|
+
borrowedAssetsMarketValueSf: this.borrowedAssetsMarketValueSf.toString(),
|
|
228
|
+
allowedBorrowValueSf: this.allowedBorrowValueSf.toString(),
|
|
229
|
+
unhealthyBorrowValueSf: this.unhealthyBorrowValueSf.toString(),
|
|
230
|
+
depositsAssetTiers: this.depositsAssetTiers,
|
|
231
|
+
borrowsAssetTiers: this.borrowsAssetTiers,
|
|
232
|
+
elevationGroup: this.elevationGroup,
|
|
233
|
+
numOfObsoleteDepositReserves: this.numOfObsoleteDepositReserves,
|
|
234
|
+
hasDebt: this.hasDebt,
|
|
235
|
+
referrer: this.referrer.toString(),
|
|
236
|
+
borrowingDisabled: this.borrowingDisabled,
|
|
237
|
+
autodeleverageTargetLtvPct: this.autodeleverageTargetLtvPct,
|
|
238
|
+
lowestReserveDepositMaxLtvPct: this.lowestReserveDepositMaxLtvPct,
|
|
239
|
+
numOfObsoleteBorrowReserves: this.numOfObsoleteBorrowReserves,
|
|
240
|
+
reserved: this.reserved,
|
|
241
|
+
highestBorrowFactorPct: this.highestBorrowFactorPct.toString(),
|
|
242
|
+
autodeleverageMarginCallStartedTimestamp: this.autodeleverageMarginCallStartedTimestamp.toString(),
|
|
243
|
+
orders: this.orders.map((item) => item.toJSON()),
|
|
244
|
+
padding3: this.padding3.map((item) => item.toString()),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
static fromJSON(obj) {
|
|
248
|
+
return new Obligation({
|
|
249
|
+
tag: new bn_js_1.default(obj.tag),
|
|
250
|
+
lastUpdate: types.LastUpdate.fromJSON(obj.lastUpdate),
|
|
251
|
+
lendingMarket: new web3_js_1.PublicKey(obj.lendingMarket),
|
|
252
|
+
owner: new web3_js_1.PublicKey(obj.owner),
|
|
253
|
+
deposits: obj.deposits.map((item) => ObligationCollateral_1.ObligationCollateral.fromJSON(item)),
|
|
254
|
+
lowestReserveDepositLiquidationLtv: new bn_js_1.default(obj.lowestReserveDepositLiquidationLtv),
|
|
255
|
+
depositedValueSf: new bn_js_1.default(obj.depositedValueSf),
|
|
256
|
+
borrows: obj.borrows.map((item) => ObligationLiquidity_1.ObligationLiquidity.fromJSON(item)),
|
|
257
|
+
borrowFactorAdjustedDebtValueSf: new bn_js_1.default(obj.borrowFactorAdjustedDebtValueSf),
|
|
258
|
+
borrowedAssetsMarketValueSf: new bn_js_1.default(obj.borrowedAssetsMarketValueSf),
|
|
259
|
+
allowedBorrowValueSf: new bn_js_1.default(obj.allowedBorrowValueSf),
|
|
260
|
+
unhealthyBorrowValueSf: new bn_js_1.default(obj.unhealthyBorrowValueSf),
|
|
261
|
+
depositsAssetTiers: obj.depositsAssetTiers,
|
|
262
|
+
borrowsAssetTiers: obj.borrowsAssetTiers,
|
|
263
|
+
elevationGroup: obj.elevationGroup,
|
|
264
|
+
numOfObsoleteDepositReserves: obj.numOfObsoleteDepositReserves,
|
|
265
|
+
hasDebt: obj.hasDebt,
|
|
266
|
+
referrer: new web3_js_1.PublicKey(obj.referrer),
|
|
267
|
+
borrowingDisabled: obj.borrowingDisabled,
|
|
268
|
+
autodeleverageTargetLtvPct: obj.autodeleverageTargetLtvPct,
|
|
269
|
+
lowestReserveDepositMaxLtvPct: obj.lowestReserveDepositMaxLtvPct,
|
|
270
|
+
numOfObsoleteBorrowReserves: obj.numOfObsoleteBorrowReserves,
|
|
271
|
+
reserved: obj.reserved,
|
|
272
|
+
highestBorrowFactorPct: new bn_js_1.default(obj.highestBorrowFactorPct),
|
|
273
|
+
autodeleverageMarginCallStartedTimestamp: new bn_js_1.default(obj.autodeleverageMarginCallStartedTimestamp),
|
|
274
|
+
orders: obj.orders.map((item) => ObligationOrder_1.ObligationOrder.fromJSON(item)),
|
|
275
|
+
padding3: obj.padding3.map((item) => new bn_js_1.default(item)),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
exports.Obligation = Obligation;
|
|
280
|
+
//# sourceMappingURL=Obligation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Obligation.js","sourceRoot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AC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAE,CAAC,IAAI,CAAC,CAAC;SACnD,CAAC,CAAA;IACJ,CAAC;;AAtQH,gCAuQC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
export interface ObligationCollateralFields {
|
|
4
|
+
/** Reserve collateral is deposited to */
|
|
5
|
+
depositReserve: PublicKey;
|
|
6
|
+
/** Amount of collateral deposited */
|
|
7
|
+
depositedAmount: BN;
|
|
8
|
+
/** Collateral market value in quote currency (scaled fraction) */
|
|
9
|
+
marketValueSf: BN;
|
|
10
|
+
/**
|
|
11
|
+
* Debt amount (lamport) taken against this collateral.
|
|
12
|
+
* (only meaningful if this obligation is part of an elevation group, otherwise 0)
|
|
13
|
+
* This is only indicative of the debt computed on the last refresh obligation.
|
|
14
|
+
* If the obligation have multiple collateral this value is the same for all of them.
|
|
15
|
+
*/
|
|
16
|
+
borrowedAmountAgainstThisCollateralInElevationGroup: BN;
|
|
17
|
+
padding: Array<BN>;
|
|
18
|
+
}
|
|
19
|
+
export interface ObligationCollateralJSON {
|
|
20
|
+
/** Reserve collateral is deposited to */
|
|
21
|
+
depositReserve: string;
|
|
22
|
+
/** Amount of collateral deposited */
|
|
23
|
+
depositedAmount: string;
|
|
24
|
+
/** Collateral market value in quote currency (scaled fraction) */
|
|
25
|
+
marketValueSf: string;
|
|
26
|
+
/**
|
|
27
|
+
* Debt amount (lamport) taken against this collateral.
|
|
28
|
+
* (only meaningful if this obligation is part of an elevation group, otherwise 0)
|
|
29
|
+
* This is only indicative of the debt computed on the last refresh obligation.
|
|
30
|
+
* If the obligation have multiple collateral this value is the same for all of them.
|
|
31
|
+
*/
|
|
32
|
+
borrowedAmountAgainstThisCollateralInElevationGroup: string;
|
|
33
|
+
padding: Array<string>;
|
|
34
|
+
}
|
|
35
|
+
/** Obligation collateral state */
|
|
36
|
+
export declare class ObligationCollateral {
|
|
37
|
+
/** Reserve collateral is deposited to */
|
|
38
|
+
readonly depositReserve: PublicKey;
|
|
39
|
+
/** Amount of collateral deposited */
|
|
40
|
+
readonly depositedAmount: BN;
|
|
41
|
+
/** Collateral market value in quote currency (scaled fraction) */
|
|
42
|
+
readonly marketValueSf: BN;
|
|
43
|
+
/**
|
|
44
|
+
* Debt amount (lamport) taken against this collateral.
|
|
45
|
+
* (only meaningful if this obligation is part of an elevation group, otherwise 0)
|
|
46
|
+
* This is only indicative of the debt computed on the last refresh obligation.
|
|
47
|
+
* If the obligation have multiple collateral this value is the same for all of them.
|
|
48
|
+
*/
|
|
49
|
+
readonly borrowedAmountAgainstThisCollateralInElevationGroup: BN;
|
|
50
|
+
readonly padding: Array<BN>;
|
|
51
|
+
constructor(fields: ObligationCollateralFields);
|
|
52
|
+
static layout(property?: string): any;
|
|
53
|
+
static fromDecoded(obj: any): ObligationCollateral;
|
|
54
|
+
static toEncodable(fields: ObligationCollateralFields): {
|
|
55
|
+
depositReserve: PublicKey;
|
|
56
|
+
depositedAmount: BN;
|
|
57
|
+
marketValueSf: BN;
|
|
58
|
+
borrowedAmountAgainstThisCollateralInElevationGroup: BN;
|
|
59
|
+
padding: BN[];
|
|
60
|
+
};
|
|
61
|
+
toJSON(): ObligationCollateralJSON;
|
|
62
|
+
static fromJSON(obj: ObligationCollateralJSON): ObligationCollateral;
|
|
63
|
+
toEncodable(): {
|
|
64
|
+
depositReserve: PublicKey;
|
|
65
|
+
depositedAmount: BN;
|
|
66
|
+
marketValueSf: BN;
|
|
67
|
+
borrowedAmountAgainstThisCollateralInElevationGroup: BN;
|
|
68
|
+
padding: BN[];
|
|
69
|
+
};
|
|
70
|
+
}
|