@0dotxyz/p0-ts-sdk 1.0.0 → 1.0.1
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/README.md +7 -4
- package/dist/{dto-farm.types-D9Q3c7Q7.d.cts → dto-farm.types-DvTDZThL.d.cts} +101 -101
- package/dist/{dto-farm.types-D9Q3c7Q7.d.ts → dto-farm.types-DvTDZThL.d.ts} +101 -101
- package/dist/index.cjs +140 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +139 -141
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +115 -117
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +2 -2
- package/dist/vendor.d.ts +2 -2
- package/dist/vendor.js +111 -113
- package/dist/vendor.js.map +1 -1
- package/package.json +5 -5
package/dist/vendor.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
2
|
import { PublicKey, TransactionInstruction, Connection, Transaction, Commitment, AccountInfo, AccountMeta, Signer } from '@solana/web3.js';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
-
import { R as ReserveRaw, O as ObligationRaw, c as ObligationJSON, b as ReserveJSON, C as CurvePointFields, e as RewardInfoFields, a as FarmStateRaw, d as FarmStateJSON } from './dto-farm.types-
|
|
5
|
-
export { U as BigFractionBytesFields, X as BigFractionBytesJSON, B as BorrowRateCurveFields, x as BorrowRateCurveJSON, h as CrossbarSimulatePayload, f as CurrentResult, y as CurvePointJSON, F as FeedResponse, Q as LastUpdateFields, V as LastUpdateJSON, L as ObligationCollateralFields, J as ObligationCollateralJSON, M as ObligationLiquidityFields, I as ObligationLiquidityJSON, N as ObligationOrderFields, K as ObligationOrderJSON, g as OracleSubmission, o as PriceHeuristicFields, A as PriceHeuristicJSON, P as PullFeedAccountData, r as PythConfigurationFields, G as PythConfigurationJSON, l as ReserveCollateralFields, u as ReserveCollateralJSON, m as ReserveConfigFields, v as ReserveConfigJSON, n as ReserveFeesFields, w as ReserveFeesJSON, k as ReserveLiquidityFields, t as ReserveLiquidityJSON, Y as RewardPerTimeUnitPointFields, $ as RewardPerTimeUnitPointJSON, Z as RewardScheduleCurveFields, _ as RewardScheduleCurveJSON, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, p as ScopeConfigurationFields, D as ScopeConfigurationJSON, q as SwitchboardConfigurationFields, E as SwitchboardConfigurationJSON, T as TokenInfoFields, z as TokenInfoJSON, W as WithdrawalCapsFields, H as WithdrawalCapsJSON, j as decodeSwitchboardPullFeedData, i as getSwitchboardProgram, s as switchboardAccountCoder } from './dto-farm.types-
|
|
4
|
+
import { R as ReserveRaw, O as ObligationRaw, c as ObligationJSON, b as ReserveJSON, C as CurvePointFields, e as RewardInfoFields, a as FarmStateRaw, d as FarmStateJSON } from './dto-farm.types-DvTDZThL.cjs';
|
|
5
|
+
export { U as BigFractionBytesFields, X as BigFractionBytesJSON, B as BorrowRateCurveFields, x as BorrowRateCurveJSON, h as CrossbarSimulatePayload, f as CurrentResult, y as CurvePointJSON, F as FeedResponse, Q as LastUpdateFields, V as LastUpdateJSON, L as ObligationCollateralFields, J as ObligationCollateralJSON, M as ObligationLiquidityFields, I as ObligationLiquidityJSON, N as ObligationOrderFields, K as ObligationOrderJSON, g as OracleSubmission, o as PriceHeuristicFields, A as PriceHeuristicJSON, P as PullFeedAccountData, r as PythConfigurationFields, G as PythConfigurationJSON, l as ReserveCollateralFields, u as ReserveCollateralJSON, m as ReserveConfigFields, v as ReserveConfigJSON, n as ReserveFeesFields, w as ReserveFeesJSON, k as ReserveLiquidityFields, t as ReserveLiquidityJSON, Y as RewardPerTimeUnitPointFields, $ as RewardPerTimeUnitPointJSON, Z as RewardScheduleCurveFields, _ as RewardScheduleCurveJSON, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, p as ScopeConfigurationFields, D as ScopeConfigurationJSON, q as SwitchboardConfigurationFields, E as SwitchboardConfigurationJSON, T as TokenInfoFields, z as TokenInfoJSON, W as WithdrawalCapsFields, H as WithdrawalCapsJSON, j as decodeSwitchboardPullFeedData, i as getSwitchboardProgram, s as switchboardAccountCoder } from './dto-farm.types-DvTDZThL.cjs';
|
|
6
6
|
import { Program, BorshCoder, Address } from '@coral-xyz/anchor';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as _solana_buffer_layout from '@solana/buffer-layout';
|
package/dist/vendor.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
2
|
import { PublicKey, TransactionInstruction, Connection, Transaction, Commitment, AccountInfo, AccountMeta, Signer } from '@solana/web3.js';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
-
import { R as ReserveRaw, O as ObligationRaw, c as ObligationJSON, b as ReserveJSON, C as CurvePointFields, e as RewardInfoFields, a as FarmStateRaw, d as FarmStateJSON } from './dto-farm.types-
|
|
5
|
-
export { U as BigFractionBytesFields, X as BigFractionBytesJSON, B as BorrowRateCurveFields, x as BorrowRateCurveJSON, h as CrossbarSimulatePayload, f as CurrentResult, y as CurvePointJSON, F as FeedResponse, Q as LastUpdateFields, V as LastUpdateJSON, L as ObligationCollateralFields, J as ObligationCollateralJSON, M as ObligationLiquidityFields, I as ObligationLiquidityJSON, N as ObligationOrderFields, K as ObligationOrderJSON, g as OracleSubmission, o as PriceHeuristicFields, A as PriceHeuristicJSON, P as PullFeedAccountData, r as PythConfigurationFields, G as PythConfigurationJSON, l as ReserveCollateralFields, u as ReserveCollateralJSON, m as ReserveConfigFields, v as ReserveConfigJSON, n as ReserveFeesFields, w as ReserveFeesJSON, k as ReserveLiquidityFields, t as ReserveLiquidityJSON, Y as RewardPerTimeUnitPointFields, $ as RewardPerTimeUnitPointJSON, Z as RewardScheduleCurveFields, _ as RewardScheduleCurveJSON, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, p as ScopeConfigurationFields, D as ScopeConfigurationJSON, q as SwitchboardConfigurationFields, E as SwitchboardConfigurationJSON, T as TokenInfoFields, z as TokenInfoJSON, W as WithdrawalCapsFields, H as WithdrawalCapsJSON, j as decodeSwitchboardPullFeedData, i as getSwitchboardProgram, s as switchboardAccountCoder } from './dto-farm.types-
|
|
4
|
+
import { R as ReserveRaw, O as ObligationRaw, c as ObligationJSON, b as ReserveJSON, C as CurvePointFields, e as RewardInfoFields, a as FarmStateRaw, d as FarmStateJSON } from './dto-farm.types-DvTDZThL.js';
|
|
5
|
+
export { U as BigFractionBytesFields, X as BigFractionBytesJSON, B as BorrowRateCurveFields, x as BorrowRateCurveJSON, h as CrossbarSimulatePayload, f as CurrentResult, y as CurvePointJSON, F as FeedResponse, Q as LastUpdateFields, V as LastUpdateJSON, L as ObligationCollateralFields, J as ObligationCollateralJSON, M as ObligationLiquidityFields, I as ObligationLiquidityJSON, N as ObligationOrderFields, K as ObligationOrderJSON, g as OracleSubmission, o as PriceHeuristicFields, A as PriceHeuristicJSON, P as PullFeedAccountData, r as PythConfigurationFields, G as PythConfigurationJSON, l as ReserveCollateralFields, u as ReserveCollateralJSON, m as ReserveConfigFields, v as ReserveConfigJSON, n as ReserveFeesFields, w as ReserveFeesJSON, k as ReserveLiquidityFields, t as ReserveLiquidityJSON, Y as RewardPerTimeUnitPointFields, $ as RewardPerTimeUnitPointJSON, Z as RewardScheduleCurveFields, _ as RewardScheduleCurveJSON, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, p as ScopeConfigurationFields, D as ScopeConfigurationJSON, q as SwitchboardConfigurationFields, E as SwitchboardConfigurationJSON, T as TokenInfoFields, z as TokenInfoJSON, W as WithdrawalCapsFields, H as WithdrawalCapsJSON, j as decodeSwitchboardPullFeedData, i as getSwitchboardProgram, s as switchboardAccountCoder } from './dto-farm.types-DvTDZThL.js';
|
|
6
6
|
import { Program, BorshCoder, Address } from '@coral-xyz/anchor';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as _solana_buffer_layout from '@solana/buffer-layout';
|
package/dist/vendor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicKey, TransactionInstruction, SYSVAR_RENT_PUBKEY, SystemProgram, STAKE_CONFIG_ID, Transaction, LAMPORTS_PER_SOL, StakeProgram, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
|
|
2
2
|
import 'bignumber.js';
|
|
3
3
|
import { deserialize } from 'borsh';
|
|
4
|
-
import
|
|
4
|
+
import BN2, { BN } from 'bn.js';
|
|
5
5
|
import { struct, u8, u32 } from '@solana/buffer-layout';
|
|
6
6
|
import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
|
|
7
7
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
@@ -3820,9 +3820,7 @@ var idl_default = {
|
|
|
3820
3820
|
|
|
3821
3821
|
// src/vendor/switchboard_pull/index.ts
|
|
3822
3822
|
var SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
|
|
3823
|
-
var switchboardAccountCoder = new BorshCoder(
|
|
3824
|
-
idl_default
|
|
3825
|
-
);
|
|
3823
|
+
var switchboardAccountCoder = new BorshCoder(idl_default);
|
|
3826
3824
|
function getSwitchboardProgram(provider) {
|
|
3827
3825
|
return new Program(idl_default, provider);
|
|
3828
3826
|
}
|
|
@@ -12515,9 +12513,9 @@ function decodeKlendObligationData(data) {
|
|
|
12515
12513
|
}
|
|
12516
12514
|
function dtoToObligationRaw(obligationDto) {
|
|
12517
12515
|
return {
|
|
12518
|
-
tag: new
|
|
12516
|
+
tag: new BN2(obligationDto.tag),
|
|
12519
12517
|
lastUpdate: {
|
|
12520
|
-
slot: new
|
|
12518
|
+
slot: new BN2(obligationDto.lastUpdate.slot),
|
|
12521
12519
|
stale: obligationDto.lastUpdate.stale,
|
|
12522
12520
|
priceStatus: obligationDto.lastUpdate.priceStatus,
|
|
12523
12521
|
placeholder: obligationDto.lastUpdate.placeholder
|
|
@@ -12527,21 +12525,21 @@ function dtoToObligationRaw(obligationDto) {
|
|
|
12527
12525
|
deposits: obligationDto.deposits.map(
|
|
12528
12526
|
(item) => dtoToObligationCollateralFields(item)
|
|
12529
12527
|
),
|
|
12530
|
-
lowestReserveDepositLiquidationLtv: new
|
|
12528
|
+
lowestReserveDepositLiquidationLtv: new BN2(
|
|
12531
12529
|
obligationDto.lowestReserveDepositLiquidationLtv
|
|
12532
12530
|
),
|
|
12533
|
-
depositedValueSf: new
|
|
12531
|
+
depositedValueSf: new BN2(obligationDto.depositedValueSf),
|
|
12534
12532
|
borrows: obligationDto.borrows.map(
|
|
12535
12533
|
(item) => dtoToObligationLiquidityFields(item)
|
|
12536
12534
|
),
|
|
12537
|
-
borrowFactorAdjustedDebtValueSf: new
|
|
12535
|
+
borrowFactorAdjustedDebtValueSf: new BN2(
|
|
12538
12536
|
obligationDto.borrowFactorAdjustedDebtValueSf
|
|
12539
12537
|
),
|
|
12540
|
-
borrowedAssetsMarketValueSf: new
|
|
12538
|
+
borrowedAssetsMarketValueSf: new BN2(
|
|
12541
12539
|
obligationDto.borrowedAssetsMarketValueSf
|
|
12542
12540
|
),
|
|
12543
|
-
allowedBorrowValueSf: new
|
|
12544
|
-
unhealthyBorrowValueSf: new
|
|
12541
|
+
allowedBorrowValueSf: new BN2(obligationDto.allowedBorrowValueSf),
|
|
12542
|
+
unhealthyBorrowValueSf: new BN2(obligationDto.unhealthyBorrowValueSf),
|
|
12545
12543
|
depositsAssetTiers: obligationDto.depositsAssetTiers,
|
|
12546
12544
|
borrowsAssetTiers: obligationDto.borrowsAssetTiers,
|
|
12547
12545
|
elevationGroup: obligationDto.elevationGroup,
|
|
@@ -12553,21 +12551,21 @@ function dtoToObligationRaw(obligationDto) {
|
|
|
12553
12551
|
lowestReserveDepositMaxLtvPct: obligationDto.lowestReserveDepositMaxLtvPct,
|
|
12554
12552
|
numOfObsoleteBorrowReserves: obligationDto.numOfObsoleteBorrowReserves,
|
|
12555
12553
|
reserved: obligationDto.reserved,
|
|
12556
|
-
highestBorrowFactorPct: new
|
|
12557
|
-
autodeleverageMarginCallStartedTimestamp: new
|
|
12554
|
+
highestBorrowFactorPct: new BN2(obligationDto.highestBorrowFactorPct),
|
|
12555
|
+
autodeleverageMarginCallStartedTimestamp: new BN2(
|
|
12558
12556
|
obligationDto.autodeleverageMarginCallStartedTimestamp
|
|
12559
12557
|
),
|
|
12560
12558
|
orders: obligationDto.orders.map(
|
|
12561
12559
|
(item) => dtoToObligationOrderFields(item)
|
|
12562
12560
|
),
|
|
12563
|
-
padding3: obligationDto.padding3.map((item) => new
|
|
12561
|
+
padding3: obligationDto.padding3.map((item) => new BN2(item))
|
|
12564
12562
|
};
|
|
12565
12563
|
}
|
|
12566
12564
|
function dtoToReserveRaw(reserveDto) {
|
|
12567
12565
|
return {
|
|
12568
|
-
version: new
|
|
12566
|
+
version: new BN2(reserveDto.version),
|
|
12569
12567
|
lastUpdate: {
|
|
12570
|
-
slot: new
|
|
12568
|
+
slot: new BN2(reserveDto.lastUpdate.slot),
|
|
12571
12569
|
stale: reserveDto.lastUpdate.stale,
|
|
12572
12570
|
priceStatus: reserveDto.lastUpdate.priceStatus,
|
|
12573
12571
|
placeholder: reserveDto.lastUpdate.placeholder
|
|
@@ -12577,27 +12575,27 @@ function dtoToReserveRaw(reserveDto) {
|
|
|
12577
12575
|
farmDebt: new PublicKey(reserveDto.farmDebt),
|
|
12578
12576
|
liquidity: dtoToReserveLiquidityFields(reserveDto.liquidity),
|
|
12579
12577
|
reserveLiquidityPadding: reserveDto.reserveLiquidityPadding.map(
|
|
12580
|
-
(item) => new
|
|
12578
|
+
(item) => new BN2(item)
|
|
12581
12579
|
),
|
|
12582
12580
|
collateral: {
|
|
12583
12581
|
mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
|
|
12584
|
-
mintTotalSupply: new
|
|
12582
|
+
mintTotalSupply: new BN2(reserveDto.collateral.mintTotalSupply),
|
|
12585
12583
|
supplyVault: new PublicKey(reserveDto.collateral.supplyVault),
|
|
12586
|
-
padding1: reserveDto.collateral.padding1.map((item) => new
|
|
12587
|
-
padding2: reserveDto.collateral.padding2.map((item) => new
|
|
12584
|
+
padding1: reserveDto.collateral.padding1.map((item) => new BN2(item)),
|
|
12585
|
+
padding2: reserveDto.collateral.padding2.map((item) => new BN2(item))
|
|
12588
12586
|
},
|
|
12589
12587
|
reserveCollateralPadding: reserveDto.reserveCollateralPadding.map(
|
|
12590
|
-
(item) => new
|
|
12588
|
+
(item) => new BN2(item)
|
|
12591
12589
|
),
|
|
12592
12590
|
config: dtoToReserveConfigFields(reserveDto.config),
|
|
12593
|
-
configPadding: reserveDto.configPadding.map((item) => new
|
|
12594
|
-
borrowedAmountOutsideElevationGroup: new
|
|
12591
|
+
configPadding: reserveDto.configPadding.map((item) => new BN2(item)),
|
|
12592
|
+
borrowedAmountOutsideElevationGroup: new BN2(
|
|
12595
12593
|
reserveDto.borrowedAmountOutsideElevationGroup
|
|
12596
12594
|
),
|
|
12597
12595
|
borrowedAmountsAgainstThisReserveInElevationGroups: reserveDto.borrowedAmountsAgainstThisReserveInElevationGroups.map(
|
|
12598
|
-
(item) => new
|
|
12596
|
+
(item) => new BN2(item)
|
|
12599
12597
|
),
|
|
12600
|
-
padding: reserveDto.padding.map((item) => new
|
|
12598
|
+
padding: reserveDto.padding.map((item) => new BN2(item))
|
|
12601
12599
|
};
|
|
12602
12600
|
}
|
|
12603
12601
|
function dtoToReserveLiquidityFields(reserveDto) {
|
|
@@ -12605,30 +12603,30 @@ function dtoToReserveLiquidityFields(reserveDto) {
|
|
|
12605
12603
|
mintPubkey: new PublicKey(reserveDto.mintPubkey),
|
|
12606
12604
|
supplyVault: new PublicKey(reserveDto.supplyVault),
|
|
12607
12605
|
feeVault: new PublicKey(reserveDto.feeVault),
|
|
12608
|
-
availableAmount: new
|
|
12609
|
-
borrowedAmountSf: new
|
|
12610
|
-
marketPriceSf: new
|
|
12611
|
-
marketPriceLastUpdatedTs: new
|
|
12612
|
-
mintDecimals: new
|
|
12613
|
-
depositLimitCrossedTimestamp: new
|
|
12606
|
+
availableAmount: new BN2(reserveDto.availableAmount),
|
|
12607
|
+
borrowedAmountSf: new BN2(reserveDto.borrowedAmountSf),
|
|
12608
|
+
marketPriceSf: new BN2(reserveDto.marketPriceSf),
|
|
12609
|
+
marketPriceLastUpdatedTs: new BN2(reserveDto.marketPriceLastUpdatedTs),
|
|
12610
|
+
mintDecimals: new BN2(reserveDto.mintDecimals),
|
|
12611
|
+
depositLimitCrossedTimestamp: new BN2(
|
|
12614
12612
|
reserveDto.depositLimitCrossedTimestamp
|
|
12615
12613
|
),
|
|
12616
|
-
borrowLimitCrossedTimestamp: new
|
|
12614
|
+
borrowLimitCrossedTimestamp: new BN2(reserveDto.borrowLimitCrossedTimestamp),
|
|
12617
12615
|
cumulativeBorrowRateBsf: {
|
|
12618
12616
|
value: reserveDto.cumulativeBorrowRateBsf.value.map(
|
|
12619
|
-
(item) => new
|
|
12617
|
+
(item) => new BN2(item)
|
|
12620
12618
|
),
|
|
12621
12619
|
padding: reserveDto.cumulativeBorrowRateBsf.padding.map(
|
|
12622
|
-
(item) => new
|
|
12620
|
+
(item) => new BN2(item)
|
|
12623
12621
|
)
|
|
12624
12622
|
},
|
|
12625
|
-
accumulatedProtocolFeesSf: new
|
|
12626
|
-
accumulatedReferrerFeesSf: new
|
|
12627
|
-
pendingReferrerFeesSf: new
|
|
12628
|
-
absoluteReferralRateSf: new
|
|
12623
|
+
accumulatedProtocolFeesSf: new BN2(reserveDto.accumulatedProtocolFeesSf),
|
|
12624
|
+
accumulatedReferrerFeesSf: new BN2(reserveDto.accumulatedReferrerFeesSf),
|
|
12625
|
+
pendingReferrerFeesSf: new BN2(reserveDto.pendingReferrerFeesSf),
|
|
12626
|
+
absoluteReferralRateSf: new BN2(reserveDto.absoluteReferralRateSf),
|
|
12629
12627
|
tokenProgram: new PublicKey(reserveDto.tokenProgram),
|
|
12630
|
-
padding2: reserveDto.padding2.map((item) => new
|
|
12631
|
-
padding3: reserveDto.padding3.map((item) => new
|
|
12628
|
+
padding2: reserveDto.padding2.map((item) => new BN2(item)),
|
|
12629
|
+
padding3: reserveDto.padding3.map((item) => new BN2(item))
|
|
12632
12630
|
};
|
|
12633
12631
|
}
|
|
12634
12632
|
function dtoToReserveConfigFields(reserveDto) {
|
|
@@ -12645,15 +12643,15 @@ function dtoToReserveConfigFields(reserveDto) {
|
|
|
12645
12643
|
minLiquidationBonusBps: reserveDto.minLiquidationBonusBps,
|
|
12646
12644
|
maxLiquidationBonusBps: reserveDto.maxLiquidationBonusBps,
|
|
12647
12645
|
badDebtLiquidationBonusBps: reserveDto.badDebtLiquidationBonusBps,
|
|
12648
|
-
deleveragingMarginCallPeriodSecs: new
|
|
12646
|
+
deleveragingMarginCallPeriodSecs: new BN2(
|
|
12649
12647
|
reserveDto.deleveragingMarginCallPeriodSecs
|
|
12650
12648
|
),
|
|
12651
|
-
deleveragingThresholdDecreaseBpsPerDay: new
|
|
12649
|
+
deleveragingThresholdDecreaseBpsPerDay: new BN2(
|
|
12652
12650
|
reserveDto.deleveragingThresholdDecreaseBpsPerDay
|
|
12653
12651
|
),
|
|
12654
12652
|
fees: {
|
|
12655
|
-
borrowFeeSf: new
|
|
12656
|
-
flashLoanFeeSf: new
|
|
12653
|
+
borrowFeeSf: new BN2(reserveDto.fees.borrowFeeSf),
|
|
12654
|
+
flashLoanFeeSf: new BN2(reserveDto.fees.flashLoanFeeSf),
|
|
12657
12655
|
padding: reserveDto.fees.padding
|
|
12658
12656
|
},
|
|
12659
12657
|
borrowRateCurve: {
|
|
@@ -12662,9 +12660,9 @@ function dtoToReserveConfigFields(reserveDto) {
|
|
|
12662
12660
|
borrowRateBps: item.borrowRateBps
|
|
12663
12661
|
}))
|
|
12664
12662
|
},
|
|
12665
|
-
borrowFactorPct: new
|
|
12666
|
-
depositLimit: new
|
|
12667
|
-
borrowLimit: new
|
|
12663
|
+
borrowFactorPct: new BN2(reserveDto.borrowFactorPct),
|
|
12664
|
+
depositLimit: new BN2(reserveDto.depositLimit),
|
|
12665
|
+
borrowLimit: new BN2(reserveDto.borrowLimit),
|
|
12668
12666
|
tokenInfo: dtoToTokenInfoFields(reserveDto.tokenInfo),
|
|
12669
12667
|
depositWithdrawalCap: dtoToWithdrawalCapsFields(
|
|
12670
12668
|
reserveDto.depositWithdrawalCap
|
|
@@ -12675,13 +12673,13 @@ function dtoToReserveConfigFields(reserveDto) {
|
|
|
12675
12673
|
utilizationLimitBlockBorrowingAbovePct: reserveDto.utilizationLimitBlockBorrowingAbovePct,
|
|
12676
12674
|
autodeleverageEnabled: reserveDto.autodeleverageEnabled,
|
|
12677
12675
|
reserved1: reserveDto.reserved1,
|
|
12678
|
-
borrowLimitOutsideElevationGroup: new
|
|
12676
|
+
borrowLimitOutsideElevationGroup: new BN2(
|
|
12679
12677
|
reserveDto.borrowLimitOutsideElevationGroup
|
|
12680
12678
|
),
|
|
12681
12679
|
borrowLimitAgainstThisCollateralInElevationGroup: reserveDto.borrowLimitAgainstThisCollateralInElevationGroup.map(
|
|
12682
|
-
(item) => new
|
|
12680
|
+
(item) => new BN2(item)
|
|
12683
12681
|
),
|
|
12684
|
-
deleveragingBonusIncreaseBpsPerDay: new
|
|
12682
|
+
deleveragingBonusIncreaseBpsPerDay: new BN2(
|
|
12685
12683
|
reserveDto.deleveragingBonusIncreaseBpsPerDay
|
|
12686
12684
|
)
|
|
12687
12685
|
};
|
|
@@ -12690,13 +12688,13 @@ function dtoToTokenInfoFields(tokenInfoDto) {
|
|
|
12690
12688
|
return {
|
|
12691
12689
|
name: tokenInfoDto.name,
|
|
12692
12690
|
heuristic: {
|
|
12693
|
-
lower: new
|
|
12694
|
-
upper: new
|
|
12695
|
-
exp: new
|
|
12691
|
+
lower: new BN2(tokenInfoDto.heuristic.lower),
|
|
12692
|
+
upper: new BN2(tokenInfoDto.heuristic.upper),
|
|
12693
|
+
exp: new BN2(tokenInfoDto.heuristic.exp)
|
|
12696
12694
|
},
|
|
12697
|
-
maxTwapDivergenceBps: new
|
|
12698
|
-
maxAgePriceSeconds: new
|
|
12699
|
-
maxAgeTwapSeconds: new
|
|
12695
|
+
maxTwapDivergenceBps: new BN2(tokenInfoDto.maxTwapDivergenceBps),
|
|
12696
|
+
maxAgePriceSeconds: new BN2(tokenInfoDto.maxAgePriceSeconds),
|
|
12697
|
+
maxAgeTwapSeconds: new BN2(tokenInfoDto.maxAgeTwapSeconds),
|
|
12700
12698
|
scopeConfiguration: {
|
|
12701
12699
|
priceFeed: new PublicKey(tokenInfoDto.scopeConfiguration.priceFeed),
|
|
12702
12700
|
priceChain: tokenInfoDto.scopeConfiguration.priceChain,
|
|
@@ -12715,17 +12713,17 @@ function dtoToTokenInfoFields(tokenInfoDto) {
|
|
|
12715
12713
|
},
|
|
12716
12714
|
blockPriceUsage: tokenInfoDto.blockPriceUsage,
|
|
12717
12715
|
reserved: tokenInfoDto.reserved,
|
|
12718
|
-
padding: tokenInfoDto.padding.map((item) => new
|
|
12716
|
+
padding: tokenInfoDto.padding.map((item) => new BN2(item))
|
|
12719
12717
|
};
|
|
12720
12718
|
}
|
|
12721
12719
|
function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
|
|
12722
12720
|
return {
|
|
12723
|
-
configCapacity: new
|
|
12724
|
-
currentTotal: new
|
|
12725
|
-
lastIntervalStartTimestamp: new
|
|
12721
|
+
configCapacity: new BN2(withdrawalCapsDto.configCapacity),
|
|
12722
|
+
currentTotal: new BN2(withdrawalCapsDto.currentTotal),
|
|
12723
|
+
lastIntervalStartTimestamp: new BN2(
|
|
12726
12724
|
withdrawalCapsDto.lastIntervalStartTimestamp
|
|
12727
12725
|
),
|
|
12728
|
-
configIntervalLengthSeconds: new
|
|
12726
|
+
configIntervalLengthSeconds: new BN2(
|
|
12729
12727
|
withdrawalCapsDto.configIntervalLengthSeconds
|
|
12730
12728
|
)
|
|
12731
12729
|
};
|
|
@@ -12733,12 +12731,12 @@ function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
|
|
|
12733
12731
|
function dtoToObligationCollateralFields(obligationCollateralDto) {
|
|
12734
12732
|
return {
|
|
12735
12733
|
depositReserve: new PublicKey(obligationCollateralDto.depositReserve),
|
|
12736
|
-
depositedAmount: new
|
|
12737
|
-
marketValueSf: new
|
|
12738
|
-
borrowedAmountAgainstThisCollateralInElevationGroup: new
|
|
12734
|
+
depositedAmount: new BN2(obligationCollateralDto.depositedAmount),
|
|
12735
|
+
marketValueSf: new BN2(obligationCollateralDto.marketValueSf),
|
|
12736
|
+
borrowedAmountAgainstThisCollateralInElevationGroup: new BN2(
|
|
12739
12737
|
obligationCollateralDto.borrowedAmountAgainstThisCollateralInElevationGroup
|
|
12740
12738
|
),
|
|
12741
|
-
padding: obligationCollateralDto.padding.map((item) => new
|
|
12739
|
+
padding: obligationCollateralDto.padding.map((item) => new BN2(item))
|
|
12742
12740
|
};
|
|
12743
12741
|
}
|
|
12744
12742
|
function dtoToObligationLiquidityFields(obligationLiquidityDto) {
|
|
@@ -12746,34 +12744,34 @@ function dtoToObligationLiquidityFields(obligationLiquidityDto) {
|
|
|
12746
12744
|
borrowReserve: new PublicKey(obligationLiquidityDto.borrowReserve),
|
|
12747
12745
|
cumulativeBorrowRateBsf: {
|
|
12748
12746
|
value: obligationLiquidityDto.cumulativeBorrowRateBsf.value.map(
|
|
12749
|
-
(item) => new
|
|
12747
|
+
(item) => new BN2(item)
|
|
12750
12748
|
),
|
|
12751
12749
|
padding: obligationLiquidityDto.cumulativeBorrowRateBsf.padding.map(
|
|
12752
|
-
(item) => new
|
|
12750
|
+
(item) => new BN2(item)
|
|
12753
12751
|
)
|
|
12754
12752
|
},
|
|
12755
|
-
padding: new
|
|
12756
|
-
borrowedAmountSf: new
|
|
12757
|
-
marketValueSf: new
|
|
12758
|
-
borrowFactorAdjustedMarketValueSf: new
|
|
12753
|
+
padding: new BN2(obligationLiquidityDto.padding),
|
|
12754
|
+
borrowedAmountSf: new BN2(obligationLiquidityDto.borrowedAmountSf),
|
|
12755
|
+
marketValueSf: new BN2(obligationLiquidityDto.marketValueSf),
|
|
12756
|
+
borrowFactorAdjustedMarketValueSf: new BN2(
|
|
12759
12757
|
obligationLiquidityDto.borrowFactorAdjustedMarketValueSf
|
|
12760
12758
|
),
|
|
12761
|
-
borrowedAmountOutsideElevationGroups: new
|
|
12759
|
+
borrowedAmountOutsideElevationGroups: new BN2(
|
|
12762
12760
|
obligationLiquidityDto.borrowedAmountOutsideElevationGroups
|
|
12763
12761
|
),
|
|
12764
|
-
padding2: obligationLiquidityDto.padding2.map((item) => new
|
|
12762
|
+
padding2: obligationLiquidityDto.padding2.map((item) => new BN2(item))
|
|
12765
12763
|
};
|
|
12766
12764
|
}
|
|
12767
12765
|
function dtoToObligationOrderFields(obligationOrderDto) {
|
|
12768
12766
|
return {
|
|
12769
|
-
conditionThresholdSf: new
|
|
12770
|
-
opportunityParameterSf: new
|
|
12767
|
+
conditionThresholdSf: new BN2(obligationOrderDto.conditionThresholdSf),
|
|
12768
|
+
opportunityParameterSf: new BN2(obligationOrderDto.opportunityParameterSf),
|
|
12771
12769
|
minExecutionBonusBps: obligationOrderDto.minExecutionBonusBps,
|
|
12772
12770
|
maxExecutionBonusBps: obligationOrderDto.maxExecutionBonusBps,
|
|
12773
12771
|
conditionType: obligationOrderDto.conditionType,
|
|
12774
12772
|
opportunityType: obligationOrderDto.opportunityType,
|
|
12775
12773
|
padding1: obligationOrderDto.padding1,
|
|
12776
|
-
padding2: obligationOrderDto.padding2.map((item) => new
|
|
12774
|
+
padding2: obligationOrderDto.padding2.map((item) => new BN2(item))
|
|
12777
12775
|
};
|
|
12778
12776
|
}
|
|
12779
12777
|
var SEED_LENDING_MARKET_AUTH = "lma";
|
|
@@ -12909,9 +12907,9 @@ var Fraction = class _Fraction {
|
|
|
12909
12907
|
static MAX_SIZE_BF = 256;
|
|
12910
12908
|
static FRACTIONS = 60;
|
|
12911
12909
|
static MULTIPLIER = new FractionDecimal(2).pow(_Fraction.FRACTIONS);
|
|
12912
|
-
static MAX_F_BN = new
|
|
12913
|
-
static MAX_BF_BN = new
|
|
12914
|
-
static MIN_BN = new
|
|
12910
|
+
static MAX_F_BN = new BN2(2).pow(new BN2(_Fraction.MAX_SIZE_F)).sub(new BN2(1));
|
|
12911
|
+
static MAX_BF_BN = new BN2(2).pow(new BN2(_Fraction.MAX_SIZE_BF)).sub(new BN2(1));
|
|
12912
|
+
static MIN_BN = new BN2(0);
|
|
12915
12913
|
valueSf;
|
|
12916
12914
|
constructor(valueSf) {
|
|
12917
12915
|
if (valueSf.lt(_Fraction.MIN_BN) || valueSf.gt(_Fraction.MAX_BF_BN)) {
|
|
@@ -12927,7 +12925,7 @@ var Fraction = class _Fraction {
|
|
|
12927
12925
|
static fromDecimal(n) {
|
|
12928
12926
|
const scaledDecimal = new FractionDecimal(n).mul(_Fraction.MULTIPLIER);
|
|
12929
12927
|
const roundedScaledDecimal = roundNearest(scaledDecimal);
|
|
12930
|
-
const scaledValue = new
|
|
12928
|
+
const scaledValue = new BN2(roundedScaledDecimal.toFixed());
|
|
12931
12929
|
return new _Fraction(scaledValue);
|
|
12932
12930
|
}
|
|
12933
12931
|
static fromBps(n) {
|
|
@@ -12957,7 +12955,7 @@ var Fraction = class _Fraction {
|
|
|
12957
12955
|
return this.valueSf.eq(x.getValue());
|
|
12958
12956
|
}
|
|
12959
12957
|
};
|
|
12960
|
-
new Fraction(new
|
|
12958
|
+
new Fraction(new BN2(0));
|
|
12961
12959
|
function roundNearest(decimal) {
|
|
12962
12960
|
return decimal.toDecimalPlaces(0, Decimal3.ROUND_HALF_CEIL);
|
|
12963
12961
|
}
|
|
@@ -13354,42 +13352,42 @@ function dtoToFarmRaw(dto) {
|
|
|
13354
13352
|
globalConfig: new PublicKey(dto.globalConfig),
|
|
13355
13353
|
token: {
|
|
13356
13354
|
mint: new PublicKey(dto.token.mint),
|
|
13357
|
-
decimals: new
|
|
13355
|
+
decimals: new BN2(dto.token.decimals),
|
|
13358
13356
|
tokenProgram: new PublicKey(dto.token.tokenProgram),
|
|
13359
|
-
padding: dto.token.padding.map((item) => new
|
|
13357
|
+
padding: dto.token.padding.map((item) => new BN2(item))
|
|
13360
13358
|
},
|
|
13361
13359
|
rewardInfos: dto.rewardInfos.map((item) => ({
|
|
13362
13360
|
token: {
|
|
13363
13361
|
mint: new PublicKey(item.token.mint),
|
|
13364
|
-
decimals: new
|
|
13362
|
+
decimals: new BN2(item.token.decimals),
|
|
13365
13363
|
tokenProgram: new PublicKey(item.token.tokenProgram),
|
|
13366
|
-
padding: item.token.padding.map((p) => new
|
|
13364
|
+
padding: item.token.padding.map((p) => new BN2(p))
|
|
13367
13365
|
},
|
|
13368
13366
|
rewardsVault: new PublicKey(item.rewardsVault),
|
|
13369
|
-
rewardsAvailable: new
|
|
13367
|
+
rewardsAvailable: new BN2(item.rewardsAvailable),
|
|
13370
13368
|
rewardScheduleCurve: {
|
|
13371
13369
|
points: item.rewardScheduleCurve.points.map((p) => ({
|
|
13372
|
-
tsStart: new
|
|
13373
|
-
rewardPerTimeUnit: new
|
|
13370
|
+
tsStart: new BN2(p.tsStart),
|
|
13371
|
+
rewardPerTimeUnit: new BN2(p.rewardPerTimeUnit)
|
|
13374
13372
|
}))
|
|
13375
13373
|
},
|
|
13376
|
-
minClaimDurationSeconds: new
|
|
13377
|
-
lastIssuanceTs: new
|
|
13378
|
-
rewardsIssuedUnclaimed: new
|
|
13379
|
-
rewardsIssuedCumulative: new
|
|
13380
|
-
rewardPerShareScaled: new
|
|
13381
|
-
placeholder0: new
|
|
13374
|
+
minClaimDurationSeconds: new BN2(item.minClaimDurationSeconds),
|
|
13375
|
+
lastIssuanceTs: new BN2(item.lastIssuanceTs),
|
|
13376
|
+
rewardsIssuedUnclaimed: new BN2(item.rewardsIssuedUnclaimed),
|
|
13377
|
+
rewardsIssuedCumulative: new BN2(item.rewardsIssuedCumulative),
|
|
13378
|
+
rewardPerShareScaled: new BN2(item.rewardPerShareScaled),
|
|
13379
|
+
placeholder0: new BN2(item.placeholder0),
|
|
13382
13380
|
rewardType: item.rewardType,
|
|
13383
13381
|
rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
|
|
13384
13382
|
padding0: item.padding0,
|
|
13385
|
-
padding1: item.padding1.map((p) => new
|
|
13383
|
+
padding1: item.padding1.map((p) => new BN2(p))
|
|
13386
13384
|
})),
|
|
13387
|
-
numRewardTokens: new
|
|
13388
|
-
numUsers: new
|
|
13389
|
-
totalStakedAmount: new
|
|
13385
|
+
numRewardTokens: new BN2(dto.numRewardTokens),
|
|
13386
|
+
numUsers: new BN2(dto.numUsers),
|
|
13387
|
+
totalStakedAmount: new BN2(dto.totalStakedAmount),
|
|
13390
13388
|
farmVault: new PublicKey(dto.farmVault),
|
|
13391
13389
|
farmVaultsAuthority: new PublicKey(dto.farmVaultsAuthority),
|
|
13392
|
-
farmVaultsAuthorityBump: new
|
|
13390
|
+
farmVaultsAuthorityBump: new BN2(dto.farmVaultsAuthorityBump),
|
|
13393
13391
|
delegateAuthority: new PublicKey(dto.delegateAuthority),
|
|
13394
13392
|
timeUnit: dto.timeUnit,
|
|
13395
13393
|
isFarmFrozen: dto.isFarmFrozen,
|
|
@@ -13398,28 +13396,28 @@ function dtoToFarmRaw(dto) {
|
|
|
13398
13396
|
withdrawAuthority: new PublicKey(dto.withdrawAuthority),
|
|
13399
13397
|
depositWarmupPeriod: dto.depositWarmupPeriod,
|
|
13400
13398
|
withdrawalCooldownPeriod: dto.withdrawalCooldownPeriod,
|
|
13401
|
-
totalActiveStakeScaled: new
|
|
13402
|
-
totalPendingStakeScaled: new
|
|
13403
|
-
totalPendingAmount: new
|
|
13404
|
-
slashedAmountCurrent: new
|
|
13405
|
-
slashedAmountCumulative: new
|
|
13399
|
+
totalActiveStakeScaled: new BN2(dto.totalActiveStakeScaled),
|
|
13400
|
+
totalPendingStakeScaled: new BN2(dto.totalPendingStakeScaled),
|
|
13401
|
+
totalPendingAmount: new BN2(dto.totalPendingAmount),
|
|
13402
|
+
slashedAmountCurrent: new BN2(dto.slashedAmountCurrent),
|
|
13403
|
+
slashedAmountCumulative: new BN2(dto.slashedAmountCumulative),
|
|
13406
13404
|
slashedAmountSpillAddress: new PublicKey(dto.slashedAmountSpillAddress),
|
|
13407
|
-
lockingMode: new
|
|
13408
|
-
lockingStartTimestamp: new
|
|
13409
|
-
lockingDuration: new
|
|
13410
|
-
lockingEarlyWithdrawalPenaltyBps: new
|
|
13405
|
+
lockingMode: new BN2(dto.lockingMode),
|
|
13406
|
+
lockingStartTimestamp: new BN2(dto.lockingStartTimestamp),
|
|
13407
|
+
lockingDuration: new BN2(dto.lockingDuration),
|
|
13408
|
+
lockingEarlyWithdrawalPenaltyBps: new BN2(
|
|
13411
13409
|
dto.lockingEarlyWithdrawalPenaltyBps
|
|
13412
13410
|
),
|
|
13413
|
-
depositCapAmount: new
|
|
13411
|
+
depositCapAmount: new BN2(dto.depositCapAmount),
|
|
13414
13412
|
scopePrices: new PublicKey(dto.scopePrices),
|
|
13415
|
-
scopeOraclePriceId: new
|
|
13416
|
-
scopeOracleMaxAge: new
|
|
13413
|
+
scopeOraclePriceId: new BN2(dto.scopeOraclePriceId),
|
|
13414
|
+
scopeOracleMaxAge: new BN2(dto.scopeOracleMaxAge),
|
|
13417
13415
|
pendingFarmAdmin: new PublicKey(dto.pendingFarmAdmin),
|
|
13418
13416
|
strategyId: new PublicKey(dto.strategyId),
|
|
13419
13417
|
delegatedRpsAdmin: new PublicKey(dto.delegatedRpsAdmin),
|
|
13420
13418
|
vaultId: new PublicKey(dto.vaultId),
|
|
13421
13419
|
secondDelegatedAuthority: new PublicKey(dto.secondDelegatedAuthority),
|
|
13422
|
-
padding: dto.padding.map((item) => new
|
|
13420
|
+
padding: dto.padding.map((item) => new BN2(item))
|
|
13423
13421
|
};
|
|
13424
13422
|
}
|
|
13425
13423
|
|