@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/index.d.ts CHANGED
@@ -3,9 +3,9 @@ import { Infer } from 'superstruct';
3
3
  import * as _solana_web3_js from '@solana/web3.js';
4
4
  import { VersionedTransaction, Transaction, PublicKey, TransactionError, TransactionInstruction, Keypair, Signer, AddressLookupTableAccount, Blockhash, TransactionMessage, Connection, AccountInfo } from '@solana/web3.js';
5
5
  import { Idl, Instruction, AnchorProvider, Address, Program as Program$1 } from '@coral-xyz/anchor';
6
- import BigNumber$1 from 'bignumber.js';
7
6
  import BN from 'bn.js';
8
- import { F as FeedResponse, R as ReserveRaw, D as DriftSpotMarket, a as DriftRewards, b as ReserveJSON, O as ObligationJSON, c as FarmStateJSON, d as ObligationRaw, e as FarmStateRaw, f as DriftSpotMarketJSON, g as DriftUserJSON, h as DriftRewardsJSON, i as DriftUserStatsJSON, j as DriftUser, k as DriftUserStats } from './rewards.types-2ooCYOAZ.js';
7
+ import BigNumber$1 from 'bignumber.js';
8
+ import { F as FeedResponse, R as ReserveRaw, D as DriftSpotMarket, a as DriftRewards, J as JupLendingState, b as ReserveJSON, O as ObligationJSON, c as FarmStateJSON, d as ObligationRaw, e as FarmStateRaw, f as DriftSpotMarketJSON, g as DriftUserJSON, h as DriftRewardsJSON, i as DriftUserStatsJSON, j as DriftUser, k as DriftUserStats, l as JupLendingStateJSON, m as JupTokenReserveJSON, n as JupLendingRewardsRateModelJSON, o as JupRateModelJSON, p as JupTokenReserve, q as JupLendingRewardsRateModel, r as JupRateModel } from './dto-rate-model.types-gN82ZYyC.js';
9
9
  import { ConfigurationParameters, QuoteGetRequest, QuoteResponse } from '@jup-ag/api';
10
10
 
