@kamino-finance/klend-sdk 5.0.4 → 5.0.5
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/dist/classes/fraction.d.ts.map +1 -1
- package/dist/classes/fraction.js.map +1 -1
- package/dist/classes/manager.d.ts +38 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +112 -5
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +4 -0
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +17 -25
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +2 -1
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +1 -0
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +22 -27
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/utils.d.ts +3 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +30 -0
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +12 -8
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +94 -66
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +15 -1
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +27 -2
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +8 -1
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +3 -12
- package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.js +1 -4
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +20 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +33 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +25 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +4 -4
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +22 -18
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +45 -15
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +101 -39
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts +4 -4
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.js +162 -162
- package/dist/idl_codegen_kamino_vault/errors/anchor.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +144 -32
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js +305 -109
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.js +7 -2
- package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js +3 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts +13 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +47 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts +18 -10
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +2 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts +6 -2
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts +7 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js +16 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts +14 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +52 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js +8 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts +23 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +51 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/programId.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js +4 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js +6 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js +5 -5
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts +27 -24
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js +59 -53
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js +5 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts +11 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js +25 -17
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js +3 -3
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js +11 -11
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +18 -8
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +27 -13
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +110 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +242 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +34 -30
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.js +26 -1
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/utils/ObligationType.d.ts.map +1 -1
- package/dist/utils/ObligationType.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/pubkey.d.ts.map +1 -1
- package/dist/utils/pubkey.js.map +1 -1
- package/dist/utils/rpc.d.ts.map +1 -1
- package/dist/utils/rpc.js +2 -1
- package/dist/utils/rpc.js.map +1 -1
- package/package.json +2 -1
- package/src/classes/fraction.ts +5 -0
- package/src/classes/manager.ts +136 -5
- package/src/classes/market.ts +19 -2
- package/src/classes/obligation.ts +2 -1
- package/src/classes/reserve.ts +55 -39
- package/src/classes/utils.ts +30 -0
- package/src/classes/vault.ts +123 -49
- package/src/client_kamino_manager.ts +19 -1
- package/src/idl_codegen/accounts/LendingMarket.ts +12 -1
- package/src/idl_codegen/accounts/Obligation.ts +3 -12
- package/src/idl_codegen/types/UpdateLendingMarketConfigValue.ts +43 -0
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +30 -0
- package/src/idl_codegen/types/index.ts +4 -0
- package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +132 -105
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +217 -124
- package/src/idl_codegen_kamino_vault/accounts/index.ts +4 -4
- package/src/idl_codegen_kamino_vault/errors/anchor.ts +335 -326
- package/src/idl_codegen_kamino_vault/errors/custom.ts +353 -157
- package/src/idl_codegen_kamino_vault/errors/index.ts +35 -22
- package/src/idl_codegen_kamino_vault/instructions/deposit.ts +33 -25
- package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +40 -0
- package/src/idl_codegen_kamino_vault/instructions/index.ts +27 -10
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +25 -20
- package/src/idl_codegen_kamino_vault/instructions/invest.ts +40 -25
- package/src/idl_codegen_kamino_vault/instructions/updateAdmin.ts +24 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +24 -24
- package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +49 -0
- package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +45 -33
- package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +75 -0
- package/src/idl_codegen_kamino_vault/programId.ts +5 -3
- package/src/idl_codegen_kamino_vault/types/BigFractionBytes.ts +24 -18
- package/src/idl_codegen_kamino_vault/types/BorrowRateCurve.ts +21 -16
- package/src/idl_codegen_kamino_vault/types/CurvePoint.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/LastUpdate.ts +32 -27
- package/src/idl_codegen_kamino_vault/types/PriceHeuristic.ts +25 -22
- package/src/idl_codegen_kamino_vault/types/PythConfiguration.ts +14 -14
- package/src/idl_codegen_kamino_vault/types/ReserveCollateral.ts +35 -35
- package/src/idl_codegen_kamino_vault/types/ReserveConfig.ts +232 -191
- package/src/idl_codegen_kamino_vault/types/ReserveFees.ts +27 -23
- package/src/idl_codegen_kamino_vault/types/ReserveLiquidity.ts +116 -98
- package/src/idl_codegen_kamino_vault/types/ScopeConfiguration.ts +25 -25
- package/src/idl_codegen_kamino_vault/types/SwitchboardConfiguration.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/TokenInfo.ts +92 -74
- package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +67 -49
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +270 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +77 -30
- package/src/utils/ObligationType.ts +6 -0
- package/src/utils/managerTypes.ts +1 -0
- package/src/utils/pubkey.ts +2 -0
- package/src/utils/rpc.ts +3 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
|
5
|
+
|
|
6
|
+
export interface PerformanceFeeBpsJSON {
|
|
7
|
+
kind: "PerformanceFeeBps"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class PerformanceFeeBps {
|
|
11
|
+
static readonly discriminator = 0
|
|
12
|
+
static readonly kind = "PerformanceFeeBps"
|
|
13
|
+
readonly discriminator = 0
|
|
14
|
+
readonly kind = "PerformanceFeeBps"
|
|
15
|
+
|
|
16
|
+
toJSON(): PerformanceFeeBpsJSON {
|
|
17
|
+
return {
|
|
18
|
+
kind: "PerformanceFeeBps",
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toEncodable() {
|
|
23
|
+
return {
|
|
24
|
+
PerformanceFeeBps: {},
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ManagementFeeBpsJSON {
|
|
30
|
+
kind: "ManagementFeeBps"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class ManagementFeeBps {
|
|
34
|
+
static readonly discriminator = 1
|
|
35
|
+
static readonly kind = "ManagementFeeBps"
|
|
36
|
+
readonly discriminator = 1
|
|
37
|
+
readonly kind = "ManagementFeeBps"
|
|
38
|
+
|
|
39
|
+
toJSON(): ManagementFeeBpsJSON {
|
|
40
|
+
return {
|
|
41
|
+
kind: "ManagementFeeBps",
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toEncodable() {
|
|
46
|
+
return {
|
|
47
|
+
ManagementFeeBps: {},
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface MinDepositAmountJSON {
|
|
53
|
+
kind: "MinDepositAmount"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class MinDepositAmount {
|
|
57
|
+
static readonly discriminator = 2
|
|
58
|
+
static readonly kind = "MinDepositAmount"
|
|
59
|
+
readonly discriminator = 2
|
|
60
|
+
readonly kind = "MinDepositAmount"
|
|
61
|
+
|
|
62
|
+
toJSON(): MinDepositAmountJSON {
|
|
63
|
+
return {
|
|
64
|
+
kind: "MinDepositAmount",
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
toEncodable() {
|
|
69
|
+
return {
|
|
70
|
+
MinDepositAmount: {},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface MinWithdrawAmountJSON {
|
|
76
|
+
kind: "MinWithdrawAmount"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class MinWithdrawAmount {
|
|
80
|
+
static readonly discriminator = 3
|
|
81
|
+
static readonly kind = "MinWithdrawAmount"
|
|
82
|
+
readonly discriminator = 3
|
|
83
|
+
readonly kind = "MinWithdrawAmount"
|
|
84
|
+
|
|
85
|
+
toJSON(): MinWithdrawAmountJSON {
|
|
86
|
+
return {
|
|
87
|
+
kind: "MinWithdrawAmount",
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
toEncodable() {
|
|
92
|
+
return {
|
|
93
|
+
MinWithdrawAmount: {},
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface MintInvestAmountJSON {
|
|
99
|
+
kind: "MintInvestAmount"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export class MintInvestAmount {
|
|
103
|
+
static readonly discriminator = 4
|
|
104
|
+
static readonly kind = "MintInvestAmount"
|
|
105
|
+
readonly discriminator = 4
|
|
106
|
+
readonly kind = "MintInvestAmount"
|
|
107
|
+
|
|
108
|
+
toJSON(): MintInvestAmountJSON {
|
|
109
|
+
return {
|
|
110
|
+
kind: "MintInvestAmount",
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
toEncodable() {
|
|
115
|
+
return {
|
|
116
|
+
MintInvestAmount: {},
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MinInvestDelaySlotsJSON {
|
|
122
|
+
kind: "MinInvestDelaySlots"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export class MinInvestDelaySlots {
|
|
126
|
+
static readonly discriminator = 5
|
|
127
|
+
static readonly kind = "MinInvestDelaySlots"
|
|
128
|
+
readonly discriminator = 5
|
|
129
|
+
readonly kind = "MinInvestDelaySlots"
|
|
130
|
+
|
|
131
|
+
toJSON(): MinInvestDelaySlotsJSON {
|
|
132
|
+
return {
|
|
133
|
+
kind: "MinInvestDelaySlots",
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
toEncodable() {
|
|
138
|
+
return {
|
|
139
|
+
MinInvestDelaySlots: {},
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CrankFundFeePerReserveJSON {
|
|
145
|
+
kind: "CrankFundFeePerReserve"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export class CrankFundFeePerReserve {
|
|
149
|
+
static readonly discriminator = 6
|
|
150
|
+
static readonly kind = "CrankFundFeePerReserve"
|
|
151
|
+
readonly discriminator = 6
|
|
152
|
+
readonly kind = "CrankFundFeePerReserve"
|
|
153
|
+
|
|
154
|
+
toJSON(): CrankFundFeePerReserveJSON {
|
|
155
|
+
return {
|
|
156
|
+
kind: "CrankFundFeePerReserve",
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
toEncodable() {
|
|
161
|
+
return {
|
|
162
|
+
CrankFundFeePerReserve: {},
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface PendingVaultAdminJSON {
|
|
168
|
+
kind: "PendingVaultAdmin"
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export class PendingVaultAdmin {
|
|
172
|
+
static readonly discriminator = 7
|
|
173
|
+
static readonly kind = "PendingVaultAdmin"
|
|
174
|
+
readonly discriminator = 7
|
|
175
|
+
readonly kind = "PendingVaultAdmin"
|
|
176
|
+
|
|
177
|
+
toJSON(): PendingVaultAdminJSON {
|
|
178
|
+
return {
|
|
179
|
+
kind: "PendingVaultAdmin",
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
toEncodable() {
|
|
184
|
+
return {
|
|
185
|
+
PendingVaultAdmin: {},
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
+
export function fromDecoded(obj: any): types.VaultConfigFieldKind {
|
|
192
|
+
if (typeof obj !== "object") {
|
|
193
|
+
throw new Error("Invalid enum object")
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if ("PerformanceFeeBps" in obj) {
|
|
197
|
+
return new PerformanceFeeBps()
|
|
198
|
+
}
|
|
199
|
+
if ("ManagementFeeBps" in obj) {
|
|
200
|
+
return new ManagementFeeBps()
|
|
201
|
+
}
|
|
202
|
+
if ("MinDepositAmount" in obj) {
|
|
203
|
+
return new MinDepositAmount()
|
|
204
|
+
}
|
|
205
|
+
if ("MinWithdrawAmount" in obj) {
|
|
206
|
+
return new MinWithdrawAmount()
|
|
207
|
+
}
|
|
208
|
+
if ("MintInvestAmount" in obj) {
|
|
209
|
+
return new MintInvestAmount()
|
|
210
|
+
}
|
|
211
|
+
if ("MinInvestDelaySlots" in obj) {
|
|
212
|
+
return new MinInvestDelaySlots()
|
|
213
|
+
}
|
|
214
|
+
if ("CrankFundFeePerReserve" in obj) {
|
|
215
|
+
return new CrankFundFeePerReserve()
|
|
216
|
+
}
|
|
217
|
+
if ("PendingVaultAdmin" in obj) {
|
|
218
|
+
return new PendingVaultAdmin()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
throw new Error("Invalid enum object")
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function fromJSON(
|
|
225
|
+
obj: types.VaultConfigFieldJSON
|
|
226
|
+
): types.VaultConfigFieldKind {
|
|
227
|
+
switch (obj.kind) {
|
|
228
|
+
case "PerformanceFeeBps": {
|
|
229
|
+
return new PerformanceFeeBps()
|
|
230
|
+
}
|
|
231
|
+
case "ManagementFeeBps": {
|
|
232
|
+
return new ManagementFeeBps()
|
|
233
|
+
}
|
|
234
|
+
case "MinDepositAmount": {
|
|
235
|
+
return new MinDepositAmount()
|
|
236
|
+
}
|
|
237
|
+
case "MinWithdrawAmount": {
|
|
238
|
+
return new MinWithdrawAmount()
|
|
239
|
+
}
|
|
240
|
+
case "MintInvestAmount": {
|
|
241
|
+
return new MintInvestAmount()
|
|
242
|
+
}
|
|
243
|
+
case "MinInvestDelaySlots": {
|
|
244
|
+
return new MinInvestDelaySlots()
|
|
245
|
+
}
|
|
246
|
+
case "CrankFundFeePerReserve": {
|
|
247
|
+
return new CrankFundFeePerReserve()
|
|
248
|
+
}
|
|
249
|
+
case "PendingVaultAdmin": {
|
|
250
|
+
return new PendingVaultAdmin()
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function layout(property?: string) {
|
|
256
|
+
const ret = borsh.rustEnum([
|
|
257
|
+
borsh.struct([], "PerformanceFeeBps"),
|
|
258
|
+
borsh.struct([], "ManagementFeeBps"),
|
|
259
|
+
borsh.struct([], "MinDepositAmount"),
|
|
260
|
+
borsh.struct([], "MinWithdrawAmount"),
|
|
261
|
+
borsh.struct([], "MintInvestAmount"),
|
|
262
|
+
borsh.struct([], "MinInvestDelaySlots"),
|
|
263
|
+
borsh.struct([], "CrankFundFeePerReserve"),
|
|
264
|
+
borsh.struct([], "PendingVaultAdmin"),
|
|
265
|
+
])
|
|
266
|
+
if (property !== undefined) {
|
|
267
|
+
return ret.replicate(property)
|
|
268
|
+
}
|
|
269
|
+
return ret
|
|
270
|
+
}
|
|
@@ -1,30 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
export type {
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
29
|
-
export {
|
|
30
|
-
|
|
1
|
+
import * as VaultConfigField from "./VaultConfigField"
|
|
2
|
+
|
|
3
|
+
export { LastUpdate } from "./LastUpdate"
|
|
4
|
+
export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"
|
|
5
|
+
export { BigFractionBytes } from "./BigFractionBytes"
|
|
6
|
+
export type {
|
|
7
|
+
BigFractionBytesFields,
|
|
8
|
+
BigFractionBytesJSON,
|
|
9
|
+
} from "./BigFractionBytes"
|
|
10
|
+
export { ReserveCollateral } from "./ReserveCollateral"
|
|
11
|
+
export type {
|
|
12
|
+
ReserveCollateralFields,
|
|
13
|
+
ReserveCollateralJSON,
|
|
14
|
+
} from "./ReserveCollateral"
|
|
15
|
+
export { ReserveConfig } from "./ReserveConfig"
|
|
16
|
+
export type { ReserveConfigFields, ReserveConfigJSON } from "./ReserveConfig"
|
|
17
|
+
export { ReserveFees } from "./ReserveFees"
|
|
18
|
+
export type { ReserveFeesFields, ReserveFeesJSON } from "./ReserveFees"
|
|
19
|
+
export { ReserveLiquidity } from "./ReserveLiquidity"
|
|
20
|
+
export type {
|
|
21
|
+
ReserveLiquidityFields,
|
|
22
|
+
ReserveLiquidityJSON,
|
|
23
|
+
} from "./ReserveLiquidity"
|
|
24
|
+
export { WithdrawalCaps } from "./WithdrawalCaps"
|
|
25
|
+
export type { WithdrawalCapsFields, WithdrawalCapsJSON } from "./WithdrawalCaps"
|
|
26
|
+
export { PriceHeuristic } from "./PriceHeuristic"
|
|
27
|
+
export type { PriceHeuristicFields, PriceHeuristicJSON } from "./PriceHeuristic"
|
|
28
|
+
export { PythConfiguration } from "./PythConfiguration"
|
|
29
|
+
export type {
|
|
30
|
+
PythConfigurationFields,
|
|
31
|
+
PythConfigurationJSON,
|
|
32
|
+
} from "./PythConfiguration"
|
|
33
|
+
export { ScopeConfiguration } from "./ScopeConfiguration"
|
|
34
|
+
export type {
|
|
35
|
+
ScopeConfigurationFields,
|
|
36
|
+
ScopeConfigurationJSON,
|
|
37
|
+
} from "./ScopeConfiguration"
|
|
38
|
+
export { SwitchboardConfiguration } from "./SwitchboardConfiguration"
|
|
39
|
+
export type {
|
|
40
|
+
SwitchboardConfigurationFields,
|
|
41
|
+
SwitchboardConfigurationJSON,
|
|
42
|
+
} from "./SwitchboardConfiguration"
|
|
43
|
+
export { TokenInfo } from "./TokenInfo"
|
|
44
|
+
export type { TokenInfoFields, TokenInfoJSON } from "./TokenInfo"
|
|
45
|
+
export { BorrowRateCurve } from "./BorrowRateCurve"
|
|
46
|
+
export type {
|
|
47
|
+
BorrowRateCurveFields,
|
|
48
|
+
BorrowRateCurveJSON,
|
|
49
|
+
} from "./BorrowRateCurve"
|
|
50
|
+
export { CurvePoint } from "./CurvePoint"
|
|
51
|
+
export type { CurvePointFields, CurvePointJSON } from "./CurvePoint"
|
|
52
|
+
export { VaultConfigField }
|
|
53
|
+
|
|
54
|
+
export type VaultConfigFieldKind =
|
|
55
|
+
| VaultConfigField.PerformanceFeeBps
|
|
56
|
+
| VaultConfigField.ManagementFeeBps
|
|
57
|
+
| VaultConfigField.MinDepositAmount
|
|
58
|
+
| VaultConfigField.MinWithdrawAmount
|
|
59
|
+
| VaultConfigField.MintInvestAmount
|
|
60
|
+
| VaultConfigField.MinInvestDelaySlots
|
|
61
|
+
| VaultConfigField.CrankFundFeePerReserve
|
|
62
|
+
| VaultConfigField.PendingVaultAdmin
|
|
63
|
+
export type VaultConfigFieldJSON =
|
|
64
|
+
| VaultConfigField.PerformanceFeeBpsJSON
|
|
65
|
+
| VaultConfigField.ManagementFeeBpsJSON
|
|
66
|
+
| VaultConfigField.MinDepositAmountJSON
|
|
67
|
+
| VaultConfigField.MinWithdrawAmountJSON
|
|
68
|
+
| VaultConfigField.MintInvestAmountJSON
|
|
69
|
+
| VaultConfigField.MinInvestDelaySlotsJSON
|
|
70
|
+
| VaultConfigField.CrankFundFeePerReserveJSON
|
|
71
|
+
| VaultConfigField.PendingVaultAdminJSON
|
|
72
|
+
|
|
73
|
+
export { VaultAllocation } from "./VaultAllocation"
|
|
74
|
+
export type {
|
|
75
|
+
VaultAllocationFields,
|
|
76
|
+
VaultAllocationJSON,
|
|
77
|
+
} from "./VaultAllocation"
|
|
@@ -24,6 +24,7 @@ export class VanillaObligation {
|
|
|
24
24
|
constructor(programId: PublicKey) {
|
|
25
25
|
this.programId = programId;
|
|
26
26
|
}
|
|
27
|
+
|
|
27
28
|
toArgs() {
|
|
28
29
|
const initObligationArgs: InitObligationArgsModel = {
|
|
29
30
|
tag: VanillaObligation.tag,
|
|
@@ -34,6 +35,7 @@ export class VanillaObligation {
|
|
|
34
35
|
|
|
35
36
|
return initObligationArgs;
|
|
36
37
|
}
|
|
38
|
+
|
|
37
39
|
toPda(market: PublicKey, user: PublicKey) {
|
|
38
40
|
return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
|
|
39
41
|
}
|
|
@@ -61,6 +63,7 @@ export class MultiplyObligation {
|
|
|
61
63
|
|
|
62
64
|
return initObligationArgs;
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
toPda(market: PublicKey, user: PublicKey) {
|
|
65
68
|
return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
|
|
66
69
|
}
|
|
@@ -88,6 +91,7 @@ export class LeverageObligation {
|
|
|
88
91
|
|
|
89
92
|
return initObligationArgs;
|
|
90
93
|
}
|
|
94
|
+
|
|
91
95
|
toPda(market: PublicKey, user: PublicKey) {
|
|
92
96
|
return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
|
|
93
97
|
}
|
|
@@ -102,6 +106,7 @@ export class LendingObligation {
|
|
|
102
106
|
this.token = token;
|
|
103
107
|
this.programId = programId;
|
|
104
108
|
}
|
|
109
|
+
|
|
105
110
|
toArgs() {
|
|
106
111
|
const initObligationArgs: InitObligationArgsModel = {
|
|
107
112
|
tag: LendingObligation.tag,
|
|
@@ -112,6 +117,7 @@ export class LendingObligation {
|
|
|
112
117
|
|
|
113
118
|
return initObligationArgs;
|
|
114
119
|
}
|
|
120
|
+
|
|
115
121
|
toPda(market: PublicKey, user: PublicKey) {
|
|
116
122
|
return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
|
|
117
123
|
}
|
package/src/utils/pubkey.ts
CHANGED
|
@@ -239,6 +239,7 @@ export class PubkeyHashMap<K extends PublicKey, V> implements Map<K, V> {
|
|
|
239
239
|
export class HashablePublicKey extends PublicKey implements IEquality<HashablePublicKey> {
|
|
240
240
|
// We only use the last 32 bits of the public key for hashing
|
|
241
241
|
static MASK = new BN(1).shln(32).subn(1);
|
|
242
|
+
|
|
242
243
|
constructor(value: PublicKey | string | Buffer | Uint8Array | Array<number>) {
|
|
243
244
|
super(value);
|
|
244
245
|
}
|
|
@@ -257,5 +258,6 @@ export class HashablePublicKey extends PublicKey implements IEquality<HashablePu
|
|
|
257
258
|
|
|
258
259
|
interface IEquality<T extends IEquality<T>> {
|
|
259
260
|
equals(other: T): boolean;
|
|
261
|
+
|
|
260
262
|
hashCode(): number;
|
|
261
263
|
}
|
package/src/utils/rpc.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
import { Buffer } from 'buffer';
|
|
11
11
|
import axios from 'axios';
|
|
12
12
|
import { init, decompress } from '@bokuweb/zstd-wasm';
|
|
13
|
+
import { randomUUID } from 'crypto';
|
|
14
|
+
|
|
13
15
|
(async () => {
|
|
14
16
|
await init();
|
|
15
17
|
})();
|
|
@@ -44,7 +46,7 @@ export async function getProgramAccounts(
|
|
|
44
46
|
...configWithoutEncoding,
|
|
45
47
|
},
|
|
46
48
|
],
|
|
47
|
-
id:
|
|
49
|
+
id: randomUUID(),
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
52
|
headers: {
|