@0dotxyz/p0-ts-sdk 2.2.0-alpha.0 → 2.2.0-alpha.2

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
@@ -576,8 +576,8 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
576
576
  return bundleTipInstruction;
577
577
  }
578
578
 
579
- // src/idl/marginfi_0.1.7.json
580
- var marginfi_0_1_7_default = {
579
+ // src/idl/marginfi_0.1.8.json
580
+ var marginfi_0_1_8_default = {
581
581
  address: "",
582
582
  metadata: {
583
583
  name: "marginfi",
@@ -627,7 +627,7 @@ var marginfi_0_1_7_default = {
627
627
  {
628
628
  name: "configure_bank_rate_limits",
629
629
  docs: [
630
- "(admin only) Configure bank-level rate limits for withdraw/borrow.",
630
+ "(admin or delegate_limit_admin) Configure bank-level rate limits for withdraw/borrow.",
631
631
  "Rate limits track net outflow in native tokens. Deposits offset withdraws.",
632
632
  "Set to 0 to disable. Hourly and daily windows are independent."
633
633
  ],
@@ -639,8 +639,7 @@ var marginfi_0_1_7_default = {
639
639
  },
640
640
  {
641
641
  name: "admin",
642
- signer: true,
643
- relations: ["group"]
642
+ signer: true
644
643
  },
645
644
  {
646
645
  name: "bank",
@@ -664,7 +663,9 @@ var marginfi_0_1_7_default = {
664
663
  },
665
664
  {
666
665
  name: "configure_deleverage_withdrawal_limit",
667
- docs: ["(group admin only) Set the daily withdrawal limit for deleverages per group."],
666
+ docs: [
667
+ "(admin or delegate_limit_admin) Set the daily withdrawal limit for deleverages per group."
668
+ ],
668
669
  discriminator: [28, 132, 205, 158, 67, 77, 177, 63],
669
670
  accounts: [
670
671
  {
@@ -673,8 +674,7 @@ var marginfi_0_1_7_default = {
673
674
  },
674
675
  {
675
676
  name: "admin",
676
- signer: true,
677
- relations: ["marginfi_group"]
677
+ signer: true
678
678
  }
679
679
  ],
680
680
  args: [
@@ -687,7 +687,7 @@ var marginfi_0_1_7_default = {
687
687
  {
688
688
  name: "configure_group_rate_limits",
689
689
  docs: [
690
- "(admin only) Configure group-level rate limits for withdraw/borrow.",
690
+ "(admin or delegate_limit_admin) Configure group-level rate limits for withdraw/borrow.",
691
691
  "Rate limits track aggregate net outflow in USD.",
692
692
  "Example: $10M = 10_000_000. Set to 0 to disable."
693
693
  ],
@@ -699,8 +699,7 @@ var marginfi_0_1_7_default = {
699
699
  },
700
700
  {
701
701
  name: "admin",
702
- signer: true,
703
- relations: ["marginfi_group"]
702
+ signer: true
704
703
  }
705
704
  ],
706
705
  args: [
@@ -728,7 +727,6 @@ var marginfi_0_1_7_default = {
728
727
  accounts: [
729
728
  {
730
729
  name: "group",
731
- writable: true,
732
730
  relations: ["marginfi_account", "bank"]
733
731
  },
734
732
  {
@@ -1316,7 +1314,6 @@ var marginfi_0_1_7_default = {
1316
1314
  accounts: [
1317
1315
  {
1318
1316
  name: "group",
1319
- writable: true,
1320
1317
  relations: ["marginfi_account", "bank"]
1321
1318
  },
1322
1319
  {
@@ -1850,6 +1847,7 @@ var marginfi_0_1_7_default = {
1850
1847
  accounts: [
1851
1848
  {
1852
1849
  name: "group",
1850
+ writable: true,
1853
1851
  relations: ["marginfi_account", "bank"]
1854
1852
  },
1855
1853
  {
@@ -1858,8 +1856,7 @@ var marginfi_0_1_7_default = {
1858
1856
  },
1859
1857
  {
1860
1858
  name: "authority",
1861
- signer: true,
1862
- relations: ["marginfi_account"]
1859
+ signer: true
1863
1860
  },
1864
1861
  {
1865
1862
  name: "bank",
@@ -2149,7 +2146,6 @@ var marginfi_0_1_7_default = {
2149
2146
  accounts: [
2150
2147
  {
2151
2148
  name: "group",
2152
- writable: true,
2153
2149
  relations: ["marginfi_account", "bank"]
2154
2150
  },
2155
2151
  {
@@ -2324,7 +2320,6 @@ var marginfi_0_1_7_default = {
2324
2320
  accounts: [
2325
2321
  {
2326
2322
  name: "group",
2327
- writable: true,
2328
2323
  relations: ["marginfi_account", "bank"]
2329
2324
  },
2330
2325
  {
@@ -2853,7 +2848,6 @@ var marginfi_0_1_7_default = {
2853
2848
  accounts: [
2854
2849
  {
2855
2850
  name: "group",
2856
- writable: true,
2857
2851
  relations: ["marginfi_account", "bank"]
2858
2852
  },
2859
2853
  {
@@ -2950,12 +2944,13 @@ var marginfi_0_1_7_default = {
2950
2944
  relations: ["bank"]
2951
2945
  },
2952
2946
  {
2953
- name: "reserve_liquidity_mint",
2947
+ name: "mint",
2954
2948
  docs: [
2955
2949
  "The liquidity token mint (e.g., USDC)",
2956
2950
  "Needs serde to get the mint decimals for transfer checked"
2957
2951
  ],
2958
- writable: true
2952
+ writable: true,
2953
+ relations: ["bank"]
2959
2954
  },
2960
2955
  {
2961
2956
  name: "reserve_liquidity_supply",
@@ -3030,7 +3025,6 @@ var marginfi_0_1_7_default = {
3030
3025
  accounts: [
3031
3026
  {
3032
3027
  name: "group",
3033
- writable: true,
3034
3028
  relations: ["marginfi_account", "bank"]
3035
3029
  },
3036
3030
  {
@@ -3102,11 +3096,26 @@ var marginfi_0_1_7_default = {
3102
3096
  ]
3103
3097
  },
3104
3098
  {
3105
- name: "lending_account_close_balance",
3099
+ name: "lending_account_clear_emissions",
3106
3100
  docs: [
3107
- "(account authority) Close a balance position with dust-level amounts. Claims outstanding",
3108
- "emissions before closing."
3101
+ "(permissionless) Zero out `emissions_outstanding` on a balance after emissions are disabled",
3102
+ "on the bank."
3109
3103
  ],
3104
+ discriminator: [239, 4, 221, 98, 45, 167, 201, 244],
3105
+ accounts: [
3106
+ {
3107
+ name: "marginfi_account",
3108
+ writable: true
3109
+ },
3110
+ {
3111
+ name: "bank"
3112
+ }
3113
+ ],
3114
+ args: []
3115
+ },
3116
+ {
3117
+ name: "lending_account_close_balance",
3118
+ docs: ["(account authority) Close a balance position with dust-level amounts."],
3110
3119
  discriminator: [245, 54, 41, 4, 243, 202, 31, 17],
3111
3120
  accounts: [
3112
3121
  {
@@ -3138,7 +3147,219 @@ var marginfi_0_1_7_default = {
3138
3147
  accounts: [
3139
3148
  {
3140
3149
  name: "group",
3150
+ relations: ["marginfi_account", "bank"]
3151
+ },
3152
+ {
3153
+ name: "marginfi_account",
3154
+ writable: true
3155
+ },
3156
+ {
3157
+ name: "authority",
3158
+ signer: true
3159
+ },
3160
+ {
3161
+ name: "bank",
3162
+ writable: true
3163
+ },
3164
+ {
3165
+ name: "signer_token_account",
3166
+ writable: true
3167
+ },
3168
+ {
3169
+ name: "liquidity_vault",
3141
3170
  writable: true,
3171
+ relations: ["bank"]
3172
+ },
3173
+ {
3174
+ name: "token_program"
3175
+ }
3176
+ ],
3177
+ args: [
3178
+ {
3179
+ name: "amount",
3180
+ type: "u64"
3181
+ },
3182
+ {
3183
+ name: "deposit_up_to_limit",
3184
+ type: {
3185
+ option: "bool"
3186
+ }
3187
+ }
3188
+ ]
3189
+ },
3190
+ {
3191
+ name: "lending_account_end_flashloan",
3192
+ docs: ["(account authority) End a flash loan and run the health check."],
3193
+ discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
3194
+ accounts: [
3195
+ {
3196
+ name: "marginfi_account",
3197
+ writable: true
3198
+ },
3199
+ {
3200
+ name: "authority",
3201
+ signer: true,
3202
+ relations: ["marginfi_account"]
3203
+ }
3204
+ ],
3205
+ args: []
3206
+ },
3207
+ {
3208
+ name: "lending_account_liquidate",
3209
+ docs: [
3210
+ "(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
3211
+ "The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
3212
+ "fee + 2.5% insurance fee).",
3213
+ "* `asset_amount` - amount of collateral to liquidate",
3214
+ "* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
3215
+ "* `liquidator_accounts` - number of remaining accounts for the liquidator"
3216
+ ],
3217
+ discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
3218
+ accounts: [
3219
+ {
3220
+ name: "group",
3221
+ relations: [
3222
+ "asset_bank",
3223
+ "liab_bank",
3224
+ "liquidator_marginfi_account",
3225
+ "liquidatee_marginfi_account"
3226
+ ]
3227
+ },
3228
+ {
3229
+ name: "asset_bank",
3230
+ writable: true
3231
+ },
3232
+ {
3233
+ name: "liab_bank",
3234
+ writable: true
3235
+ },
3236
+ {
3237
+ name: "liquidator_marginfi_account",
3238
+ writable: true
3239
+ },
3240
+ {
3241
+ name: "authority",
3242
+ signer: true
3243
+ },
3244
+ {
3245
+ name: "liquidatee_marginfi_account",
3246
+ writable: true
3247
+ },
3248
+ {
3249
+ name: "bank_liquidity_vault_authority",
3250
+ pda: {
3251
+ seeds: [
3252
+ {
3253
+ kind: "const",
3254
+ value: [
3255
+ 108,
3256
+ 105,
3257
+ 113,
3258
+ 117,
3259
+ 105,
3260
+ 100,
3261
+ 105,
3262
+ 116,
3263
+ 121,
3264
+ 95,
3265
+ 118,
3266
+ 97,
3267
+ 117,
3268
+ 108,
3269
+ 116,
3270
+ 95,
3271
+ 97,
3272
+ 117,
3273
+ 116,
3274
+ 104
3275
+ ]
3276
+ },
3277
+ {
3278
+ kind: "account",
3279
+ path: "liab_bank"
3280
+ }
3281
+ ]
3282
+ }
3283
+ },
3284
+ {
3285
+ name: "bank_liquidity_vault",
3286
+ writable: true,
3287
+ pda: {
3288
+ seeds: [
3289
+ {
3290
+ kind: "const",
3291
+ value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
3292
+ },
3293
+ {
3294
+ kind: "account",
3295
+ path: "liab_bank"
3296
+ }
3297
+ ]
3298
+ }
3299
+ },
3300
+ {
3301
+ name: "bank_insurance_vault",
3302
+ writable: true,
3303
+ pda: {
3304
+ seeds: [
3305
+ {
3306
+ kind: "const",
3307
+ value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
3308
+ },
3309
+ {
3310
+ kind: "account",
3311
+ path: "liab_bank"
3312
+ }
3313
+ ]
3314
+ }
3315
+ },
3316
+ {
3317
+ name: "token_program"
3318
+ }
3319
+ ],
3320
+ args: [
3321
+ {
3322
+ name: "asset_amount",
3323
+ type: "u64"
3324
+ },
3325
+ {
3326
+ name: "liquidatee_accounts",
3327
+ type: "u8"
3328
+ },
3329
+ {
3330
+ name: "liquidator_accounts",
3331
+ type: "u8"
3332
+ }
3333
+ ]
3334
+ },
3335
+ {
3336
+ name: "lending_account_pulse_health",
3337
+ docs: [
3338
+ "(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
3339
+ "other consumers that want to see the internal risk state of a user account. This cache is",
3340
+ "read-only and serves no purpose except being populated by this ix.",
3341
+ "* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
3342
+ "user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
3343
+ ],
3344
+ discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
3345
+ accounts: [
3346
+ {
3347
+ name: "marginfi_account",
3348
+ writable: true
3349
+ }
3350
+ ],
3351
+ args: []
3352
+ },
3353
+ {
3354
+ name: "lending_account_repay",
3355
+ docs: [
3356
+ "(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
3357
+ "interest, records repayment, and transfers tokens to the bank's liquidity vault."
3358
+ ],
3359
+ discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
3360
+ accounts: [
3361
+ {
3362
+ name: "group",
3142
3363
  relations: ["marginfi_account", "bank"]
3143
3364
  },
3144
3365
  {
@@ -3147,226 +3368,12 @@ var marginfi_0_1_7_default = {
3147
3368
  },
3148
3369
  {
3149
3370
  name: "authority",
3150
- signer: true
3151
- },
3152
- {
3153
- name: "bank",
3154
- writable: true
3155
- },
3156
- {
3157
- name: "signer_token_account",
3158
- writable: true
3159
- },
3160
- {
3161
- name: "liquidity_vault",
3162
- writable: true,
3163
- relations: ["bank"]
3164
- },
3165
- {
3166
- name: "token_program"
3167
- }
3168
- ],
3169
- args: [
3170
- {
3171
- name: "amount",
3172
- type: "u64"
3173
- },
3174
- {
3175
- name: "deposit_up_to_limit",
3176
- type: {
3177
- option: "bool"
3178
- }
3179
- }
3180
- ]
3181
- },
3182
- {
3183
- name: "lending_account_end_flashloan",
3184
- docs: ["(account authority) End a flash loan and run the health check."],
3185
- discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
3186
- accounts: [
3187
- {
3188
- name: "marginfi_account",
3189
- writable: true
3190
- },
3191
- {
3192
- name: "authority",
3193
- signer: true,
3194
- relations: ["marginfi_account"]
3195
- }
3196
- ],
3197
- args: []
3198
- },
3199
- {
3200
- name: "lending_account_liquidate",
3201
- docs: [
3202
- "(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
3203
- "The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
3204
- "fee + 2.5% insurance fee).",
3205
- "* `asset_amount` - amount of collateral to liquidate",
3206
- "* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
3207
- "* `liquidator_accounts` - number of remaining accounts for the liquidator"
3208
- ],
3209
- discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
3210
- accounts: [
3211
- {
3212
- name: "group",
3213
- relations: [
3214
- "asset_bank",
3215
- "liab_bank",
3216
- "liquidator_marginfi_account",
3217
- "liquidatee_marginfi_account"
3218
- ]
3219
- },
3220
- {
3221
- name: "asset_bank",
3222
- writable: true
3223
- },
3224
- {
3225
- name: "liab_bank",
3226
- writable: true
3227
- },
3228
- {
3229
- name: "liquidator_marginfi_account",
3230
- writable: true
3231
- },
3232
- {
3233
- name: "authority",
3234
- signer: true
3235
- },
3236
- {
3237
- name: "liquidatee_marginfi_account",
3238
- writable: true
3239
- },
3240
- {
3241
- name: "bank_liquidity_vault_authority",
3242
- pda: {
3243
- seeds: [
3244
- {
3245
- kind: "const",
3246
- value: [
3247
- 108,
3248
- 105,
3249
- 113,
3250
- 117,
3251
- 105,
3252
- 100,
3253
- 105,
3254
- 116,
3255
- 121,
3256
- 95,
3257
- 118,
3258
- 97,
3259
- 117,
3260
- 108,
3261
- 116,
3262
- 95,
3263
- 97,
3264
- 117,
3265
- 116,
3266
- 104
3267
- ]
3268
- },
3269
- {
3270
- kind: "account",
3271
- path: "liab_bank"
3272
- }
3273
- ]
3274
- }
3275
- },
3276
- {
3277
- name: "bank_liquidity_vault",
3278
- writable: true,
3279
- pda: {
3280
- seeds: [
3281
- {
3282
- kind: "const",
3283
- value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
3284
- },
3285
- {
3286
- kind: "account",
3287
- path: "liab_bank"
3288
- }
3289
- ]
3290
- }
3291
- },
3292
- {
3293
- name: "bank_insurance_vault",
3294
- writable: true,
3295
- pda: {
3296
- seeds: [
3297
- {
3298
- kind: "const",
3299
- value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
3300
- },
3301
- {
3302
- kind: "account",
3303
- path: "liab_bank"
3304
- }
3305
- ]
3306
- }
3307
- },
3308
- {
3309
- name: "token_program"
3310
- }
3311
- ],
3312
- args: [
3313
- {
3314
- name: "asset_amount",
3315
- type: "u64"
3316
- },
3317
- {
3318
- name: "liquidatee_accounts",
3319
- type: "u8"
3320
- },
3321
- {
3322
- name: "liquidator_accounts",
3323
- type: "u8"
3324
- }
3325
- ]
3326
- },
3327
- {
3328
- name: "lending_account_pulse_health",
3329
- docs: [
3330
- "(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
3331
- "other consumers that want to see the internal risk state of a user account. This cache is",
3332
- "read-only and serves no purpose except being populated by this ix.",
3333
- "* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
3334
- "user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
3335
- ],
3336
- discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
3337
- accounts: [
3338
- {
3339
- name: "marginfi_account",
3340
- writable: true
3341
- }
3342
- ],
3343
- args: []
3344
- },
3345
- {
3346
- name: "lending_account_repay",
3347
- docs: [
3348
- "(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
3349
- "interest, records repayment, and transfers tokens to the bank's liquidity vault."
3350
- ],
3351
- discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
3352
- accounts: [
3353
- {
3354
- name: "group",
3355
- writable: true,
3356
- relations: ["marginfi_account", "bank"]
3357
- },
3358
- {
3359
- name: "marginfi_account",
3360
- writable: true
3361
- },
3362
- {
3363
- name: "authority",
3364
- docs: [
3365
- "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
3366
- "",
3367
- "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
3368
- "long as the invariants checked at the end of execution are met."
3369
- ],
3371
+ docs: [
3372
+ "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
3373
+ "",
3374
+ "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
3375
+ "long as the invariants checked at the end of execution are met."
3376
+ ],
3370
3377
  signer: true
3371
3378
  },
3372
3379
  {
@@ -3399,24 +3406,6 @@ var marginfi_0_1_7_default = {
3399
3406
  }
3400
3407
  ]
3401
3408
  },
3402
- {
3403
- name: "lending_account_settle_emissions",
3404
- docs: [
3405
- "(permissionless) Settle unclaimed emissions into a user's balance without withdrawing."
3406
- ],
3407
- discriminator: [161, 58, 136, 174, 242, 223, 156, 176],
3408
- accounts: [
3409
- {
3410
- name: "marginfi_account",
3411
- writable: true
3412
- },
3413
- {
3414
- name: "bank",
3415
- writable: true
3416
- }
3417
- ],
3418
- args: []
3419
- },
3420
3409
  {
3421
3410
  name: "lending_account_start_flashloan",
3422
3411
  docs: [
@@ -3457,7 +3446,6 @@ var marginfi_0_1_7_default = {
3457
3446
  accounts: [
3458
3447
  {
3459
3448
  name: "group",
3460
- writable: true,
3461
3449
  relations: ["marginfi_account", "bank"]
3462
3450
  },
3463
3451
  {
@@ -3540,253 +3528,6 @@ var marginfi_0_1_7_default = {
3540
3528
  }
3541
3529
  ]
3542
3530
  },
3543
- {
3544
- name: "lending_account_withdraw_emissions",
3545
- docs: [
3546
- "(account authority) Settle and withdraw emissions rewards to a destination token account."
3547
- ],
3548
- discriminator: [234, 22, 84, 214, 118, 176, 140, 170],
3549
- accounts: [
3550
- {
3551
- name: "group",
3552
- relations: ["marginfi_account", "bank"]
3553
- },
3554
- {
3555
- name: "marginfi_account",
3556
- writable: true
3557
- },
3558
- {
3559
- name: "authority",
3560
- signer: true
3561
- },
3562
- {
3563
- name: "bank",
3564
- writable: true
3565
- },
3566
- {
3567
- name: "emissions_mint",
3568
- relations: ["bank"]
3569
- },
3570
- {
3571
- name: "emissions_auth",
3572
- pda: {
3573
- seeds: [
3574
- {
3575
- kind: "const",
3576
- value: [
3577
- 101,
3578
- 109,
3579
- 105,
3580
- 115,
3581
- 115,
3582
- 105,
3583
- 111,
3584
- 110,
3585
- 115,
3586
- 95,
3587
- 97,
3588
- 117,
3589
- 116,
3590
- 104,
3591
- 95,
3592
- 115,
3593
- 101,
3594
- 101,
3595
- 100
3596
- ]
3597
- },
3598
- {
3599
- kind: "account",
3600
- path: "bank"
3601
- },
3602
- {
3603
- kind: "account",
3604
- path: "emissions_mint"
3605
- }
3606
- ]
3607
- }
3608
- },
3609
- {
3610
- name: "emissions_vault",
3611
- writable: true,
3612
- pda: {
3613
- seeds: [
3614
- {
3615
- kind: "const",
3616
- value: [
3617
- 101,
3618
- 109,
3619
- 105,
3620
- 115,
3621
- 115,
3622
- 105,
3623
- 111,
3624
- 110,
3625
- 115,
3626
- 95,
3627
- 116,
3628
- 111,
3629
- 107,
3630
- 101,
3631
- 110,
3632
- 95,
3633
- 97,
3634
- 99,
3635
- 99,
3636
- 111,
3637
- 117,
3638
- 110,
3639
- 116,
3640
- 95,
3641
- 115,
3642
- 101,
3643
- 101,
3644
- 100
3645
- ]
3646
- },
3647
- {
3648
- kind: "account",
3649
- path: "bank"
3650
- },
3651
- {
3652
- kind: "account",
3653
- path: "emissions_mint"
3654
- }
3655
- ]
3656
- }
3657
- },
3658
- {
3659
- name: "destination_account",
3660
- writable: true
3661
- },
3662
- {
3663
- name: "token_program"
3664
- }
3665
- ],
3666
- args: []
3667
- },
3668
- {
3669
- name: "lending_account_withdraw_emissions_permissionless",
3670
- docs: [
3671
- "(permissionless) Withdraw emissions to the user's pre-configured emissions destination ATA."
3672
- ],
3673
- discriminator: [4, 174, 124, 203, 44, 49, 145, 150],
3674
- accounts: [
3675
- {
3676
- name: "group",
3677
- relations: ["marginfi_account", "bank"]
3678
- },
3679
- {
3680
- name: "marginfi_account",
3681
- writable: true
3682
- },
3683
- {
3684
- name: "bank",
3685
- writable: true
3686
- },
3687
- {
3688
- name: "emissions_mint",
3689
- relations: ["bank"]
3690
- },
3691
- {
3692
- name: "emissions_auth",
3693
- pda: {
3694
- seeds: [
3695
- {
3696
- kind: "const",
3697
- value: [
3698
- 101,
3699
- 109,
3700
- 105,
3701
- 115,
3702
- 115,
3703
- 105,
3704
- 111,
3705
- 110,
3706
- 115,
3707
- 95,
3708
- 97,
3709
- 117,
3710
- 116,
3711
- 104,
3712
- 95,
3713
- 115,
3714
- 101,
3715
- 101,
3716
- 100
3717
- ]
3718
- },
3719
- {
3720
- kind: "account",
3721
- path: "bank"
3722
- },
3723
- {
3724
- kind: "account",
3725
- path: "emissions_mint"
3726
- }
3727
- ]
3728
- }
3729
- },
3730
- {
3731
- name: "emissions_vault",
3732
- writable: true,
3733
- pda: {
3734
- seeds: [
3735
- {
3736
- kind: "const",
3737
- value: [
3738
- 101,
3739
- 109,
3740
- 105,
3741
- 115,
3742
- 115,
3743
- 105,
3744
- 111,
3745
- 110,
3746
- 115,
3747
- 95,
3748
- 116,
3749
- 111,
3750
- 107,
3751
- 101,
3752
- 110,
3753
- 95,
3754
- 97,
3755
- 99,
3756
- 99,
3757
- 111,
3758
- 117,
3759
- 110,
3760
- 116,
3761
- 95,
3762
- 115,
3763
- 101,
3764
- 101,
3765
- 100
3766
- ]
3767
- },
3768
- {
3769
- kind: "account",
3770
- path: "bank"
3771
- },
3772
- {
3773
- kind: "account",
3774
- path: "emissions_mint"
3775
- }
3776
- ]
3777
- }
3778
- },
3779
- {
3780
- name: "destination_account",
3781
- docs: ["registered on `marginfi_account`"],
3782
- writable: true
3783
- },
3784
- {
3785
- name: "token_program"
3786
- }
3787
- ],
3788
- args: []
3789
- },
3790
3531
  {
3791
3532
  name: "lending_pool_accrue_bank_interest",
3792
3533
  docs: [
@@ -6188,7 +5929,6 @@ var marginfi_0_1_7_default = {
6188
5929
  accounts: [
6189
5930
  {
6190
5931
  name: "group",
6191
- writable: true,
6192
5932
  relations: ["bank"]
6193
5933
  },
6194
5934
  {
@@ -6199,50 +5939,17 @@ var marginfi_0_1_7_default = {
6199
5939
  args: []
6200
5940
  },
6201
5941
  {
6202
- name: "lending_pool_set_fixed_oracle_price",
6203
- docs: ["(admin only)"],
6204
- discriminator: [28, 126, 127, 127, 60, 37, 211, 125],
6205
- accounts: [
6206
- {
6207
- name: "group",
6208
- relations: ["bank"]
6209
- },
6210
- {
6211
- name: "admin",
6212
- signer: true,
6213
- relations: ["group"]
6214
- },
6215
- {
6216
- name: "bank",
6217
- writable: true
6218
- }
5942
+ name: "lending_pool_reclaim_emissions_vault",
5943
+ docs: [
5944
+ "(permissionless) Reclaim all remaining tokens from the emissions vault",
5945
+ "to the global fee wallet ATA, and disable emissions on the bank."
6219
5946
  ],
6220
- args: [
6221
- {
6222
- name: "price",
6223
- type: {
6224
- defined: {
6225
- name: "WrappedI80F48"
6226
- }
6227
- }
6228
- }
6229
- ]
6230
- },
6231
- {
6232
- name: "lending_pool_setup_emissions",
6233
- docs: ["(delegate_emissions_admin only)"],
6234
- discriminator: [206, 97, 120, 172, 113, 204, 169, 70],
5947
+ discriminator: [206, 67, 186, 225, 41, 30, 95, 216],
6235
5948
  accounts: [
6236
5949
  {
6237
5950
  name: "group",
6238
5951
  relations: ["bank"]
6239
5952
  },
6240
- {
6241
- name: "delegate_emissions_admin",
6242
- writable: true,
6243
- signer: true,
6244
- relations: ["group"]
6245
- },
6246
5953
  {
6247
5954
  name: "bank",
6248
5955
  writable: true
@@ -6290,106 +5997,7 @@ var marginfi_0_1_7_default = {
6290
5997
  }
6291
5998
  },
6292
5999
  {
6293
- name: "emissions_token_account",
6294
- writable: true,
6295
- pda: {
6296
- seeds: [
6297
- {
6298
- kind: "const",
6299
- value: [
6300
- 101,
6301
- 109,
6302
- 105,
6303
- 115,
6304
- 115,
6305
- 105,
6306
- 111,
6307
- 110,
6308
- 115,
6309
- 95,
6310
- 116,
6311
- 111,
6312
- 107,
6313
- 101,
6314
- 110,
6315
- 95,
6316
- 97,
6317
- 99,
6318
- 99,
6319
- 111,
6320
- 117,
6321
- 110,
6322
- 116,
6323
- 95,
6324
- 115,
6325
- 101,
6326
- 101,
6327
- 100
6328
- ]
6329
- },
6330
- {
6331
- kind: "account",
6332
- path: "bank"
6333
- },
6334
- {
6335
- kind: "account",
6336
- path: "emissions_mint"
6337
- }
6338
- ]
6339
- }
6340
- },
6341
- {
6342
- name: "emissions_funding_account",
6343
- docs: ["NOTE: This is a TokenAccount, spl transfer will validate it.", ""],
6344
- writable: true
6345
- },
6346
- {
6347
- name: "token_program"
6348
- },
6349
- {
6350
- name: "system_program",
6351
- address: "11111111111111111111111111111111"
6352
- }
6353
- ],
6354
- args: [
6355
- {
6356
- name: "flags",
6357
- type: "u64"
6358
- },
6359
- {
6360
- name: "rate",
6361
- type: "u64"
6362
- },
6363
- {
6364
- name: "total_emissions",
6365
- type: "u64"
6366
- }
6367
- ]
6368
- },
6369
- {
6370
- name: "lending_pool_update_emissions_parameters",
6371
- docs: ["(delegate_emissions_admin only)"],
6372
- discriminator: [55, 213, 224, 168, 153, 53, 197, 40],
6373
- accounts: [
6374
- {
6375
- name: "group",
6376
- relations: ["bank"]
6377
- },
6378
- {
6379
- name: "delegate_emissions_admin",
6380
- writable: true,
6381
- signer: true,
6382
- relations: ["group"]
6383
- },
6384
- {
6385
- name: "bank",
6386
- writable: true
6387
- },
6388
- {
6389
- name: "emissions_mint"
6390
- },
6391
- {
6392
- name: "emissions_token_account",
6000
+ name: "emissions_vault",
6393
6001
  writable: true,
6394
6002
  pda: {
6395
6003
  seeds: [
@@ -6438,30 +6046,53 @@ var marginfi_0_1_7_default = {
6438
6046
  }
6439
6047
  },
6440
6048
  {
6441
- name: "emissions_funding_account",
6049
+ name: "fee_state",
6050
+ pda: {
6051
+ seeds: [
6052
+ {
6053
+ kind: "const",
6054
+ value: [102, 101, 101, 115, 116, 97, 116, 101]
6055
+ }
6056
+ ]
6057
+ }
6058
+ },
6059
+ {
6060
+ name: "destination_account",
6061
+ docs: ["emissions mint (validated in handler)."],
6442
6062
  writable: true
6443
6063
  },
6444
6064
  {
6445
6065
  name: "token_program"
6446
6066
  }
6447
6067
  ],
6448
- args: [
6068
+ args: []
6069
+ },
6070
+ {
6071
+ name: "lending_pool_set_fixed_oracle_price",
6072
+ docs: ["(admin only)"],
6073
+ discriminator: [28, 126, 127, 127, 60, 37, 211, 125],
6074
+ accounts: [
6449
6075
  {
6450
- name: "emissions_flags",
6451
- type: {
6452
- option: "u64"
6453
- }
6076
+ name: "group",
6077
+ relations: ["bank"]
6454
6078
  },
6455
6079
  {
6456
- name: "emissions_rate",
6457
- type: {
6458
- option: "u64"
6459
- }
6080
+ name: "admin",
6081
+ signer: true,
6082
+ relations: ["group"]
6460
6083
  },
6461
6084
  {
6462
- name: "additional_emissions",
6085
+ name: "bank",
6086
+ writable: true
6087
+ }
6088
+ ],
6089
+ args: [
6090
+ {
6091
+ name: "price",
6463
6092
  type: {
6464
- option: "u64"
6093
+ defined: {
6094
+ name: "WrappedI80F48"
6095
+ }
6465
6096
  }
6466
6097
  }
6467
6098
  ]
@@ -6971,7 +6602,7 @@ var marginfi_0_1_7_default = {
6971
6602
  name: "marginfi_account_keeper_close_order",
6972
6603
  docs: [
6973
6604
  "(permissionless keeper) Close an existing Order after the user account was closed, or it no",
6974
- "longer as the associated positions, or the user has executed",
6605
+ "longer has the associated positions, or the user has executed",
6975
6606
  "`marginfi_account_set_keeper_close_flags`. Keeper keeps the rent."
6976
6607
  ],
6977
6608
  discriminator: [128, 114, 71, 46, 194, 71, 186, 106],
@@ -7197,8 +6828,7 @@ var marginfi_0_1_7_default = {
7197
6828
  {
7198
6829
  name: "marginfi_account_update_emissions_destination_account",
7199
6830
  docs: [
7200
- "(account authority) Set the wallet whose canonical ATA will receive permissionless emissions",
7201
- "withdrawals."
6831
+ "(account authority) Set the wallet whose canonical ATA will receive off-chain emissions."
7202
6832
  ],
7203
6833
  discriminator: [73, 185, 162, 201, 111, 24, 116, 185],
7204
6834
  accounts: [
@@ -7208,12 +6838,11 @@ var marginfi_0_1_7_default = {
7208
6838
  },
7209
6839
  {
7210
6840
  name: "authority",
7211
- signer: true,
7212
- relations: ["marginfi_account"]
6841
+ signer: true
7213
6842
  },
7214
6843
  {
7215
6844
  name: "destination_account",
7216
- docs: ["User's earned emissions will be sent to the canonical ATA of this wallet.", ""]
6845
+ docs: ["the canonical ATA for each emissions mint."]
7217
6846
  }
7218
6847
  ],
7219
6848
  args: []
@@ -7262,6 +6891,12 @@ var marginfi_0_1_7_default = {
7262
6891
  option: "pubkey"
7263
6892
  }
7264
6893
  },
6894
+ {
6895
+ name: "new_flow_admin",
6896
+ type: {
6897
+ option: "pubkey"
6898
+ }
6899
+ },
7265
6900
  {
7266
6901
  name: "new_emissions_admin",
7267
6902
  type: {
@@ -7510,7 +7145,6 @@ var marginfi_0_1_7_default = {
7510
7145
  accounts: [
7511
7146
  {
7512
7147
  name: "group",
7513
- writable: true,
7514
7148
  relations: ["marginfi_account", "bank"]
7515
7149
  },
7516
7150
  {
@@ -7832,7 +7466,6 @@ var marginfi_0_1_7_default = {
7832
7466
  accounts: [
7833
7467
  {
7834
7468
  name: "group",
7835
- writable: true,
7836
7469
  relations: ["marginfi_account", "bank"]
7837
7470
  },
7838
7471
  {
@@ -8172,6 +7805,91 @@ var marginfi_0_1_7_default = {
8172
7805
  }
8173
7806
  ]
8174
7807
  },
7808
+ {
7809
+ name: "update_deleverage_withdrawals",
7810
+ docs: [
7811
+ "(delegate_flow_admin only) Update the deleverage daily withdraw outflow with",
7812
+ "aggregated data. The delegate flow admin aggregates",
7813
+ "`DeleverageWithdrawFlowEvent` events off-chain and calls this instruction at intervals."
7814
+ ],
7815
+ discriminator: [56, 3, 181, 118, 27, 247, 207, 227],
7816
+ accounts: [
7817
+ {
7818
+ name: "marginfi_group",
7819
+ writable: true
7820
+ },
7821
+ {
7822
+ name: "delegate_flow_admin",
7823
+ signer: true,
7824
+ relations: ["marginfi_group"]
7825
+ }
7826
+ ],
7827
+ args: [
7828
+ {
7829
+ name: "outflow_usd",
7830
+ type: "u32"
7831
+ },
7832
+ {
7833
+ name: "update_seq",
7834
+ type: "u64"
7835
+ },
7836
+ {
7837
+ name: "event_start_slot",
7838
+ type: "u64"
7839
+ },
7840
+ {
7841
+ name: "event_end_slot",
7842
+ type: "u64"
7843
+ }
7844
+ ]
7845
+ },
7846
+ {
7847
+ name: "update_group_rate_limiter",
7848
+ docs: [
7849
+ "(delegate_flow_admin only) Update the group rate limiter with aggregated",
7850
+ "inflow/outflow. The delegate flow admin aggregates",
7851
+ "`RateLimitFlowEvent` events off-chain, converts to USD, and calls this instruction at",
7852
+ "intervals to update group rate limiter state."
7853
+ ],
7854
+ discriminator: [23, 78, 60, 139, 187, 44, 129, 37],
7855
+ accounts: [
7856
+ {
7857
+ name: "marginfi_group",
7858
+ writable: true
7859
+ },
7860
+ {
7861
+ name: "delegate_flow_admin",
7862
+ signer: true,
7863
+ relations: ["marginfi_group"]
7864
+ }
7865
+ ],
7866
+ args: [
7867
+ {
7868
+ name: "outflow_usd",
7869
+ type: {
7870
+ option: "u64"
7871
+ }
7872
+ },
7873
+ {
7874
+ name: "inflow_usd",
7875
+ type: {
7876
+ option: "u64"
7877
+ }
7878
+ },
7879
+ {
7880
+ name: "update_seq",
7881
+ type: "u64"
7882
+ },
7883
+ {
7884
+ name: "event_start_slot",
7885
+ type: "u64"
7886
+ },
7887
+ {
7888
+ name: "event_end_slot",
7889
+ type: "u64"
7890
+ }
7891
+ ]
7892
+ },
8175
7893
  {
8176
7894
  name: "write_bank_metadata",
8177
7895
  docs: [
@@ -8282,6 +8000,10 @@ var marginfi_0_1_7_default = {
8282
8000
  name: "DeleverageEvent",
8283
8001
  discriminator: [161, 8, 108, 204, 209, 198, 12, 30]
8284
8002
  },
8003
+ {
8004
+ name: "DeleverageWithdrawFlowEvent",
8005
+ discriminator: [109, 90, 139, 200, 10, 204, 84, 176]
8006
+ },
8285
8007
  {
8286
8008
  name: "EditStakedSettingsEvent",
8287
8009
  discriminator: [29, 58, 155, 191, 75, 220, 145, 206]
@@ -8378,6 +8100,10 @@ var marginfi_0_1_7_default = {
8378
8100
  name: "MarginfiGroupCreateEvent",
8379
8101
  discriminator: [233, 125, 61, 14, 98, 240, 136, 253]
8380
8102
  },
8103
+ {
8104
+ name: "RateLimitFlowEvent",
8105
+ discriminator: [229, 5, 73, 200, 0, 107, 105, 109]
8106
+ },
8381
8107
  {
8382
8108
  name: "SetKeeperCloseFlagsEvent",
8383
8109
  discriminator: [193, 230, 93, 128, 117, 87, 96, 21]
@@ -8984,6 +8710,66 @@ var marginfi_0_1_7_default = {
8984
8710
  name: "InvalidRateLimitPrice",
8985
8711
  msg: "Invalid rate limit price: pass oracle or pre-crank cache"
8986
8712
  },
8713
+ {
8714
+ code: 6120,
8715
+ name: "GroupRateLimiterUpdateEmpty",
8716
+ msg: "Group rate limiter admin update must include inflow and/or outflow"
8717
+ },
8718
+ {
8719
+ code: 6121,
8720
+ name: "GroupRateLimiterUpdateInvalidSlotRange",
8721
+ msg: "Group rate limiter admin update slot range is invalid"
8722
+ },
8723
+ {
8724
+ code: 6122,
8725
+ name: "GroupRateLimiterUpdateFutureSlot",
8726
+ msg: "Group rate limiter admin update cannot reference future slots"
8727
+ },
8728
+ {
8729
+ code: 6123,
8730
+ name: "GroupRateLimiterUpdateStale",
8731
+ msg: "Group rate limiter admin update is too stale"
8732
+ },
8733
+ {
8734
+ code: 6124,
8735
+ name: "GroupRateLimiterUpdateOutOfOrderSlot",
8736
+ msg: "Group rate limiter admin update slot progression is out of order"
8737
+ },
8738
+ {
8739
+ code: 6125,
8740
+ name: "GroupRateLimiterUpdateOutOfOrderSeq",
8741
+ msg: "Group rate limiter admin update sequence is out of order"
8742
+ },
8743
+ {
8744
+ code: 6126,
8745
+ name: "DeleverageWithdrawalUpdateEmpty",
8746
+ msg: "Deleverage withdrawal admin update must include outflow"
8747
+ },
8748
+ {
8749
+ code: 6127,
8750
+ name: "DeleverageWithdrawalUpdateInvalidSlotRange",
8751
+ msg: "Deleverage withdrawal admin update slot range is invalid"
8752
+ },
8753
+ {
8754
+ code: 6128,
8755
+ name: "DeleverageWithdrawalUpdateFutureSlot",
8756
+ msg: "Deleverage withdrawal admin update cannot reference future slots"
8757
+ },
8758
+ {
8759
+ code: 6129,
8760
+ name: "DeleverageWithdrawalUpdateStale",
8761
+ msg: "Deleverage withdrawal admin update is too stale"
8762
+ },
8763
+ {
8764
+ code: 6130,
8765
+ name: "DeleverageWithdrawalUpdateOutOfOrderSlot",
8766
+ msg: "Deleverage withdrawal admin update slot progression is out of order"
8767
+ },
8768
+ {
8769
+ code: 6131,
8770
+ name: "DeleverageWithdrawalUpdateOutOfOrderSeq",
8771
+ msg: "Deleverage withdrawal admin update sequence is out of order"
8772
+ },
8987
8773
  {
8988
8774
  code: 6200,
8989
8775
  name: "WrongAssetTagForStandardInstructions",
@@ -9789,7 +9575,7 @@ var marginfi_0_1_7_default = {
9789
9575
  {
9790
9576
  name: "_pad_0",
9791
9577
  type: {
9792
- array: ["u8", 8]
9578
+ array: ["u8", 16]
9793
9579
  }
9794
9580
  },
9795
9581
  {
@@ -9907,8 +9693,10 @@ var marginfi_0_1_7_default = {
9907
9693
  "Liquidate as an additional safeguard, if the liquidation prices stored here were to be",
9908
9694
  "edited between start and end, it would completely break the risk engine. End validates that",
9909
9695
  "the lock is set, panics if not, and removes it - which prevents footguns if the cache was",
9910
- "e.g. accidently set to default. The lock is also removed when a Balance is closed with",
9911
- "repay_all or withdraw_all, since those Balances can be omitted from the risk check at End."
9696
+ "e.g. accidently set to default. The lock is also removed when a Balance is closed via",
9697
+ "withdraw_all, repay_all, or close_balance, but only when the account has",
9698
+ "ACCOUNT_IN_RECEIVERSHIP set, so that operations on unrelated accounts sharing the same",
9699
+ "bank do not interfere with an in-progress liquidation."
9912
9700
  ],
9913
9701
  type: "u8"
9914
9702
  },
@@ -10551,16 +10339,6 @@ var marginfi_0_1_7_default = {
10551
10339
  name: "RateLimitWindow"
10552
10340
  }
10553
10341
  }
10554
- },
10555
- {
10556
- name: "untracked_inflow",
10557
- docs: [
10558
- "Native token inflows pending USD conversion for group rate limiter.",
10559
- "When deposits/repays occur without a valid oracle price, the amount is",
10560
- "recorded here and later applied to the group rate limiter when a valid",
10561
- "price becomes available (e.g., during pulse_bank_price_cache or outflow operations)."
10562
- ],
10563
- type: "i64"
10564
10342
  }
10565
10343
  ]
10566
10344
  }
@@ -10589,6 +10367,41 @@ var marginfi_0_1_7_default = {
10589
10367
  ]
10590
10368
  }
10591
10369
  },
10370
+ {
10371
+ name: "DeleverageWithdrawFlowEvent",
10372
+ docs: [
10373
+ "Emitted for deleverage-only withdraw outflows.",
10374
+ "The delegate flow admin aggregates these off-chain and",
10375
+ "updates the deleverage daily withdraws via `update_deleverage_withdrawals`."
10376
+ ],
10377
+ type: {
10378
+ kind: "struct",
10379
+ fields: [
10380
+ {
10381
+ name: "group",
10382
+ type: "pubkey"
10383
+ },
10384
+ {
10385
+ name: "bank",
10386
+ type: "pubkey"
10387
+ },
10388
+ {
10389
+ name: "mint",
10390
+ type: "pubkey"
10391
+ },
10392
+ {
10393
+ name: "outflow_usd",
10394
+ docs: ["Equity-denominated outflow value in USD, rounded to integer."],
10395
+ type: "u32"
10396
+ },
10397
+ {
10398
+ name: "current_timestamp",
10399
+ docs: ["Unix timestamp when the flow was recorded"],
10400
+ type: "i64"
10401
+ }
10402
+ ]
10403
+ }
10404
+ },
10592
10405
  {
10593
10406
  name: "DriftConfigCompact",
10594
10407
  docs: [
@@ -11897,7 +11710,7 @@ var marginfi_0_1_7_default = {
11897
11710
  "(i.e. no implicit padding). This is important because `Pubkey` has alignment=1 while `u64`",
11898
11711
  "has alignment=8; using plain `repr(C)` would insert padding before the first `u64`."
11899
11712
  ],
11900
- serialization: "bytemuckunsafe",
11713
+ serialization: "bytemuck",
11901
11714
  repr: {
11902
11715
  kind: "c",
11903
11716
  packed: true
@@ -12744,12 +12557,7 @@ var marginfi_0_1_7_default = {
12744
12557
  },
12745
12558
  {
12746
12559
  name: "emissions_destination_account",
12747
- docs: [
12748
- "Set with `update_emissions_destination_account`. Emissions rewards can be withdrawn to the",
12749
- "canonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).",
12750
- "If pubkey default, the user has not opted into this feature, and must claim emissions",
12751
- "manually (withdraw_emissions)."
12752
- ],
12560
+ docs: ["Wallet whose canonical ATA receives off-chain emissions distributions."],
12753
12561
  type: "pubkey"
12754
12562
  },
12755
12563
  {
@@ -13022,7 +12830,7 @@ var marginfi_0_1_7_default = {
13022
12830
  name: "emode_admin",
13023
12831
  docs: [
13024
12832
  "This admin can configure collateral ratios above (but not below) the collateral ratio of",
13025
- "certain banks , e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
12833
+ "certain banks, e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
13026
12834
  "the default rate."
13027
12835
  ],
13028
12836
  type: "pubkey"
@@ -13123,6 +12931,40 @@ var marginfi_0_1_7_default = {
13123
12931
  }
13124
12932
  }
13125
12933
  },
12934
+ {
12935
+ name: "rate_limiter_last_admin_update_slot",
12936
+ docs: ["Last slot covered by an admin group rate limiter aggregation update."],
12937
+ type: "u64"
12938
+ },
12939
+ {
12940
+ name: "rate_limiter_last_admin_update_seq",
12941
+ docs: [
12942
+ "Monotonic sequence number for admin group rate limiter updates.",
12943
+ "This is used to enforce strict ordering and prevent duplicate/replayed batches",
12944
+ "when slot ranges overlap or multiple updates happen in the same slot."
12945
+ ],
12946
+ type: "u64"
12947
+ },
12948
+ {
12949
+ name: "deleverage_withdraw_last_admin_update_slot",
12950
+ docs: ["Last slot covered by an admin deleverage withdraw-limit aggregation update."],
12951
+ type: "u64"
12952
+ },
12953
+ {
12954
+ name: "deleverage_withdraw_last_admin_update_seq",
12955
+ docs: ["Monotonic sequence number for admin deleverage withdraw-limit updates."],
12956
+ type: "u64"
12957
+ },
12958
+ {
12959
+ name: "delegate_flow_admin",
12960
+ docs: [
12961
+ "Can modify flow-control status for the group, i.e. update the withdraw caches with flow",
12962
+ "information from banks. Typically this is a hot wallet that lives in e.g. some cron job. If",
12963
+ "compromised, flow control can be effectively disabled until the admin is restored, which",
12964
+ "does not itself compromise any funds, and is merely annoying."
12965
+ ],
12966
+ type: "pubkey"
12967
+ },
13126
12968
  {
13127
12969
  name: "_padding_0",
13128
12970
  type: {
@@ -13130,7 +12972,7 @@ var marginfi_0_1_7_default = {
13130
12972
  {
13131
12973
  array: ["u64", 2]
13132
12974
  },
13133
- 6
12975
+ 2
13134
12976
  ]
13135
12977
  }
13136
12978
  },
@@ -14241,6 +14083,50 @@ var marginfi_0_1_7_default = {
14241
14083
  ]
14242
14084
  }
14243
14085
  },
14086
+ {
14087
+ name: "RateLimitFlowEvent",
14088
+ docs: [
14089
+ "Emitted when a bank-level inflow or outflow is recorded.",
14090
+ "The delegate flow admin aggregates these off-chain and",
14091
+ "updates the group rate limiter via `update_group_rate_limiter`."
14092
+ ],
14093
+ type: {
14094
+ kind: "struct",
14095
+ fields: [
14096
+ {
14097
+ name: "group",
14098
+ type: "pubkey"
14099
+ },
14100
+ {
14101
+ name: "bank",
14102
+ type: "pubkey"
14103
+ },
14104
+ {
14105
+ name: "mint",
14106
+ type: "pubkey"
14107
+ },
14108
+ {
14109
+ name: "flow_direction",
14110
+ docs: ["0 = outflow (withdraw/borrow), 1 = inflow (deposit/repay)"],
14111
+ type: "u8"
14112
+ },
14113
+ {
14114
+ name: "native_amount",
14115
+ docs: ["Amount in native tokens"],
14116
+ type: "u64"
14117
+ },
14118
+ {
14119
+ name: "mint_decimals",
14120
+ type: "u8"
14121
+ },
14122
+ {
14123
+ name: "current_timestamp",
14124
+ docs: ["Unix timestamp when the flow was recorded"],
14125
+ type: "i64"
14126
+ }
14127
+ ]
14128
+ }
14129
+ },
14244
14130
  {
14245
14131
  name: "RateLimitWindow",
14246
14132
  docs: [
@@ -14963,7 +14849,7 @@ var marginfi_0_1_7_default = {
14963
14849
  };
14964
14850
 
14965
14851
  // src/idl/index.ts
14966
- var MARGINFI_IDL = marginfi_0_1_7_default;
14852
+ var MARGINFI_IDL = marginfi_0_1_8_default;
14967
14853
  function decodeInstruction(idl, encoded) {
14968
14854
  const coder = new BorshInstructionCoder(idl);
14969
14855
  return coder.decode(encoded, "base58");
@@ -15530,7 +15416,6 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
15530
15416
  bank,
15531
15417
  destinationTokenAccount,
15532
15418
  lendingMarket,
15533
- reserveLiquidityMint,
15534
15419
  lendingMarketAuthority,
15535
15420
  reserveLiquiditySupply,
15536
15421
  reserveCollateralMint,
@@ -15545,7 +15430,6 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
15545
15430
  bank,
15546
15431
  destinationTokenAccount,
15547
15432
  lendingMarket,
15548
- reserveLiquidityMint,
15549
15433
  lendingMarketAuthority,
15550
15434
  reserveLiquiditySupply,
15551
15435
  reserveCollateralMint,
@@ -15590,14 +15474,11 @@ function makeLendingAccountLiquidateIx(mfiProgram, accounts, args, remainingAcco
15590
15474
  tokenProgram
15591
15475
  }).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
15592
15476
  }
15593
- function makelendingAccountWithdrawEmissionIx(mfiProgram, accounts) {
15594
- const { marginfiAccount, destinationAccount, bank, tokenProgram, ...optionalAccounts } = accounts;
15595
- return mfiProgram.methods.lendingAccountWithdrawEmissions().accounts({
15596
- marginfiAccount,
15597
- destinationAccount,
15598
- bank,
15599
- tokenProgram
15600
- }).accountsPartial(optionalAccounts).instruction();
15477
+ function makeLendingAccountClearEmissionsIx(mfiProgram, accounts) {
15478
+ return mfiProgram.methods.lendingAccountClearEmissions().accounts({
15479
+ marginfiAccount: accounts.marginfiAccount,
15480
+ bank: accounts.bank
15481
+ }).instruction();
15601
15482
  }
15602
15483
  function makePoolConfigureBankIx(mfiProgram, accounts, args) {
15603
15484
  const { bank, ...optionalAccounts } = accounts;
@@ -15697,7 +15578,7 @@ var instructions = {
15697
15578
  makeInitMarginfiAccountIx,
15698
15579
  makeInitMarginfiAccountPdaIx,
15699
15580
  makeLendingAccountLiquidateIx,
15700
- makelendingAccountWithdrawEmissionIx,
15581
+ makeLendingAccountClearEmissionsIx,
15701
15582
  makePoolAddBankIx,
15702
15583
  makePoolConfigureBankIx,
15703
15584
  makeBeginFlashLoanIx,
@@ -16202,7 +16083,7 @@ function parseEmodeSettingsRaw(emodeSettingsRaw) {
16202
16083
  };
16203
16084
  return emodeSettings;
16204
16085
  }
16205
- function parseBankRaw(address, accountParsed, bankMetadata, mintData) {
16086
+ function parseBankRaw(address, accountParsed, bankMetadata) {
16206
16087
  const flags = accountParsed.flags.toNumber();
16207
16088
  const mint = accountParsed.mint;
16208
16089
  const mintDecimals = accountParsed.mintDecimals;
@@ -16301,8 +16182,6 @@ function parseBankRaw(address, accountParsed, bankMetadata, mintData) {
16301
16182
  borrowingPositionCount,
16302
16183
  emode,
16303
16184
  tokenSymbol,
16304
- mintRate: mintData?.mintRate ?? null,
16305
- mintPrice: mintData?.mintPrice ?? 0,
16306
16185
  kaminoIntegrationAccounts,
16307
16186
  driftIntegrationAccounts,
16308
16187
  solendIntegrationAccounts,
@@ -16343,9 +16222,6 @@ function dtoToBank(bankDto) {
16343
16222
  feesDestinationAccount: bankDto.feesDestinationAccount ? new PublicKey(bankDto.feesDestinationAccount) : void 0,
16344
16223
  lendingPositionCount: bankDto.lendingPositionCount ? new BigNumber3(bankDto.lendingPositionCount) : void 0,
16345
16224
  borrowingPositionCount: bankDto.borrowingPositionCount ? new BigNumber3(bankDto.borrowingPositionCount) : void 0,
16346
- mintRate: null,
16347
- // TODO: move these out
16348
- mintPrice: 0,
16349
16225
  kaminoIntegrationAccounts: bankDto.kaminoIntegrationAccounts ? {
16350
16226
  kaminoReserve: new PublicKey(bankDto.kaminoIntegrationAccounts.kaminoReserve),
16351
16227
  kaminoObligation: new PublicKey(bankDto.kaminoIntegrationAccounts.kaminoObligation)
@@ -44130,7 +44006,7 @@ var SEED_RESERVE = "reserve";
44130
44006
  var SEED_RATE_MODEL = "rate_model";
44131
44007
  var SEED_USER_SUPPLY_POSITION = "user_supply_position";
44132
44008
  var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
44133
- function getAllDerivedJupLendAccounts(mint) {
44009
+ function getAllDerivedJupLendAccounts(mint, tokenProgram) {
44134
44010
  const [fTokenMint] = deriveJupLendFTokenMint(mint);
44135
44011
  const [lending] = deriveJupLendLending(mint, fTokenMint);
44136
44012
  const [liquidity] = deriveJupLendLiquidity();
@@ -44140,7 +44016,7 @@ function getAllDerivedJupLendAccounts(mint) {
44140
44016
  supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
44141
44017
  lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
44142
44018
  rateModel: deriveJupLendRateModel(mint)[0],
44143
- vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
44019
+ vault: deriveJupLendLiquidityVaultAta(mint, liquidity, tokenProgram),
44144
44020
  liquidity,
44145
44021
  rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
44146
44022
  };
@@ -44587,7 +44463,7 @@ var DISCRIMINATORS = {
44587
44463
  LENDING_ACCOUNT_WITHDRAW: Buffer.from([36, 72, 74, 19, 210, 210, 192, 192]),
44588
44464
  LENDING_ACCOUNT_BORROW: Buffer.from([4, 126, 116, 53, 48, 5, 212, 31]),
44589
44465
  LENDING_ACCOUNT_LIQUIDATE: Buffer.from([214, 169, 151, 213, 251, 167, 86, 219]),
44590
- LENDING_ACCOUNT_WITHDRAW_EMISSIONS: Buffer.from([234, 22, 84, 214, 118, 176, 140, 170]),
44466
+ LENDING_ACCOUNT_CLEAR_EMISSIONS: Buffer.from([239, 4, 221, 98, 45, 167, 201, 244]),
44591
44467
  LENDING_POOL_ADD_BANK: Buffer.from([215, 68, 72, 78, 208, 218, 103, 182]),
44592
44468
  LENDING_POOL_CONFIGURE_BANK: Buffer.from([121, 173, 156, 40, 93, 148, 56, 237]),
44593
44469
  LENDING_ACCOUNT_START_FLASHLOAN: Buffer.from([14, 131, 33, 220, 81, 186, 180, 107]),
@@ -44674,7 +44550,7 @@ function makeWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
44674
44550
  const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
44675
44551
  const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
44676
44552
  const keys = [
44677
- { pubkey: accounts.group, isSigner: false, isWritable: true },
44553
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
44678
44554
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44679
44555
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
44680
44556
  { pubkey: accounts.bank, isSigner: false, isWritable: true },
@@ -44830,7 +44706,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
44830
44706
  const liquidityVaultAuthority = deriveBankLiquidityVaultAuthority(programId, accounts.bank)[0];
44831
44707
  const liquidityVault = deriveBankLiquidityVault(programId, accounts.bank)[0];
44832
44708
  const keys = [
44833
- { pubkey: accounts.group, isSigner: false, isWritable: true },
44709
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
44834
44710
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44835
44711
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
44836
44712
  { pubkey: accounts.bank, isSigner: false, isWritable: true },
@@ -44850,7 +44726,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
44850
44726
  },
44851
44727
  { pubkey: accounts.integrationAcc1, isSigner: false, isWritable: true },
44852
44728
  {
44853
- pubkey: accounts.reserveLiquidityMint,
44729
+ pubkey: accounts.mint,
44854
44730
  isSigner: false,
44855
44731
  isWritable: true
44856
44732
  },
@@ -44937,22 +44813,15 @@ function makeLendingAccountLiquidateIx2(programId, accounts, args, remainingAcco
44937
44813
  ]);
44938
44814
  return new TransactionInstruction({ keys, programId, data });
44939
44815
  }
44940
- function makelendingAccountWithdrawEmissionIx2(programId, accounts) {
44816
+ function makeLendingAccountClearEmissionsIx2(programId, accounts) {
44941
44817
  const keys = [
44942
- { pubkey: accounts.group, isSigner: false, isWritable: false },
44943
44818
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44944
- { pubkey: accounts.authority, isSigner: true, isWritable: false },
44945
- { pubkey: accounts.bank, isSigner: false, isWritable: true },
44946
- { pubkey: accounts.emissionsMint, isSigner: false, isWritable: false },
44947
- { pubkey: accounts.emissionsAuth, isSigner: false, isWritable: false },
44948
- { pubkey: accounts.emissionsVault, isSigner: false, isWritable: true },
44949
- { pubkey: accounts.destinationAccount, isSigner: false, isWritable: true },
44950
- { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
44819
+ { pubkey: accounts.bank, isSigner: false, isWritable: false }
44951
44820
  ];
44952
44821
  return new TransactionInstruction({
44953
44822
  keys,
44954
44823
  programId,
44955
- data: DISCRIMINATORS.LENDING_ACCOUNT_WITHDRAW_EMISSIONS
44824
+ data: DISCRIMINATORS.LENDING_ACCOUNT_CLEAR_EMISSIONS
44956
44825
  });
44957
44826
  }
44958
44827
  function makeCloseAccountIx2(programId, accounts) {
@@ -45115,7 +44984,7 @@ function makeDriftWithdrawIx2(programId, accounts, args, remainingAccounts = [])
45115
44984
  const DRIFT_PROGRAM_ID2 = new PublicKey("dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH");
45116
44985
  const SYSTEM_PROGRAM_ID2 = new PublicKey("11111111111111111111111111111111");
45117
44986
  const keys = [
45118
- { pubkey: accounts.group, isSigner: false, isWritable: true },
44987
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
45119
44988
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
45120
44989
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
45121
44990
  { pubkey: accounts.bank, isSigner: false, isWritable: true }
@@ -45250,7 +45119,7 @@ var syncInstructions = {
45250
45119
  makeKaminoWithdrawIx: makeKaminoWithdrawIx2,
45251
45120
  makeBorrowIx: makeBorrowIx2,
45252
45121
  makeLendingAccountLiquidateIx: makeLendingAccountLiquidateIx2,
45253
- makelendingAccountWithdrawEmissionIx: makelendingAccountWithdrawEmissionIx2,
45122
+ makeLendingAccountClearEmissionsIx: makeLendingAccountClearEmissionsIx2,
45254
45123
  makePoolAddBankIx: makePoolAddBankIx2,
45255
45124
  makePoolConfigureBankIx: makePoolConfigureBankIx2,
45256
45125
  makeBeginFlashLoanIx: makeBeginFlashLoanIx2,
@@ -45542,7 +45411,7 @@ async function makeKaminoWithdrawIx3({
45542
45411
  lendingMarket,
45543
45412
  lendingMarketAuthority,
45544
45413
  integrationAcc1: bank.kaminoIntegrationAccounts.kaminoReserve,
45545
- reserveLiquidityMint: bank.mint,
45414
+ mint: bank.mint,
45546
45415
  reserveLiquiditySupply,
45547
45416
  reserveCollateralMint,
45548
45417
  reserveSourceCollateral: reserveDestinationDepositCollateral,
@@ -45566,7 +45435,7 @@ async function makeKaminoWithdrawIx3({
45566
45435
  bank: bank.address,
45567
45436
  destinationTokenAccount: userTokenAtaPk,
45568
45437
  lendingMarket,
45569
- reserveLiquidityMint: bank.mint,
45438
+ mint: bank.mint,
45570
45439
  lendingMarketAuthority,
45571
45440
  reserveLiquiditySupply,
45572
45441
  reserveCollateralMint,
@@ -45887,7 +45756,7 @@ async function makeJuplendWithdrawIx2({
45887
45756
  lendingAdmin,
45888
45757
  rateModel,
45889
45758
  vault,
45890
- liquidity} = getAllDerivedJupLendAccounts(bank.mint);
45759
+ liquidity} = getAllDerivedJupLendAccounts(bank.mint, tokenProgram);
45891
45760
  if (opts.observationBanksOverride) {
45892
45761
  remainingAccounts.push(...opts.observationBanksOverride);
45893
45762
  } else {
@@ -46510,7 +46379,7 @@ async function makeJuplendDepositIx2({
46510
46379
  if (!bank.jupLendIntegrationAccounts) {
46511
46380
  throw new Error("Bank has no JupLend integration accounts");
46512
46381
  }
46513
- const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint);
46382
+ const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint, tokenProgram);
46514
46383
  const {
46515
46384
  fTokenMint,
46516
46385
  lendingAdmin,
@@ -47459,37 +47328,14 @@ async function buildRepayWithCollatFlashloanTx({
47459
47328
  }
47460
47329
 
47461
47330
  // src/services/account/actions/emissions.ts
47462
- async function makeWithdrawEmissionsIx(program, marginfiAccount, banks, mintDatas, bankAddress) {
47331
+ async function makeClearEmissionsIx(program, marginfiAccount, banks, bankAddress) {
47463
47332
  const bank = banks.get(bankAddress.toBase58());
47464
47333
  if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
47465
- const mintData = mintDatas.get(bankAddress.toBase58());
47466
- if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);
47467
- if (!mintData.emissionTokenProgram) {
47468
- throw Error(`Emission token program not found for bank ${bankAddress.toBase58()}`);
47469
- }
47470
- let ixs = [];
47471
- const userAta = getAssociatedTokenAddressSync(
47472
- bank.emissionsMint,
47473
- marginfiAccount.authority,
47474
- true,
47475
- mintData.emissionTokenProgram
47476
- );
47477
- const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(
47478
- marginfiAccount.authority,
47479
- userAta,
47480
- marginfiAccount.authority,
47481
- bank.emissionsMint,
47482
- mintData.emissionTokenProgram
47483
- );
47484
- ixs.push(createAtaIdempotentIx);
47485
- const withdrawEmissionsIx = await instructions_default.makelendingAccountWithdrawEmissionIx(program, {
47334
+ const clearEmissionsIx = await instructions_default.makeLendingAccountClearEmissionsIx(program, {
47486
47335
  marginfiAccount: marginfiAccount.address,
47487
- destinationAccount: userAta,
47488
- bank: bank.address,
47489
- tokenProgram: mintData.emissionTokenProgram
47336
+ bank: bank.address
47490
47337
  });
47491
- ixs.push(withdrawEmissionsIx);
47492
- return { instructions: ixs, keys: [] };
47338
+ return { instructions: [clearEmissionsIx], keys: [] };
47493
47339
  }
47494
47340
  async function makeSwapCollateralTx(params) {
47495
47341
  const {
@@ -51775,13 +51621,11 @@ async function fetchBankIntegrationMetadata(options) {
51775
51621
  return bankIntegrationMap;
51776
51622
  }
51777
51623
  var Bank = class _Bank {
51778
- constructor(address, mint, mintDecimals, group, mintRate, mintPrice, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol) {
51624
+ constructor(address, mint, mintDecimals, group, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol) {
51779
51625
  this.address = address;
51780
51626
  this.mint = mint;
51781
51627
  this.mintDecimals = mintDecimals;
51782
51628
  this.group = group;
51783
- this.mintRate = mintRate;
51784
- this.mintPrice = mintPrice;
51785
51629
  this.assetShareValue = assetShareValue;
51786
51630
  this.liabilityShareValue = liabilityShareValue;
51787
51631
  this.liquidityVault = liquidityVault;
@@ -51851,8 +51695,6 @@ var Bank = class _Bank {
51851
51695
  bankType.mint,
51852
51696
  bankType.mintDecimals,
51853
51697
  bankType.group,
51854
- bankType.mintRate,
51855
- bankType.mintPrice,
51856
51698
  bankType.assetShareValue,
51857
51699
  bankType.liabilityShareValue,
51858
51700
  bankType.liquidityVault,
@@ -51894,8 +51736,6 @@ var Bank = class _Bank {
51894
51736
  props.mint,
51895
51737
  props.mintDecimals,
51896
51738
  props.group,
51897
- props.mintRate,
51898
- props.mintPrice,
51899
51739
  props.assetShareValue,
51900
51740
  props.liabilityShareValue,
51901
51741
  props.liquidityVault,
@@ -52622,15 +52462,14 @@ var MarginfiAccount = class _MarginfiAccount {
52622
52462
  *
52623
52463
  * @param program - The Marginfi program instance
52624
52464
  * @param banks - Map of all available banks
52625
- * @param mintDatas - Map of mint data for token programs
52626
- * @param bankAddress - The bank to withdraw emissions from
52465
+ * @param bankAddress - The bank to clear emissions for
52627
52466
  *
52628
- * @returns Promise resolving to InstructionsWrapper containing the withdraw emissions instructions
52467
+ * @returns Promise resolving to InstructionsWrapper containing the clear emissions instructions
52629
52468
  *
52630
- * @see {@link makeWithdrawEmissionsIx} for implementation
52469
+ * @see {@link makeClearEmissionsIx} for implementation
52631
52470
  */
52632
- async makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress) {
52633
- return makeWithdrawEmissionsIx(program, this, banks, mintDatas, bankAddress);
52471
+ async makeClearEmissionsIx(program, banks, bankAddress) {
52472
+ return makeClearEmissionsIx(program, this, banks, bankAddress);
52634
52473
  }
52635
52474
  /**
52636
52475
  * Creates an instruction to begin a flash loan.
@@ -53313,17 +53152,12 @@ var MarginfiAccountWrapper = class {
53313
53152
  });
53314
53153
  }
53315
53154
  /**
53316
- * Creates a withdraw emissions instruction with auto-injected client data.
53155
+ * Creates a clear emissions instruction with auto-injected client data.
53317
53156
  *
53318
- * @param bankAddress - Bank address to withdraw emissions from
53157
+ * @param bankAddress - Bank address to clear emissions for
53319
53158
  */
53320
- async makeWithdrawEmissionsIx(bankAddress) {
53321
- return this.account.makeWithdrawEmissionsIx(
53322
- this.client.program,
53323
- this.client.bankMap,
53324
- this.client.mintDataByBank,
53325
- bankAddress
53326
- );
53159
+ async makeClearEmissionsIx(bankAddress) {
53160
+ return this.account.makeClearEmissionsIx(this.client.program, this.client.bankMap, bankAddress);
53327
53161
  }
53328
53162
  /**
53329
53163
  * Creates a begin flash loan instruction.
@@ -54258,6 +54092,6 @@ var EmodeSettings = class _EmodeSettings {
54258
54092
  }
54259
54093
  };
54260
54094
 
54261
- export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
54095
+ export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeClearEmissionsIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
54262
54096
  //# sourceMappingURL=index.js.map
54263
54097
  //# sourceMappingURL=index.js.map