11
11
  /**
@@ -18,7 +18,7 @@ type Marginfi = {
18
18
  address: string;
19
19
  metadata: {
20
20
  name: "marginfi";
21
- version: "0.1.7";
21
+ version: "0.1.8";
22
22
  spec: "0.1.0";
23
23
  description: "Borrow Lending Prime Broker";
24
24
  };
@@ -61,6 +61,44 @@ type Marginfi = {
61
61
  }
62
62
  ];
63
63
  },
64
+ {
65
+ name: "configureBankRateLimits";
66
+ docs: [
67
+ "(admin only) Configure bank-level rate limits for withdraw/borrow.",
68
+ "Rate limits track net outflow in native tokens. Deposits offset withdraws.",
69
+ "Set to 0 to disable. Hourly and daily windows are independent."
70
+ ];
71
+ discriminator: [175, 84, 85, 221, 206, 220, 110, 174];
72
+ accounts: [
73
+ {
74
+ name: "group";
75
+ relations: ["bank"];
76
+ },
77
+ {
78
+ name: "admin";
79
+ signer: true;
80
+ relations: ["group"];
81
+ },
82
+ {
83
+ name: "bank";
84
+ writable: true;
85
+ }
86
+ ];
87
+ args: [
88
+ {
89
+ name: "hourlyMaxOutflow";
90
+ type: {
91
+ option: "u64";
92
+ };
93
+ },
94
+ {
95
+ name: "dailyMaxOutflow";
96
+ type: {
97
+ option: "u64";
98
+ };
99
+ }
100
+ ];
101
+ },
64
102
  {
65
103
  name: "configureDeleverageWithdrawalLimit";
66
104
  docs: ["(group admin only) Set the daily withdrawal limit for deleverages per group."];
@@ -83,6 +121,40 @@ type Marginfi = {
83
121
  }
84
122
  ];
85
123
  },
124
+ {
125
+ name: "configureGroupRateLimits";
126
+ docs: [
127
+ "(admin only) Configure group-level rate limits for withdraw/borrow.",
128
+ "Rate limits track aggregate net outflow in USD.",
129
+ "Example: $10M = 10_000_000. Set to 0 to disable."
130
+ ];
131
+ discriminator: [111, 47, 213, 142, 158, 51, 226, 102];
132
+ accounts: [
133
+ {
134
+ name: "marginfiGroup";
135
+ writable: true;
136
+ },
137
+ {
138
+ name: "admin";
139
+ signer: true;
140
+ relations: ["marginfiGroup"];
141
+ }
142
+ ];
143
+ args: [
144
+ {
145
+ name: "hourlyMaxOutflowUsd";
146
+ type: {
147
+ option: "u64";
148
+ };
149
+ },
150
+ {
151
+ name: "dailyMaxOutflowUsd";
152
+ type: {
153
+ option: "u64";
154
+ };
155
+ }
156
+ ];
157
+ },
86
158
  {
87
159
  name: "driftDeposit";
88
160
  docs: [
@@ -93,6 +165,7 @@ type Marginfi = {
93
165
  accounts: [
94
166
  {
95
167
  name: "group";
168
+ writable: true;
96
169
  relations: ["marginfiAccount", "bank"];
97
170
  },
98
171
  {
@@ -214,8 +287,9 @@ type Marginfi = {
214
287
  {
215
288
  name: "driftHarvestReward";
216
289
  docs: [
217
- "(fee admin only) Harvest rewards from admin deposits in Drift spot markets",
218
- "The harvest spot market must be different from the bank's main drift spot market"
290
+ "(permissionless) Harvest rewards from admin deposits in Drift spot markets.",
291
+ "Rewards are always sent to the global fee wallet's canonical ATA.",
292
+ "The harvest spot market must be different from the bank's main drift spot market."
219
293
  ];
220
294
  discriminator: [167, 161, 240, 194, 138, 54, 87, 189];
221
295
  accounts: [
@@ -879,6 +953,10 @@ type Marginfi = {
879
953
  name: "liquidationFlatSolFee";
880
954
  type: "u32";
881
955
  },
956
+ {
957
+ name: "orderInitFlatSolFee";
958
+ type: "u32";
959
+ },
882
960
  {
883
961
  name: "programFeeFixed";
884
962
  type: {
@@ -902,11 +980,20 @@ type Marginfi = {
902
980
  name: "wrappedI80f48";
903
981
  };
904
982
  };
983
+ },
984
+ {
985
+ name: "orderExecutionMaxFee";
986
+ type: {
987
+ defined: {
988
+ name: "wrappedI80f48";
989
+ };
990
+ };
905
991
  }
906
992
  ];
907
993
  },
908
994
  {
909
995
  name: "editStakedSettings";
996
+ docs: ["(admin only) Edit the staked collateral settings for the group."];
910
997
  discriminator: [11, 108, 215, 87, 240, 9, 66, 241];
911
998
  accounts: [
912
999
  {
@@ -936,6 +1023,7 @@ type Marginfi = {
936
1023
  },
937
1024
  {
938
1025
  name: "endDeleverage";
1026
+ docs: ["(risk_admin only) End forced deleverage. Validates health did not worsen."];
939
1027
  discriminator: [114, 14, 250, 143, 252, 104, 214, 209];
940
1028
  accounts: [
941
1029
  {
@@ -961,6 +1049,10 @@ type Marginfi = {
961
1049
  },
962
1050
  {
963
1051
  name: "endLiquidation";
1052
+ docs: [
1053
+ "(liquidation_receiver, set in start_liquidation) End receivership liquidation. Validates",
1054
+ "health improved and seized assets are within fee limits. Charges a flat SOL fee."
1055
+ ];
964
1056
  discriminator: [110, 11, 244, 54, 229, 181, 22, 184];
965
1057
  accounts: [
966
1058
  {
@@ -1089,6 +1181,10 @@ type Marginfi = {
1089
1181
  name: "liquidationFlatSolFee";
1090
1182
  type: "u32";
1091
1183
  },
1184
+ {
1185
+ name: "orderInitFlatSolFee";
1186
+ type: "u32";
1187
+ },
1092
1188
  {
1093
1189
  name: "programFeeFixed";
1094
1190
  type: {
@@ -1112,6 +1208,14 @@ type Marginfi = {
1112
1208
  name: "wrappedI80f48";
1113
1209
  };
1114
1210
  };
1211
+ },
1212
+ {
1213
+ name: "orderExecutionMaxFee";
1214
+ type: {
1215
+ defined: {
1216
+ name: "wrappedI80f48";
1217
+ };
1218
+ };
1115
1219
  }
1116
1220
  ];
1117
1221
  },
@@ -1172,13 +1276,12 @@ type Marginfi = {
1172
1276
  ];
1173
1277
  },
1174
1278
  {
1175
- name: "kaminoDeposit";
1279
+ name: "juplendDeposit";
1176
1280
  docs: [
1177
- "(user) Deposit into a Kamino pool through a marginfi account",
1178
- "* amount - in the liquidity token (e.g. if there is a Kamino USDC bank, pass the amount of",
1179
- "USDC desired), in native decimals."
1281
+ "(user) Deposit into a JupLend lending pool through a marginfi account.",
1282
+ "* amount - in the underlying token (e.g., USDC), in native decimals"
1180
1283
  ];
1181
- discriminator: [237, 8, 188, 187, 115, 99, 49, 85];
1284
+ discriminator: [114, 11, 218, 81, 183, 165, 143, 255];
1182
1285
  accounts: [
1183
1286
  {
1184
1287
  name: "group";
@@ -1191,6 +1294,7 @@ type Marginfi = {
1191
1294
  {
1192
1295
  name: "authority";
1193
1296
  signer: true;
1297
+ relations: ["marginfiAccount"];
1194
1298
  },
1195
1299
  {
1196
1300
  name: "bank";
@@ -1204,8 +1308,8 @@ type Marginfi = {
1204
1308
  {
1205
1309
  name: "liquidityVaultAuthority";
1206
1310
  docs: [
1207
- "The bank's liquidity vault authority, which owns the Kamino obligation. Note: Kamino needs",
1208
- "this to be mut because `deposit` might return the rent here"
1311
+ "The bank's liquidity vault authority PDA (acts as signer for JupLend CPIs).",
1312
+ "NOTE: JupLend marks the signer as writable in their deposit instruction."
1209
1313
  ];
1210
1314
  writable: true;
1211
1315
  pda: {
@@ -1244,82 +1348,77 @@ type Marginfi = {
1244
1348
  },
1245
1349
  {
1246
1350
  name: "liquidityVault";
1247
- docs: ["Used as an intermediary to deposit token into Kamino"];
1351
+ docs: [
1352
+ "Bank liquidity vault (holds underlying mint and is used as depositor_token_account)."
1353
+ ];
1248
1354
  writable: true;
1249
1355
  relations: ["bank"];
1250
1356
  },
1251
1357
  {
1252
- name: "integrationAcc2";
1253
- writable: true;
1358
+ name: "mint";
1359
+ docs: ["Underlying mint."];
1254
1360
  relations: ["bank"];
1255
1361
  },
1256
1362
  {
1257
- name: "lendingMarket";
1363
+ name: "integrationAcc1";
1364
+ docs: ["JupLend lending state account."];
1365
+ writable: true;
1366
+ relations: ["bank"];
1258
1367
  },
1259
1368
  {
1260
- name: "lendingMarketAuthority";
1369
+ name: "fTokenMint";
1370
+ docs: ["JupLend fToken mint."];
1371
+ writable: true;
1372
+ relations: ["integrationAcc1"];
1261
1373
  },
1262
1374
  {
1263
- name: "integrationAcc1";
1264
- docs: ["The Kamino reserve that holds liquidity"];
1375
+ name: "integrationAcc2";
1376
+ docs: ["Bank's fToken vault (validated via has_one on bank)."];
1265
1377
  writable: true;
1266
1378
  relations: ["bank"];
1267
1379
  },
1268
1380
  {
1269
- name: "mint";
1270
- docs: [
1271
- "Bank's liquidity token mint (e.g., USDC). Kamino calls this the `reserve_liquidity_mint`"
1272
- ];
1273
- relations: ["bank"];
1381
+ name: "lendingAdmin";
1274
1382
  },
1275
1383
  {
1276
- name: "reserveLiquiditySupply";
1384
+ name: "supplyTokenReservesLiquidity";
1277
1385
  writable: true;
1278
1386
  },
1279
1387
  {
1280
- name: "reserveCollateralMint";
1281
- docs: ["The reserve's mint for tokenized representations of Kamino deposits."];
1388
+ name: "lendingSupplyPositionOnLiquidity";
1282
1389
  writable: true;
1283
1390
  },
1284
1391
  {
1285
- name: "reserveDestinationDepositCollateral";
1286
- docs: [
1287
- "The reserve's destination for tokenized representations of deposits. Note: the",
1288
- "`reserve_collateral_mint` will mint tokens directly to this account."
1289
- ];
1290
- writable: true;
1392
+ name: "rateModel";
1291
1393
  },
1292
1394
  {
1293
- name: "obligationFarmUserState";
1294
- docs: ["Required if the Kamino reserve has an active farm."];
1395
+ name: "vault";
1295
1396
  writable: true;
1296
- optional: true;
1297
1397
  },
1298
1398
  {
1299
- name: "reserveFarmState";
1300
- docs: ["Required if the Kamino reserve has an active farm."];
1399
+ name: "liquidity";
1301
1400
  writable: true;
1302
- optional: true;
1303
1401
  },
1304
1402
  {
1305
- name: "kaminoProgram";
1306
- address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD";
1403
+ name: "liquidityProgram";
1307
1404
  },
1308
1405
  {
1309
- name: "farmsProgram";
1310
- docs: ["Farms program for Kamino staking functionality"];
1311
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr";
1406
+ name: "rewardsRateModel";
1312
1407
  },
1313
1408
  {
1314
- name: "collateralTokenProgram";
1315
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1409
+ name: "juplendProgram";
1410
+ address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9";
1316
1411
  },
1317
1412
  {
1318
- name: "liquidityTokenProgram";
1413
+ name: "tokenProgram";
1319
1414
  },
1320
1415
  {
1321
- name: "instructionSysvarAccount";
1322
- address: "Sysvar1nstructions1111111111111111111111111";
1416
+ name: "associatedTokenProgram";
1417
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1418
+ },
1419
+ {
1420
+ name: "systemProgram";
1421
+ address: "11111111111111111111111111111111";
1323
1422
  }
1324
1423
  ];
1325
1424
  args: [
@@ -1330,90 +1429,34 @@ type Marginfi = {
1330
1429
  ];
1331
1430
  },
1332
1431
  {
1333
- name: "kaminoHarvestReward";
1432
+ name: "juplendInitPosition";
1334
1433
  docs: [
1335
- "(fee admin only) Harvest the specified reward index from the Kamino Farm attached to this bank.",
1434
+ "(permissionless) Initialize the bank-level JupLend position.",
1336
1435
  "",
1337
- "* `reward_index` index of the reward token in the Kamino Farm's reward list"
1436
+ "This creates the bank's fToken ATA (owned by the bank liquidity vault authority) and",
1437
+ "performs a nominal seed deposit into JupLend, then flips the bank from `Paused` to",
1438
+ "`Operational`."
1338
1439
  ];
1339
- discriminator: [163, 202, 248, 141, 106, 20, 116, 5];
1440
+ discriminator: [176, 255, 151, 106, 5, 207, 74, 215];
1340
1441
  accounts: [
1341
1442
  {
1342
- name: "bank";
1443
+ name: "feePayer";
1444
+ docs: ["Provides a nominal deposit amount."];
1445
+ writable: true;
1446
+ signer: true;
1343
1447
  },
1344
1448
  {
1345
- name: "feeState";
1346
- docs: ["Global fee state that contains the global_fee_admin"];
1347
- pda: {
1348
- seeds: [
1349
- {
1350
- kind: "const";
1351
- value: [102, 101, 101, 115, 116, 97, 116, 101];
1352
- }
1353
- ];
1354
- };
1449
+ name: "signerTokenAccount";
1450
+ docs: ["Token account owned by the fee payer holding the underlying mint."];
1451
+ writable: true;
1355
1452
  },
1356
1453
  {
1357
- name: "destinationTokenAccount";
1358
- docs: ["Destination token account must be owned by the global fee admin"];
1454
+ name: "bank";
1359
1455
  writable: true;
1360
- pda: {
1361
- seeds: [
1362
- {
1363
- kind: "account";
1364
- path: "feeState";
1365
- },
1366
- {
1367
- kind: "account";
1368
- path: "tokenProgram";
1369
- },
1370
- {
1371
- kind: "account";
1372
- path: "rewardMint";
1373
- }
1374
- ];
1375
- program: {
1376
- kind: "const";
1377
- value: [
1378
- 140,
1379
- 151,
1380
- 37,
1381
- 143,
1382
- 78,
1383
- 36,
1384
- 137,
1385
- 241,
1386
- 187,
1387
- 61,
1388
- 16,
1389
- 41,
1390
- 20,
1391
- 142,
1392
- 13,
1393
- 131,
1394
- 11,
1395
- 90,
1396
- 19,
1397
- 153,
1398
- 218,
1399
- 255,
1400
- 16,
1401
- 132,
1402
- 4,
1403
- 142,
1404
- 123,
1405
- 216,
1406
- 219,
1407
- 233,
1408
- 248,
1409
- 89
1410
- ];
1411
- };
1412
- };
1413
1456
  },
1414
1457
  {
1415
1458
  name: "liquidityVaultAuthority";
1416
- docs: ["The bank's liquidity vault authority, which owns the Kamino obligation."];
1459
+ docs: ["The bank's liquidity vault authority PDA (acts as signer for JupLend CPIs)."];
1417
1460
  writable: true;
1418
1461
  pda: {
1419
1462
  seeds: [
@@ -1450,48 +1493,584 @@ type Marginfi = {
1450
1493
  };
1451
1494
  },
1452
1495
  {
1453
- name: "userState";
1496
+ name: "liquidityVault";
1497
+ docs: [
1498
+ "Bank liquidity vault (holds underlying mint and is used as depositor_token_account)."
1499
+ ];
1454
1500
  writable: true;
1501
+ relations: ["bank"];
1455
1502
  },
1456
1503
  {
1457
- name: "farmState";
1504
+ name: "mint";
1505
+ docs: ["Underlying mint (must match bank mint and JupLend lending state mint)."];
1506
+ relations: ["bank"];
1507
+ },
1508
+ {
1509
+ name: "integrationAcc1";
1510
+ docs: ["JupLend lending state account."];
1458
1511
  writable: true;
1512
+ relations: ["bank"];
1459
1513
  },
1460
1514
  {
1461
- name: "globalConfig";
1515
+ name: "fTokenMint";
1516
+ docs: ["JupLend fToken mint."];
1517
+ writable: true;
1518
+ relations: ["integrationAcc1"];
1462
1519
  },
1463
1520
  {
1464
- name: "rewardMint";
1521
+ name: "integrationAcc2";
1522
+ docs: ["Bank's fToken vault (validated via has_one on bank)."];
1523
+ writable: true;
1524
+ relations: ["bank"];
1465
1525
  },
1466
1526
  {
1467
- name: "userRewardAta";
1468
- docs: ["An initialized ATA of type reward mint owned by liquidity vault"];
1527
+ name: "lendingAdmin";
1528
+ },
1529
+ {
1530
+ name: "supplyTokenReservesLiquidity";
1469
1531
  writable: true;
1470
1532
  },
1471
1533
  {
1472
- name: "rewardsVault";
1534
+ name: "lendingSupplyPositionOnLiquidity";
1473
1535
  writable: true;
1474
1536
  },
1475
1537
  {
1476
- name: "rewardsTreasuryVault";
1538
+ name: "rateModel";
1539
+ },
1540
+ {
1541
+ name: "vault";
1477
1542
  writable: true;
1478
1543
  },
1479
1544
  {
1480
- name: "farmVaultsAuthority";
1545
+ name: "liquidity";
1546
+ writable: true;
1481
1547
  },
1482
1548
  {
1483
- name: "scopePrices";
1484
- optional: true;
1549
+ name: "liquidityProgram";
1485
1550
  },
1486
1551
  {
1487
- name: "farmsProgram";
1488
- address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr";
1552
+ name: "rewardsRateModel";
1553
+ },
1554
+ {
1555
+ name: "juplendProgram";
1556
+ address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9";
1489
1557
  },
1490
1558
  {
1491
1559
  name: "tokenProgram";
1492
- }
1493
- ];
1494
- args: [
1560
+ },
1561
+ {
1562
+ name: "associatedTokenProgram";
1563
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1564
+ },
1565
+ {
1566
+ name: "systemProgram";
1567
+ address: "11111111111111111111111111111111";
1568
+ }
1569
+ ];
1570
+ args: [
1571
+ {
1572
+ name: "amount";
1573
+ type: "u64";
1574
+ }
1575
+ ];
1576
+ },
1577
+ {
1578
+ name: "juplendWithdraw";
1579
+ docs: [
1580
+ "(user) Withdraw from a JupLend lending pool through a marginfi account.",
1581
+ "* amount - in the underlying token (e.g., USDC), in native decimals"
1582
+ ];
1583
+ discriminator: [245, 164, 253, 202, 53, 77, 251, 221];
1584
+ accounts: [
1585
+ {
1586
+ name: "group";
1587
+ writable: true;
1588
+ relations: ["marginfiAccount", "bank"];
1589
+ },
1590
+ {
1591
+ name: "marginfiAccount";
1592
+ writable: true;
1593
+ },
1594
+ {
1595
+ name: "authority";
1596
+ signer: true;
1597
+ },
1598
+ {
1599
+ name: "bank";
1600
+ writable: true;
1601
+ },
1602
+ {
1603
+ name: "destinationTokenAccount";
1604
+ docs: [
1605
+ "Token account that will receive the underlying withdrawal.",
1606
+ "WARN: Completely unchecked!"
1607
+ ];
1608
+ writable: true;
1609
+ },
1610
+ {
1611
+ name: "liquidityVaultAuthority";
1612
+ docs: [
1613
+ "The bank's liquidity vault authority PDA (acts as signer for JupLend CPIs).",
1614
+ "NOTE: JupLend marks the signer as writable in their withdraw instruction."
1615
+ ];
1616
+ writable: true;
1617
+ pda: {
1618
+ seeds: [
1619
+ {
1620
+ kind: "const";
1621
+ value: [
1622
+ 108,
1623
+ 105,
1624
+ 113,
1625
+ 117,
1626
+ 105,
1627
+ 100,
1628
+ 105,
1629
+ 116,
1630
+ 121,
1631
+ 95,
1632
+ 118,
1633
+ 97,
1634
+ 117,
1635
+ 108,
1636
+ 116,
1637
+ 95,
1638
+ 97,
1639
+ 117,
1640
+ 116,
1641
+ 104
1642
+ ];
1643
+ },
1644
+ {
1645
+ kind: "account";
1646
+ path: "bank";
1647
+ }
1648
+ ];
1649
+ };
1650
+ },
1651
+ {
1652
+ name: "mint";
1653
+ docs: ["Underlying mint."];
1654
+ relations: ["bank"];
1655
+ },
1656
+ {
1657
+ name: "integrationAcc1";
1658
+ docs: ["JupLend lending state account."];
1659
+ writable: true;
1660
+ relations: ["bank"];
1661
+ },
1662
+ {
1663
+ name: "fTokenMint";
1664
+ docs: ["JupLend fToken mint."];
1665
+ writable: true;
1666
+ relations: ["integrationAcc1"];
1667
+ },
1668
+ {
1669
+ name: "integrationAcc2";
1670
+ docs: ["Bank's fToken vault (validated via has_one on bank)."];
1671
+ writable: true;
1672
+ relations: ["bank"];
1673
+ },
1674
+ {
1675
+ name: "integrationAcc3";
1676
+ docs: [
1677
+ "Withdraw intermediary ATA (authority = liquidity_vault_authority).",
1678
+ "This must be an ATA to satisfy JupLend's withdraw constraints."
1679
+ ];
1680
+ writable: true;
1681
+ relations: ["bank"];
1682
+ },
1683
+ {
1684
+ name: "lendingAdmin";
1685
+ },
1686
+ {
1687
+ name: "supplyTokenReservesLiquidity";
1688
+ writable: true;
1689
+ },
1690
+ {
1691
+ name: "lendingSupplyPositionOnLiquidity";
1692
+ writable: true;
1693
+ },
1694
+ {
1695
+ name: "rateModel";
1696
+ },
1697
+ {
1698
+ name: "vault";
1699
+ writable: true;
1700
+ },
1701
+ {
1702
+ name: "claimAccount";
1703
+ docs: [
1704
+ "JupLend claim account for liquidity_vault_authority.",
1705
+ "TEMPORARY: Mainnet currently requires this account (passing None causes ConstraintMut errors),",
1706
+ "but an upcoming upgrade is expected to make it truly optional. The account is never actually",
1707
+ "validated or used - you can pass any mutable account. We create the canonical PDA for consistency.",
1708
+ 'Seeds: ["user_claim", liquidity_vault_authority, mint] on Liquidity program.'
1709
+ ];
1710
+ writable: true;
1711
+ },
1712
+ {
1713
+ name: "liquidity";
1714
+ writable: true;
1715
+ },
1716
+ {
1717
+ name: "liquidityProgram";
1718
+ },
1719
+ {
1720
+ name: "rewardsRateModel";
1721
+ },
1722
+ {
1723
+ name: "juplendProgram";
1724
+ address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9";
1725
+ },
1726
+ {
1727
+ name: "tokenProgram";
1728
+ },
1729
+ {
1730
+ name: "associatedTokenProgram";
1731
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1732
+ },
1733
+ {
1734
+ name: "systemProgram";
1735
+ address: "11111111111111111111111111111111";
1736
+ }
1737
+ ];
1738
+ args: [
1739
+ {
1740
+ name: "amount";
1741
+ type: "u64";
1742
+ },
1743
+ {
1744
+ name: "withdrawAll";
1745
+ type: {
1746
+ option: "bool";
1747
+ };
1748
+ }
1749
+ ];
1750
+ },
1751
+ {
1752
+ name: "kaminoDeposit";
1753
+ docs: [
1754
+ "(user) Deposit into a Kamino pool through a marginfi account",
1755
+ "* amount - in the liquidity token (e.g. if there is a Kamino USDC bank, pass the amount of",
1756
+ "USDC desired), in native decimals."
1757
+ ];
1758
+ discriminator: [237, 8, 188, 187, 115, 99, 49, 85];
1759
+ accounts: [
1760
+ {
1761
+ name: "group";
1762
+ writable: true;
1763
+ relations: ["marginfiAccount", "bank"];
1764
+ },
1765
+ {
1766
+ name: "marginfiAccount";
1767
+ writable: true;
1768
+ },
1769
+ {
1770
+ name: "authority";
1771
+ signer: true;
1772
+ },
1773
+ {
1774
+ name: "bank";
1775
+ writable: true;
1776
+ },
1777
+ {
1778
+ name: "signerTokenAccount";
1779
+ docs: ["Owned by authority, the source account for the token deposit."];
1780
+ writable: true;
1781
+ },
1782
+ {
1783
+ name: "liquidityVaultAuthority";
1784
+ docs: [
1785
+ "The bank's liquidity vault authority, which owns the Kamino obligation. Note: Kamino needs",
1786
+ "this to be mut because `deposit` might return the rent here"
1787
+ ];
1788
+ writable: true;
1789
+ pda: {
1790
+ seeds: [
1791
+ {
1792
+ kind: "const";
1793
+ value: [
1794
+ 108,
1795
+ 105,
1796
+ 113,
1797
+ 117,
1798
+ 105,
1799
+ 100,
1800
+ 105,
1801
+ 116,
1802
+ 121,
1803
+ 95,
1804
+ 118,
1805
+ 97,
1806
+ 117,
1807
+ 108,
1808
+ 116,
1809
+ 95,
1810
+ 97,
1811
+ 117,
1812
+ 116,
1813
+ 104
1814
+ ];
1815
+ },
1816
+ {
1817
+ kind: "account";
1818
+ path: "bank";
1819
+ }
1820
+ ];
1821
+ };
1822
+ },
1823
+ {
1824
+ name: "liquidityVault";
1825
+ docs: ["Used as an intermediary to deposit token into Kamino"];
1826
+ writable: true;
1827
+ relations: ["bank"];
1828
+ },
1829
+ {
1830
+ name: "integrationAcc2";
1831
+ writable: true;
1832
+ relations: ["bank"];
1833
+ },
1834
+ {
1835
+ name: "lendingMarket";
1836
+ },
1837
+ {
1838
+ name: "lendingMarketAuthority";
1839
+ },
1840
+ {
1841
+ name: "integrationAcc1";
1842
+ docs: ["The Kamino reserve that holds liquidity"];
1843
+ writable: true;
1844
+ relations: ["bank"];
1845
+ },
1846
+ {
1847
+ name: "mint";
1848
+ docs: [
1849
+ "Bank's liquidity token mint (e.g., USDC). Kamino calls this the `reserve_liquidity_mint`"
1850
+ ];
1851
+ relations: ["bank"];
1852
+ },
1853
+ {
1854
+ name: "reserveLiquiditySupply";
1855
+ writable: true;
1856
+ },
1857
+ {
1858
+ name: "reserveCollateralMint";
1859
+ docs: ["The reserve's mint for tokenized representations of Kamino deposits."];
1860
+ writable: true;
1861
+ },
1862
+ {
1863
+ name: "reserveDestinationDepositCollateral";
1864
+ docs: [
1865
+ "The reserve's destination for tokenized representations of deposits. Note: the",
1866
+ "`reserve_collateral_mint` will mint tokens directly to this account."
1867
+ ];
1868
+ writable: true;
1869
+ },
1870
+ {
1871
+ name: "obligationFarmUserState";
1872
+ docs: ["Required if the Kamino reserve has an active farm."];
1873
+ writable: true;
1874
+ optional: true;
1875
+ },
1876
+ {
1877
+ name: "reserveFarmState";
1878
+ docs: ["Required if the Kamino reserve has an active farm."];
1879
+ writable: true;
1880
+ optional: true;
1881
+ },
1882
+ {
1883
+ name: "kaminoProgram";
1884
+ address: "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD";
1885
+ },
1886
+ {
1887
+ name: "farmsProgram";
1888
+ docs: ["Farms program for Kamino staking functionality"];
1889
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr";
1890
+ },
1891
+ {
1892
+ name: "collateralTokenProgram";
1893
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1894
+ },
1895
+ {
1896
+ name: "liquidityTokenProgram";
1897
+ },
1898
+ {
1899
+ name: "instructionSysvarAccount";
1900
+ address: "Sysvar1nstructions1111111111111111111111111";
1901
+ }
1902
+ ];
1903
+ args: [
1904
+ {
1905
+ name: "amount";
1906
+ type: "u64";
1907
+ }
1908
+ ];
1909
+ },
1910
+ {
1911
+ name: "kaminoHarvestReward";
1912
+ docs: [
1913
+ "(permissionless) Harvest the specified reward index from the Kamino Farm attached to this",
1914
+ "bank. Rewards are always sent to the global fee wallet's canonical ATA.",
1915
+ "",
1916
+ "* `reward_index` — index of the reward token in the Kamino Farm's reward list"
1917
+ ];
1918
+ discriminator: [163, 202, 248, 141, 106, 20, 116, 5];
1919
+ accounts: [
1920
+ {
1921
+ name: "bank";
1922
+ },
1923
+ {
1924
+ name: "feeState";
1925
+ docs: ["Global fee state that contains the global_fee_admin"];
1926
+ pda: {
1927
+ seeds: [
1928
+ {
1929
+ kind: "const";
1930
+ value: [102, 101, 101, 115, 116, 97, 116, 101];
1931
+ }
1932
+ ];
1933
+ };
1934
+ },
1935
+ {
1936
+ name: "destinationTokenAccount";
1937
+ docs: ["Destination token account must be owned by the global fee admin"];
1938
+ writable: true;
1939
+ pda: {
1940
+ seeds: [
1941
+ {
1942
+ kind: "account";
1943
+ path: "feeState";
1944
+ },
1945
+ {
1946
+ kind: "account";
1947
+ path: "tokenProgram";
1948
+ },
1949
+ {
1950
+ kind: "account";
1951
+ path: "rewardMint";
1952
+ }
1953
+ ];
1954
+ program: {
1955
+ kind: "const";
1956
+ value: [
1957
+ 140,
1958
+ 151,
1959
+ 37,
1960
+ 143,
1961
+ 78,
1962
+ 36,
1963
+ 137,
1964
+ 241,
1965
+ 187,
1966
+ 61,
1967
+ 16,
1968
+ 41,
1969
+ 20,
1970
+ 142,
1971
+ 13,
1972
+ 131,
1973
+ 11,
1974
+ 90,
1975
+ 19,
1976
+ 153,
1977
+ 218,
1978
+ 255,
1979
+ 16,
1980
+ 132,
1981
+ 4,
1982
+ 142,
1983
+ 123,
1984
+ 216,
1985
+ 219,
1986
+ 233,
1987
+ 248,
1988
+ 89
1989
+ ];
1990
+ };
1991
+ };
1992
+ },
1993
+ {
1994
+ name: "liquidityVaultAuthority";
1995
+ docs: ["The bank's liquidity vault authority, which owns the Kamino obligation."];
1996
+ writable: true;
1997
+ pda: {
1998
+ seeds: [
1999
+ {
2000
+ kind: "const";
2001
+ value: [
2002
+ 108,
2003
+ 105,
2004
+ 113,
2005
+ 117,
2006
+ 105,
2007
+ 100,
2008
+ 105,
2009
+ 116,
2010
+ 121,
2011
+ 95,
2012
+ 118,
2013
+ 97,
2014
+ 117,
2015
+ 108,
2016
+ 116,
2017
+ 95,
2018
+ 97,
2019
+ 117,
2020
+ 116,
2021
+ 104
2022
+ ];
2023
+ },
2024
+ {
2025
+ kind: "account";
2026
+ path: "bank";
2027
+ }
2028
+ ];
2029
+ };
2030
+ },
2031
+ {
2032
+ name: "userState";
2033
+ writable: true;
2034
+ },
2035
+ {
2036
+ name: "farmState";
2037
+ writable: true;
2038
+ },
2039
+ {
2040
+ name: "globalConfig";
2041
+ },
2042
+ {
2043
+ name: "rewardMint";
2044
+ },
2045
+ {
2046
+ name: "userRewardAta";
2047
+ docs: ["An initialized ATA of type reward mint owned by liquidity vault"];
2048
+ writable: true;
2049
+ },
2050
+ {
2051
+ name: "rewardsVault";
2052
+ writable: true;
2053
+ },
2054
+ {
2055
+ name: "rewardsTreasuryVault";
2056
+ writable: true;
2057
+ },
2058
+ {
2059
+ name: "farmVaultsAuthority";
2060
+ },
2061
+ {
2062
+ name: "scopePrices";
2063
+ optional: true;
2064
+ },
2065
+ {
2066
+ name: "farmsProgram";
2067
+ address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr";
2068
+ },
2069
+ {
2070
+ name: "tokenProgram";
2071
+ }
2072
+ ];
2073
+ args: [
1495
2074
  {
1496
2075
  name: "rewardIndex";
1497
2076
  type: "u64";
@@ -1726,7 +2305,10 @@ type Marginfi = {
1726
2305
  },
1727
2306
  {
1728
2307
  name: "destinationTokenAccount";
1729
- docs: ["Token account that will get tokens back", "WARN: Completely unchecked!"];
2308
+ docs: [
2309
+ "Token account that will receive the withdrawn tokens. Mint/owner are validated by the",
2310
+ "SPL transfer; the caller controls the destination."
2311
+ ];
1730
2312
  writable: true;
1731
2313
  },
1732
2314
  {
@@ -1875,10 +2457,15 @@ type Marginfi = {
1875
2457
  },
1876
2458
  {
1877
2459
  name: "lendingAccountBorrow";
2460
+ docs: [
2461
+ "(account authority) Borrow assets from a bank. Accrues interest, records liability, applies",
2462
+ "origination fee, transfers tokens, and runs a health check."
2463
+ ];
1878
2464
  discriminator: [4, 126, 116, 53, 48, 5, 212, 31];
1879
2465
  accounts: [
1880
2466
  {
1881
2467
  name: "group";
2468
+ writable: true;
1882
2469
  relations: ["marginfiAccount", "bank"];
1883
2470
  },
1884
2471
  {
@@ -1951,6 +2538,10 @@ type Marginfi = {
1951
2538
  },
1952
2539
  {
1953
2540
  name: "lendingAccountCloseBalance";
2541
+ docs: [
2542
+ "(account authority) Close a balance position with dust-level amounts. Claims outstanding",
2543
+ "emissions before closing."
2544
+ ];
1954
2545
  discriminator: [245, 54, 41, 4, 243, 202, 31, 17];
1955
2546
  accounts: [
1956
2547
  {
@@ -1974,10 +2565,15 @@ type Marginfi = {
1974
2565
  },
1975
2566
  {
1976
2567
  name: "lendingAccountDeposit";
2568
+ docs: [
2569
+ "(account authority) Deposit assets into a bank. Accrues interest, records deposit, and",
2570
+ "transfers tokens from the signer's token account to the bank's liquidity vault."
2571
+ ];
1977
2572
  discriminator: [171, 94, 235, 103, 82, 64, 212, 140];
1978
2573
  accounts: [
1979
2574
  {
1980
2575
  name: "group";
2576
+ writable: true;
1981
2577
  relations: ["marginfiAccount", "bank"];
1982
2578
  },
1983
2579
  {
@@ -2020,6 +2616,7 @@ type Marginfi = {
2020
2616
  },
2021
2617
  {
2022
2618
  name: "lendingAccountEndFlashloan";
2619
+ docs: ["(account authority) End a flash loan and run the health check."];
2023
2620
  discriminator: [105, 124, 201, 106, 153, 2, 8, 156];
2024
2621
  accounts: [
2025
2622
  {
@@ -2036,7 +2633,14 @@ type Marginfi = {
2036
2633
  },
2037
2634
  {
2038
2635
  name: "lendingAccountLiquidate";
2039
- docs: ["Liquidate a lending account balance of an unhealthy marginfi account"];
2636
+ docs: [
2637
+ "(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
2638
+ "The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
2639
+ "fee + 2.5% insurance fee).",
2640
+ "* `asset_amount` - amount of collateral to liquidate",
2641
+ "* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
2642
+ "* `liquidator_accounts` - number of remaining accounts for the liquidator"
2643
+ ];
2040
2644
  discriminator: [214, 169, 151, 213, 251, 167, 86, 219];
2041
2645
  accounts: [
2042
2646
  {
@@ -2175,10 +2779,15 @@ type Marginfi = {
2175
2779
  },
2176
2780
  {
2177
2781
  name: "lendingAccountRepay";
2782
+ docs: [
2783
+ "(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
2784
+ "interest, records repayment, and transfers tokens to the bank's liquidity vault."
2785
+ ];
2178
2786
  discriminator: [79, 209, 172, 177, 222, 51, 173, 151];
2179
2787
  accounts: [
2180
2788
  {
2181
2789
  name: "group";
2790
+ writable: true;
2182
2791
  relations: ["marginfiAccount", "bank"];
2183
2792
  },
2184
2793
  {
@@ -2188,10 +2797,10 @@ type Marginfi = {
2188
2797
  {
2189
2798
  name: "authority";
2190
2799
  docs: [
2191
- "Must be marginfi_account's authority, unless in liquidation/deleverage receivership",
2800
+ "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
2192
2801
  "",
2193
- "Note: during receivership, there are no signer checks whatsoever: any key can repay as",
2194
- "long as the invariants checked at the end of receivership are met."
2802
+ "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
2803
+ "long as the invariants checked at the end of execution are met."
2195
2804
  ];
2196
2805
  signer: true;
2197
2806
  },
@@ -2227,6 +2836,9 @@ type Marginfi = {
2227
2836
  },
2228
2837
  {
2229
2838
  name: "lendingAccountSettleEmissions";
2839
+ docs: [
2840
+ "(permissionless) Settle unclaimed emissions into a user's balance without withdrawing."
2841
+ ];
2230
2842
  discriminator: [161, 58, 136, 174, 242, 223, 156, 176];
2231
2843
  accounts: [
2232
2844
  {
@@ -2242,6 +2854,10 @@ type Marginfi = {
2242
2854
  },
2243
2855
  {
2244
2856
  name: "lendingAccountStartFlashloan";
2857
+ docs: [
2858
+ "(account authority) Start a flash loan. Must have a corresponding `end_flashloan` ix in the",
2859
+ "same tx. Health checks are skipped until the flash loan ends."
2860
+ ];
2245
2861
  discriminator: [14, 131, 33, 220, 81, 186, 180, 107];
2246
2862
  accounts: [
2247
2863
  {
@@ -2267,6 +2883,11 @@ type Marginfi = {
2267
2883
  },
2268
2884
  {
2269
2885
  name: "lendingAccountWithdraw";
2886
+ docs: [
2887
+ "(account authority, or any signer during receivership) Withdraw assets from a bank. Accrues",
2888
+ "interest, records withdrawal, transfers tokens, and runs a health check (skipped during",
2889
+ "receivership)."
2890
+ ];
2270
2891
  discriminator: [36, 72, 74, 19, 210, 210, 192, 192];
2271
2892
  accounts: [
2272
2893
  {
@@ -2281,10 +2902,10 @@ type Marginfi = {
2281
2902
  {
2282
2903
  name: "authority";
2283
2904
  docs: [
2284
- "Must be marginfi_account's authority, unless in liquidation/deleverage receivership",
2905
+ "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
2285
2906
  "",
2286
- "Note: during receivership, there are no signer checks whatsoever: any key can repay as",
2287
- "long as the invariants checked at the end of receivership are met."
2907
+ "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
2908
+ "long as the invariants checked at the end of execution are met."
2288
2909
  ];
2289
2910
  signer: true;
2290
2911
  },
@@ -2356,6 +2977,9 @@ type Marginfi = {
2356
2977
  },
2357
2978
  {
2358
2979
  name: "lendingAccountWithdrawEmissions";
2980
+ docs: [
2981
+ "(account authority) Settle and withdraw emissions rewards to a destination token account."
2982
+ ];
2359
2983
  discriminator: [234, 22, 84, 214, 118, 176, 140, 170];
2360
2984
  accounts: [
2361
2985
  {
@@ -2478,6 +3102,9 @@ type Marginfi = {
2478
3102
  },
2479
3103
  {
2480
3104
  name: "lendingAccountWithdrawEmissionsPermissionless";
3105
+ docs: [
3106
+ "(permissionless) Withdraw emissions to the user's pre-configured emissions destination ATA."
3107
+ ];
2481
3108
  discriminator: [4, 174, 124, 203, 44, 49, 145, 150];
2482
3109
  accounts: [
2483
3110
  {
@@ -2597,6 +3224,9 @@ type Marginfi = {
2597
3224
  },
2598
3225
  {
2599
3226
  name: "lendingPoolAccrueBankInterest";
3227
+ docs: [
3228
+ "(permissionless) Accrue interest on a bank, updating share values and collecting fees."
3229
+ ];
2600
3230
  discriminator: [108, 201, 30, 87, 47, 65, 97, 188];
2601
3231
  accounts: [
2602
3232
  {
@@ -2612,6 +3242,7 @@ type Marginfi = {
2612
3242
  },
2613
3243
  {
2614
3244
  name: "lendingPoolAddBank";
3245
+ docs: ["(admin only) Add a new bank to the lending pool"];
2615
3246
  discriminator: [215, 68, 72, 78, 208, 218, 103, 182];
2616
3247
  accounts: [
2617
3248
  {
@@ -3140,6 +3771,254 @@ type Marginfi = {
3140
3771
  }
3141
3772
  ];
3142
3773
  },
3774
+ {
3775
+ name: "lendingPoolAddBankJuplend";
3776
+ docs: [
3777
+ "(admin) Add a JupLend bank to the marginfi group.",
3778
+ "",
3779
+ "Remaining accounts (for oracle validation):",
3780
+ "0. underlying oracle feed (pyth push or switchboard pull)",
3781
+ "1. JupLend `Lending` state"
3782
+ ];
3783
+ discriminator: [18, 208, 117, 90, 53, 111, 195, 41];
3784
+ accounts: [
3785
+ {
3786
+ name: "group";
3787
+ writable: true;
3788
+ },
3789
+ {
3790
+ name: "admin";
3791
+ signer: true;
3792
+ relations: ["group"];
3793
+ },
3794
+ {
3795
+ name: "feePayer";
3796
+ writable: true;
3797
+ signer: true;
3798
+ },
3799
+ {
3800
+ name: "bankMint";
3801
+ docs: ["Must match the mint used by the JupLend lending state."];
3802
+ },
3803
+ {
3804
+ name: "bank";
3805
+ writable: true;
3806
+ pda: {
3807
+ seeds: [
3808
+ {
3809
+ kind: "account";
3810
+ path: "group";
3811
+ },
3812
+ {
3813
+ kind: "account";
3814
+ path: "bankMint";
3815
+ },
3816
+ {
3817
+ kind: "arg";
3818
+ path: "bankSeed";
3819
+ }
3820
+ ];
3821
+ };
3822
+ },
3823
+ {
3824
+ name: "integrationAcc1";
3825
+ docs: ["JupLend lending state account that must match the bank mint."];
3826
+ },
3827
+ {
3828
+ name: "liquidityVaultAuthority";
3829
+ docs: [
3830
+ "Will be authority of the bank's liquidity vault. Used as intermediary for deposits/withdraws."
3831
+ ];
3832
+ pda: {
3833
+ seeds: [
3834
+ {
3835
+ kind: "const";
3836
+ value: [
3837
+ 108,
3838
+ 105,
3839
+ 113,
3840
+ 117,
3841
+ 105,
3842
+ 100,
3843
+ 105,
3844
+ 116,
3845
+ 121,
3846
+ 95,
3847
+ 118,
3848
+ 97,
3849
+ 117,
3850
+ 108,
3851
+ 116,
3852
+ 95,
3853
+ 97,
3854
+ 117,
3855
+ 116,
3856
+ 104
3857
+ ];
3858
+ },
3859
+ {
3860
+ kind: "account";
3861
+ path: "bank";
3862
+ }
3863
+ ];
3864
+ };
3865
+ },
3866
+ {
3867
+ name: "liquidityVault";
3868
+ docs: [
3869
+ "For JupLend banks, the `liquidity_vault` is used as an intermediary when depositing/",
3870
+ "withdrawing, e.g., withdrawn funds move from JupLend -> here -> the user's token account."
3871
+ ];
3872
+ writable: true;
3873
+ pda: {
3874
+ seeds: [
3875
+ {
3876
+ kind: "const";
3877
+ value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116];
3878
+ },
3879
+ {
3880
+ kind: "account";
3881
+ path: "bank";
3882
+ }
3883
+ ];
3884
+ };
3885
+ },
3886
+ {
3887
+ name: "insuranceVaultAuthority";
3888
+ docs: ["Note: Currently does nothing."];
3889
+ pda: {
3890
+ seeds: [
3891
+ {
3892
+ kind: "const";
3893
+ value: [
3894
+ 105,
3895
+ 110,
3896
+ 115,
3897
+ 117,
3898
+ 114,
3899
+ 97,
3900
+ 110,
3901
+ 99,
3902
+ 101,
3903
+ 95,
3904
+ 118,
3905
+ 97,
3906
+ 117,
3907
+ 108,
3908
+ 116,
3909
+ 95,
3910
+ 97,
3911
+ 117,
3912
+ 116,
3913
+ 104
3914
+ ];
3915
+ },
3916
+ {
3917
+ kind: "account";
3918
+ path: "bank";
3919
+ }
3920
+ ];
3921
+ };
3922
+ },
3923
+ {
3924
+ name: "insuranceVault";
3925
+ docs: ["Note: Currently does nothing."];
3926
+ writable: true;
3927
+ pda: {
3928
+ seeds: [
3929
+ {
3930
+ kind: "const";
3931
+ value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116];
3932
+ },
3933
+ {
3934
+ kind: "account";
3935
+ path: "bank";
3936
+ }
3937
+ ];
3938
+ };
3939
+ },
3940
+ {
3941
+ name: "feeVaultAuthority";
3942
+ pda: {
3943
+ seeds: [
3944
+ {
3945
+ kind: "const";
3946
+ value: [102, 101, 101, 95, 118, 97, 117, 108, 116, 95, 97, 117, 116, 104];
3947
+ },
3948
+ {
3949
+ kind: "account";
3950
+ path: "bank";
3951
+ }
3952
+ ];
3953
+ };
3954
+ },
3955
+ {
3956
+ name: "feeVault";
3957
+ writable: true;
3958
+ pda: {
3959
+ seeds: [
3960
+ {
3961
+ kind: "const";
3962
+ value: [102, 101, 101, 95, 118, 97, 117, 108, 116];
3963
+ },
3964
+ {
3965
+ kind: "account";
3966
+ path: "bank";
3967
+ }
3968
+ ];
3969
+ };
3970
+ },
3971
+ {
3972
+ name: "fTokenMint";
3973
+ relations: ["integrationAcc1"];
3974
+ },
3975
+ {
3976
+ name: "integrationAcc2";
3977
+ docs: [
3978
+ "The bank's fToken vault holds the fTokens received when depositing into JupLend.",
3979
+ ""
3980
+ ];
3981
+ writable: true;
3982
+ pda: {
3983
+ seeds: [
3984
+ {
3985
+ kind: "const";
3986
+ value: [102, 95, 116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116];
3987
+ },
3988
+ {
3989
+ kind: "account";
3990
+ path: "bank";
3991
+ }
3992
+ ];
3993
+ };
3994
+ },
3995
+ {
3996
+ name: "tokenProgram";
3997
+ docs: [
3998
+ "Token program for both underlying mint and fToken mint (SPL Token or Token-2022).",
3999
+ "JupLend creates fToken mints using the same token program as the underlying."
4000
+ ];
4001
+ },
4002
+ {
4003
+ name: "systemProgram";
4004
+ address: "11111111111111111111111111111111";
4005
+ }
4006
+ ];
4007
+ args: [
4008
+ {
4009
+ name: "bankConfig";
4010
+ type: {
4011
+ defined: {
4012
+ name: "juplendConfigCompact";
4013
+ };
4014
+ };
4015
+ },
4016
+ {
4017
+ name: "bankSeed";
4018
+ type: "u64";
4019
+ }
4020
+ ];
4021
+ },
3143
4022
  {
3144
4023
  name: "lendingPoolAddBankKamino";
3145
4024
  docs: [
@@ -3372,6 +4251,9 @@ type Marginfi = {
3372
4251
  },
3373
4252
  {
3374
4253
  name: "lendingPoolAddBankPermissionless";
4254
+ docs: [
4255
+ "(permissionless) Add a staked collateral bank. Requires a valid SPL single-pool LST mint."
4256
+ ];
3375
4257
  discriminator: [127, 187, 121, 34, 187, 167, 238, 102];
3376
4258
  accounts: [
3377
4259
  {
@@ -3837,7 +4719,7 @@ type Marginfi = {
3837
4719
  {
3838
4720
  name: "lendingPoolAddBankWithSeed";
3839
4721
  docs: [
3840
- "A copy of lending_pool_add_bank with an additional bank seed.",
4722
+ "(admin only) A copy of lending_pool_add_bank with an additional bank seed.",
3841
4723
  "This seed is used to create a PDA for the bank's signature.",
3842
4724
  "lending_pool_add_bank is preserved for backwards compatibility."
3843
4725
  ];
@@ -4059,7 +4941,10 @@ type Marginfi = {
4059
4941
  },
4060
4942
  {
4061
4943
  name: "lendingPoolCloneBank";
4062
- docs: ["Staging or localnet only, panics on mainnet"];
4944
+ docs: [
4945
+ "(admin only) Staging or localnet only, panics on mainnet",
4946
+ "This instruction is used to clone a bank to a new PDA."
4947
+ ];
4063
4948
  discriminator: [214, 93, 17, 236, 177, 228, 78, 17];
4064
4949
  accounts: [
4065
4950
  {
@@ -4282,6 +5167,7 @@ type Marginfi = {
4282
5167
  },
4283
5168
  {
4284
5169
  name: "lendingPoolCloseBank";
5170
+ docs: ["(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares."];
4285
5171
  discriminator: [22, 115, 7, 130, 227, 85, 0, 47];
4286
5172
  accounts: [
4287
5173
  {
@@ -4304,6 +5190,10 @@ type Marginfi = {
4304
5190
  },
4305
5191
  {
4306
5192
  name: "lendingPoolCollectBankFees";
5193
+ docs: [
5194
+ "(permissionless) Transfer accrued fees from the liquidity vault to insurance/fee/program",
5195
+ "vaults."
5196
+ ];
4307
5197
  discriminator: [201, 5, 215, 116, 230, 92, 75, 150];
4308
5198
  accounts: [
4309
5199
  {
@@ -4425,7 +5315,10 @@ type Marginfi = {
4425
5315
  },
4426
5316
  {
4427
5317
  name: "lendingPoolConfigureBank";
4428
- docs: ["(admin only)"];
5318
+ docs: [
5319
+ "(admin only) Configure bank parameters. If the bank has `FREEZE_SETTINGS`, only",
5320
+ "deposit/borrow limits are updated and all other config changes are silently ignored."
5321
+ ];
4429
5322
  discriminator: [121, 173, 156, 40, 93, 148, 56, 237];
4430
5323
  accounts: [
4431
5324
  {
@@ -4494,7 +5387,10 @@ type Marginfi = {
4494
5387
  },
4495
5388
  {
4496
5389
  name: "lendingPoolConfigureBankInterestOnly";
4497
- docs: ["(delegate_curve_admin only)"];
5390
+ docs: [
5391
+ "(delegate_curve_admin only) Update interest rate config. Does nothing if bank has",
5392
+ "`FREEZE_SETTINGS`."
5393
+ ];
4498
5394
  discriminator: [245, 107, 83, 38, 103, 219, 163, 241];
4499
5395
  accounts: [
4500
5396
  {
@@ -4524,7 +5420,7 @@ type Marginfi = {
4524
5420
  },
4525
5421
  {
4526
5422
  name: "lendingPoolConfigureBankLimitsOnly";
4527
- docs: ["(delegate_limits_admin only)"];
5423
+ docs: ["(delegate_limit_admin only) Update deposit/borrow/init limits only."];
4528
5424
  discriminator: [157, 196, 221, 200, 202, 62, 84, 21];
4529
5425
  accounts: [
4530
5426
  {
@@ -4619,7 +5515,11 @@ type Marginfi = {
4619
5515
  },
4620
5516
  {
4621
5517
  name: "lendingPoolHandleBankruptcy";
4622
- docs: ["Handle bad debt of a bankrupt marginfi account for a given bank."];
5518
+ docs: [
5519
+ "(risk_admin or admin, unless `PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG` is set on the bank)",
5520
+ "Handle bad debt of a bankrupt marginfi account for a given bank. Covers bad debt from the",
5521
+ "insurance fund and socializes any remainder among depositors."
5522
+ ];
4623
5523
  discriminator: [162, 11, 56, 139, 90, 128, 70, 173];
4624
5524
  accounts: [
4625
5525
  {
@@ -4628,7 +5528,10 @@ type Marginfi = {
4628
5528
  },
4629
5529
  {
4630
5530
  name: "signer";
4631
- docs: ["PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG is not set"];
5531
+ docs: [
5532
+ "Must be risk_admin or admin, unless the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG",
5533
+ "set, in which case any signer is accepted."
5534
+ ];
4632
5535
  signer: true;
4633
5536
  },
4634
5537
  {
@@ -4720,6 +5623,7 @@ type Marginfi = {
4720
5623
  accounts: [
4721
5624
  {
4722
5625
  name: "group";
5626
+ writable: true;
4723
5627
  relations: ["bank"];
4724
5628
  },
4725
5629
  {
@@ -4999,6 +5903,7 @@ type Marginfi = {
4999
5903
  },
5000
5904
  {
5001
5905
  name: "lendingPoolUpdateFeesDestinationAccount";
5906
+ docs: ["(admin only) Set the destination wallet for permissionless fee withdrawals."];
5002
5907
  discriminator: [102, 4, 121, 243, 237, 110, 95, 13];
5003
5908
  accounts: [
5004
5909
  {
@@ -5023,6 +5928,7 @@ type Marginfi = {
5023
5928
  },
5024
5929
  {
5025
5930
  name: "lendingPoolWithdrawFees";
5931
+ docs: ["(admin only) Withdraw collected group fees from the fee vault."];
5026
5932
  discriminator: [92, 140, 215, 254, 170, 0, 83, 174];
5027
5933
  accounts: [
5028
5934
  {
@@ -5085,6 +5991,9 @@ type Marginfi = {
5085
5991
  },
5086
5992
  {
5087
5993
  name: "lendingPoolWithdrawFeesPermissionless";
5994
+ docs: [
5995
+ "(permissionless) Withdraw group fees to the pre-configured `fees_destination_account`."
5996
+ ];
5088
5997
  discriminator: [57, 245, 1, 208, 130, 18, 145, 113];
5089
5998
  accounts: [
5090
5999
  {
@@ -5143,6 +6052,7 @@ type Marginfi = {
5143
6052
  },
5144
6053
  {
5145
6054
  name: "lendingPoolWithdrawInsurance";
6055
+ docs: ["(admin only) Withdraw from the insurance vault."];
5146
6056
  discriminator: [108, 60, 60, 246, 104, 79, 159, 243];
5147
6057
  accounts: [
5148
6058
  {
@@ -5226,6 +6136,10 @@ type Marginfi = {
5226
6136
  },
5227
6137
  {
5228
6138
  name: "marginfiAccountClose";
6139
+ docs: [
6140
+ "(account authority) Close a marginfi account. Requires all balances to be empty and no",
6141
+ "active flags (disabled, flashloan, receivership)."
6142
+ ];
5229
6143
  discriminator: [186, 221, 93, 34, 50, 97, 194, 241];
5230
6144
  accounts: [
5231
6145
  {
@@ -5245,8 +6159,101 @@ type Marginfi = {
5245
6159
  ];
5246
6160
  args: [];
5247
6161
  },
6162
+ {
6163
+ name: "marginfiAccountCloseOrder";
6164
+ docs: ["(user) Close an existing Order, returning rent to the user"];
6165
+ discriminator: [212, 223, 79, 182, 172, 183, 205, 237];
6166
+ accounts: [
6167
+ {
6168
+ name: "marginfiAccount";
6169
+ writable: true;
6170
+ relations: ["order"];
6171
+ },
6172
+ {
6173
+ name: "authority";
6174
+ signer: true;
6175
+ relations: ["marginfiAccount"];
6176
+ },
6177
+ {
6178
+ name: "order";
6179
+ writable: true;
6180
+ },
6181
+ {
6182
+ name: "feeRecipient";
6183
+ writable: true;
6184
+ },
6185
+ {
6186
+ name: "systemProgram";
6187
+ address: "11111111111111111111111111111111";
6188
+ }
6189
+ ];
6190
+ args: [];
6191
+ },
6192
+ {
6193
+ name: "marginfiAccountEndExecuteOrder";
6194
+ docs: [
6195
+ "(permissionless keeper) End Order execution",
6196
+ "* Closes the Order (keeper keeps the rent)",
6197
+ "* Closes the borrow position involved in the Order, the lending position remains open",
6198
+ '* User health must be "unchanged" (within Order requirements i.e. minus slippage). Keeper',
6199
+ "may keep any slippage in excess of what was needed to complete the Order as profit.",
6200
+ "* `StartExecuteOrder` must appear earlier in the tx",
6201
+ "* Must appear last in the tx",
6202
+ "* CPI is forbidden",
6203
+ "* Returns rent for ephemeral accounts created during `StartExecuteOrder`"
6204
+ ];
6205
+ discriminator: [115, 42, 20, 93, 121, 84, 178, 83];
6206
+ accounts: [
6207
+ {
6208
+ name: "group";
6209
+ relations: ["marginfiAccount"];
6210
+ },
6211
+ {
6212
+ name: "marginfiAccount";
6213
+ docs: ["The account owning the order"];
6214
+ writable: true;
6215
+ relations: ["order"];
6216
+ },
6217
+ {
6218
+ name: "executor";
6219
+ docs: ["The executioner ☠️"];
6220
+ signer: true;
6221
+ relations: ["executeRecord"];
6222
+ },
6223
+ {
6224
+ name: "feeRecipient";
6225
+ writable: true;
6226
+ },
6227
+ {
6228
+ name: "order";
6229
+ writable: true;
6230
+ relations: ["executeRecord"];
6231
+ },
6232
+ {
6233
+ name: "executeRecord";
6234
+ docs: ["This keeps track of the relevant state to be checked at the end of execution."];
6235
+ writable: true;
6236
+ },
6237
+ {
6238
+ name: "feeState";
6239
+ pda: {
6240
+ seeds: [
6241
+ {
6242
+ kind: "const";
6243
+ value: [102, 101, 101, 115, 116, 97, 116, 101];
6244
+ }
6245
+ ];
6246
+ };
6247
+ }
6248
+ ];
6249
+ args: [];
6250
+ },
5248
6251
  {
5249
6252
  name: "marginfiAccountInitLiqRecord";
6253
+ docs: [
6254
+ "(permissionless) Initialize a liquidation record PDA for a marginfi account. The fee_payer",
6255
+ "pays rent; the record is required for receivership liquidation."
6256
+ ];
5250
6257
  discriminator: [236, 213, 238, 126, 147, 251, 164, 8];
5251
6258
  accounts: [
5252
6259
  {
@@ -5393,8 +6400,111 @@ type Marginfi = {
5393
6400
  }
5394
6401
  ];
5395
6402
  },
6403
+ {
6404
+ name: "marginfiAccountKeeperCloseOrder";
6405
+ docs: [
6406
+ "(permissionless keeper) Close an existing Order after the user account was closed, or it no",
6407
+ "longer as the associated positions, or the user has executed",
6408
+ "`marginfi_account_set_keeper_close_flags`. Keeper keeps the rent."
6409
+ ];
6410
+ discriminator: [128, 114, 71, 46, 194, 71, 186, 106];
6411
+ accounts: [
6412
+ {
6413
+ name: "marginfiAccount";
6414
+ docs: [
6415
+ "marginfi account was closed.",
6416
+ "The ownership check is checked in the handler or/and type checks are made in the handler."
6417
+ ];
6418
+ relations: ["order"];
6419
+ },
6420
+ {
6421
+ name: "feeRecipient";
6422
+ writable: true;
6423
+ },
6424
+ {
6425
+ name: "order";
6426
+ writable: true;
6427
+ }
6428
+ ];
6429
+ args: [];
6430
+ },
6431
+ {
6432
+ name: "marginfiAccountPlaceOrder";
6433
+ docs: [
6434
+ "(user) Create a new Order.",
6435
+ "* bank_keys - Currently only two keys: the lending position and borrowing position in the",
6436
+ "users's Balances for which the order is being placed",
6437
+ "* trigger - the type of order (stop loss, take profit, or both), and the threshold at which",
6438
+ "to trigger the order, in dollars"
6439
+ ];
6440
+ discriminator: [244, 112, 75, 138, 143, 108, 7, 186];
6441
+ accounts: [
6442
+ {
6443
+ name: "group";
6444
+ relations: ["marginfiAccount"];
6445
+ },
6446
+ {
6447
+ name: "marginfiAccount";
6448
+ writable: true;
6449
+ },
6450
+ {
6451
+ name: "feePayer";
6452
+ writable: true;
6453
+ signer: true;
6454
+ },
6455
+ {
6456
+ name: "authority";
6457
+ signer: true;
6458
+ relations: ["marginfiAccount"];
6459
+ },
6460
+ {
6461
+ name: "order";
6462
+ writable: true;
6463
+ },
6464
+ {
6465
+ name: "feeState";
6466
+ pda: {
6467
+ seeds: [
6468
+ {
6469
+ kind: "const";
6470
+ value: [102, 101, 101, 115, 116, 97, 116, 101];
6471
+ }
6472
+ ];
6473
+ };
6474
+ },
6475
+ {
6476
+ name: "globalFeeWallet";
6477
+ writable: true;
6478
+ relations: ["feeState"];
6479
+ },
6480
+ {
6481
+ name: "systemProgram";
6482
+ address: "11111111111111111111111111111111";
6483
+ }
6484
+ ];
6485
+ args: [
6486
+ {
6487
+ name: "bankKeys";
6488
+ type: {
6489
+ vec: "pubkey";
6490
+ };
6491
+ },
6492
+ {
6493
+ name: "trigger";
6494
+ type: {
6495
+ defined: {
6496
+ name: "orderTrigger";
6497
+ };
6498
+ };
6499
+ }
6500
+ ];
6501
+ },
5396
6502
  {
5397
6503
  name: "marginfiAccountSetFreeze";
6504
+ docs: [
6505
+ "(admin only) Freeze or unfreeze a marginfi account. Frozen accounts can only be operated on",
6506
+ "by the group admin."
6507
+ ];
5398
6508
  discriminator: [199, 179, 231, 30, 138, 247, 110, 227];
5399
6509
  accounts: [
5400
6510
  {
@@ -5417,8 +6527,112 @@ type Marginfi = {
5417
6527
  }
5418
6528
  ];
5419
6529
  },
6530
+ {
6531
+ name: "marginfiAccountSetKeeperCloseFlags";
6532
+ docs: [
6533
+ "(user) Purge flags from some balances, enabling a Keeper to call",
6534
+ "`marginfi_account_keeper_close_order` on associated Orders. Typically, use",
6535
+ "`marginfi_account_close_order` instead if trying to close an Order."
6536
+ ];
6537
+ discriminator: [82, 163, 165, 222, 212, 255, 33, 210];
6538
+ accounts: [
6539
+ {
6540
+ name: "marginfiAccount";
6541
+ writable: true;
6542
+ },
6543
+ {
6544
+ name: "authority";
6545
+ signer: true;
6546
+ relations: ["marginfiAccount"];
6547
+ }
6548
+ ];
6549
+ args: [
6550
+ {
6551
+ name: "bankKeysOpt";
6552
+ type: {
6553
+ option: {
6554
+ vec: "pubkey";
6555
+ };
6556
+ };
6557
+ }
6558
+ ];
6559
+ },
6560
+ {
6561
+ name: "marginfiAccountStartExecuteOrder";
6562
+ docs: [
6563
+ "(permissionless keeper) Begin Order execution",
6564
+ "* Enables the Keeper to withdraw/repay associated positions until the end of the tx",
6565
+ "* Only one `StartExecuteOrder` is allowed per tx",
6566
+ "* Must appear before `EndExecuteOrder` in the tx, and before any instructions except certain",
6567
+ "allowed ones (compute budget, kamino refresh, etc)",
6568
+ "* `EndExecuteOrder` must also appear in the tx",
6569
+ "* CPI is forbidden",
6570
+ "* Costs a small amount of rent, which is returned at the end of the tx, make sure you have",
6571
+ "enough SOL to start the tx."
6572
+ ];
6573
+ discriminator: [1, 70, 140, 134, 183, 29, 208, 224];
6574
+ accounts: [
6575
+ {
6576
+ name: "group";
6577
+ relations: ["marginfiAccount"];
6578
+ },
6579
+ {
6580
+ name: "marginfiAccount";
6581
+ docs: ["The account owning the order"];
6582
+ writable: true;
6583
+ relations: ["order"];
6584
+ },
6585
+ {
6586
+ name: "feePayer";
6587
+ writable: true;
6588
+ signer: true;
6589
+ },
6590
+ {
6591
+ name: "executor";
6592
+ docs: [
6593
+ "This account will have the authority to withdraw/repay as if they are the user authority",
6594
+ "until the end of the tx.",
6595
+ ""
6596
+ ];
6597
+ },
6598
+ {
6599
+ name: "order";
6600
+ writable: true;
6601
+ },
6602
+ {
6603
+ name: "executeRecord";
6604
+ docs: ["This keeps track of the relevant state to be checked at the end of execution."];
6605
+ writable: true;
6606
+ pda: {
6607
+ seeds: [
6608
+ {
6609
+ kind: "const";
6610
+ value: [101, 120, 101, 99, 117, 116, 101, 95, 111, 114, 100, 101, 114];
6611
+ },
6612
+ {
6613
+ kind: "account";
6614
+ path: "order";
6615
+ }
6616
+ ];
6617
+ };
6618
+ },
6619
+ {
6620
+ name: "instructionSysvar";
6621
+ address: "Sysvar1nstructions1111111111111111111111111";
6622
+ },
6623
+ {
6624
+ name: "systemProgram";
6625
+ address: "11111111111111111111111111111111";
6626
+ }
6627
+ ];
6628
+ args: [];
6629
+ },
5420
6630
  {
5421
6631
  name: "marginfiAccountUpdateEmissionsDestinationAccount";
6632
+ docs: [
6633
+ "(account authority) Set the wallet whose canonical ATA will receive permissionless emissions",
6634
+ "withdrawals."
6635
+ ];
5422
6636
  discriminator: [73, 185, 162, 201, 111, 24, 116, 185];
5423
6637
  accounts: [
5424
6638
  {
@@ -5439,6 +6653,11 @@ type Marginfi = {
5439
6653
  },
5440
6654
  {
5441
6655
  name: "marginfiGroupConfigure";
6656
+ docs: [
6657
+ "(admin only) Configure group admin keys and emode leverage caps. All admin keys must be",
6658
+ "provided on every call. Emode leverage caps are set if provided, otherwise the existing",
6659
+ "(non-zero) values are kept. Pass `Some(value)` to update, `None` to leave unchanged."
6660
+ ];
5442
6661
  discriminator: [62, 199, 81, 78, 33, 13, 236, 61];
5443
6662
  accounts: [
5444
6663
  {
@@ -5454,31 +6673,45 @@ type Marginfi = {
5454
6673
  args: [
5455
6674
  {
5456
6675
  name: "newAdmin";
5457
- type: "pubkey";
6676
+ type: {
6677
+ option: "pubkey";
6678
+ };
5458
6679
  },
5459
6680
  {
5460
6681
  name: "newEmodeAdmin";
5461
- type: "pubkey";
6682
+ type: {
6683
+ option: "pubkey";
6684
+ };
5462
6685
  },
5463
6686
  {
5464
6687
  name: "newCurveAdmin";
5465
- type: "pubkey";
6688
+ type: {
6689
+ option: "pubkey";
6690
+ };
5466
6691
  },
5467
6692
  {
5468
6693
  name: "newLimitAdmin";
5469
- type: "pubkey";
6694
+ type: {
6695
+ option: "pubkey";
6696
+ };
5470
6697
  },
5471
6698
  {
5472
6699
  name: "newEmissionsAdmin";
5473
- type: "pubkey";
6700
+ type: {
6701
+ option: "pubkey";
6702
+ };
5474
6703
  },
5475
6704
  {
5476
6705
  name: "newMetadataAdmin";
5477
- type: "pubkey";
6706
+ type: {
6707
+ option: "pubkey";
6708
+ };
5478
6709
  },
5479
6710
  {
5480
6711
  name: "newRiskAdmin";
5481
- type: "pubkey";
6712
+ type: {
6713
+ option: "pubkey";
6714
+ };
5482
6715
  },
5483
6716
  {
5484
6717
  name: "emodeMaxInitLeverage";
@@ -5504,6 +6737,7 @@ type Marginfi = {
5504
6737
  },
5505
6738
  {
5506
6739
  name: "marginfiGroupInitialize";
6740
+ docs: ["(admin only) Initialize a new marginfi group. The signer becomes the group admin."];
5507
6741
  discriminator: [255, 67, 67, 26, 94, 31, 34, 20];
5508
6742
  accounts: [
5509
6743
  {
@@ -5551,6 +6785,10 @@ type Marginfi = {
5551
6785
  },
5552
6786
  {
5553
6787
  name: "panicPause";
6788
+ docs: [
6789
+ "(global_fee_admin only) Pause the protocol. Auto-expires after 30 minutes. Limited to 3",
6790
+ "pauses per day and 2 consecutive pauses."
6791
+ ];
5554
6792
  discriminator: [76, 164, 123, 25, 4, 43, 79, 165];
5555
6793
  accounts: [
5556
6794
  {
@@ -5577,6 +6815,7 @@ type Marginfi = {
5577
6815
  },
5578
6816
  {
5579
6817
  name: "panicUnpause";
6818
+ docs: ["(global_fee_admin only) Unpause the protocol before the auto-expiry."];
5580
6819
  discriminator: [236, 107, 194, 242, 99, 51, 121, 128];
5581
6820
  accounts: [
5582
6821
  {
@@ -5647,6 +6886,7 @@ type Marginfi = {
5647
6886
  },
5648
6887
  {
5649
6888
  name: "propagateStakedSettings";
6889
+ docs: ["(permissionless) Propagate updated staked settings to a staked collateral bank."];
5650
6890
  discriminator: [210, 30, 152, 69, 130, 99, 222, 170];
5651
6891
  accounts: [
5652
6892
  {
@@ -5703,6 +6943,7 @@ type Marginfi = {
5703
6943
  accounts: [
5704
6944
  {
5705
6945
  name: "group";
6946
+ writable: true;
5706
6947
  relations: ["marginfiAccount", "bank"];
5707
6948
  },
5708
6949
  {
@@ -6041,7 +7282,10 @@ type Marginfi = {
6041
7282
  },
6042
7283
  {
6043
7284
  name: "destinationTokenAccount";
6044
- docs: ["Token account that will get tokens back", "WARN: Completely unchecked!"];
7285
+ docs: [
7286
+ "Token account that will receive the withdrawn tokens. Mint/owner are validated by the",
7287
+ "SPL transfer; the caller controls the destination."
7288
+ ];
6045
7289
  writable: true;
6046
7290
  },
6047
7291
  {
@@ -6157,6 +7401,10 @@ type Marginfi = {
6157
7401
  },
6158
7402
  {
6159
7403
  name: "startDeleverage";
7404
+ docs: [
7405
+ "(risk_admin only) Begin forced deleverage on an account. Similar to start_liquidation but",
7406
+ "does not require the account to be unhealthy."
7407
+ ];
6160
7408
  discriminator: [10, 138, 10, 57, 40, 232, 182, 193];
6161
7409
  accounts: [
6162
7410
  {
@@ -6192,6 +7440,10 @@ type Marginfi = {
6192
7440
  },
6193
7441
  {
6194
7442
  name: "startLiquidation";
7443
+ docs: [
7444
+ "(permissionless) Begin receivership liquidation on an unhealthy account. Snapshots health",
7445
+ "and marks the account in receivership. Must have `end_liquidation` as the last ix in the tx."
7446
+ ];
6195
7447
  discriminator: [244, 93, 90, 214, 192, 166, 191, 21];
6196
7448
  accounts: [
6197
7449
  {
@@ -6222,6 +7474,10 @@ type Marginfi = {
6222
7474
  },
6223
7475
  {
6224
7476
  name: "transferToNewAccount";
7477
+ docs: [
7478
+ "(account authority) Transfer all positions to a new account under a new authority. The old",
7479
+ "account is disabled. Pays a flat SOL fee to the protocol."
7480
+ ];
6225
7481
  discriminator: [28, 79, 129, 231, 169, 69, 69, 65];
6226
7482
  accounts: [
6227
7483
  {
@@ -6263,13 +7519,13 @@ type Marginfi = {
6263
7519
  {
6264
7520
  name: "transferToNewAccountPda";
6265
7521
  docs: [
6266
- "Same as `transfer_to_new_account` except the resulting account is a PDA",
7522
+ "(account authority) Same as `transfer_to_new_account` except the resulting account is a PDA",
6267
7523
  "",
6268
7524
  "seeds:",
6269
7525
  "- marginfi_group",
6270
7526
  "- authority: The account authority (owner)",
6271
- "- account_index: A u32 value to allow multiple accounts per authority",
6272
- "- third_party_id: Optional u32 for third-party tagging. Seeds < PDA_FREE_THRESHOLD can be",
7527
+ "- account_index: A u16 value to allow multiple accounts per authority",
7528
+ "- third_party_id: Optional u16 for third-party tagging. Seeds < PDA_FREE_THRESHOLD can be",
6273
7529
  "used freely. For a dedicated seed used by just your program (via CPI), contact us."
6274
7530
  ];
6275
7531
  discriminator: [172, 210, 224, 220, 146, 212, 253, 49];
@@ -6352,8 +7608,8 @@ type Marginfi = {
6352
7608
  {
6353
7609
  name: "writeBankMetadata";
6354
7610
  docs: [
6355
- "(metadata admin only) Write ticker/descrption information for a bank on-chain. Optional, not",
6356
- "all Banks are guranteed to have metadata."
7611
+ "(metadata admin only) Write ticker/description information for a bank on-chain. Optional, not",
7612
+ "all Banks are guaranteed to have metadata."
6357
7613
  ];
6358
7614
  discriminator: [147, 78, 81, 133, 129, 138, 233, 59];
6359
7615
  accounts: [
@@ -6401,10 +7657,18 @@ type Marginfi = {
6401
7657
  name: "bankMetadata";
6402
7658
  discriminator: [49, 207, 31, 34, 67, 225, 169, 186];
6403
7659
  },
7660
+ {
7661
+ name: "executeOrderRecord";
7662
+ discriminator: [6, 100, 107, 60, 164, 226, 56, 97];
7663
+ },
6404
7664
  {
6405
7665
  name: "feeState";
6406
7666
  discriminator: [63, 224, 16, 85, 193, 36, 235, 220];
6407
7667
  },
7668
+ {
7669
+ name: "lending";
7670
+ discriminator: [135, 199, 82, 16, 249, 131, 182, 241];
7671
+ },
6408
7672
  {
6409
7673
  name: "liquidationRecord";
6410
7674
  discriminator: [95, 116, 23, 132, 89, 210, 245, 162];
@@ -6433,6 +7697,10 @@ type Marginfi = {
6433
7697
  name: "minimalUser";
6434
7698
  discriminator: [159, 117, 95, 227, 239, 151, 58, 236];
6435
7699
  },
7700
+ {
7701
+ name: "order";
7702
+ discriminator: [134, 173, 223, 185, 77, 86, 28, 51];
7703
+ },
6436
7704
  {
6437
7705
  name: "solendMinimalReserve";
6438
7706
  discriminator: [1];
@@ -6455,6 +7723,10 @@ type Marginfi = {
6455
7723
  name: "healthPulseEvent";
6456
7724
  discriminator: [183, 159, 218, 110, 61, 220, 65, 1];
6457
7725
  },
7726
+ {
7727
+ name: "keeperCloseOrderEvent";
7728
+ discriminator: [46, 152, 11, 174, 92, 157, 77, 64];
7729
+ },
6458
7730
  {
6459
7731
  name: "lendingAccountBorrowEvent";
6460
7732
  discriminator: [223, 96, 81, 10, 156, 99, 26, 59];
@@ -6511,6 +7783,10 @@ type Marginfi = {
6511
7783
  name: "liquidationReceiverEvent";
6512
7784
  discriminator: [40, 131, 224, 220, 151, 83, 24, 230];
6513
7785
  },
7786
+ {
7787
+ name: "marginfiAccountCloseOrderEvent";
7788
+ discriminator: [158, 34, 122, 98, 23, 146, 229, 212];
7789
+ },
6514
7790
  {
6515
7791
  name: "marginfiAccountCreateEvent";
6516
7792
  discriminator: [183, 5, 117, 104, 122, 199, 68, 51];
@@ -6519,6 +7795,10 @@ type Marginfi = {
6519
7795
  name: "marginfiAccountFreezeEvent";
6520
7796
  discriminator: [219, 219, 57, 178, 75, 86, 146, 122];
6521
7797
  },
7798
+ {
7799
+ name: "marginfiAccountPlaceOrderEvent";
7800
+ discriminator: [1, 105, 79, 28, 142, 242, 99, 145];
7801
+ },
6522
7802
  {
6523
7803
  name: "marginfiAccountTransferToNewAccount";
6524
7804
  discriminator: [59, 105, 171, 110, 223, 136, 80, 89];
@@ -6530,6 +7810,10 @@ type Marginfi = {
6530
7810
  {
6531
7811
  name: "marginfiGroupCreateEvent";
6532
7812
  discriminator: [233, 125, 61, 14, 98, 240, 136, 253];
7813
+ },
7814
+ {
7815
+ name: "setKeeperCloseFlagsEvent";
7816
+ discriminator: [193, 230, 93, 128, 117, 87, 96, 21];
6533
7817
  }
6534
7818
  ];
6535
7819
  errors: [
@@ -6800,13 +8084,13 @@ type Marginfi = {
6800
8084
  },
6801
8085
  {
6802
8086
  code: 6053;
6803
- name: "pythPushWrongAccountOwner";
6804
- msg: "Pyth Push oracle: wrong account owner";
8087
+ name: "vacated2";
8088
+ msg: "vacated2";
6805
8089
  },
6806
8090
  {
6807
8091
  code: 6054;
6808
- name: "stakedPythPushWrongAccountOwner";
6809
- msg: "Staked Pyth Push oracle: wrong account owner";
8092
+ name: "vacated3";
8093
+ msg: "vacated3";
6810
8094
  },
6811
8095
  {
6812
8096
  code: 6055;
@@ -6900,13 +8184,13 @@ type Marginfi = {
6900
8184
  },
6901
8185
  {
6902
8186
  code: 6073;
6903
- name: "vacated0";
6904
- msg: "vacated0";
8187
+ name: "integrationPositionLimitExceeded";
8188
+ msg: "Exceeded the maximum allowed integration positions";
6905
8189
  },
6906
8190
  {
6907
8191
  code: 6074;
6908
- name: "vacated1";
6909
- msg: "vacated1";
8192
+ name: "maxInitLeverageExceeded";
8193
+ msg: "Maximum initial leverage exceeded";
6910
8194
  },
6911
8195
  {
6912
8196
  code: 6075;
@@ -7053,6 +8337,86 @@ type Marginfi = {
7053
8337
  name: "accountFrozen";
7054
8338
  msg: "Account is frozen by the group admin";
7055
8339
  },
8340
+ {
8341
+ code: 6104;
8342
+ name: "duplicateBalance";
8343
+ msg: "Cannot reference duplicate balances";
8344
+ },
8345
+ {
8346
+ code: 6105;
8347
+ name: "invalidBalanceCount";
8348
+ msg: "Invalid amount of balances referenced";
8349
+ },
8350
+ {
8351
+ code: 6106;
8352
+ name: "liquidatorOrderCloseNotAllowed";
8353
+ msg: "Liquidator not allowed to close order";
8354
+ },
8355
+ {
8356
+ code: 6107;
8357
+ name: "orderTriggerNotMet";
8358
+ msg: "Order trigger is yet to be met";
8359
+ },
8360
+ {
8361
+ code: 6108;
8362
+ name: "unexpectedOrderExecutionState";
8363
+ msg: "Order execution state issue. Check the necessary invariants i.e not in flashloan or disabled e.t.c";
8364
+ },
8365
+ {
8366
+ code: 6109;
8367
+ name: "orderLiabilityNotClosed";
8368
+ msg: "Order liability not closed";
8369
+ },
8370
+ {
8371
+ code: 6110;
8372
+ name: "invalidAssetOrLiabilitiesCount";
8373
+ msg: "Invalid asset or liabilities count";
8374
+ },
8375
+ {
8376
+ code: 6111;
8377
+ name: "worseHealthPostExecution";
8378
+ msg: "Account health can only worsen if account is healthy";
8379
+ },
8380
+ {
8381
+ code: 6112;
8382
+ name: "invalidOrderTakeProfitOrStopLoss";
8383
+ msg: "TP must be > 0, SL must be > 0 and TP > SL if both are set";
8384
+ },
8385
+ {
8386
+ code: 6113;
8387
+ name: "invalidSlippage";
8388
+ msg: "Max slippage must be less than 100%";
8389
+ },
8390
+ {
8391
+ code: 6114;
8392
+ name: "orderExecutionOverWithdrawal";
8393
+ msg: "Executor withdrew too much: slippage or max fee constraint violated";
8394
+ },
8395
+ {
8396
+ code: 6115;
8397
+ name: "bankHourlyRateLimitExceeded";
8398
+ msg: "Bank hourly rate limit exceeded: try again later";
8399
+ },
8400
+ {
8401
+ code: 6116;
8402
+ name: "bankDailyRateLimitExceeded";
8403
+ msg: "Bank daily rate limit exceeded: try again later";
8404
+ },
8405
+ {
8406
+ code: 6117;
8407
+ name: "groupHourlyRateLimitExceeded";
8408
+ msg: "Group hourly rate limit exceeded: try again later";
8409
+ },
8410
+ {
8411
+ code: 6118;
8412
+ name: "groupDailyRateLimitExceeded";
8413
+ msg: "Group daily rate limit exceeded: try again later";
8414
+ },
8415
+ {
8416
+ code: 6119;
8417
+ name: "invalidRateLimitPrice";
8418
+ msg: "Invalid rate limit price: pass oracle or pre-crank cache";
8419
+ },
7056
8420
  {
7057
8421
  code: 6200;
7058
8422
  name: "wrongAssetTagForStandardInstructions";
@@ -7115,8 +8479,8 @@ type Marginfi = {
7115
8479
  },
7116
8480
  {
7117
8481
  code: 6212;
7118
- name: "integrationPositionLimitExceeded";
7119
- msg: "Maximum integration positions limit exceeded (max 8 Kamino/Drift/Solend positions per account)";
8482
+ name: "maxMaintLeverageExceeded";
8483
+ msg: "Maximum Maintenance leverage exceeded";
7120
8484
  },
7121
8485
  {
7122
8486
  code: 6213;
@@ -7347,6 +8711,71 @@ type Marginfi = {
7347
8711
  code: 6416;
7348
8712
  name: "invalidSolendObligation";
7349
8713
  msg: "Invalid Solend obligation: account constraint violated";
8714
+ },
8715
+ {
8716
+ code: 6500;
8717
+ name: "juplendInvalidOracleSetup";
8718
+ msg: "Invalid oracle setup: only JuplendPythPull and JuplendSwitchboardPull are supported";
8719
+ },
8720
+ {
8721
+ code: 6501;
8722
+ name: "juplendLendingValidationFailed";
8723
+ msg: "Juplend lending state validation failed";
8724
+ },
8725
+ {
8726
+ code: 6502;
8727
+ name: "wrongBankAssetTagForJuplendOperation";
8728
+ msg: "Wrong bank asset tag for Juplend operation";
8729
+ },
8730
+ {
8731
+ code: 6503;
8732
+ name: "cantUseStandardOperationsOnJuplendAssets";
8733
+ msg: "Cannot use standard operations on Juplend assets";
8734
+ },
8735
+ {
8736
+ code: 6504;
8737
+ name: "juplendLendingStale";
8738
+ msg: "Juplend lending state is stale";
8739
+ },
8740
+ {
8741
+ code: 6505;
8742
+ name: "invalidJuplendLending";
8743
+ msg: "Invalid Juplend lending: account constraint violated";
8744
+ },
8745
+ {
8746
+ code: 6506;
8747
+ name: "juplendLendingMintMismatch";
8748
+ msg: "Juplend lending mint mismatch";
8749
+ },
8750
+ {
8751
+ code: 6507;
8752
+ name: "juplendBankAlreadyActivated";
8753
+ msg: "Juplend bank is already activated";
8754
+ },
8755
+ {
8756
+ code: 6508;
8757
+ name: "invalidJuplendFTokenVault";
8758
+ msg: "Invalid Juplend fToken vault";
8759
+ },
8760
+ {
8761
+ code: 6509;
8762
+ name: "juplendDepositFailed";
8763
+ msg: "Juplend deposit failed";
8764
+ },
8765
+ {
8766
+ code: 6510;
8767
+ name: "juplendWithdrawFailed";
8768
+ msg: "Juplend withdraw failed";
8769
+ },
8770
+ {
8771
+ code: 6511;
8772
+ name: "juplendInitPositionDepositInsufficient";
8773
+ msg: "Juplend init position deposit insufficient";
8774
+ },
8775
+ {
8776
+ code: 6512;
8777
+ name: "invalidJuplendWithdrawIntermediaryAta";
8778
+ msg: "Invalid Juplend withdraw intermediary ATA";
7350
8779
  }
7351
8780
  ];
7352
8781
  types: [
@@ -7386,10 +8815,12 @@ type Marginfi = {
7386
8815
  fields: [
7387
8816
  {
7388
8817
  name: "active";
8818
+ docs: ["Whether this balance slot is in use (nonzero = active)"];
7389
8819
  type: "u8";
7390
8820
  },
7391
8821
  {
7392
8822
  name: "bankPk";
8823
+ docs: ["The bank this balance corresponds to"];
7393
8824
  type: "pubkey";
7394
8825
  },
7395
8826
  {
@@ -7400,14 +8831,26 @@ type Marginfi = {
7400
8831
  ];
7401
8832
  type: "u8";
7402
8833
  },
8834
+ {
8835
+ name: "tag";
8836
+ docs: [
8837
+ "Tag used by orders to reference this balance (0 means unused/unassigned).",
8838
+ "A tag may also have a non-zero value while having no orders."
8839
+ ];
8840
+ type: "u16";
8841
+ },
7403
8842
  {
7404
8843
  name: "pad0";
7405
8844
  type: {
7406
- array: ["u8", 6];
8845
+ array: ["u8", 4];
7407
8846
  };
7408
8847
  },
7409
8848
  {
7410
8849
  name: "assetShares";
8850
+ docs: [
8851
+ "The user's asset (deposit) shares in the bank. Multiply by `bank.asset_share_value` for",
8852
+ "the token amount."
8853
+ ];
7411
8854
  type: {
7412
8855
  defined: {
7413
8856
  name: "wrappedI80f48";
@@ -7416,6 +8859,10 @@ type Marginfi = {
7416
8859
  },
7417
8860
  {
7418
8861
  name: "liabilityShares";
8862
+ docs: [
8863
+ "The user's liability (borrow) shares in the bank. Multiply by `bank.liability_share_value`",
8864
+ "for the token amount."
8865
+ ];
7419
8866
  type: {
7420
8867
  defined: {
7421
8868
  name: "wrappedI80f48";
@@ -7424,6 +8871,7 @@ type Marginfi = {
7424
8871
  },
7425
8872
  {
7426
8873
  name: "emissionsOutstanding";
8874
+ docs: ["Unclaimed emissions rewards for this position"];
7427
8875
  type: {
7428
8876
  defined: {
7429
8877
  name: "wrappedI80f48";
@@ -7432,10 +8880,12 @@ type Marginfi = {
7432
8880
  },
7433
8881
  {
7434
8882
  name: "lastUpdate";
8883
+ docs: ["Unix timestamp (u64) of the last emissions calculation for this position"];
7435
8884
  type: "u64";
7436
8885
  },
7437
8886
  {
7438
8887
  name: "padding";
8888
+ docs: ["Reserved for future use"];
7439
8889
  type: {
7440
8890
  array: ["u64", 1];
7441
8891
  };
@@ -7454,14 +8904,17 @@ type Marginfi = {
7454
8904
  fields: [
7455
8905
  {
7456
8906
  name: "mint";
8907
+ docs: ["The SPL token mint this bank manages"];
7457
8908
  type: "pubkey";
7458
8909
  },
7459
8910
  {
7460
8911
  name: "mintDecimals";
8912
+ docs: ["Number of decimals of the `mint`. Must be < 24."];
7461
8913
  type: "u8";
7462
8914
  },
7463
8915
  {
7464
8916
  name: "group";
8917
+ docs: ["The `MarginfiGroup` this bank belongs to"];
7465
8918
  type: "pubkey";
7466
8919
  },
7467
8920
  {
@@ -7500,26 +8953,32 @@ type Marginfi = {
7500
8953
  },
7501
8954
  {
7502
8955
  name: "liquidityVault";
8956
+ docs: ["The SPL token account holding deposited liquidity"];
7503
8957
  type: "pubkey";
7504
8958
  },
7505
8959
  {
7506
8960
  name: "liquidityVaultBump";
8961
+ docs: ["PDA bump for the liquidity vault"];
7507
8962
  type: "u8";
7508
8963
  },
7509
8964
  {
7510
8965
  name: "liquidityVaultAuthorityBump";
8966
+ docs: ["PDA bump for the liquidity vault authority"];
7511
8967
  type: "u8";
7512
8968
  },
7513
8969
  {
7514
8970
  name: "insuranceVault";
8971
+ docs: ["The SPL token account holding insurance fund tokens"];
7515
8972
  type: "pubkey";
7516
8973
  },
7517
8974
  {
7518
8975
  name: "insuranceVaultBump";
8976
+ docs: ["PDA bump for the insurance vault"];
7519
8977
  type: "u8";
7520
8978
  },
7521
8979
  {
7522
8980
  name: "insuranceVaultAuthorityBump";
8981
+ docs: ["PDA bump for the insurance vault authority"];
7523
8982
  type: "u8";
7524
8983
  },
7525
8984
  {
@@ -7539,14 +8998,17 @@ type Marginfi = {
7539
8998
  },
7540
8999
  {
7541
9000
  name: "feeVault";
9001
+ docs: ["The SPL token account holding collected group fees"];
7542
9002
  type: "pubkey";
7543
9003
  },
7544
9004
  {
7545
9005
  name: "feeVaultBump";
9006
+ docs: ["PDA bump for the fee vault"];
7546
9007
  type: "u8";
7547
9008
  },
7548
9009
  {
7549
9010
  name: "feeVaultAuthorityBump";
9011
+ docs: ["PDA bump for the fee vault authority"];
7550
9012
  type: "u8";
7551
9013
  },
7552
9014
  {
@@ -7568,7 +9030,7 @@ type Marginfi = {
7568
9030
  name: "totalLiabilityShares";
7569
9031
  docs: [
7570
9032
  "Sum of all liability shares held by all borrowers in this bank.",
7571
- "* Uses `mint_decimals`"
9033
+ "Multiply by `liability_share_value` to get the total liability amount in native token units."
7572
9034
  ];
7573
9035
  type: {
7574
9036
  defined: {
@@ -7580,7 +9042,7 @@ type Marginfi = {
7580
9042
  name: "totalAssetShares";
7581
9043
  docs: [
7582
9044
  "Sum of all asset shares held by all depositors in this bank.",
7583
- "* Uses `mint_decimals`",
9045
+ "Multiply by `asset_share_value` to get the total asset amount in native token units.",
7584
9046
  "* For Kamino banks, this is the quantity of collateral tokens (NOT liquidity tokens) in the",
7585
9047
  "bank, and also uses `mint_decimals`, though the mint itself will always show (6) decimals",
7586
9048
  "exactly (i.e Kamino ignores this and treats it as if it was using `mint_decimals`)"
@@ -7593,10 +9055,14 @@ type Marginfi = {
7593
9055
  },
7594
9056
  {
7595
9057
  name: "lastUpdate";
9058
+ docs: ["Unix timestamp (i64) of the last interest accrual"];
7596
9059
  type: "i64";
7597
9060
  },
7598
9061
  {
7599
9062
  name: "config";
9063
+ docs: [
9064
+ "The bank's configuration parameters (weights, limits, oracle setup, interest rate config)"
9065
+ ];
7600
9066
  type: {
7601
9067
  defined: {
7602
9068
  name: "bankConfig";
@@ -7606,15 +9072,15 @@ type Marginfi = {
7606
9072
  {
7607
9073
  name: "flags";
7608
9074
  docs: [
7609
- "Bank Config Flags",
9075
+ "Bank flags bitfield (u64).",
7610
9076
  "",
7611
- "- EMISSIONS_FLAG_BORROW_ACTIVE: 1",
7612
- "- EMISSIONS_FLAG_LENDING_ACTIVE: 2",
7613
- "- PERMISSIONLESS_BAD_DEBT_SETTLEMENT: 4",
7614
- "- FREEZE_SETTINGS: 8",
7615
- "- CLOSE_ENABLED_FLAG: 16",
7616
- "- TOKENLESS_REPAYMENTS_ACTIVE: 32",
7617
- ""
9077
+ "- Bit 0 (1): `EMISSIONS_FLAG_BORROW_ACTIVE` — borrow-side emissions are active",
9078
+ "- Bit 1 (2): `EMISSIONS_FLAG_LENDING_ACTIVE` — lending-side emissions are active",
9079
+ "- Bit 2 (4): `PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG` — anyone can settle bad debt",
9080
+ "- Bit 3 (8): `FREEZE_SETTINGS` — bank configuration is frozen (only limits can change)",
9081
+ "- Bit 4 (16): `CLOSE_ENABLED_FLAG` — bank can be closed (set at creation for banks >= 0.1.4)",
9082
+ "- Bit 5 (32): `TOKENLESS_REPAYMENTS_ALLOWED` — risk admin can repay debt without tokens",
9083
+ "- Bit 6 (64): `TOKENLESS_REPAYMENTS_COMPLETE` — all debt cleared, lender purge enabled"
7618
9084
  ];
7619
9085
  type: "u64";
7620
9086
  },
@@ -7628,6 +9094,7 @@ type Marginfi = {
7628
9094
  },
7629
9095
  {
7630
9096
  name: "emissionsRemaining";
9097
+ docs: ["Remaining emissions tokens available for distribution"];
7631
9098
  type: {
7632
9099
  defined: {
7633
9100
  name: "wrappedI80f48";
@@ -7636,6 +9103,7 @@ type Marginfi = {
7636
9103
  },
7637
9104
  {
7638
9105
  name: "emissionsMint";
9106
+ docs: ["The SPL token mint used for emissions rewards"];
7639
9107
  type: "pubkey";
7640
9108
  },
7641
9109
  {
@@ -7672,6 +9140,7 @@ type Marginfi = {
7672
9140
  },
7673
9141
  {
7674
9142
  name: "cache";
9143
+ docs: ["Cached bank metrics (interest rates, oracle price, etc.)"];
7675
9144
  type: {
7676
9145
  defined: {
7677
9146
  name: "bankCache";
@@ -7702,6 +9171,7 @@ type Marginfi = {
7702
9171
  },
7703
9172
  {
7704
9173
  name: "padding0";
9174
+ docs: ["Reserved for future use"];
7705
9175
  type: {
7706
9176
  array: ["u8", 16];
7707
9177
  };
@@ -7712,7 +9182,8 @@ type Marginfi = {
7712
9182
  "Integration account slot 1 (default Pubkey for non-integrations).",
7713
9183
  "- Kamino: reserve",
7714
9184
  "- Drift: spot market",
7715
- "- Solend: reserve"
9185
+ "- Solend: reserve",
9186
+ "- JupLend: lending state"
7716
9187
  ];
7717
9188
  type: "pubkey";
7718
9189
  },
@@ -7722,7 +9193,8 @@ type Marginfi = {
7722
9193
  "Integration account slot 2 (default Pubkey for non-integrations).",
7723
9194
  "- Kamino: obligation",
7724
9195
  "- Drift: user",
7725
- "- Solend: obligation"
9196
+ "- Solend: obligation",
9197
+ "- JupLend: fToken vault"
7726
9198
  ];
7727
9199
  type: "pubkey";
7728
9200
  },
@@ -7730,10 +9202,29 @@ type Marginfi = {
7730
9202
  name: "integrationAcc3";
7731
9203
  docs: [
7732
9204
  "Integration account slot 3 (default Pubkey for non-integrations).",
7733
- "- Drift: user stats"
9205
+ "- Drift: user stats",
9206
+ "- JupLend: withdraw intermediary ATA (ATA of liquidity_vault_authority for bank mint)"
7734
9207
  ];
7735
9208
  type: "pubkey";
7736
9209
  },
9210
+ {
9211
+ name: "rateLimiter";
9212
+ docs: [
9213
+ "Rate limiter for controlling withdraw/borrow outflow.",
9214
+ "Tracks net outflow (outflows - inflows) in native tokens."
9215
+ ];
9216
+ type: {
9217
+ defined: {
9218
+ name: "bankRateLimiter";
9219
+ };
9220
+ };
9221
+ },
9222
+ {
9223
+ name: "pad0";
9224
+ type: {
9225
+ array: ["u8", 8];
9226
+ };
9227
+ },
7737
9228
  {
7738
9229
  name: "padding1";
7739
9230
  type: {
@@ -7741,7 +9232,7 @@ type Marginfi = {
7741
9232
  {
7742
9233
  array: ["u64", 2];
7743
9234
  },
7744
- 13
9235
+ 7
7745
9236
  ];
7746
9237
  };
7747
9238
  }
@@ -7762,7 +9253,7 @@ type Marginfi = {
7762
9253
  docs: [
7763
9254
  "Actual (spot) interest/fee rates of the bank, based on utilization",
7764
9255
  "* APR (annual percentage rate) values",
7765
- "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u:32::MAX/2 = 500%, etc"
9256
+ "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc"
7766
9257
  ];
7767
9258
  type: "u32";
7768
9259
  },
@@ -7770,7 +9261,7 @@ type Marginfi = {
7770
9261
  name: "lendingRate";
7771
9262
  docs: [
7772
9263
  "Equivalent to `base_rate` * utilization",
7773
- "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u:32::MAX/2 = 500%, etc"
9264
+ "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc"
7774
9265
  ];
7775
9266
  type: "u32";
7776
9267
  },
@@ -7778,7 +9269,7 @@ type Marginfi = {
7778
9269
  name: "borrowingRate";
7779
9270
  docs: [
7780
9271
  "Equivalent to `base_rate` * (1 + ir_fees) + fixed_fees",
7781
- "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u:32::MAX/2 = 500%, etc"
9272
+ "* From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc"
7782
9273
  ];
7783
9274
  type: "u32";
7784
9275
  },
@@ -7841,16 +9332,59 @@ type Marginfi = {
7841
9332
  };
7842
9333
  };
7843
9334
  },
9335
+ {
9336
+ name: "liqCacheFlags";
9337
+ docs: [
9338
+ "Liquidation cache flags, set during receivership flow.",
9339
+ '* 1 (LIQ_CACHE_LOCKED_FLAG) - We "lock" the liquidation cache when writing to it in Start',
9340
+ "Liquidate as an additional safeguard, if the liquidation prices stored here were to be",
9341
+ "edited between start and end, it would completely break the risk engine. End validates that",
9342
+ "the lock is set, panics if not, and removes it - which prevents footguns if the cache was",
9343
+ "e.g. accidently set to default. The lock is also removed when a Balance is closed with",
9344
+ "repay_all or withdraw_all, since those Balances can be omitted from the risk check at End."
9345
+ ];
9346
+ type: "u8";
9347
+ },
7844
9348
  {
7845
9349
  name: "padding";
7846
9350
  type: {
7847
- array: ["u8", 24];
9351
+ array: ["u8", 23];
7848
9352
  };
7849
9353
  },
7850
9354
  {
7851
- name: "reserved0";
9355
+ name: "liquidationPriceRt";
9356
+ docs: ["Cached real-time price for receivership liquidation."];
7852
9357
  type: {
7853
- array: ["u8", 64];
9358
+ defined: {
9359
+ name: "wrappedI80f48";
9360
+ };
9361
+ };
9362
+ },
9363
+ {
9364
+ name: "liquidationPriceRtConfidence";
9365
+ docs: ["Cached real-time price confidence for receivership liquidation."];
9366
+ type: {
9367
+ defined: {
9368
+ name: "wrappedI80f48";
9369
+ };
9370
+ };
9371
+ },
9372
+ {
9373
+ name: "liquidationPriceTwap";
9374
+ docs: ["Cached TWAP price for receivership liquidation."];
9375
+ type: {
9376
+ defined: {
9377
+ name: "wrappedI80f48";
9378
+ };
9379
+ };
9380
+ },
9381
+ {
9382
+ name: "liquidationPriceTwapConfidence";
9383
+ docs: ["Cached TWAP price confidence for receivership liquidation."];
9384
+ type: {
9385
+ defined: {
9386
+ name: "wrappedI80f48";
9387
+ };
7854
9388
  };
7855
9389
  }
7856
9390
  ];
@@ -7866,7 +9400,10 @@ type Marginfi = {
7866
9400
  fields: [
7867
9401
  {
7868
9402
  name: "assetWeightInit";
7869
- docs: ["TODO: Convert weights to (u64, u64) to avoid precision loss (maybe?)"];
9403
+ docs: [
9404
+ "Discount factor for asset values in initial margin calculation (0 to 1).",
9405
+ "E.g., 0.8 means assets count as 80% of their value for borrowing purposes."
9406
+ ];
7870
9407
  type: {
7871
9408
  defined: {
7872
9409
  name: "wrappedI80f48";
@@ -7875,6 +9412,10 @@ type Marginfi = {
7875
9412
  },
7876
9413
  {
7877
9414
  name: "assetWeightMaint";
9415
+ docs: [
9416
+ "Discount factor for asset values in maintenance margin calculation (0 to 2).",
9417
+ "Used for liquidation eligibility. Generally >= asset_weight_init."
9418
+ ];
7878
9419
  type: {
7879
9420
  defined: {
7880
9421
  name: "wrappedI80f48";
@@ -7883,6 +9424,10 @@ type Marginfi = {
7883
9424
  },
7884
9425
  {
7885
9426
  name: "liabilityWeightInit";
9427
+ docs: [
9428
+ "Premium factor for liability values in initial margin calculation (>= 1).",
9429
+ "E.g., 1.2 means liabilities count as 120% of their value for borrowing purposes."
9430
+ ];
7886
9431
  type: {
7887
9432
  defined: {
7888
9433
  name: "wrappedI80f48";
@@ -7891,6 +9436,10 @@ type Marginfi = {
7891
9436
  },
7892
9437
  {
7893
9438
  name: "liabilityWeightMaint";
9439
+ docs: [
9440
+ "Premium factor for liability values in maintenance margin calculation (>= 1).",
9441
+ "Used for liquidation eligibility. Generally <= liability_weight_init."
9442
+ ];
7894
9443
  type: {
7895
9444
  defined: {
7896
9445
  name: "wrappedI80f48";
@@ -7899,10 +9448,14 @@ type Marginfi = {
7899
9448
  },
7900
9449
  {
7901
9450
  name: "depositLimit";
9451
+ docs: [
9452
+ "Maximum total deposits allowed in this bank, in native token units (0 = no limit)"
9453
+ ];
7902
9454
  type: "u64";
7903
9455
  },
7904
9456
  {
7905
9457
  name: "interestRateConfig";
9458
+ docs: ["Interest rate model configuration"];
7906
9459
  type: {
7907
9460
  defined: {
7908
9461
  name: "interestRateConfig";
@@ -7911,6 +9464,9 @@ type Marginfi = {
7911
9464
  },
7912
9465
  {
7913
9466
  name: "operationalState";
9467
+ docs: [
9468
+ "Current operational state of the bank (Paused, Operational, ReduceOnly, KilledByBankruptcy)"
9469
+ ];
7914
9470
  type: {
7915
9471
  defined: {
7916
9472
  name: "bankOperationalState";
@@ -7919,6 +9475,7 @@ type Marginfi = {
7919
9475
  },
7920
9476
  {
7921
9477
  name: "oracleSetup";
9478
+ docs: ["Oracle type used for price feeds"];
7922
9479
  type: {
7923
9480
  defined: {
7924
9481
  name: "oracleSetup";
@@ -7927,6 +9484,7 @@ type Marginfi = {
7927
9484
  },
7928
9485
  {
7929
9486
  name: "oracleKeys";
9487
+ docs: ["Oracle account keys (usage depends on oracle_setup type)"];
7930
9488
  type: {
7931
9489
  array: ["pubkey", 5];
7932
9490
  };
@@ -7939,10 +9497,14 @@ type Marginfi = {
7939
9497
  },
7940
9498
  {
7941
9499
  name: "borrowLimit";
9500
+ docs: [
9501
+ "Maximum total borrows allowed in this bank, in native token units (0 = no limit)"
9502
+ ];
7942
9503
  type: "u64";
7943
9504
  },
7944
9505
  {
7945
9506
  name: "riskTier";
9507
+ docs: ["Risk tier for this bank (Collateral or Isolated)"];
7946
9508
  type: {
7947
9509
  defined: {
7948
9510
  name: "riskTier";
@@ -7952,14 +9514,16 @@ type Marginfi = {
7952
9514
  {
7953
9515
  name: "assetTag";
7954
9516
  docs: [
7955
- "Determines what kinds of assets users of this bank can interact with.",
7956
- "Options:",
7957
- "* ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset",
7958
- "or with `ASSET_TAG_SOL`",
7959
- "* ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with **either**",
9517
+ "Determines what kinds of assets users of this bank can interact with. Options:",
9518
+ "* `ASSET_TAG_DEFAULT` (0) - A regular asset that can be comingled with any other regular",
9519
+ "asset or with `ASSET_TAG_SOL`",
9520
+ "* `ASSET_TAG_SOL` (1) - Accounts with a SOL position can comingle with **either**",
7960
9521
  "`ASSET_TAG_DEFAULT` or `ASSET_TAG_STAKED` positions, but not both",
7961
- "* ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit",
7962
- "other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL"
9522
+ "* `ASSET_TAG_STAKED` (2) - Staked SOL assets. Accounts with a STAKED position can only",
9523
+ "deposit other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL",
9524
+ "* `ASSET_TAG_KAMINO` (3) - Treated the same as `ASSET_TAG_DEFAULT`",
9525
+ "* `ASSET_TAG_DRIFT` (4) - Treated the same as `ASSET_TAG_DEFAULT`",
9526
+ "* `ASSET_TAG_SOLEND` (5) - Treated the same as `ASSET_TAG_DEFAULT`"
7963
9527
  ];
7964
9528
  type: "u8";
7965
9529
  },
@@ -7967,9 +9531,9 @@ type Marginfi = {
7967
9531
  name: "configFlags";
7968
9532
  docs: [
7969
9533
  "Flags for various config options",
7970
- "* 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new pyth",
7971
- "oracle setup from a prior version. Not set in 0.1.3 or earlier banks using pyth that have",
7972
- "not yet migrated. Does nothing for banks that use switchboard.",
9534
+ "* 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new pyth oracle",
9535
+ "setup from a prior version. Not set in 0.1.3 or earlier banks using pyth that have not yet",
9536
+ "migrated. Does nothing for banks that use switchboard.",
7973
9537
  "* 2, 4, 8, 16, etc - reserved for future use."
7974
9538
  ];
7975
9539
  type: "u8";
@@ -7984,11 +9548,11 @@ type Marginfi = {
7984
9548
  name: "totalAssetValueInitLimit";
7985
9549
  docs: [
7986
9550
  "USD denominated limit for calculating asset value for initialization margin requirements.",
7987
- "Example, if total SOL deposits are equal to $1M and the limit it set to $500K,",
7988
- "then SOL assets will be discounted by 50%.",
9551
+ "Example, if total SOL deposits are equal to $1M and the limit it set to $500K, then SOL",
9552
+ "assets will be discounted by 50%.",
7989
9553
  "",
7990
- "In other words the max value of liabilities that can be backed by the asset is $500K.",
7991
- "This is useful for limiting the damage of orcale attacks.",
9554
+ "In other words the max value of liabilities that can be backed by the asset is $500K. This",
9555
+ "is useful for limiting the damage of oracle attacks.",
7992
9556
  "",
7993
9557
  "Value is UI USD value, for example value 100 -> $100"
7994
9558
  ];
@@ -8035,7 +9599,6 @@ type Marginfi = {
8035
9599
  },
8036
9600
  {
8037
9601
  name: "bankConfigCompact";
8038
- docs: ["TODO: Convert weights to (u64, u64) to avoid precision loss (maybe?)"];
8039
9602
  repr: {
8040
9603
  kind: "c";
8041
9604
  };
@@ -8109,14 +9672,16 @@ type Marginfi = {
8109
9672
  {
8110
9673
  name: "assetTag";
8111
9674
  docs: [
8112
- "Determines what kinds of assets users of this bank can interact with.",
8113
- "Options:",
8114
- "* ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset",
8115
- "or with `ASSET_TAG_SOL`",
8116
- "* ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with **either**",
9675
+ "Determines what kinds of assets users of this bank can interact with. Options:",
9676
+ "* `ASSET_TAG_DEFAULT` (0) - A regular asset that can be comingled with any other regular",
9677
+ "asset or with `ASSET_TAG_SOL`",
9678
+ "* `ASSET_TAG_SOL` (1) - Accounts with a SOL position can comingle with **either**",
8117
9679
  "`ASSET_TAG_DEFAULT` or `ASSET_TAG_STAKED` positions, but not both",
8118
- "* ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit",
8119
- "other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL"
9680
+ "* `ASSET_TAG_STAKED` (2) - Staked SOL assets. Accounts with a STAKED position can only",
9681
+ "deposit other STAKED assets or SOL (`ASSET_TAG_SOL`) and can only borrow SOL",
9682
+ "* `ASSET_TAG_KAMINO` (3) - Treated the same as `ASSET_TAG_DEFAULT`",
9683
+ "* `ASSET_TAG_DRIFT` (4) - Treated the same as `ASSET_TAG_DEFAULT`",
9684
+ "* `ASSET_TAG_SOLEND` (5) - Treated the same as `ASSET_TAG_DEFAULT`"
8120
9685
  ];
8121
9686
  type: "u8";
8122
9687
  },
@@ -8124,8 +9689,8 @@ type Marginfi = {
8124
9689
  name: "configFlags";
8125
9690
  docs: [
8126
9691
  "Flags for various config options",
8127
- "* 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new oracle",
8128
- "setup from a prior version. Not set in 0.1.3 or earlier banks that have not yet migrated.",
9692
+ "* 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new oracle setup",
9693
+ "from a prior version. Not set in 0.1.3 or earlier banks that have not yet migrated.",
8129
9694
  "* 2, 4, 8, 16, etc - reserved for future use."
8130
9695
  ];
8131
9696
  type: "u8";
@@ -8140,11 +9705,11 @@ type Marginfi = {
8140
9705
  name: "totalAssetValueInitLimit";
8141
9706
  docs: [
8142
9707
  "USD denominated limit for calculating asset value for initialization margin requirements.",
8143
- "Example, if total SOL deposits are equal to $1M and the limit it set to $500K,",
8144
- "then SOL assets will be discounted by 50%.",
9708
+ "Example, if total SOL deposits are equal to $1M and the limit it set to $500K, then SOL",
9709
+ "assets will be discounted by 50%.",
8145
9710
  "",
8146
- "In other words the max value of liabilities that can be backed by the asset is $500K.",
8147
- "This is useful for limiting the damage of orcale attacks.",
9711
+ "In other words the max value of liabilities that can be backed by the asset is $500K. This",
9712
+ "is useful for limiting the damage of oracle attacks.",
8148
9713
  "",
8149
9714
  "Value is UI USD value, for example value 100 -> $100"
8150
9715
  ];
@@ -8327,7 +9892,7 @@ type Marginfi = {
8327
9892
  },
8328
9893
  {
8329
9894
  name: "description";
8330
- docs: ["The token's plain english descripion, e.g US Dollar Coin", "* utf-8"];
9895
+ docs: ["The token's plain english description, e.g US Dollar Coin", "* utf-8"];
8331
9896
  type: {
8332
9897
  array: ["u8", 128];
8333
9898
  };
@@ -8390,6 +9955,49 @@ type Marginfi = {
8390
9955
  ];
8391
9956
  };
8392
9957
  },
9958
+ {
9959
+ name: "bankRateLimiter";
9960
+ docs: [
9961
+ "Per-bank rate limiting configuration and state.",
9962
+ "Tracks net outflow in native tokens."
9963
+ ];
9964
+ repr: {
9965
+ kind: "c";
9966
+ };
9967
+ type: {
9968
+ kind: "struct";
9969
+ fields: [
9970
+ {
9971
+ name: "hourly";
9972
+ docs: ["Hourly window rate limiter (native tokens)."];
9973
+ type: {
9974
+ defined: {
9975
+ name: "rateLimitWindow";
9976
+ };
9977
+ };
9978
+ },
9979
+ {
9980
+ name: "daily";
9981
+ docs: ["Daily window rate limiter (native tokens)."];
9982
+ type: {
9983
+ defined: {
9984
+ name: "rateLimitWindow";
9985
+ };
9986
+ };
9987
+ },
9988
+ {
9989
+ name: "untrackedInflow";
9990
+ docs: [
9991
+ "Native token inflows pending USD conversion for group rate limiter.",
9992
+ "When deposits/repays occur without a valid oracle price, the amount is",
9993
+ "recorded here and later applied to the group rate limiter when a valid",
9994
+ "price becomes available (e.g., during pulse_bank_price_cache or outflow operations)."
9995
+ ];
9996
+ type: "i64";
9997
+ }
9998
+ ];
9999
+ };
10000
+ },
8393
10001
  {
8394
10002
  name: "deleverageEvent";
8395
10003
  type: {
@@ -8624,29 +10232,121 @@ type Marginfi = {
8624
10232
  type: "u16";
8625
10233
  },
8626
10234
  {
8627
- name: "pad0";
10235
+ name: "pad0";
10236
+ type: {
10237
+ array: ["u8", 6];
10238
+ };
10239
+ },
10240
+ {
10241
+ name: "timestamp";
10242
+ docs: ["Unix timestamp from the system clock when emode state was last updated"];
10243
+ type: "i64";
10244
+ },
10245
+ {
10246
+ name: "flags";
10247
+ docs: [
10248
+ "EMODE_ON (1) - If set, at least one entry is configured",
10249
+ "2, 4, 8, etc, Reserved for future use"
10250
+ ];
10251
+ type: "u64";
10252
+ },
10253
+ {
10254
+ name: "emodeConfig";
10255
+ type: {
10256
+ defined: {
10257
+ name: "emodeConfig";
10258
+ };
10259
+ };
10260
+ }
10261
+ ];
10262
+ };
10263
+ },
10264
+ {
10265
+ name: "executeOrderBalanceRecord";
10266
+ repr: {
10267
+ kind: "c";
10268
+ };
10269
+ type: {
10270
+ kind: "struct";
10271
+ fields: [
10272
+ {
10273
+ name: "bank";
10274
+ type: "pubkey";
10275
+ },
10276
+ {
10277
+ name: "isAsset";
10278
+ type: "u8";
10279
+ },
10280
+ {
10281
+ name: "pad0";
10282
+ type: {
10283
+ array: ["u8", 5];
10284
+ };
10285
+ },
10286
+ {
10287
+ name: "tag";
10288
+ type: "u16";
10289
+ },
10290
+ {
10291
+ name: "shares";
10292
+ type: {
10293
+ defined: {
10294
+ name: "wrappedI80f48";
10295
+ };
10296
+ };
10297
+ }
10298
+ ];
10299
+ };
10300
+ },
10301
+ {
10302
+ name: "executeOrderRecord";
10303
+ serialization: "bytemuck";
10304
+ repr: {
10305
+ kind: "c";
10306
+ };
10307
+ type: {
10308
+ kind: "struct";
10309
+ fields: [
10310
+ {
10311
+ name: "order";
10312
+ type: "pubkey";
10313
+ },
10314
+ {
10315
+ name: "executor";
10316
+ type: "pubkey";
10317
+ },
10318
+ {
10319
+ name: "balanceStates";
8628
10320
  type: {
8629
- array: ["u8", 6];
10321
+ array: [
10322
+ {
10323
+ defined: {
10324
+ name: "executeOrderBalanceRecord";
10325
+ };
10326
+ },
10327
+ 14
10328
+ ];
8630
10329
  };
8631
10330
  },
8632
10331
  {
8633
- name: "timestamp";
8634
- docs: ["Unix timestamp from the system clock when emode state was last updated"];
8635
- type: "i64";
10332
+ name: "activeBalanceCount";
10333
+ type: "u8";
8636
10334
  },
8637
10335
  {
8638
- name: "flags";
8639
- docs: [
8640
- "EMODE_ON (1) - If set, at least one entry is configured",
8641
- "2, 4, 8, etc, Reserved for future use"
8642
- ];
8643
- type: "u64";
10336
+ name: "inactiveBalanceCount";
10337
+ type: "u8";
8644
10338
  },
8645
10339
  {
8646
- name: "emodeConfig";
10340
+ name: "reserved0";
10341
+ type: {
10342
+ array: ["u8", 6];
10343
+ };
10344
+ },
10345
+ {
10346
+ name: "orderStartHealth";
8647
10347
  type: {
8648
10348
  defined: {
8649
- name: "emodeConfig";
10349
+ name: "wrappedI80f48";
8650
10350
  };
8651
10351
  };
8652
10352
  }
@@ -8709,7 +10409,7 @@ type Marginfi = {
8709
10409
  name: "liquidationMaxFee";
8710
10410
  docs: [
8711
10411
  "Liquidators can claim at this premium, when liquidating an asset in receivership",
8712
- "liquidation, e.g. (1 + this) * amount repaid <= asset seized",
10412
+ "liquidation, e.g. (1 + this) * amount repaid >= asset seized",
8713
10413
  "* A percentage"
8714
10414
  ];
8715
10415
  type: {
@@ -8761,9 +10461,24 @@ type Marginfi = {
8761
10461
  type: "u32";
8762
10462
  },
8763
10463
  {
8764
- name: "reserved0";
10464
+ name: "orderInitFlatSolFee";
10465
+ docs: [
10466
+ "Flat fee assessed for preventing spam use when creating an order",
10467
+ "* In SOL, in native decimals."
10468
+ ];
10469
+ type: "u32";
10470
+ },
10471
+ {
10472
+ name: "orderExecutionMaxFee";
10473
+ docs: [
10474
+ "Take-profit Orders can be executed at this premium, which Keepers are allowed to keep (no",
10475
+ "pun intended) e.g. (1 + this) * amount repaid >= asset seized",
10476
+ "* A percentage"
10477
+ ];
8765
10478
  type: {
8766
- array: ["u8", 20];
10479
+ defined: {
10480
+ name: "wrappedI80f48";
10481
+ };
8767
10482
  };
8768
10483
  },
8769
10484
  {
@@ -8777,6 +10492,7 @@ type Marginfi = {
8777
10492
  },
8778
10493
  {
8779
10494
  name: "feeStateCache";
10495
+ docs: ["Cached fee configuration propagated from the global FeeState"];
8780
10496
  repr: {
8781
10497
  kind: "c";
8782
10498
  };
@@ -8785,10 +10501,12 @@ type Marginfi = {
8785
10501
  fields: [
8786
10502
  {
8787
10503
  name: "globalFeeWallet";
10504
+ docs: ["The wallet that receives program-level fees"];
8788
10505
  type: "pubkey";
8789
10506
  },
8790
10507
  {
8791
10508
  name: "programFeeFixed";
10509
+ docs: ["Fixed fee APR charged to borrowers (program-level)"];
8792
10510
  type: {
8793
10511
  defined: {
8794
10512
  name: "wrappedI80f48";
@@ -8797,6 +10515,7 @@ type Marginfi = {
8797
10515
  },
8798
10516
  {
8799
10517
  name: "programFeeRate";
10518
+ docs: ["Proportional fee rate on interest (program-level)"];
8800
10519
  type: {
8801
10520
  defined: {
8802
10521
  name: "wrappedI80f48";
@@ -8805,6 +10524,7 @@ type Marginfi = {
8805
10524
  },
8806
10525
  {
8807
10526
  name: "lastUpdate";
10527
+ docs: ["Unix timestamp of the last fee state propagation"];
8808
10528
  type: "i64";
8809
10529
  }
8810
10530
  ];
@@ -8828,6 +10548,39 @@ type Marginfi = {
8828
10548
  ];
8829
10549
  };
8830
10550
  },
10551
+ {
10552
+ name: "groupRateLimiter";
10553
+ docs: [
10554
+ "Per-group rate limiting configuration and state.",
10555
+ "Tracks aggregate net outflow in USD."
10556
+ ];
10557
+ repr: {
10558
+ kind: "c";
10559
+ };
10560
+ type: {
10561
+ kind: "struct";
10562
+ fields: [
10563
+ {
10564
+ name: "hourly";
10565
+ docs: ["Hourly window rate limiter (USD)."];
10566
+ type: {
10567
+ defined: {
10568
+ name: "rateLimitWindow";
10569
+ };
10570
+ };
10571
+ },
10572
+ {
10573
+ name: "daily";
10574
+ docs: ["Daily window rate limiter (USD)."];
10575
+ type: {
10576
+ defined: {
10577
+ name: "rateLimitWindow";
10578
+ };
10579
+ };
10580
+ }
10581
+ ];
10582
+ };
10583
+ },
8831
10584
  {
8832
10585
  name: "healthCache";
8833
10586
  docs: [
@@ -8937,7 +10690,7 @@ type Marginfi = {
8937
10690
  {
8938
10691
  name: "flags";
8939
10692
  docs: [
8940
- "The flags that indicate the state of the health cache. This is a u64 bitfield, where each",
10693
+ "The flags that indicate the state of the health cache. This is a u32 bitfield, where each",
8941
10694
  "bit represents a flag.",
8942
10695
  "",
8943
10696
  "* HEALTHY = 1 - If set, the account cannot be liquidated. If 0, the account is unhealthy and",
@@ -9005,10 +10758,14 @@ type Marginfi = {
9005
10758
  },
9006
10759
  {
9007
10760
  name: "internalLiqErr";
10761
+ docs: [
10762
+ "Error code from the liquidation health check during the last health pulse (0 if none)"
10763
+ ];
9008
10764
  type: "u32";
9009
10765
  },
9010
10766
  {
9011
10767
  name: "internalBankruptcyErr";
10768
+ docs: ["Error code from the bankruptcy check during the last health pulse (0 if none)"];
9012
10769
  type: "u32";
9013
10770
  },
9014
10771
  {
@@ -9380,6 +11137,83 @@ type Marginfi = {
9380
11137
  ];
9381
11138
  };
9382
11139
  },
11140
+ {
11141
+ name: "juplendConfigCompact";
11142
+ docs: [
11143
+ "Used to configure JupLend banks. A simplified version of `BankConfigCompact` which omits most",
11144
+ "values related to interest since JupLend banks cannot earn interest or be borrowed against.",
11145
+ "",
11146
+ "Note: JupLend banks do not take an Operational State, they always start in `Paused` state and",
11147
+ "are set to `Operational` via `juplend_init_position` (seed deposit + protocol fToken vault)."
11148
+ ];
11149
+ type: {
11150
+ kind: "struct";
11151
+ fields: [
11152
+ {
11153
+ name: "oracle";
11154
+ type: "pubkey";
11155
+ },
11156
+ {
11157
+ name: "assetWeightInit";
11158
+ type: {
11159
+ defined: {
11160
+ name: "wrappedI80f48";
11161
+ };
11162
+ };
11163
+ },
11164
+ {
11165
+ name: "assetWeightMaint";
11166
+ type: {
11167
+ defined: {
11168
+ name: "wrappedI80f48";
11169
+ };
11170
+ };
11171
+ },
11172
+ {
11173
+ name: "depositLimit";
11174
+ type: "u64";
11175
+ },
11176
+ {
11177
+ name: "oracleSetup";
11178
+ docs: ["Either `JuplendPythPull` or `JuplendSwitchboardPull`"];
11179
+ type: {
11180
+ defined: {
11181
+ name: "oracleSetup";
11182
+ };
11183
+ };
11184
+ },
11185
+ {
11186
+ name: "riskTier";
11187
+ docs: ["Isolated or Collateral"];
11188
+ type: {
11189
+ defined: {
11190
+ name: "riskTier";
11191
+ };
11192
+ };
11193
+ },
11194
+ {
11195
+ name: "configFlags";
11196
+ docs: ["Config flags for future-proofing, currently ignored"];
11197
+ type: "u8";
11198
+ },
11199
+ {
11200
+ name: "totalAssetValueInitLimit";
11201
+ docs: ["In $"];
11202
+ type: "u64";
11203
+ },
11204
+ {
11205
+ name: "oracleMaxAge";
11206
+ docs: ["In seconds"];
11207
+ type: "u16";
11208
+ },
11209
+ {
11210
+ name: "oracleMaxConfidence";
11211
+ docs: ["Oracle confidence threshold (0 = use default 10%)"];
11212
+ type: "u32";
11213
+ }
11214
+ ];
11215
+ };
11216
+ },
9383
11217
  {
9384
11218
  name: "kaminoConfigCompact";
9385
11219
  docs: [
@@ -9462,8 +11296,101 @@ type Marginfi = {
9462
11296
  ];
9463
11297
  };
9464
11298
  },
11299
+ {
11300
+ name: "keeperCloseOrderEvent";
11301
+ type: {
11302
+ kind: "struct";
11303
+ fields: [
11304
+ {
11305
+ name: "header";
11306
+ type: {
11307
+ defined: {
11308
+ name: "accountEventHeader";
11309
+ };
11310
+ };
11311
+ },
11312
+ {
11313
+ name: "order";
11314
+ type: "pubkey";
11315
+ }
11316
+ ];
11317
+ };
11318
+ },
11319
+ {
11320
+ name: "lending";
11321
+ docs: [
11322
+ "Minimal representation of the on-chain JupLend `Lending` account.",
11323
+ "",
11324
+ "Notes:",
11325
+ "- We intentionally use a **zero-copy** layout here to match how other integrations load large",
11326
+ "external accounts (and to avoid paying Borsh (de)serialization cost on every access).",
11327
+ "- `repr(C, packed)` keeps the byte layout identical to a field-by-field serialization",
11328
+ "(i.e. no implicit padding). This is important because `Pubkey` has alignment=1 while `u64`",
11329
+ "has alignment=8; using plain `repr(C)` would insert padding before the first `u64`."
11330
+ ];
11331
+ serialization: "bytemuckunsafe";
11332
+ repr: {
11333
+ kind: "c";
11334
+ packed: true;
11335
+ };
11336
+ type: {
11337
+ kind: "struct";
11338
+ fields: [
11339
+ {
11340
+ name: "mint";
11341
+ type: "pubkey";
11342
+ },
11343
+ {
11344
+ name: "fTokenMint";
11345
+ type: "pubkey";
11346
+ },
11347
+ {
11348
+ name: "lendingId";
11349
+ type: "u16";
11350
+ },
11351
+ {
11352
+ name: "decimals";
11353
+ docs: ["number of decimals for the fToken, same as underlying mint"];
11354
+ type: "u8";
11355
+ },
11356
+ {
11357
+ name: "rewardsRateModel";
11358
+ docs: ["PDA of rewards rate model (LRRM)"];
11359
+ type: "pubkey";
11360
+ },
11361
+ {
11362
+ name: "liquidityExchangePrice";
11363
+ docs: ["exchange price in the liquidity layer (no rewards)"];
11364
+ type: "u64";
11365
+ },
11366
+ {
11367
+ name: "tokenExchangePrice";
11368
+ docs: ["exchange price between fToken and underlying (with rewards)"];
11369
+ type: "u64";
11370
+ },
11371
+ {
11372
+ name: "lastUpdateTimestamp";
11373
+ docs: ["unix timestamp when exchange prices were updated last"];
11374
+ type: "u64";
11375
+ },
11376
+ {
11377
+ name: "tokenReservesLiquidity";
11378
+ type: "pubkey";
11379
+ },
11380
+ {
11381
+ name: "supplyPositionOnLiquidity";
11382
+ type: "pubkey";
11383
+ },
11384
+ {
11385
+ name: "bump";
11386
+ type: "u8";
11387
+ }
11388
+ ];
11389
+ };
11390
+ },
9465
11391
  {
9466
11392
  name: "lendingAccount";
11393
+ docs: ["The lending account holds up to 16 balance positions for a user."];
9467
11394
  repr: {
9468
11395
  kind: "c";
9469
11396
  };
@@ -9472,6 +11399,7 @@ type Marginfi = {
9472
11399
  fields: [
9473
11400
  {
9474
11401
  name: "balances";
11402
+ docs: ["Array of balance positions (max 16). Sorted in descending order by bank_pk."];
9475
11403
  type: {
9476
11404
  array: [
9477
11405
  {
@@ -9483,10 +11411,23 @@ type Marginfi = {
9483
11411
  ];
9484
11412
  };
9485
11413
  },
11414
+ {
11415
+ name: "lastTagUsed";
11416
+ docs: ["Last allocated balance tag (u16), used to find the next unused tag."];
11417
+ type: "u16";
11418
+ },
11419
+ {
11420
+ name: "pad1";
11421
+ docs: ["Reserved for future use"];
11422
+ type: {
11423
+ array: ["u8", 6];
11424
+ };
11425
+ },
9486
11426
  {
9487
11427
  name: "padding";
11428
+ docs: ["Reserved for future use"];
9488
11429
  type: {
9489
- array: ["u64", 8];
11430
+ array: ["u64", 7];
9490
11431
  };
9491
11432
  }
9492
11433
  ];
@@ -10236,7 +12177,7 @@ type Marginfi = {
10236
12177
  name: "emissionsDestinationAccount";
10237
12178
  docs: [
10238
12179
  "Set with `update_emissions_destination_account`. Emissions rewards can be withdrawn to the",
10239
- "cannonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).",
12180
+ "canonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).",
10240
12181
  "If pubkey default, the user has not opted into this feature, and must claim emissions",
10241
12182
  "manually (withdraw_emissions)."
10242
12183
  ];
@@ -10264,6 +12205,9 @@ type Marginfi = {
10264
12205
  },
10265
12206
  {
10266
12207
  name: "lastUpdate";
12208
+ docs: [
12209
+ "Unix timestamp (u64) of the last account interaction. Note: Bank.last_update uses i64."
12210
+ ];
10267
12211
  type: "u64";
10268
12212
  },
10269
12213
  {
@@ -10301,21 +12245,41 @@ type Marginfi = {
10301
12245
  };
10302
12246
  },
10303
12247
  {
10304
- name: "liquidationRecord";
10305
- docs: [
10306
- "Stores information related to liquidations made against this account. A pda of this",
10307
- 'account\'s key, and "liq_record"',
10308
- "* Typically pubkey default if this account has never been liquidated or close to liquidation",
10309
- "* Opening this account is permissionless. Typically the liquidator pays, but e.g. we may",
10310
- "also charge the user if they are opening a risky position on the front end."
10311
- ];
12248
+ name: "liquidationRecord";
12249
+ docs: [
12250
+ "Stores information related to liquidations made against this account. A pda of this",
12251
+ 'account\'s key, and "liq_record"',
12252
+ "* Typically pubkey default if this account has never been liquidated or close to liquidation",
12253
+ "* Opening this account is permissionless. Typically the liquidator pays, but e.g. we may",
12254
+ "also charge the user if they are opening a risky position on the front end."
12255
+ ];
12256
+ type: "pubkey";
12257
+ },
12258
+ {
12259
+ name: "padding0";
12260
+ type: {
12261
+ array: ["u64", 7];
12262
+ };
12263
+ }
12264
+ ];
12265
+ };
12266
+ },
12267
+ {
12268
+ name: "marginfiAccountCloseOrderEvent";
12269
+ type: {
12270
+ kind: "struct";
12271
+ fields: [
12272
+ {
12273
+ name: "header";
12274
+ type: {
12275
+ defined: {
12276
+ name: "accountEventHeader";
12277
+ };
12278
+ };
12279
+ },
12280
+ {
12281
+ name: "order";
10312
12282
  type: "pubkey";
10313
- },
10314
- {
10315
- name: "padding0";
10316
- type: {
10317
- array: ["u64", 7];
10318
- };
10319
12283
  }
10320
12284
  ];
10321
12285
  };
@@ -10356,6 +12320,56 @@ type Marginfi = {
10356
12320
  ];
10357
12321
  };
10358
12322
  },
12323
+ {
12324
+ name: "marginfiAccountPlaceOrderEvent";
12325
+ type: {
12326
+ kind: "struct";
12327
+ fields: [
12328
+ {
12329
+ name: "header";
12330
+ type: {
12331
+ defined: {
12332
+ name: "accountEventHeader";
12333
+ };
12334
+ };
12335
+ },
12336
+ {
12337
+ name: "order";
12338
+ type: "pubkey";
12339
+ },
12340
+ {
12341
+ name: "trigger";
12342
+ type: {
12343
+ defined: {
12344
+ name: "orderTriggerType";
12345
+ };
12346
+ };
12347
+ },
12348
+ {
12349
+ name: "stopLoss";
12350
+ type: {
12351
+ defined: {
12352
+ name: "wrappedI80f48";
12353
+ };
12354
+ };
12355
+ },
12356
+ {
12357
+ name: "takeProfit";
12358
+ type: {
12359
+ defined: {
12360
+ name: "wrappedI80f48";
12361
+ };
12362
+ };
12363
+ },
12364
+ {
12365
+ name: "tags";
12366
+ type: {
12367
+ array: ["u16", 2];
12368
+ };
12369
+ }
12370
+ ];
12371
+ };
12372
+ },
10359
12373
  {
10360
12374
  name: "marginfiAccountTransferToNewAccount";
10361
12375
  type: {
@@ -10402,8 +12416,7 @@ type Marginfi = {
10402
12416
  name: "groupFlags";
10403
12417
  docs: [
10404
12418
  "Bitmask for group settings flags.",
10405
- "* 0: `PROGRAM_FEES_ENABLED` If set, program-level fees are enabled.",
10406
- "* 1: `ARENA_GROUP` Deprecated, available for future use.",
12419
+ "* Bit 0 (1): `PROGRAM_FEES_ENABLED` If set, program-level fees are enabled.",
10407
12420
  "* Bits 1-63: Reserved for future use."
10408
12421
  ];
10409
12422
  type: "u64";
@@ -10421,6 +12434,11 @@ type Marginfi = {
10421
12434
  },
10422
12435
  {
10423
12436
  name: "banks";
12437
+ docs: [
12438
+ "For groups initialized in versions 0.1.2 or greater, this is an authoritative count",
12439
+ "of the number of banks under this group. For groups initialized prior to 0.1.2,",
12440
+ "a non-authoritative count of the number of banks initiated after 0.1.2 went live."
12441
+ ];
10424
12442
  type: "u16";
10425
12443
  },
10426
12444
  {
@@ -10440,6 +12458,10 @@ type Marginfi = {
10440
12458
  },
10441
12459
  {
10442
12460
  name: "delegateCurveAdmin";
12461
+ docs: [
12462
+ "Can modify the fields in `config.interest_rate_config` but nothing else, for every bank",
12463
+ "under this group"
12464
+ ];
10443
12465
  type: "pubkey";
10444
12466
  },
10445
12467
  {
@@ -10497,18 +12519,39 @@ type Marginfi = {
10497
12519
  },
10498
12520
  {
10499
12521
  name: "emodeMaxInitLeverage";
12522
+ docs: [
12523
+ "Maximum leverage allowed for emode positions (initial margin), stored as u32 basis.",
12524
+ "Use `u32_to_basis` to convert to I80F48. Range: 1-100."
12525
+ ];
10500
12526
  type: "u32";
10501
12527
  },
10502
12528
  {
10503
12529
  name: "emodeMaxMaintLeverage";
12530
+ docs: [
12531
+ "Maximum leverage allowed for emode positions (maintenance margin), stored as u32 basis.",
12532
+ "Must be > emode_max_init_leverage. Range: 1-100."
12533
+ ];
10504
12534
  type: "u32";
10505
12535
  },
10506
12536
  {
10507
12537
  name: "padding";
12538
+ docs: ["Reserved for future use"];
10508
12539
  type: {
10509
12540
  array: ["u8", 8];
10510
12541
  };
10511
12542
  },
12543
+ {
12544
+ name: "rateLimiter";
12545
+ docs: [
12546
+ "Rate limiter for controlling aggregate withdraw/borrow outflow across all banks.",
12547
+ "Tracks net outflow in USD."
12548
+ ];
12549
+ type: {
12550
+ defined: {
12551
+ name: "groupRateLimiter";
12552
+ };
12553
+ };
12554
+ },
10512
12555
  {
10513
12556
  name: "padding0";
10514
12557
  type: {
@@ -10516,7 +12559,7 @@ type Marginfi = {
10516
12559
  {
10517
12560
  array: ["u64", 2];
10518
12561
  },
10519
- 11
12562
+ 6
10520
12563
  ];
10521
12564
  };
10522
12565
  },
@@ -10549,7 +12592,9 @@ type Marginfi = {
10549
12592
  },
10550
12593
  {
10551
12594
  name: "admin";
10552
- type: "pubkey";
12595
+ type: {
12596
+ option: "pubkey";
12597
+ };
10553
12598
  },
10554
12599
  {
10555
12600
  name: "flags";
@@ -11266,24 +13311,261 @@ type Marginfi = {
11266
13311
  type: "u16";
11267
13312
  },
11268
13313
  {
11269
- name: "status";
11270
- type: {
11271
- defined: {
11272
- name: "userStatus";
11273
- };
11274
- };
13314
+ name: "status";
13315
+ type: {
13316
+ defined: {
13317
+ name: "userStatus";
13318
+ };
13319
+ };
13320
+ },
13321
+ {
13322
+ name: "padding8";
13323
+ type: {
13324
+ array: ["u8", 27];
13325
+ };
13326
+ }
13327
+ ];
13328
+ };
13329
+ },
13330
+ {
13331
+ name: "oracleSetup";
13332
+ repr: {
13333
+ kind: "rust";
13334
+ };
13335
+ type: {
13336
+ kind: "enum";
13337
+ variants: [
13338
+ {
13339
+ name: "none";
13340
+ },
13341
+ {
13342
+ name: "pythLegacy";
13343
+ },
13344
+ {
13345
+ name: "switchboardV2";
13346
+ },
13347
+ {
13348
+ name: "pythPushOracle";
13349
+ },
13350
+ {
13351
+ name: "switchboardPull";
13352
+ },
13353
+ {
13354
+ name: "stakedWithPythPush";
13355
+ },
13356
+ {
13357
+ name: "kaminoPythPush";
13358
+ },
13359
+ {
13360
+ name: "kaminoSwitchboardPull";
13361
+ },
13362
+ {
13363
+ name: "fixed";
13364
+ },
13365
+ {
13366
+ name: "driftPythPull";
13367
+ },
13368
+ {
13369
+ name: "driftSwitchboardPull";
13370
+ },
13371
+ {
13372
+ name: "solendPythPull";
13373
+ },
13374
+ {
13375
+ name: "solendSwitchboardPull";
13376
+ },
13377
+ {
13378
+ name: "fixedKamino";
13379
+ },
13380
+ {
13381
+ name: "fixedDrift";
13382
+ },
13383
+ {
13384
+ name: "juplendPythPull";
13385
+ },
13386
+ {
13387
+ name: "juplendSwitchboardPull";
13388
+ },
13389
+ {
13390
+ name: "fixedJuplend";
13391
+ }
13392
+ ];
13393
+ };
13394
+ },
13395
+ {
13396
+ name: "order";
13397
+ serialization: "bytemuck";
13398
+ repr: {
13399
+ kind: "c";
13400
+ };
13401
+ type: {
13402
+ kind: "struct";
13403
+ fields: [
13404
+ {
13405
+ name: "marginfiAccount";
13406
+ type: "pubkey";
13407
+ },
13408
+ {
13409
+ name: "stopLoss";
13410
+ type: {
13411
+ defined: {
13412
+ name: "wrappedI80f48";
13413
+ };
13414
+ };
13415
+ },
13416
+ {
13417
+ name: "takeProfit";
13418
+ type: {
13419
+ defined: {
13420
+ name: "wrappedI80f48";
13421
+ };
13422
+ };
13423
+ },
13424
+ {
13425
+ name: "placeholder";
13426
+ docs: ["Reserved for future use"];
13427
+ type: "u64";
13428
+ },
13429
+ {
13430
+ name: "maxSlippage";
13431
+ docs: ["* a %, as u32, out of 100%, e.g. 50% = .5 * u32::MAX"];
13432
+ type: "u32";
13433
+ },
13434
+ {
13435
+ name: "pad0";
13436
+ type: {
13437
+ array: ["u8", 4];
13438
+ };
13439
+ },
13440
+ {
13441
+ name: "tags";
13442
+ docs: [
13443
+ "Active tags (currently 2). Remaining capacity is stored in padding for layout compatibility.",
13444
+ "Padding byte `ORDER_TAG_PADDING - 1` stores the tag count for forward compatibility. (u16 *",
13445
+ "2 = 4 bytes)"
13446
+ ];
13447
+ type: {
13448
+ array: ["u16", 2];
13449
+ };
13450
+ },
13451
+ {
13452
+ name: "pad1";
13453
+ type: {
13454
+ array: ["u8", 4];
13455
+ };
13456
+ },
13457
+ {
13458
+ name: "tagsPadding";
13459
+ type: {
13460
+ array: ["u8", 32];
13461
+ };
13462
+ },
13463
+ {
13464
+ name: "trigger";
13465
+ docs: ["Stop Loss (0), Take Profit (1), or Both (2)"];
13466
+ type: {
13467
+ defined: {
13468
+ name: "orderTriggerType";
13469
+ };
13470
+ };
13471
+ },
13472
+ {
13473
+ name: "bump";
13474
+ docs: ["Bump to derive this pda"];
13475
+ type: "u8";
13476
+ },
13477
+ {
13478
+ name: "pad2";
13479
+ type: {
13480
+ array: ["u8", 6];
13481
+ };
13482
+ },
13483
+ {
13484
+ name: "reserved1";
13485
+ type: {
13486
+ array: [
13487
+ {
13488
+ array: ["u8", 32];
13489
+ },
13490
+ 4
13491
+ ];
13492
+ };
13493
+ }
13494
+ ];
13495
+ };
13496
+ },
13497
+ {
13498
+ name: "orderTrigger";
13499
+ repr: {
13500
+ kind: "c";
13501
+ };
13502
+ type: {
13503
+ kind: "enum";
13504
+ variants: [
13505
+ {
13506
+ name: "stopLoss";
13507
+ fields: [
13508
+ {
13509
+ name: "threshold";
13510
+ type: {
13511
+ defined: {
13512
+ name: "wrappedI80f48";
13513
+ };
13514
+ };
13515
+ },
13516
+ {
13517
+ name: "maxSlippage";
13518
+ type: "u32";
13519
+ }
13520
+ ];
13521
+ },
13522
+ {
13523
+ name: "takeProfit";
13524
+ fields: [
13525
+ {
13526
+ name: "threshold";
13527
+ type: {
13528
+ defined: {
13529
+ name: "wrappedI80f48";
13530
+ };
13531
+ };
13532
+ },
13533
+ {
13534
+ name: "maxSlippage";
13535
+ type: "u32";
13536
+ }
13537
+ ];
11275
13538
  },
11276
13539
  {
11277
- name: "padding8";
11278
- type: {
11279
- array: ["u8", 27];
11280
- };
13540
+ name: "both";
13541
+ fields: [
13542
+ {
13543
+ name: "stopLoss";
13544
+ type: {
13545
+ defined: {
13546
+ name: "wrappedI80f48";
13547
+ };
13548
+ };
13549
+ },
13550
+ {
13551
+ name: "takeProfit";
13552
+ type: {
13553
+ defined: {
13554
+ name: "wrappedI80f48";
13555
+ };
13556
+ };
13557
+ },
13558
+ {
13559
+ name: "maxSlippage";
13560
+ type: "u32";
13561
+ }
13562
+ ];
11281
13563
  }
11282
13564
  ];
11283
13565
  };
11284
13566
  },
11285
13567
  {
11286
- name: "oracleSetup";
13568
+ name: "orderTriggerType";
11287
13569
  repr: {
11288
13570
  kind: "rust";
11289
13571
  };
@@ -11291,43 +13573,13 @@ type Marginfi = {
11291
13573
  kind: "enum";
11292
13574
  variants: [
11293
13575
  {
11294
- name: "none";
11295
- },
11296
- {
11297
- name: "pythLegacy";
11298
- },
11299
- {
11300
- name: "switchboardV2";
11301
- },
11302
- {
11303
- name: "pythPushOracle";
11304
- },
11305
- {
11306
- name: "switchboardPull";
11307
- },
11308
- {
11309
- name: "stakedWithPythPush";
11310
- },
11311
- {
11312
- name: "kaminoPythPush";
11313
- },
11314
- {
11315
- name: "kaminoSwitchboardPull";
11316
- },
11317
- {
11318
- name: "fixed";
11319
- },
11320
- {
11321
- name: "driftPythPull";
11322
- },
11323
- {
11324
- name: "driftSwitchboardPull";
13576
+ name: "stopLoss";
11325
13577
  },
11326
13578
  {
11327
- name: "solendPythPull";
13579
+ name: "takeProfit";
11328
13580
  },
11329
13581
  {
11330
- name: "solendSwitchboardPull";
13582
+ name: "both";
11331
13583
  }
11332
13584
  ];
11333
13585
  };
@@ -11418,6 +13670,59 @@ type Marginfi = {
11418
13670
  ];
11419
13671
  };
11420
13672
  },
13673
+ {
13674
+ name: "rateLimitWindow";
13675
+ docs: [
13676
+ "A sliding window rate limiter that tracks net outflow over a time window.",
13677
+ "Uses weighted blend of previous and current windows for smooth transitions.",
13678
+ "",
13679
+ "Net outflow = (withdraws + borrows) - (deposits + repays).",
13680
+ "A negative net outflow increases remaining capacity for subsequent outflows."
13681
+ ];
13682
+ repr: {
13683
+ kind: "c";
13684
+ };
13685
+ type: {
13686
+ kind: "struct";
13687
+ fields: [
13688
+ {
13689
+ name: "maxOutflow";
13690
+ docs: [
13691
+ "Maximum net outflow allowed per window (0 = disabled).",
13692
+ "For bank-level: denominated in native tokens.",
13693
+ "For group-level: denominated in USD."
13694
+ ];
13695
+ type: "u64";
13696
+ },
13697
+ {
13698
+ name: "windowDuration";
13699
+ docs: ["Window duration in seconds (e.g., 3600 for hourly, 86400 for daily)."];
13700
+ type: "u64";
13701
+ },
13702
+ {
13703
+ name: "windowStart";
13704
+ docs: ["Unix timestamp when the current window started."];
13705
+ type: "i64";
13706
+ },
13707
+ {
13708
+ name: "prevWindowOutflow";
13709
+ docs: [
13710
+ "Net outflow accumulated in the previous window.",
13711
+ "Signed to allow tracking when inflows exceed outflows."
13712
+ ];
13713
+ type: "i64";
13714
+ },
13715
+ {
13716
+ name: "curWindowOutflow";
13717
+ docs: [
13718
+ "Net outflow accumulated in the current window.",
13719
+ "Signed to allow tracking when inflows exceed outflows."
13720
+ ];
13721
+ type: "i64";
13722
+ }
13723
+ ];
13724
+ };
13725
+ },
11421
13726
  {
11422
13727
  name: "ratePoint";
11423
13728
  repr: {
@@ -11462,6 +13767,30 @@ type Marginfi = {
11462
13767
  ];
11463
13768
  };
11464
13769
  },
13770
+ {
13771
+ name: "setKeeperCloseFlagsEvent";
13772
+ type: {
13773
+ kind: "struct";
13774
+ fields: [
13775
+ {
13776
+ name: "header";
13777
+ type: {
13778
+ defined: {
13779
+ name: "accountEventHeader";
13780
+ };
13781
+ };
13782
+ },
13783
+ {
13784
+ name: "bankKeys";
13785
+ type: {
13786
+ option: {
13787
+ vec: "pubkey";
13788
+ };
13789
+ };
13790
+ }
13791
+ ];
13792
+ };
13793
+ },
11465
13794
  {
11466
13795
  name: "solendConfigCompact";
11467
13796
  docs: [
@@ -11767,7 +14096,7 @@ type Marginfi = {
11767
14096
  docs: [
11768
14097
  "Unique per-group. Staked Collateral banks created under a group automatically use these",
11769
14098
  "settings. Groups that have not created this struct cannot create staked collateral banks. When",
11770
- "this struct updates, changes must be permissionlessly propogated to staked collateral banks.",
14099
+ "this struct updates, changes must be permissionlessly propagated to staked collateral banks.",
11771
14100
  "Administrators can also edit the bank manually, i.e. with configure_bank, to temporarily make",
11772
14101
  "changes such as raising the deposit limit for a single bank."
11773
14102
  ];
@@ -12013,6 +14342,7 @@ type Marginfi = {
12013
14342
  },
12014
14343
  {
12015
14344
  name: "withdrawWindowCache";
14345
+ docs: ["Tracks deleverage withdrawal limits to protect against compromised risk admin"];
12016
14346
  repr: {
12017
14347
  kind: "c";
12018
14348
  };
@@ -12021,14 +14351,17 @@ type Marginfi = {
12021
14351
  fields: [
12022
14352
  {
12023
14353
  name: "dailyLimit";
14354
+ docs: ["Maximum USD value that can be withdrawn per day via deleverage (0 = no limit)"];
12024
14355
  type: "u32";
12025
14356
  },
12026
14357
  {
12027
14358
  name: "withdrawnToday";
14359
+ docs: ["USD value withdrawn today via deleverage (approximate, rounded)"];
12028
14360
  type: "u32";
12029
14361
  },
12030
14362
  {
12031
14363
  name: "lastDailyResetTimestamp";
14364
+ docs: ["Unix timestamp of the last daily counter reset"];
12032
14365
  type: "i64";
12033
14366
  }
12034
14367
  ];
@@ -12369,6 +14702,16 @@ type OracleSetupRaw = {
12369
14702
  solendPythPull: {};
12370
14703
  } | {
12371
14704
  solendSwitchboardPull: {};
14705
+ } | {
14706
+ fixedKamino: {};
14707
+ } | {
14708
+ fixedDrift: {};
14709
+ } | {
14710
+ juplendPythPull: {};
14711
+ } | {
14712
+ juplendSwitchboardPull: {};
14713
+ } | {
14714
+ fixedJuplend: {};
12372
14715
  };
12373
14716
  interface OracleConfigOptRaw {
12374
14717
  setup: OracleSetupRaw;
@@ -12445,7 +14788,12 @@ declare enum OracleSetup {
12445
14788
  DriftPythPull = "DriftPythPull",
12446
14789
  DriftSwitchboardPull = "DriftSwitchboardPull",
12447
14790
  SolendPythPull = "SolendPythPull",
12448
- SolendSwitchboardPull = "SolendSwitchboardPull"
14791
+ SolendSwitchboardPull = "SolendSwitchboardPull",
14792
+ FixedKamino = "FixedKamino",
14793
+ FixedDrift = "FixedDrift",
14794
+ JuplendPythPull = "JuplendPythPull",
14795
+ JuplendSwitchboardPull = "JuplendSwitchboardPull",
14796
+ FixedJuplend = "FixedJuplend"
12449
14797
  }
12450
14798
  declare enum AssetTag {
12451
14799
  DEFAULT = 0,
@@ -12453,7 +14801,8 @@ declare enum AssetTag {
12453
14801
  STAKED = 2,
12454
14802
  KAMINO = 3,
12455
14803
  DRIFT = 4,
12456
- SOLEND = 5
14804
+ SOLEND = 5,
14805
+ JUPLEND = 6
12457
14806
  }
12458
14807
  declare enum BankConfigFlag {
12459
14808
  PYTH_MIGRATED = 1
@@ -12543,6 +14892,11 @@ interface BankType {
12543
14892
  solendReserve: PublicKey;
12544
14893
  solendObligation: PublicKey;
12545
14894
  };
14895
+ jupLendIntegrationAccounts?: {
14896
+ jupLendingState: PublicKey;
14897
+ jupFTokenVault: PublicKey;
14898
+ jupFTokenAta: PublicKey;
14899
+ };
12546
14900
  }
12547
14901
  /**
12548
14902
  * Bitwise flags for EMode entry
@@ -12740,6 +15094,11 @@ interface BankTypeDto {
12740
15094
  solendReserve: string;
12741
15095
  solendObligation: string;
12742
15096
  };
15097
+ jupLendIntegrationAccounts?: {
15098
+ jupLendingState: string;
15099
+ jupFTokenVault: string;
15100
+ jupFTokenAta: string;
15101
+ };
12743
15102
  }
12744
15103
  interface BankRawDto {
12745
15104
  group: string;
@@ -13062,6 +15421,7 @@ declare const categorizePythBanks: (banks: BankType[]) => {
13062
15421
  pythPushKaminosBanks: BankType[];
13063
15422
  driftPythPullBanks: BankType[];
13064
15423
  solendPythPullBanks: BankType[];
15424
+ juplendPythPullBanks: BankType[];
13065
15425
  };
13066
15426
  /**
13067
15427
  * Converts vote account coefficients to bank address coefficients for staked collateral pricing
@@ -13330,6 +15690,17 @@ interface MakeDepositIxParams {
13330
15690
  isSync?: boolean;
13331
15691
  opts?: MakeDepositIxOpts;
13332
15692
  }
15693
+ interface MakeJuplendDepositIxParams {
15694
+ program: MarginfiProgram;
15695
+ bank: BankType;
15696
+ tokenProgram: PublicKey;
15697
+ amount: Amount;
15698
+ accountAddress: PublicKey;
15699
+ authority: PublicKey;
15700
+ group: PublicKey;
15701
+ isSync?: boolean;
15702
+ opts?: MakeDepositIxOpts;
15703
+ }
13333
15704
  interface MakeDriftDepositIxParams {
13334
15705
  program: MarginfiProgram;
13335
15706
  bank: BankType;
@@ -13359,6 +15730,11 @@ interface MakeDepositTxParams extends MakeDepositIxParams {
13359
15730
  luts: AddressLookupTableAccount[];
13360
15731
  blockhash?: string;
13361
15732
  }
15733
+ interface MakeJuplendDepositTxParams extends MakeJuplendDepositIxParams {
15734
+ luts: AddressLookupTableAccount[];
15735
+ connection: Connection;
15736
+ blockhash?: string;
15737
+ }
13362
15738
  interface MakeDriftDepositTxParams extends MakeDriftDepositIxParams {
13363
15739
  luts: AddressLookupTableAccount[];
13364
15740
  connection: Connection;
@@ -13430,6 +15806,20 @@ interface MakeKaminoWithdrawIxParams {
13430
15806
  withdrawAll?: boolean;
13431
15807
  opts?: MakeWithdrawIxOpts;
13432
15808
  }
15809
+ interface MakeJuplendWithdrawIxParams {
15810
+ program: MarginfiProgram;
15811
+ bank: BankType;
15812
+ bankMap: Map<string, BankType>;
15813
+ tokenProgram: PublicKey;
15814
+ amount: Amount;
15815
+ marginfiAccount: MarginfiAccountType;
15816
+ authority: PublicKey;
15817
+ jupLendingState: JupLendingState;
15818
+ bankMetadataMap: BankIntegrationMetadataMap;
15819
+ isSync?: boolean;
15820
+ withdrawAll?: boolean;
15821
+ opts?: MakeWithdrawIxOpts;
15822
+ }
13433
15823
  interface MakeWithdrawIxParams {
13434
15824
  program: MarginfiProgram;
13435
15825
  bank: BankType;
@@ -13486,6 +15876,13 @@ interface MakeBorrowTxParams extends MakeBorrowIxParams {
13486
15876
  luts: AddressLookupTableAccount[];
13487
15877
  crossbarUrl?: string;
13488
15878
  }
15879
+ interface MakeJuplendWithdrawTxParams extends MakeJuplendWithdrawIxParams {
15880
+ connection: Connection;
15881
+ oraclePrices: Map<string, OraclePrice>;
15882
+ assetShareValueMultiplierByBank: Map<string, BigNumber>;
15883
+ luts: AddressLookupTableAccount[];
15884
+ crossbarUrl?: string;
15885
+ }
13489
15886
  interface MakeDriftWithdrawTxParams extends MakeDriftWithdrawIxParams {
13490
15887
  connection: Connection;
13491
15888
  oraclePrices: Map<string, OraclePrice>;
@@ -13740,6 +16137,33 @@ interface SmartCrankResult {
13740
16137
  */
