@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.cjs CHANGED
@@ -706,12 +706,12 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
706
706
  return bundleTipInstruction;
707
707
  }
708
708
 
709
- // src/idl/marginfi_0.1.9.json
710
- var marginfi_0_1_9_default = {
709
+ // src/idl/marginfi_0.1.10.json
710
+ var marginfi_0_1_10_default = {
711
711
  address: "MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA",
712
712
  metadata: {
713
713
  name: "marginfi",
714
- version: "0.1.9",
714
+ version: "0.1.10",
715
715
  spec: "0.1.0",
716
716
  description: "Borrow Lending Prime Broker"
717
717
  },
@@ -932,69 +932,6 @@ var marginfi_0_1_9_default = {
932
932
  }
933
933
  ]
934
934
  },
935
- {
936
- name: "copy_fee_state_to_v2",
937
- docs: [
938
- "(permissionless) Copy current FeeState values into FeeStateV2."
939
- ],
940
- discriminator: [
941
- 100,
942
- 146,
943
- 124,
944
- 224,
945
- 95,
946
- 196,
947
- 206,
948
- 14
949
- ],
950
- accounts: [
951
- {
952
- name: "fee_state",
953
- pda: {
954
- seeds: [
955
- {
956
- kind: "const",
957
- value: [
958
- 102,
959
- 101,
960
- 101,
961
- 115,
962
- 116,
963
- 97,
964
- 116,
965
- 101
966
- ]
967
- }
968
- ]
969
- }
970
- },
971
- {
972
- name: "fee_state_v2",
973
- writable: true,
974
- pda: {
975
- seeds: [
976
- {
977
- kind: "const",
978
- value: [
979
- 102,
980
- 101,
981
- 101,
982
- 115,
983
- 116,
984
- 97,
985
- 116,
986
- 101,
987
- 95,
988
- 118,
989
- 50
990
- ]
991
- }
992
- ]
993
- }
994
- }
995
- ],
996
- args: []
997
- },
998
935
  {
999
936
  name: "disable_staked_oracles",
1000
937
  docs: [
@@ -2371,6 +2308,12 @@ var marginfi_0_1_9_default = {
2371
2308
  type: {
2372
2309
  option: "pubkey"
2373
2310
  }
2311
+ },
2312
+ {
2313
+ name: "account_transfer_fee",
2314
+ type: {
2315
+ option: "u32"
2316
+ }
2374
2317
  }
2375
2318
  ]
2376
2319
  },
@@ -2560,6 +2503,12 @@ var marginfi_0_1_9_default = {
2560
2503
  "marginfi_account"
2561
2504
  ]
2562
2505
  },
2506
+ {
2507
+ name: "group",
2508
+ relations: [
2509
+ "marginfi_account"
2510
+ ]
2511
+ },
2563
2512
  {
2564
2513
  name: "liquidation_receiver",
2565
2514
  writable: true,
@@ -2598,6 +2547,16 @@ var marginfi_0_1_9_default = {
2598
2547
  {
2599
2548
  name: "system_program",
2600
2549
  address: "11111111111111111111111111111111"
2550
+ },
2551
+ {
2552
+ name: "fee_payer",
2553
+ docs: [
2554
+ "Optional separate payer for the flat liquidation fee. When provided it must sign and pays the",
2555
+ "fee; when omitted, the `liquidation_receiver` pays (the default)."
2556
+ ],
2557
+ writable: true,
2558
+ signer: true,
2559
+ optional: true
2601
2560
  }
2602
2561
  ],
2603
2562
  args: []
@@ -2775,61 +2734,6 @@ var marginfi_0_1_9_default = {
2775
2734
  }
2776
2735
  ]
2777
2736
  },
