@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.js
CHANGED
|
@@ -239,6 +239,10 @@ var SYSVAR_STAKE_HISTORY_ID = new PublicKey(
|
|
|
239
239
|
new PublicKey(
|
|
240
240
|
"StakeConfig11111111111111111111111111111111"
|
|
241
241
|
);
|
|
242
|
+
|
|
243
|
+
// src/constants/misc.consts.ts
|
|
244
|
+
var HOURS_PER_YEAR = 365.25 * 24;
|
|
245
|
+
BigInt("18446744073709551615").toString();
|
|
242
246
|
new PublicKey("So11111111111111111111111111111111111111112");
|
|
243
247
|
new PublicKey("LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp");
|
|
244
248
|
var USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
@@ -28260,7 +28264,880 @@ function makeUpdateSpotMarketIx({ spotMarket }) {
|
|
|
28260
28264
|
spotMarketVault
|
|
28261
28265
|
);
|
|
28262
28266
|
}
|
|
28267
|
+
var JUP_LEND_PROGRAM_ID = new PublicKey("jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9");
|
|
28268
|
+
var JUP_LIQUIDITY_PROGRAM_ID = new PublicKey(
|
|
28269
|
+
"jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC"
|
|
28270
|
+
);
|
|
28271
|
+
var JUP_REWARDS_PROGRAM_ID = new PublicKey("jup7TthsMgcR9Y3L277b8Eo9uboVSmu1utkuXHNUKar");
|
|
28272
|
+
|
|
28273
|
+
// src/vendor/jup-lend/idl/jup-lend.json
|
|
28274
|
+
var jup_lend_default = {
|
|
28275
|
+
address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9",
|
|
28276
|
+
metadata: {
|
|
28277
|
+
name: "lending",
|
|
28278
|
+
version: "0.1.0",
|
|
28279
|
+
spec: "0.1.0",
|
|
28280
|
+
description: "Created with Anchor"
|
|
28281
|
+
},
|
|
28282
|
+
instructions: [
|
|
28283
|
+
{
|
|
28284
|
+
name: "deposit",
|
|
28285
|
+
discriminator: [242, 35, 198, 137, 82, 225, 242, 182],
|
|
28286
|
+
accounts: [
|
|
28287
|
+
{ name: "signer", writable: true, signer: true },
|
|
28288
|
+
{ name: "depositor_token_account", writable: true },
|
|
28289
|
+
{ name: "recipient_token_account", writable: true },
|
|
28290
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28291
|
+
{ name: "lending_admin" },
|
|
28292
|
+
{ name: "lending", writable: true },
|
|
28293
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28294
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28295
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28296
|
+
{ name: "rate_model" },
|
|
28297
|
+
{ name: "vault", writable: true },
|
|
28298
|
+
{ name: "liquidity", writable: true },
|
|
28299
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28300
|
+
{ name: "rewards_rate_model" },
|
|
28301
|
+
{ name: "token_program" },
|
|
28302
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28303
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28304
|
+
],
|
|
28305
|
+
args: [{ name: "assets", type: "u64" }],
|
|
28306
|
+
returns: "u64"
|
|
28307
|
+
},
|
|
28308
|
+
{
|
|
28309
|
+
name: "mint",
|
|
28310
|
+
discriminator: [51, 57, 225, 47, 182, 146, 137, 166],
|
|
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: "shares", type: "u64" }],
|
|
28331
|
+
returns: "u64"
|
|
28332
|
+
},
|
|
28333
|
+
{
|
|
28334
|
+
name: "withdraw",
|
|
28335
|
+
discriminator: [183, 18, 70, 156, 148, 109, 161, 34],
|
|
28336
|
+
accounts: [
|
|
28337
|
+
{ name: "signer", writable: true, signer: true },
|
|
28338
|
+
{ name: "owner_token_account", writable: true },
|
|
28339
|
+
{ name: "recipient_token_account", writable: true },
|
|
28340
|
+
{ name: "lending_admin" },
|
|
28341
|
+
{ name: "lending", writable: true },
|
|
28342
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
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: "claim_account", writable: true },
|
|
28349
|
+
{ name: "liquidity", writable: true },
|
|
28350
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28351
|
+
{ name: "rewards_rate_model" },
|
|
28352
|
+
{ name: "token_program" },
|
|
28353
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28354
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28355
|
+
],
|
|
28356
|
+
args: [{ name: "amount", type: "u64" }],
|
|
28357
|
+
returns: "u64"
|
|
28358
|
+
},
|
|
28359
|
+
{
|
|
28360
|
+
name: "redeem",
|
|
28361
|
+
discriminator: [184, 12, 86, 149, 70, 196, 97, 225],
|
|
28362
|
+
accounts: [
|
|
28363
|
+
{ name: "signer", writable: true, signer: true },
|
|
28364
|
+
{ name: "owner_token_account", writable: true },
|
|
28365
|
+
{ name: "recipient_token_account", writable: true },
|
|
28366
|
+
{ name: "lending_admin" },
|
|
28367
|
+
{ name: "lending", writable: true },
|
|
28368
|
+
{ name: "mint", relations: ["lending", "rewards_rate_model"] },
|
|
28369
|
+
{ name: "f_token_mint", writable: true, relations: ["lending"] },
|
|
28370
|
+
{ name: "supply_token_reserves_liquidity", writable: true },
|
|
28371
|
+
{ name: "lending_supply_position_on_liquidity", writable: true },
|
|
28372
|
+
{ name: "rate_model" },
|
|
28373
|
+
{ name: "vault", writable: true },
|
|
28374
|
+
{ name: "claim_account", writable: true },
|
|
28375
|
+
{ name: "liquidity", writable: true },
|
|
28376
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28377
|
+
{ name: "rewards_rate_model" },
|
|
28378
|
+
{ name: "token_program" },
|
|
28379
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28380
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28381
|
+
],
|
|
28382
|
+
args: [{ name: "shares", type: "u64" }],
|
|
28383
|
+
returns: "u64"
|
|
28384
|
+
},
|
|
28385
|
+
{
|
|
28386
|
+
name: "rebalance",
|
|
28387
|
+
discriminator: [108, 158, 77, 9, 210, 52, 88, 62],
|
|
28388
|
+
accounts: [
|
|
28389
|
+
{ name: "signer", writable: true, signer: true },
|
|
28390
|
+
{ name: "depositor_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", writable: true },
|
|
28398
|
+
{ name: "vault", writable: true },
|
|
28399
|
+
{ name: "liquidity", writable: true },
|
|
28400
|
+
{ name: "liquidity_program", writable: true, relations: ["lending_admin"] },
|
|
28401
|
+
{ name: "rewards_rate_model" },
|
|
28402
|
+
{ name: "token_program" },
|
|
28403
|
+
{ name: "associated_token_program", address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" },
|
|
28404
|
+
{ name: "system_program", address: "11111111111111111111111111111111" }
|
|
28405
|
+
],
|
|
28406
|
+
args: []
|
|
28407
|
+
},
|
|
28408
|
+
{
|
|
28409
|
+
name: "update_rate",
|
|
28410
|
+
discriminator: [24, 225, 53, 189, 72, 212, 225, 178],
|
|
28411
|
+
accounts: [
|
|
28412
|
+
{ name: "lending", writable: true },
|
|
28413
|
+
{ name: "mint", relations: ["lending", "supply_token_reserves_liquidity"] },
|
|
28414
|
+
{ name: "f_token_mint", relations: ["lending"] },
|
|
28415
|
+
{ name: "supply_token_reserves_liquidity" },
|
|
28416
|
+
{ name: "rewards_rate_model" }
|
|
28417
|
+
],
|
|
28418
|
+
args: []
|
|
28419
|
+
}
|
|
28420
|
+
],
|
|
28421
|
+
accounts: [
|
|
28422
|
+
{ name: "Lending", discriminator: [135, 199, 82, 16, 249, 131, 182, 241] },
|
|
28423
|
+
{ name: "LendingAdmin", discriminator: [42, 8, 33, 220, 163, 40, 210, 5] },
|
|
28424
|
+
{ name: "LendingRewardsRateModel", discriminator: [166, 72, 71, 131, 172, 74, 166, 181] },
|
|
28425
|
+
{ name: "TokenReserve", discriminator: [21, 18, 59, 135, 120, 20, 31, 12] },
|
|
28426
|
+
{ name: "UserSupplyPosition", discriminator: [202, 219, 136, 118, 61, 177, 21, 146] }
|
|
28427
|
+
],
|
|
28428
|
+
errors: [
|
|
28429
|
+
{ code: 6e3, name: "FTokenDepositInsignificant", msg: "F_TOKEN_DEPOSIT_INSIGNIFICANT" },
|
|
28430
|
+
{ code: 6001, name: "FTokenMinAmountOut", msg: "F_TOKEN_MIN_AMOUNT_OUT" },
|
|
28431
|
+
{ code: 6002, name: "FTokenMaxAmount", msg: "F_TOKEN_MAX_AMOUNT" },
|
|
28432
|
+
{ code: 6003, name: "FTokenInvalidParams", msg: "F_TOKEN_INVALID_PARAMS" },
|
|
28433
|
+
{ code: 6004, name: "FTokenRewardsRateModelAlreadySet", msg: "F_TOKEN_REWARDS_RATE_MODEL_ALREADY_SET" },
|
|
28434
|
+
{ code: 6005, name: "FTokenMaxAuthCountReached", msg: "F_TOKEN_MAX_AUTH_COUNT" },
|
|
28435
|
+
{ code: 6006, name: "FTokenLiquidityExchangePriceUnexpected", msg: "F_TOKEN_LIQUIDITY_EXCHANGE_PRICE_UNEXPECTED" },
|
|
28436
|
+
{ code: 6007, name: "FTokenCpiToLiquidityFailed", msg: "F_TOKEN_CPI_TO_LIQUIDITY_FAILED" },
|
|
28437
|
+
{ code: 6008, name: "FTokenOnlyAuth", msg: "F_TOKEN_ONLY_AUTH" },
|
|
28438
|
+
{ code: 6009, name: "FTokenOnlyAuthority", msg: "F_TOKEN_ONLY_AUTHORITY" },
|
|
28439
|
+
{ code: 6010, name: "FTokenOnlyRebalancer", msg: "F_TOKEN_ONLY_REBALANCER" },
|
|
28440
|
+
{ code: 6011, name: "FTokenUserSupplyPositionRequired", msg: "F_TOKEN_USER_SUPPLY_POSITION_REQUIRED" },
|
|
28441
|
+
{ code: 6012, name: "FTokenLiquidityProgramMismatch", msg: "F_TOKEN_LIQUIDITY_PROGRAM_MISMATCH" }
|
|
28442
|
+
],
|
|
28443
|
+
types: [
|
|
28444
|
+
{
|
|
28445
|
+
name: "AddressBool",
|
|
28446
|
+
type: {
|
|
28447
|
+
kind: "struct",
|
|
28448
|
+
fields: [
|
|
28449
|
+
{ name: "addr", type: "pubkey" },
|
|
28450
|
+
{ name: "value", type: "bool" }
|
|
28451
|
+
]
|
|
28452
|
+
}
|
|
28453
|
+
},
|
|
28454
|
+
{
|
|
28455
|
+
name: "Lending",
|
|
28456
|
+
type: {
|
|
28457
|
+
kind: "struct",
|
|
28458
|
+
fields: [
|
|
28459
|
+
{ name: "mint", type: "pubkey" },
|
|
28460
|
+
{ name: "f_token_mint", type: "pubkey" },
|
|
28461
|
+
{ name: "lending_id", type: "u16" },
|
|
28462
|
+
{ name: "decimals", type: "u8" },
|
|
28463
|
+
{ name: "rewards_rate_model", type: "pubkey" },
|
|
28464
|
+
{ name: "liquidity_exchange_price", type: "u64" },
|
|
28465
|
+
{ name: "token_exchange_price", type: "u64" },
|
|
28466
|
+
{ name: "last_update_timestamp", type: "u64" },
|
|
28467
|
+
{ name: "token_reserves_liquidity", type: "pubkey" },
|
|
28468
|
+
{ name: "supply_position_on_liquidity", type: "pubkey" },
|
|
28469
|
+
{ name: "bump", type: "u8" }
|
|
28470
|
+
]
|
|
28471
|
+
}
|
|
28472
|
+
},
|
|
28473
|
+
{
|
|
28474
|
+
name: "LendingAdmin",
|
|
28475
|
+
type: {
|
|
28476
|
+
kind: "struct",
|
|
28477
|
+
fields: [
|
|
28478
|
+
{ name: "authority", type: "pubkey" },
|
|
28479
|
+
{ name: "liquidity_program", type: "pubkey" },
|
|
28480
|
+
{ name: "rebalancer", type: "pubkey" },
|
|
28481
|
+
{ name: "next_lending_id", type: "u16" },
|
|
28482
|
+
{ name: "auths", type: { vec: "pubkey" } },
|
|
28483
|
+
{ name: "bump", type: "u8" }
|
|
28484
|
+
]
|
|
28485
|
+
}
|
|
28486
|
+
},
|
|
28487
|
+
{
|
|
28488
|
+
name: "LendingRewardsRateModel",
|
|
28489
|
+
type: {
|
|
28490
|
+
kind: "struct",
|
|
28491
|
+
fields: [
|
|
28492
|
+
{ name: "mint", type: "pubkey" },
|
|
28493
|
+
{ name: "start_tvl", type: "u64" },
|
|
28494
|
+
{ name: "duration", type: "u64" },
|
|
28495
|
+
{ name: "start_time", type: "u64" },
|
|
28496
|
+
{ name: "yearly_reward", type: "u64" },
|
|
28497
|
+
{ name: "next_duration", type: "u64" },
|
|
28498
|
+
{ name: "next_reward_amount", type: "u64" },
|
|
28499
|
+
{ name: "bump", type: "u8" }
|
|
28500
|
+
]
|
|
28501
|
+
}
|
|
28502
|
+
},
|
|
28503
|
+
{
|
|
28504
|
+
name: "TokenReserve",
|
|
28505
|
+
serialization: "bytemuck",
|
|
28506
|
+
repr: { kind: "c", packed: true },
|
|
28507
|
+
type: {
|
|
28508
|
+
kind: "struct",
|
|
28509
|
+
fields: [
|
|
28510
|
+
{ name: "mint", type: "pubkey" },
|
|
28511
|
+
{ name: "vault", type: "pubkey" },
|
|
28512
|
+
{ name: "borrow_rate", type: "u16" },
|
|
28513
|
+
{ name: "fee_on_interest", type: "u16" },
|
|
28514
|
+
{ name: "last_utilization", type: "u16" },
|
|
28515
|
+
{ name: "last_update_timestamp", type: "u64" },
|
|
28516
|
+
{ name: "supply_exchange_price", type: "u64" },
|
|
28517
|
+
{ name: "borrow_exchange_price", type: "u64" },
|
|
28518
|
+
{ name: "max_utilization", type: "u16" },
|
|
28519
|
+
{ name: "total_supply_with_interest", type: "u64" },
|
|
28520
|
+
{ name: "total_supply_interest_free", type: "u64" },
|
|
28521
|
+
{ name: "total_borrow_with_interest", type: "u64" },
|
|
28522
|
+
{ name: "total_borrow_interest_free", type: "u64" },
|
|
28523
|
+
{ name: "total_claim_amount", type: "u64" },
|
|
28524
|
+
{ name: "interacting_protocol", type: "pubkey" },
|
|
28525
|
+
{ name: "interacting_timestamp", type: "u64" },
|
|
28526
|
+
{ name: "interacting_balance", type: "u64" }
|
|
28527
|
+
]
|
|
28528
|
+
}
|
|
28529
|
+
},
|
|
28530
|
+
{
|
|
28531
|
+
name: "UserSupplyPosition",
|
|
28532
|
+
serialization: "bytemuck",
|
|
28533
|
+
repr: { kind: "c", packed: true },
|
|
28534
|
+
type: {
|
|
28535
|
+
kind: "struct",
|
|
28536
|
+
fields: [
|
|
28537
|
+
{ name: "protocol", type: "pubkey" },
|
|
28538
|
+
{ name: "mint", type: "pubkey" },
|
|
28539
|
+
{ name: "with_interest", type: "u8" },
|
|
28540
|
+
{ name: "amount", type: "u64" },
|
|
28541
|
+
{ name: "withdrawal_limit", type: "u128" },
|
|
28542
|
+
{ name: "last_update", type: "u64" },
|
|
28543
|
+
{ name: "expand_pct", type: "u16" },
|
|
28544
|
+
{ name: "expand_duration", type: "u64" },
|
|
28545
|
+
{ name: "base_withdrawal_limit", type: "u64" },
|
|
28546
|
+
{ name: "status", type: "u8" }
|
|
28547
|
+
]
|
|
28548
|
+
}
|
|
28549
|
+
}
|
|
28550
|
+
]
|
|
28551
|
+
};
|
|
28552
|
+
|
|
28553
|
+
// src/vendor/jup-lend/idl/index.ts
|
|
28554
|
+
var JUP_LEND_IDL = jup_lend_default;
|
|
28555
|
+
|
|
28556
|
+
// src/vendor/jup-lend/utils/serialize.utils.ts
|
|
28557
|
+
function jupLendingStateRawToDto(raw) {
|
|
28558
|
+
return {
|
|
28559
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28560
|
+
mint: raw.mint.toBase58(),
|
|
28561
|
+
fTokenMint: raw.fTokenMint.toBase58(),
|
|
28562
|
+
lendingId: raw.lendingId,
|
|
28563
|
+
decimals: raw.decimals,
|
|
28564
|
+
rewardsRateModel: raw.rewardsRateModel.toBase58(),
|
|
28565
|
+
liquidityExchangePrice: raw.liquidityExchangePrice.toString(),
|
|
28566
|
+
tokenExchangePrice: raw.tokenExchangePrice.toString(),
|
|
28567
|
+
lastUpdateTimestamp: raw.lastUpdateTimestamp.toString(),
|
|
28568
|
+
tokenReservesLiquidity: raw.tokenReservesLiquidity.toBase58(),
|
|
28569
|
+
supplyPositionOnLiquidity: raw.supplyPositionOnLiquidity.toBase58()
|
|
28570
|
+
};
|
|
28571
|
+
}
|
|
28572
|
+
function jupTokenReserveRawToDto(raw) {
|
|
28573
|
+
return {
|
|
28574
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28575
|
+
mint: raw.mint.toBase58(),
|
|
28576
|
+
vault: raw.vault.toBase58(),
|
|
28577
|
+
borrowRate: raw.borrowRate,
|
|
28578
|
+
feeOnInterest: raw.feeOnInterest,
|
|
28579
|
+
lastUtilization: raw.lastUtilization,
|
|
28580
|
+
lastUpdateTimestamp: raw.lastUpdateTimestamp.toString(),
|
|
28581
|
+
supplyExchangePrice: raw.supplyExchangePrice.toString(),
|
|
28582
|
+
borrowExchangePrice: raw.borrowExchangePrice.toString(),
|
|
28583
|
+
maxUtilization: raw.maxUtilization,
|
|
28584
|
+
totalSupplyWithInterest: raw.totalSupplyWithInterest.toString(),
|
|
28585
|
+
totalSupplyInterestFree: raw.totalSupplyInterestFree.toString(),
|
|
28586
|
+
totalBorrowWithInterest: raw.totalBorrowWithInterest.toString(),
|
|
28587
|
+
totalBorrowInterestFree: raw.totalBorrowInterestFree.toString(),
|
|
28588
|
+
totalClaimAmount: raw.totalClaimAmount.toString(),
|
|
28589
|
+
interactingProtocol: raw.interactingProtocol.toBase58(),
|
|
28590
|
+
interactingTimestamp: raw.interactingTimestamp.toString(),
|
|
28591
|
+
interactingBalance: raw.interactingBalance.toString()
|
|
28592
|
+
};
|
|
28593
|
+
}
|
|
28594
|
+
function jupLendingRewardsRateModelRawToDto(raw) {
|
|
28595
|
+
return {
|
|
28596
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28597
|
+
mint: raw.mint.toBase58(),
|
|
28598
|
+
startTvl: raw.startTvl.toString(),
|
|
28599
|
+
duration: raw.duration.toString(),
|
|
28600
|
+
startTime: raw.startTime.toString(),
|
|
28601
|
+
yearlyReward: raw.yearlyReward.toString(),
|
|
28602
|
+
nextDuration: raw.nextDuration.toString(),
|
|
28603
|
+
nextRewardAmount: raw.nextRewardAmount.toString()
|
|
28604
|
+
};
|
|
28605
|
+
}
|
|
28606
|
+
function jupRateModelRawToDto(raw) {
|
|
28607
|
+
return {
|
|
28608
|
+
pubkey: raw.pubkey.toBase58(),
|
|
28609
|
+
mint: raw.mint.toBase58(),
|
|
28610
|
+
version: raw.version,
|
|
28611
|
+
rateAtZero: raw.rateAtZero,
|
|
28612
|
+
kink1Utilization: raw.kink1Utilization,
|
|
28613
|
+
rateAtKink1: raw.rateAtKink1,
|
|
28614
|
+
rateAtMax: raw.rateAtMax,
|
|
28615
|
+
kink2Utilization: raw.kink2Utilization,
|
|
28616
|
+
rateAtKink2: raw.rateAtKink2
|
|
28617
|
+
};
|
|
28618
|
+
}
|
|
28619
|
+
var JUP_LEND_ACCOUNTS_CODER = new BorshAccountsCoder(JUP_LEND_IDL);
|
|
28620
|
+
var lendingDiscriminator = Buffer.from([135, 199, 82, 16, 249, 131, 182, 241]);
|
|
28621
|
+
var lendingRewardsRateModelDiscriminator = Buffer.from([166, 72, 71, 131, 172, 74, 166, 181]);
|
|
28622
|
+
var rateModelDiscriminator = Buffer.from([94, 3, 203, 219, 107, 137, 4, 162]);
|
|
28623
|
+
function decodeJupLendingStateData(data, pubkey) {
|
|
28624
|
+
if (!data.slice(0, 8).equals(lendingDiscriminator)) {
|
|
28625
|
+
throw new Error("invalid Lending account discriminator");
|
|
28626
|
+
}
|
|
28627
|
+
const decoded = JUP_LEND_ACCOUNTS_CODER.decode("Lending", data);
|
|
28628
|
+
return {
|
|
28629
|
+
pubkey,
|
|
28630
|
+
mint: decoded.mint,
|
|
28631
|
+
fTokenMint: decoded.f_token_mint ?? decoded.fTokenMint,
|
|
28632
|
+
lendingId: decoded.lending_id ?? decoded.lendingId,
|
|
28633
|
+
decimals: decoded.decimals,
|
|
28634
|
+
rewardsRateModel: decoded.rewards_rate_model ?? decoded.rewardsRateModel,
|
|
28635
|
+
liquidityExchangePrice: decoded.liquidity_exchange_price ?? decoded.liquidityExchangePrice,
|
|
28636
|
+
tokenExchangePrice: decoded.token_exchange_price ?? decoded.tokenExchangePrice,
|
|
28637
|
+
lastUpdateTimestamp: decoded.last_update_timestamp ?? decoded.lastUpdateTimestamp,
|
|
28638
|
+
tokenReservesLiquidity: decoded.token_reserves_liquidity ?? decoded.tokenReservesLiquidity,
|
|
28639
|
+
supplyPositionOnLiquidity: decoded.supply_position_on_liquidity ?? decoded.supplyPositionOnLiquidity,
|
|
28640
|
+
bump: decoded.bump
|
|
28641
|
+
};
|
|
28642
|
+
}
|
|
28643
|
+
function decodeJupLendingRewardsRateModelData(data, pubkey) {
|
|
28644
|
+
if (!data.slice(0, 8).equals(lendingRewardsRateModelDiscriminator)) {
|
|
28645
|
+
throw new Error("invalid LendingRewardsRateModel account discriminator");
|
|
28646
|
+
}
|
|
28647
|
+
const decoded = JUP_LEND_ACCOUNTS_CODER.decode("LendingRewardsRateModel", data);
|
|
28648
|
+
return {
|
|
28649
|
+
pubkey,
|
|
28650
|
+
mint: decoded.mint,
|
|
28651
|
+
startTvl: decoded.start_tvl ?? decoded.startTvl,
|
|
28652
|
+
duration: decoded.duration,
|
|
28653
|
+
startTime: decoded.start_time ?? decoded.startTime,
|
|
28654
|
+
yearlyReward: decoded.yearly_reward ?? decoded.yearlyReward,
|
|
28655
|
+
nextDuration: decoded.next_duration ?? decoded.nextDuration,
|
|
28656
|
+
nextRewardAmount: decoded.next_reward_amount ?? decoded.nextRewardAmount,
|
|
28657
|
+
bump: decoded.bump
|
|
28658
|
+
};
|
|
28659
|
+
}
|
|
28660
|
+
function decodeJupTokenReserveData(data, pubkey) {
|
|
28661
|
+
let offset = 8;
|
|
28662
|
+
const mint = new PublicKey(data.slice(offset, offset + 32));
|
|
28663
|
+
offset += 32;
|
|
28664
|
+
const vault = new PublicKey(data.slice(offset, offset + 32));
|
|
28665
|
+
offset += 32;
|
|
28666
|
+
const borrowRate = data.readUInt16LE(offset);
|
|
28667
|
+
offset += 2;
|
|
28668
|
+
const feeOnInterest = data.readUInt16LE(offset);
|
|
28669
|
+
offset += 2;
|
|
28670
|
+
const lastUtilization = data.readUInt16LE(offset);
|
|
28671
|
+
offset += 2;
|
|
28672
|
+
const lastUpdateTimestamp = new BN2(data.slice(offset, offset + 8), "le");
|
|
28673
|
+
offset += 8;
|
|
28674
|
+
const supplyExchangePrice = new BN2(data.slice(offset, offset + 8), "le");
|
|
28675
|
+
offset += 8;
|
|
28676
|
+
const borrowExchangePrice = new BN2(data.slice(offset, offset + 8), "le");
|
|
28677
|
+
offset += 8;
|
|
28678
|
+
const maxUtilization = data.readUInt16LE(offset);
|
|
28679
|
+
offset += 2;
|
|
28680
|
+
const totalSupplyWithInterest = new BN2(data.slice(offset, offset + 8), "le");
|
|
28681
|
+
offset += 8;
|
|
28682
|
+
const totalSupplyInterestFree = new BN2(data.slice(offset, offset + 8), "le");
|
|
28683
|
+
offset += 8;
|
|
28684
|
+
const totalBorrowWithInterest = new BN2(data.slice(offset, offset + 8), "le");
|
|
28685
|
+
offset += 8;
|
|
28686
|
+
const totalBorrowInterestFree = new BN2(data.slice(offset, offset + 8), "le");
|
|
28687
|
+
offset += 8;
|
|
28688
|
+
const totalClaimAmount = new BN2(data.slice(offset, offset + 8), "le");
|
|
28689
|
+
offset += 8;
|
|
28690
|
+
const interactingProtocol = new PublicKey(data.slice(offset, offset + 32));
|
|
28691
|
+
offset += 32;
|
|
28692
|
+
const interactingTimestamp = new BN2(data.slice(offset, offset + 8), "le");
|
|
28693
|
+
offset += 8;
|
|
28694
|
+
const interactingBalance = new BN2(data.slice(offset, offset + 8), "le");
|
|
28695
|
+
return {
|
|
28696
|
+
pubkey,
|
|
28697
|
+
mint,
|
|
28698
|
+
vault,
|
|
28699
|
+
borrowRate,
|
|
28700
|
+
feeOnInterest,
|
|
28701
|
+
lastUtilization,
|
|
28702
|
+
lastUpdateTimestamp,
|
|
28703
|
+
supplyExchangePrice,
|
|
28704
|
+
borrowExchangePrice,
|
|
28705
|
+
maxUtilization,
|
|
28706
|
+
totalSupplyWithInterest,
|
|
28707
|
+
totalSupplyInterestFree,
|
|
28708
|
+
totalBorrowWithInterest,
|
|
28709
|
+
totalBorrowInterestFree,
|
|
28710
|
+
totalClaimAmount,
|
|
28711
|
+
interactingProtocol,
|
|
28712
|
+
interactingTimestamp,
|
|
28713
|
+
interactingBalance
|
|
28714
|
+
};
|
|
28715
|
+
}
|
|
28716
|
+
function decodeJupRateModelData(data, pubkey) {
|
|
28717
|
+
if (!data.slice(0, 8).equals(rateModelDiscriminator)) {
|
|
28718
|
+
throw new Error("invalid RateModel account discriminator");
|
|
28719
|
+
}
|
|
28720
|
+
let offset = 8;
|
|
28721
|
+
const mint = new PublicKey(data.slice(offset, offset + 32));
|
|
28722
|
+
offset += 32;
|
|
28723
|
+
const version = data.readUInt8(offset);
|
|
28724
|
+
offset += 1;
|
|
28725
|
+
const rateAtZero = data.readUInt16LE(offset);
|
|
28726
|
+
offset += 2;
|
|
28727
|
+
const kink1Utilization = data.readUInt16LE(offset);
|
|
28728
|
+
offset += 2;
|
|
28729
|
+
const rateAtKink1 = data.readUInt16LE(offset);
|
|
28730
|
+
offset += 2;
|
|
28731
|
+
const rateAtMax = data.readUInt16LE(offset);
|
|
28732
|
+
offset += 2;
|
|
28733
|
+
const kink2Utilization = data.readUInt16LE(offset);
|
|
28734
|
+
offset += 2;
|
|
28735
|
+
const rateAtKink2 = data.readUInt16LE(offset);
|
|
28736
|
+
return {
|
|
28737
|
+
pubkey,
|
|
28738
|
+
mint,
|
|
28739
|
+
version,
|
|
28740
|
+
rateAtZero,
|
|
28741
|
+
kink1Utilization,
|
|
28742
|
+
rateAtKink1,
|
|
28743
|
+
rateAtMax,
|
|
28744
|
+
kink2Utilization,
|
|
28745
|
+
rateAtKink2
|
|
28746
|
+
};
|
|
28747
|
+
}
|
|
28748
|
+
function dtoToJupLendingStateRaw(dto) {
|
|
28749
|
+
return {
|
|
28750
|
+
pubkey: new PublicKey(dto.pubkey),
|
|
28751
|
+
mint: new PublicKey(dto.mint),
|
|
28752
|
+
fTokenMint: new PublicKey(dto.fTokenMint),
|
|
28753
|
+
lendingId: dto.lendingId,
|
|
28754
|
+
decimals: dto.decimals,
|
|
28755
|
+
rewardsRateModel: new PublicKey(dto.rewardsRateModel),
|
|
28756
|
+
liquidityExchangePrice: new BN2(dto.liquidityExchangePrice),
|
|
28757
|
+
tokenExchangePrice: new BN2(dto.tokenExchangePrice),
|
|
28758
|
+
lastUpdateTimestamp: new BN2(dto.lastUpdateTimestamp),
|
|
28759
|
+
tokenReservesLiquidity: new PublicKey(dto.tokenReservesLiquidity),
|
|
28760
|
+
supplyPositionOnLiquidity: new PublicKey(dto.supplyPositionOnLiquidity)
|
|
28761
|
+
};
|
|
28762
|
+
}
|
|
28763
|
+
function dtoToJupTokenReserveRaw(dto) {
|
|
28764
|
+
return {
|
|
28765
|
+
pubkey: new PublicKey(dto.pubkey),
|
|
28766
|
+
mint: new PublicKey(dto.mint),
|
|
28767
|
+
vault: new PublicKey(dto.vault),
|
|
28768
|
+
borrowRate: dto.borrowRate,
|
|
28769
|
+
feeOnInterest: dto.feeOnInterest,
|
|
28770
|
+
lastUtilization: dto.lastUtilization,
|
|
28771
|
+
lastUpdateTimestamp: new BN2(dto.lastUpdateTimestamp),
|
|
28772
|
+
supplyExchangePrice: new BN2(dto.supplyExchangePrice),
|
|
28773
|
+
borrowExchangePrice: new BN2(dto.borrowExchangePrice),
|
|
28774
|
+
maxUtilization: dto.maxUtilization,
|
|
28775
|
+
totalSupplyWithInterest: new BN2(dto.totalSupplyWithInterest),
|
|
28776
|
+
totalSupplyInterestFree: new BN2(dto.totalSupplyInterestFree),
|
|
28777
|
+
totalBorrowWithInterest: new BN2(dto.totalBorrowWithInterest),
|
|
28778
|
+
totalBorrowInterestFree: new BN2(dto.totalBorrowInterestFree),
|
|
28779
|
+
totalClaimAmount: new BN2(dto.totalClaimAmount),
|
|
28780
|
+
interactingProtocol: new PublicKey(dto.interactingProtocol),
|
|
28781
|
+
interactingTimestamp: new BN2(dto.interactingTimestamp),
|
|
28782
|
+
interactingBalance: new BN2(dto.interactingBalance)
|
|
28783
|
+
};
|
|
28784
|
+
}
|
|
28785
|
+
function dtoToJupLendingRewardsRateModelRaw(dto) {
|
|
28786
|
+
return {
|
|
28787
|
+
pubkey: new PublicKey(dto.pubkey),
|
|
28788
|
+
mint: new PublicKey(dto.mint),
|
|
28789
|
+
startTvl: new BN2(dto.startTvl),
|
|
28790
|
+
duration: new BN2(dto.duration),
|
|
28791
|
+
startTime: new BN2(dto.startTime),
|
|
28792
|
+
yearlyReward: new BN2(dto.yearlyReward),
|
|
28793
|
+
nextDuration: new BN2(dto.nextDuration),
|
|
28794
|
+
nextRewardAmount: new BN2(dto.nextRewardAmount)
|
|
28795
|
+
};
|
|
28796
|
+
}
|
|
28797
|
+
function dtoToJupRateModelRaw(dto) {
|
|
28798
|
+
return {
|
|
28799
|
+
pubkey: new PublicKey(dto.pubkey),
|
|
28800
|
+
mint: new PublicKey(dto.mint),
|
|
28801
|
+
version: dto.version,
|
|
28802
|
+
rateAtZero: dto.rateAtZero,
|
|
28803
|
+
kink1Utilization: dto.kink1Utilization,
|
|
28804
|
+
rateAtKink1: dto.rateAtKink1,
|
|
28805
|
+
rateAtMax: dto.rateAtMax,
|
|
28806
|
+
kink2Utilization: dto.kink2Utilization,
|
|
28807
|
+
rateAtKink2: dto.rateAtKink2
|
|
28808
|
+
};
|
|
28809
|
+
}
|
|
28810
|
+
var SEED_LENDING_ADMIN = "lending_admin";
|
|
28811
|
+
var SEED_F_TOKEN_MINT = "f_token_mint";
|
|
28812
|
+
var SEED_LENDING = "lending";
|
|
28813
|
+
var SEED_LIQUIDITY = "liquidity";
|
|
28814
|
+
var SEED_RESERVE = "reserve";
|
|
28815
|
+
var SEED_RATE_MODEL = "rate_model";
|
|
28816
|
+
var SEED_USER_SUPPLY_POSITION = "user_supply_position";
|
|
28817
|
+
var SEED_USER_CLAIM = "user_claim";
|
|
28818
|
+
var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
|
|
28819
|
+
function getAllDerivedJupLendAccounts(mint) {
|
|
28820
|
+
const [fTokenMint] = deriveJupLendFTokenMint(mint);
|
|
28821
|
+
const [lending] = deriveJupLendLending(mint, fTokenMint);
|
|
28822
|
+
const [liquidity] = deriveJupLendLiquidity();
|
|
28823
|
+
return {
|
|
28824
|
+
fTokenMint,
|
|
28825
|
+
lendingAdmin: deriveJupLendLendingAdmin()[0],
|
|
28826
|
+
supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
|
|
28827
|
+
lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
|
|
28828
|
+
rateModel: deriveJupLendRateModel(mint)[0],
|
|
28829
|
+
vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
|
|
28830
|
+
liquidity,
|
|
28831
|
+
rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
|
|
28832
|
+
};
|
|
28833
|
+
}
|
|
28834
|
+
function deriveJupLendLendingPdas(underlyingMint, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28835
|
+
const [lendingAdmin, lendingAdminBump] = deriveJupLendLendingAdmin(lendingProgramId);
|
|
28836
|
+
const [fTokenMint, fTokenMintBump] = deriveJupLendFTokenMint(underlyingMint, lendingProgramId);
|
|
28837
|
+
const [lending, lendingBump] = deriveJupLendLending(underlyingMint, fTokenMint, lendingProgramId);
|
|
28838
|
+
return {
|
|
28839
|
+
lendingAdmin,
|
|
28840
|
+
lendingAdminBump,
|
|
28841
|
+
fTokenMint,
|
|
28842
|
+
fTokenMintBump,
|
|
28843
|
+
lending,
|
|
28844
|
+
lendingBump
|
|
28845
|
+
};
|
|
28846
|
+
}
|
|
28847
|
+
function deriveJupLendFTokenMint(asset, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28848
|
+
return PublicKey.findProgramAddressSync(
|
|
28849
|
+
[Buffer.from(SEED_F_TOKEN_MINT), asset.toBuffer()],
|
|
28850
|
+
lendingProgramId
|
|
28851
|
+
);
|
|
28852
|
+
}
|
|
28853
|
+
function deriveJupLendLending(asset, fTokenMint, lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28854
|
+
const [_fTokenMint] = fTokenMint ? [fTokenMint] : deriveJupLendFTokenMint(asset, lendingProgramId);
|
|
28855
|
+
return PublicKey.findProgramAddressSync(
|
|
28856
|
+
[Buffer.from(SEED_LENDING), asset.toBuffer(), _fTokenMint.toBuffer()],
|
|
28857
|
+
lendingProgramId
|
|
28858
|
+
);
|
|
28859
|
+
}
|
|
28860
|
+
function deriveJupLendLendingAdmin(lendingProgramId = JUP_LEND_PROGRAM_ID) {
|
|
28861
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_LENDING_ADMIN)], lendingProgramId);
|
|
28862
|
+
}
|
|
28863
|
+
function deriveJupLendLendingRewardsRateModel(asset, rewardsProgramId = JUP_REWARDS_PROGRAM_ID) {
|
|
28864
|
+
return PublicKey.findProgramAddressSync(
|
|
28865
|
+
[Buffer.from(SEED_LENDING_REWARDS_RATE_MODEL), asset.toBuffer()],
|
|
28866
|
+
rewardsProgramId
|
|
28867
|
+
);
|
|
28868
|
+
}
|
|
28869
|
+
function deriveJupLendTokenReserve(asset, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28870
|
+
return PublicKey.findProgramAddressSync(
|
|
28871
|
+
[Buffer.from(SEED_RESERVE), asset.toBuffer()],
|
|
28872
|
+
liquidityProgramId
|
|
28873
|
+
);
|
|
28874
|
+
}
|
|
28875
|
+
function deriveJupLendLiquidityVaultAta(underlyingMint, liquidityPda, tokenProgramId = TOKEN_PROGRAM_ID) {
|
|
28876
|
+
return getAssociatedTokenAddressSync(
|
|
28877
|
+
underlyingMint,
|
|
28878
|
+
liquidityPda,
|
|
28879
|
+
true,
|
|
28880
|
+
tokenProgramId,
|
|
28881
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
28882
|
+
);
|
|
28883
|
+
}
|
|
28884
|
+
function deriveJupLendRateModel(asset, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28885
|
+
return PublicKey.findProgramAddressSync(
|
|
28886
|
+
[Buffer.from(SEED_RATE_MODEL), asset.toBuffer()],
|
|
28887
|
+
liquidityProgramId
|
|
28888
|
+
);
|
|
28889
|
+
}
|
|
28890
|
+
function deriveJupLendLiquidity(liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28891
|
+
return PublicKey.findProgramAddressSync([Buffer.from(SEED_LIQUIDITY)], liquidityProgramId);
|
|
28892
|
+
}
|
|
28893
|
+
function deriveJupLendClaimAccount(owner, mint, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28894
|
+
return PublicKey.findProgramAddressSync(
|
|
28895
|
+
[Buffer.from(SEED_USER_CLAIM), owner.toBuffer(), mint.toBuffer()],
|
|
28896
|
+
liquidityProgramId
|
|
28897
|
+
);
|
|
28898
|
+
}
|
|
28899
|
+
function deriveJupLendLiquiditySupplyPositionPda(underlyingMint, lendingPda, liquidityProgramId = JUP_LIQUIDITY_PROGRAM_ID) {
|
|
28900
|
+
return PublicKey.findProgramAddressSync(
|
|
28901
|
+
[Buffer.from(SEED_USER_SUPPLY_POSITION), underlyingMint.toBuffer(), lendingPda.toBuffer()],
|
|
28902
|
+
liquidityProgramId
|
|
28903
|
+
);
|
|
28904
|
+
}
|
|
28905
|
+
|
|
28906
|
+
// src/utils/accounting.utils.ts
|
|
28907
|
+
var aprToApy2 = (apr, compoundingFrequency = HOURS_PER_YEAR, apyCap = 3) => Math.min((1 + apr / compoundingFrequency) ** compoundingFrequency - 1, apyCap);
|
|
28908
|
+
|
|
28909
|
+
// src/vendor/jup-lend/utils/interest-rate.utils.ts
|
|
28910
|
+
var JUP_EXCHANGE_PRICES_PRECISION = new BN2("1000000000000");
|
|
28911
|
+
var JUP_SECONDS_PER_YEAR = new BN2(31536e3);
|
|
28912
|
+
var JUP_MAX_REWARDS_RATE = new BN2("50000000000000");
|
|
28913
|
+
function calculateJupLendTotalAssets(lendingState, fTokenTotalSupply) {
|
|
28914
|
+
return lendingState.tokenExchangePrice.mul(fTokenTotalSupply).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
28915
|
+
}
|
|
28916
|
+
function calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp) {
|
|
28917
|
+
const defaultResult = {
|
|
28918
|
+
rewardsRate: new BN2(0),
|
|
28919
|
+
rewardsEnded: false,
|
|
28920
|
+
rewardsStartTime: rewardsModel.startTime
|
|
28921
|
+
};
|
|
28922
|
+
if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
|
|
28923
|
+
return defaultResult;
|
|
28924
|
+
}
|
|
28925
|
+
if (currentTimestamp.gt(rewardsModel.startTime.add(rewardsModel.duration))) {
|
|
28926
|
+
return { ...defaultResult, rewardsEnded: true };
|
|
28927
|
+
}
|
|
28928
|
+
if (totalAssets.lt(rewardsModel.startTvl)) {
|
|
28929
|
+
return defaultResult;
|
|
28930
|
+
}
|
|
28931
|
+
let rewardsRate = rewardsModel.yearlyReward.mul(new BN2(1e4)).div(totalAssets);
|
|
28932
|
+
if (rewardsRate.gt(JUP_MAX_REWARDS_RATE)) {
|
|
28933
|
+
rewardsRate = JUP_MAX_REWARDS_RATE;
|
|
28934
|
+
}
|
|
28935
|
+
return {
|
|
28936
|
+
rewardsRate,
|
|
28937
|
+
rewardsEnded: false,
|
|
28938
|
+
rewardsStartTime: rewardsModel.startTime
|
|
28939
|
+
};
|
|
28940
|
+
}
|
|
28941
|
+
function calculateJupLendRewardsRateForExchangePrice(rewardsModel, totalAssets, currentTimestamp) {
|
|
28942
|
+
const defaultResult = { rate: new BN2(0), rewardsStartTime: rewardsModel.startTime };
|
|
28943
|
+
if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
|
|
28944
|
+
return defaultResult;
|
|
28945
|
+
}
|
|
28946
|
+
if (currentTimestamp.gt(rewardsModel.startTime.add(rewardsModel.duration))) {
|
|
28947
|
+
return defaultResult;
|
|
28948
|
+
}
|
|
28949
|
+
if (totalAssets.lt(rewardsModel.startTvl)) {
|
|
28950
|
+
return defaultResult;
|
|
28951
|
+
}
|
|
28952
|
+
let rate = rewardsModel.yearlyReward.mul(JUP_EXCHANGE_PRICES_PRECISION).div(totalAssets);
|
|
28953
|
+
if (rate.gt(JUP_MAX_REWARDS_RATE)) {
|
|
28954
|
+
rate = JUP_MAX_REWARDS_RATE;
|
|
28955
|
+
}
|
|
28956
|
+
return { rate, rewardsStartTime: rewardsModel.startTime };
|
|
28957
|
+
}
|
|
28958
|
+
function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply, currentTimestamp) {
|
|
28959
|
+
const oldTokenExchangePrice = lendingState.tokenExchangePrice;
|
|
28960
|
+
const oldLiquidityExchangePrice = lendingState.liquidityExchangePrice;
|
|
28961
|
+
const currentLiquidityExchangePrice = tokenReserve.supplyExchangePrice;
|
|
28962
|
+
let rewardsRate = new BN2(0);
|
|
28963
|
+
let rewardsStartTime = lendingState.lastUpdateTimestamp;
|
|
28964
|
+
if (rewardsModel) {
|
|
28965
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
28966
|
+
const result = calculateJupLendRewardsRateForExchangePrice(
|
|
28967
|
+
rewardsModel,
|
|
28968
|
+
totalAssets,
|
|
28969
|
+
currentTimestamp
|
|
28970
|
+
);
|
|
28971
|
+
rewardsRate = result.rate;
|
|
28972
|
+
rewardsStartTime = result.rewardsStartTime;
|
|
28973
|
+
}
|
|
28974
|
+
let lastUpdateTime = lendingState.lastUpdateTimestamp;
|
|
28975
|
+
if (lastUpdateTime.lt(rewardsStartTime)) {
|
|
28976
|
+
lastUpdateTime = rewardsStartTime;
|
|
28977
|
+
}
|
|
28978
|
+
const secondsElapsed = currentTimestamp.sub(lastUpdateTime);
|
|
28979
|
+
let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN2(100));
|
|
28980
|
+
const delta = currentLiquidityExchangePrice.sub(oldLiquidityExchangePrice);
|
|
28981
|
+
totalReturnPercent = totalReturnPercent.add(
|
|
28982
|
+
delta.mul(new BN2(1e14)).div(oldLiquidityExchangePrice)
|
|
28983
|
+
);
|
|
28984
|
+
return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN2(1e14)));
|
|
28985
|
+
}
|
|
28986
|
+
function calculateJupLendLiquiditySupplyRate(tokenReserve) {
|
|
28987
|
+
const borrowRate = new BN2(tokenReserve.borrowRate);
|
|
28988
|
+
const fee = new BN2(tokenReserve.feeOnInterest);
|
|
28989
|
+
if (tokenReserve.totalSupplyWithInterest.isZero()) {
|
|
28990
|
+
return new BN2(0);
|
|
28991
|
+
}
|
|
28992
|
+
const borrowWithInterestForRate = tokenReserve.totalBorrowWithInterest.mul(tokenReserve.borrowExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
28993
|
+
const supplyWithInterestForRate = tokenReserve.totalSupplyWithInterest.mul(tokenReserve.supplyExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
28994
|
+
if (supplyWithInterestForRate.isZero()) {
|
|
28995
|
+
return new BN2(0);
|
|
28996
|
+
}
|
|
28997
|
+
return borrowRate.mul(new BN2(1e4).sub(fee)).mul(borrowWithInterestForRate).div(supplyWithInterestForRate.mul(new BN2(1e4)));
|
|
28998
|
+
}
|
|
28999
|
+
function calculateJupLendSupplyRate(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply) {
|
|
29000
|
+
const supplyRate = calculateJupLendLiquiditySupplyRate(tokenReserve);
|
|
29001
|
+
let totalRateBps = supplyRate.toNumber();
|
|
29002
|
+
if (rewardsModel) {
|
|
29003
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
29004
|
+
const currentTimestamp = new BN2(Math.floor(Date.now() / 1e3));
|
|
29005
|
+
const { rewardsRate } = calculateJupLendRewardsRate(
|
|
29006
|
+
rewardsModel,
|
|
29007
|
+
totalAssets,
|
|
29008
|
+
currentTimestamp
|
|
29009
|
+
);
|
|
29010
|
+
totalRateBps += rewardsRate.toNumber();
|
|
29011
|
+
}
|
|
29012
|
+
return totalRateBps / 1e4;
|
|
29013
|
+
}
|
|
29014
|
+
function calculateJupLendSupplyAPY(tokenReserve) {
|
|
29015
|
+
const supplyRateBps = calculateJupLendLiquiditySupplyRate(tokenReserve);
|
|
29016
|
+
const apr = supplyRateBps.toNumber() / 1e4;
|
|
29017
|
+
return aprToApy2(apr);
|
|
29018
|
+
}
|
|
29019
|
+
function calculateJupLendBorrowRate(rateModel, utilizationBps) {
|
|
29020
|
+
const u = Math.max(0, Math.min(1e4, utilizationBps));
|
|
29021
|
+
if (rateModel.version === 2) {
|
|
29022
|
+
if (u <= rateModel.kink1Utilization) {
|
|
29023
|
+
return linearInterpolate(
|
|
29024
|
+
0,
|
|
29025
|
+
rateModel.rateAtZero,
|
|
29026
|
+
rateModel.kink1Utilization,
|
|
29027
|
+
rateModel.rateAtKink1,
|
|
29028
|
+
u
|
|
29029
|
+
);
|
|
29030
|
+
} else if (u <= rateModel.kink2Utilization) {
|
|
29031
|
+
return linearInterpolate(
|
|
29032
|
+
rateModel.kink1Utilization,
|
|
29033
|
+
rateModel.rateAtKink1,
|
|
29034
|
+
rateModel.kink2Utilization,
|
|
29035
|
+
rateModel.rateAtKink2,
|
|
29036
|
+
u
|
|
29037
|
+
);
|
|
29038
|
+
} else {
|
|
29039
|
+
return linearInterpolate(
|
|
29040
|
+
rateModel.kink2Utilization,
|
|
29041
|
+
rateModel.rateAtKink2,
|
|
29042
|
+
1e4,
|
|
29043
|
+
rateModel.rateAtMax,
|
|
29044
|
+
u
|
|
29045
|
+
);
|
|
29046
|
+
}
|
|
29047
|
+
} else {
|
|
29048
|
+
if (u <= rateModel.kink1Utilization) {
|
|
29049
|
+
return linearInterpolate(
|
|
29050
|
+
0,
|
|
29051
|
+
rateModel.rateAtZero,
|
|
29052
|
+
rateModel.kink1Utilization,
|
|
29053
|
+
rateModel.rateAtKink1,
|
|
29054
|
+
u
|
|
29055
|
+
);
|
|
29056
|
+
} else {
|
|
29057
|
+
return linearInterpolate(
|
|
29058
|
+
rateModel.kink1Utilization,
|
|
29059
|
+
rateModel.rateAtKink1,
|
|
29060
|
+
1e4,
|
|
29061
|
+
rateModel.rateAtMax,
|
|
29062
|
+
u
|
|
29063
|
+
);
|
|
29064
|
+
}
|
|
29065
|
+
}
|
|
29066
|
+
}
|
|
29067
|
+
function linearInterpolate(x0, y0, x1, y1, x) {
|
|
29068
|
+
if (x1 === x0) return y0;
|
|
29069
|
+
return y0 + (y1 - y0) * (x - x0) / (x1 - x0);
|
|
29070
|
+
}
|
|
29071
|
+
function generateJupLendSupplyCurve(rateModel, feeOnInterest) {
|
|
29072
|
+
const feeMultiplier = 1 - feeOnInterest / 1e4;
|
|
29073
|
+
return Array.from({ length: 101 }, (_, i) => {
|
|
29074
|
+
const utilizationFraction = i / 100;
|
|
29075
|
+
const utilizationBps = i * 100;
|
|
29076
|
+
const borrowRateBps = calculateJupLendBorrowRate(rateModel, utilizationBps);
|
|
29077
|
+
const borrowRateDecimal = borrowRateBps / 1e4;
|
|
29078
|
+
const supplyAPR = borrowRateDecimal * feeMultiplier * utilizationFraction;
|
|
29079
|
+
const supplyAPY = aprToApy2(supplyAPR);
|
|
29080
|
+
return {
|
|
29081
|
+
utilization: i,
|
|
29082
|
+
// 0-100
|
|
29083
|
+
supplyAPY: supplyAPY * 100
|
|
29084
|
+
// Convert to percentage
|
|
29085
|
+
};
|
|
29086
|
+
});
|
|
29087
|
+
}
|
|
29088
|
+
function getJupLendRewards(lendingState, rewardsModel, fTokenTotalSupply) {
|
|
29089
|
+
if (lendingState.rewardsRateModel.equals(PublicKey.default)) {
|
|
29090
|
+
return {
|
|
29091
|
+
rewardsRate: new BN2(0),
|
|
29092
|
+
rewardsEnded: false,
|
|
29093
|
+
rewardsStartTime: new BN2(0)
|
|
29094
|
+
};
|
|
29095
|
+
}
|
|
29096
|
+
const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
|
|
29097
|
+
const currentTimestamp = new BN2(Math.floor(Date.now() / 1e3));
|
|
29098
|
+
return calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp);
|
|
29099
|
+
}
|
|
29100
|
+
var UPDATE_RATE_DISCRIMINATOR = Buffer.from([
|
|
29101
|
+
24,
|
|
29102
|
+
225,
|
|
29103
|
+
53,
|
|
29104
|
+
189,
|
|
29105
|
+
72,
|
|
29106
|
+
212,
|
|
29107
|
+
225,
|
|
29108
|
+
178
|
|
29109
|
+
]);
|
|
29110
|
+
var makeUpdateJupLendRateIx = (lending, mint, fTokenMint, supplyTokenReservesLiquidity, rewardsRateModel) => {
|
|
29111
|
+
const keys = [
|
|
29112
|
+
// lending: writable (exchange prices are updated)
|
|
29113
|
+
{ pubkey: lending, isSigner: false, isWritable: true },
|
|
29114
|
+
// mint: read-only
|
|
29115
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
29116
|
+
// fTokenMint: read-only
|
|
29117
|
+
{ pubkey: fTokenMint, isSigner: false, isWritable: false },
|
|
29118
|
+
// supplyTokenReservesLiquidity: read-only
|
|
29119
|
+
{ pubkey: supplyTokenReservesLiquidity, isSigner: false, isWritable: false },
|
|
29120
|
+
// rewardsRateModel: read-only
|
|
29121
|
+
{ pubkey: rewardsRateModel, isSigner: false, isWritable: false }
|
|
29122
|
+
];
|
|
29123
|
+
return new TransactionInstruction({
|
|
29124
|
+
keys,
|
|
29125
|
+
programId: JUP_LEND_PROGRAM_ID,
|
|
29126
|
+
data: UPDATE_RATE_DISCRIMINATOR
|
|
29127
|
+
});
|
|
29128
|
+
};
|
|
29129
|
+
|
|
29130
|
+
// src/vendor/jup-lend/actions/update-rate.ts
|
|
29131
|
+
function makeUpdateJupLendRate({ lendingState }) {
|
|
29132
|
+
return makeUpdateJupLendRateIx(
|
|
29133
|
+
lendingState.pubkey,
|
|
29134
|
+
lendingState.mint,
|
|
29135
|
+
lendingState.fTokenMint,
|
|
29136
|
+
lendingState.tokenReservesLiquidity,
|
|
29137
|
+
lendingState.rewardsRateModel
|
|
29138
|
+
);
|
|
29139
|
+
}
|
|
28263
29140
|
|
|
28264
|
-
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, ExtensionType, FARMS_PROGRAM_ID, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, MintLayout, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_LENDING_MARKET_AUTH, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_STATE, SEED_USER_STATS, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, SinglePoolInstruction, SplAccountType, SpotBalanceType, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, ZERO, addSigners, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeFarmDataRaw, decodeKlendObligationData, decodeKlendReserveData, decodeSwitchboardPullFeedData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveFeeReceiver, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToObligationRaw, dtoToReserveRaw, farmRawToDto, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, getSwitchboardProgram, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, interpolateLinear, isSpotBalanceTypeVariant, layout, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo2 as parsePriceInfo, replenishPoolIx, reserveRawToDto, scaledSupplies, slotAdjustmentFactor, switchboardAccountCoder, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
|
|
29141
|
+
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, ExtensionType, FARMS_PROGRAM_ID, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, MintLayout, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, SinglePoolInstruction, SplAccountType, SpotBalanceType, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, ZERO, addSigners, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, decodeSwitchboardPullFeedData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, farmRawToDto, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, getSwitchboardProgram, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, interpolateLinear, isSpotBalanceTypeVariant, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo2 as parsePriceInfo, replenishPoolIx, reserveRawToDto, scaledSupplies, slotAdjustmentFactor, switchboardAccountCoder, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
|
|
28265
29142
|
//# sourceMappingURL=vendor.js.map
|
|
28266
29143
|
//# sourceMappingURL=vendor.js.map
|