13741
16138
  declare function computeSmartCrank({ marginfiAccount, bankMap, oraclePrices, instructions, program, connection, crossbarUrl, assetShareValueMultiplierByBank, }: SmartCrankParams): Promise<SmartCrankResult>;
13742
16139
 
16140
+ declare const ORACLE_SOURCES: {
16141
+ readonly switchboard: "Switchboard";
16142
+ readonly pyth: "Pyth";
16143
+ readonly fixed: "Fixed";
16144
+ readonly unknown: "Unknown";
16145
+ };
16146
+ type OracleSourceKey = keyof typeof ORACLE_SOURCES;
16147
+ /**
16148
+ * Gets the oracle source from a oracle source key
16149
+ * @param oracleSourceKey - The oracle source key
16150
+ * @returns The oracle source name
16151
+ */
16152
+ declare function getOracleSourceNameFromKey(oracleSourceKey: string): string;
16153
+ /**
16154
+ * Gets the venue from a bank
16155
+ * @param bank - The bank to get the venue from
16156
+ * @returns The venue
16157
+ */
16158
+ declare function getOracleSourceFromBank(bank: BankType): {
16159
+ key: OracleSourceKey;
16160
+ name: string;
16161
+ };
16162
+ declare function getOracleSourceFromOracleSetup(oracleSetup: OracleSetup): {
16163
+ key: "fixed" | "switchboard" | "pyth" | "unknown";
16164
+ name: "Fixed" | "Switchboard" | "Pyth" | "Unknown";
16165
+ };
16166
+
13743
16167
  /**
13744
16168
  * Configuration for simulating account health cache with fallback
13745
16169
  */
