@kamino-finance/klend-sdk 5.0.3 → 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/manager.d.ts +38 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +98 -4
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +2 -25
- package/dist/classes/market.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 +14 -0
- package/dist/client_kamino_manager.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/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +6 -0
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/leverage/calcs.d.ts +28 -1
- package/dist/leverage/calcs.d.ts.map +1 -1
- package/dist/leverage/calcs.js +204 -8
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/index.d.ts +1 -0
- package/dist/leverage/index.d.ts.map +1 -1
- package/dist/leverage/index.js +1 -0
- package/dist/leverage/index.js.map +1 -1
- package/dist/leverage/operations.d.ts +14 -241
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +508 -776
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +173 -0
- package/dist/leverage/types.d.ts.map +1 -0
- package/dist/leverage/types.js +3 -0
- package/dist/leverage/types.js.map +1 -0
- package/dist/leverage/utils.d.ts +5 -5
- package/dist/leverage/utils.d.ts.map +1 -1
- package/dist/leverage/utils.js +68 -33
- package/dist/leverage/utils.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +2 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/fuzz.d.ts +3 -0
- package/dist/utils/fuzz.d.ts.map +1 -0
- package/dist/utils/fuzz.js +11 -0
- package/dist/utils/fuzz.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.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/manager.ts +122 -4
- package/src/classes/market.ts +1 -1
- package/src/classes/vault.ts +123 -49
- package/src/client_kamino_manager.ts +18 -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/lending_operations/repay_with_collateral_operations.ts +2 -0
- package/src/leverage/calcs.ts +315 -8
- package/src/leverage/index.ts +1 -0
- package/src/leverage/operations.ts +1079 -1331
- package/src/leverage/types.ts +211 -0
- package/src/leverage/utils.ts +103 -64
- package/src/utils/constants.ts +2 -0
- package/src/utils/fuzz.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/rpc.ts +2 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface WithdrawPendingFeesAccounts {
|
|
8
|
+
adminAuthority: PublicKey
|
|
9
|
+
vaultState: PublicKey
|
|
10
|
+
reserve: PublicKey
|
|
11
|
+
tokenVault: PublicKey
|
|
12
|
+
ctokenVault: PublicKey
|
|
13
|
+
baseVaultAuthority: PublicKey
|
|
14
|
+
tokenAta: PublicKey
|
|
15
|
+
tokenMint: PublicKey
|
|
16
|
+
tokenProgram: PublicKey
|
|
17
|
+
/** CPI accounts */
|
|
18
|
+
lendingMarket: PublicKey
|
|
19
|
+
lendingMarketAuthority: PublicKey
|
|
20
|
+
reserveLiquiditySupply: PublicKey
|
|
21
|
+
reserveCollateralMint: PublicKey
|
|
22
|
+
klendProgram: PublicKey
|
|
23
|
+
instructionSysvarAccount: PublicKey
|
|
24
|
+
reserveCollateralTokenProgram: PublicKey
|
|
25
|
+
sharesTokenProgram: PublicKey
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function withdrawPendingFees(
|
|
29
|
+
accounts: WithdrawPendingFeesAccounts,
|
|
30
|
+
programId: PublicKey = PROGRAM_ID
|
|
31
|
+
) {
|
|
32
|
+
const keys: Array<AccountMeta> = [
|
|
33
|
+
{ pubkey: accounts.adminAuthority, isSigner: true, isWritable: true },
|
|
34
|
+
{ pubkey: accounts.vaultState, isSigner: false, isWritable: true },
|
|
35
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
36
|
+
{ pubkey: accounts.tokenVault, isSigner: false, isWritable: true },
|
|
37
|
+
{ pubkey: accounts.ctokenVault, isSigner: false, isWritable: true },
|
|
38
|
+
{ pubkey: accounts.baseVaultAuthority, isSigner: false, isWritable: true },
|
|
39
|
+
{ pubkey: accounts.tokenAta, isSigner: false, isWritable: true },
|
|
40
|
+
{ pubkey: accounts.tokenMint, isSigner: false, isWritable: true },
|
|
41
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
42
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
43
|
+
{
|
|
44
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
45
|
+
isSigner: false,
|
|
46
|
+
isWritable: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
pubkey: accounts.reserveLiquiditySupply,
|
|
50
|
+
isSigner: false,
|
|
51
|
+
isWritable: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pubkey: accounts.reserveCollateralMint,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
},
|
|
58
|
+
{ pubkey: accounts.klendProgram, isSigner: false, isWritable: false },
|
|
59
|
+
{
|
|
60
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: false,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
pubkey: accounts.reserveCollateralTokenProgram,
|
|
66
|
+
isSigner: false,
|
|
67
|
+
isWritable: false,
|
|
68
|
+
},
|
|
69
|
+
{ pubkey: accounts.sharesTokenProgram, isSigner: false, isWritable: false },
|
|
70
|
+
]
|
|
71
|
+
const identifier = Buffer.from([131, 194, 200, 140, 175, 244, 217, 183])
|
|
72
|
+
const data = identifier
|
|
73
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
74
|
+
return ix
|
|
75
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
2
2
|
|
|
3
3
|
// Program ID passed with the cli --program-id flag when running the code generator. Do not edit, it will get overwritten.
|
|
4
|
-
export const PROGRAM_ID_CLI = new PublicKey(
|
|
4
|
+
export const PROGRAM_ID_CLI = new PublicKey(
|
|
5
|
+
"kvauTFR8qm1dhniz6pYuBZkuene3Hfrs1VQhVRgCNrr"
|
|
6
|
+
)
|
|
5
7
|
|
|
6
8
|
// This constant will not get overwritten on subsequent code generations and it's safe to modify it's value.
|
|
7
|
-
export const PROGRAM_ID: PublicKey = PROGRAM_ID_CLI
|
|
9
|
+
export const PROGRAM_ID: PublicKey = PROGRAM_ID_CLI
|
|
@@ -1,29 +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 BigFractionBytesFields {
|
|
7
|
-
value: Array<BN
|
|
8
|
-
padding: Array<BN
|
|
7
|
+
value: Array<BN>
|
|
8
|
+
padding: Array<BN>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface BigFractionBytesJSON {
|
|
12
|
-
value: Array<string
|
|
13
|
-
padding: Array<string
|
|
12
|
+
value: Array<string>
|
|
13
|
+
padding: Array<string>
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export class BigFractionBytes {
|
|
17
|
-
readonly value: Array<BN
|
|
18
|
-
readonly padding: Array<BN
|
|
17
|
+
readonly value: Array<BN>
|
|
18
|
+
readonly padding: Array<BN>
|
|
19
19
|
|
|
20
20
|
constructor(fields: BigFractionBytesFields) {
|
|
21
|
-
this.value = fields.value
|
|
22
|
-
this.padding = fields.padding
|
|
21
|
+
this.value = fields.value
|
|
22
|
+
this.padding = fields.padding
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
static layout(property?: string) {
|
|
26
|
-
return borsh.struct(
|
|
26
|
+
return borsh.struct(
|
|
27
|
+
[
|
|
28
|
+
borsh.array(borsh.u64(), 4, "value"),
|
|
29
|
+
borsh.array(borsh.u64(), 2, "padding"),
|
|
30
|
+
],
|
|
31
|
+
property
|
|
32
|
+
)
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -31,31 +37,31 @@ export class BigFractionBytes {
|
|
|
31
37
|
return new BigFractionBytes({
|
|
32
38
|
value: obj.value,
|
|
33
39
|
padding: obj.padding,
|
|
34
|
-
})
|
|
40
|
+
})
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
static toEncodable(fields: BigFractionBytesFields) {
|
|
38
44
|
return {
|
|
39
45
|
value: fields.value,
|
|
40
46
|
padding: fields.padding,
|
|
41
|
-
}
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
toJSON(): BigFractionBytesJSON {
|
|
45
51
|
return {
|
|
46
52
|
value: this.value.map((item) => item.toString()),
|
|
47
53
|
padding: this.padding.map((item) => item.toString()),
|
|
48
|
-
}
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
static fromJSON(obj: BigFractionBytesJSON): BigFractionBytes {
|
|
52
58
|
return new BigFractionBytes({
|
|
53
59
|
value: obj.value.map((item) => new BN(item)),
|
|
54
60
|
padding: obj.padding.map((item) => new BN(item)),
|
|
55
|
-
})
|
|
61
|
+
})
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
toEncodable() {
|
|
59
|
-
return BigFractionBytes.toEncodable(this)
|
|
65
|
+
return BigFractionBytes.toEncodable(this)
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -1,55 +1,60 @@
|
|
|
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 BorrowRateCurveFields {
|
|
7
|
-
points: Array<types.CurvePointFields
|
|
7
|
+
points: Array<types.CurvePointFields>
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface BorrowRateCurveJSON {
|
|
11
|
-
points: Array<types.CurvePointJSON
|
|
11
|
+
points: Array<types.CurvePointJSON>
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export class BorrowRateCurve {
|
|
15
|
-
readonly points: Array<types.CurvePoint
|
|
15
|
+
readonly points: Array<types.CurvePoint>
|
|
16
16
|
|
|
17
17
|
constructor(fields: BorrowRateCurveFields) {
|
|
18
|
-
this.points = fields.points.map((item) => new types.CurvePoint({ ...item }))
|
|
18
|
+
this.points = fields.points.map((item) => new types.CurvePoint({ ...item }))
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
static layout(property?: string) {
|
|
22
|
-
return borsh.struct(
|
|
22
|
+
return borsh.struct(
|
|
23
|
+
[borsh.array(types.CurvePoint.layout(), 11, "points")],
|
|
24
|
+
property
|
|
25
|
+
)
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
29
|
static fromDecoded(obj: any) {
|
|
27
30
|
return new BorrowRateCurve({
|
|
28
|
-
points: obj.points.map(
|
|
29
|
-
|
|
31
|
+
points: obj.points.map(
|
|
32
|
+
(
|
|
33
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
|
34
|
+
) => types.CurvePoint.fromDecoded(item)
|
|
30
35
|
),
|
|
31
|
-
})
|
|
36
|
+
})
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
static toEncodable(fields: BorrowRateCurveFields) {
|
|
35
40
|
return {
|
|
36
41
|
points: fields.points.map((item) => types.CurvePoint.toEncodable(item)),
|
|
37
|
-
}
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
toJSON(): BorrowRateCurveJSON {
|
|
41
46
|
return {
|
|
42
47
|
points: this.points.map((item) => item.toJSON()),
|
|
43
|
-
}
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
static fromJSON(obj: BorrowRateCurveJSON): BorrowRateCurve {
|
|
47
52
|
return new BorrowRateCurve({
|
|
48
53
|
points: obj.points.map((item) => types.CurvePoint.fromJSON(item)),
|
|
49
|
-
})
|
|
54
|
+
})
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
toEncodable() {
|
|
53
|
-
return BorrowRateCurve.toEncodable(this)
|
|
58
|
+
return BorrowRateCurve.toEncodable(this)
|
|
54
59
|
}
|
|
55
60
|
}
|
|
@@ -1,29 +1,32 @@
|
|
|
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 CurvePointFields {
|
|
7
|
-
utilizationRateBps: number
|
|
8
|
-
borrowRateBps: number
|
|
7
|
+
utilizationRateBps: number
|
|
8
|
+
borrowRateBps: number
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface CurvePointJSON {
|
|
12
|
-
utilizationRateBps: number
|
|
13
|
-
borrowRateBps: number
|
|
12
|
+
utilizationRateBps: number
|
|
13
|
+
borrowRateBps: number
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export class CurvePoint {
|
|
17
|
-
readonly utilizationRateBps: number
|
|
18
|
-
readonly borrowRateBps: number
|
|
17
|
+
readonly utilizationRateBps: number
|
|
18
|
+
readonly borrowRateBps: number
|
|
19
19
|
|
|
20
20
|
constructor(fields: CurvePointFields) {
|
|
21
|
-
this.utilizationRateBps = fields.utilizationRateBps
|
|
22
|
-
this.borrowRateBps = fields.borrowRateBps
|
|
21
|
+
this.utilizationRateBps = fields.utilizationRateBps
|
|
22
|
+
this.borrowRateBps = fields.borrowRateBps
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
static layout(property?: string) {
|
|
26
|
-
return borsh.struct(
|
|
26
|
+
return borsh.struct(
|
|
27
|
+
[borsh.u32("utilizationRateBps"), borsh.u32("borrowRateBps")],
|
|
28
|
+
property
|
|
29
|
+
)
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -31,31 +34,31 @@ export class CurvePoint {
|
|
|
31
34
|
return new CurvePoint({
|
|
32
35
|
utilizationRateBps: obj.utilizationRateBps,
|
|
33
36
|
borrowRateBps: obj.borrowRateBps,
|
|
34
|
-
})
|
|
37
|
+
})
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
static toEncodable(fields: CurvePointFields) {
|
|
38
41
|
return {
|
|
39
42
|
utilizationRateBps: fields.utilizationRateBps,
|
|
40
43
|
borrowRateBps: fields.borrowRateBps,
|
|
41
|
-
}
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
toJSON(): CurvePointJSON {
|
|
45
48
|
return {
|
|
46
49
|
utilizationRateBps: this.utilizationRateBps,
|
|
47
50
|
borrowRateBps: this.borrowRateBps,
|
|
48
|
-
}
|
|
51
|
+
}
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
static fromJSON(obj: CurvePointJSON): CurvePoint {
|
|
52
55
|
return new CurvePoint({
|
|
53
56
|
utilizationRateBps: obj.utilizationRateBps,
|
|
54
57
|
borrowRateBps: obj.borrowRateBps,
|
|
55
|
-
})
|
|
58
|
+
})
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
toEncodable() {
|
|
59
|
-
return CurvePoint.toEncodable(this)
|
|
62
|
+
return CurvePoint.toEncodable(this)
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -1,50 +1,55 @@
|
|
|
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 LastUpdateFields {
|
|
7
7
|
/** Last slot when updated */
|
|
8
|
-
slot: BN
|
|
8
|
+
slot: BN
|
|
9
9
|
/** True when marked stale, false when slot updated */
|
|
10
|
-
stale: number
|
|
10
|
+
stale: number
|
|
11
11
|
/** Status of the prices used to calculate the last update */
|
|
12
|
-
priceStatus: number
|
|
13
|
-
placeholder: Array<number
|
|
12
|
+
priceStatus: number
|
|
13
|
+
placeholder: Array<number>
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface LastUpdateJSON {
|
|
17
17
|
/** Last slot when updated */
|
|
18
|
-
slot: string
|
|
18
|
+
slot: string
|
|
19
19
|
/** True when marked stale, false when slot updated */
|
|
20
|
-
stale: number
|
|
20
|
+
stale: number
|
|
21
21
|
/** Status of the prices used to calculate the last update */
|
|
22
|
-
priceStatus: number
|
|
23
|
-
placeholder: Array<number
|
|
22
|
+
priceStatus: number
|
|
23
|
+
placeholder: Array<number>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** Last update state */
|
|
27
27
|
export class LastUpdate {
|
|
28
28
|
/** Last slot when updated */
|
|
29
|
-
readonly slot: BN
|
|
29
|
+
readonly slot: BN
|
|
30
30
|
/** True when marked stale, false when slot updated */
|
|
31
|
-
readonly stale: number
|
|
31
|
+
readonly stale: number
|
|
32
32
|
/** Status of the prices used to calculate the last update */
|
|
33
|
-
readonly priceStatus: number
|
|
34
|
-
readonly placeholder: Array<number
|
|
33
|
+
readonly priceStatus: number
|
|
34
|
+
readonly placeholder: Array<number>
|
|
35
35
|
|
|
36
36
|
constructor(fields: LastUpdateFields) {
|
|
37
|
-
this.slot = fields.slot
|
|
38
|
-
this.stale = fields.stale
|
|
39
|
-
this.priceStatus = fields.priceStatus
|
|
40
|
-
this.placeholder = fields.placeholder
|
|
37
|
+
this.slot = fields.slot
|
|
38
|
+
this.stale = fields.stale
|
|
39
|
+
this.priceStatus = fields.priceStatus
|
|
40
|
+
this.placeholder = fields.placeholder
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
static layout(property?: string) {
|
|
44
44
|
return borsh.struct(
|
|
45
|
-
[
|
|
45
|
+
[
|
|
46
|
+
borsh.u64("slot"),
|
|
47
|
+
borsh.u8("stale"),
|
|
48
|
+
borsh.u8("priceStatus"),
|
|
49
|
+
borsh.array(borsh.u8(), 6, "placeholder"),
|
|
50
|
+
],
|
|
46
51
|
property
|
|
47
|
-
)
|
|
52
|
+
)
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -54,7 +59,7 @@ export class LastUpdate {
|
|
|
54
59
|
stale: obj.stale,
|
|
55
60
|
priceStatus: obj.priceStatus,
|
|
56
61
|
placeholder: obj.placeholder,
|
|
57
|
-
})
|
|
62
|
+
})
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
static toEncodable(fields: LastUpdateFields) {
|
|
@@ -63,7 +68,7 @@ export class LastUpdate {
|
|
|
63
68
|
stale: fields.stale,
|
|
64
69
|
priceStatus: fields.priceStatus,
|
|
65
70
|
placeholder: fields.placeholder,
|
|
66
|
-
}
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
toJSON(): LastUpdateJSON {
|
|
@@ -72,7 +77,7 @@ export class LastUpdate {
|
|
|
72
77
|
stale: this.stale,
|
|
73
78
|
priceStatus: this.priceStatus,
|
|
74
79
|
placeholder: this.placeholder,
|
|
75
|
-
}
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
static fromJSON(obj: LastUpdateJSON): LastUpdate {
|
|
@@ -81,10 +86,10 @@ export class LastUpdate {
|
|
|
81
86
|
stale: obj.stale,
|
|
82
87
|
priceStatus: obj.priceStatus,
|
|
83
88
|
placeholder: obj.placeholder,
|
|
84
|
-
})
|
|
89
|
+
})
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
toEncodable() {
|
|
88
|
-
return LastUpdate.toEncodable(this)
|
|
93
|
+
return LastUpdate.toEncodable(this)
|
|
89
94
|
}
|
|
90
95
|
}
|
|
@@ -1,42 +1,45 @@
|
|
|
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 PriceHeuristicFields {
|
|
7
7
|
/** Lower value of acceptable price */
|
|
8
|
-
lower: BN
|
|
8
|
+
lower: BN
|
|
9
9
|
/** Upper value of acceptable price */
|
|
10
|
-
upper: BN
|
|
10
|
+
upper: BN
|
|
11
11
|
/** Number of decimals of the previously defined values */
|
|
12
|
-
exp: BN
|
|
12
|
+
exp: BN
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface PriceHeuristicJSON {
|
|
16
16
|
/** Lower value of acceptable price */
|
|
17
|
-
lower: string
|
|
17
|
+
lower: string
|
|
18
18
|
/** Upper value of acceptable price */
|
|
19
|
-
upper: string
|
|
19
|
+
upper: string
|
|
20
20
|
/** Number of decimals of the previously defined values */
|
|
21
|
-
exp: string
|
|
21
|
+
exp: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export class PriceHeuristic {
|
|
25
25
|
/** Lower value of acceptable price */
|
|
26
|
-
readonly lower: BN
|
|
26
|
+
readonly lower: BN
|
|
27
27
|
/** Upper value of acceptable price */
|
|
28
|
-
readonly upper: BN
|
|
28
|
+
readonly upper: BN
|
|
29
29
|
/** Number of decimals of the previously defined values */
|
|
30
|
-
readonly exp: BN
|
|
30
|
+
readonly exp: BN
|
|
31
31
|
|
|
32
32
|
constructor(fields: PriceHeuristicFields) {
|
|
33
|
-
this.lower = fields.lower
|
|
34
|
-
this.upper = fields.upper
|
|
35
|
-
this.exp = fields.exp
|
|
33
|
+
this.lower = fields.lower
|
|
34
|
+
this.upper = fields.upper
|
|
35
|
+
this.exp = fields.exp
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
static layout(property?: string) {
|
|
39
|
-
return borsh.struct(
|
|
39
|
+
return borsh.struct(
|
|
40
|
+
[borsh.u64("lower"), borsh.u64("upper"), borsh.u64("exp")],
|
|
41
|
+
property
|
|
42
|
+
)
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -45,7 +48,7 @@ export class PriceHeuristic {
|
|
|
45
48
|
lower: obj.lower,
|
|
46
49
|
upper: obj.upper,
|
|
47
50
|
exp: obj.exp,
|
|
48
|
-
})
|
|
51
|
+
})
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
static toEncodable(fields: PriceHeuristicFields) {
|
|
@@ -53,7 +56,7 @@ export class PriceHeuristic {
|
|
|
53
56
|
lower: fields.lower,
|
|
54
57
|
upper: fields.upper,
|
|
55
58
|
exp: fields.exp,
|
|
56
|
-
}
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
toJSON(): PriceHeuristicJSON {
|
|
@@ -61,7 +64,7 @@ export class PriceHeuristic {
|
|
|
61
64
|
lower: this.lower.toString(),
|
|
62
65
|
upper: this.upper.toString(),
|
|
63
66
|
exp: this.exp.toString(),
|
|
64
|
-
}
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
static fromJSON(obj: PriceHeuristicJSON): PriceHeuristic {
|
|
@@ -69,10 +72,10 @@ export class PriceHeuristic {
|
|
|
69
72
|
lower: new BN(obj.lower),
|
|
70
73
|
upper: new BN(obj.upper),
|
|
71
74
|
exp: new BN(obj.exp),
|
|
72
|
-
})
|
|
75
|
+
})
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
toEncodable() {
|
|
76
|
-
return PriceHeuristic.toEncodable(this)
|
|
79
|
+
return PriceHeuristic.toEncodable(this)
|
|
77
80
|
}
|
|
78
81
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
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 PythConfigurationFields {
|
|
7
7
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
8
|
-
price: PublicKey
|
|
8
|
+
price: PublicKey
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface PythConfigurationJSON {
|
|
12
12
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
13
|
-
price: string
|
|
13
|
+
price: string
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export class PythConfiguration {
|
|
17
17
|
/** Pubkey of the base price feed (disabled if `null` or `default`) */
|
|
18
|
-
readonly price: PublicKey
|
|
18
|
+
readonly price: PublicKey
|
|
19
19
|
|
|
20
20
|
constructor(fields: PythConfigurationFields) {
|
|
21
|
-
this.price = fields.price
|
|
21
|
+
this.price = fields.price
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
static layout(property?: string) {
|
|
25
|
-
return borsh.struct([borsh.publicKey(
|
|
25
|
+
return borsh.struct([borsh.publicKey("price")], property)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
static fromDecoded(obj: any) {
|
|
30
30
|
return new PythConfiguration({
|
|
31
31
|
price: obj.price,
|
|
32
|
-
})
|
|
32
|
+
})
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
static toEncodable(fields: PythConfigurationFields) {
|
|
36
36
|
return {
|
|
37
37
|
price: fields.price,
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
toJSON(): PythConfigurationJSON {
|
|
42
42
|
return {
|
|
43
43
|
price: this.price.toString(),
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
static fromJSON(obj: PythConfigurationJSON): PythConfiguration {
|
|
48
48
|
return new PythConfiguration({
|
|
49
49
|
price: new PublicKey(obj.price),
|
|
50
|
-
})
|
|
50
|
+
})
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
toEncodable() {
|
|
54
|
-
return PythConfiguration.toEncodable(this)
|
|
54
|
+
return PythConfiguration.toEncodable(this)
|
|
55
55
|
}
|
|
56
56
|
}
|