@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
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
5
|
|
|
6
6
|
export interface ReserveFeesFields {
|
|
7
7
|
/**
|
|
@@ -12,14 +12,14 @@ export interface ReserveFeesFields {
|
|
|
12
12
|
* 0.01% (1 basis point) = 115292150460685
|
|
13
13
|
* 0.00001% (Aave borrow fee) = 115292150461
|
|
14
14
|
*/
|
|
15
|
-
borrowFeeSf: BN
|
|
15
|
+
borrowFeeSf: BN
|
|
16
16
|
/**
|
|
17
17
|
* Fee for flash loan, expressed as scaled fraction.
|
|
18
18
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
19
19
|
*/
|
|
20
|
-
flashLoanFeeSf: BN
|
|
20
|
+
flashLoanFeeSf: BN
|
|
21
21
|
/** Used for allignment */
|
|
22
|
-
padding: Array<number
|
|
22
|
+
padding: Array<number>
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface ReserveFeesJSON {
|
|
@@ -31,14 +31,14 @@ export interface ReserveFeesJSON {
|
|
|
31
31
|
* 0.01% (1 basis point) = 115292150460685
|
|
32
32
|
* 0.00001% (Aave borrow fee) = 115292150461
|
|
33
33
|
*/
|
|
34
|
-
borrowFeeSf: string
|
|
34
|
+
borrowFeeSf: string
|
|
35
35
|
/**
|
|
36
36
|
* Fee for flash loan, expressed as scaled fraction.
|
|
37
37
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
38
38
|
*/
|
|
39
|
-
flashLoanFeeSf: string
|
|
39
|
+
flashLoanFeeSf: string
|
|
40
40
|
/** Used for allignment */
|
|
41
|
-
padding: Array<number
|
|
41
|
+
padding: Array<number>
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -57,26 +57,30 @@ export class ReserveFees {
|
|
|
57
57
|
* 0.01% (1 basis point) = 115292150460685
|
|
58
58
|
* 0.00001% (Aave borrow fee) = 115292150461
|
|
59
59
|
*/
|
|
60
|
-
readonly borrowFeeSf: BN
|
|
60
|
+
readonly borrowFeeSf: BN
|
|
61
61
|
/**
|
|
62
62
|
* Fee for flash loan, expressed as scaled fraction.
|
|
63
63
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
64
64
|
*/
|
|
65
|
-
readonly flashLoanFeeSf: BN
|
|
65
|
+
readonly flashLoanFeeSf: BN
|
|
66
66
|
/** Used for allignment */
|
|
67
|
-
readonly padding: Array<number
|
|
67
|
+
readonly padding: Array<number>
|
|
68
68
|
|
|
69
69
|
constructor(fields: ReserveFeesFields) {
|
|
70
|
-
this.borrowFeeSf = fields.borrowFeeSf
|
|
71
|
-
this.flashLoanFeeSf = fields.flashLoanFeeSf
|
|
72
|
-
this.padding = fields.padding
|
|
70
|
+
this.borrowFeeSf = fields.borrowFeeSf
|
|
71
|
+
this.flashLoanFeeSf = fields.flashLoanFeeSf
|
|
72
|
+
this.padding = fields.padding
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
static layout(property?: string) {
|
|
76
76
|
return borsh.struct(
|
|
77
|
-
[
|
|
77
|
+
[
|
|
78
|
+
borsh.u64("borrowFeeSf"),
|
|
79
|
+
borsh.u64("flashLoanFeeSf"),
|
|
80
|
+
borsh.array(borsh.u8(), 8, "padding"),
|
|
81
|
+
],
|
|
78
82
|
property
|
|
79
|
-
)
|
|
83
|
+
)
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -85,7 +89,7 @@ export class ReserveFees {
|
|
|
85
89
|
borrowFeeSf: obj.borrowFeeSf,
|
|
86
90
|
flashLoanFeeSf: obj.flashLoanFeeSf,
|
|
87
91
|
padding: obj.padding,
|
|
88
|
-
})
|
|
92
|
+
})
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
static toEncodable(fields: ReserveFeesFields) {
|
|
@@ -93,7 +97,7 @@ export class ReserveFees {
|
|
|
93
97
|
borrowFeeSf: fields.borrowFeeSf,
|
|
94
98
|
flashLoanFeeSf: fields.flashLoanFeeSf,
|
|
95
99
|
padding: fields.padding,
|
|
96
|
-
}
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
toJSON(): ReserveFeesJSON {
|
|
@@ -101,7 +105,7 @@ export class ReserveFees {
|
|
|
101
105
|
borrowFeeSf: this.borrowFeeSf.toString(),
|
|
102
106
|
flashLoanFeeSf: this.flashLoanFeeSf.toString(),
|
|
103
107
|
padding: this.padding,
|
|
104
|
-
}
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
static fromJSON(obj: ReserveFeesJSON): ReserveFees {
|
|
@@ -109,10 +113,10 @@ export class ReserveFees {
|
|
|
109
113
|
borrowFeeSf: new BN(obj.borrowFeeSf),
|
|
110
114
|
flashLoanFeeSf: new BN(obj.flashLoanFeeSf),
|
|
111
115
|
padding: obj.padding,
|
|
112
|
-
})
|
|
116
|
+
})
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
toEncodable() {
|
|
116
|
-
return ReserveFees.toEncodable(this)
|
|
120
|
+
return ReserveFees.toEncodable(this)
|
|
117
121
|
}
|
|
118
122
|
}
|
|
@@ -1,176 +1,184 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
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
5
|
|
|
6
6
|
export interface ReserveLiquidityFields {
|
|
7
7
|
/** Reserve liquidity mint address */
|
|
8
|
-
mintPubkey: PublicKey
|
|
8
|
+
mintPubkey: PublicKey
|
|
9
9
|
/** Reserve liquidity supply address */
|
|
10
|
-
supplyVault: PublicKey
|
|
10
|
+
supplyVault: PublicKey
|
|
11
11
|
/** Reserve liquidity fee collection address */
|
|
12
|
-
feeVault: PublicKey
|
|
12
|
+
feeVault: PublicKey
|
|
13
13
|
/** Reserve liquidity available */
|
|
14
|
-
availableAmount: BN
|
|
14
|
+
availableAmount: BN
|
|
15
15
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
16
|
-
borrowedAmountSf: BN
|
|
16
|
+
borrowedAmountSf: BN
|
|
17
17
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
18
|
-
marketPriceSf: BN
|
|
18
|
+
marketPriceSf: BN
|
|
19
19
|
/** Unix timestamp of the market price (from the oracle) */
|
|
20
|
-
marketPriceLastUpdatedTs: BN
|
|
20
|
+
marketPriceLastUpdatedTs: BN
|
|
21
21
|
/** Reserve liquidity mint decimals */
|
|
22
|
-
mintDecimals: BN
|
|
22
|
+
mintDecimals: BN
|
|
23
23
|
/**
|
|
24
24
|
* Timestamp in slots when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
25
25
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
26
26
|
*/
|
|
27
|
-
depositLimitCrossedSlot: BN
|
|
27
|
+
depositLimitCrossedSlot: BN
|
|
28
28
|
/**
|
|
29
29
|
* Timestamp in slots when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
30
30
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
31
31
|
*/
|
|
32
|
-
borrowLimitCrossedSlot: BN
|
|
32
|
+
borrowLimitCrossedSlot: BN
|
|
33
33
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
34
|
-
cumulativeBorrowRateBsf: types.BigFractionBytesFields
|
|
34
|
+
cumulativeBorrowRateBsf: types.BigFractionBytesFields
|
|
35
35
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
36
|
-
accumulatedProtocolFeesSf: BN
|
|
36
|
+
accumulatedProtocolFeesSf: BN
|
|
37
37
|
/** Reserve cumulative referrer fees (scaled fraction) */
|
|
38
|
-
accumulatedReferrerFeesSf: BN
|
|
38
|
+
accumulatedReferrerFeesSf: BN
|
|
39
39
|
/** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
|
|
40
|
-
pendingReferrerFeesSf: BN
|
|
40
|
+
pendingReferrerFeesSf: BN
|
|
41
41
|
/** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
|
|
42
|
-
absoluteReferralRateSf: BN
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
absoluteReferralRateSf: BN
|
|
43
|
+
/** Token program of the liquidity mint */
|
|
44
|
+
tokenProgram: PublicKey
|
|
45
|
+
padding2: Array<BN>
|
|
46
|
+
padding3: Array<BN>
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export interface ReserveLiquidityJSON {
|
|
48
50
|
/** Reserve liquidity mint address */
|
|
49
|
-
mintPubkey: string
|
|
51
|
+
mintPubkey: string
|
|
50
52
|
/** Reserve liquidity supply address */
|
|
51
|
-
supplyVault: string
|
|
53
|
+
supplyVault: string
|
|
52
54
|
/** Reserve liquidity fee collection address */
|
|
53
|
-
feeVault: string
|
|
55
|
+
feeVault: string
|
|
54
56
|
/** Reserve liquidity available */
|
|
55
|
-
availableAmount: string
|
|
57
|
+
availableAmount: string
|
|
56
58
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
57
|
-
borrowedAmountSf: string
|
|
59
|
+
borrowedAmountSf: string
|
|
58
60
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
59
|
-
marketPriceSf: string
|
|
61
|
+
marketPriceSf: string
|
|
60
62
|
/** Unix timestamp of the market price (from the oracle) */
|
|
61
|
-
marketPriceLastUpdatedTs: string
|
|
63
|
+
marketPriceLastUpdatedTs: string
|
|
62
64
|
/** Reserve liquidity mint decimals */
|
|
63
|
-
mintDecimals: string
|
|
65
|
+
mintDecimals: string
|
|
64
66
|
/**
|
|
65
67
|
* Timestamp in slots when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
66
68
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
67
69
|
*/
|
|
68
|
-
depositLimitCrossedSlot: string
|
|
70
|
+
depositLimitCrossedSlot: string
|
|
69
71
|
/**
|
|
70
72
|
* Timestamp in slots when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
71
73
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
72
74
|
*/
|
|
73
|
-
borrowLimitCrossedSlot: string
|
|
75
|
+
borrowLimitCrossedSlot: string
|
|
74
76
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
75
|
-
cumulativeBorrowRateBsf: types.BigFractionBytesJSON
|
|
77
|
+
cumulativeBorrowRateBsf: types.BigFractionBytesJSON
|
|
76
78
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
77
|
-
accumulatedProtocolFeesSf: string
|
|
79
|
+
accumulatedProtocolFeesSf: string
|
|
78
80
|
/** Reserve cumulative referrer fees (scaled fraction) */
|
|
79
|
-
accumulatedReferrerFeesSf: string
|
|
81
|
+
accumulatedReferrerFeesSf: string
|
|
80
82
|
/** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
|
|
81
|
-
pendingReferrerFeesSf: string
|
|
83
|
+
pendingReferrerFeesSf: string
|
|
82
84
|
/** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
|
|
83
|
-
absoluteReferralRateSf: string
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
absoluteReferralRateSf: string
|
|
86
|
+
/** Token program of the liquidity mint */
|
|
87
|
+
tokenProgram: string
|
|
88
|
+
padding2: Array<string>
|
|
89
|
+
padding3: Array<string>
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
/** Reserve liquidity */
|
|
89
93
|
export class ReserveLiquidity {
|
|
90
94
|
/** Reserve liquidity mint address */
|
|
91
|
-
readonly mintPubkey: PublicKey
|
|
95
|
+
readonly mintPubkey: PublicKey
|
|
92
96
|
/** Reserve liquidity supply address */
|
|
93
|
-
readonly supplyVault: PublicKey
|
|
97
|
+
readonly supplyVault: PublicKey
|
|
94
98
|
/** Reserve liquidity fee collection address */
|
|
95
|
-
readonly feeVault: PublicKey
|
|
99
|
+
readonly feeVault: PublicKey
|
|
96
100
|
/** Reserve liquidity available */
|
|
97
|
-
readonly availableAmount: BN
|
|
101
|
+
readonly availableAmount: BN
|
|
98
102
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
99
|
-
readonly borrowedAmountSf: BN
|
|
103
|
+
readonly borrowedAmountSf: BN
|
|
100
104
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
101
|
-
readonly marketPriceSf: BN
|
|
105
|
+
readonly marketPriceSf: BN
|
|
102
106
|
/** Unix timestamp of the market price (from the oracle) */
|
|
103
|
-
readonly marketPriceLastUpdatedTs: BN
|
|
107
|
+
readonly marketPriceLastUpdatedTs: BN
|
|
104
108
|
/** Reserve liquidity mint decimals */
|
|
105
|
-
readonly mintDecimals: BN
|
|
109
|
+
readonly mintDecimals: BN
|
|
106
110
|
/**
|
|
107
111
|
* Timestamp in slots when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
108
112
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
109
113
|
*/
|
|
110
|
-
readonly depositLimitCrossedSlot: BN
|
|
114
|
+
readonly depositLimitCrossedSlot: BN
|
|
111
115
|
/**
|
|
112
116
|
* Timestamp in slots when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
113
117
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
114
118
|
*/
|
|
115
|
-
readonly borrowLimitCrossedSlot: BN
|
|
119
|
+
readonly borrowLimitCrossedSlot: BN
|
|
116
120
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
117
|
-
readonly cumulativeBorrowRateBsf: types.BigFractionBytes
|
|
121
|
+
readonly cumulativeBorrowRateBsf: types.BigFractionBytes
|
|
118
122
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
119
|
-
readonly accumulatedProtocolFeesSf: BN
|
|
123
|
+
readonly accumulatedProtocolFeesSf: BN
|
|
120
124
|
/** Reserve cumulative referrer fees (scaled fraction) */
|
|
121
|
-
readonly accumulatedReferrerFeesSf: BN
|
|
125
|
+
readonly accumulatedReferrerFeesSf: BN
|
|
122
126
|
/** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */
|
|
123
|
-
readonly pendingReferrerFeesSf: BN
|
|
127
|
+
readonly pendingReferrerFeesSf: BN
|
|
124
128
|
/** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */
|
|
125
|
-
readonly absoluteReferralRateSf: BN
|
|
126
|
-
|
|
127
|
-
readonly
|
|
129
|
+
readonly absoluteReferralRateSf: BN
|
|
130
|
+
/** Token program of the liquidity mint */
|
|
131
|
+
readonly tokenProgram: PublicKey
|
|
132
|
+
readonly padding2: Array<BN>
|
|
133
|
+
readonly padding3: Array<BN>
|
|
128
134
|
|
|
129
135
|
constructor(fields: ReserveLiquidityFields) {
|
|
130
|
-
this.mintPubkey = fields.mintPubkey
|
|
131
|
-
this.supplyVault = fields.supplyVault
|
|
132
|
-
this.feeVault = fields.feeVault
|
|
133
|
-
this.availableAmount = fields.availableAmount
|
|
134
|
-
this.borrowedAmountSf = fields.borrowedAmountSf
|
|
135
|
-
this.marketPriceSf = fields.marketPriceSf
|
|
136
|
-
this.marketPriceLastUpdatedTs = fields.marketPriceLastUpdatedTs
|
|
137
|
-
this.mintDecimals = fields.mintDecimals
|
|
138
|
-
this.depositLimitCrossedSlot = fields.depositLimitCrossedSlot
|
|
139
|
-
this.borrowLimitCrossedSlot = fields.borrowLimitCrossedSlot
|
|
136
|
+
this.mintPubkey = fields.mintPubkey
|
|
137
|
+
this.supplyVault = fields.supplyVault
|
|
138
|
+
this.feeVault = fields.feeVault
|
|
139
|
+
this.availableAmount = fields.availableAmount
|
|
140
|
+
this.borrowedAmountSf = fields.borrowedAmountSf
|
|
141
|
+
this.marketPriceSf = fields.marketPriceSf
|
|
142
|
+
this.marketPriceLastUpdatedTs = fields.marketPriceLastUpdatedTs
|
|
143
|
+
this.mintDecimals = fields.mintDecimals
|
|
144
|
+
this.depositLimitCrossedSlot = fields.depositLimitCrossedSlot
|
|
145
|
+
this.borrowLimitCrossedSlot = fields.borrowLimitCrossedSlot
|
|
140
146
|
this.cumulativeBorrowRateBsf = new types.BigFractionBytes({
|
|
141
147
|
...fields.cumulativeBorrowRateBsf,
|
|
142
|
-
})
|
|
143
|
-
this.accumulatedProtocolFeesSf = fields.accumulatedProtocolFeesSf
|
|
144
|
-
this.accumulatedReferrerFeesSf = fields.accumulatedReferrerFeesSf
|
|
145
|
-
this.pendingReferrerFeesSf = fields.pendingReferrerFeesSf
|
|
146
|
-
this.absoluteReferralRateSf = fields.absoluteReferralRateSf
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
148
|
+
})
|
|
149
|
+
this.accumulatedProtocolFeesSf = fields.accumulatedProtocolFeesSf
|
|
150
|
+
this.accumulatedReferrerFeesSf = fields.accumulatedReferrerFeesSf
|
|
151
|
+
this.pendingReferrerFeesSf = fields.pendingReferrerFeesSf
|
|
152
|
+
this.absoluteReferralRateSf = fields.absoluteReferralRateSf
|
|
153
|
+
this.tokenProgram = fields.tokenProgram
|
|
154
|
+
this.padding2 = fields.padding2
|
|
155
|
+
this.padding3 = fields.padding3
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
static layout(property?: string) {
|
|
152
159
|
return borsh.struct(
|
|
153
160
|
[
|
|
154
|
-
borsh.publicKey(
|
|
155
|
-
borsh.publicKey(
|
|
156
|
-
borsh.publicKey(
|
|
157
|
-
borsh.u64(
|
|
158
|
-
borsh.u128(
|
|
159
|
-
borsh.u128(
|
|
160
|
-
borsh.u64(
|
|
161
|
-
borsh.u64(
|
|
162
|
-
borsh.u64(
|
|
163
|
-
borsh.u64(
|
|
164
|
-
types.BigFractionBytes.layout(
|
|
165
|
-
borsh.u128(
|
|
166
|
-
borsh.u128(
|
|
167
|
-
borsh.u128(
|
|
168
|
-
borsh.u128(
|
|
169
|
-
borsh.
|
|
170
|
-
borsh.array(borsh.
|
|
161
|
+
borsh.publicKey("mintPubkey"),
|
|
162
|
+
borsh.publicKey("supplyVault"),
|
|
163
|
+
borsh.publicKey("feeVault"),
|
|
164
|
+
borsh.u64("availableAmount"),
|
|
165
|
+
borsh.u128("borrowedAmountSf"),
|
|
166
|
+
borsh.u128("marketPriceSf"),
|
|
167
|
+
borsh.u64("marketPriceLastUpdatedTs"),
|
|
168
|
+
borsh.u64("mintDecimals"),
|
|
169
|
+
borsh.u64("depositLimitCrossedSlot"),
|
|
170
|
+
borsh.u64("borrowLimitCrossedSlot"),
|
|
171
|
+
types.BigFractionBytes.layout("cumulativeBorrowRateBsf"),
|
|
172
|
+
borsh.u128("accumulatedProtocolFeesSf"),
|
|
173
|
+
borsh.u128("accumulatedReferrerFeesSf"),
|
|
174
|
+
borsh.u128("pendingReferrerFeesSf"),
|
|
175
|
+
borsh.u128("absoluteReferralRateSf"),
|
|
176
|
+
borsh.publicKey("tokenProgram"),
|
|
177
|
+
borsh.array(borsh.u64(), 51, "padding2"),
|
|
178
|
+
borsh.array(borsh.u128(), 32, "padding3"),
|
|
171
179
|
],
|
|
172
180
|
property
|
|
173
|
-
)
|
|
181
|
+
)
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -186,14 +194,17 @@ export class ReserveLiquidity {
|
|
|
186
194
|
mintDecimals: obj.mintDecimals,
|
|
187
195
|
depositLimitCrossedSlot: obj.depositLimitCrossedSlot,
|
|
188
196
|
borrowLimitCrossedSlot: obj.borrowLimitCrossedSlot,
|
|
189
|
-
cumulativeBorrowRateBsf: types.BigFractionBytes.fromDecoded(
|
|
197
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.fromDecoded(
|
|
198
|
+
obj.cumulativeBorrowRateBsf
|
|
199
|
+
),
|
|
190
200
|
accumulatedProtocolFeesSf: obj.accumulatedProtocolFeesSf,
|
|
191
201
|
accumulatedReferrerFeesSf: obj.accumulatedReferrerFeesSf,
|
|
192
202
|
pendingReferrerFeesSf: obj.pendingReferrerFeesSf,
|
|
193
203
|
absoluteReferralRateSf: obj.absoluteReferralRateSf,
|
|
204
|
+
tokenProgram: obj.tokenProgram,
|
|
194
205
|
padding2: obj.padding2,
|
|
195
206
|
padding3: obj.padding3,
|
|
196
|
-
})
|
|
207
|
+
})
|
|
197
208
|
}
|
|
198
209
|
|
|
199
210
|
static toEncodable(fields: ReserveLiquidityFields) {
|
|
@@ -208,14 +219,17 @@ export class ReserveLiquidity {
|
|
|
208
219
|
mintDecimals: fields.mintDecimals,
|
|
209
220
|
depositLimitCrossedSlot: fields.depositLimitCrossedSlot,
|
|
210
221
|
borrowLimitCrossedSlot: fields.borrowLimitCrossedSlot,
|
|
211
|
-
cumulativeBorrowRateBsf: types.BigFractionBytes.toEncodable(
|
|
222
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.toEncodable(
|
|
223
|
+
fields.cumulativeBorrowRateBsf
|
|
224
|
+
),
|
|
212
225
|
accumulatedProtocolFeesSf: fields.accumulatedProtocolFeesSf,
|
|
213
226
|
accumulatedReferrerFeesSf: fields.accumulatedReferrerFeesSf,
|
|
214
227
|
pendingReferrerFeesSf: fields.pendingReferrerFeesSf,
|
|
215
228
|
absoluteReferralRateSf: fields.absoluteReferralRateSf,
|
|
229
|
+
tokenProgram: fields.tokenProgram,
|
|
216
230
|
padding2: fields.padding2,
|
|
217
231
|
padding3: fields.padding3,
|
|
218
|
-
}
|
|
232
|
+
}
|
|
219
233
|
}
|
|
220
234
|
|
|
221
235
|
toJSON(): ReserveLiquidityJSON {
|
|
@@ -235,9 +249,10 @@ export class ReserveLiquidity {
|
|
|
235
249
|
accumulatedReferrerFeesSf: this.accumulatedReferrerFeesSf.toString(),
|
|
236
250
|
pendingReferrerFeesSf: this.pendingReferrerFeesSf.toString(),
|
|
237
251
|
absoluteReferralRateSf: this.absoluteReferralRateSf.toString(),
|
|
252
|
+
tokenProgram: this.tokenProgram.toString(),
|
|
238
253
|
padding2: this.padding2.map((item) => item.toString()),
|
|
239
254
|
padding3: this.padding3.map((item) => item.toString()),
|
|
240
|
-
}
|
|
255
|
+
}
|
|
241
256
|
}
|
|
242
257
|
|
|
243
258
|
static fromJSON(obj: ReserveLiquidityJSON): ReserveLiquidity {
|
|
@@ -252,17 +267,20 @@ export class ReserveLiquidity {
|
|
|
252
267
|
mintDecimals: new BN(obj.mintDecimals),
|
|
253
268
|
depositLimitCrossedSlot: new BN(obj.depositLimitCrossedSlot),
|
|
254
269
|
borrowLimitCrossedSlot: new BN(obj.borrowLimitCrossedSlot),
|
|
255
|
-
cumulativeBorrowRateBsf: types.BigFractionBytes.fromJSON(
|
|
270
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.fromJSON(
|
|
271
|
+
obj.cumulativeBorrowRateBsf
|
|
272
|
+
),
|
|
256
273
|
accumulatedProtocolFeesSf: new BN(obj.accumulatedProtocolFeesSf),
|
|
257
274
|
accumulatedReferrerFeesSf: new BN(obj.accumulatedReferrerFeesSf),
|
|
258
275
|
pendingReferrerFeesSf: new BN(obj.pendingReferrerFeesSf),
|
|
259
276
|
absoluteReferralRateSf: new BN(obj.absoluteReferralRateSf),
|
|
277
|
+
tokenProgram: new PublicKey(obj.tokenProgram),
|
|
260
278
|
padding2: obj.padding2.map((item) => new BN(item)),
|
|
261
279
|
padding3: obj.padding3.map((item) => new BN(item)),
|
|
262
|
-
})
|
|
280
|
+
})
|
|
263
281
|
}
|
|
264
282
|
|
|
265
283
|
toEncodable() {
|
|
266
|
-
return ReserveLiquidity.toEncodable(this)
|
|
284
|
+
return ReserveLiquidity.toEncodable(this)
|
|
267
285
|
}
|
|
268
286
|
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
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
5
|
|
|
6
6
|
export interface ScopeConfigurationFields {
|
|
7
7
|
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
8
|
-
priceFeed: PublicKey
|
|
8
|
+
priceFeed: PublicKey
|
|
9
9
|
/** This is the scope_id price chain that results in a price for the token */
|
|
10
|
-
priceChain: Array<number
|
|
10
|
+
priceChain: Array<number>
|
|
11
11
|
/** This is the scope_id price chain for the twap */
|
|
12
|
-
twapChain: Array<number
|
|
12
|
+
twapChain: Array<number>
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface ScopeConfigurationJSON {
|
|
16
16
|
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
17
|
-
priceFeed: string
|
|
17
|
+
priceFeed: string
|
|
18
18
|
/** This is the scope_id price chain that results in a price for the token */
|
|
19
|
-
priceChain: Array<number
|
|
19
|
+
priceChain: Array<number>
|
|
20
20
|
/** This is the scope_id price chain for the twap */
|
|
21
|
-
twapChain: Array<number
|
|
21
|
+
twapChain: Array<number>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export class ScopeConfiguration {
|
|
25
25
|
/** Pubkey of the scope price feed (disabled if `null` or `default`) */
|
|
26
|
-
readonly priceFeed: PublicKey
|
|
26
|
+
readonly priceFeed: PublicKey
|
|
27
27
|
/** This is the scope_id price chain that results in a price for the token */
|
|
28
|
-
readonly priceChain: Array<number
|
|
28
|
+
readonly priceChain: Array<number>
|
|
29
29
|
/** This is the scope_id price chain for the twap */
|
|
30
|
-
readonly twapChain: Array<number
|
|
30
|
+
readonly twapChain: Array<number>
|
|
31
31
|
|
|
32
32
|
constructor(fields: ScopeConfigurationFields) {
|
|
33
|
-
this.priceFeed = fields.priceFeed
|
|
34
|
-
this.priceChain = fields.priceChain
|
|
35
|
-
this.twapChain = fields.twapChain
|
|
33
|
+
this.priceFeed = fields.priceFeed
|
|
34
|
+
this.priceChain = fields.priceChain
|
|
35
|
+
this.twapChain = fields.twapChain
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
static layout(property?: string) {
|
|
39
39
|
return borsh.struct(
|
|
40
40
|
[
|
|
41
|
-
borsh.publicKey(
|
|
42
|
-
borsh.array(borsh.u16(), 4,
|
|
43
|
-
borsh.array(borsh.u16(), 4,
|
|
41
|
+
borsh.publicKey("priceFeed"),
|
|
42
|
+
borsh.array(borsh.u16(), 4, "priceChain"),
|
|
43
|
+
borsh.array(borsh.u16(), 4, "twapChain"),
|
|
44
44
|
],
|
|
45
45
|
property
|
|
46
|
-
)
|
|
46
|
+
)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -52,7 +52,7 @@ export class ScopeConfiguration {
|
|
|
52
52
|
priceFeed: obj.priceFeed,
|
|
53
53
|
priceChain: obj.priceChain,
|
|
54
54
|
twapChain: obj.twapChain,
|
|
55
|
-
})
|
|
55
|
+
})
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
static toEncodable(fields: ScopeConfigurationFields) {
|
|
@@ -60,7 +60,7 @@ export class ScopeConfiguration {
|
|
|
60
60
|
priceFeed: fields.priceFeed,
|
|
61
61
|
priceChain: fields.priceChain,
|
|
62
62
|
twapChain: fields.twapChain,
|
|
63
|
-
}
|
|
63
|
+
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
toJSON(): ScopeConfigurationJSON {
|
|
@@ -68,7 +68,7 @@ export class ScopeConfiguration {
|
|
|
68
68
|
priceFeed: this.priceFeed.toString(),
|
|
69
69
|
priceChain: this.priceChain,
|
|
70
70
|
twapChain: this.twapChain,
|
|
71
|
-
}
|
|
71
|
+
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
static fromJSON(obj: ScopeConfigurationJSON): ScopeConfiguration {
|
|
@@ -76,10 +76,10 @@ export class ScopeConfiguration {
|
|
|
76
76
|
priceFeed: new PublicKey(obj.priceFeed),
|
|
77
77
|
priceChain: obj.priceChain,
|
|
78
78
|
twapChain: obj.twapChain,
|
|
79
|
-
})
|
|
79
|
+
})
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
toEncodable() {
|
|
83
|
-
return ScopeConfiguration.toEncodable(this)
|
|
83
|
+
return ScopeConfiguration.toEncodable(this)
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
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
5
|
|
|
6
6
|
export interface SwitchboardConfigurationFields {
|
|
7
7
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
8
|
-
priceAggregator: PublicKey
|
|
9
|
-
twapAggregator: PublicKey
|
|
8
|
+
priceAggregator: PublicKey
|
|
9
|
+
twapAggregator: PublicKey
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface SwitchboardConfigurationJSON {
|
|
13
13
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
14
|
-
priceAggregator: string
|
|
15
|
-
twapAggregator: string
|
|
14
|
+
priceAggregator: string
|
|
15
|
+
twapAggregator: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class SwitchboardConfiguration {
|
|
19
19
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
20
|
-
readonly priceAggregator: PublicKey
|
|
21
|
-
readonly twapAggregator: PublicKey
|
|
20
|
+
readonly priceAggregator: PublicKey
|
|
21
|
+
readonly twapAggregator: PublicKey
|
|
22
22
|
|
|
23
23
|
constructor(fields: SwitchboardConfigurationFields) {
|
|
24
|
-
this.priceAggregator = fields.priceAggregator
|
|
25
|
-
this.twapAggregator = fields.twapAggregator
|
|
24
|
+
this.priceAggregator = fields.priceAggregator
|
|
25
|
+
this.twapAggregator = fields.twapAggregator
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
static layout(property?: string) {
|
|
29
|
-
return borsh.struct(
|
|
29
|
+
return borsh.struct(
|
|
30
|
+
[borsh.publicKey("priceAggregator"), borsh.publicKey("twapAggregator")],
|
|
31
|
+
property
|
|
32
|
+
)
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -34,31 +37,31 @@ export class SwitchboardConfiguration {
|
|
|
34
37
|
return new SwitchboardConfiguration({
|
|
35
38
|
priceAggregator: obj.priceAggregator,
|
|
36
39
|
twapAggregator: obj.twapAggregator,
|
|
37
|
-
})
|
|
40
|
+
})
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
static toEncodable(fields: SwitchboardConfigurationFields) {
|
|
41
44
|
return {
|
|
42
45
|
priceAggregator: fields.priceAggregator,
|
|
43
46
|
twapAggregator: fields.twapAggregator,
|
|
44
|
-
}
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
toJSON(): SwitchboardConfigurationJSON {
|
|
48
51
|
return {
|
|
49
52
|
priceAggregator: this.priceAggregator.toString(),
|
|
50
53
|
twapAggregator: this.twapAggregator.toString(),
|
|
51
|
-
}
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
static fromJSON(obj: SwitchboardConfigurationJSON): SwitchboardConfiguration {
|
|
55
58
|
return new SwitchboardConfiguration({
|
|
56
59
|
priceAggregator: new PublicKey(obj.priceAggregator),
|
|
57
60
|
twapAggregator: new PublicKey(obj.twapAggregator),
|
|
58
|
-
})
|
|
61
|
+
})
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
toEncodable() {
|
|
62
|
-
return SwitchboardConfiguration.toEncodable(this)
|
|
65
|
+
return SwitchboardConfiguration.toEncodable(this)
|
|
63
66
|
}
|
|
64
67
|
}
|