@0dotxyz/p0-ts-sdk 2.0.2 → 2.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{rewards.types-2ooCYOAZ.d.cts → dto-rate-model.types-gN82ZYyC.d.cts} +164 -1
- package/dist/{rewards.types-2ooCYOAZ.d.ts → dto-rate-model.types-gN82ZYyC.d.ts} +164 -1
- package/dist/index.cjs +4163 -414
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2924 -311
- package/dist/index.d.ts +2924 -311
- package/dist/index.js +4156 -418
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +929 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +923 -3
- package/dist/vendor.d.ts +923 -3
- package/dist/vendor.js +878 -1
- package/dist/vendor.js.map +1 -1
- package/package.json +27 -23
package/dist/vendor.cjs
CHANGED
|
@@ -264,6 +264,10 @@ var SYSVAR_STAKE_HISTORY_ID = new web3_js.PublicKey(
|
|
|
264
264
|
new web3_js.PublicKey(
|
|
265
265
|
"StakeConfig11111111111111111111111111111111"
|
|
266
266
|
);
|
|
267
|
+
|
|
268
|
+
// src/constants/misc.consts.ts
|
|
269
|
+
var HOURS_PER_YEAR = 365.25 * 24;
|
|
270
|
+
BigInt("18446744073709551615").toString();
|
|
267
271
|
new web3_js.PublicKey("So11111111111111111111111111111111111111112");
|
|
268
272
|
new web3_js.PublicKey("LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp");
|
|
269
273
|
var USDC_MINT = new web3_js.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
@@ -28285,6 +28289,879 @@ function makeUpdateSpotMarketIx({ spotMarket }) {
|
|
|
28285
28289
|
spotMarketVault
|
|
28286
28290
|
);
|
|
28287
28291
|
}
|
|
28292
|
+
var JUP_LEND_PROGRAM_ID = new web3_js.PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9");
|
|
28293
|
+
var JUP_LIQUIDITY_PROGRAM_ID = new web3_js.PublicKey(
|
|
28294
|
+
"jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC"
|
|
28295
|
+
);
|
|
28296
|
+
var JUP_REWARDS_PROGRAM_ID = new web3_js.PublicKey("jup7TthsMgcR9Y3L277b8Eo9uboVSmu1utkuXHNUKar");
|
|
28297
|
+
|
|
28298
|
+
// src/vendor/jup-lend/idl/jup-lend.json
|
|
28299
|
+
var jup_lend_default = {
|
|
28300
|
+
address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9",
|
|
28301
|
+
metadata: {
|
|
28302
|
+
name: "lending",
|
|
28303
|
+
version: "0.1.0",
|
|
28304
|
+
spec: "0.1.0",
|
|
28305
|
+
description: "Created with Anchor"
|
|
28306
|
+
},
|
|
28307
|
+
instructions: [
|
|
28308
|
+
{
|
|
28309
|
+
name: "deposit",
|
|
28310
|
+
discriminator: [242, 35, 198, 137, 82, 225, 242, 182],
|
|
28311
|
+
accounts: [
|
|
28312
|
+
{ name: "signer", writable: true, signer: true },
|
|
28313
|
+
{ name: "depositor_token_account", writable: true },
|
|
28314
|
+
{ name: "recipient_token_account", writable: true },
|
|
28315
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28316
|
+
{ name: "lending_admin" },
|
|
28317
|
+
{ name: "lending", writable: true },
|
|
28318
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28319
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28320
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28321
|
+
{ name: "rate_model" },
|
|
28322
|
+
{ name: "vault", writable: true },
|
|
28323
|
+
{ name: "liquidity", writable: true },
|
|
28324
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28325
|
+
{ name: "rewards_rate_model" },
|
|
28326
|
+
{ name: "token_program" },
|
|
28327
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28328
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28329
|
+
],
|
|
28330
|
+
args: [{ name: "assets", type: "u64" }],
|
|
28331
|
+
returns: "u64"
|
|
28332
|
+
},
|
|
28333
|
+
{
|
|
28334
|
+
name: "mint",
|
|
28335
|
+
discriminator: [51, 57, 225, 47, 182, 146, 137, 166],
|
|
28336
|
+
accounts: [
|
|
28337
|
+
{ name: "signer", writable: true, signer: true },
|
|
28338
|
+
{ name: "depositor_token_account", writable: true },
|
|
28339
|
+
{ name: "recipient_token_account", writable: true },
|
|
28340
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28341
|
+
{ name: "lending_admin" },
|
|
28342
|
+
{ name: "lending", writable: true },
|
|
28343
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28344
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28345
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28346
|
+
{ name: "rate_model" },
|
|
28347
|
+
{ name: "vault", writable: true },
|
|
28348
|
+
{ name: "liquidity", writable: true },
|
|
28349
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28350
|
+
{ name: "rewards_rate_model" },
|
|
28351
|
+
{ name: "token_program" },
|
|
28352
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28353
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28354
|
+
],
|
|
28355
|
+
args: [{ name: "shares", type: "u64" }],
|
|
28356
|
+
returns: "u64"
|
|
28357
|
+
},
|
|
28358
|
+
{
|
|
28359
|
+
name: "withdraw",
|
|
28360
|
+
discriminator: [183, 18, 70, 156, 148, 109, 161, 34],
|
|
28361
|
+
accounts: [
|
|
28362
|
+
{ name: "signer", writable: true, signer: true },
|
|
28363
|
+
{ name: "owner_token_account", writable: true },
|
|
28364
|
+
{ name: "recipient_token_account", writable: true },
|
|
28365
|
+
{ name: "lending_admin" },
|
|
28366
|
+
{ name: "lending", writable: true },
|
|
28367
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28368
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28369
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28370
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28371
|
+
{ name: "rate_model" },
|
|
28372
|
+
{ name: "vault", writable: true },
|
|
28373
|
+
{ name: "claim_account", writable: true },
|
|
28374
|
+
{ name: "liquidity", writable: true },
|
|
28375
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28376
|
+
{ name: "rewards_rate_model" },
|
|
28377
|
+
{ name: "token_program" },
|
|
28378
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28379
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28380
|
+
],
|
|
28381
|
+
args: [{ name: "amount", type: "u64" }],
|
|
28382
|
+
returns: "u64"
|
|
28383
|
+
},
|
|
28384
|
+
{
|
|
28385
|
+
name: "redeem",
|
|
28386
|
+
discriminator: [184, 12, 86, 149, 70, 196, 97, 225],
|
|
28387
|
+
accounts: [
|
|
28388
|
+
{ name: "signer", writable: true, signer: true },
|
|
28389
|
+
{ name: "owner_token_account", writable: true },
|
|
28390
|
+
{ name: "recipient_token_account", writable: true },
|
|
28391
|
+
{ name: "lending_admin" },
|
|
28392
|
+
{ name: "lending", writable: true },
|
|
28393
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28394
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28395
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28396
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28397
|
+
{ name: "rate_model" },
|
|
28398
|
+
{ name: "vault", writable: true },
|
|
28399
|
+
{ name: "claim_account", writable: true },
|
|
28400
|
+
{ name: "liquidity", writable: true },
|
|
28401
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28402
|
+
{ name: "rewards_rate_model" },
|
|
28403
|
+
{ name: "token_program" },
|
|
28404
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28405
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28406
|
+
],
|
|
28407
|
+
args: [{ name: "shares", type: "u64" }],
|
|
28408
|
+
returns: "u64"
|
|
28409
|
+
},
|
|
28410
|
+
{
|
|
28411
|
+
name: "rebalance",
|
|
28412
|
+
discriminator: [108, 158, 77, 9, 210, 52, 88, 62],
|
|
28413
|
+
accounts: [
|
|
28414
|
+
{ name: "signer", writable: true, signer: true },
|
|
28415
|
+
{ name: "depositor_token_account", writable: true },
|
|
28416
|
+
{ name: "lending_admin" },
|
|
28417
|
+
{ name: "lending", writable: true },
|
|
28418
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28419
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28420
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28421
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28422
|
+
{ name: "rate_model", writable: true },
|
|
28423
|
+
{ name: "vault", writable: true },
|
|
28424
|
+
{ name: "liquidity", writable: true },
|
|
28425
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28426
|
+
{ name: "rewards_rate_model" },
|
|
28427
|
+
{ name: "token_program" },
|
|
28428
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28429
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28430
|
+
],
|
|
28431
|
+
args: []
|
|
28432
|
+
},
|
|
28433
|
+
{
|
|
28434
|
+
name: "update_rate",
|
|
28435
|
+
discriminator: [24, 225, 53, 189, 72, 212, 225, 178],
|
|
28436
|
+
accounts: [
|
|
28437
|
+
{ name: "lending", writable: true },
|
|
28438
|
+
{ name: "mint", relations: ["lending", "supply_token_reserves_liquidity"] },
|
|
28439
|
+
{ name: "f_token_mint", relations: ["lending"] },
|
|
28440
|
+
{ name: "supply_token_reserves_liquidity" },
|
|
28441
|
+
{ name: "rewards_rate_model" }
|
|
28442
|
+
],
|
|
28443
|
+
args: []
|
|
28444
|
+
}
|
|
28445
|
+
],
|
|
28446
|
+
accounts: [
|
|
28447
|
+
{ name: "Lending", discriminator: [135, 199, 82, 16, 249, 131, 182, 241] },
|
|
28448
|
+
{ name: "LendingAdmin", discriminator: [42, 8, 33, 220, 163, 40, 210, 5] },
|
|
28449
|
+
{ name: "LendingRewardsRateModel", discriminator: [166, 72, 71, 131, 172, 74, 166, 181] },
|
|
28450
|
+
{ name: "TokenReserve", discriminator: [21, 18, 59, 135, 120, 20, 31, 12] },
|
|
28451
|
+
{ name: "UserSupplyPosition", discriminator: [202, 219, 136, 118, 61, 177, 21, 146] }
|
|
28452
|
+
],
|
|
28453
|
+
errors: [
|
|
28454
|
+
{ code: 6e3, name: "FTokenDepositInsignificant", msg: "F_TOKEN_DEPOSIT_INSIGNIFICANT" },
|
|
28455
|
+
{ code: 6001, name: "FTokenMinAmountOut", msg: "F_TOKEN_MIN_AMOUNT_OUT" },
|
|
28456
|
+
{ code: 6002, name: "FTokenMaxAmount", msg: "F_TOKEN_MAX_AMOUNT" },
|
|
28457
|
+
{ code: 6003, name: "FTokenInvalidParams", msg: "F_TOKEN_INVALID_PARAMS" },
|
|
28458
|
+
{ code: 6004, name: "FTokenRewardsRateModelAlreadySet", msg: "F_TOKEN_REWARDS_RATE_MODEL_ALREADY_SET" },
|
|
28459
|
+
{ code: 6005, name: "FTokenMaxAuthCountReached", msg: "F_TOKEN_MAX_AUTH_COUNT" },
|
|
28460
|
+
{ code: 6006, name: "FTokenLiquidityExchangePriceUnexpected", msg: "F_TOKEN_LIQUIDITY_EXCHANGE_PRICE_UNEXPECTED" },
|
|
28461
|
+
{ code: 6007, name: "FTokenCpiToLiquidityFailed", msg: "F_TOKEN_CPI_TO_LIQUIDITY_FAILED" },
|
|
28462
|
+
{ code: 6008, name: "FTokenOnlyAuth", msg: "F_TOKEN_ONLY_AUTH" },
|
|
28463
|
+
{ code: 6009, name: "FTokenOnlyAuthority", msg: "F_TOKEN_ONLY_AUTHORITY" },
|
|
28464
|
+
{ code: 6010, name: "FTokenOnlyRebalancer", msg: "F_TOKEN_ONLY_REBALANCER" },
|
|
28465
|
+
{ code: 6011, name: "FTokenUserSupplyPositionRequired", msg: "F_TOKEN_USER_SUPPLY_POSITION_REQUIRED" },
|
|
28466
|
+
{ code: 6012, name: "FTokenLiquidityProgramMismatch", msg: "F_TOKEN_LIQUIDITY_PROGRAM_MISMATCH" }
|
|
28467
|
+
],
|
|
28468
|
+
types: [
|
|
28469
|
+
{
|
|
28470
|
+
name: "AddressBool",
|
|
28471
|
+
type: {
|
|
28472
|
+
kind: "struct",
|
|
28473
|
+
fields: [
|
|
28474
|
+
{ name: "addr", type: "pubkey" },
|
|
28475
|
+
{ name: "value", type: "bool" }
|
|
28476
|
+
]
|
|
28477
|
+
}
|
|
28478
|
+
},
|
|
28479
|
+
{
|
|
28480
|
+
name: "Lending",
|
|
28481
|
+
type: {
|
|
28482
|
+
kind: "struct",
|
|
28483
|
+
fields: [
|
|
28484
|
+
{ name: "mint", type: "pubkey" },
|
|
28485
|
+
{ name: "f_token_mint", type: "pubkey" },
|
|
28486
|
+
{ name: "lending_id", type: "u16" },
|
|
28487
|
+
{ name: "decimals", type: "u8" },
|
|
28488
|
+
{ name: "rewards_rate_model", type: "pubkey" },
|
|
28489
|
+
{ name: "liquidity_exchange_price", type: "u64" },
|
|
28490
|
+
{ name: "token_exchange_price", type: "u64" },
|
|
28491
|
+
{ name: "last_update_timestamp", type: "u64" },
|
|
28492
|
+
{ name: "token_reserves_liquidity", type: "pubkey" },
|
|
28493
|
+
{ name: "supply_position_on_liquidity", type: "pubkey" },
|
|
28494
|
+
{ name: "bump", type: "u8" }
|
|
28495
|
+
]
|
|
28496
|
+
}
|
|
28497
|
+
},
|
|
28498
|
+
{
|
|
28499
|
+
name: "LendingAdmin",
|
|
28500
|
+
type: {
|
|
28501
|
+
kind: "struct",
|
|
28502
|
+
fields: [
|
|
28503
|
+
{ name: "authority", type: "pubkey" },
|
|
28504
|
+
{ name: "liquidity_program", type: "pubkey" },
|
|
28505
|
+
{ name: "rebalancer", type: "pubkey" },
|
|
28506
|
+
{ name: "next_lending_id", type: "u16" },
|
|
28507
|
+
{ name: "auths", type: { vec: "pubkey" } },
|
|
28508
|
+
{ name: "bump", type: "u8" }
|
|
28509
|
+
]
|
|
28510
|
+
}
|
|
28511
|
+
},
|
|
28512
|
+
{
|
|
28513
|
+
name: "LendingRewardsRateModel",
|
|
28514
|
+
type: {
|
|
28515
|
+
kind: "struct",
|
|
28516
|
+
fields: [
|
|
28517
|
+
{ name: "mint", type: "pubkey" },
|
|
28518
|
+
{ name: "start_tvl", type: "u64" },
|
|
28519
|
+
{ name: "duration", type: "u64" },
|
|
28520
|
+
{ name: "start_time", type: "u64" },
|
|
28521
|
+
{ name: "yearly_reward", type: "u64" },
|
|
28522
|
+
{ name: "next_duration", type: "u64" },
|
|
28523
|
+
{ name: "next_reward_amount", type: "u64" },
|
|
28524
|
+
{ name: "bump", type: "u8" }
|
|
28525
|
+
]
|
|
28526
|
+
}
|
|
28527
|
+
},
|
|
28528
|
+
{
|
|
28529
|
+
name: "TokenReserve",
|
|
28530
|
+
serialization: "bytemuck",
|
|
28531
|
+
repr: { kind: "c", packed: true },
|
|
28532
|
+
type: {
|
|
28533
|
+
kind: "struct",
|
|
28534
|
+
fields: [
|
|
28535
|
+
{ name: "mint", type: "pubkey" },
|
|
28536
|
+
{ name: "vault", type: "pubkey" },
|
|
28537
|
+
{ name: "borrow_rate", type: "u16" },
|
|
28538
|
+
{ name: "fee_on_interest", type: "u16" },
|
|
28539
|
+
{ name: "last_utilization", type: "u16" },
|
|
28540
|
+
{ name: "last_update_timestamp", type: "u64" },
|
|
28541
|
+
{ name: "supply_exchange_price", type: "u64" },
|
|
28542
|
+
{ name: "borrow_exchange_price", type: "u64" },
|
|
28543
|
+
{ name: "max_utilization", type: "u16" },
|
|
28544
|
+
{ name: "total_supply_with_interest", type: "u64" },
|
|
28545
|
+
{ name: "total_supply_interest_free", type: "u64" },
|
|
28546
|
+
{ name: "total_borrow_with_interest", type: "u64" },
|
|
28547
|
+
{ name: "total_borrow_interest_free", type: "u64" },
|
|
28548
|
+
{ name: "total_claim_amount", type: "u64" },
|
|
28549
|
+
{ name: "interacting_protocol", type: "pubkey" },
|
|
28550
|
+
{ name: "interacting_timestamp", type: "u64" },
|
|
28551
|
+
{ name: "interacting_balance", type: "u64" }
|
|
28552
|
+
]
|
|
28553
|
+
}
|
|
28554
|
+
},
|
|
28555
|
+
{
|
|
28556
|
+
name: "UserSupplyPosition",
|
|
28557
|
+
serialization: "bytemuck",
|
|
28558
|
+
repr: { kind: "c", packed: true },
|
|
28559
|
+
type: {
|
|
28560
|
+
kind: "struct",
|
|
28561
|
+
fields: [
|
|
28562
|
+
{ name: "protocol", type: "pubkey" },
|
|
28563
|
+
{ name: "mint", type: "pubkey" },
|
|
28564
|
+
{ name: "with_interest", type: "u8" },
|
|
28565
|
+
{ name: "amount", type: "u64" },
|
|
28566
|
+
{ name: "withdrawal_limit", type: "u128" },
|
|
28567
|
+
{ name: "last_update", type: "u64" },
|
|
28568
|
+
{ name: "expand_pct", type: "u16" },
|
|
28569
|
+
{ name: "expand_duration", type: "u64" },
|
|
28570
|
+
{ name: "base_withdrawal_limit", type: "u64" },
|
|
28571
|
+
{ name: "status", type: "u8" }
|
|
28572
|
+
]
|
|
28573
|
+
}
|
|
28574
|
+
}
|
|
28575
|
+
]
|
|
28576
|
+
};
|
|
28577
|
+
|
|
28578
|
+
// src/vendor/jup-lend/idl/index.ts
|
|
28579
|
+
var JUP_LEND_IDL = jup_lend_default;
|
|
28580
|
+
|
|
28581
|
+
// src/vendor/jup-lend/utils/serialize.utils.ts
|
|
28582
|
+
function jupLendingStateRawToDto(raw) {
|
|
28583
|
+
return {
|
|
28584
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28585
|
+
mint: raw.mint.toBase58(),
|
|
28586
|
+
fTokenMint: raw.fTokenMint.toBase58(),
|
|
28587
|
+
lendingId: raw.lendingId,
|
|
28588
|
+
decimals: raw.decimals,
|
|
28589
|
+
rewardsRateModel: raw.rewardsRateModel.toBase58(),
|
|
28590
|
+
liquidityExchangePrice: raw.liquidityExchangePrice.toString(),
|
|
28591
|
+
tokenExchangePrice: raw.tokenExchangePrice.toString(),
|
|
28592
|
+
lastUpdateTimestamp: raw.lastUpdateTimestamp.toString(),
|
|
28593
|
+
tokenReservesLiquidity: raw.tokenReservesLiquidity.toBase58(),
|
|
28594
|
+
supplyPositionOnLiquidity: raw.supplyPositionOnLiquidity.toBase58()
|
|
28595
|
+
};
|
|
28596
|
+
}
|
|
28597
|
+
function jupTokenReserveRawToDto(raw) {
|
|
28598
|
+
return {
|
|
28599
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28600
|
+
mint: raw.mint.toBase58(),
|
|
28601
|
+
vault: raw.vault.toBase58(),
|
|
28602
|
+
borrowRate: raw.borrowRate,
|
|
28603
|
+
feeOnInterest: raw.feeOnInterest,
|
|
28604
|
+
lastUtilization: raw.lastUtilization,
|
|
28605
|
+
lastUpdateTimestamp: raw.lastUpdateTimestamp.toString(),
|
|
28606
|
+
supplyExchangePrice: raw.supplyExchangePrice.toString(),
|
|
28607
|
+
borrowExchangePrice: raw.borrowExchangePrice.toString(),
|
|
28608
|
+
maxUtilization: raw.maxUtilization,
|
|
28609
|
+
totalSupplyWithInterest: raw.totalSupplyWithInterest.toString(),
|
|
28610
|
+
totalSupplyInterestFree: raw.totalSupplyInterestFree.toString(),
|
|
28611
|
+
totalBorrowWithInterest: raw.totalBorrowWithInterest.toString(),
|
|
28612
|
+
totalBorrowInterestFree: raw.totalBorrowInterestFree.toString(),
|
|
28613
|
+
totalClaimAmount: raw.totalClaimAmount.toString(),
|
|
28614
|
+
interactingProtocol: raw.interactingProtocol.toBase58(),
|
|
28615
|
+
interactingTimestamp: raw.interactingTimestamp.toString(),
|
|
28616
|
+
interactingBalance: raw.interactingBalance.toString()
|
|
28617
|
+
};
|
|
28618
|
+
}
|
|
28619
|
+
function jupLendingRewardsRateModelRawToDto(raw) {
|
|
28620
|
+
return {
|
|
28621
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28622
|
+
mint: raw.mint.toBase58(),
|
|
28623
|
+
startTvl: raw.startTvl.toString(),
|
|
28624
|
+
duration: raw.duration.toString(),
|
|
28625
|
+
startTime: raw.startTime.toString(),
|
|
28626
|
+
yearlyReward: raw.yearlyReward.toString(),
|
|
28627
|
+
nextDuration: raw.nextDuration.toString(),
|
|
28628
|
+
nextRewardAmount: raw.nextRewardAmount.toString()
|
|
28629
|
+
};
|
|
28630
|
+
}
|
|
28631
|
+
function jupRateModelRawToDto(raw) {
|
|
28632
|
+
return {
|
|
28633
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28634
|
+
mint: raw.mint.toBase58(),
|
|
28635
|
+
version: raw.version,
|
|
28636
|
+
rateAtZero: raw.rateAtZero,
|
|
28637
|
+
kink1Utilization: raw.kink1Utilization,
|
|
28638
|
+
rateAtKink1: raw.rateAtKink1,
|
|
28639
|
+
rateAtMax: raw.rateAtMax,
|
|
28640
|
+
kink2Utilization: raw.kink2Utilization,
|
|
28641
|
+
rateAtKink2: raw.rateAtKink2
|
|
28642
|
+
};
|
|
28643
|
+
}
|
|
28644
|
+
var JUP_LEND_ACCOUNTS_CODER = new anchor.BorshAccountsCoder(JUP_LEND_IDL);
|
|
28645
|
+
var lendingDiscriminator = Buffer.from([135, 199, 82, 16, 249, 131, 182, 241]);
|
|
28646
|
+
var lendingRewardsRateModelDiscriminator = Buffer.from([166, 72, 71, 131, 172, 74, 166, 181]);
|
|
28647
|
+
var rateModelDiscriminator = Buffer.from([94, 3, 203, 219, 107, 137, 4, 162]);
|
|
28648
|
+
function decodeJupLendingStateData(data, pubkey) {
|
|
28649
|
+
if (!data.slice(0, 8).equals(lendingDiscriminator)) {
|
|
28650
|
+
throw new Error("invalid Lending account discriminator");
|
|
28651
|
+
}
|
|
28652
|
+
const decoded = JUP_LEND_ACCOUNTS_CODER.decode("Lending", data);
|
|
28653
|
+
return {
|
|
28654
|
+
pubkey,
|
|
28655
|
+
mint: decoded.mint,
|
|
28656
|
+
fTokenMint: decoded.f_token_mint ?? decoded.fTokenMint,
|
|
28657
|
+
lendingId: decoded.lending_id ?? decoded.lendingId,
|
|
28658
|
+
decimals: decoded.decimals,
|
|
28659
|
+
rewardsRateModel: decoded.rewards_rate_model ?? decoded.rewardsRateModel,
|
|
28660
|
+
liquidityExchangePrice: decoded.liquidity_exchange_price ?? decoded.liquidityExchangePrice,
|
|
28661
|
+
tokenExchangePrice: decoded.token_exchange_price ?? decoded.tokenExchangePrice,
|
|
28662
|
+
lastUpdateTimestamp: decoded.last_update_timestamp ?? decoded.lastUpdateTimestamp,
|
|
28663
|
+
tokenReservesLiquidity: decoded.token_reserves_liquidity ?? decoded.tokenReservesLiquidity,
|
|
28664
|
+
supplyPositionOnLiquidity: decoded.supply_position_on_liquidity ?? decoded.supplyPositionOnLiquidity,
|
|
28665
|
+
bump: decoded.bump
|
|
28666
|
+
};
|
|
28667
|
+
}
|
|
28668
|
+
function decodeJupLendingRewardsRateModelData(data, pubkey) {
|
|
28669
|
+
if (!data.slice(0, 8).equals(lendingRewardsRateModelDiscriminator)) {
|
|
28670
|
+
throw new Error("invalid LendingRewardsRateModel account discriminator");
|
|
28671
|
+
}
|
|
28672
|
+
const decoded = JUP_LEND_ACCOUNTS_CODER.decode("LendingRewardsRateModel", data);
|
|
28673
|
+
return {
|
|
28674
|
+
pubkey,
|
|
28675
|
+
mint: decoded.mint,
|
|
28676
|
+
startTvl: decoded.start_tvl ?? decoded.startTvl,
|
|
28677
|
+
duration: decoded.duration,
|
|
28678
|
+
startTime: decoded.start_time ?? decoded.startTime,
|
|
28679
|
+
yearlyReward: decoded.yearly_reward ?? decoded.yearlyReward,
|
|
28680
|
+
nextDuration: decoded.next_duration ?? decoded.nextDuration,
|
|
28681
|
+
nextRewardAmount: decoded.next_reward_amount ?? decoded.nextRewardAmount,
|
|
28682
|
+
bump: decoded.bump
|
|
28683
|
+
};
|
|
28684
|
+
}
|
|
28685
|
+
function decodeJupTokenReserveData(data, pubkey) {
|
|
28686
|
+
let offset = 8;
|
|
28687
|
+
const mint = new web3_js.PublicKey(data.slice(offset, offset + 32));
|
|
28688
|
+
offset += 32;
|
|
28689
|
+
const vault = new web3_js.PublicKey(data.slice(offset, offset + 32));
|
|
28690
|
+
offset += 32;
|
|
28691
|
+
const borrowRate = data.readUInt16LE(offset);
|
|
28692
|
+
offset += 2;
|
|
28693
|
+
const feeOnInterest = data.readUInt16LE(offset);
|
|
28694
|
+
offset += 2;
|
|
28695
|
+
const lastUtilization = data.readUInt16LE(offset);
|
|
28696
|
+
offset += 2;
|
|
28697
|
+
const lastUpdateTimestamp = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28698
|
+
offset += 8;
|
|
28699
|
+
const supplyExchangePrice = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28700
|
+
offset += 8;
|
|
28701
|
+
const borrowExchangePrice = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28702
|
+
offset += 8;
|
|
28703
|
+
const maxUtilization = data.readUInt16LE(offset);
|
|
28704
|
+
offset += 2;
|
|
28705
|
+
const totalSupplyWithInterest = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28706
|
+
offset += 8;
|
|
28707
|
+
const totalSupplyInterestFree = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28708
|
+
offset += 8;
|
|
28709
|
+
const totalBorrowWithInterest = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28710
|
+
offset += 8;
|
|
28711
|
+
const totalBorrowInterestFree = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28712
|
+
offset += 8;
|
|
28713
|
+
const totalClaimAmount = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28714
|
+
offset += 8;
|
|
28715
|
+
const interactingProtocol = new web3_js.PublicKey(data.slice(offset, offset + 32));
|
|
28716
|
+
offset += 32;
|
|
28717
|
+
const interactingTimestamp = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28718
|
+
offset += 8;
|
|
28719
|
+
const interactingBalance = new BN2__default.default(data.slice(offset, offset + 8), "le");
|
|
28720
|
+
return {
|
|
28721
|
+
pubkey,
|
|
28722
|
+
mint,
|
|
28723
|
+
vault,
|
|
28724
|
+
borrowRate,
|
|
28725
|
+
feeOnInterest,
|
|
28726
|
+
lastUtilization,
|
|
28727
|
+
lastUpdateTimestamp,
|
|
28728
|
+
supplyExchangePrice,
|
|
28729
|
+
borrowExchangePrice,
|
|
28730
|
+
maxUtilization,
|
|
28731
|
+
totalSupplyWithInterest,
|
|
28732
|
+
totalSupplyInterestFree,
|
|
28733
|
+
totalBorrowWithInterest,
|
|
28734
|
+
totalBorrowInterestFree,
|
|
28735
|
+
totalClaimAmount,
|
|
28736
|
+
interactingProtocol,
|
|
28737
|
+
interactingTimestamp,
|
|
28738
|
+
interactingBalance
|
|
28739
|
+
};
|
|
28740
|
+
}
|
|
28741
|
+
function decodeJupRateModelData(data, pubkey) {
|
|
28742
|
+
if (!data.slice(0, 8).equals(rateModelDiscriminator)) {
|
|
28743
|
+
throw new Error("invalid RateModel account discriminator");
|
|
28744
|
+
}
|
|
28745
|
+
let offset = 8;
|
|
28746
|
+
const mint = new web3_js.PublicKey(data.slice(offset, offset + 32));
|
|
28747
|
+
offset += 32;
|
|
28748
|
+
const version = data.readUInt8(offset);
|
|
28749
|
+
offset += 1;
|
|
28750
|
+
const rateAtZero = data.readUInt16LE(offset);
|
|
28751
|
+
offset += 2;
|
|
28752
|
+
const kink1Utilization = data.readUInt16LE(offset);
|
|
28753
|
+
offset += 2;
|
|
28754
|
+
const rateAtKink1 = data.readUInt16LE(offset);
|
|
28755
|
+
offset += 2;
|
|
28756
|
+
const rateAtMax = data.readUInt16LE(offset);
|
|
28757
|
+
offset += 2;
|
|
28758
|
+
const kink2Utilization = data.readUInt16LE(offset);
|
|
28759
|
+
offset += 2;
|
|
28760
|
+
const rateAtKink2 = data.readUInt16LE(offset);
|
|
28761
|
+
return {
|
|
28762
|
+
pubkey,
|
|
28763
|
+
mint,
|
|
28764
|
+
version,
|
|
28765
|
+
rateAtZero,
|
|
28766
|
+
kink1Utilization,
|
|
28767
|
+
rateAtKink1,
|
|
28768
|
+
rateAtMax,
|
|
28769
|
+
kink2Utilization,
|
|
28770
|
+
rateAtKink2
|
|
28771
|
+
};
|
|
28772
|
+
}
|
|
28773
|
+
function dtoToJupLendingStateRaw(dto) {
|
|
28774
|
+
return {
|
|
28775
|
+
pubkey: new web3_js.PublicKey(dto.pubkey),
|
|
28776
|
+
mint: new web3_js.PublicKey(dto.mint),
|
|
28777
|
+
fTokenMint: new web3_js.PublicKey(dto.fTokenMint),
|
|
28778
|
+
lendingId: dto.lendingId,
|
|
28779
|
+
decimals: dto.decimals,
|
|
28780
|
+
rewardsRateModel: new web3_js.PublicKey(dto.rewardsRateModel),
|
|
28781
|
+
liquidityExchangePrice: new BN2__default.default(dto.liquidityExchangePrice),
|
|
28782
|
+
tokenExchangePrice: new BN2__default.default(dto.tokenExchangePrice),
|
|
28783
|
+
lastUpdateTimestamp: new BN2__default.default(dto.lastUpdateTimestamp),
|
|
28784
|
+
tokenReservesLiquidity: new web3_js.PublicKey(dto.tokenReservesLiquidity),
|
|
28785
|
+
supplyPositionOnLiquidity: new web3_js.PublicKey(dto.supplyPositionOnLiquidity)
|
|
28786
|
+
};
|
|
28787
|
+
}
|
|
28788
|
+
function dtoToJupTokenReserveRaw(dto) {
|
|
28789
|
+
return {
|
|
28790
|
+
pubkey: new web3_js.PublicKey(dto.pubkey),
|
|
28791
|
+
mint: new web3_js.PublicKey(dto.mint),
|
|
28792
|
+
vault: new web3_js.PublicKey(dto.vault),
|
|
28793
|
+
borrowRate: dto.borrowRate,
|
|
28794
|
+
feeOnInterest: dto.feeOnInterest,
|
|
28795
|
+
lastUtilization: dto.lastUtilization,
|
|
28796
|
+
lastUpdateTimestamp: new BN2__default.default(dto.lastUpdateTimestamp),
|
|
28797
|
+
supplyExchangePrice: new BN2__default.default(dto.supplyExchangePrice),
|
|
28798
|
+
borrowExchangePrice: new BN2__default.default(dto.borrowExchangePrice),
|
|
28799
|
+
maxUtilization: dto.maxUtilization,
|
|
28800
|
+
totalSupplyWithInterest: new BN2__default.default(dto.totalSupplyWithInterest),
|
|
28801
|
+
totalSupplyInterestFree: new BN2__default.default(dto.totalSupplyInterestFree),
|
|
28802
|
+
totalBorrowWithInterest: new BN2__default.default(dto.totalBorrowWithInterest),
|
|
28803
|
+
totalBorrowInterestFree: new BN2__default.default(dto.totalBorrowInterestFree),
|
|
28804
|
+
totalClaimAmount: new BN2__default.default(dto.totalClaimAmount),
|
|
28805
|
+
interactingProtocol: new web3_js.PublicKey(dto.interactingProtocol),
|
|
28806
|
+
interactingTimestamp: new BN2__default.default(dto.interactingTimestamp),
|
|
28807
|
+
interactingBalance: new BN2__default.default(dto.interactingBalance)
|
|
28808
|
+
};
|
|
28809
|
+
}
|
|
28810
|
+
function dtoToJupLendingRewardsRateModelRaw(dto) {
|
|
28811
|
+
return {
|
|
28812
|
+
pubkey: new web3_js.PublicKey(dto.pubkey),
|
|
28813
|
+
mint: new web3_js.PublicKey(dto.mint),
|
|
28814
|
+
startTvl: new BN2__default.default(dto.startTvl),
|
|
28815
|
+
duration: new BN2__default.default(dto.duration),
|
|
28816
|
+
startTime: new BN2__default.default(dto.startTime),
|
|
28817
|
+
yearlyReward: new BN2__default.default(dto.yearlyReward),
|
|
28818
|
+
nextDuration: new BN2__default.default(dto.nextDuration),
|
|
28819
|
+
nextRewardAmount: new BN2__default.default(dto.nextRewardAmount)
|
|
28820
|
+
};
|
|
28821
|
+
}
|
|
28822
|
+
function dtoToJupRateModelRaw(dto) {
|
|
28823
|
+
return {
|
|
28824
|
+
pubkey: new web3_js.PublicKey(dto.pubkey),
|
|
28825
|
+
mint: new web3_js.PublicKey(dto.mint),
|
|
28826
|
+
version: dto.version,
|
|
28827
|
+
rateAtZero: dto.rateAtZero,
|
|
28828
|
+
kink1Utilization: dto.kink1Utilization,
|
|
28829
|
+
rateAtKink1: dto.rateAtKink1,
|
|
28830
|
+
rateAtMax: dto.rateAtMax,
|
|
28831
|
+
kink2Utilization: dto.kink2Utilization,
|
|
28832
|
+
rateAtKink2: dto.rateAtKink2
|
|
28833
|
+
};
|
|
28834
|
+
}
|
|
28835
|
+
var SEED_LENDING_ADMIN = "lending_admin";
|
|
28836
|
+
var SEED_F_TOKEN_MINT = "f_token_mint";
|
|
28837
|
+
var SEED_LENDING = "lending";
|
|
28838
|
+
var SEED_LIQUIDITY = "liquidity";
|
|
28839
|
+
var SEED_RESERVE = "reserve";
|
|
28840
|
+
var SEED_RATE_MODEL = "rate_model";
|
|
28841
|
+
var SEED_USER_SUPPLY_POSITION = "user_supply_position";
|
|
28842
|
+
var SEED_USER_CLAIM = "user_claim";
|
|
28843
|
+
var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
|
|
28844
|
+
function getAllDerivedJupLendAccounts(mint) {
|
|
28845
|
+
const [fTokenMint] = deriveJupLendFTokenMint(mint);
|
|
28846
|
+
const [lending] = deriveJupLendLending(mint, fTokenMint);
|
|
28847
|
+
const [liquidity] = deriveJupLendLiquidity();
|
|
28848
|
+
return {
|
|
28849
|
+
fTokenMint,
|
|
28850
|
+
lendingAdmin: deriveJupLendLendingAdmin()[0],
|
|
28851
|
+
supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
|
|
28852
|
+
lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
|
|
28853
|
+
rateModel: deriveJupLendRateModel(mint)[0],
|
|
28854
|
+
vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
|
|
28855
|
+
liquidity,
|
|
28856
|
+
rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
|
|
28857
|
+
};
|
|
28858
|
+
}
|
|
28859
|
+
function deriveJupLendLendingPdas(underlyingMint, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28860
|
+
const [lendingAdmin, lendingAdminBump] = deriveJupLendLendingAdmin(lendingProgramId);
|
|
28861
|
+
const [fTokenMint, fTokenMintBump] = deriveJupLendFTokenMint(underlyingMint, lendingProgramId);
|
|
28862
|
+
const [lending, lendingBump] = deriveJupLendLending(underlyingMint, fTokenMint, lendingProgramId);
|
|
28863
|
+
return {
|
|
28864
|
+
lendingAdmin,
|
|
28865
|
+
lendingAdminBump,
|
|
28866
|
+
fTokenMint,
|
|
28867
|
+
fTokenMintBump,
|
|
28868
|
+
lending,
|
|
28869
|
+
lendingBump
|
|
28870
|
+
};
|
|
28871
|
+
}
|
|
28872
|
+
function deriveJupLendFTokenMint(asset, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28873
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28874
|
+
[Buffer.from(SEED_F_TOKEN_MINT), asset.toBuffer()],
|
|
28875
|
+
lendingProgramId
|
|
28876
|
+
);
|
|
28877
|
+
}
|
|
28878
|
+
function deriveJupLendLending(asset, fTokenMint, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28879
|
+
const [_fTokenMint] = fTokenMint ? [fTokenMint] : deriveJupLendFTokenMint(asset, lendingProgramId);
|
|
28880
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28881
|
+
[Buffer.from(SEED_LENDING), asset.toBuffer(), _fTokenMint.toBuffer()],
|
|
28882
|
+
lendingProgramId
|
|
28883
|
+
);
|
|
28884
|
+
}
|
|
28885
|
+
function deriveJupLendLendingAdmin(lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28886
|
+
return web3_js.PublicKey.findProgramAddressSync([Buffer.from(SEED_LENDING_ADMIN)], lendingProgramId);
|
|
28887
|
+
}
|
|
28888
|
+
function deriveJupLendLendingRewardsRateModel(asset, rewardsProgramId = JUP_REWARDS_PROGRAM_ID) {
|
|
28889
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28890
|
+
[Buffer.from(SEED_LENDING_REWARDS_RATE_MODEL), asset.toBuffer()],
|
|
28891
|
+
rewardsProgramId
|
|
28892
|
+
);
|
|
28893
|
+
}
|
|
28894
|
+
function deriveJupLendTokenReserve(asset, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28895
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28896
|
+
[Buffer.from(SEED_RESERVE), asset.toBuffer()],
|
|
28897
|
+
liquidityProgramId
|
|
28898
|
+
);
|
|
28899
|
+
}
|
|
28900
|
+
function deriveJupLendLiquidityVaultAta(underlyingMint, liquidityPda, tokenProgramId = TOKEN_PROGRAM_ID) {
|
|
28901
|
+
return getAssociatedTokenAddressSync(
|
|
28902
|
+
underlyingMint,
|
|
28903
|
+
liquidityPda,
|
|
28904
|
+
true,
|
|
28905
|
+
tokenProgramId,
|
|
28906
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
28907
|
+
);
|
|
28908
|
+
}
|
|
28909
|
+
function deriveJupLendRateModel(asset, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28910
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28911
|
+
[Buffer.from(SEED_RATE_MODEL), asset.toBuffer()],
|
|
28912
|
+
liquidityProgramId
|
|
28913
|
+
);
|
|
28914
|
+
}
|
|
28915
|
+
function deriveJupLendLiquidity(liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28916
|
+
return web3_js.PublicKey.findProgramAddressSync([Buffer.from(SEED_LIQUIDITY)], liquidityProgramId);
|
|
28917
|
+
}
|
|
28918
|
+
function deriveJupLendClaimAccount(owner, mint, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28919
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28920
|
+
[Buffer.from(SEED_USER_CLAIM), owner.toBuffer(), mint.toBuffer()],
|
|
28921
|
+
liquidityProgramId
|
|
28922
|
+
);
|
|
28923
|
+
}
|
|
28924
|
+
function deriveJupLendLiquiditySupplyPositionPda(underlyingMint, lendingPda, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28925
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
28926
|
+
[Buffer.from(SEED_USER_SUPPLY_POSITION), underlyingMint.toBuffer(), lendingPda.toBuffer()],
|
|
28927
|
+
liquidityProgramId
|
|
28928
|
+
);
|
|
28929
|
+
}
|
|
28930
|
+
|
|
28931
|
+
// src/utils/accounting.utils.ts
|
|
28932
|
+
var aprToApy2 = (apr, compoundingFrequency = HOURS_PER_YEAR, apyCap = 3) => Math.min((1 + apr / compoundingFrequency) ** compoundingFrequency - 1, apyCap);
|
|
28933
|
+
|
|
28934
|
+
// src/vendor/jup-lend/utils/interest-rate.utils.ts
|
|
28935
|
+
var JUP_EXCHANGE_PRICES_PRECISION = new BN2__default.default("1000000000000");
|
|
28936
|
+
var JUP_SECONDS_PER_YEAR = new BN2__default.default(31536e3);
|
|
28937
|
+
var JUP_MAX_REWARDS_RATE = new BN2__default.default("50000000000000");
|
|
28938
|
+
function calculateJupLendTotalAssets(lendingState, fTokenTotalSupply) {
|
|
28939
|
+
return lendingState.tokenExchangePrice.mul(fTokenTotalSupply).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
28940
|
+
}
|
|
28941
|
+
function calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp) {
|
|
28942
|
+
const defaultResult = {
|
|
28943
|
+
rewardsRate: new BN2__default.default(0),
|
|
28944
|
+
rewardsEnded: false,
|
|
28945
|
+
rewardsStartTime: rewardsModel.startTime
|
|
28946
|
+
};
|
|
28947
|
+
if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
|
|
28948
|
+
return defaultResult;
|
|
28949
|
+
}
|
|
28950
|
+
if (currentTimestamp.gt(rewardsModel.startTime.add(rewardsModel.duration))) {
|
|
28951
|
+
return { ...defaultResult, rewardsEnded: true };
|
|
28952
|
+
}
|
|
28953
|
+
if (totalAssets.lt(rewardsModel.startTvl)) {
|
|
28954
|
+
return defaultResult;
|
|
28955
|
+
}
|
|
28956
|
+
let rewardsRate = rewardsModel.yearlyReward.mul(new BN2__default.default(1e4)).div(totalAssets);
|
|
28957
|
+
if (rewardsRate.gt(JUP_MAX_REWARDS_RATE)) {
|
|
28958
|
+
rewardsRate = JUP_MAX_REWARDS_RATE;
|
|
28959
|
+
}
|
|
28960
|
+
return {
|
|
28961
|
+
rewardsRate,
|
|
28962
|
+
rewardsEnded: false,
|
|
28963
|
+
rewardsStartTime: rewardsModel.startTime
|
|
28964
|
+
};
|
|
28965
|
+
}
|
|
28966
|
+
function calculateJupLendRewardsRateForExchangePrice(rewardsModel, totalAssets, currentTimestamp) {
|
|
28967
|
+
const defaultResult = { rate: new BN2__default.default(0), rewardsStartTime: rewardsModel.startTime };
|
|
28968
|
+
if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
|
|
28969
|
+
return defaultResult;
|
|
28970
|
+
}
|
|
28971
|
+
if (currentTimestamp.gt(rewardsModel.startTime.add(rewardsModel.duration))) {
|
|
28972
|
+
return defaultResult;
|
|
28973
|
+
}
|
|
28974
|
+
if (totalAssets.lt(rewardsModel.startTvl)) {
|
|
28975
|
+
return defaultResult;
|
|
28976
|
+
}
|
|
28977
|
+
let rate = rewardsModel.yearlyReward.mul(JUP_EXCHANGE_PRICES_PRECISION).div(totalAssets);
|
|
28978
|
+
if (rate.gt(JUP_MAX_REWARDS_RATE)) {
|
|
28979
|
+
rate = JUP_MAX_REWARDS_RATE;
|
|
28980
|
+
}
|
|
28981
|
+
return { rate, rewardsStartTime: rewardsModel.startTime };
|
|
28982
|
+
}
|
|
28983
|
+
function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply, currentTimestamp) {
|
|
28984
|
+
const oldTokenExchangePrice = lendingState.tokenExchangePrice;
|
|
28985
|
+
const oldLiquidityExchangePrice = lendingState.liquidityExchangePrice;
|
|
28986
|
+
const currentLiquidityExchangePrice = tokenReserve.supplyExchangePrice;
|
|
28987
|
+
let rewardsRate = new BN2__default.default(0);
|
|
28988
|
+
let rewardsStartTime = lendingState.lastUpdateTimestamp;
|
|
28989
|
+
if (rewardsModel) {
|
|
28990
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
28991
|
+
const result = calculateJupLendRewardsRateForExchangePrice(
|
|
28992
|
+
rewardsModel,
|
|
28993
|
+
totalAssets,
|
|
28994
|
+
currentTimestamp
|
|
28995
|
+
);
|
|
28996
|
+
rewardsRate = result.rate;
|
|
28997
|
+
rewardsStartTime = result.rewardsStartTime;
|
|
28998
|
+
}
|
|
28999
|
+
let lastUpdateTime = lendingState.lastUpdateTimestamp;
|
|
29000
|
+
if (lastUpdateTime.lt(rewardsStartTime)) {
|
|
29001
|
+
lastUpdateTime = rewardsStartTime;
|
|
29002
|
+
}
|
|
29003
|
+
const secondsElapsed = currentTimestamp.sub(lastUpdateTime);
|
|
29004
|
+
let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN2__default.default(100));
|
|
29005
|
+
const delta = currentLiquidityExchangePrice.sub(oldLiquidityExchangePrice);
|
|
29006
|
+
totalReturnPercent = totalReturnPercent.add(
|
|
29007
|
+
delta.mul(new BN2__default.default(1e14)).div(oldLiquidityExchangePrice)
|
|
29008
|
+
);
|
|
29009
|
+
return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN2__default.default(1e14)));
|
|
29010
|
+
}
|
|
29011
|
+
function calculateJupLendLiquiditySupplyRate(tokenReserve) {
|
|
29012
|
+
const borrowRate = new BN2__default.default(tokenReserve.borrowRate);
|
|
29013
|
+
const fee = new BN2__default.default(tokenReserve.feeOnInterest);
|
|
29014
|
+
if (tokenReserve.totalSupplyWithInterest.isZero()) {
|
|
29015
|
+
return new BN2__default.default(0);
|
|
29016
|
+
}
|
|
29017
|
+
const borrowWithInterestForRate = tokenReserve.totalBorrowWithInterest.mul(tokenReserve.borrowExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
29018
|
+
const supplyWithInterestForRate = tokenReserve.totalSupplyWithInterest.mul(tokenReserve.supplyExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
29019
|
+
if (supplyWithInterestForRate.isZero()) {
|
|
29020
|
+
return new BN2__default.default(0);
|
|
29021
|
+
}
|
|
29022
|
+
return borrowRate.mul(new BN2__default.default(1e4).sub(fee)).mul(borrowWithInterestForRate).div(supplyWithInterestForRate.mul(new BN2__default.default(1e4)));
|
|
29023
|
+
}
|
|
29024
|
+
function calculateJupLendSupplyRate(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply) {
|
|
29025
|
+
const supplyRate = calculateJupLendLiquiditySupplyRate(tokenReserve);
|
|
29026
|
+
let totalRateBps = supplyRate.toNumber();
|
|
29027
|
+
if (rewardsModel) {
|
|
29028
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
29029
|
+
const currentTimestamp = new BN2__default.default(Math.floor(Date.now() / 1e3));
|
|
29030
|
+
const { rewardsRate } = calculateJupLendRewardsRate(
|
|
29031
|
+
rewardsModel,
|
|
29032
|
+
totalAssets,
|
|
29033
|
+
currentTimestamp
|
|
29034
|
+
);
|
|
29035
|
+
totalRateBps += rewardsRate.toNumber();
|
|
29036
|
+
}
|
|
29037
|
+
return totalRateBps / 1e4;
|
|
29038
|
+
}
|
|
29039
|
+
function calculateJupLendSupplyAPY(tokenReserve) {
|
|
29040
|
+
const supplyRateBps = calculateJupLendLiquiditySupplyRate(tokenReserve);
|
|
29041
|
+
const apr = supplyRateBps.toNumber() / 1e4;
|
|
29042
|
+
return aprToApy2(apr);
|
|
29043
|
+
}
|
|
29044
|
+
function calculateJupLendBorrowRate(rateModel, utilizationBps) {
|
|
29045
|
+
const u = Math.max(0, Math.min(1e4, utilizationBps));
|
|
29046
|
+
if (rateModel.version === 2) {
|
|
29047
|
+
if (u <= rateModel.kink1Utilization) {
|
|
29048
|
+
return linearInterpolate(
|
|
29049
|
+
0,
|
|
29050
|
+
rateModel.rateAtZero,
|
|
29051
|
+
rateModel.kink1Utilization,
|
|
29052
|
+
rateModel.rateAtKink1,
|
|
29053
|
+
u
|
|
29054
|
+
);
|
|
29055
|
+
} else if (u <= rateModel.kink2Utilization) {
|
|
29056
|
+
return linearInterpolate(
|
|
29057
|
+
rateModel.kink1Utilization,
|
|
29058
|
+
rateModel.rateAtKink1,
|
|
29059
|
+
rateModel.kink2Utilization,
|
|
29060
|
+
rateModel.rateAtKink2,
|
|
29061
|
+
u
|
|
29062
|
+
);
|
|
29063
|
+
} else {
|
|
29064
|
+
return linearInterpolate(
|
|
29065
|
+
rateModel.kink2Utilization,
|
|
29066
|
+
rateModel.rateAtKink2,
|
|
29067
|
+
1e4,
|
|
29068
|
+
rateModel.rateAtMax,
|
|
29069
|
+
u
|
|
29070
|
+
);
|
|
29071
|
+
}
|
|
29072
|
+
} else {
|
|
29073
|
+
if (u <= rateModel.kink1Utilization) {
|
|
29074
|
+
return linearInterpolate(
|
|
29075
|
+
0,
|
|
29076
|
+
rateModel.rateAtZero,
|
|
29077
|
+
rateModel.kink1Utilization,
|
|
29078
|
+
rateModel.rateAtKink1,
|
|
29079
|
+
u
|
|
29080
|
+
);
|
|
29081
|
+
} else {
|
|
29082
|
+
return linearInterpolate(
|
|
29083
|
+
rateModel.kink1Utilization,
|
|
29084
|
+
rateModel.rateAtKink1,
|
|
29085
|
+
1e4,
|
|
29086
|
+
rateModel.rateAtMax,
|
|
29087
|
+
u
|
|
29088
|
+
);
|
|
29089
|
+
}
|
|
29090
|
+
}
|
|
29091
|
+
}
|
|
29092
|
+
function linearInterpolate(x0, y0, x1, y1, x) {
|
|
29093
|
+
if (x1 === x0) return y0;
|
|
29094
|
+
return y0 + (y1 - y0) * (x - x0) / (x1 - x0);
|
|
29095
|
+
}
|
|
29096
|
+
function generateJupLendSupplyCurve(rateModel, feeOnInterest) {
|
|
29097
|
+
const feeMultiplier = 1 - feeOnInterest / 1e4;
|
|
29098
|
+
return Array.from({ length: 101 }, (_, i) => {
|
|
29099
|
+
const utilizationFraction = i / 100;
|
|
29100
|
+
const utilizationBps = i * 100;
|
|
29101
|
+
const borrowRateBps = calculateJupLendBorrowRate(rateModel, utilizationBps);
|
|
29102
|
+
const borrowRateDecimal = borrowRateBps / 1e4;
|
|
29103
|
+
const supplyAPR = borrowRateDecimal * feeMultiplier * utilizationFraction;
|
|
29104
|
+
const supplyAPY = aprToApy2(supplyAPR);
|
|
29105
|
+
return {
|
|
29106
|
+
utilization: i,
|
|
29107
|
+
// 0-100
|
|
29108
|
+
supplyAPY: supplyAPY * 100
|
|
29109
|
+
// Convert to percentage
|
|
29110
|
+
};
|
|
29111
|
+
});
|
|
29112
|
+
}
|
|
29113
|
+
function getJupLendRewards(lendingState, rewardsModel, fTokenTotalSupply) {
|
|
29114
|
+
if (lendingState.rewardsRateModel.equals(web3_js.PublicKey.default)) {
|
|
29115
|
+
return {
|
|
29116
|
+
rewardsRate: new BN2__default.default(0),
|
|
29117
|
+
rewardsEnded: false,
|
|
29118
|
+
rewardsStartTime: new BN2__default.default(0)
|
|
29119
|
+
};
|
|
29120
|
+
}
|
|
29121
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
29122
|
+
const currentTimestamp = new BN2__default.default(Math.floor(Date.now() / 1e3));
|
|
29123
|
+
return calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp);
|
|
29124
|
+
}
|
|
29125
|
+
var UPDATE_RATE_DISCRIMINATOR = Buffer.from([
|
|
29126
|
+
24,
|
|
29127
|
+
225,
|
|
29128
|
+
53,
|
|
29129
|
+
189,
|
|
29130
|
+
72,
|
|
29131
|
+
212,
|
|
29132
|
+
225,
|
|
29133
|
+
178
|
|
29134
|
+
]);
|
|
29135
|
+
var makeUpdateJupLendRateIx = (lending, mint, fTokenMint, supplyTokenReservesLiquidity, rewardsRateModel) => {
|
|
29136
|
+
const keys = [
|
|
29137
|
+
// lending: writable (exchange prices are updated)
|
|
29138
|
+
{ pubkey: lending, isSigner: false, isWritable: true },
|
|
29139
|
+
// mint: read-only
|
|
29140
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
29141
|
+
// fTokenMint: read-only
|
|
29142
|
+
{ pubkey: fTokenMint, isSigner: false, isWritable: false },
|
|
29143
|
+
// supplyTokenReservesLiquidity: read-only
|
|
29144
|
+
{ pubkey: supplyTokenReservesLiquidity, isSigner: false, isWritable: false },
|
|
29145
|
+
// rewardsRateModel: read-only
|
|
29146
|
+
{ pubkey: rewardsRateModel, isSigner: false, isWritable: false }
|
|
29147
|
+
];
|
|
29148
|
+
return new web3_js.TransactionInstruction({
|
|
29149
|
+
keys,
|
|
29150
|
+
programId: JUP_LEND_PROGRAM_ID,
|
|
29151
|
+
data: UPDATE_RATE_DISCRIMINATOR
|
|
29152
|
+
});
|
|
29153
|
+
};
|
|
29154
|
+
|
|
29155
|
+
// src/vendor/jup-lend/actions/update-rate.ts
|
|
29156
|
+
function makeUpdateJupLendRate({ lendingState }) {
|
|
29157
|
+
return makeUpdateJupLendRateIx(
|
|
29158
|
+
lendingState.pubkey,
|
|
29159
|
+
lendingState.mint,
|
|
29160
|
+
lendingState.fTokenMint,
|
|
29161
|
+
lendingState.tokenReservesLiquidity,
|
|
29162
|
+
lendingState.rewardsRateModel
|
|
29163
|
+
);
|
|
29164
|
+
}
|
|
28288
29165
|
|
|
28289
29166
|
exports.ACCOUNT_SIZE = ACCOUNT_SIZE;
|
|
28290
29167
|
exports.ACCOUNT_TYPE_SIZE = ACCOUNT_TYPE_SIZE;
|
|
@@ -28299,6 +29176,13 @@ exports.DRIFT_PROGRAM_ID = DRIFT_PROGRAM_ID;
|
|
|
28299
29176
|
exports.DriftSpotBalanceType = DriftSpotBalanceType;
|
|
28300
29177
|
exports.ExtensionType = ExtensionType;
|
|
28301
29178
|
exports.FARMS_PROGRAM_ID = FARMS_PROGRAM_ID;
|
|
29179
|
+
exports.JUP_EXCHANGE_PRICES_PRECISION = JUP_EXCHANGE_PRICES_PRECISION;
|
|
29180
|
+
exports.JUP_LEND_IDL = JUP_LEND_IDL;
|
|
29181
|
+
exports.JUP_LEND_PROGRAM_ID = JUP_LEND_PROGRAM_ID;
|
|
29182
|
+
exports.JUP_LIQUIDITY_PROGRAM_ID = JUP_LIQUIDITY_PROGRAM_ID;
|
|
29183
|
+
exports.JUP_MAX_REWARDS_RATE = JUP_MAX_REWARDS_RATE;
|
|
29184
|
+
exports.JUP_REWARDS_PROGRAM_ID = JUP_REWARDS_PROGRAM_ID;
|
|
29185
|
+
exports.JUP_SECONDS_PER_YEAR = JUP_SECONDS_PER_YEAR;
|
|
28302
29186
|
exports.KFARMS_IDL = KFARMS_IDL;
|
|
28303
29187
|
exports.KLEND_ACCOUNT_CODER = KLEND_ACCOUNT_CODER;
|
|
28304
29188
|
exports.KLEND_IDL = KLEND_IDL;
|
|
@@ -28326,15 +29210,24 @@ exports.SEED_BASE_USER_METADATA = SEED_BASE_USER_METADATA;
|
|
|
28326
29210
|
exports.SEED_DRIFT_SIGNER = SEED_DRIFT_SIGNER;
|
|
28327
29211
|
exports.SEED_DRIFT_STATE = SEED_DRIFT_STATE;
|
|
28328
29212
|
exports.SEED_FEE_RECEIVER = SEED_FEE_RECEIVER;
|
|
29213
|
+
exports.SEED_F_TOKEN_MINT = SEED_F_TOKEN_MINT;
|
|
29214
|
+
exports.SEED_LENDING = SEED_LENDING;
|
|
29215
|
+
exports.SEED_LENDING_ADMIN = SEED_LENDING_ADMIN;
|
|
28329
29216
|
exports.SEED_LENDING_MARKET_AUTH = SEED_LENDING_MARKET_AUTH;
|
|
29217
|
+
exports.SEED_LENDING_REWARDS_RATE_MODEL = SEED_LENDING_REWARDS_RATE_MODEL;
|
|
29218
|
+
exports.SEED_LIQUIDITY = SEED_LIQUIDITY;
|
|
29219
|
+
exports.SEED_RATE_MODEL = SEED_RATE_MODEL;
|
|
29220
|
+
exports.SEED_RESERVE = SEED_RESERVE;
|
|
28330
29221
|
exports.SEED_RESERVE_COLL_MINT = SEED_RESERVE_COLL_MINT;
|
|
28331
29222
|
exports.SEED_RESERVE_COLL_SUPPLY = SEED_RESERVE_COLL_SUPPLY;
|
|
28332
29223
|
exports.SEED_RESERVE_LIQ_SUPPLY = SEED_RESERVE_LIQ_SUPPLY;
|
|
28333
29224
|
exports.SEED_SPOT_MARKET = SEED_SPOT_MARKET;
|
|
28334
29225
|
exports.SEED_SPOT_MARKET_VAULT = SEED_SPOT_MARKET_VAULT;
|
|
28335
29226
|
exports.SEED_USER = SEED_USER;
|
|
29227
|
+
exports.SEED_USER_CLAIM = SEED_USER_CLAIM;
|
|
28336
29228
|
exports.SEED_USER_STATE = SEED_USER_STATE;
|
|
28337
29229
|
exports.SEED_USER_STATS = SEED_USER_STATS;
|
|
29230
|
+
exports.SEED_USER_SUPPLY_POSITION = SEED_USER_SUPPLY_POSITION;
|
|
28338
29231
|
exports.SLOTS_PER_DAY = SLOTS_PER_DAY;
|
|
28339
29232
|
exports.SLOTS_PER_HOUR = SLOTS_PER_HOUR;
|
|
28340
29233
|
exports.SLOTS_PER_MINUTE = SLOTS_PER_MINUTE;
|
|
@@ -28377,6 +29270,14 @@ exports.calculateDriftInterestRate = calculateDriftInterestRate;
|
|
|
28377
29270
|
exports.calculateDriftLendingAPR = calculateDriftLendingAPR;
|
|
28378
29271
|
exports.calculateDriftLendingAPY = calculateDriftLendingAPY;
|
|
28379
29272
|
exports.calculateDriftUtilization = calculateDriftUtilization;
|
|
29273
|
+
exports.calculateJupLendBorrowRate = calculateJupLendBorrowRate;
|
|
29274
|
+
exports.calculateJupLendLiquiditySupplyRate = calculateJupLendLiquiditySupplyRate;
|
|
29275
|
+
exports.calculateJupLendNewExchangePrice = calculateJupLendNewExchangePrice;
|
|
29276
|
+
exports.calculateJupLendRewardsRate = calculateJupLendRewardsRate;
|
|
29277
|
+
exports.calculateJupLendRewardsRateForExchangePrice = calculateJupLendRewardsRateForExchangePrice;
|
|
29278
|
+
exports.calculateJupLendSupplyAPY = calculateJupLendSupplyAPY;
|
|
29279
|
+
exports.calculateJupLendSupplyRate = calculateJupLendSupplyRate;
|
|
29280
|
+
exports.calculateJupLendTotalAssets = calculateJupLendTotalAssets;
|
|
28380
29281
|
exports.calculateKaminoEstimatedBorrowRate = calculateKaminoEstimatedBorrowRate;
|
|
28381
29282
|
exports.calculateKaminoEstimatedSupplyRate = calculateKaminoEstimatedSupplyRate;
|
|
28382
29283
|
exports.calculateKaminoSupplyAPY = calculateKaminoSupplyAPY;
|
|
@@ -28398,6 +29299,10 @@ exports.decodeDriftStateData = decodeDriftStateData;
|
|
|
28398
29299
|
exports.decodeDriftUserData = decodeDriftUserData;
|
|
28399
29300
|
exports.decodeDriftUserStatsData = decodeDriftUserStatsData;
|
|
28400
29301
|
exports.decodeFarmDataRaw = decodeFarmDataRaw;
|
|
29302
|
+
exports.decodeJupLendingRewardsRateModelData = decodeJupLendingRewardsRateModelData;
|
|
29303
|
+
exports.decodeJupLendingStateData = decodeJupLendingStateData;
|
|
29304
|
+
exports.decodeJupRateModelData = decodeJupRateModelData;
|
|
29305
|
+
exports.decodeJupTokenReserveData = decodeJupTokenReserveData;
|
|
28401
29306
|
exports.decodeKlendObligationData = decodeKlendObligationData;
|
|
28402
29307
|
exports.decodeKlendReserveData = decodeKlendReserveData;
|
|
28403
29308
|
exports.decodeSwitchboardPullFeedData = decodeSwitchboardPullFeedData;
|
|
@@ -28409,6 +29314,17 @@ exports.deriveDriftState = deriveDriftState;
|
|
|
28409
29314
|
exports.deriveDriftUser = deriveDriftUser;
|
|
28410
29315
|
exports.deriveDriftUserStats = deriveDriftUserStats;
|
|
28411
29316
|
exports.deriveFeeReceiver = deriveFeeReceiver;
|
|
29317
|
+
exports.deriveJupLendClaimAccount = deriveJupLendClaimAccount;
|
|
29318
|
+
exports.deriveJupLendFTokenMint = deriveJupLendFTokenMint;
|
|
29319
|
+
exports.deriveJupLendLending = deriveJupLendLending;
|
|
29320
|
+
exports.deriveJupLendLendingAdmin = deriveJupLendLendingAdmin;
|
|
29321
|
+
exports.deriveJupLendLendingPdas = deriveJupLendLendingPdas;
|
|
29322
|
+
exports.deriveJupLendLendingRewardsRateModel = deriveJupLendLendingRewardsRateModel;
|
|
29323
|
+
exports.deriveJupLendLiquidity = deriveJupLendLiquidity;
|
|
29324
|
+
exports.deriveJupLendLiquiditySupplyPositionPda = deriveJupLendLiquiditySupplyPositionPda;
|
|
29325
|
+
exports.deriveJupLendLiquidityVaultAta = deriveJupLendLiquidityVaultAta;
|
|
29326
|
+
exports.deriveJupLendRateModel = deriveJupLendRateModel;
|
|
29327
|
+
exports.deriveJupLendTokenReserve = deriveJupLendTokenReserve;
|
|
28412
29328
|
exports.deriveLendingMarketAuthority = deriveLendingMarketAuthority;
|
|
28413
29329
|
exports.deriveObligation = deriveObligation;
|
|
28414
29330
|
exports.deriveReferrerState = deriveReferrerState;
|
|
@@ -28430,6 +29346,10 @@ exports.dtoToDriftStateRaw = dtoToDriftStateRaw;
|
|
|
28430
29346
|
exports.dtoToDriftUserRaw = dtoToDriftUserRaw;
|
|
28431
29347
|
exports.dtoToDriftUserStatsRaw = dtoToDriftUserStatsRaw;
|
|
28432
29348
|
exports.dtoToFarmRaw = dtoToFarmRaw;
|
|
29349
|
+
exports.dtoToJupLendingRewardsRateModelRaw = dtoToJupLendingRewardsRateModelRaw;
|
|
29350
|
+
exports.dtoToJupLendingStateRaw = dtoToJupLendingStateRaw;
|
|
29351
|
+
exports.dtoToJupRateModelRaw = dtoToJupRateModelRaw;
|
|
29352
|
+
exports.dtoToJupTokenReserveRaw = dtoToJupTokenReserveRaw;
|
|
28433
29353
|
exports.dtoToObligationRaw = dtoToObligationRaw;
|
|
28434
29354
|
exports.dtoToReserveRaw = dtoToReserveRaw;
|
|
28435
29355
|
exports.farmRawToDto = farmRawToDto;
|
|
@@ -28443,16 +29363,19 @@ exports.findPoolOnRampAddress = findPoolOnRampAddress;
|
|
|
28443
29363
|
exports.findPoolStakeAddress = findPoolStakeAddress;
|
|
28444
29364
|
exports.findPoolStakeAuthorityAddress = findPoolStakeAuthorityAddress;
|
|
28445
29365
|
exports.generateDriftReserveCurve = generateDriftReserveCurve;
|
|
29366
|
+
exports.generateJupLendSupplyCurve = generateJupLendSupplyCurve;
|
|
28446
29367
|
exports.generateKaminoReserveCurve = generateKaminoReserveCurve;
|
|
28447
29368
|
exports.getAccount = getAccount;
|
|
28448
29369
|
exports.getAccountLen = getAccountLen;
|
|
28449
29370
|
exports.getAllDerivedDriftAccounts = getAllDerivedDriftAccounts;
|
|
29371
|
+
exports.getAllDerivedJupLendAccounts = getAllDerivedJupLendAccounts;
|
|
28450
29372
|
exports.getAllDerivedKaminoAccounts = getAllDerivedKaminoAccounts;
|
|
28451
29373
|
exports.getAllRequiredMarkets = getAllRequiredMarkets;
|
|
28452
29374
|
exports.getAssociatedTokenAddressSync = getAssociatedTokenAddressSync;
|
|
28453
29375
|
exports.getDriftRewards = getDriftRewards;
|
|
28454
29376
|
exports.getDriftTokenAmount = getDriftTokenAmount;
|
|
28455
29377
|
exports.getFixedHostInterestRate = getFixedHostInterestRate;
|
|
29378
|
+
exports.getJupLendRewards = getJupLendRewards;
|
|
28456
29379
|
exports.getKaminoBorrowRate = getKaminoBorrowRate;
|
|
28457
29380
|
exports.getKaminoTotalSupply = getKaminoTotalSupply;
|
|
28458
29381
|
exports.getMinimumBalanceForRentExemptAccount = getMinimumBalanceForRentExemptAccount;
|
|
@@ -28469,10 +29392,16 @@ exports.initializeStakedPoolIxs = initializeStakedPoolIxs;
|
|
|
28469
29392
|
exports.initializeStakedPoolTx = initializeStakedPoolTx;
|
|
28470
29393
|
exports.interpolateLinear = interpolateLinear;
|
|
28471
29394
|
exports.isSpotBalanceTypeVariant = isSpotBalanceTypeVariant;
|
|
29395
|
+
exports.jupLendingRewardsRateModelRawToDto = jupLendingRewardsRateModelRawToDto;
|
|
29396
|
+
exports.jupLendingStateRawToDto = jupLendingStateRawToDto;
|
|
29397
|
+
exports.jupRateModelRawToDto = jupRateModelRawToDto;
|
|
29398
|
+
exports.jupTokenReserveRawToDto = jupTokenReserveRawToDto;
|
|
28472
29399
|
exports.layout = layout;
|
|
28473
29400
|
exports.makeRefreshObligationIx = makeRefreshObligationIx;
|
|
28474
29401
|
exports.makeRefreshReservesBatchIx = makeRefreshReservesBatchIx;
|
|
28475
29402
|
exports.makeRefreshingIxs = makeRefreshingIxs;
|
|
29403
|
+
exports.makeUpdateJupLendRate = makeUpdateJupLendRate;
|
|
29404
|
+
exports.makeUpdateJupLendRateIx = makeUpdateJupLendRateIx;
|
|
28476
29405
|
exports.makeUpdateSpotMarketCumulativeInterestIx = makeUpdateSpotMarketCumulativeInterestIx;
|
|
28477
29406
|
exports.makeUpdateSpotMarketIx = makeUpdateSpotMarketIx;
|
|
28478
29407
|
exports.obligationRawToDto = obligationRawToDto;
|