2778
- {
2779
- name: "init_global_fee_state_v2",
2780
- docs: [
2781
- "(Runs once per program) Initialize the V2 fee state PDA."
2782
- ],
2783
- discriminator: [
2784
- 170,
2785
- 82,
2786
- 207,
2787
- 84,
2788
- 84,
2789
- 17,
2790
- 116,
2791
- 124
2792
- ],
2793
- accounts: [
2794
- {
2795
- name: "payer",
2796
- docs: [
2797
- "Pays the init fee"
2798
- ],
2799
- writable: true,
2800
- signer: true
2801
- },
2802
- {
2803
- name: "fee_state_v2",
2804
- writable: true,
2805
- pda: {
2806
- seeds: [
2807
- {
2808
- kind: "const",
2809
- value: [
2810
- 102,
2811
- 101,
2812
- 101,
2813
- 115,
2814
- 116,
2815
- 97,
2816
- 116,
2817
- 101,
2818
- 95,
2819
- 118,
2820
- 50
2821
- ]
2822
- }
2823
- ]
2824
- }
2825
- },
2826
- {
2827
- name: "system_program",
2828
- address: "11111111111111111111111111111111"
2829
- }
2830
- ],
2831
- args: []
2832
- },
2833
2737
  {
2834
2738
  name: "init_staked_settings",
2835
2739
  docs: [
@@ -4549,6 +4453,12 @@ var marginfi_0_1_9_default = {
4549
4453
  name: "marginfi_account",
4550
4454
  writable: true
4551
4455
  },
4456
+ {
4457
+ name: "group",
4458
+ relations: [
4459
+ "marginfi_account"
4460
+ ]
4461
+ },
4552
4462
  {
4553
4463
  name: "authority",
4554
4464
  signer: true,
@@ -4751,6 +4661,12 @@ var marginfi_0_1_9_default = {
4751
4661
  {
4752
4662
  name: "marginfi_account",
4753
4663
  writable: true
4664
+ },
4665
+ {
4666
+ name: "group",
4667
+ relations: [
4668
+ "marginfi_account"
4669
+ ]
4754
4670
  }
4755
4671
  ],
4756
4672
  args: []
@@ -7362,6 +7278,50 @@ var marginfi_0_1_9_default = {
7362
7278
  ],
7363
7279
  args: []
7364
7280
  },
7281
+ {
7282
+ name: "lending_pool_clear_circuit_breaker",
7283
+ docs: [
7284
+ "(admin or risk_admin) Clear an active circuit-breaker halt on a bank.",
7285
+ "* `reseed_reference` - If true, also zero the EMA reference so the next pulse reseeds it",
7286
+ "from live oracle data (use when clearing because the new price level is valid and the",
7287
+ "pre-halt reference would cause an immediate re-halt)."
7288
+ ],
7289
+ discriminator: [
7290
+ 64,
7291
+ 73,
7292
+ 106,
7293
+ 46,
7294
+ 213,
7295
+ 86,
7296
+ 31,
7297
+ 48
7298
+ ],
7299
+ accounts: [
7300
+ {
7301
+ name: "group",
7302
+ relations: [
7303
+ "bank"
7304
+ ]
7305
+ },
7306
+ {
7307
+ name: "authority",
7308
+ docs: [
7309
+ "Either `group.admin` or `group.risk_admin`. Validated in the handler."
7310
+ ],
7311
+ signer: true
7312
+ },
7313
+ {
7314
+ name: "bank",
7315
+ writable: true
7316
+ }
7317
+ ],
7318
+ args: [
7319
+ {
7320
+ name: "reseed_reference",
7321
+ type: "bool"
7322
+ }
7323
+ ]
7324
+ },
7365
7325
  {
7366
7326
  name: "lending_pool_clone_bank",
7367
7327
  docs: [
@@ -7674,7 +7634,20 @@ var marginfi_0_1_9_default = {
7674
7634
  {
7675
7635
  name: "lending_pool_close_bank",
7676
7636
  docs: [
7677
- "(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares."
7637
+ "(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares.",
7638
+ "",
7639
+ "Pass `force_close = Some(true)` to bypass the CLOSE_ENABLED_FLAG and open-position checks",
7640
+ "(zero-shares/emissions are still required). Forcing a bank closed is **VERY DANGEROUS**.",
7641
+ "Only do it if a Bank was fundamentally broken in some way. The admin **MUST ENSURE** that:",
7642
+ "",
7643
+ "* **NO USER** has a Balance in this bank (zero-shares on the bank is not sufficient to",
7644
+ "guarantee this, a user can have a zero-share Balance, this could brick their account.)",
7645
+ "* fee and insurance vault balances are withdrawn (unless you don't care if they are lost",
7646
+ "**FOREVER**).",
7647
+ "* all three vault token-account balances are zero (or you don't care if anything remaining",
7648
+ "is lost **FOREVER**), including the liquidity vault",
7649
+ "* all three outstanding-fee fields are zero (or you don't care if anything remaining is lost",
7650
+ "**FOREVER**)"
7678
7651
  ],
7679
7652
  discriminator: [
7680
7653
  22,
@@ -7707,7 +7680,14 @@ var marginfi_0_1_9_default = {
7707
7680
  ]
7708
7681
  }
7709
7682
  ],
7710
- args: []
7683
+ args: [
7684
+ {
7685
+ name: "force_close",
7686
+ type: {
7687
+ option: "bool"
7688
+ }
7689
+ }
7690
+ ]
7711
7691
  },
7712
7692
  {
7713
7693
  name: "lending_pool_collect_bank_fees",
@@ -8391,6 +8371,79 @@ var marginfi_0_1_9_default = {
8391
8371
  ],
8392
8372
  args: []
8393
8373
  },
8374
+ {
8375
+ name: "lending_pool_init_same_asset_emode_registry",
8376
+ docs: [
8377
+ "(admin or emode_admin only) Initialize the per-group same-asset e-mode registry."
8378
+ ],
8379
+ discriminator: [
8380
+ 217,
8381
+ 78,
8382
+ 227,
8383
+ 223,
8384
+ 147,
8385
+ 231,
8386
+ 213,
8387
+ 108
8388
+ ],
8389
+ accounts: [
8390
+ {
8391
+ name: "group"
8392
+ },
8393
+ {
8394
+ name: "signer",
8395
+ writable: true,
8396
+ signer: true
8397
+ },
8398
+ {
8399
+ name: "same_asset_emode_registry",
8400
+ writable: true,
8401
+ pda: {
8402
+ seeds: [
8403
+ {
8404
+ kind: "const",
8405
+ value: [
8406
+ 115,
8407
+ 97,
8408
+ 109,
8409
+ 101,
8410
+ 95,
8411
+ 97,
8412
+ 115,
8413
+ 115,
8414
+ 101,
8415
+ 116,
8416
+ 95,
8417
+ 101,
8418
+ 109,
8419
+ 111,
8420
+ 100,
8421
+ 101,
8422
+ 95,
8423
+ 114,
8424
+ 101,
8425
+ 103,
8426
+ 105,
8427
+ 115,
8428
+ 116,
8429
+ 114,
8430
+ 121
8431
+ ]
8432
+ },
8433
+ {
8434
+ kind: "account",
8435
+ path: "group"
8436
+ }
8437
+ ]
8438
+ }
8439
+ },
8440
+ {
8441
+ name: "system_program",
8442
+ address: "11111111111111111111111111111111"
8443
+ }
8444
+ ],
8445
+ args: []
8446
+ },
8394
8447
  {
8395
8448
  name: "lending_pool_pulse_bank_price_cache",
8396
8449
  docs: [
@@ -8420,6 +8473,126 @@ var marginfi_0_1_9_default = {
8420
8473
  ],
8421
8474
  args: []
8422
8475
  },
8476
+ {
8477
+ name: "lending_pool_resize_group_account",
8478
+ docs: [
8479
+ "(permissionless) Resize the group account to the v2 layout size; `payer` funds the",
8480
+ "added rent."
8481
+ ],
8482
+ discriminator: [
8483
+ 97,
8484
+ 221,
8485
+ 69,
8486
+ 96,
8487
+ 204,
8488
+ 162,
8489
+ 174,
8490
+ 250
8491
+ ],
8492
+ accounts: [
8493
+ {
8494
+ name: "group",
8495
+ docs: [
8496
+ "undersized group can still be resized under the future (larger-struct) program."
8497
+ ],
8498
+ writable: true
8499
+ },
8500
+ {
8501
+ name: "payer",
8502
+ docs: [
8503
+ "Funds the rent for the added account space."
8504
+ ],
8505
+ writable: true,
8506
+ signer: true
8507
+ },
8508
+ {
8509
+ name: "system_program",
8510
+ address: "11111111111111111111111111111111"
8511
+ }
8512
+ ],
8513
+ args: []
8514
+ },
8515
+ {
8516
+ name: "lending_pool_set_bank_same_asset_emode_eligibility",
8517
+ docs: [
8518
+ "(admin or emode_admin only) Opt a bank in/out of same-asset e-mode participation."
8519
+ ],
8520
+ discriminator: [
8521
+ 149,
8522
+ 50,
8523
+ 162,
8524
+ 236,
8525
+ 150,
8526
+ 119,
8527
+ 9,
8528
+ 47
8529
+ ],
8530
+ accounts: [
8531
+ {
8532
+ name: "group",
8533
+ relations: [
8534
+ "bank",
8535
+ "same_asset_emode_registry"
8536
+ ]
8537
+ },
8538
+ {
8539
+ name: "signer",
8540
+ signer: true
8541
+ },
8542
+ {
8543
+ name: "bank",
8544
+ writable: true
8545
+ },
8546
+ {
8547
+ name: "same_asset_emode_registry",
8548
+ writable: true,
8549
+ pda: {
8550
+ seeds: [
8551
+ {
8552
+ kind: "const",
8553
+ value: [
8554
+ 115,
8555
+ 97,
8556
+ 109,
8557
+ 101,
8558
+ 95,
8559
+ 97,
8560
+ 115,
8561
+ 115,
8562
+ 101,
8563
+ 116,
8564
+ 95,
8565
+ 101,
8566
+ 109,
8567
+ 111,
8568
+ 100,
8569
+ 101,
8570
+ 95,
8571
+ 114,
8572
+ 101,
8573
+ 103,
8574
+ 105,
8575
+ 115,
8576
+ 116,
8577
+ 114,
8578
+ 121
8579
+ ]
8580
+ },
8581
+ {
8582
+ kind: "account",
8583
+ path: "group"
8584
+ }
8585
+ ]
8586
+ }
8587
+ }
8588
+ ],
8589
+ args: [
8590
+ {
8591
+ name: "enabled",
8592
+ type: "bool"
8593
+ }
8594
+ ]
8595
+ },
8423
8596
  {
8424
8597
  name: "lending_pool_set_fixed_oracle_price",
8425
8598
  docs: [
@@ -9609,6 +9782,8 @@ var marginfi_0_1_9_default = {
9609
9782
  "(admin only) Configure group admin keys and emode leverage caps. All admin keys must be",
9610
9783
  "provided on every call. Emode leverage caps are set if provided, otherwise the existing",
9611
9784
  "(non-zero) values are kept. Pass `Some(value)` to update, `None` to leave unchanged.",
9785
+ "Same-asset emode leverage is disabled by configuring both init and maint leverage to `1`;",
9786
+ "values below `1`, including `0`, are invalid.",
9612
9787
  "",
9613
9788
  "Note: `new_emissions_admin` is deprecated and currently has no on-chain effect."
9614
9789
  ],
@@ -9703,6 +9878,26 @@ var marginfi_0_1_9_default = {
9703
9878
  }
9704
9879
  }
9705
9880
  }
9881
+ },
9882
+ {
9883
+ name: "same_asset_emode_init_leverage",
9884
+ type: {
9885
+ option: {
9886
+ defined: {
9887
+ name: "WrappedI80F48"
9888
+ }
9889
+ }
9890
+ }
9891
+ },
9892
+ {
9893
+ name: "same_asset_emode_maint_leverage",
9894
+ type: {
9895
+ option: {
9896
+ defined: {
9897
+ name: "WrappedI80F48"
9898
+ }
9899
+ }
9900
+ }
9706
9901
  }
9707
9902
  ]
9708
9903
  },
@@ -9982,10 +10177,11 @@ var marginfi_0_1_9_default = {
9982
10177
  {
9983
10178
  name: "purge_deleverage_balance",
9984
10179
  docs: [
9985
- "(risk admin only) Purge a user's lending balance without withdrawing anything. Only usable",
9986
- "after all the debt has been settled on a bank in deleveraging mode, e.g. when",
9987
- "`TOKENLESS_REPAYMENTS_ALLOWED` and `TOKENLESS_REPAYMENTS_COMPLETE`. used to purge remaining",
9988
- "lending assets in a now-worthless bank before it is fully sunset."
10180
+ "(risk admin only) Purge a user's lending balance on a bank being sunset, without paying the",
10181
+ "user anything. Only usable after all the debt has been settled on a bank in deleveraging",
10182
+ "mode, i.e. `TOKENLESS_REPAYMENTS_ALLOWED` and `TOKENLESS_REPAYMENTS_COMPLETE`. Used to clear",
10183
+ "abandoned lending positions in a now-worthless bank so it can be closed via",
10184
+ "`lending_pool_close_bank`."
9989
10185
  ],
9990
10186
  discriminator: [
9991
10187
  132,
@@ -10023,6 +10219,63 @@ var marginfi_0_1_9_default = {
10023
10219
  ],
10024
10220
  args: []
10025
10221
  },
10222
+ {
10223
+ name: "resize_global_fee_state",
10224
+ docs: [
10225
+ "(permissionless) Resize the fee-state account to the v2 layout size; `payer` funds the",
10226
+ "added rent."
10227
+ ],
10228
+ discriminator: [
10229
+ 141,
10230
+ 111,
10231
+ 97,
10232
+ 79,
10233
+ 111,
10234
+ 143,
10235
+ 77,
10236
+ 159
10237
+ ],
10238
+ accounts: [
10239
+ {
10240
+ name: "fee_state",
10241
+ docs: [
10242
+ "Not an AccountLoader so an undersized fee state can still be resized under the future",
10243
+ "(larger-struct) program."
10244
+ ],
10245
+ writable: true,
10246
+ pda: {
10247
+ seeds: [
10248
+ {
10249
+ kind: "const",
10250
+ value: [
10251
+ 102,
10252
+ 101,
10253
+ 101,
10254
+ 115,
10255
+ 116,
10256
+ 97,
10257
+ 116,
10258
+ 101
10259
+ ]
10260
+ }
10261
+ ]
10262
+ }
10263
+ },
10264
+ {
10265
+ name: "payer",
10266
+ docs: [
10267
+ "Funds the rent for the added account space."
10268
+ ],
10269
+ writable: true,
10270
+ signer: true
10271
+ },
10272
+ {
10273
+ name: "system_program",
10274
+ address: "11111111111111111111111111111111"
10275
+ }
10276
+ ],
10277
+ args: []
10278
+ },
10026
10279
  {
10027
10280
  name: "solend_deposit",
10028
10281
  docs: [
@@ -10686,6 +10939,12 @@ var marginfi_0_1_9_default = {
10686
10939
  "marginfi_account"
10687
10940
  ]
10688
10941
  },
10942
+ {
10943
+ name: "group",
10944
+ relations: [
10945
+ "marginfi_account"
10946
+ ]
10947
+ },
10689
10948
  {
10690
10949
  name: "liquidation_receiver",
10691
10950
  docs: [
@@ -10922,6 +11181,26 @@ var marginfi_0_1_9_default = {
10922
11181
  name: "global_fee_wallet",
10923
11182
  writable: true
10924
11183
  },
11184
+ {
11185
+ name: "fee_state",
11186
+ pda: {
11187
+ seeds: [
11188
+ {
11189
+ kind: "const",
11190
+ value: [
11191
+ 102,
11192
+ 101,
11193
+ 101,
11194
+ 115,
11195
+ 116,
11196
+ 97,
11197
+ 116,
11198
+ 101
11199
+ ]
11200
+ }
11201
+ ]
11202
+ }
11203
+ },
10925
11204
  {
10926
11205
  name: "system_program",
10927
11206
  address: "11111111111111111111111111111111"
@@ -11023,6 +11302,26 @@ var marginfi_0_1_9_default = {
11023
11302
  name: "global_fee_wallet",
11024
11303
  writable: true
11025
11304
  },
11305
+ {
11306
+ name: "fee_state",
11307
+ pda: {
11308
+ seeds: [
11309
+ {
11310
+ kind: "const",
11311
+ value: [
11312
+ 102,
11313
+ 101,
11314
+ 101,
11315
+ 115,
11316
+ 116,
11317
+ 97,
11318
+ 116,
11319
+ 101
11320
+ ]
11321
+ }
11322
+ ]
11323
+ }
11324
+ },
11026
11325
  {
11027
11326
  name: "instructions_sysvar",
11028
11327
  docs: [
@@ -11347,19 +11646,6 @@ var marginfi_0_1_9_default = {
11347
11646
  220
11348
11647
  ]
11349
11648
  },
11350
- {
11351
- name: "FeeStateV2",
11352
- discriminator: [
11353
- 240,
11354
- 43,
11355
- 104,
11356
- 108,
11357
- 146,
11358
- 39,
11359
- 22,
11360
- 38
11361
- ]
11362
- },
11363
11649
  {
11364
11650
  name: "LiquidationRecord",
11365
11651
  discriminator: [
@@ -11412,6 +11698,19 @@ var marginfi_0_1_9_default = {
11412
11698
  51
11413
11699
  ]
11414
11700
  },
11701
+ {
11702
+ name: "SameAssetEmodeRegistry",
11703
+ discriminator: [
11704
+ 222,
11705
+ 21,
11706
+ 195,
11707
+ 149,
11708
+ 193,
11709
+ 72,
11710
+ 219,
11711
+ 31
11712
+ ]
11713
+ },
11415
11714
  {
11416
11715
  name: "StakedSettings",
11417
11716
  discriminator: [
@@ -11440,6 +11739,45 @@ var marginfi_0_1_9_default = {
11440
11739
  73
11441
11740
  ]
11442
11741
  },
11742
+ {
11743
+ name: "CircuitBreakerAutoBrokenEvent",
11744
+ discriminator: [
11745
+ 104,
11746
+ 30,
11747
+ 251,
11748
+ 194,
11749
+ 213,
11750
+ 139,
11751
+ 21,
11752
+ 230
11753
+ ]
11754
+ },
11755
+ {
11756
+ name: "CircuitBreakerClearedEvent",
11757
+ discriminator: [
11758
+ 97,
11759
+ 244,
11760
+ 85,
11761
+ 48,
11762
+ 246,
11763
+ 155,
11764
+ 29,
11765
+ 219
11766
+ ]
11767
+ },
11768
+ {
11769
+ name: "CircuitBreakerTrippedEvent",
11770
+ discriminator: [
11771
+ 112,
11772
+ 68,
11773
+ 182,
11774
+ 85,
11775
+ 54,
11776
+ 184,
11777
+ 4,
11778
+ 134
11779
+ ]
11780
+ },
11443
11781
  {
11444
11782
  name: "DeleverageEvent",
11445
11783
  discriminator: [
@@ -11687,6 +12025,19 @@ var marginfi_0_1_9_default = {
11687
12025
  26
11688
12026
  ]
11689
12027
  },
12028
+ {
12029
+ name: "LendingPoolBankSetSameAssetEmodeEligibilityEvent",
12030
+ discriminator: [
12031
+ 186,
12032
+ 247,
12033
+ 119,
12034
+ 107,
12035
+ 251,
12036
+ 215,
12037
+ 15,
12038
+ 79
12039
+ ]
12040
+ },
11690
12041
  {
11691
12042
  name: "LendingPoolSuperAdminDepositEvent",
11692
12043
  discriminator: [
@@ -12884,6 +13235,36 @@ var marginfi_0_1_9_default = {
12884
13235
  code: 6512,
12885
13236
  name: "InvalidJuplendWithdrawIntermediaryAta",
12886
13237
  msg: "Invalid Juplend withdraw intermediary ATA"
13238
+ },
13239
+ {
13240
+ code: 6513,
13241
+ name: "InvalidResize",
13242
+ msg: "Account is already at (or above) the target size"
13243
+ },
13244
+ {
13245
+ code: 6600,
13246
+ name: "BankCircuitBreakerHalted",
13247
+ msg: "Bank is halted by oracle circuit breaker"
13248
+ },
13249
+ {
13250
+ code: 6601,
13251
+ name: "CircuitBreakerAdminOnly",
13252
+ msg: "Action requires risk admin while bank is circuit-breaker halted"
13253
+ },
13254
+ {
13255
+ code: 6602,
13256
+ name: "CircuitBreakerInvalidConfig",
13257
+ msg: "Invalid circuit breaker config"
13258
+ },
13259
+ {
13260
+ code: 6603,
13261
+ name: "CircuitBreakerRequiresWarmCache",
13262
+ msg: "Circuit breaker cannot be enabled until the oracle price cache is warm (call pulse first)"
13263
+ },
13264
+ {
13265
+ code: 6604,
13266
+ name: "CircuitBreakerPriceJump",
13267
+ msg: "Oracle price deviates too far from the circuit breaker reference; action rejected"
12887
13268
  }
12888
13269
  ],
12889
13270
  types: [
@@ -13270,7 +13651,9 @@ var marginfi_0_1_9_default = {
13270
13651
  "keypair-based bank.",
13271
13652
  "- Bit 9 (512): `STAKED_ORACLE_DISABLED` \u2014 staked oracle pricing is temporarily disabled.",
13272
13653
  "- Bit 10 (1024): `STAKED_ORACLE_PRICE_USES_ONRAMP` \u2014 staked oracle pricing includes the SPL",
13273
- "single-pool on-ramp account in NAV."
13654
+ "single-pool on-ramp account in NAV.",
13655
+ "- Bit 11 (2048): `CIRCUIT_BREAKER_ENABLED` \u2014 oracle deviation breaker active on this bank",
13656
+ "- Bit 12 (4096): `BANK_SAME_ASSET_EMODE_ELIGIBLE` \u2014 bank may participate in same-asset e-mode."
13274
13657
  ],
13275
13658
  type: "u64"
13276
13659
  },
@@ -13365,6 +13748,24 @@ var marginfi_0_1_9_default = {
13365
13748
  ],
13366
13749
  type: "i32"
13367
13750
  },
13751
+ {
13752
+ name: "liquidation_liquidator_fee",
13753
+ docs: [
13754
+ "Fee the liquidator earns when liquidating against this bank's liability. Decode with",
13755
+ "`u32_to_centi` (`u32::MAX` = 100%).",
13756
+ "* 0 falls back to the default (`DEFAULT_LIQUIDATION_FEE` = 2.5%)."
13757
+ ],
13758
+ type: "u32"
13759
+ },
13760
+ {
13761
+ name: "liquidation_insurance_fee",
13762
+ docs: [
13763
+ "Fee routed to this bank's insurance fund on a liquidation against its liability. Decode",
13764
+ "with `u32_to_centi` (`u32::MAX` = 100%).",
13765
+ "* 0 falls back to the default (`DEFAULT_LIQUIDATION_FEE` = 2.5%)."
13766
+ ],
13767
+ type: "u32"
13768
+ },
13368
13769
  {
13369
13770
  name: "_padding_0",
13370
13771
  docs: [
@@ -13373,7 +13774,7 @@ var marginfi_0_1_9_default = {
13373
13774
  type: {
13374
13775
  array: [
13375
13776
  "u8",
13376
- 16
13777
+ 8
13377
13778
  ]
13378
13779
  }
13379
13780
  },
@@ -13440,12 +13841,116 @@ var marginfi_0_1_9_default = {
13440
13841
  ],
13441
13842
  type: "u64"
13442
13843
  },
13844
+ {
13845
+ name: "cb_halt_started_at",
13846
+ docs: [
13847
+ "Unix-seconds when the current halt started, zero if not halted."
13848
+ ],
13849
+ type: "i64"
13850
+ },
13851
+ {
13852
+ name: "cb_halt_ended_at",
13853
+ docs: [
13854
+ "Unix-seconds when the current halt's tier duration ends. Tier stays sticky past this for",
13855
+ "the escalation window; a fresh breach within the window ratchets to the next tier."
13856
+ ],
13857
+ type: "i64"
13858
+ },
13859
+ {
13860
+ name: "cb_tier",
13861
+ docs: [
13862
+ "0 = operational, 1..=3 = escalating halt severity."
13863
+ ],
13864
+ type: "u8"
13865
+ },
13866
+ {
13867
+ name: "cb_tier3_consecutive_trips",
13868
+ docs: [
13869
+ "Consecutive tier-3 trips with no clean escalation-window between them. Hitting",
13870
+ "`CB_MAX_TIER3_BEFORE_CIRCUIT_BREAK` forces the bank to `CircuitBroken`."
13871
+ ],
13872
+ type: "u8"
13873
+ },
13874
+ {
13875
+ name: "cb_pre_break_state",
13876
+ docs: [
13877
+ "`BankOperationalState` (as `u8`) the bank held before the breaker forced it to",
13878
+ "`CircuitBroken`. Restored by `clear_circuit_breaker`. Meaningless unless",
13879
+ "`operational_state == CircuitBroken`."
13880
+ ],
13881
+ type: "u8"
13882
+ },
13883
+ {
13884
+ name: "_cb_pad",
13885
+ type: {
13886
+ array: [
13887
+ "u8",
13888
+ 5
13889
+ ]
13890
+ }
13891
+ },
13892
+ {
13893
+ name: "cb_last_observed_slot",
13894
+ docs: [
13895
+ "Solana slot of the last counted CB observation; used for slot-level dedup."
13896
+ ],
13897
+ type: "u64"
13898
+ },
13899
+ {
13900
+ name: "cb_last_oracle_source_time",
13901
+ docs: [
13902
+ "Publisher-side timestamp of the last counted CB observation; rejects re-reads of the same",
13903
+ "publication across multiple Solana slots. Zero when the adapter doesn't expose one."
13904
+ ],
13905
+ type: "i64"
13906
+ },
13907
+ {
13908
+ name: "cb_reference_price",
13909
+ docs: [
13910
+ "EMA reference price used by the circuit breaker, in the multiplier-adjusted effective-price",
13911
+ "domain the risk engine uses. Frozen while halted, zero until the first observation after",
13912
+ "enable."
13913
+ ],
13914
+ type: {
13915
+ defined: {
13916
+ name: "WrappedI80F48"
13917
+ }
13918
+ }
13919
+ },
13920
+ {
13921
+ name: "cb_window_reference_price",
13922
+ docs: [
13923
+ "Long-window reference price (same multiplier-adjusted domain as `cb_reference_price`) used",
13924
+ "to catch slow oracle walking that stays below the per-observation breaker threshold."
13925
+ ],
13926
+ type: {
13927
+ defined: {
13928
+ name: "WrappedI80F48"
13929
+ }
13930
+ }
13931
+ },
13932
+ {
13933
+ name: "cb_window_started_at",
13934
+ docs: [
13935
+ "Unix-seconds when `cb_window_reference_price` was anchored."
13936
+ ],
13937
+ type: "i64"
13938
+ },
13939
+ {
13940
+ name: "cb_frozen_seconds_pending",
13941
+ docs: [
13942
+ "Frozen halt seconds from halt intervals overwritten or cleared before `accrue_interest`",
13943
+ "consumed them. Non-zero only when the halt record changes without a preceding accrual, i.e.",
13944
+ "a paused pulse; the next accrual excludes these on top of the current halt. Zero normally."
13945
+ ],
13946
+ type: "u64"
13947
+ },
13443
13948
  {
13444
13949
  name: "_padding_1",
13445
13950
  type: {
13446
13951
  array: [
13447
13952
  "u64",
13448
- 13
13953
+ 2
13449
13954
  ]
13450
13955
  }
13451
13956
  }
@@ -13541,7 +14046,8 @@ var marginfi_0_1_9_default = {
13541
14046
  "Confidence interval reported by the oracle when last_oracle_price was fetched",
13542
14047
  "* Always non-negative",
13543
14048
  "* Zero if never updated",
13544
- "* Note: this value is the confidence reported by oracles, multiplied by `STD_DEV_MULTIPLE`"
14049
+ "* Pyth: confidence * 2.12",
14050
+ "* Switchboard: price * oracle_max_confidence / U32_MAX"
13545
14051
  ],
13546
14052
  type: {
13547
14053
  defined: {
@@ -13565,7 +14071,7 @@ var marginfi_0_1_9_default = {
13565
14071
  type: "u8"
13566
14072
  },
13567
14073
  {
13568
- name: "_pad0",
14074
+ name: "_cb_cache_pad",
13569
14075
  type: {
13570
14076
  array: [
13571
14077
  "u8",
@@ -13742,12 +14248,26 @@ var marginfi_0_1_9_default = {
13742
14248
  ]
13743
14249
  }
13744
14250
  },
14251
+ {
14252
+ name: "cb_window_max_up_bps",
14253
+ docs: [
14254
+ "CB long-window upward move cap in bps; `0` uses the `CB_WINDOW_MAX_UP_BPS` default."
14255
+ ],
14256
+ type: "u16"
14257
+ },
14258
+ {
14259
+ name: "cb_window_max_down_bps",
14260
+ docs: [
14261
+ "CB long-window downward move cap in bps; `0` uses the `CB_WINDOW_MAX_DOWN_BPS` default."
14262
+ ],
14263
+ type: "u16"
14264
+ },
13745
14265
  {
13746
14266
  name: "_pad0",
13747
14267
  type: {
13748
14268
  array: [
13749
14269
  "u8",
13750
- 6
14270
+ 2
13751
14271
  ]
13752
14272
  }
13753
14273
  },
@@ -13801,10 +14321,17 @@ var marginfi_0_1_9_default = {
13801
14321
  type: {
13802
14322
  array: [
13803
14323
  "u8",
13804
- 5
14324
+ 1
13805
14325
  ]
13806
14326
  }
13807
14327
  },
14328
+ {
14329
+ name: "cb_window_seconds",
14330
+ docs: [
14331
+ "CB long-window length in seconds; `0` uses the `CB_WINDOW_SECONDS` default."
14332
+ ],
14333
+ type: "u32"
14334
+ },
13808
14335
  {
13809
14336
  name: "total_asset_value_init_limit",
13810
14337
  docs: [
@@ -13838,10 +14365,15 @@ var marginfi_0_1_9_default = {
13838
14365
  {
13839
14366
  name: "oracle_max_confidence",
13840
14367
  docs: [
13841
- "From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note:",
13842
- "the confidence adjustment is capped at 5% regardless of this value.",
13843
- "* 0 falls back to using the default 10% instead, i.e., U32_MAX_DIV_10",
13844
- "* A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc."
14368
+ "A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.",
14369
+ "",
14370
+ "Oracle confidence configuration. Semantics depend on the oracle type:",
14371
+ "* Pyth: Maximum allowed confidence interval. Prices exceeding this threshold are rejected.",
14372
+ "- 0 defaults to 10%.",
14373
+ "* Switchboard: Confidence spread used for price biasing.",
14374
+ "- 0 disables confidence adjustment.",
14375
+ "- Non-zero: confidence = price * oracle_max_confidence / U32_MAX.",
14376
+ "- Clamped to MAX_CONF_INTERVAL (5% of price)."
13845
14377
  ],
13846
14378
  type: "u32"
13847
14379
  },
@@ -13857,13 +14389,47 @@ var marginfi_0_1_9_default = {
13857
14389
  }
13858
14390
  },
13859
14391
  {
13860
- name: "_padding1",
14392
+ name: "cb_deviation_bps_tiers",
14393
+ docs: [
14394
+ "Deviation thresholds in basis points for tiers 1/2/3, strictly monotonic."
14395
+ ],
13861
14396
  type: {
13862
14397
  array: [
13863
- "u8",
13864
- 16
14398
+ "u16",
14399
+ 3
14400
+ ]
14401
+ }
14402
+ },
14403
+ {
14404
+ name: "cb_tier_durations_seconds",
14405
+ docs: [
14406
+ "Halt durations in seconds for tiers 1/2/3, strictly monotonic."
14407
+ ],
14408
+ type: {
14409
+ array: [
14410
+ "u16",
14411
+ 3
13865
14412
  ]
13866
14413
  }
14414
+ },
14415
+ {
14416
+ name: "cb_escalation_window_mult",
14417
+ docs: [
14418
+ "Escalation window multiplier: a re-breach within `prev_tier_duration * mult` seconds",
14419
+ "after a halt ends ratchets to the next tier."
14420
+ ],
14421
+ type: "u8"
14422
+ },
14423
+ {
14424
+ name: "_cb_config_pad",
14425
+ type: "u8"
14426
+ },
14427
+ {
14428
+ name: "cb_ema_alpha_bps",
14429
+ docs: [
14430
+ "EMA smoothing factor for the reference price, in basis points (e.g. 1000 = \u03B1=0.1)."
14431
+ ],
14432
+ type: "u16"
13867
14433
  }
13868
14434
  ]
13869
14435
  }
@@ -13999,10 +14565,15 @@ var marginfi_0_1_9_default = {
13999
14565
  {
14000
14566
  name: "oracle_max_confidence",
14001
14567
  docs: [
14002
- "From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note:",
14003
- "the confidence adjustment is capped at 5% regardless of this value.",
14004
- "* 0% = use the default (10%)",
14005
- "* A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc."
14568
+ "A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.",
14569
+ "",
14570
+ "Oracle confidence configuration. Semantics depend on the oracle type.",
14571
+ "* Pyth: Maximum allowed confidence interval. Prices exceeding this threshold are rejected.",
14572
+ "- 0 defaults to 10%.",
14573
+ "* Switchboard: Confidence spread used for price biasing.",
14574
+ "- 0 disables confidence adjustment.",
14575
+ "- Non-zero: confidence = price * oracle_max_confidence / U32_MAX.",
14576
+ "- Clamped to MAX_CONF_INTERVAL (5% of price)."
14006
14577
  ],
14007
14578
  type: "u32"
14008
14579
  }
@@ -14137,6 +14708,79 @@ var marginfi_0_1_9_default = {
14137
14708
  type: {
14138
14709
  option: "bool"
14139
14710
  }
14711
+ },
14712
+ {
14713
+ name: "liquidation_liquidator_fee",
14714
+ docs: [
14715
+ "Per-bank liquidation fees, encoded as `u32_to_centi` (`u32::MAX` = 100%; 0 => default 2.5%)."
14716
+ ],
14717
+ type: {
14718
+ option: "u32"
14719
+ }
14720
+ },
14721
+ {
14722
+ name: "liquidation_insurance_fee",
14723
+ type: {
14724
+ option: "u32"
14725
+ }
14726
+ },
14727
+ {
14728
+ name: "circuit_breaker_enabled",
14729
+ type: {
14730
+ option: "bool"
14731
+ }
14732
+ },
14733
+ {
14734
+ name: "cb_deviation_bps_tiers",
14735
+ type: {
14736
+ option: {
14737
+ array: [
14738
+ "u16",
14739
+ 3
14740
+ ]
14741
+ }
14742
+ }
14743
+ },
14744
+ {
14745
+ name: "cb_tier_durations_seconds",
14746
+ type: {
14747
+ option: {
14748
+ array: [
14749
+ "u16",
14750
+ 3
14751
+ ]
14752
+ }
14753
+ }
14754
+ },
14755
+ {
14756
+ name: "cb_escalation_window_mult",
14757
+ type: {
14758
+ option: "u8"
14759
+ }
14760
+ },
14761
+ {
14762
+ name: "cb_ema_alpha_bps",
14763
+ type: {
14764
+ option: "u16"
14765
+ }
14766
+ },
14767
+ {
14768
+ name: "cb_window_seconds",
14769
+ type: {
14770
+ option: "u32"
14771
+ }
14772
+ },
14773
+ {
14774
+ name: "cb_window_max_up_bps",
14775
+ type: {
14776
+ option: "u16"
14777
+ }
14778
+ },
14779
+ {
14780
+ name: "cb_window_max_down_bps",
14781
+ type: {
14782
+ option: "u16"
14783
+ }
14140
14784
  }
14141
14785
  ]
14142
14786
  }
@@ -14261,6 +14905,9 @@ var marginfi_0_1_9_default = {
14261
14905
  },
14262
14906
  {
14263
14907
  name: "ReduceOnlyWithBorrowingPower"
14908
+ },
14909
+ {
14910
+ name: "CircuitBroken"
14264
14911
  }
14265
14912
  ]
14266
14913
  }
@@ -14302,6 +14949,78 @@ var marginfi_0_1_9_default = {
14302
14949
  ]
14303
14950
  }
14304
14951
  },
14952
+ {
14953
+ name: "CircuitBreakerAutoBrokenEvent",
14954
+ docs: [
14955
+ "Emitted when consecutive tier-3 trips force a bank into `CircuitBroken`."
14956
+ ],
14957
+ type: {
14958
+ kind: "struct",
14959
+ fields: [
14960
+ {
14961
+ name: "consecutive_tier3_trips",
14962
+ type: "u8"
14963
+ },
14964
+ {
14965
+ name: "current_timestamp",
14966
+ type: "i64"
14967
+ }
14968
+ ]
14969
+ }
14970
+ },
14971
+ {
14972
+ name: "CircuitBreakerClearedEvent",
14973
+ docs: [
14974
+ "Emitted when a halt is cleared (admin override or escalation-window expiry)."
14975
+ ],
14976
+ type: {
14977
+ kind: "struct",
14978
+ fields: [
14979
+ {
14980
+ name: "prior_tier",
14981
+ type: "u8"
14982
+ },
14983
+ {
14984
+ name: "reason",
14985
+ docs: [
14986
+ "One of the `CB_CLEAR_REASON_*` constants."
14987
+ ],
14988
+ type: "u8"
14989
+ },
14990
+ {
14991
+ name: "current_timestamp",
14992
+ type: "i64"
14993
+ }
14994
+ ]
14995
+ }
14996
+ },
14997
+ {
14998
+ name: "CircuitBreakerTrippedEvent",
14999
+ docs: [
15000
+ "Emitted when the per-bank oracle circuit breaker trips or escalates a halt."
15001
+ ],
15002
+ type: {
15003
+ kind: "struct",
15004
+ fields: [
15005
+ {
15006
+ name: "tier",
15007
+ type: "u8"
15008
+ },
15009
+ {
15010
+ name: "deviation_bps",
15011
+ type: "u64"
15012
+ },
15013
+ {
15014
+ name: "halt_started_at",
15015
+ type: "i64"
15016
+ },
15017
+ {
15018
+ name: "halt_ended_at",
15019
+ type: "i64"
15020
+ }
15021
+ ]
15022
+ }
15023
+ },
14305
15024
  {
14306
15025
  name: "DeleverageEvent",
14307
15026
  type: {
@@ -14421,7 +15140,7 @@ var marginfi_0_1_9_default = {
14421
15140
  name: "DriftConfigCompact",
14422
15141
  docs: [
14423
15142
  "Used to configure Drift banks. A simplified version of `BankConfigCompact` which omits most",
14424
- "values related to interest since Drift banks cannot earn interest or be borrowed against."
15143
+ "values related to interest since Drift banks cannot earn interest or be borrowed from."
14425
15144
  ],
14426
15145
  type: {
14427
15146
  kind: "struct",
@@ -14813,210 +15532,24 @@ var marginfi_0_1_9_default = {
14813
15532
  type: "pubkey"
14814
15533
  },
14815
15534
  {
14816
- name: "placeholder0",
14817
- type: "u64"
14818
- },
14819
- {
14820
- name: "bank_init_flat_sol_fee",
15535
+ name: "account_transfer_fee",
14821
15536
  docs: [
14822
- "Flat fee assessed when a new bank is initialized, in lamports.",
14823
- "* In SOL, in native decimals."
15537
+ "Flat fee in lamports paid to the global fee wallet when initiating an account transfer",
15538
+ '(anti-spam; 5,000,000 lamports ~= $0.50). A stored 0 means "use the default"',
15539
+ "(`DEFAULT_ACCOUNT_TRANSFER_FEE_LAMPORTS`), which preserves the legacy fee for FeeStates",
15540
+ "created before this field existed."
14824
15541
  ],
14825
15542
  type: "u32"
14826
15543
  },
14827
15544
  {
14828
- name: "bump_seed",
14829
- type: "u8"
14830
- },
14831
- {
14832
- name: "_padding0",
15545
+ name: "_placeholder0",
14833
15546
  type: {
14834
15547
  array: [
14835
15548
  "u8",
14836
- 3
15549
+ 4
14837
15550
  ]
14838
15551
  }
14839
15552
  },
14840
- {
14841
- name: "liquidation_max_fee",
14842
- docs: [
14843
- "Liquidators can claim at this premium, when liquidating an asset in receivership",
14844
- "liquidation, e.g. (1 + this) * amount repaid >= asset seized",
14845
- "* A percentage"
14846
- ],
14847
- type: {
14848
- defined: {
14849
- name: "WrappedI80F48"
14850
- }
14851
- }
14852
- },
14853
- {
14854
- name: "program_fee_fixed",
14855
- docs: [
14856
- "Fee collected by the program owner from all groups",
14857
- "* A percentage"
14858
- ],
14859
- type: {
14860
- defined: {
14861
- name: "WrappedI80F48"
14862
- }
14863
- }
14864
- },
14865
- {
14866
- name: "program_fee_rate",
14867
- docs: [
14868
- "Fee collected by the program owner from all groups",
14869
- "* A percentage"
14870
- ],
14871
- type: {
14872
- defined: {
14873
- name: "WrappedI80F48"
14874
- }
14875
- }
14876
- },
14877
- {
14878
- name: "panic_state",
14879
- docs: [
14880
- "When the global admin pauses the protocol in the event of an emergency, information about",
14881
- "the pause duration will be stored here and propagated to groups."
14882
- ],
14883
- type: {
14884
- defined: {
14885
- name: "PanicState"
14886
- }
14887
- }
14888
- },
14889
- {
14890
- name: "placeholder1",
14891
- type: "u64"
14892
- },
14893
- {
14894
- name: "liquidation_flat_sol_fee",
14895
- docs: [
14896
- "Flat fee assessed for insurance/program use when a liquidation is executed",
14897
- "* In SOL, in native decimals."
14898
- ],
14899
- type: "u32"
14900
- },
14901
- {
14902
- name: "order_init_flat_sol_fee",
14903
- docs: [
14904
- "Flat fee assessed for preventing spam use when creating an order",
14905
- "* In SOL, in native decimals."
14906
- ],
14907
- type: "u32"
14908
- },
14909
- {
14910
- name: "order_execution_max_fee",
14911
- docs: [
14912
- "Take-profit Orders can be executed at this premium, which Keepers are allowed to keep (no",
14913
- "pun intended) e.g. (1 + this) * amount repaid >= asset seized",
14914
- "* A percentage"
14915
- ],
14916
- type: {
14917
- defined: {
14918
- name: "WrappedI80F48"
14919
- }
14920
- }
14921
- },
14922
- {
14923
- name: "pause_delegate_admin",
14924
- docs: [
14925
- "Can pause (not unpause) the protocol, but cannot modify any fee configuration."
14926
- ],
14927
- type: "pubkey"
14928
- }
14929
- ]
14930
- }
14931
- },
14932
- {
14933
- name: "FeeStateCache",
14934
- docs: [
14935
- "Cached fee configuration propagated from the global FeeState"
14936
- ],
14937
- repr: {
14938
- kind: "c"
14939
- },
14940
- type: {
14941
- kind: "struct",
14942
- fields: [
14943
- {
14944
- name: "global_fee_wallet",
14945
- docs: [
14946
- "The wallet that receives program-level fees"
14947
- ],
14948
- type: "pubkey"
14949
- },
14950
- {
14951
- name: "program_fee_fixed",
14952
- docs: [
14953
- "Fixed fee APR charged to borrowers (program-level)"
14954
- ],
14955
- type: {
14956
- defined: {
14957
- name: "WrappedI80F48"
14958
- }
14959
- }
14960
- },
14961
- {
14962
- name: "program_fee_rate",
14963
- docs: [
14964
- "Proportional fee rate on interest (program-level)"
14965
- ],
14966
- type: {
14967
- defined: {
14968
- name: "WrappedI80F48"
14969
- }
14970
- }
14971
- },
14972
- {
14973
- name: "last_update",
14974
- docs: [
14975
- "Unix timestamp of the last fee state propagation"
14976
- ],
14977
- type: "i64"
14978
- }
14979
- ]
14980
- }
14981
- },
14982
- {
14983
- name: "FeeStateV2",
14984
- docs: [
14985
- "V2 fee state, currently unused by protocol logic. Mirrors `FeeState` with additional padding."
14986
- ],
14987
- serialization: "bytemuck",
14988
- repr: {
14989
- kind: "c"
14990
- },
14991
- type: {
14992
- kind: "struct",
14993
- fields: [
14994
- {
14995
- name: "key",
14996
- docs: [
14997
- 'The fee state\'s own key. A PDA derived from `b"feestate_v2"`'
14998
- ],
14999
- type: "pubkey"
15000
- },
15001
- {
15002
- name: "global_fee_admin",
15003
- docs: [
15004
- "Can modify fees, pause the protocol, etc"
15005
- ],
15006
- type: "pubkey"
15007
- },
15008
- {
15009
- name: "global_fee_wallet",
15010
- docs: [
15011
- "The base wallet for all protocol fees. All SOL fees go to this wallet. All non-SOL fees go",
15012
- "to the cannonical ATA of this wallet for that asset."
15013
- ],
15014
- type: "pubkey"
15015
- },
15016
- {
15017
- name: "placeholder0",
15018
- type: "u64"
15019
- },
15020
15553
  {
15021
15554
  name: "bank_init_flat_sol_fee",
15022
15555
  docs: [
@@ -15128,20 +15661,73 @@ var marginfi_0_1_9_default = {
15128
15661
  type: "pubkey"
15129
15662
  },
15130
15663
  {
15131
- name: "_padding1",
15664
+ name: "_reserved0",
15132
15665
  docs: [
15133
- "Extra reserved bytes for future expansions."
15666
+ "Reserved for future use (e.g. the variable-borrow premium settings). Accounts created",
15667
+ "before the struct grew to this size are v1-sized (`8 + V1_LEN` bytes) and must be",
15668
+ "grown via `resize_global_fee_state` before this program version can load them; the new",
15669
+ "bytes are zero-filled."
15134
15670
  ],
15135
15671
  type: {
15136
15672
  array: [
15137
- "u8",
15138
- 256
15673
+ "u64",
15674
+ 32
15139
15675
  ]
15140
15676
  }
15141
15677
  }
15142
15678
  ]
15143
15679
  }
15144
15680
  },
15681
+ {
15682
+ name: "FeeStateCache",
15683
+ docs: [
15684
+ "Cached fee configuration propagated from the global FeeState"
15685
+ ],
15686
+ repr: {
15687
+ kind: "c"
15688
+ },
15689
+ type: {
15690
+ kind: "struct",
15691
+ fields: [
15692
+ {
15693
+ name: "global_fee_wallet",
15694
+ docs: [
15695
+ "The wallet that receives program-level fees"
15696
+ ],
15697
+ type: "pubkey"
15698
+ },
15699
+ {
15700
+ name: "program_fee_fixed",
15701
+ docs: [
15702
+ "Fixed fee APR charged to borrowers (program-level)"
15703
+ ],
15704
+ type: {
15705
+ defined: {
15706
+ name: "WrappedI80F48"
15707
+ }
15708
+ }
15709
+ },
15710
+ {
15711
+ name: "program_fee_rate",
15712
+ docs: [
15713
+ "Proportional fee rate on interest (program-level)"
15714
+ ],
15715
+ type: {
15716
+ defined: {
15717
+ name: "WrappedI80F48"
15718
+ }
15719
+ }
15720
+ },
15721
+ {
15722
+ name: "last_update",
15723
+ docs: [
15724
+ "Unix timestamp of the last fee state propagation"
15725
+ ],
15726
+ type: "i64"
15727
+ }
15728
+ ]
15729
+ }
15730
+ },
15145
15731
  {
15146
15732
  name: "GroupEventHeader",
15147
15733
  type: {
@@ -15954,7 +16540,7 @@ var marginfi_0_1_9_default = {
15954
16540
  name: "JuplendConfigCompact",
15955
16541
  docs: [
15956
16542
  "Used to configure JupLend banks. A simplified version of `BankConfigCompact` which omits most",
15957
- "values related to interest since JupLend banks cannot earn interest or be borrowed against.",
16543
+ "values related to interest since JupLend banks cannot earn interest or be borrowed from.",
15958
16544
  "",
15959
16545
  "Note: JupLend banks do not take an Operational State, they always start in `Uninitialized`",
15960
16546
  "state and are set to `Operational` via `juplend_init_position` (seed deposit + protocol fToken",
@@ -16778,6 +17364,34 @@ var marginfi_0_1_9_default = {
16778
17364
  ]
16779
17365
  }
16780
17366
  },
17367
+ {
17368
+ name: "LendingPoolBankSetSameAssetEmodeEligibilityEvent",
17369
+ type: {
17370
+ kind: "struct",
17371
+ fields: [
17372
+ {
17373
+ name: "header",
17374
+ type: {
17375
+ defined: {
17376
+ name: "GroupEventHeader"
17377
+ }
17378
+ }
17379
+ },
17380
+ {
17381
+ name: "bank",
17382
+ type: "pubkey"
17383
+ },
17384
+ {
17385
+ name: "mint",
17386
+ type: "pubkey"
17387
+ },
17388
+ {
17389
+ name: "enabled",
17390
+ type: "bool"
17391
+ }
17392
+ ]
17393
+ }
17394
+ },
16781
17395
  {
16782
17396
  name: "LendingPoolSuperAdminDepositEvent",
16783
17397
  type: {
@@ -16864,6 +17478,10 @@ var marginfi_0_1_9_default = {
16864
17478
  {
16865
17479
  name: "liquidator_liability_balance",
16866
17480
  type: "f64"
17481
+ },
17482
+ {
17483
+ name: "liquidator_liability_bank_asset_balance",
17484
+ type: "f64"
16867
17485
  }
16868
17486
  ]
16869
17487
  }
@@ -17573,16 +18191,21 @@ var marginfi_0_1_9_default = {
17573
18191
  type: "u32"
17574
18192
  },
17575
18193
  {
17576
- name: "_padding",
18194
+ name: "same_asset_emode_init_leverage",
17577
18195
  docs: [
17578
- "Reserved for future use"
18196
+ "Encoded same-asset automatic emode leverage for initial margin.",
18197
+ "Decode with `u32_to_basis`. Same-asset treatment is disabled when the decoded leverage is",
18198
+ "less than or equal to 1 and also requires each participating bank to opt in."
17579
18199
  ],
17580
- type: {
17581
- array: [
17582
- "u8",
17583
- 8
17584
- ]
17585
- }
18200
+ type: "u32"
18201
+ },
18202
+ {
18203
+ name: "same_asset_emode_maint_leverage",
18204
+ docs: [
18205
+ "Encoded same-asset automatic emode leverage for maintenance margin.",
18206
+ "Decode with `u32_to_basis`. Ordering is validated in decoded space."
18207
+ ],
18208
+ type: "u32"
17586
18209
  },
17587
18210
  {
17588
18211
  name: "rate_limiter",
@@ -17663,6 +18286,20 @@ var marginfi_0_1_9_default = {
17663
18286
  32
17664
18287
  ]
17665
18288
  }
18289
+ },
18290
+ {
18291
+ name: "_padding_2",
18292
+ type: {
18293
+ array: [
18294
+ {
18295
+ array: [
18296
+ "u64",
18297
+ 32
18298
+ ]
18299
+ },
18300
+ 32
18301
+ ]
18302
+ }
17666
18303
  }
17667
18304
  ]
17668
18305
  }
@@ -18708,11 +19345,12 @@ var marginfi_0_1_9_default = {
18708
19345
  }
18709
19346
  },
18710
19347
  {
18711
- name: "placeholder",
19348
+ name: "created_at",
18712
19349
  docs: [
18713
- "Reserved for future use"
19350
+ "Unix timestamp (seconds) when the order was created. Reads 0 for orders created before this",
19351
+ "field existed (it was previously a reserved placeholder; same 8 bytes, so layout-compatible)."
18714
19352
  ],
18715
- type: "u64"
19353
+ type: "i64"
18716
19354
  },
18717
19355
  {
18718
19356
  name: "max_slippage",
@@ -19162,6 +19800,175 @@ var marginfi_0_1_9_default = {
19162
19800
  ]
19163
19801
  }
19164
19802
  },
19803
+ {
19804
+ name: "SameAssetEmodeBank",
19805
+ serialization: "bytemuck",
19806
+ repr: {
19807
+ kind: "c"
19808
+ },
19809
+ type: {
19810
+ kind: "struct",
19811
+ fields: [
19812
+ {
19813
+ name: "bank",
19814
+ type: "pubkey"
19815
+ },
19816
+ {
19817
+ name: "group_index",
19818
+ docs: [
19819
+ "Index into `SameAssetEmodeRegistry.groups`."
19820
+ ],
19821
+ type: "u8"
19822
+ },
19823
+ {
19824
+ name: "_padding",
19825
+ type: {
19826
+ array: [
19827
+ "u8",
19828
+ 7
19829
+ ]
19830
+ }
19831
+ }
19832
+ ]
19833
+ }
19834
+ },
19835
+ {
19836
+ name: "SameAssetEmodeGroup",
19837
+ serialization: "bytemuck",
19838
+ repr: {
19839
+ kind: "c"
19840
+ },
19841
+ type: {
19842
+ kind: "struct",
19843
+ fields: [
19844
+ {
19845
+ name: "mint",
19846
+ type: "pubkey"
19847
+ },
19848
+ {
19849
+ name: "oracle_key",
19850
+ docs: [
19851
+ "The canonical price source, matching `Bank.config.oracle_keys[0]`."
19852
+ ],
19853
+ type: "pubkey"
19854
+ }
19855
+ ]
19856
+ }
19857
+ },
19858
+ {
19859
+ name: "SameAssetEmodeRegistry",
19860
+ docs: [
19861
+ "Read-only archive of same-asset-emode banks. Enables the emode admin to see, at a glance, which",
19862
+ "banks are participating in same-asset-emode."
19863
+ ],
19864
+ serialization: "bytemuck",
19865
+ repr: {
19866
+ kind: "c"
19867
+ },
19868
+ type: {
19869
+ kind: "struct",
19870
+ fields: [
19871
+ {
19872
+ name: "_padding_0",
19873
+ type: "u64"
19874
+ },
19875
+ {
19876
+ name: "key",
19877
+ docs: [
19878
+ "This registry's own key."
19879
+ ],
19880
+ type: "pubkey"
19881
+ },
19882
+ {
19883
+ name: "group",
19884
+ docs: [
19885
+ "Group for which this registry applies."
19886
+ ],
19887
+ type: "pubkey"
19888
+ },
19889
+ {
19890
+ name: "bank_count",
19891
+ type: "u16"
19892
+ },
19893
+ {
19894
+ name: "group_count",
19895
+ type: "u8"
19896
+ },
19897
+ {
19898
+ name: "bump",
19899
+ type: "u8"
19900
+ },
19901
+ {
19902
+ name: "_padding_1",
19903
+ type: {
19904
+ array: [
19905
+ "u8",
19906
+ 4
19907
+ ]
19908
+ }
19909
+ },
19910
+ {
19911
+ name: "groups",
19912
+ docs: [
19913
+ "Describes the same-asset-emode groupings that exist"
19914
+ ],
19915
+ type: {
19916
+ array: [
19917
+ {
19918
+ defined: {
19919
+ name: "SameAssetEmodeGroup"
19920
+ }
19921
+ },
19922
+ 32
19923
+ ]
19924
+ }
19925
+ },
19926
+ {
19927
+ name: "banks",
19928
+ docs: [
19929
+ "Describes which bank belongs to which group"
19930
+ ],
19931
+ type: {
19932
+ array: [
19933
+ {
19934
+ defined: {
19935
+ name: "SameAssetEmodeBank"
19936
+ }
19937
+ },
19938
+ 128
19939
+ ]
19940
+ }
19941
+ },
19942
+ {
19943
+ name: "_padding_2",
19944
+ type: {
19945
+ array: [
19946
+ "u8",
19947
+ 1024
19948
+ ]
19949
+ }
19950
+ },
19951
+ {
19952
+ name: "_padding_3",
19953
+ type: {
19954
+ array: [
19955
+ "u8",
19956
+ 512
19957
+ ]
19958
+ }
19959
+ },
19960
+ {
19961
+ name: "_padding_4",
19962
+ type: {
19963
+ array: [
19964
+ "u8",
19965
+ 256
19966
+ ]
19967
+ }
19968
+ }
19969
+ ]
19970
+ }
19971
+ },
19165
19972
  {
19166
19973
  name: "SetKeeperCloseFlagsEvent",
19167
19974
  type: {
@@ -19887,7 +20694,7 @@ var marginfi_0_1_9_default = {
19887
20694
  };
19888
20695
 
19889
20696
  // src/idl/index.ts
19890
- var MARGINFI_IDL = marginfi_0_1_9_default;
20697
+ var MARGINFI_IDL = marginfi_0_1_10_default;
19891
20698
 
19892
20699
  // src/services/bank/types/bank.types.ts
19893
20700
  var RiskTier = /* @__PURE__ */ ((RiskTier3) => {
@@ -19902,6 +20709,7 @@ var OperationalState = /* @__PURE__ */ ((OperationalState3) => {
19902
20709
  OperationalState3["KilledByBankruptcy"] = "KilledByBankruptcy";
19903
20710
  OperationalState3["Uninitialized"] = "Uninitialized";
19904
20711
  OperationalState3["ReduceOnlyWithBorrowingPower"] = "ReduceOnlyWithBorrowingPower";
20712
+ OperationalState3["CircuitBroken"] = "CircuitBroken";
19905
20713
  return OperationalState3;
19906
20714
  })(OperationalState || {});
19907
20715
  var OracleSetup = /* @__PURE__ */ ((OracleSetup3) => {
@@ -20895,7 +21703,17 @@ function serializeBankConfigOpt(bankConfigOpt) {
20895
21703
  permissionlessBadDebtSettlement: bankConfigOpt.permissionlessBadDebtSettlement,
20896
21704
  freezeSettings: bankConfigOpt.freezeSettings,
20897
21705
  tokenlessRepaymentsAllowed: bankConfigOpt.tokenlessRepaymentsAllowed,
20898
- oracleMaxConfidence: bankConfigOpt.oracleMaxConfidence
21706
+ oracleMaxConfidence: bankConfigOpt.oracleMaxConfidence,
21707
+ liquidationLiquidatorFee: null,
21708
+ liquidationInsuranceFee: null,
21709
+ circuitBreakerEnabled: null,
21710
+ cbDeviationBpsTiers: null,
21711
+ cbTierDurationsSeconds: null,
21712
+ cbEscalationWindowMult: null,
21713
+ cbEmaAlphaBps: null,
21714
+ cbWindowSeconds: null,
21715
+ cbWindowMaxUpBps: null,
21716
+ cbWindowMaxDownBps: null
20899
21717
  };
20900
21718
  }
20901
21719
  function serializeInterestRateConfig(interestRateConfig) {
@@ -21741,6 +22559,8 @@ function parseOperationalState(operationalStateRaw) {
21741
22559
  return "Uninitialized" /* Uninitialized */;
21742
22560
  case "reduceonlywithborrowingpower":
21743
22561
  return "ReduceOnlyWithBorrowingPower" /* ReduceOnlyWithBorrowingPower */;
22562
+ case "circuitbroken":
22563
+ return "CircuitBroken" /* CircuitBroken */;
21744
22564
  default:
21745
22565
  throw new Error(`Invalid operational state "${operationalStateRaw}"`);
21746
22566
  }
@@ -68667,6 +69487,7 @@ function makeBeginFlashLoanIx2(programId, accounts, args) {
68667
69487
  function makeEndFlashLoanIx2(programId, accounts, remainingAccounts = []) {
68668
69488
  const keys = [
68669
69489
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
69490
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
68670
69491
  { pubkey: accounts.authority, isSigner: true, isWritable: false }
68671
69492
  ];
68672
69493
  keys.push(...remainingAccounts);
@@ -68875,7 +69696,8 @@ function makeCloseAccountIx2(programId, accounts) {
68875
69696
  }
68876
69697
  function makePulseHealthIx3(programId, accounts, remainingAccounts = []) {
68877
69698
  const keys = [
68878
- { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true }
69699
+ { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
69700
+ { pubkey: accounts.group, isSigner: false, isWritable: false }
68879
69701
  ];
68880
69702
  keys.push(...remainingAccounts);
68881
69703
  return new web3_js.TransactionInstruction({
@@ -68893,6 +69715,7 @@ function makeAccountTransferToNewAccountIx2(programId, accounts) {
68893
69715
  { pubkey: accounts.feePayer, isSigner: true, isWritable: true },
68894
69716
  { pubkey: accounts.newAuthority, isSigner: false, isWritable: false },
68895
69717
  { pubkey: accounts.globalFeeWallet, isSigner: false, isWritable: true },
69718
+ { pubkey: accounts.feeState, isSigner: false, isWritable: false },
68896
69719
  { pubkey: web3_js.SystemProgram.programId, isSigner: false, isWritable: false }
68897
69720
  ];
68898
69721
  return new web3_js.TransactionInstruction({
@@ -71580,12 +72403,13 @@ async function makeBeginFlashLoanIx3(program, marginfiAccountPk, endIndex, autho
71580
72403
  );
71581
72404
  return { instructions: [ix], keys: [] };
71582
72405
  }
71583
- async function makeEndFlashLoanIx3(program, marginfiAccountPk, projectedActiveBanks, authority, isSync) {
72406
+ async function makeEndFlashLoanIx3(program, marginfiAccountPk, group, projectedActiveBanks, authority, isSync) {
71584
72407
  const remainingAccounts = computeHealthAccountMetas({ banksToInclude: projectedActiveBanks });
71585
72408
  const ix = isSync && authority ? sync_instructions_default.makeEndFlashLoanIx(
71586
72409
  program.programId,
71587
72410
  {
71588
72411
  marginfiAccount: marginfiAccountPk,
72412
+ group,
71589
72413
  authority
71590
72414
  },
71591
72415
  remainingAccounts.map((account) => ({
@@ -71638,6 +72462,7 @@ async function makeFlashLoanTx({
71638
72462
  const endFlashLoanIx = await makeEndFlashLoanIx3(
71639
72463
  program,
71640
72464
  marginfiAccount.address,
72465
+ marginfiAccount.group,
71641
72466
  projectedActiveBanks,
71642
72467
  marginfiAccount.authority,
71643
72468
  isSync
@@ -72251,7 +73076,11 @@ function computeFlashLoanNonSwapBudget({
72251
73076
  });
72252
73077
  const endFlIx = sync_instructions_default.makeEndFlashLoanIx(
72253
73078
  program.programId,
72254
- { marginfiAccount: marginfiAccount.address, authority: marginfiAccount.authority },
73079
+ {
73080
+ marginfiAccount: marginfiAccount.address,
73081
+ group: marginfiAccount.group,
73082
+ authority: marginfiAccount.authority
73083
+ },
72255
73084
  endFlRemainingAccounts.map((pubkey) => ({ pubkey, isSigner: false, isWritable: false }))
72256
73085
  );
72257
73086
  const allNonSwapIxs = [beginFlIx, ...ixs, endFlIx];
@@ -73193,7 +74022,7 @@ var MarginfiAccount = class _MarginfiAccount {
73193
74022
  );
73194
74023
  }
73195
74024
  const banks = projectedActiveBanks.map((account) => bankMap.get(account.toBase58()));
73196
- return makeEndFlashLoanIx3(program, this.address, banks, authority);
74025
+ return makeEndFlashLoanIx3(program, this.address, this.group, banks, authority);
73197
74026
  }
73198
74027
  /**
73199
74028
  * Builds a transaction to transfer this account to a new authority.
@@ -75956,6 +76785,7 @@ async function buildTransferFlashloanTx(args) {
75956
76785
  const end = await makeEndFlashLoanIx3(
75957
76786
  program,
75958
76787
  accountA.address,
76788
+ accountA.group,
75959
76789
  projectedActiveBanksA,
75960
76790
  accountA.authority
75961
76791
  );