@@ -14987,6 +17411,36 @@ declare function makeKaminoWithdrawIx({ program, bank, bankMap, tokenProgram, cT
14987
17411
  declare function makeWithdrawIx({ program, bank, bankMap, tokenProgram, amount, marginfiAccount, authority, withdrawAll, isSync, opts, }: MakeWithdrawIxParams): Promise<InstructionsWrapper>;
14988
17412
  declare function makeWithdrawTx(params: MakeWithdrawTxParams): Promise<TransactionBuilderResult>;
14989
17413
  declare function makeKaminoWithdrawTx(params: MakeKaminoWithdrawTxParams): Promise<TransactionBuilderResult>;
17414
+ /**
17415
+ * Creates a JupLend withdraw instruction for withdrawing assets from a JupLend lending pool.
17416
+ *
17417
+ * This function handles:
17418
+ * - Creating the destination ATA if needed (idempotent)
17419
+ * - Computing health check accounts for the withdrawal
17420
+ * - Deriving JupLend protocol accounts via `getAllDerivedJupLendAccounts` (fTokenMint, rateModel, vault, liquidity, lendingAdmin)
17421
+ * - Using on-chain `jupLendingState` values for supplyTokenReservesLiquidity, lendingSupplyPositionOnLiquidity, and rewardsRateModel
17422
+ * - Unwrapping wSOL back to native SOL if needed
17423
+ *
17424
+ * @param params - The parameters for creating the withdraw instruction
17425
+ * @param params.program - The Marginfi program instance
17426
+ * @param params.bank - The bank to withdraw from (must have JupLend integration configured)
17427
+ * @param params.bankMap - Map of all banks for health check computation
17428
+ * @param params.tokenProgram - The token program ID (TOKEN_PROGRAM or TOKEN_2022_PROGRAM)
17429
+ * @param params.amount - The amount to withdraw in UI units
17430
+ * @param params.marginfiAccount - The Marginfi account to withdraw from
17431
+ * @param params.authority - The authority/signer public key
17432
+ * @param params.jupLendingState - The on-chain JupLend lending state (provides token reserve and rewards accounts)
17433
+ * @param params.withdrawAll - Whether to withdraw the full balance (default: false)
17434
+ * @param params.opts - Optional configuration
17435
+ * @param params.opts.wrapAndUnwrapSol - Whether to unwrap wSOL to native SOL (default: true)
17436
+ * @param params.opts.createAtas - Whether to create the destination ATA if missing (default: true)
17437
+ * @param params.opts.overrideInferAccounts - Optional account overrides for testing/special cases
17438
+ * @param params.opts.observationBanksOverride - Optional override for health check remaining accounts
17439
+ *
17440
+ * @returns Promise resolving to InstructionsWrapper containing the withdraw instructions
17441
+ */
17442
+ declare function makeJuplendWithdrawIx({ program, bank, bankMap, tokenProgram, amount, marginfiAccount, jupLendingState, authority, withdrawAll, opts, }: MakeJuplendWithdrawIxParams): Promise<InstructionsWrapper>;
17443
+ declare function makeJuplendWithdrawTx(params: MakeJuplendWithdrawTxParams): Promise<TransactionBuilderResult>;
14990
17444
 
14991
17445
  declare function makeBorrowIx({ program, bank, bankMap, tokenProgram, amount, marginfiAccount, authority, isSync, opts, }: MakeBorrowIxParams): Promise<InstructionsWrapper>;
14992
17446
  declare function makeBorrowTx(params: MakeBorrowTxParams): Promise<TransactionBuilderResult>;
@@ -15149,6 +17603,57 @@ declare function makeDepositIx({ program, bank, tokenProgram, amount, accountAdd
15149
17603
  * @returns Promise resolving to an ExtendedTransaction with metadata
15150
17604
  */
15151
17605
  declare function makeDepositTx(params: MakeDepositTxParams): Promise<ExtendedTransaction>;
17606
+ /**
17607
+ * Creates a JupLend deposit instruction for depositing assets into a JupLend lending pool.
17608
+ *
17609
+ * This function handles:
17610
+ * - Wrapping SOL to wSOL if needed (for native SOL deposits)
17611
+ * - Deriving all necessary JupLend protocol accounts via `getAllDerivedJupLendAccounts`
17612
+ * - Creating the deposit instruction to the JupLend lending pool
17613
+ *
17614
+ * @param params - The parameters for creating the deposit instruction
17615
+ * @param params.program - The Marginfi program instance
17616
+ * @param params.bank - The bank to deposit into (must have JupLend integration configured)
17617
+ * @param params.tokenProgram - The token program ID (TOKEN_PROGRAM or TOKEN_2022_PROGRAM)
17618
+ * @param params.amount - The amount to deposit in UI units
17619
+ * @param params.accountAddress - The Marginfi account address
17620
+ * @param params.authority - The authority/signer public key
17621
+ * @param params.group - The Marginfi group address
17622
+ * @param params.opts - Optional configuration
17623
+ * @param params.opts.wrapAndUnwrapSol - Whether to wrap SOL to wSOL (default: true)
17624
+ * @param params.opts.wSolBalanceUi - Existing wSOL balance to combine with native SOL (default: 0)
17625
+ * @param params.opts.overrideInferAccounts - Optional account overrides for testing/special cases
17626
+ *
17627
+ * @returns Promise resolving to InstructionsWrapper containing the deposit instructions
17628
+ */
17629
+ declare function makeJuplendDepositIx({ program, bank, tokenProgram, amount, accountAddress, authority, group, isSync, opts, }: MakeJuplendDepositIxParams): Promise<InstructionsWrapper>;
17630
+ /**
17631
+ * Creates a complete JupLend deposit transaction ready to be signed and sent.
17632
+ *
17633
+ * This function builds a full versioned transaction that includes:
17634
+ * - SOL wrapping instructions if depositing native SOL
17635
+ * - The actual deposit instruction to the JupLend lending pool
17636
+ *
17637
+ * The transaction is constructed with proper metadata, address lookup tables,
17638
+ * and is ready to be signed by the authority and submitted to the network.
17639
+ *
17640
+ * @param params - The parameters for creating the deposit transaction
17641
+ * @param params.luts - Address lookup tables for transaction compression
17642
+ * @param params.connection - Solana connection for fetching blockhash
17643
+ * @param params.amount - The amount to deposit in UI units
17644
+ * @param params.blockhash - Optional recent blockhash (fetched if not provided)
17645
+ * @param params.program - The Marginfi program instance
17646
+ * @param params.bank - The bank to deposit into (must have JupLend integration configured)
17647
+ * @param params.tokenProgram - The token program ID
17648
+ * @param params.accountAddress - The Marginfi account address
17649
+ * @param params.authority - The authority/signer public key
17650
+ * @param params.group - The Marginfi group address
17651
+ * @param params.opts - Optional configuration (wrapping, overrides, etc.)
17652
+ *
17653
+ * @returns Promise resolving to a versioned transaction with metadata
17654
+ * @throws Error if the bank doesn't have JupLend integration accounts configured
17655
+ */
17656
+ declare function makeJuplendDepositTx(params: MakeJuplendDepositTxParams): Promise<ExtendedV0Transaction>;
15152
17657
 
15153
17658
  declare function makeLoopTx(params: MakeLoopTxParams): Promise<{
15154
17659
  transactions: ExtendedV0Transaction[];
@@ -15336,6 +17841,25 @@ declare function makeRefreshKaminoBanksIxs(marginfiAccount: MarginfiAccountType,
15336
17841
  */
15337
17842
  declare function makeUpdateDriftMarketIxs(marginfiAccount: MarginfiAccountType, bankMap: Map<string, BankType>, banksToExclude: PublicKey[], bankMetadataMap: BankIntegrationMetadataMap): InstructionsWrapper;
15338
17843
 
17844
+ /**
17845
+ * Creates instructions to refresh JupLend exchange rates.
17846
+ *
17847
+ * This function generates permissionless `update_rate` instructions for all active
17848
+ * JupLend banks in the marginfi account, excluding any specified banks. This ensures
17849
+ * exchange rates are current before risk-sensitive flows (liquidation, borrow,
17850
+ * non-JupLend withdraw where JupLend is collateral).
17851
+ *
17852
+ * Note: juplend_deposit and juplend_withdraw call updateRate internally,
17853
+ * so this is only needed for other flows.
17854
+ *
17855
+ * @param marginfiAccount - The marginfi account containing active bank balances
17856
+ * @param bankMap - Map of bank addresses (base58) to bank instances
17857
+ * @param banksToExclude - Public keys of banks to exclude from the update
17858
+ * @param bankMetadataMap - Map containing Bank-specific metadata (JupLend lending states)
17859
+ * @returns InstructionsWrapper containing update_rate instructions
17860
+ */
17861
+ declare function makeUpdateJupLendRateIxs(marginfiAccount: MarginfiAccountType, bankMap: Map<string, BankType>, banksToExclude: PublicKey[], bankMetadataMap: BankIntegrationMetadataMap): InstructionsWrapper;
17862
+
15339
17863
  type ValidatorVoteAccountByBank = {
15340
17864
  [address: string]: string;
15341
17865
  };
@@ -16077,7 +18601,7 @@ declare function chunkedGetRawMultipleAccountInfos(connection: Connection, pks:
16077
18601
  declare function chunkedGetRawMultipleAccountInfoOrderedWithNulls(connection: Connection, pks: string[], batchChunkSize?: number, maxAccountsChunkSize?: number): Promise<Array<AccountInfo<Buffer> | null>>;
16078
18602
  declare function chunkedGetRawMultipleAccountInfoOrdered(connection: Connection, pks: string[], batchChunkSize?: number, maxAccountsChunkSize?: number): Promise<Array<AccountInfo<Buffer>>>;
16079
18603
 
16080
- type IntegrationType = "kamino" | "drift";
18604
+ type IntegrationType = "kamino" | "drift" | "juplend";
16081
18605
  interface FetchBankIntegrationMetadataOptions {
16082
18606
  connection: Connection;
16083
18607
  banks: Bank[];
@@ -16203,6 +18727,72 @@ declare function getDriftStatesDto(connection: Connection, driftBanks: DriftBank
16203
18727
 
16204
18728
  declare function getDriftCTokenMultiplier(spotMarket: DriftSpotMarket): BigNumber$1;
16205
18729
 
18730
+ type JupLendStateJsonByBank = Record<string, {
18731
+ jupLendingState: JupLendingStateJSON;
18732
+ jupTokenReserveState: JupTokenReserveJSON;
18733
+ jupRewardsRateModel: JupLendingRewardsRateModelJSON | null;
18734
+ jupRateModel: JupRateModelJSON | null;
18735
+ fTokenTotalSupply: string;
18736
+ }>;
18737
+ type JupLendStateByBank = Record<string, {
18738
+ jupLendingState: JupLendingState;
18739
+ jupTokenReserveState: JupTokenReserve;
18740
+ jupRewardsRateModel: JupLendingRewardsRateModel | null;
18741
+ jupRateModel: JupRateModel | null;
18742
+ fTokenTotalSupply: BN;
18743
+ }>;
18744
+
18745
+ interface JupLendMetadata {
18746
+ jupLendStates: {
18747
+ jupLendingState: JupLendingState;
18748
+ jupTokenReserveState: JupTokenReserve;
18749
+ jupRewardsRateModel: JupLendingRewardsRateModel | null;
18750
+ jupRateModel: JupRateModel | null;
18751
+ fTokenTotalSupply: BN;
18752
+ };
18753
+ }
18754
+ interface FetchJupLendMetadataOptions {
18755
+ connection: Connection;
18756
+ banks: Bank[];
18757
+ }
18758
+ interface JupLendBankInput {
18759
+ bankAddress: string;
18760
+ lendingState: string;
18761
+ }
18762
+ /**
18763
+ * Fetch JupLend Lending state, TokenReserve, and RewardsRateModel for banks with JupLend integration.
18764
+ *
18765
+ * This function:
18766
+ * 1. Filters banks that have JupLend integration accounts
18767
+ * 2. Batch fetches all Lending state accounts in one RPC call
18768
+ * 3. Decodes Lending states to extract TokenReserve and RewardsRateModel addresses
18769
+ * 4. Batch fetches TokenReserve and RewardsRateModel accounts in a second RPC call
18770
+ * 5. Returns a complete map keyed by bank address
18771
+ *
18772
+ * @param options - Connection and banks to fetch metadata for
18773
+ * @returns Map of bank addresses to their complete JupLend metadata
18774
+ */
18775
+ declare function getJupLendMetadata(options: FetchJupLendMetadataOptions): Promise<Map<string, JupLendMetadata>>;
18776
+ declare function getJupLendStatesDto(connection: Connection, jupLendBanks: JupLendBankInput[]): Promise<JupLendStateJsonByBank>;
18777
+
18778
+ /**
18779
+ * Compute the fToken → native multiplier for a JupLend market.
18780
+ * Analogous to `getDriftCTokenMultiplier`.
18781
+ *
18782
+ * Formula: newExchangePrice / EXCHANGE_PRICES_PRECISION (1e12)
18783
+ *
18784
+ * Multiply the result by an fToken share amount to get the equivalent
18785
+ * native token amount (in lamports / base units).
18786
+ *
18787
+ * @param lendingState - The on-chain Lending account
18788
+ * @param tokenReserve - The on-chain TokenReserve account
18789
+ * @param rewardsModel - The on-chain LendingRewardsRateModel (or null)
18790
+ * @param fTokenTotalSupply - Total supply of the fToken mint (raw amount)
18791
+ * @param nowSeconds - Current unix timestamp in seconds
18792
+ * @returns Multiplier as BigNumber (e.g. 1.05 means 1 fToken = 1.05 native tokens)
18793
+ */
18794
+ declare function getJupLendFTokenMultiplier(lendingState: JupLendingState, tokenReserve: JupTokenReserve, rewardsModel: JupLendingRewardsRateModel | null, fTokenTotalSupply: BN, nowSeconds: number): BigNumber$1;
18795
+
16206
18796
  declare class EmodeSettings implements EmodeSettingsType {
16207
18797
  emodeTag: EmodeTag;
16208
18798
  timestamp: number;
@@ -16262,6 +18852,11 @@ declare class Bank implements BankType {
16262
18852
  solendReserve: PublicKey;
16263
18853
  solendObligation: PublicKey;
16264
18854
  } | undefined;
18855
+ readonly jupLendIntegrationAccounts?: {
18856
+ jupLendingState: PublicKey;
18857
+ jupFTokenVault: PublicKey;
18858
+ jupFTokenAta: PublicKey;
18859
+ } | undefined;
16265
18860
  readonly feesDestinationAccount?: PublicKey | undefined;
16266
18861
  readonly lendingPositionCount?: BigNumber$1 | undefined;
16267
18862
  readonly borrowingPositionCount?: BigNumber$1 | undefined;
@@ -16276,6 +18871,10 @@ declare class Bank implements BankType {
16276
18871
  } | undefined, solendIntegrationAccounts?: {
16277
18872
  solendReserve: PublicKey;
16278
18873
  solendObligation: PublicKey;
18874
+ } | undefined, jupLendIntegrationAccounts?: {
18875
+ jupLendingState: PublicKey;
18876
+ jupFTokenVault: PublicKey;
18877
+ jupFTokenAta: PublicKey;
16279
18878
  } | undefined, feesDestinationAccount?: PublicKey | undefined, lendingPositionCount?: BigNumber$1 | undefined, borrowingPositionCount?: BigNumber$1 | undefined, tokenSymbol?: string | undefined);
16280
18879
  static fetch(address: PublicKey, program: MarginfiProgram, bankMetadata?: BankMetadata$1): Promise<Bank>;
16281
18880
  static decodeBankRaw(encoded: Buffer, idl: MarginfiIdlType): BankRaw;
@@ -16389,6 +18988,13 @@ type BankIntegrationMetadata = {
16389
18988
  userRewards: DriftRewards[];
16390
18989
  userStatsState?: DriftUserStats;
16391
18990
  };
18991
+ jupLendStates?: {
18992
+ jupLendingState: JupLendingState;
18993
+ jupTokenReserveState: JupTokenReserve;
18994
+ jupRewardsRateModel: JupLendingRewardsRateModel | null;
18995
+ jupRateModel: JupRateModel | null;
18996
+ fTokenTotalSupply: BN;
18997
+ };
16392
18998
  };
16393
18999
  type BankIntegrationMetadataDto = {
16394
19000
  kaminoStates?: {
@@ -16402,6 +19008,13 @@ type BankIntegrationMetadataDto = {
16402
19008
  userRewards: DriftRewardsJSON[];
16403
19009
  userStatsState?: DriftUserStatsJSON;
16404
19010
  };
19011
+ jupLendStates?: {
19012
+ jupLendingState: JupLendingStateJSON;
19013
+ jupTokenReserveState: JupTokenReserveJSON;
19014
+ jupRewardsRateModel: JupLendingRewardsRateModelJSON | null;
19015
+ jupRateModel: JupRateModelJSON | null;
19016
+ fTokenTotalSupply: string;
19017
+ };
16405
19018
  };
16406
19019
  type BankIntegrationMetadataMap = {
16407
19020
  [address: string]: BankIntegrationMetadata;
@@ -17877,4 +20490,4 @@ declare class MarginfiAccountWrapper {
17877
20490
  getClient(): Project0Client;
17878
20491
  }
17879
20492
 
17880
- export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, type Amount, type AmountType, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, type BankAddress, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, type BankIntegrationMetadata, type BankIntegrationMetadataDto, type BankIntegrationMetadataMap, type BankIntegrationMetadataMapDto, type BankMap, type BankMetadata, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type ComputeAssetHealthComponentParams, type ComputeAssetUsdValueParams, type ComputeBalanceUsdValueParams, type ComputeFreeCollateralFromBalancesParams, type ComputeHealthCacheStatusParams, type ComputeHealthComponentsFromBalancesParams, type ComputeHealthComponentsWithoutBiasParams, type ComputeLiabilityHealthComponentParams, type ComputeLiabilityUsdValueParams, type ComputeLiquidationPriceForBankParams, type ComputeMaxBorrowForBankParams, type ComputeMaxWithdrawForBankParams, type ComputeNetApyParams, type ComputeUsdValueParams, ConfigRaw, type CrankCombination, type CrankabilityResult, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, type DriftBankInput, type DriftMetadata, type DriftStateByBank, type DriftStateJsonByBank, EMPTY_HEALTH_CACHE, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, type Environment, type ExtendedTransaction, type ExtendedTransactionProperties, type ExtendedV0Transaction, FLASHLOAN_ENABLED_FLAG, type FeeStateCache, type FetchBankIntegrationMetadataOptions, type FetchDriftMetadataOptions, type FetchKaminoMetadataOptions, type FlashloanActionResult, type GetAssetWeightParams, type GetBalanceUsdValueWithPriceBiasParams, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, HealthCacheStatus, type HealthCacheType, type HealthCacheTypeDto, type InstructionsWrapper, type IntegrationType, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, type KaminoBankInput, type KaminoMetadata, type KaminoStateByBank, type KaminoStateJsonByBank, type KaminoStates, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowIxParams, type MakeBorrowTxParams, type MakeCloseAccountIxParams, type MakeCloseAccountTxParams, type MakeDepositIxOpts, type MakeDepositIxParams, type MakeDepositTxParams, type MakeDriftDepositIxParams, type MakeDriftDepositTxParams, type MakeDriftWithdrawIxParams, type MakeDriftWithdrawTxParams, type MakeFlashLoanTxParams, type MakeKaminoDepositIxParams, type MakeKaminoDepositTxParams, type MakeKaminoWithdrawIxParams, type MakeKaminoWithdrawTxParams, type MakeLoopTxParams, type MakeRepayIxOpts, type MakeRepayIxParams, type MakeRepayTxParams, type MakeRepayWithCollatTxParams, type MakeSetupIxParams, type MakeSwapCollateralTxParams, type MakeSwapDebtTxParams, type MakeWithdrawIxOpts, type MakeWithdrawIxParams, type MakeWithdrawTxParams, MarginRequirementType, type MarginRequirementTypeRaw, MarginfiAccount, type MarginfiAccountRaw, type MarginfiAccountType, type MarginfiAccountTypeDto, MarginfiAccountWrapper, MarginfiGroup, type MarginfiGroupRaw, type MarginfiGroupType, type MarginfiGroupTypeDto, type MarginfiIdlType, type MarginfiProgram, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, type PanicStateCache, PriceBias, type PriceWithConfidence, type PriceWithConfidenceDto, type Program, Project0Client, type Project0Config, Project0ConfigRaw, type PythOracleServiceOpts, type RatePoint, type RatePointDto, type RatePointRaw, RiskTier, type RiskTierRaw, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, type SimulateAccountHealthCacheWithFallbackParams, type SimulationResultRaw, type SmartCrankParams, type SmartCrankResult, type SolanaTransaction, type StakeAccount, type StakePoolMevMap, type SwbOracleAiDataByKey, type SwbOracleServiceOpts, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, type TransactionBuilderResult, TransactionBuildingError, TransactionBuildingErrorCode, type TransactionBuildingErrorDetails, TransactionConfigMap, TransactionType, type TypedAmount, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, WSOL_MINT, type Wallet, type WithdrawWindowCache, type WrappedI80F48, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getPrice, getPriceWithConfidence, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx, makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx, makeDepositTx, makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx, makeFlashLoanTx, makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makePoolAddBankIx, makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx, makeRefreshKaminoBanksIxs, makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
20493
+ export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, type Amount, type AmountType, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, type BankAddress, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, type BankIntegrationMetadata, type BankIntegrationMetadataDto, type BankIntegrationMetadataMap, type BankIntegrationMetadataMapDto, type BankMap, type BankMetadata, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type ComputeAssetHealthComponentParams, type ComputeAssetUsdValueParams, type ComputeBalanceUsdValueParams, type ComputeFreeCollateralFromBalancesParams, type ComputeHealthCacheStatusParams, type ComputeHealthComponentsFromBalancesParams, type ComputeHealthComponentsWithoutBiasParams, type ComputeLiabilityHealthComponentParams, type ComputeLiabilityUsdValueParams, type ComputeLiquidationPriceForBankParams, type ComputeMaxBorrowForBankParams, type ComputeMaxWithdrawForBankParams, type ComputeNetApyParams, type ComputeUsdValueParams, ConfigRaw, type CrankCombination, type CrankabilityResult, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, type DriftBankInput, type DriftMetadata, type DriftStateByBank, type DriftStateJsonByBank, EMPTY_HEALTH_CACHE, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, type Environment, type ExtendedTransaction, type ExtendedTransactionProperties, type ExtendedV0Transaction, FLASHLOAN_ENABLED_FLAG, type FeeStateCache, type FetchBankIntegrationMetadataOptions, type FetchDriftMetadataOptions, type FetchJupLendMetadataOptions, type FetchKaminoMetadataOptions, type FlashloanActionResult, type GetAssetWeightParams, type GetBalanceUsdValueWithPriceBiasParams, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, HealthCacheStatus, type HealthCacheType, type HealthCacheTypeDto, type InstructionsWrapper, type IntegrationType, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, type JupLendBankInput, type JupLendMetadata, type JupLendStateByBank, type JupLendStateJsonByBank, type KaminoBankInput, type KaminoMetadata, type KaminoStateByBank, type KaminoStateJsonByBank, type KaminoStates, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowIxParams, type MakeBorrowTxParams, type MakeCloseAccountIxParams, type MakeCloseAccountTxParams, type MakeDepositIxOpts, type MakeDepositIxParams, type MakeDepositTxParams, type MakeDriftDepositIxParams, type MakeDriftDepositTxParams, type MakeDriftWithdrawIxParams, type MakeDriftWithdrawTxParams, type MakeFlashLoanTxParams, type MakeJuplendDepositIxParams, type MakeJuplendDepositTxParams, type MakeJuplendWithdrawIxParams, type MakeJuplendWithdrawTxParams, type MakeKaminoDepositIxParams, type MakeKaminoDepositTxParams, type MakeKaminoWithdrawIxParams, type MakeKaminoWithdrawTxParams, type MakeLoopTxParams, type MakeRepayIxOpts, type MakeRepayIxParams, type MakeRepayTxParams, type MakeRepayWithCollatTxParams, type MakeSetupIxParams, type MakeSwapCollateralTxParams, type MakeSwapDebtTxParams, type MakeWithdrawIxOpts, type MakeWithdrawIxParams, type MakeWithdrawTxParams, MarginRequirementType, type MarginRequirementTypeRaw, MarginfiAccount, type MarginfiAccountRaw, type MarginfiAccountType, type MarginfiAccountTypeDto, MarginfiAccountWrapper, MarginfiGroup, type MarginfiGroupRaw, type MarginfiGroupType, type MarginfiGroupTypeDto, type MarginfiIdlType, type MarginfiProgram, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, type OracleSourceKey, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, type PanicStateCache, PriceBias, type PriceWithConfidence, type PriceWithConfidenceDto, type Program, Project0Client, type Project0Config, Project0ConfigRaw, type PythOracleServiceOpts, type RatePoint, type RatePointDto, type RatePointRaw, RiskTier, type RiskTierRaw, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, type SimulateAccountHealthCacheWithFallbackParams, type SimulationResultRaw, type SmartCrankParams, type SmartCrankResult, type SolanaTransaction, type StakeAccount, type StakePoolMevMap, type SwbOracleAiDataByKey, type SwbOracleServiceOpts, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, type TransactionBuilderResult, TransactionBuildingError, TransactionBuildingErrorCode, type TransactionBuildingErrorDetails, TransactionConfigMap, TransactionType, type TypedAmount, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, WSOL_MINT, type Wallet, type WithdrawWindowCache, type WrappedI80F48, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx, makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx, makeDepositTx, makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makePoolAddBankIx, makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx, makeRefreshKaminoBanksIxs, makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };