@0dotxyz/p0-ts-sdk 2.6.2 → 2.7.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.js CHANGED
@@ -678,12 +678,12 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
678
678
  return bundleTipInstruction;
679
679
  }
680
680
 
681
- // src/idl/marginfi_0.1.9.json
682
- var marginfi_0_1_9_default = {
681
+ // src/idl/marginfi_0.1.10.json
682
+ var marginfi_0_1_10_default = {
683
683
  address: "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA",
684
684
  metadata: {
685
685
  name: "marginfi",
686
- version: "0.1.9",
686
+ version: "0.1.10",
687
687
  spec: "0.1.0",
688
688
  description: "Borrow Lending Prime Broker"
689
689
  },
@@ -904,69 +904,6 @@ var marginfi_0_1_9_default = {
904
904
  }
905
905
  ]
906
906
  },
907
- {
908
- name: "copy_fee_state_to_v2",
909
- docs: [
910
- "(permissionless) Copy current FeeState values into FeeStateV2."
911
- ],
912
- discriminator: [
913
- 100,
914
- 146,
915
- 124,
916
- 224,
917
- 95,
918
- 196,
919
- 206,
920
- 14
921
- ],
922
- accounts: [
923
- {
924
- name: "fee_state",
925
- pda: {
926
- seeds: [
927
- {
928
- kind: "const",
929
- value: [
930
- 102,
931
- 101,
932
- 101,
933
- 115,
934
- 116,
935
- 97,
936
- 116,
937
- 101
938
- ]
939
- }
940
- ]
941
- }
942
- },
943
- {
944
- name: "fee_state_v2",
945
- writable: true,
946
- pda: {
947
- seeds: [
948
- {
949
- kind: "const",
950
- value: [
951
- 102,
952
- 101,
953
- 101,
954
- 115,
955
- 116,
956
- 97,
957
- 116,
958
- 101,
959
- 95,
960
- 118,
961
- 50
962
- ]
963
- }
964
- ]
965
- }
966
- }
967
- ],
968
- args: []
969
- },
970
907
  {
971
908
  name: "disable_staked_oracles",
972
909
  docs: [
@@ -2343,6 +2280,12 @@ var marginfi_0_1_9_default = {
2343
2280
  type: {
2344
2281
  option: "pubkey"
2345
2282
  }
2283
+ },
2284
+ {
2285
+ name: "account_transfer_fee",
2286
+ type: {
2287
+ option: "u32"
2288
+ }
2346
2289
  }
2347
2290
  ]
2348
2291
  },
@@ -2532,6 +2475,12 @@ var marginfi_0_1_9_default = {
2532
2475
  "marginfi_account"
2533
2476
  ]
2534
2477
  },
2478
+ {
2479
+ name: "group",
2480
+ relations: [
2481
+ "marginfi_account"
2482
+ ]
2483
+ },
2535
2484
  {
2536
2485
  name: "liquidation_receiver",
2537
2486
  writable: true,
@@ -2570,6 +2519,16 @@ var marginfi_0_1_9_default = {
2570
2519
  {
2571
2520
  name: "system_program",
2572
2521
  address: "11111111111111111111111111111111"
2522
+ },
2523
+ {
2524
+ name: "fee_payer",
2525
+ docs: [
2526
+ "Optional separate payer for the flat liquidation fee. When provided it must sign and pays the",
2527
+ "fee; when omitted, the `liquidation_receiver` pays (the default)."
2528
+ ],
2529
+ writable: true,
2530
+ signer: true,
2531
+ optional: true
2573
2532
  }
2574
2533
  ],
2575
2534
  args: []
@@ -2747,61 +2706,6 @@ var marginfi_0_1_9_default = {
2747
2706
  }
2748
2707
  ]
2749
2708
  },
2750
- {
2751
- name: "init_global_fee_state_v2",
2752
- docs: [
2753
- "(Runs once per program) Initialize the V2 fee state PDA."
2754
- ],
2755
- discriminator: [
2756
- 170,
2757
- 82,
2758
- 207,
2759
- 84,
2760
- 84,
2761
- 17,
2762
- 116,
2763
- 124
2764
- ],
2765
- accounts: [
2766
- {
2767
- name: "payer",
2768
- docs: [
2769
- "Pays the init fee"
2770
- ],
2771
- writable: true,
2772
- signer: true
2773
- },
2774
- {
2775
- name: "fee_state_v2",
2776
- writable: true,
2777
- pda: {
2778
- seeds: [
2779
- {
2780
- kind: "const",
2781
- value: [
2782
- 102,
2783
- 101,
2784
- 101,
2785
- 115,
2786
- 116,
2787
- 97,
2788
- 116,
2789
- 101,
2790
- 95,
2791
- 118,
2792
- 50
2793
- ]
2794
- }
2795
- ]
2796
- }
2797
- },
2798
- {
2799
- name: "system_program",
2800
- address: "11111111111111111111111111111111"
2801
- }
2802
- ],
2803
- args: []
2804
- },
2805
2709
  {
2806
2710
  name: "init_staked_settings",
2807
2711
  docs: [
@@ -4521,6 +4425,12 @@ var marginfi_0_1_9_default = {
4521
4425
  name: "marginfi_account",
4522
4426
  writable: true
4523
4427
  },
4428
+ {
4429
+ name: "group",
4430
+ relations: [
4431
+ "marginfi_account"
4432
+ ]
4433
+ },
4524
4434
  {
4525
4435
  name: "authority",
4526
4436
  signer: true,
@@ -4723,6 +4633,12 @@ var marginfi_0_1_9_default = {
4723
4633
  {
4724
4634
  name: "marginfi_account",
4725
4635
  writable: true
4636
+ },
4637
+ {
4638
+ name: "group",
4639
+ relations: [
4640
+ "marginfi_account"
4641
+ ]
4726
4642
  }
4727
4643
  ],
4728
4644
  args: []
@@ -7334,6 +7250,50 @@ var marginfi_0_1_9_default = {
7334
7250
  ],
7335
7251
  args: []
7336
7252
  },
7253
+ {
7254
+ name: "lending_pool_clear_circuit_breaker",
7255
+ docs: [
7256
+ "(admin or risk_admin) Clear an active circuit-breaker halt on a bank.",
7257
+ "* `reseed_reference` - If true, also zero the EMA reference so the next pulse reseeds it",
7258
+ "from live oracle data (use when clearing because the new price level is valid and the",
7259
+ "pre-halt reference would cause an immediate re-halt)."
7260
+ ],
7261
+ discriminator: [
7262
+ 64,
7263
+ 73,
7264
+ 106,
7265
+ 46,
7266
+ 213,
7267
+ 86,
7268
+ 31,
7269
+ 48
7270
+ ],
7271
+ accounts: [
7272
+ {
7273
+ name: "group",
7274
+ relations: [
7275
+ "bank"
7276
+ ]
7277
+ },
7278
+ {
7279
+ name: "authority",
7280
+ docs: [
7281
+ "Either `group.admin` or `group.risk_admin`. Validated in the handler."
7282
+ ],
7283
+ signer: true
7284
+ },
7285
+ {
7286
+ name: "bank",
7287
+ writable: true
7288
+ }
7289
+ ],
7290
+ args: [
7291
+ {
7292
+ name: "reseed_reference",
7293
+ type: "bool"
7294
+ }
7295
+ ]
7296
+ },
7337
7297
  {
7338
7298
  name: "lending_pool_clone_bank",
7339
7299
  docs: [
@@ -7646,7 +7606,20 @@ var marginfi_0_1_9_default = {
7646
7606
  {
7647
7607
  name: "lending_pool_close_bank",
7648
7608
  docs: [
7649
- "(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares."
7609
+ "(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares.",
7610
+ "",
7611
+ "Pass `force_close = Some(true)` to bypass the CLOSE_ENABLED_FLAG and open-position checks",
7612
+ "(zero-shares/emissions are still required). Forcing a bank closed is **VERY DANGEROUS**.",
7613
+ "Only do it if a Bank was fundamentally broken in some way. The admin **MUST ENSURE** that:",
7614
+ "",
7615
+ "* **NO USER** has a Balance in this bank (zero-shares on the bank is not sufficient to",
7616
+ "guarantee this, a user can have a zero-share Balance, this could brick their account.)",
7617
+ "* fee and insurance vault balances are withdrawn (unless you don't care if they are lost",
7618
+ "**FOREVER**).",
7619
+ "* all three vault token-account balances are zero (or you don't care if anything remaining",
7620
+ "is lost **FOREVER**), including the liquidity vault",
7621
+ "* all three outstanding-fee fields are zero (or you don't care if anything remaining is lost",
7622
+ "**FOREVER**)"
7650
7623
  ],
7651
7624
  discriminator: [
7652
7625
  22,
@@ -7679,7 +7652,14 @@ var marginfi_0_1_9_default = {
7679
7652
  ]
7680
7653
  }
7681
7654
  ],
7682
- args: []
7655
+ args: [
7656
+ {
7657
+ name: "force_close",
7658
+ type: {
7659
+ option: "bool"
7660
+ }
7661
+ }
7662
+ ]
7683
7663
  },
7684
7664
  {
7685
7665
  name: "lending_pool_collect_bank_fees",
@@ -8363,6 +8343,79 @@ var marginfi_0_1_9_default = {
8363
8343
  ],
8364
8344
  args: []
8365
8345
  },
8346
+ {
8347
+ name: "lending_pool_init_same_asset_emode_registry",
8348
+ docs: [
8349
+ "(admin or emode_admin only) Initialize the per-group same-asset e-mode registry."
8350
+ ],
8351
+ discriminator: [
8352
+ 217,
8353
+ 78,
8354
+ 227,
8355
+ 223,
8356
+ 147,
8357
+ 231,
8358
+ 213,
8359
+ 108
8360
+ ],
8361
+ accounts: [
8362
+ {
8363
+ name: "group"
8364
+ },
8365
+ {
8366
+ name: "signer",
8367
+ writable: true,
8368
+ signer: true
8369
+ },
8370
+ {
8371
+ name: "same_asset_emode_registry",
8372
+ writable: true,
8373
+ pda: {
8374
+ seeds: [
8375
+ {
8376
+ kind: "const",
8377
+ value: [
8378
+ 115,
8379
+ 97,
8380
+ 109,
8381
+ 101,
8382
+ 95,
8383
+ 97,
8384
+ 115,
8385
+ 115,
8386
+ 101,
8387
+ 116,
8388
+ 95,
8389
+ 101,
8390
+ 109,
8391
+ 111,
8392
+ 100,
8393
+ 101,
8394
+ 95,
8395
+ 114,
8396
+ 101,
8397
+ 103,
8398
+ 105,
8399
+ 115,
8400
+ 116,
8401
+ 114,
8402
+ 121
8403
+ ]
8404
+ },
8405
+ {
8406
+ kind: "account",
8407
+ path: "group"
8408
+ }
8409
+ ]
8410
+ }
8411
+ },
8412
+ {
8413
+ name: "system_program",
8414
+ address: "11111111111111111111111111111111"
8415
+ }
8416
+ ],
8417
+ args: []
8418
+ },
8366
8419
  {
8367
8420
  name: "lending_pool_pulse_bank_price_cache",
8368
8421
  docs: [
@@ -8392,6 +8445,126 @@ var marginfi_0_1_9_default = {
8392
8445
  ],
8393
8446
  args: []
8394
8447
  },
8448
+ {
8449
+ name: "lending_pool_resize_group_account",
8450
+ docs: [
8451
+ "(permissionless) Resize the group account to the v2 layout size; `payer` funds the",
8452
+ "added rent."
8453
+ ],
8454
+ discriminator: [
8455
+ 97,
8456
+ 221,
8457
+ 69,
8458
+ 96,
8459
+ 204,
8460
+ 162,
8461
+ 174,
8462
+ 250
8463
+ ],
8464
+ accounts: [
8465
+ {
8466
+ name: "group",
8467
+ docs: [
8468
+ "undersized group can still be resized under the future (larger-struct) program."
8469
+ ],
8470
+ writable: true
8471
+ },
8472
+ {
8473
+ name: "payer",
8474
+ docs: [
8475
+ "Funds the rent for the added account space."
8476
+ ],
8477
+ writable: true,
8478
+ signer: true
8479
+ },
8480
+ {
8481
+ name: "system_program",
8482
+ address: "11111111111111111111111111111111"
8483
+ }
8484
+ ],
8485
+ args: []
8486
+ },
8487
+ {
8488
+ name: "lending_pool_set_bank_same_asset_emode_eligibility",
8489
+ docs: [
8490
+ "(admin or emode_admin only) Opt a bank in/out of same-asset e-mode participation."
8491
+ ],
8492
+ discriminator: [
8493
+ 149,
8494
+ 50,
8495
+ 162,
8496
+ 236,
8497
+ 150,
8498
+ 119,
8499
+ 9,
8500
+ 47
8501
+ ],
8502
+ accounts: [
8503
+ {
8504
+ name: "group",
8505
+ relations: [
8506
+ "bank",
8507
+ "same_asset_emode_registry"
8508
+ ]
8509
+ },
8510
+ {
8511
+ name: "signer",
8512
+ signer: true
8513
+ },
8514
+ {
8515
+ name: "bank",
8516
+ writable: true
8517
+ },
8518
+ {
8519
+ name: "same_asset_emode_registry",
8520
+ writable: true,
8521
+ pda: {
8522
+ seeds: [
8523
+ {
8524
+ kind: "const",
8525
+ value: [
8526
+ 115,
8527
+ 97,
8528
+ 109,
8529
+ 101,
8530
+ 95,
8531
+ 97,
8532
+ 115,
8533
+ 115,
8534
+ 101,
8535
+ 116,
8536
+ 95,
8537
+ 101,
8538
+ 109,
8539
+ 111,
8540
+ 100,
8541
+ 101,
8542
+ 95,
8543
+ 114,
8544
+ 101,
8545
+ 103,
8546
+ 105,
8547
+ 115,
8548
+ 116,
8549
+ 114,
8550
+ 121
8551
+ ]
8552
+ },
8553
+ {
8554
+ kind: "account",
8555
+ path: "group"
8556
+ }
8557
+ ]
8558
+ }
8559
+ }
8560
+ ],
8561
+ args: [
8562
+ {
8563
+ name: "enabled",
8564
+ type: "bool"
8565
+ }
8566
+ ]
8567
+ },
8395
8568
  {
8396
8569
  name: "lending_pool_set_fixed_oracle_price",
8397
8570
  docs: [
@@ -9581,6 +9754,8 @@ var marginfi_0_1_9_default = {
9581
9754
  "(admin only) Configure group admin keys and emode leverage caps. All admin keys must be",
9582
9755
  "provided on every call. Emode leverage caps are set if provided, otherwise the existing",
9583
9756
  "(non-zero) values are kept. Pass `Some(value)` to update, `None` to leave unchanged.",
9757
+ "Same-asset emode leverage is disabled by configuring both init and maint leverage to `1`;",
9758
+ "values below `1`, including `0`, are invalid.",
9584
9759
  "",
9585
9760
  "Note: `new_emissions_admin` is deprecated and currently has no on-chain effect."
9586
9761
  ],
@@ -9675,6 +9850,26 @@ var marginfi_0_1_9_default = {
9675
9850
  }
9676
9851
  }
9677
9852
  }
9853
+ },
9854
+ {
9855
+ name: "same_asset_emode_init_leverage",
9856
+ type: {
9857
+ option: {
9858
+ defined: {
9859
+ name: "WrappedI80F48"
9860
+ }
9861
+ }
9862
+ }
9863
+ },
9864
+ {
9865
+ name: "same_asset_emode_maint_leverage",
9866
+ type: {
9867
+ option: {
9868
+ defined: {
9869
+ name: "WrappedI80F48"
9870
+ }
9871
+ }
9872
+ }
9678
9873
  }
9679
9874
  ]
9680
9875
  },
@@ -9954,10 +10149,11 @@ var marginfi_0_1_9_default = {
9954
10149
  {
9955
10150
  name: "purge_deleverage_balance",
9956
10151
  docs: [
9957
- "(risk admin only) Purge a user's lending balance without withdrawing anything. Only usable",
9958
- "after all the debt has been settled on a bank in deleveraging mode, e.g. when",
9959
- "`TOKENLESS_REPAYMENTS_ALLOWED` and `TOKENLESS_REPAYMENTS_COMPLETE`. used to purge remaining",
9960
- "lending assets in a now-worthless bank before it is fully sunset."
10152
+ "(risk admin only) Purge a user's lending balance on a bank being sunset, without paying the",
10153
+ "user anything. Only usable after all the debt has been settled on a bank in deleveraging",
10154
+ "mode, i.e. `TOKENLESS_REPAYMENTS_ALLOWED` and `TOKENLESS_REPAYMENTS_COMPLETE`. Used to clear",
10155
+ "abandoned lending positions in a now-worthless bank so it can be closed via",
10156
+ "`lending_pool_close_bank`."
9961
10157
  ],
9962
10158
  discriminator: [
9963
10159
  132,
@@ -9995,6 +10191,63 @@ var marginfi_0_1_9_default = {
9995
10191
  ],
9996
10192
  args: []
9997
10193
  },
10194
+ {
10195
+ name: "resize_global_fee_state",
10196
+ docs: [
10197
+ "(permissionless) Resize the fee-state account to the v2 layout size; `payer` funds the",
10198
+ "added rent."
10199
+ ],
10200
+ discriminator: [
10201
+ 141,
10202
+ 111,
10203
+ 97,
10204
+ 79,
10205
+ 111,
10206
+ 143,
10207
+ 77,
10208
+ 159
10209
+ ],
10210
+ accounts: [
10211
+ {
10212
+ name: "fee_state",
10213
+ docs: [
10214
+ "Not an AccountLoader so an undersized fee state can still be resized under the future",
10215
+ "(larger-struct) program."
10216
+ ],
10217
+ writable: true,
10218
+ pda: {
10219
+ seeds: [
10220
+ {
10221
+ kind: "const",
10222
+ value: [
10223
+ 102,
10224
+ 101,
10225
+ 101,
10226
+ 115,
10227
+ 116,
10228
+ 97,
10229
+ 116,
10230
+ 101
10231
+ ]
10232
+ }
10233
+ ]
10234
+ }
10235
+ },
10236
+ {
10237
+ name: "payer",
10238
+ docs: [
10239
+ "Funds the rent for the added account space."
10240
+ ],
10241
+ writable: true,
10242
+ signer: true
10243
+ },
10244
+ {
10245
+ name: "system_program",
10246
+ address: "11111111111111111111111111111111"
10247
+ }
10248
+ ],
10249
+ args: []
10250
+ },
9998
10251
  {
9999
10252
  name: "solend_deposit",
10000
10253
  docs: [
@@ -10658,6 +10911,12 @@ var marginfi_0_1_9_default = {
10658
10911
  "marginfi_account"
10659
10912
  ]
10660
10913
  },
10914
+ {
10915
+ name: "group",
10916
+ relations: [
10917
+ "marginfi_account"
10918
+ ]
10919
+ },
10661
10920
  {
10662
10921
  name: "liquidation_receiver",
10663
10922
  docs: [
@@ -10894,6 +11153,26 @@ var marginfi_0_1_9_default = {
10894
11153
  name: "global_fee_wallet",
10895
11154
  writable: true
10896
11155
  },
11156
+ {
11157
+ name: "fee_state",
11158
+ pda: {
11159
+ seeds: [
11160
+ {
11161
+ kind: "const",
11162
+ value: [
11163
+ 102,
11164
+ 101,
11165
+ 101,
11166
+ 115,
11167
+ 116,
11168
+ 97,
11169
+ 116,
11170
+ 101
11171
+ ]
11172
+ }
11173
+ ]
11174
+ }
11175
+ },
10897
11176
  {
10898
11177
  name: "system_program",
10899
11178
  address: "11111111111111111111111111111111"
@@ -10995,6 +11274,26 @@ var marginfi_0_1_9_default = {
10995
11274
  name: "global_fee_wallet",
10996
11275
  writable: true
10997
11276
  },
11277
+ {
11278
+ name: "fee_state",
11279
+ pda: {
11280
+ seeds: [
11281
+ {
11282
+ kind: "const",
11283
+ value: [
11284
+ 102,
11285
+ 101,
11286
+ 101,
11287
+ 115,
11288
+ 116,
11289
+ 97,
11290
+ 116,
11291
+ 101
11292
+ ]
11293
+ }
11294
+ ]
11295
+ }
11296
+ },
10998
11297
  {
10999
11298
  name: "instructions_sysvar",
11000
11299
  docs: [
@@ -11319,19 +11618,6 @@ var marginfi_0_1_9_default = {
11319
11618
  220
11320
11619
  ]
11321
11620
  },
11322
- {
11323
- name: "FeeStateV2",
11324
- discriminator: [
11325
- 240,
11326
- 43,
11327
- 104,
11328
- 108,
11329
- 146,
11330
- 39,
11331
- 22,
11332
- 38
11333
- ]
11334
- },
11335
11621
  {
11336
11622
  name: "LiquidationRecord",
11337
11623
  discriminator: [
@@ -11384,6 +11670,19 @@ var marginfi_0_1_9_default = {
11384
11670
  51
11385
11671
  ]
11386
11672
  },
11673
+ {
11674
+ name: "SameAssetEmodeRegistry",
11675
+ discriminator: [
11676
+ 222,
11677
+ 21,
11678
+ 195,
11679
+ 149,
11680
+ 193,
11681
+ 72,
11682
+ 219,
11683
+ 31
11684
+ ]
11685
+ },
11387
11686
  {
11388
11687
  name: "StakedSettings",
11389
11688
  discriminator: [
@@ -11412,6 +11711,45 @@ var marginfi_0_1_9_default = {
11412
11711
  73
11413
11712
  ]
11414
11713
  },
11714
+ {
11715
+ name: "CircuitBreakerAutoBrokenEvent",
11716
+ discriminator: [
11717
+ 104,
11718
+ 30,
11719
+ 251,
11720
+ 194,
11721
+ 213,
11722
+ 139,
11723
+ 21,
11724
+ 230
11725
+ ]
11726
+ },
11727
+ {
11728
+ name: "CircuitBreakerClearedEvent",
11729
+ discriminator: [
11730
+ 97,
11731
+ 244,
11732
+ 85,
11733
+ 48,
11734
+ 246,
11735
+ 155,
11736
+ 29,
11737
+ 219
11738
+ ]
11739
+ },
11740
+ {
11741
+ name: "CircuitBreakerTrippedEvent",
11742
+ discriminator: [
11743
+ 112,
11744
+ 68,
11745
+ 182,
11746
+ 85,
11747
+ 54,
11748
+ 184,
11749
+ 4,
11750
+ 134
11751
+ ]
11752
+ },
11415
11753
  {
11416
11754
  name: "DeleverageEvent",
11417
11755
  discriminator: [
@@ -11659,6 +11997,19 @@ var marginfi_0_1_9_default = {
11659
11997
  26
11660
11998
  ]
11661
11999
  },
12000
+ {
12001
+ name: "LendingPoolBankSetSameAssetEmodeEligibilityEvent",
12002
+ discriminator: [
12003
+ 186,
12004
+ 247,
12005
+ 119,
12006
+ 107,
12007
+ 251,
12008
+ 215,
12009
+ 15,
12010
+ 79
12011
+ ]
12012
+ },
11662
12013
  {
11663
12014
  name: "LendingPoolSuperAdminDepositEvent",
11664
12015
  discriminator: [
@@ -12856,6 +13207,36 @@ var marginfi_0_1_9_default = {
12856
13207
  code: 6512,
12857
13208
  name: "InvalidJuplendWithdrawIntermediaryAta",
12858
13209
  msg: "Invalid Juplend withdraw intermediary ATA"
13210
+ },
13211
+ {
13212
+ code: 6513,
13213
+ name: "InvalidResize",
13214
+ msg: "Account is already at (or above) the target size"
13215
+ },
13216
+ {
13217
+ code: 6600,
13218
+ name: "BankCircuitBreakerHalted",
13219
+ msg: "Bank is halted by oracle circuit breaker"
13220
+ },
13221
+ {
13222
+ code: 6601,
13223
+ name: "CircuitBreakerAdminOnly",
13224
+ msg: "Action requires risk admin while bank is circuit-breaker halted"
13225
+ },
13226
+ {
13227
+ code: 6602,
13228
+ name: "CircuitBreakerInvalidConfig",
13229
+ msg: "Invalid circuit breaker config"
13230
+ },
13231
+ {
13232
+ code: 6603,
13233
+ name: "CircuitBreakerRequiresWarmCache",
13234
+ msg: "Circuit breaker cannot be enabled until the oracle price cache is warm (call pulse first)"
13235
+ },
13236
+ {
13237
+ code: 6604,
13238
+ name: "CircuitBreakerPriceJump",
13239
+ msg: "Oracle price deviates too far from the circuit breaker reference; action rejected"
12859
13240
  }
12860
13241
  ],
12861
13242
  types: [
@@ -13242,7 +13623,9 @@ var marginfi_0_1_9_default = {
13242
13623
  "keypair-based bank.",
13243
13624
  "- Bit 9 (512): `STAKED_ORACLE_DISABLED` \u2014 staked oracle pricing is temporarily disabled.",
13244
13625
  "- Bit 10 (1024): `STAKED_ORACLE_PRICE_USES_ONRAMP` \u2014 staked oracle pricing includes the SPL",
13245
- "single-pool on-ramp account in NAV."
13626
+ "single-pool on-ramp account in NAV.",
13627
+ "- Bit 11 (2048): `CIRCUIT_BREAKER_ENABLED` \u2014 oracle deviation breaker active on this bank",
13628
+ "- Bit 12 (4096): `BANK_SAME_ASSET_EMODE_ELIGIBLE` \u2014 bank may participate in same-asset e-mode."
13246
13629
  ],
13247
13630
  type: "u64"
13248
13631
  },
@@ -13337,6 +13720,24 @@ var marginfi_0_1_9_default = {
13337
13720
  ],
13338
13721
  type: "i32"
13339
13722
  },
13723
+ {
13724
+ name: "liquidation_liquidator_fee",
13725
+ docs: [
13726
+ "Fee the liquidator earns when liquidating against this bank's liability. Decode with",
13727
+ "`u32_to_centi` (`u32::MAX` = 100%).",
13728
+ "* 0 falls back to the default (`DEFAULT_LIQUIDATION_FEE` = 2.5%)."
13729
+ ],
13730
+ type: "u32"
13731
+ },
13732
+ {
13733
+ name: "liquidation_insurance_fee",
13734
+ docs: [
13735
+ "Fee routed to this bank's insurance fund on a liquidation against its liability. Decode",
13736
+ "with `u32_to_centi` (`u32::MAX` = 100%).",
13737
+ "* 0 falls back to the default (`DEFAULT_LIQUIDATION_FEE` = 2.5%)."
13738
+ ],
13739
+ type: "u32"
13740
+ },
13340
13741
  {
13341
13742
  name: "_padding_0",
13342
13743
  docs: [
@@ -13345,7 +13746,7 @@ var marginfi_0_1_9_default = {
13345
13746
  type: {
13346
13747
  array: [
13347
13748
  "u8",
13348
- 16
13749
+ 8
13349
13750
  ]
13350
13751
  }
13351
13752
  },
@@ -13412,12 +13813,116 @@ var marginfi_0_1_9_default = {
13412
13813
  ],
13413
13814
  type: "u64"
13414
13815
  },
13816
+ {
13817
+ name: "cb_halt_started_at",
13818
+ docs: [
13819
+ "Unix-seconds when the current halt started, zero if not halted."
13820
+ ],
13821
+ type: "i64"
13822
+ },
13823
+ {
13824
+ name: "cb_halt_ended_at",
13825
+ docs: [
13826
+ "Unix-seconds when the current halt's tier duration ends. Tier stays sticky past this for",
13827
+ "the escalation window; a fresh breach within the window ratchets to the next tier."
13828
+ ],
13829
+ type: "i64"
13830
+ },
13831
+ {
13832
+ name: "cb_tier",
13833
+ docs: [
13834
+ "0 = operational, 1..=3 = escalating halt severity."
13835
+ ],
13836
+ type: "u8"
13837
+ },
13838
+ {
13839
+ name: "cb_tier3_consecutive_trips",
13840
+ docs: [
13841
+ "Consecutive tier-3 trips with no clean escalation-window between them. Hitting",
13842
+ "`CB_MAX_TIER3_BEFORE_CIRCUIT_BREAK` forces the bank to `CircuitBroken`."
13843
+ ],
13844
+ type: "u8"
13845
+ },
13846
+ {
13847
+ name: "cb_pre_break_state",
13848
+ docs: [
13849
+ "`BankOperationalState` (as `u8`) the bank held before the breaker forced it to",
13850
+ "`CircuitBroken`. Restored by `clear_circuit_breaker`. Meaningless unless",
13851
+ "`operational_state == CircuitBroken`."
13852
+ ],
13853
+ type: "u8"
13854
+ },
13855
+ {
13856
+ name: "_cb_pad",
13857
+ type: {
13858
+ array: [
13859
+ "u8",
13860
+ 5
13861
+ ]
13862
+ }
13863
+ },
13864
+ {
13865
+ name: "cb_last_observed_slot",
13866
+ docs: [
13867
+ "Solana slot of the last counted CB observation; used for slot-level dedup."
13868
+ ],
13869
+ type: "u64"
13870
+ },
13871
+ {
13872
+ name: "cb_last_oracle_source_time",
13873
+ docs: [
13874
+ "Publisher-side timestamp of the last counted CB observation; rejects re-reads of the same",
13875
+ "publication across multiple Solana slots. Zero when the adapter doesn't expose one."
13876
+ ],
13877
+ type: "i64"
13878
+ },
13879
+ {
13880
+ name: "cb_reference_price",
13881
+ docs: [
13882
+ "EMA reference price used by the circuit breaker, in the multiplier-adjusted effective-price",
13883
+ "domain the risk engine uses. Frozen while halted, zero until the first observation after",
13884
+ "enable."
13885
+ ],
13886
+ type: {
13887
+ defined: {
13888
+ name: "WrappedI80F48"
13889
+ }
13890
+ }
13891
+ },
13892
+ {
13893
+ name: "cb_window_reference_price",
13894
+ docs: [
13895
+ "Long-window reference price (same multiplier-adjusted domain as `cb_reference_price`) used",
13896
+ "to catch slow oracle walking that stays below the per-observation breaker threshold."
13897
+ ],
13898
+ type: {
13899
+ defined: {
13900
+ name: "WrappedI80F48"
13901
+ }
13902
+ }
13903
+ },
13904
+ {
13905
+ name: "cb_window_started_at",
13906
+ docs: [
13907
+ "Unix-seconds when `cb_window_reference_price` was anchored."
13908
+ ],
13909
+ type: "i64"
13910
+ },
13911
+ {
13912
+ name: "cb_frozen_seconds_pending",
13913
+ docs: [
13914
+ "Frozen halt seconds from halt intervals overwritten or cleared before `accrue_interest`",
13915
+ "consumed them. Non-zero only when the halt record changes without a preceding accrual, i.e.",
13916
+ "a paused pulse; the next accrual excludes these on top of the current halt. Zero normally."
13917
+ ],
13918
+ type: "u64"
13919
+ },
13415
13920
  {
13416
13921
  name: "_padding_1",
13417
13922
  type: {
13418
13923
  array: [
13419
13924
  "u64",
13420
- 13
13925
+ 2
13421
13926
  ]
13422
13927
  }
13423
13928
  }
@@ -13513,7 +14018,8 @@ var marginfi_0_1_9_default = {
13513
14018
  "Confidence interval reported by the oracle when last_oracle_price was fetched",
13514
14019
  "* Always non-negative",
13515
14020
  "* Zero if never updated",
13516
- "* Note: this value is the confidence reported by oracles, multiplied by `STD_DEV_MULTIPLE`"
14021
+ "* Pyth: confidence * 2.12",
14022
+ "* Switchboard: price * oracle_max_confidence / U32_MAX"
13517
14023
  ],
13518
14024
  type: {
13519
14025
  defined: {
@@ -13537,7 +14043,7 @@ var marginfi_0_1_9_default = {
13537
14043
  type: "u8"
13538
14044
  },
13539
14045
  {
13540
- name: "_pad0",
14046
+ name: "_cb_cache_pad",
13541
14047
  type: {
13542
14048
  array: [
13543
14049
  "u8",
@@ -13714,12 +14220,26 @@ var marginfi_0_1_9_default = {
13714
14220
  ]
13715
14221
  }
13716
14222
  },
14223
+ {
14224
+ name: "cb_window_max_up_bps",
14225
+ docs: [
14226
+ "CB long-window upward move cap in bps; `0` uses the `CB_WINDOW_MAX_UP_BPS` default."
14227
+ ],
14228
+ type: "u16"
14229
+ },
14230
+ {
14231
+ name: "cb_window_max_down_bps",
14232
+ docs: [
14233
+ "CB long-window downward move cap in bps; `0` uses the `CB_WINDOW_MAX_DOWN_BPS` default."
14234
+ ],
14235
+ type: "u16"
14236
+ },
13717
14237
  {
13718
14238
  name: "_pad0",
13719
14239
  type: {
13720
14240
  array: [
13721
14241
  "u8",
13722
- 6
14242
+ 2
13723
14243
  ]
13724
14244
  }
13725
14245
  },
@@ -13773,10 +14293,17 @@ var marginfi_0_1_9_default = {
13773
14293
  type: {
13774
14294
  array: [
13775
14295
  "u8",
13776
- 5
14296
+ 1
13777
14297
  ]
13778
14298
  }
13779
14299
  },
14300
+ {
14301
+ name: "cb_window_seconds",
14302
+ docs: [
14303
+ "CB long-window length in seconds; `0` uses the `CB_WINDOW_SECONDS` default."
14304
+ ],
14305
+ type: "u32"
14306
+ },
13780
14307
  {
13781
14308
  name: "total_asset_value_init_limit",
13782
14309
  docs: [
@@ -13810,10 +14337,15 @@ var marginfi_0_1_9_default = {
13810
14337
  {
13811
14338
  name: "oracle_max_confidence",
13812
14339
  docs: [
13813
- "From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note:",
13814
- "the confidence adjustment is capped at 5% regardless of this value.",
13815
- "* 0 falls back to using the default 10% instead, i.e., U32_MAX_DIV_10",
13816
- "* A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc."
14340
+ "A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.",
14341
+ "",
14342
+ "Oracle confidence configuration. Semantics depend on the oracle type:",
14343
+ "* Pyth: Maximum allowed confidence interval. Prices exceeding this threshold are rejected.",
14344
+ "- 0 defaults to 10%.",
14345
+ "* Switchboard: Confidence spread used for price biasing.",
14346
+ "- 0 disables confidence adjustment.",
14347
+ "- Non-zero: confidence = price * oracle_max_confidence / U32_MAX.",
14348
+ "- Clamped to MAX_CONF_INTERVAL (5% of price)."
13817
14349
  ],
13818
14350
  type: "u32"
13819
14351
  },
@@ -13829,13 +14361,47 @@ var marginfi_0_1_9_default = {
13829
14361
  }
13830
14362
  },
13831
14363
  {
13832
- name: "_padding1",
14364
+ name: "cb_deviation_bps_tiers",
14365
+ docs: [
14366
+ "Deviation thresholds in basis points for tiers 1/2/3, strictly monotonic."
14367
+ ],
13833
14368
  type: {
13834
14369
  array: [
13835
- "u8",
13836
- 16
14370
+ "u16",
14371
+ 3
14372
+ ]
14373
+ }
14374
+ },
14375
+ {
14376
+ name: "cb_tier_durations_seconds",
14377
+ docs: [
14378
+ "Halt durations in seconds for tiers 1/2/3, strictly monotonic."
14379
+ ],
14380
+ type: {
14381
+ array: [
14382
+ "u16",
14383
+ 3
13837
14384
  ]
13838
14385
  }
14386
+ },
14387
+ {
14388
+ name: "cb_escalation_window_mult",
14389
+ docs: [
14390
+ "Escalation window multiplier: a re-breach within `prev_tier_duration * mult` seconds",
14391
+ "after a halt ends ratchets to the next tier."
14392
+ ],
14393
+ type: "u8"
14394
+ },
14395
+ {
14396
+ name: "_cb_config_pad",
14397
+ type: "u8"
14398
+ },
14399
+ {
14400
+ name: "cb_ema_alpha_bps",
14401
+ docs: [
14402
+ "EMA smoothing factor for the reference price, in basis points (e.g. 1000 = \u03B1=0.1)."
14403
+ ],
14404
+ type: "u16"
13839
14405
  }
13840
14406
  ]
13841
14407
  }
@@ -13971,10 +14537,15 @@ var marginfi_0_1_9_default = {
13971
14537
  {
13972
14538
  name: "oracle_max_confidence",
13973
14539
  docs: [
13974
- "From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note:",
13975
- "the confidence adjustment is capped at 5% regardless of this value.",
13976
- "* 0% = use the default (10%)",
13977
- "* A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc."
14540
+ "A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.",
14541
+ "",
14542
+ "Oracle confidence configuration. Semantics depend on the oracle type.",
14543
+ "* Pyth: Maximum allowed confidence interval. Prices exceeding this threshold are rejected.",
14544
+ "- 0 defaults to 10%.",
14545
+ "* Switchboard: Confidence spread used for price biasing.",
14546
+ "- 0 disables confidence adjustment.",
14547
+ "- Non-zero: confidence = price * oracle_max_confidence / U32_MAX.",
14548
+ "- Clamped to MAX_CONF_INTERVAL (5% of price)."
13978
14549
  ],
13979
14550
  type: "u32"
13980
14551
  }
@@ -14109,6 +14680,79 @@ var marginfi_0_1_9_default = {
14109
14680
  type: {
14110
14681
  option: "bool"
14111
14682
  }
14683
+ },
14684
+ {
14685
+ name: "liquidation_liquidator_fee",
14686
+ docs: [
14687
+ "Per-bank liquidation fees, encoded as `u32_to_centi` (`u32::MAX` = 100%; 0 => default 2.5%)."
14688
+ ],
14689
+ type: {
14690
+ option: "u32"
14691
+ }
14692
+ },
14693
+ {
14694
+ name: "liquidation_insurance_fee",
14695
+ type: {
14696
+ option: "u32"
14697
+ }
14698
+ },
14699
+ {
14700
+ name: "circuit_breaker_enabled",
14701
+ type: {
14702
+ option: "bool"
14703
+ }
14704
+ },
14705
+ {
14706
+ name: "cb_deviation_bps_tiers",
14707
+ type: {
14708
+ option: {
14709
+ array: [
14710
+ "u16",
14711
+ 3
14712
+ ]
14713
+ }
14714
+ }
14715
+ },
14716
+ {
14717
+ name: "cb_tier_durations_seconds",
14718
+ type: {
14719
+ option: {
14720
+ array: [
14721
+ "u16",
14722
+ 3
14723
+ ]
14724
+ }
14725
+ }
14726
+ },
14727
+ {
14728
+ name: "cb_escalation_window_mult",
14729
+ type: {
14730
+ option: "u8"
14731
+ }
14732
+ },
14733
+ {
14734
+ name: "cb_ema_alpha_bps",
14735
+ type: {
14736
+ option: "u16"
14737
+ }
14738
+ },
14739
+ {
14740
+ name: "cb_window_seconds",
14741
+ type: {
14742
+ option: "u32"
14743
+ }
14744
+ },
14745
+ {
14746
+ name: "cb_window_max_up_bps",
14747
+ type: {
14748
+ option: "u16"
14749
+ }
14750
+ },
14751
+ {
14752
+ name: "cb_window_max_down_bps",
14753
+ type: {
14754
+ option: "u16"
14755
+ }
14112
14756
  }
14113
14757
  ]
14114
14758
  }
@@ -14233,6 +14877,9 @@ var marginfi_0_1_9_default = {
14233
14877
  },
14234
14878
  {
14235
14879
  name: "ReduceOnlyWithBorrowingPower"
14880
+ },
14881
+ {
14882
+ name: "CircuitBroken"
14236
14883
  }
14237
14884
  ]
14238
14885
  }
@@ -14274,6 +14921,78 @@ var marginfi_0_1_9_default = {
14274
14921
  ]
14275
14922
  }
14276
14923
  },
14924
+ {
14925
+ name: "CircuitBreakerAutoBrokenEvent",
14926
+ docs: [
14927
+ "Emitted when consecutive tier-3 trips force a bank into `CircuitBroken`."
14928
+ ],
14929
+ type: {
14930
+ kind: "struct",
14931
+ fields: [
14932
+ {
14933
+ name: "consecutive_tier3_trips",
14934
+ type: "u8"
14935
+ },
14936
+ {
14937
+ name: "current_timestamp",
14938
+ type: "i64"
14939
+ }
14940
+ ]
14941
+ }
14942
+ },
14943
+ {
14944
+ name: "CircuitBreakerClearedEvent",
14945
+ docs: [
14946
+ "Emitted when a halt is cleared (admin override or escalation-window expiry)."
14947
+ ],
14948
+ type: {
14949
+ kind: "struct",
14950
+ fields: [
14951
+ {
14952
+ name: "prior_tier",
14953
+ type: "u8"
14954
+ },
14955
+ {
14956
+ name: "reason",
14957
+ docs: [
14958
+ "One of the `CB_CLEAR_REASON_*` constants."
14959
+ ],
14960
+ type: "u8"
14961
+ },
14962
+ {
14963
+ name: "current_timestamp",
14964
+ type: "i64"
14965
+ }
14966
+ ]
14967
+ }
14968
+ },
14969
+ {
14970
+ name: "CircuitBreakerTrippedEvent",
14971
+ docs: [
14972
+ "Emitted when the per-bank oracle circuit breaker trips or escalates a halt."
14973
+ ],
14974
+ type: {
14975
+ kind: "struct",
14976
+ fields: [
14977
+ {
14978
+ name: "tier",
14979
+ type: "u8"
14980
+ },
14981
+ {
14982
+ name: "deviation_bps",
14983
+ type: "u64"
14984
+ },
14985
+ {
14986
+ name: "halt_started_at",
14987
+ type: "i64"
14988
+ },
14989
+ {
14990
+ name: "halt_ended_at",
14991
+ type: "i64"
14992
+ }
14993
+ ]
14994
+ }
14995
+ },
14277
14996
  {
14278
14997
  name: "DeleverageEvent",
14279
14998
  type: {
@@ -14393,7 +15112,7 @@ var marginfi_0_1_9_default = {
14393
15112
  name: "DriftConfigCompact",
14394
15113
  docs: [
14395
15114
  "Used to configure Drift banks. A simplified version of `BankConfigCompact` which omits most",
14396
- "values related to interest since Drift banks cannot earn interest or be borrowed against."
15115
+ "values related to interest since Drift banks cannot earn interest or be borrowed from."
14397
15116
  ],
14398
15117
  type: {
14399
15118
  kind: "struct",
@@ -14785,210 +15504,24 @@ var marginfi_0_1_9_default = {
14785
15504
  type: "pubkey"
14786
15505
  },
14787
15506
  {
14788
- name: "placeholder0",
14789
- type: "u64"
14790
- },
14791
- {
14792
- name: "bank_init_flat_sol_fee",
15507
+ name: "account_transfer_fee",
14793
15508
  docs: [
14794
- "Flat fee assessed when a new bank is initialized, in lamports.",
14795
- "* In SOL, in native decimals."
15509
+ "Flat fee in lamports paid to the global fee wallet when initiating an account transfer",
15510
+ '(anti-spam; 5,000,000 lamports ~= $0.50). A stored 0 means "use the default"',
15511
+ "(`DEFAULT_ACCOUNT_TRANSFER_FEE_LAMPORTS`), which preserves the legacy fee for FeeStates",
15512
+ "created before this field existed."
14796
15513
  ],
14797
15514
  type: "u32"
14798
15515
  },
14799
15516
  {
14800
- name: "bump_seed",
14801
- type: "u8"
14802
- },
14803
- {
14804
- name: "_padding0",
15517
+ name: "_placeholder0",
14805
15518
  type: {
14806
15519
  array: [
14807
15520
  "u8",
14808
- 3
15521
+ 4
14809
15522
  ]
14810
15523
  }
14811
15524
  },
14812
- {
14813
- name: "liquidation_max_fee",
14814
- docs: [
14815
- "Liquidators can claim at this premium, when liquidating an asset in receivership",
14816
- "liquidation, e.g. (1 + this) * amount repaid >= asset seized",
14817
- "* A percentage"
14818
- ],
14819
- type: {
14820
- defined: {
14821
- name: "WrappedI80F48"
14822
- }
14823
- }
14824
- },
14825
- {
14826
- name: "program_fee_fixed",
14827
- docs: [
14828
- "Fee collected by the program owner from all groups",
14829
- "* A percentage"
14830
- ],
14831
- type: {
14832
- defined: {
14833
- name: "WrappedI80F48"
14834
- }
14835
- }
14836
- },
14837
- {
14838
- name: "program_fee_rate",
14839
- docs: [
14840
- "Fee collected by the program owner from all groups",
14841
- "* A percentage"
14842
- ],
14843
- type: {
14844
- defined: {
14845
- name: "WrappedI80F48"
14846
- }
14847
- }
14848
- },
14849
- {
14850
- name: "panic_state",
14851
- docs: [
14852
- "When the global admin pauses the protocol in the event of an emergency, information about",
14853
- "the pause duration will be stored here and propagated to groups."
14854
- ],
14855
- type: {
14856
- defined: {
14857
- name: "PanicState"
14858
- }
14859
- }
14860
- },
14861
- {
14862
- name: "placeholder1",
14863
- type: "u64"
14864
- },
14865
- {
14866
- name: "liquidation_flat_sol_fee",
14867
- docs: [
14868
- "Flat fee assessed for insurance/program use when a liquidation is executed",
14869
- "* In SOL, in native decimals."
14870
- ],
14871
- type: "u32"
14872
- },
14873
- {
14874
- name: "order_init_flat_sol_fee",
14875
- docs: [
14876
- "Flat fee assessed for preventing spam use when creating an order",
14877
- "* In SOL, in native decimals."
14878
- ],
14879
- type: "u32"
14880
- },
14881
- {
14882
- name: "order_execution_max_fee",
14883
- docs: [
14884
- "Take-profit Orders can be executed at this premium, which Keepers are allowed to keep (no",
14885
- "pun intended) e.g. (1 + this) * amount repaid >= asset seized",
14886
- "* A percentage"
14887
- ],
14888
- type: {
14889
- defined: {
14890
- name: "WrappedI80F48"
14891
- }
14892
- }
14893
- },
14894
- {
14895
- name: "pause_delegate_admin",
14896
- docs: [
14897
- "Can pause (not unpause) the protocol, but cannot modify any fee configuration."
14898
- ],
14899
- type: "pubkey"
14900
- }
14901
- ]
14902
- }
14903
- },
14904
- {
14905
- name: "FeeStateCache",
14906
- docs: [
14907
- "Cached fee configuration propagated from the global FeeState"
14908
- ],
14909
- repr: {
14910
- kind: "c"
14911
- },
14912
- type: {
14913
- kind: "struct",
14914
- fields: [
14915
- {
14916
- name: "global_fee_wallet",
14917
- docs: [
14918
- "The wallet that receives program-level fees"
14919
- ],
14920
- type: "pubkey"
14921
- },
14922
- {
14923
- name: "program_fee_fixed",
14924
- docs: [
14925
- "Fixed fee APR charged to borrowers (program-level)"
14926
- ],
14927
- type: {
14928
- defined: {
14929
- name: "WrappedI80F48"
14930
- }
14931
- }
14932
- },
14933
- {
14934
- name: "program_fee_rate",
14935
- docs: [
14936
- "Proportional fee rate on interest (program-level)"
14937
- ],
14938
- type: {
14939
- defined: {
14940
- name: "WrappedI80F48"
14941
- }
14942
- }
14943
- },
14944
- {
14945
- name: "last_update",
14946
- docs: [
14947
- "Unix timestamp of the last fee state propagation"
14948
- ],
14949
- type: "i64"
14950
- }
14951
- ]
14952
- }
14953
- },
14954
- {
14955
- name: "FeeStateV2",
14956
- docs: [
14957
- "V2 fee state, currently unused by protocol logic. Mirrors `FeeState` with additional padding."
14958
- ],
14959
- serialization: "bytemuck",
14960
- repr: {
14961
- kind: "c"
14962
- },
14963
- type: {
14964
- kind: "struct",
14965
- fields: [
14966
- {
14967
- name: "key",
14968
- docs: [
14969
- 'The fee state\'s own key. A PDA derived from `b"feestate_v2"`'
14970
- ],
14971
- type: "pubkey"
14972
- },
14973
- {
14974
- name: "global_fee_admin",
14975
- docs: [
14976
- "Can modify fees, pause the protocol, etc"
14977
- ],
14978
- type: "pubkey"
14979
- },
14980
- {
14981
- name: "global_fee_wallet",
14982
- docs: [
14983
- "The base wallet for all protocol fees. All SOL fees go to this wallet. All non-SOL fees go",
14984
- "to the cannonical ATA of this wallet for that asset."
14985
- ],
14986
- type: "pubkey"
14987
- },
14988
- {
14989
- name: "placeholder0",
14990
- type: "u64"
14991
- },
14992
15525
  {
14993
15526
  name: "bank_init_flat_sol_fee",
14994
15527
  docs: [
@@ -15100,20 +15633,73 @@ var marginfi_0_1_9_default = {
15100
15633
  type: "pubkey"
15101
15634
  },
15102
15635
  {
15103
- name: "_padding1",
15636
+ name: "_reserved0",
15104
15637
  docs: [
15105
- "Extra reserved bytes for future expansions."
15638
+ "Reserved for future use (e.g. the variable-borrow premium settings). Accounts created",
15639
+ "before the struct grew to this size are v1-sized (`8 + V1_LEN` bytes) and must be",
15640
+ "grown via `resize_global_fee_state` before this program version can load them; the new",
15641
+ "bytes are zero-filled."
15106
15642
  ],
15107
15643
  type: {
15108
15644
  array: [
15109
- "u8",
15110
- 256
15645
+ "u64",
15646
+ 32
15111
15647
  ]
15112
15648
  }
15113
15649
  }
15114
15650
  ]
15115
15651
  }
15116
15652
  },
15653
+ {
15654
+ name: "FeeStateCache",
15655
+ docs: [
15656
+ "Cached fee configuration propagated from the global FeeState"
15657
+ ],
15658
+ repr: {
15659
+ kind: "c"
15660
+ },
15661
+ type: {
15662
+ kind: "struct",
15663
+ fields: [
15664
+ {
15665
+ name: "global_fee_wallet",
15666
+ docs: [
15667
+ "The wallet that receives program-level fees"
15668
+ ],
15669
+ type: "pubkey"
15670
+ },
15671
+ {
15672
+ name: "program_fee_fixed",
15673
+ docs: [
15674
+ "Fixed fee APR charged to borrowers (program-level)"
15675
+ ],
15676
+ type: {
15677
+ defined: {
15678
+ name: "WrappedI80F48"
15679
+ }
15680
+ }
15681
+ },
15682
+ {
15683
+ name: "program_fee_rate",
15684
+ docs: [
15685
+ "Proportional fee rate on interest (program-level)"
15686
+ ],
15687
+ type: {
15688
+ defined: {
15689
+ name: "WrappedI80F48"
15690
+ }
15691
+ }
15692
+ },
15693
+ {
15694
+ name: "last_update",
15695
+ docs: [
15696
+ "Unix timestamp of the last fee state propagation"
15697
+ ],
15698
+ type: "i64"
15699
+ }
15700
+ ]
15701
+ }
15702
+ },
15117
15703
  {
15118
15704
  name: "GroupEventHeader",
15119
15705
  type: {
@@ -15926,7 +16512,7 @@ var marginfi_0_1_9_default = {
15926
16512
  name: "JuplendConfigCompact",
15927
16513
  docs: [
15928
16514
  "Used to configure JupLend banks. A simplified version of `BankConfigCompact` which omits most",
15929
- "values related to interest since JupLend banks cannot earn interest or be borrowed against.",
16515
+ "values related to interest since JupLend banks cannot earn interest or be borrowed from.",
15930
16516
  "",
15931
16517
  "Note: JupLend banks do not take an Operational State, they always start in `Uninitialized`",
15932
16518
  "state and are set to `Operational` via `juplend_init_position` (seed deposit + protocol fToken",
@@ -16750,6 +17336,34 @@ var marginfi_0_1_9_default = {
16750
17336
  ]
16751
17337
  }
16752
17338
  },
17339
+ {
17340
+ name: "LendingPoolBankSetSameAssetEmodeEligibilityEvent",
17341
+ type: {
17342
+ kind: "struct",
17343
+ fields: [
17344
+ {
17345
+ name: "header",
17346
+ type: {
17347
+ defined: {
17348
+ name: "GroupEventHeader"
17349
+ }
17350
+ }
17351
+ },
17352
+ {
17353
+ name: "bank",
17354
+ type: "pubkey"
17355
+ },
17356
+ {
17357
+ name: "mint",
17358
+ type: "pubkey"
17359
+ },
17360
+ {
17361
+ name: "enabled",
17362
+ type: "bool"
17363
+ }
17364
+ ]
17365
+ }
17366
+ },
16753
17367
  {
16754
17368
  name: "LendingPoolSuperAdminDepositEvent",
16755
17369
  type: {
@@ -16836,6 +17450,10 @@ var marginfi_0_1_9_default = {
16836
17450
  {
16837
17451
  name: "liquidator_liability_balance",
16838
17452
  type: "f64"
17453
+ },
17454
+ {
17455
+ name: "liquidator_liability_bank_asset_balance",
17456
+ type: "f64"
16839
17457
  }
16840
17458
  ]
16841
17459
  }
@@ -17545,16 +18163,21 @@ var marginfi_0_1_9_default = {
17545
18163
  type: "u32"
17546
18164
  },
17547
18165
  {
17548
- name: "_padding",
18166
+ name: "same_asset_emode_init_leverage",
17549
18167
  docs: [
17550
- "Reserved for future use"
18168
+ "Encoded same-asset automatic emode leverage for initial margin.",
18169
+ "Decode with `u32_to_basis`. Same-asset treatment is disabled when the decoded leverage is",
18170
+ "less than or equal to 1 and also requires each participating bank to opt in."
17551
18171
  ],
17552
- type: {
17553
- array: [
17554
- "u8",
17555
- 8
17556
- ]
17557
- }
18172
+ type: "u32"
18173
+ },
18174
+ {
18175
+ name: "same_asset_emode_maint_leverage",
18176
+ docs: [
18177
+ "Encoded same-asset automatic emode leverage for maintenance margin.",
18178
+ "Decode with `u32_to_basis`. Ordering is validated in decoded space."
18179
+ ],
18180
+ type: "u32"
17558
18181
  },
17559
18182
  {
17560
18183
  name: "rate_limiter",
@@ -17635,6 +18258,20 @@ var marginfi_0_1_9_default = {
17635
18258
  32
17636
18259
  ]
17637
18260
  }
18261
+ },
18262
+ {
18263
+ name: "_padding_2",
18264
+ type: {
18265
+ array: [
18266
+ {
18267
+ array: [
18268
+ "u64",
18269
+ 32
18270
+ ]
18271
+ },
18272
+ 32
18273
+ ]
18274
+ }
17638
18275
  }
17639
18276
  ]
17640
18277
  }
@@ -18680,11 +19317,12 @@ var marginfi_0_1_9_default = {
18680
19317
  }
18681
19318
  },
18682
19319
  {
18683
- name: "placeholder",
19320
+ name: "created_at",
18684
19321
  docs: [
18685
- "Reserved for future use"
19322
+ "Unix timestamp (seconds) when the order was created. Reads 0 for orders created before this",
19323
+ "field existed (it was previously a reserved placeholder; same 8 bytes, so layout-compatible)."
18686
19324
  ],
18687
- type: "u64"
19325
+ type: "i64"
18688
19326
  },
18689
19327
  {
18690
19328
  name: "max_slippage",
@@ -19134,6 +19772,175 @@ var marginfi_0_1_9_default = {
19134
19772
  ]
19135
19773
  }
19136
19774
  },
19775
+ {
19776
+ name: "SameAssetEmodeBank",
19777
+ serialization: "bytemuck",
19778
+ repr: {
19779
+ kind: "c"
19780
+ },
19781
+ type: {
19782
+ kind: "struct",
19783
+ fields: [
19784
+ {
19785
+ name: "bank",
19786
+ type: "pubkey"
19787
+ },
19788
+ {
19789
+ name: "group_index",
19790
+ docs: [
19791
+ "Index into `SameAssetEmodeRegistry.groups`."
19792
+ ],
19793
+ type: "u8"
19794
+ },
19795
+ {
19796
+ name: "_padding",
19797
+ type: {
19798
+ array: [
19799
+ "u8",
19800
+ 7
19801
+ ]
19802
+ }
19803
+ }
19804
+ ]
19805
+ }
19806
+ },
19807
+ {
19808
+ name: "SameAssetEmodeGroup",
19809
+ serialization: "bytemuck",
19810
+ repr: {
19811
+ kind: "c"
19812
+ },
19813
+ type: {
19814
+ kind: "struct",
19815
+ fields: [
19816
+ {
19817
+ name: "mint",
19818
+ type: "pubkey"
19819
+ },
19820
+ {
19821
+ name: "oracle_key",
19822
+ docs: [
19823
+ "The canonical price source, matching `Bank.config.oracle_keys[0]`."
19824
+ ],
19825
+ type: "pubkey"
19826
+ }
19827
+ ]
19828
+ }
19829
+ },
19830
+ {
19831
+ name: "SameAssetEmodeRegistry",
19832
+ docs: [
19833
+ "Read-only archive of same-asset-emode banks. Enables the emode admin to see, at a glance, which",
19834
+ "banks are participating in same-asset-emode."
19835
+ ],
19836
+ serialization: "bytemuck",
19837
+ repr: {
19838
+ kind: "c"
19839
+ },
19840
+ type: {
19841
+ kind: "struct",
19842
+ fields: [
19843
+ {
19844
+ name: "_padding_0",
19845
+ type: "u64"
19846
+ },
19847
+ {
19848
+ name: "key",
19849
+ docs: [
19850
+ "This registry's own key."
19851
+ ],
19852
+ type: "pubkey"
19853
+ },
19854
+ {
19855
+ name: "group",
19856
+ docs: [
19857
+ "Group for which this registry applies."
19858
+ ],
19859
+ type: "pubkey"
19860
+ },
19861
+ {
19862
+ name: "bank_count",
19863
+ type: "u16"
19864
+ },
19865
+ {
19866
+ name: "group_count",
19867
+ type: "u8"
19868
+ },
19869
+ {
19870
+ name: "bump",
19871
+ type: "u8"
19872
+ },
19873
+ {
19874
+ name: "_padding_1",
19875
+ type: {
19876
+ array: [
19877
+ "u8",
19878
+ 4
19879
+ ]
19880
+ }
19881
+ },
19882
+ {
19883
+ name: "groups",
19884
+ docs: [
19885
+ "Describes the same-asset-emode groupings that exist"
19886
+ ],
19887
+ type: {
19888
+ array: [
19889
+ {
19890
+ defined: {
19891
+ name: "SameAssetEmodeGroup"
19892
+ }
19893
+ },
19894
+ 32
19895
+ ]
19896
+ }
19897
+ },
19898
+ {
19899
+ name: "banks",
19900
+ docs: [
19901
+ "Describes which bank belongs to which group"
19902
+ ],
19903
+ type: {
19904
+ array: [
19905
+ {
19906
+ defined: {
19907
+ name: "SameAssetEmodeBank"
19908
+ }
19909
+ },
19910
+ 128
19911
+ ]
19912
+ }
19913
+ },
19914
+ {
19915
+ name: "_padding_2",
19916
+ type: {
19917
+ array: [
19918
+ "u8",
19919
+ 1024
19920
+ ]
19921
+ }
19922
+ },
19923
+ {
19924
+ name: "_padding_3",
19925
+ type: {
19926
+ array: [
19927
+ "u8",
19928
+ 512
19929
+ ]
19930
+ }
19931
+ },
19932
+ {
19933
+ name: "_padding_4",
19934
+ type: {
19935
+ array: [
19936
+ "u8",
19937
+ 256
19938
+ ]
19939
+ }
19940
+ }
19941
+ ]
19942
+ }
19943
+ },
19137
19944
  {
19138
19945
  name: "SetKeeperCloseFlagsEvent",
19139
19946
  type: {
@@ -19859,7 +20666,7 @@ var marginfi_0_1_9_default = {
19859
20666
  };
19860
20667
 
19861
20668
  // src/idl/index.ts
19862
- var MARGINFI_IDL = marginfi_0_1_9_default;
20669
+ var MARGINFI_IDL = marginfi_0_1_10_default;
19863
20670
 
19864
20671
  // src/services/bank/types/bank.types.ts
19865
20672
  var RiskTier = /* @__PURE__ */ ((RiskTier3) => {
@@ -19874,6 +20681,7 @@ var OperationalState = /* @__PURE__ */ ((OperationalState3) => {
19874
20681
  OperationalState3["KilledByBankruptcy"] = "KilledByBankruptcy";
19875
20682
  OperationalState3["Uninitialized"] = "Uninitialized";
19876
20683
  OperationalState3["ReduceOnlyWithBorrowingPower"] = "ReduceOnlyWithBorrowingPower";
20684
+ OperationalState3["CircuitBroken"] = "CircuitBroken";
19877
20685
  return OperationalState3;
19878
20686
  })(OperationalState || {});
19879
20687
  var OracleSetup = /* @__PURE__ */ ((OracleSetup3) => {
@@ -20867,7 +21675,17 @@ function serializeBankConfigOpt(bankConfigOpt) {
20867
21675
  permissionlessBadDebtSettlement: bankConfigOpt.permissionlessBadDebtSettlement,
20868
21676
  freezeSettings: bankConfigOpt.freezeSettings,
20869
21677
  tokenlessRepaymentsAllowed: bankConfigOpt.tokenlessRepaymentsAllowed,
20870
- oracleMaxConfidence: bankConfigOpt.oracleMaxConfidence
21678
+ oracleMaxConfidence: bankConfigOpt.oracleMaxConfidence,
21679
+ liquidationLiquidatorFee: null,
21680
+ liquidationInsuranceFee: null,
21681
+ circuitBreakerEnabled: null,
21682
+ cbDeviationBpsTiers: null,
21683
+ cbTierDurationsSeconds: null,
21684
+ cbEscalationWindowMult: null,
21685
+ cbEmaAlphaBps: null,
21686
+ cbWindowSeconds: null,
21687
+ cbWindowMaxUpBps: null,
21688
+ cbWindowMaxDownBps: null
20871
21689
  };
20872
21690
  }
20873
21691
  function serializeInterestRateConfig(interestRateConfig) {
@@ -21713,6 +22531,8 @@ function parseOperationalState(operationalStateRaw) {
21713
22531
  return "Uninitialized" /* Uninitialized */;
21714
22532
  case "reduceonlywithborrowingpower":
21715
22533
  return "ReduceOnlyWithBorrowingPower" /* ReduceOnlyWithBorrowingPower */;
22534
+ case "circuitbroken":
22535
+ return "CircuitBroken" /* CircuitBroken */;
21716
22536
  default:
21717
22537
  throw new Error(`Invalid operational state "${operationalStateRaw}"`);
21718
22538
  }
@@ -68639,6 +69459,7 @@ function makeBeginFlashLoanIx2(programId, accounts, args) {
68639
69459
  function makeEndFlashLoanIx2(programId, accounts, remainingAccounts = []) {
68640
69460
  const keys = [
68641
69461
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
69462
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
68642
69463
  { pubkey: accounts.authority, isSigner: true, isWritable: false }
68643
69464
  ];
68644
69465
  keys.push(...remainingAccounts);
@@ -68847,7 +69668,8 @@ function makeCloseAccountIx2(programId, accounts) {
68847
69668
  }
68848
69669
  function makePulseHealthIx3(programId, accounts, remainingAccounts = []) {
68849
69670
  const keys = [
68850
- { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true }
69671
+ { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
69672
+ { pubkey: accounts.group, isSigner: false, isWritable: false }
68851
69673
  ];
68852
69674
  keys.push(...remainingAccounts);
68853
69675
  return new TransactionInstruction({
@@ -68865,6 +69687,7 @@ function makeAccountTransferToNewAccountIx2(programId, accounts) {
68865
69687
  { pubkey: accounts.feePayer, isSigner: true, isWritable: true },
68866
69688
  { pubkey: accounts.newAuthority, isSigner: false, isWritable: false },
68867
69689
  { pubkey: accounts.globalFeeWallet, isSigner: false, isWritable: true },
69690
+ { pubkey: accounts.feeState, isSigner: false, isWritable: false },
68868
69691
  { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
68869
69692
  ];
68870
69693
  return new TransactionInstruction({
@@ -71552,12 +72375,13 @@ async function makeBeginFlashLoanIx3(program, marginfiAccountPk, endIndex, autho
71552
72375
  );
71553
72376
  return { instructions: [ix], keys: [] };
71554
72377
  }
71555
- async function makeEndFlashLoanIx3(program, marginfiAccountPk, projectedActiveBanks, authority, isSync) {
72378
+ async function makeEndFlashLoanIx3(program, marginfiAccountPk, group, projectedActiveBanks, authority, isSync) {
71556
72379
  const remainingAccounts = computeHealthAccountMetas({ banksToInclude: projectedActiveBanks });
71557
72380
  const ix = isSync && authority ? sync_instructions_default.makeEndFlashLoanIx(
71558
72381
  program.programId,
71559
72382
  {
71560
72383
  marginfiAccount: marginfiAccountPk,
72384
+ group,
71561
72385
  authority
71562
72386
  },
71563
72387
  remainingAccounts.map((account) => ({
@@ -71610,6 +72434,7 @@ async function makeFlashLoanTx({
71610
72434
  const endFlashLoanIx = await makeEndFlashLoanIx3(
71611
72435
  program,
71612
72436
  marginfiAccount.address,
72437
+ marginfiAccount.group,
71613
72438
  projectedActiveBanks,
71614
72439
  marginfiAccount.authority,
71615
72440
  isSync
@@ -72223,7 +73048,11 @@ function computeFlashLoanNonSwapBudget({
72223
73048
  });
72224
73049
  const endFlIx = sync_instructions_default.makeEndFlashLoanIx(
72225
73050
  program.programId,
72226
- { marginfiAccount: marginfiAccount.address, authority: marginfiAccount.authority },
73051
+ {
73052
+ marginfiAccount: marginfiAccount.address,
73053
+ group: marginfiAccount.group,
73054
+ authority: marginfiAccount.authority
73055
+ },
72227
73056
  endFlRemainingAccounts.map((pubkey) => ({ pubkey, isSigner: false, isWritable: false }))
72228
73057
  );
72229
73058
  const allNonSwapIxs = [beginFlIx, ...ixs, endFlIx];
@@ -73165,7 +73994,7 @@ var MarginfiAccount = class _MarginfiAccount {
73165
73994
  );
73166
73995
  }
73167
73996
  const banks = projectedActiveBanks.map((account) => bankMap.get(account.toBase58()));
73168
- return makeEndFlashLoanIx3(program, this.address, banks, authority);
73997
+ return makeEndFlashLoanIx3(program, this.address, this.group, banks, authority);
73169
73998
  }
73170
73999
  /**
73171
74000
  * Builds a transaction to transfer this account to a new authority.
@@ -75928,6 +76757,7 @@ async function buildTransferFlashloanTx(args) {
75928
76757
  const end = await makeEndFlashLoanIx3(
75929
76758
  program,
75930
76759
  accountA.address,
76760
+ accountA.group,
75931
76761
  projectedActiveBanksA,
75932
76762
  accountA.authority
75933
76763
  );