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

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
@@ -602,8 +602,8 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
602
602
  return bundleTipInstruction;
603
603
  }
604
604
 
605
- // src/idl/marginfi_0.1.8.json
606
- var marginfi_0_1_8_default = {
605
+ // src/idl/marginfi_0.1.7.json
606
+ var marginfi_0_1_7_default = {
607
607
  address: "",
608
608
  metadata: {
609
609
  name: "marginfi",
@@ -653,7 +653,7 @@ var marginfi_0_1_8_default = {
653
653
  {
654
654
  name: "configure_bank_rate_limits",
655
655
  docs: [
656
- "(admin or delegate_limit_admin) Configure bank-level rate limits for withdraw/borrow.",
656
+ "(admin only) Configure bank-level rate limits for withdraw/borrow.",
657
657
  "Rate limits track net outflow in native tokens. Deposits offset withdraws.",
658
658
  "Set to 0 to disable. Hourly and daily windows are independent."
659
659
  ],
@@ -665,7 +665,8 @@ var marginfi_0_1_8_default = {
665
665
  },
666
666
  {
667
667
  name: "admin",
668
- signer: true
668
+ signer: true,
669
+ relations: ["group"]
669
670
  },
670
671
  {
671
672
  name: "bank",
@@ -689,9 +690,7 @@ var marginfi_0_1_8_default = {
689
690
  },
690
691
  {
691
692
  name: "configure_deleverage_withdrawal_limit",
692
- docs: [
693
- "(admin or delegate_limit_admin) Set the daily withdrawal limit for deleverages per group."
694
- ],
693
+ docs: ["(group admin only) Set the daily withdrawal limit for deleverages per group."],
695
694
  discriminator: [28, 132, 205, 158, 67, 77, 177, 63],
696
695
  accounts: [
697
696
  {
@@ -700,7 +699,8 @@ var marginfi_0_1_8_default = {
700
699
  },
701
700
  {
702
701
  name: "admin",
703
- signer: true
702
+ signer: true,
703
+ relations: ["marginfi_group"]
704
704
  }
705
705
  ],
706
706
  args: [
@@ -713,7 +713,7 @@ var marginfi_0_1_8_default = {
713
713
  {
714
714
  name: "configure_group_rate_limits",
715
715
  docs: [
716
- "(admin or delegate_limit_admin) Configure group-level rate limits for withdraw/borrow.",
716
+ "(admin only) Configure group-level rate limits for withdraw/borrow.",
717
717
  "Rate limits track aggregate net outflow in USD.",
718
718
  "Example: $10M = 10_000_000. Set to 0 to disable."
719
719
  ],
@@ -725,7 +725,8 @@ var marginfi_0_1_8_default = {
725
725
  },
726
726
  {
727
727
  name: "admin",
728
- signer: true
728
+ signer: true,
729
+ relations: ["marginfi_group"]
729
730
  }
730
731
  ],
731
732
  args: [
@@ -753,6 +754,7 @@ var marginfi_0_1_8_default = {
753
754
  accounts: [
754
755
  {
755
756
  name: "group",
757
+ writable: true,
756
758
  relations: ["marginfi_account", "bank"]
757
759
  },
758
760
  {
@@ -1340,6 +1342,7 @@ var marginfi_0_1_8_default = {
1340
1342
  accounts: [
1341
1343
  {
1342
1344
  name: "group",
1345
+ writable: true,
1343
1346
  relations: ["marginfi_account", "bank"]
1344
1347
  },
1345
1348
  {
@@ -1873,7 +1876,6 @@ var marginfi_0_1_8_default = {
1873
1876
  accounts: [
1874
1877
  {
1875
1878
  name: "group",
1876
- writable: true,
1877
1879
  relations: ["marginfi_account", "bank"]
1878
1880
  },
1879
1881
  {
@@ -1882,7 +1884,8 @@ var marginfi_0_1_8_default = {
1882
1884
  },
1883
1885
  {
1884
1886
  name: "authority",
1885
- signer: true
1887
+ signer: true,
1888
+ relations: ["marginfi_account"]
1886
1889
  },
1887
1890
  {
1888
1891
  name: "bank",
@@ -2172,6 +2175,7 @@ var marginfi_0_1_8_default = {
2172
2175
  accounts: [
2173
2176
  {
2174
2177
  name: "group",
2178
+ writable: true,
2175
2179
  relations: ["marginfi_account", "bank"]
2176
2180
  },
2177
2181
  {
@@ -2346,6 +2350,7 @@ var marginfi_0_1_8_default = {
2346
2350
  accounts: [
2347
2351
  {
2348
2352
  name: "group",
2353
+ writable: true,
2349
2354
  relations: ["marginfi_account", "bank"]
2350
2355
  },
2351
2356
  {
@@ -2874,6 +2879,7 @@ var marginfi_0_1_8_default = {
2874
2879
  accounts: [
2875
2880
  {
2876
2881
  name: "group",
2882
+ writable: true,
2877
2883
  relations: ["marginfi_account", "bank"]
2878
2884
  },
2879
2885
  {
@@ -2970,13 +2976,12 @@ var marginfi_0_1_8_default = {
2970
2976
  relations: ["bank"]
2971
2977
  },
2972
2978
  {
2973
- name: "mint",
2979
+ name: "reserve_liquidity_mint",
2974
2980
  docs: [
2975
2981
  "The liquidity token mint (e.g., USDC)",
2976
2982
  "Needs serde to get the mint decimals for transfer checked"
2977
2983
  ],
2978
- writable: true,
2979
- relations: ["bank"]
2984
+ writable: true
2980
2985
  },
2981
2986
  {
2982
2987
  name: "reserve_liquidity_supply",
@@ -3051,6 +3056,7 @@ var marginfi_0_1_8_default = {
3051
3056
  accounts: [
3052
3057
  {
3053
3058
  name: "group",
3059
+ writable: true,
3054
3060
  relations: ["marginfi_account", "bank"]
3055
3061
  },
3056
3062
  {
@@ -3122,26 +3128,11 @@ var marginfi_0_1_8_default = {
3122
3128
  ]
3123
3129
  },
3124
3130
  {
3125
- name: "lending_account_clear_emissions",
3131
+ name: "lending_account_close_balance",
3126
3132
  docs: [
3127
- "(permissionless) Zero out `emissions_outstanding` on a balance after emissions are disabled",
3128
- "on the bank."
3133
+ "(account authority) Close a balance position with dust-level amounts. Claims outstanding",
3134
+ "emissions before closing."
3129
3135
  ],
3130
- discriminator: [239, 4, 221, 98, 45, 167, 201, 244],
3131
- accounts: [
3132
- {
3133
- name: "marginfi_account",
3134
- writable: true
3135
- },
3136
- {
3137
- name: "bank"
3138
- }
3139
- ],
3140
- args: []
3141
- },
3142
- {
3143
- name: "lending_account_close_balance",
3144
- docs: ["(account authority) Close a balance position with dust-level amounts."],
3145
3136
  discriminator: [245, 54, 41, 4, 243, 202, 31, 17],
3146
3137
  accounts: [
3147
3138
  {
@@ -3173,219 +3164,7 @@ var marginfi_0_1_8_default = {
3173
3164
  accounts: [
3174
3165
  {
3175
3166
  name: "group",
3176
- relations: ["marginfi_account", "bank"]
3177
- },
3178
- {
3179
- name: "marginfi_account",
3180
- writable: true
3181
- },
3182
- {
3183
- name: "authority",
3184
- signer: true
3185
- },
3186
- {
3187
- name: "bank",
3188
- writable: true
3189
- },
3190
- {
3191
- name: "signer_token_account",
3192
- writable: true
3193
- },
3194
- {
3195
- name: "liquidity_vault",
3196
3167
  writable: true,
3197
- relations: ["bank"]
3198
- },
3199
- {
3200
- name: "token_program"
3201
- }
3202
- ],
3203
- args: [
3204
- {
3205
- name: "amount",
3206
- type: "u64"
3207
- },
3208
- {
3209
- name: "deposit_up_to_limit",
3210
- type: {
3211
- option: "bool"
3212
- }
3213
- }
3214
- ]
3215
- },
3216
- {
3217
- name: "lending_account_end_flashloan",
3218
- docs: ["(account authority) End a flash loan and run the health check."],
3219
- discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
3220
- accounts: [
3221
- {
3222
- name: "marginfi_account",
3223
- writable: true
3224
- },
3225
- {
3226
- name: "authority",
3227
- signer: true,
3228
- relations: ["marginfi_account"]
3229
- }
3230
- ],
3231
- args: []
3232
- },
3233
- {
3234
- name: "lending_account_liquidate",
3235
- docs: [
3236
- "(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
3237
- "The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
3238
- "fee + 2.5% insurance fee).",
3239
- "* `asset_amount` - amount of collateral to liquidate",
3240
- "* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
3241
- "* `liquidator_accounts` - number of remaining accounts for the liquidator"
3242
- ],
3243
- discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
3244
- accounts: [
3245
- {
3246
- name: "group",
3247
- relations: [
3248
- "asset_bank",
3249
- "liab_bank",
3250
- "liquidator_marginfi_account",
3251
- "liquidatee_marginfi_account"
3252
- ]
3253
- },
3254
- {
3255
- name: "asset_bank",
3256
- writable: true
3257
- },
3258
- {
3259
- name: "liab_bank",
3260
- writable: true
3261
- },
3262
- {
3263
- name: "liquidator_marginfi_account",
3264
- writable: true
3265
- },
3266
- {
3267
- name: "authority",
3268
- signer: true
3269
- },
3270
- {
3271
- name: "liquidatee_marginfi_account",
3272
- writable: true
3273
- },
3274
- {
3275
- name: "bank_liquidity_vault_authority",
3276
- pda: {
3277
- seeds: [
3278
- {
3279
- kind: "const",
3280
- value: [
3281
- 108,
3282
- 105,
3283
- 113,
3284
- 117,
3285
- 105,
3286
- 100,
3287
- 105,
3288
- 116,
3289
- 121,
3290
- 95,
3291
- 118,
3292
- 97,
3293
- 117,
3294
- 108,
3295
- 116,
3296
- 95,
3297
- 97,
3298
- 117,
3299
- 116,
3300
- 104
3301
- ]
3302
- },
3303
- {
3304
- kind: "account",
3305
- path: "liab_bank"
3306
- }
3307
- ]
3308
- }
3309
- },
3310
- {
3311
- name: "bank_liquidity_vault",
3312
- writable: true,
3313
- pda: {
3314
- seeds: [
3315
- {
3316
- kind: "const",
3317
- value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
3318
- },
3319
- {
3320
- kind: "account",
3321
- path: "liab_bank"
3322
- }
3323
- ]
3324
- }
3325
- },
3326
- {
3327
- name: "bank_insurance_vault",
3328
- writable: true,
3329
- pda: {
3330
- seeds: [
3331
- {
3332
- kind: "const",
3333
- value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
3334
- },
3335
- {
3336
- kind: "account",
3337
- path: "liab_bank"
3338
- }
3339
- ]
3340
- }
3341
- },
3342
- {
3343
- name: "token_program"
3344
- }
3345
- ],
3346
- args: [
3347
- {
3348
- name: "asset_amount",
3349
- type: "u64"
3350
- },
3351
- {
3352
- name: "liquidatee_accounts",
3353
- type: "u8"
3354
- },
3355
- {
3356
- name: "liquidator_accounts",
3357
- type: "u8"
3358
- }
3359
- ]
3360
- },
3361
- {
3362
- name: "lending_account_pulse_health",
3363
- docs: [
3364
- "(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
3365
- "other consumers that want to see the internal risk state of a user account. This cache is",
3366
- "read-only and serves no purpose except being populated by this ix.",
3367
- "* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
3368
- "user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
3369
- ],
3370
- discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
3371
- accounts: [
3372
- {
3373
- name: "marginfi_account",
3374
- writable: true
3375
- }
3376
- ],
3377
- args: []
3378
- },
3379
- {
3380
- name: "lending_account_repay",
3381
- docs: [
3382
- "(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
3383
- "interest, records repayment, and transfers tokens to the bank's liquidity vault."
3384
- ],
3385
- discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
3386
- accounts: [
3387
- {
3388
- name: "group",
3389
3168
  relations: ["marginfi_account", "bank"]
3390
3169
  },
3391
3170
  {
@@ -3394,12 +3173,226 @@ var marginfi_0_1_8_default = {
3394
3173
  },
3395
3174
  {
3396
3175
  name: "authority",
3397
- docs: [
3398
- "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
3399
- "",
3400
- "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
3401
- "long as the invariants checked at the end of execution are met."
3402
- ],
3176
+ signer: true
3177
+ },
3178
+ {
3179
+ name: "bank",
3180
+ writable: true
3181
+ },
3182
+ {
3183
+ name: "signer_token_account",
3184
+ writable: true
3185
+ },
3186
+ {
3187
+ name: "liquidity_vault",
3188
+ writable: true,
3189
+ relations: ["bank"]
3190
+ },
3191
+ {
3192
+ name: "token_program"
3193
+ }
3194
+ ],
3195
+ args: [
3196
+ {
3197
+ name: "amount",
3198
+ type: "u64"
3199
+ },
3200
+ {
3201
+ name: "deposit_up_to_limit",
3202
+ type: {
3203
+ option: "bool"
3204
+ }
3205
+ }
3206
+ ]
3207
+ },
3208
+ {
3209
+ name: "lending_account_end_flashloan",
3210
+ docs: ["(account authority) End a flash loan and run the health check."],
3211
+ discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
3212
+ accounts: [
3213
+ {
3214
+ name: "marginfi_account",
3215
+ writable: true
3216
+ },
3217
+ {
3218
+ name: "authority",
3219
+ signer: true,
3220
+ relations: ["marginfi_account"]
3221
+ }
3222
+ ],
3223
+ args: []
3224
+ },
3225
+ {
3226
+ name: "lending_account_liquidate",
3227
+ docs: [
3228
+ "(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
3229
+ "The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
3230
+ "fee + 2.5% insurance fee).",
3231
+ "* `asset_amount` - amount of collateral to liquidate",
3232
+ "* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
3233
+ "* `liquidator_accounts` - number of remaining accounts for the liquidator"
3234
+ ],
3235
+ discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
3236
+ accounts: [
3237
+ {
3238
+ name: "group",
3239
+ relations: [
3240
+ "asset_bank",
3241
+ "liab_bank",
3242
+ "liquidator_marginfi_account",
3243
+ "liquidatee_marginfi_account"
3244
+ ]
3245
+ },
3246
+ {
3247
+ name: "asset_bank",
3248
+ writable: true
3249
+ },
3250
+ {
3251
+ name: "liab_bank",
3252
+ writable: true
3253
+ },
3254
+ {
3255
+ name: "liquidator_marginfi_account",
3256
+ writable: true
3257
+ },
3258
+ {
3259
+ name: "authority",
3260
+ signer: true
3261
+ },
3262
+ {
3263
+ name: "liquidatee_marginfi_account",
3264
+ writable: true
3265
+ },
3266
+ {
3267
+ name: "bank_liquidity_vault_authority",
3268
+ pda: {
3269
+ seeds: [
3270
+ {
3271
+ kind: "const",
3272
+ value: [
3273
+ 108,
3274
+ 105,
3275
+ 113,
3276
+ 117,
3277
+ 105,
3278
+ 100,
3279
+ 105,
3280
+ 116,
3281
+ 121,
3282
+ 95,
3283
+ 118,
3284
+ 97,
3285
+ 117,
3286
+ 108,
3287
+ 116,
3288
+ 95,
3289
+ 97,
3290
+ 117,
3291
+ 116,
3292
+ 104
3293
+ ]
3294
+ },
3295
+ {
3296
+ kind: "account",
3297
+ path: "liab_bank"
3298
+ }
3299
+ ]
3300
+ }
3301
+ },
3302
+ {
3303
+ name: "bank_liquidity_vault",
3304
+ writable: true,
3305
+ pda: {
3306
+ seeds: [
3307
+ {
3308
+ kind: "const",
3309
+ value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
3310
+ },
3311
+ {
3312
+ kind: "account",
3313
+ path: "liab_bank"
3314
+ }
3315
+ ]
3316
+ }
3317
+ },
3318
+ {
3319
+ name: "bank_insurance_vault",
3320
+ writable: true,
3321
+ pda: {
3322
+ seeds: [
3323
+ {
3324
+ kind: "const",
3325
+ value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
3326
+ },
3327
+ {
3328
+ kind: "account",
3329
+ path: "liab_bank"
3330
+ }
3331
+ ]
3332
+ }
3333
+ },
3334
+ {
3335
+ name: "token_program"
3336
+ }
3337
+ ],
3338
+ args: [
3339
+ {
3340
+ name: "asset_amount",
3341
+ type: "u64"
3342
+ },
3343
+ {
3344
+ name: "liquidatee_accounts",
3345
+ type: "u8"
3346
+ },
3347
+ {
3348
+ name: "liquidator_accounts",
3349
+ type: "u8"
3350
+ }
3351
+ ]
3352
+ },
3353
+ {
3354
+ name: "lending_account_pulse_health",
3355
+ docs: [
3356
+ "(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
3357
+ "other consumers that want to see the internal risk state of a user account. This cache is",
3358
+ "read-only and serves no purpose except being populated by this ix.",
3359
+ "* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
3360
+ "user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
3361
+ ],
3362
+ discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
3363
+ accounts: [
3364
+ {
3365
+ name: "marginfi_account",
3366
+ writable: true
3367
+ }
3368
+ ],
3369
+ args: []
3370
+ },
3371
+ {
3372
+ name: "lending_account_repay",
3373
+ docs: [
3374
+ "(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
3375
+ "interest, records repayment, and transfers tokens to the bank's liquidity vault."
3376
+ ],
3377
+ discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
3378
+ accounts: [
3379
+ {
3380
+ name: "group",
3381
+ writable: true,
3382
+ relations: ["marginfi_account", "bank"]
3383
+ },
3384
+ {
3385
+ name: "marginfi_account",
3386
+ writable: true
3387
+ },
3388
+ {
3389
+ name: "authority",
3390
+ docs: [
3391
+ "Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
3392
+ "",
3393
+ "Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
3394
+ "long as the invariants checked at the end of execution are met."
3395
+ ],
3403
3396
  signer: true
3404
3397
  },
3405
3398
  {
@@ -3432,6 +3425,24 @@ var marginfi_0_1_8_default = {
3432
3425
  }
3433
3426
  ]
3434
3427
  },
3428
+ {
3429
+ name: "lending_account_settle_emissions",
3430
+ docs: [
3431
+ "(permissionless) Settle unclaimed emissions into a user's balance without withdrawing."
3432
+ ],
3433
+ discriminator: [161, 58, 136, 174, 242, 223, 156, 176],
3434
+ accounts: [
3435
+ {
3436
+ name: "marginfi_account",
3437
+ writable: true
3438
+ },
3439
+ {
3440
+ name: "bank",
3441
+ writable: true
3442
+ }
3443
+ ],
3444
+ args: []
3445
+ },
3435
3446
  {
3436
3447
  name: "lending_account_start_flashloan",
3437
3448
  docs: [
@@ -3472,6 +3483,7 @@ var marginfi_0_1_8_default = {
3472
3483
  accounts: [
3473
3484
  {
3474
3485
  name: "group",
3486
+ writable: true,
3475
3487
  relations: ["marginfi_account", "bank"]
3476
3488
  },
3477
3489
  {
@@ -3554,6 +3566,253 @@ var marginfi_0_1_8_default = {
3554
3566
  }
3555
3567
  ]
3556
3568
  },
3569
+ {
3570
+ name: "lending_account_withdraw_emissions",
3571
+ docs: [
3572
+ "(account authority) Settle and withdraw emissions rewards to a destination token account."
3573
+ ],
3574
+ discriminator: [234, 22, 84, 214, 118, 176, 140, 170],
3575
+ accounts: [
3576
+ {
3577
+ name: "group",
3578
+ relations: ["marginfi_account", "bank"]
3579
+ },
3580
+ {
3581
+ name: "marginfi_account",
3582
+ writable: true
3583
+ },
3584
+ {
3585
+ name: "authority",
3586
+ signer: true
3587
+ },
3588
+ {
3589
+ name: "bank",
3590
+ writable: true
3591
+ },
3592
+ {
3593
+ name: "emissions_mint",
3594
+ relations: ["bank"]
3595
+ },
3596
+ {
3597
+ name: "emissions_auth",
3598
+ pda: {
3599
+ seeds: [
3600
+ {
3601
+ kind: "const",
3602
+ value: [
3603
+ 101,
3604
+ 109,
3605
+ 105,
3606
+ 115,
3607
+ 115,
3608
+ 105,
3609
+ 111,
3610
+ 110,
3611
+ 115,
3612
+ 95,
3613
+ 97,
3614
+ 117,
3615
+ 116,
3616
+ 104,
3617
+ 95,
3618
+ 115,
3619
+ 101,
3620
+ 101,
3621
+ 100
3622
+ ]
3623
+ },
3624
+ {
3625
+ kind: "account",
3626
+ path: "bank"
3627
+ },
3628
+ {
3629
+ kind: "account",
3630
+ path: "emissions_mint"
3631
+ }
3632
+ ]
3633
+ }
3634
+ },
3635
+ {
3636
+ name: "emissions_vault",
3637
+ writable: true,
3638
+ pda: {
3639
+ seeds: [
3640
+ {
3641
+ kind: "const",
3642
+ value: [
3643
+ 101,
3644
+ 109,
3645
+ 105,
3646
+ 115,
3647
+ 115,
3648
+ 105,
3649
+ 111,
3650
+ 110,
3651
+ 115,
3652
+ 95,
3653
+ 116,
3654
+ 111,
3655
+ 107,
3656
+ 101,
3657
+ 110,
3658
+ 95,
3659
+ 97,
3660
+ 99,
3661
+ 99,
3662
+ 111,
3663
+ 117,
3664
+ 110,
3665
+ 116,
3666
+ 95,
3667
+ 115,
3668
+ 101,
3669
+ 101,
3670
+ 100
3671
+ ]
3672
+ },
3673
+ {
3674
+ kind: "account",
3675
+ path: "bank"
3676
+ },
3677
+ {
3678
+ kind: "account",
3679
+ path: "emissions_mint"
3680
+ }
3681
+ ]
3682
+ }
3683
+ },
3684
+ {
3685
+ name: "destination_account",
3686
+ writable: true
3687
+ },
3688
+ {
3689
+ name: "token_program"
3690
+ }
3691
+ ],
3692
+ args: []
3693
+ },
3694
+ {
3695
+ name: "lending_account_withdraw_emissions_permissionless",
3696
+ docs: [
3697
+ "(permissionless) Withdraw emissions to the user's pre-configured emissions destination ATA."
3698
+ ],
3699
+ discriminator: [4, 174, 124, 203, 44, 49, 145, 150],
3700
+ accounts: [
3701
+ {
3702
+ name: "group",
3703
+ relations: ["marginfi_account", "bank"]
3704
+ },
3705
+ {
3706
+ name: "marginfi_account",
3707
+ writable: true
3708
+ },
3709
+ {
3710
+ name: "bank",
3711
+ writable: true
3712
+ },
3713
+ {
3714
+ name: "emissions_mint",
3715
+ relations: ["bank"]
3716
+ },
3717
+ {
3718
+ name: "emissions_auth",
3719
+ pda: {
3720
+ seeds: [
3721
+ {
3722
+ kind: "const",
3723
+ value: [
3724
+ 101,
3725
+ 109,
3726
+ 105,
3727
+ 115,
3728
+ 115,
3729
+ 105,
3730
+ 111,
3731
+ 110,
3732
+ 115,
3733
+ 95,
3734
+ 97,
3735
+ 117,
3736
+ 116,
3737
+ 104,
3738
+ 95,
3739
+ 115,
3740
+ 101,
3741
+ 101,
3742
+ 100
3743
+ ]
3744
+ },
3745
+ {
3746
+ kind: "account",
3747
+ path: "bank"
3748
+ },
3749
+ {
3750
+ kind: "account",
3751
+ path: "emissions_mint"
3752
+ }
3753
+ ]
3754
+ }
3755
+ },
3756
+ {
3757
+ name: "emissions_vault",
3758
+ writable: true,
3759
+ pda: {
3760
+ seeds: [
3761
+ {
3762
+ kind: "const",
3763
+ value: [
3764
+ 101,
3765
+ 109,
3766
+ 105,
3767
+ 115,
3768
+ 115,
3769
+ 105,
3770
+ 111,
3771
+ 110,
3772
+ 115,
3773
+ 95,
3774
+ 116,
3775
+ 111,
3776
+ 107,
3777
+ 101,
3778
+ 110,
3779
+ 95,
3780
+ 97,
3781
+ 99,
3782
+ 99,
3783
+ 111,
3784
+ 117,
3785
+ 110,
3786
+ 116,
3787
+ 95,
3788
+ 115,
3789
+ 101,
3790
+ 101,
3791
+ 100
3792
+ ]
3793
+ },
3794
+ {
3795
+ kind: "account",
3796
+ path: "bank"
3797
+ },
3798
+ {
3799
+ kind: "account",
3800
+ path: "emissions_mint"
3801
+ }
3802
+ ]
3803
+ }
3804
+ },
3805
+ {
3806
+ name: "destination_account",
3807
+ docs: ["registered on `marginfi_account`"],
3808
+ writable: true
3809
+ },
3810
+ {
3811
+ name: "token_program"
3812
+ }
3813
+ ],
3814
+ args: []
3815
+ },
3557
3816
  {
3558
3817
  name: "lending_pool_accrue_bank_interest",
3559
3818
  docs: [
@@ -5955,6 +6214,7 @@ var marginfi_0_1_8_default = {
5955
6214
  accounts: [
5956
6215
  {
5957
6216
  name: "group",
6217
+ writable: true,
5958
6218
  relations: ["bank"]
5959
6219
  },
5960
6220
  {
@@ -5965,17 +6225,50 @@ var marginfi_0_1_8_default = {
5965
6225
  args: []
5966
6226
  },
5967
6227
  {
5968
- name: "lending_pool_reclaim_emissions_vault",
5969
- docs: [
5970
- "(permissionless) Reclaim all remaining tokens from the emissions vault",
5971
- "to the global fee wallet ATA, and disable emissions on the bank."
6228
+ name: "lending_pool_set_fixed_oracle_price",
6229
+ docs: ["(admin only)"],
6230
+ discriminator: [28, 126, 127, 127, 60, 37, 211, 125],
6231
+ accounts: [
6232
+ {
6233
+ name: "group",
6234
+ relations: ["bank"]
6235
+ },
6236
+ {
6237
+ name: "admin",
6238
+ signer: true,
6239
+ relations: ["group"]
6240
+ },
6241
+ {
6242
+ name: "bank",
6243
+ writable: true
6244
+ }
5972
6245
  ],
5973
- discriminator: [206, 67, 186, 225, 41, 30, 95, 216],
6246
+ args: [
6247
+ {
6248
+ name: "price",
6249
+ type: {
6250
+ defined: {
6251
+ name: "WrappedI80F48"
6252
+ }
6253
+ }
6254
+ }
6255
+ ]
6256
+ },
6257
+ {
6258
+ name: "lending_pool_setup_emissions",
6259
+ docs: ["(delegate_emissions_admin only)"],
6260
+ discriminator: [206, 97, 120, 172, 113, 204, 169, 70],
5974
6261
  accounts: [
5975
6262
  {
5976
6263
  name: "group",
5977
6264
  relations: ["bank"]
5978
6265
  },
6266
+ {
6267
+ name: "delegate_emissions_admin",
6268
+ writable: true,
6269
+ signer: true,
6270
+ relations: ["group"]
6271
+ },
5979
6272
  {
5980
6273
  name: "bank",
5981
6274
  writable: true
@@ -6023,7 +6316,7 @@ var marginfi_0_1_8_default = {
6023
6316
  }
6024
6317
  },
6025
6318
  {
6026
- name: "emissions_vault",
6319
+ name: "emissions_token_account",
6027
6320
  writable: true,
6028
6321
  pda: {
6029
6322
  seeds: [
@@ -6072,53 +6365,129 @@ var marginfi_0_1_8_default = {
6072
6365
  }
6073
6366
  },
6074
6367
  {
6075
- name: "fee_state",
6076
- pda: {
6077
- seeds: [
6078
- {
6079
- kind: "const",
6080
- value: [102, 101, 101, 115, 116, 97, 116, 101]
6081
- }
6082
- ]
6083
- }
6084
- },
6085
- {
6086
- name: "destination_account",
6087
- docs: ["emissions mint (validated in handler)."],
6368
+ name: "emissions_funding_account",
6369
+ docs: ["NOTE: This is a TokenAccount, spl transfer will validate it.", ""],
6088
6370
  writable: true
6089
6371
  },
6090
6372
  {
6091
6373
  name: "token_program"
6374
+ },
6375
+ {
6376
+ name: "system_program",
6377
+ address: "11111111111111111111111111111111"
6092
6378
  }
6093
6379
  ],
6094
- args: []
6380
+ args: [
6381
+ {
6382
+ name: "flags",
6383
+ type: "u64"
6384
+ },
6385
+ {
6386
+ name: "rate",
6387
+ type: "u64"
6388
+ },
6389
+ {
6390
+ name: "total_emissions",
6391
+ type: "u64"
6392
+ }
6393
+ ]
6095
6394
  },
6096
6395
  {
6097
- name: "lending_pool_set_fixed_oracle_price",
6098
- docs: ["(admin only)"],
6099
- discriminator: [28, 126, 127, 127, 60, 37, 211, 125],
6396
+ name: "lending_pool_update_emissions_parameters",
6397
+ docs: ["(delegate_emissions_admin only)"],
6398
+ discriminator: [55, 213, 224, 168, 153, 53, 197, 40],
6100
6399
  accounts: [
6101
6400
  {
6102
6401
  name: "group",
6103
6402
  relations: ["bank"]
6104
6403
  },
6105
6404
  {
6106
- name: "admin",
6405
+ name: "delegate_emissions_admin",
6406
+ writable: true,
6107
6407
  signer: true,
6108
6408
  relations: ["group"]
6109
6409
  },
6110
6410
  {
6111
6411
  name: "bank",
6112
6412
  writable: true
6413
+ },
6414
+ {
6415
+ name: "emissions_mint"
6416
+ },
6417
+ {
6418
+ name: "emissions_token_account",
6419
+ writable: true,
6420
+ pda: {
6421
+ seeds: [
6422
+ {
6423
+ kind: "const",
6424
+ value: [
6425
+ 101,
6426
+ 109,
6427
+ 105,
6428
+ 115,
6429
+ 115,
6430
+ 105,
6431
+ 111,
6432
+ 110,
6433
+ 115,
6434
+ 95,
6435
+ 116,
6436
+ 111,
6437
+ 107,
6438
+ 101,
6439
+ 110,
6440
+ 95,
6441
+ 97,
6442
+ 99,
6443
+ 99,
6444
+ 111,
6445
+ 117,
6446
+ 110,
6447
+ 116,
6448
+ 95,
6449
+ 115,
6450
+ 101,
6451
+ 101,
6452
+ 100
6453
+ ]
6454
+ },
6455
+ {
6456
+ kind: "account",
6457
+ path: "bank"
6458
+ },
6459
+ {
6460
+ kind: "account",
6461
+ path: "emissions_mint"
6462
+ }
6463
+ ]
6464
+ }
6465
+ },
6466
+ {
6467
+ name: "emissions_funding_account",
6468
+ writable: true
6469
+ },
6470
+ {
6471
+ name: "token_program"
6113
6472
  }
6114
6473
  ],
6115
6474
  args: [
6116
6475
  {
6117
- name: "price",
6476
+ name: "emissions_flags",
6118
6477
  type: {
6119
- defined: {
6120
- name: "WrappedI80F48"
6121
- }
6478
+ option: "u64"
6479
+ }
6480
+ },
6481
+ {
6482
+ name: "emissions_rate",
6483
+ type: {
6484
+ option: "u64"
6485
+ }
6486
+ },
6487
+ {
6488
+ name: "additional_emissions",
6489
+ type: {
6490
+ option: "u64"
6122
6491
  }
6123
6492
  }
6124
6493
  ]
@@ -6628,7 +6997,7 @@ var marginfi_0_1_8_default = {
6628
6997
  name: "marginfi_account_keeper_close_order",
6629
6998
  docs: [
6630
6999
  "(permissionless keeper) Close an existing Order after the user account was closed, or it no",
6631
- "longer has the associated positions, or the user has executed",
7000
+ "longer as the associated positions, or the user has executed",
6632
7001
  "`marginfi_account_set_keeper_close_flags`. Keeper keeps the rent."
6633
7002
  ],
6634
7003
  discriminator: [128, 114, 71, 46, 194, 71, 186, 106],
@@ -6854,7 +7223,8 @@ var marginfi_0_1_8_default = {
6854
7223
  {
6855
7224
  name: "marginfi_account_update_emissions_destination_account",
6856
7225
  docs: [
6857
- "(account authority) Set the wallet whose canonical ATA will receive off-chain emissions."
7226
+ "(account authority) Set the wallet whose canonical ATA will receive permissionless emissions",
7227
+ "withdrawals."
6858
7228
  ],
6859
7229
  discriminator: [73, 185, 162, 201, 111, 24, 116, 185],
6860
7230
  accounts: [
@@ -6864,11 +7234,12 @@ var marginfi_0_1_8_default = {
6864
7234
  },
6865
7235
  {
6866
7236
  name: "authority",
6867
- signer: true
7237
+ signer: true,
7238
+ relations: ["marginfi_account"]
6868
7239
  },
6869
7240
  {
6870
7241
  name: "destination_account",
6871
- docs: ["the canonical ATA for each emissions mint."]
7242
+ docs: ["User's earned emissions will be sent to the canonical ATA of this wallet.", ""]
6872
7243
  }
6873
7244
  ],
6874
7245
  args: []
@@ -6917,12 +7288,6 @@ var marginfi_0_1_8_default = {
6917
7288
  option: "pubkey"
6918
7289
  }
6919
7290
  },
6920
- {
6921
- name: "new_flow_admin",
6922
- type: {
6923
- option: "pubkey"
6924
- }
6925
- },
6926
7291
  {
6927
7292
  name: "new_emissions_admin",
6928
7293
  type: {
@@ -7171,6 +7536,7 @@ var marginfi_0_1_8_default = {
7171
7536
  accounts: [
7172
7537
  {
7173
7538
  name: "group",
7539
+ writable: true,
7174
7540
  relations: ["marginfi_account", "bank"]
7175
7541
  },
7176
7542
  {
@@ -7492,6 +7858,7 @@ var marginfi_0_1_8_default = {
7492
7858
  accounts: [
7493
7859
  {
7494
7860
  name: "group",
7861
+ writable: true,
7495
7862
  relations: ["marginfi_account", "bank"]
7496
7863
  },
7497
7864
  {
@@ -7831,91 +8198,6 @@ var marginfi_0_1_8_default = {
7831
8198
  }
7832
8199
  ]
7833
8200
  },
7834
- {
7835
- name: "update_deleverage_withdrawals",
7836
- docs: [
7837
- "(delegate_flow_admin only) Update the deleverage daily withdraw outflow with",
7838
- "aggregated data. The delegate flow admin aggregates",
7839
- "`DeleverageWithdrawFlowEvent` events off-chain and calls this instruction at intervals."
7840
- ],
7841
- discriminator: [56, 3, 181, 118, 27, 247, 207, 227],
7842
- accounts: [
7843
- {
7844
- name: "marginfi_group",
7845
- writable: true
7846
- },
7847
- {
7848
- name: "delegate_flow_admin",
7849
- signer: true,
7850
- relations: ["marginfi_group"]
7851
- }
7852
- ],
7853
- args: [
7854
- {
7855
- name: "outflow_usd",
7856
- type: "u32"
7857
- },
7858
- {
7859
- name: "update_seq",
7860
- type: "u64"
7861
- },
7862
- {
7863
- name: "event_start_slot",
7864
- type: "u64"
7865
- },
7866
- {
7867
- name: "event_end_slot",
7868
- type: "u64"
7869
- }
7870
- ]
7871
- },
7872
- {
7873
- name: "update_group_rate_limiter",
7874
- docs: [
7875
- "(delegate_flow_admin only) Update the group rate limiter with aggregated",
7876
- "inflow/outflow. The delegate flow admin aggregates",
7877
- "`RateLimitFlowEvent` events off-chain, converts to USD, and calls this instruction at",
7878
- "intervals to update group rate limiter state."
7879
- ],
7880
- discriminator: [23, 78, 60, 139, 187, 44, 129, 37],
7881
- accounts: [
7882
- {
7883
- name: "marginfi_group",
7884
- writable: true
7885
- },
7886
- {
7887
- name: "delegate_flow_admin",
7888
- signer: true,
7889
- relations: ["marginfi_group"]
7890
- }
7891
- ],
7892
- args: [
7893
- {
7894
- name: "outflow_usd",
7895
- type: {
7896
- option: "u64"
7897
- }
7898
- },
7899
- {
7900
- name: "inflow_usd",
7901
- type: {
7902
- option: "u64"
7903
- }
7904
- },
7905
- {
7906
- name: "update_seq",
7907
- type: "u64"
7908
- },
7909
- {
7910
- name: "event_start_slot",
7911
- type: "u64"
7912
- },
7913
- {
7914
- name: "event_end_slot",
7915
- type: "u64"
7916
- }
7917
- ]
7918
- },
7919
8201
  {
7920
8202
  name: "write_bank_metadata",
7921
8203
  docs: [
@@ -8026,10 +8308,6 @@ var marginfi_0_1_8_default = {
8026
8308
  name: "DeleverageEvent",
8027
8309
  discriminator: [161, 8, 108, 204, 209, 198, 12, 30]
8028
8310
  },
8029
- {
8030
- name: "DeleverageWithdrawFlowEvent",
8031
- discriminator: [109, 90, 139, 200, 10, 204, 84, 176]
8032
- },
8033
8311
  {
8034
8312
  name: "EditStakedSettingsEvent",
8035
8313
  discriminator: [29, 58, 155, 191, 75, 220, 145, 206]
@@ -8126,10 +8404,6 @@ var marginfi_0_1_8_default = {
8126
8404
  name: "MarginfiGroupCreateEvent",
8127
8405
  discriminator: [233, 125, 61, 14, 98, 240, 136, 253]
8128
8406
  },
8129
- {
8130
- name: "RateLimitFlowEvent",
8131
- discriminator: [229, 5, 73, 200, 0, 107, 105, 109]
8132
- },
8133
8407
  {
8134
8408
  name: "SetKeeperCloseFlagsEvent",
8135
8409
  discriminator: [193, 230, 93, 128, 117, 87, 96, 21]
@@ -8736,66 +9010,6 @@ var marginfi_0_1_8_default = {
8736
9010
  name: "InvalidRateLimitPrice",
8737
9011
  msg: "Invalid rate limit price: pass oracle or pre-crank cache"
8738
9012
  },
8739
- {
8740
- code: 6120,
8741
- name: "GroupRateLimiterUpdateEmpty",
8742
- msg: "Group rate limiter admin update must include inflow and/or outflow"
8743
- },
8744
- {
8745
- code: 6121,
8746
- name: "GroupRateLimiterUpdateInvalidSlotRange",
8747
- msg: "Group rate limiter admin update slot range is invalid"
8748
- },
8749
- {
8750
- code: 6122,
8751
- name: "GroupRateLimiterUpdateFutureSlot",
8752
- msg: "Group rate limiter admin update cannot reference future slots"
8753
- },
8754
- {
8755
- code: 6123,
8756
- name: "GroupRateLimiterUpdateStale",
8757
- msg: "Group rate limiter admin update is too stale"
8758
- },
8759
- {
8760
- code: 6124,
8761
- name: "GroupRateLimiterUpdateOutOfOrderSlot",
8762
- msg: "Group rate limiter admin update slot progression is out of order"
8763
- },
8764
- {
8765
- code: 6125,
8766
- name: "GroupRateLimiterUpdateOutOfOrderSeq",
8767
- msg: "Group rate limiter admin update sequence is out of order"
8768
- },
8769
- {
8770
- code: 6126,
8771
- name: "DeleverageWithdrawalUpdateEmpty",
8772
- msg: "Deleverage withdrawal admin update must include outflow"
8773
- },
8774
- {
8775
- code: 6127,
8776
- name: "DeleverageWithdrawalUpdateInvalidSlotRange",
8777
- msg: "Deleverage withdrawal admin update slot range is invalid"
8778
- },
8779
- {
8780
- code: 6128,
8781
- name: "DeleverageWithdrawalUpdateFutureSlot",
8782
- msg: "Deleverage withdrawal admin update cannot reference future slots"
8783
- },
8784
- {
8785
- code: 6129,
8786
- name: "DeleverageWithdrawalUpdateStale",
8787
- msg: "Deleverage withdrawal admin update is too stale"
8788
- },
8789
- {
8790
- code: 6130,
8791
- name: "DeleverageWithdrawalUpdateOutOfOrderSlot",
8792
- msg: "Deleverage withdrawal admin update slot progression is out of order"
8793
- },
8794
- {
8795
- code: 6131,
8796
- name: "DeleverageWithdrawalUpdateOutOfOrderSeq",
8797
- msg: "Deleverage withdrawal admin update sequence is out of order"
8798
- },
8799
9013
  {
8800
9014
  code: 6200,
8801
9015
  name: "WrongAssetTagForStandardInstructions",
@@ -9601,7 +9815,7 @@ var marginfi_0_1_8_default = {
9601
9815
  {
9602
9816
  name: "_pad_0",
9603
9817
  type: {
9604
- array: ["u8", 16]
9818
+ array: ["u8", 8]
9605
9819
  }
9606
9820
  },
9607
9821
  {
@@ -9719,10 +9933,8 @@ var marginfi_0_1_8_default = {
9719
9933
  "Liquidate as an additional safeguard, if the liquidation prices stored here were to be",
9720
9934
  "edited between start and end, it would completely break the risk engine. End validates that",
9721
9935
  "the lock is set, panics if not, and removes it - which prevents footguns if the cache was",
9722
- "e.g. accidently set to default. The lock is also removed when a Balance is closed via",
9723
- "withdraw_all, repay_all, or close_balance, but only when the account has",
9724
- "ACCOUNT_IN_RECEIVERSHIP set, so that operations on unrelated accounts sharing the same",
9725
- "bank do not interfere with an in-progress liquidation."
9936
+ "e.g. accidently set to default. The lock is also removed when a Balance is closed with",
9937
+ "repay_all or withdraw_all, since those Balances can be omitted from the risk check at End."
9726
9938
  ],
9727
9939
  type: "u8"
9728
9940
  },
@@ -10365,6 +10577,16 @@ var marginfi_0_1_8_default = {
10365
10577
  name: "RateLimitWindow"
10366
10578
  }
10367
10579
  }
10580
+ },
10581
+ {
10582
+ name: "untracked_inflow",
10583
+ docs: [
10584
+ "Native token inflows pending USD conversion for group rate limiter.",
10585
+ "When deposits/repays occur without a valid oracle price, the amount is",
10586
+ "recorded here and later applied to the group rate limiter when a valid",
10587
+ "price becomes available (e.g., during pulse_bank_price_cache or outflow operations)."
10588
+ ],
10589
+ type: "i64"
10368
10590
  }
10369
10591
  ]
10370
10592
  }
@@ -10393,41 +10615,6 @@ var marginfi_0_1_8_default = {
10393
10615
  ]
10394
10616
  }
10395
10617
  },
10396
- {
10397
- name: "DeleverageWithdrawFlowEvent",
10398
- docs: [
10399
- "Emitted for deleverage-only withdraw outflows.",
10400
- "The delegate flow admin aggregates these off-chain and",
10401
- "updates the deleverage daily withdraws via `update_deleverage_withdrawals`."
10402
- ],
10403
- type: {
10404
- kind: "struct",
10405
- fields: [
10406
- {
10407
- name: "group",
10408
- type: "pubkey"
10409
- },
10410
- {
10411
- name: "bank",
10412
- type: "pubkey"
10413
- },
10414
- {
10415
- name: "mint",
10416
- type: "pubkey"
10417
- },
10418
- {
10419
- name: "outflow_usd",
10420
- docs: ["Equity-denominated outflow value in USD, rounded to integer."],
10421
- type: "u32"
10422
- },
10423
- {
10424
- name: "current_timestamp",
10425
- docs: ["Unix timestamp when the flow was recorded"],
10426
- type: "i64"
10427
- }
10428
- ]
10429
- }
10430
- },
10431
10618
  {
10432
10619
  name: "DriftConfigCompact",
10433
10620
  docs: [
@@ -11736,7 +11923,7 @@ var marginfi_0_1_8_default = {
11736
11923
  "(i.e. no implicit padding). This is important because `Pubkey` has alignment=1 while `u64`",
11737
11924
  "has alignment=8; using plain `repr(C)` would insert padding before the first `u64`."
11738
11925
  ],
11739
- serialization: "bytemuck",
11926
+ serialization: "bytemuckunsafe",
11740
11927
  repr: {
11741
11928
  kind: "c",
11742
11929
  packed: true
@@ -12583,7 +12770,12 @@ var marginfi_0_1_8_default = {
12583
12770
  },
12584
12771
  {
12585
12772
  name: "emissions_destination_account",
12586
- docs: ["Wallet whose canonical ATA receives off-chain emissions distributions."],
12773
+ docs: [
12774
+ "Set with `update_emissions_destination_account`. Emissions rewards can be withdrawn to the",
12775
+ "canonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).",
12776
+ "If pubkey default, the user has not opted into this feature, and must claim emissions",
12777
+ "manually (withdraw_emissions)."
12778
+ ],
12587
12779
  type: "pubkey"
12588
12780
  },
12589
12781
  {
@@ -12856,7 +13048,7 @@ var marginfi_0_1_8_default = {
12856
13048
  name: "emode_admin",
12857
13049
  docs: [
12858
13050
  "This admin can configure collateral ratios above (but not below) the collateral ratio of",
12859
- "certain banks, e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
13051
+ "certain banks , e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
12860
13052
  "the default rate."
12861
13053
  ],
12862
13054
  type: "pubkey"
@@ -12957,40 +13149,6 @@ var marginfi_0_1_8_default = {
12957
13149
  }
12958
13150
  }
12959
13151
  },
12960
- {
12961
- name: "rate_limiter_last_admin_update_slot",
12962
- docs: ["Last slot covered by an admin group rate limiter aggregation update."],
12963
- type: "u64"
12964
- },
12965
- {
12966
- name: "rate_limiter_last_admin_update_seq",
12967
- docs: [
12968
- "Monotonic sequence number for admin group rate limiter updates.",
12969
- "This is used to enforce strict ordering and prevent duplicate/replayed batches",
12970
- "when slot ranges overlap or multiple updates happen in the same slot."
12971
- ],
12972
- type: "u64"
12973
- },
12974
- {
12975
- name: "deleverage_withdraw_last_admin_update_slot",
12976
- docs: ["Last slot covered by an admin deleverage withdraw-limit aggregation update."],
12977
- type: "u64"
12978
- },
12979
- {
12980
- name: "deleverage_withdraw_last_admin_update_seq",
12981
- docs: ["Monotonic sequence number for admin deleverage withdraw-limit updates."],
12982
- type: "u64"
12983
- },
12984
- {
12985
- name: "delegate_flow_admin",
12986
- docs: [
12987
- "Can modify flow-control status for the group, i.e. update the withdraw caches with flow",
12988
- "information from banks. Typically this is a hot wallet that lives in e.g. some cron job. If",
12989
- "compromised, flow control can be effectively disabled until the admin is restored, which",
12990
- "does not itself compromise any funds, and is merely annoying."
12991
- ],
12992
- type: "pubkey"
12993
- },
12994
13152
  {
12995
13153
  name: "_padding_0",
12996
13154
  type: {
@@ -12998,7 +13156,7 @@ var marginfi_0_1_8_default = {
12998
13156
  {
12999
13157
  array: ["u64", 2]
13000
13158
  },
13001
- 2
13159
+ 6
13002
13160
  ]
13003
13161
  }
13004
13162
  },
@@ -14109,50 +14267,6 @@ var marginfi_0_1_8_default = {
14109
14267
  ]
14110
14268
  }
14111
14269
  },
14112
- {
14113
- name: "RateLimitFlowEvent",
14114
- docs: [
14115
- "Emitted when a bank-level inflow or outflow is recorded.",
14116
- "The delegate flow admin aggregates these off-chain and",
14117
- "updates the group rate limiter via `update_group_rate_limiter`."
14118
- ],
14119
- type: {
14120
- kind: "struct",
14121
- fields: [
14122
- {
14123
- name: "group",
14124
- type: "pubkey"
14125
- },
14126
- {
14127
- name: "bank",
14128
- type: "pubkey"
14129
- },
14130
- {
14131
- name: "mint",
14132
- type: "pubkey"
14133
- },
14134
- {
14135
- name: "flow_direction",
14136
- docs: ["0 = outflow (withdraw/borrow), 1 = inflow (deposit/repay)"],
14137
- type: "u8"
14138
- },
14139
- {
14140
- name: "native_amount",
14141
- docs: ["Amount in native tokens"],
14142
- type: "u64"
14143
- },
14144
- {
14145
- name: "mint_decimals",
14146
- type: "u8"
14147
- },
14148
- {
14149
- name: "current_timestamp",
14150
- docs: ["Unix timestamp when the flow was recorded"],
14151
- type: "i64"
14152
- }
14153
- ]
14154
- }
14155
- },
14156
14270
  {
14157
14271
  name: "RateLimitWindow",
14158
14272
  docs: [
@@ -14875,7 +14989,7 @@ var marginfi_0_1_8_default = {
14875
14989
  };
14876
14990
 
14877
14991
  // src/idl/index.ts
14878
- var MARGINFI_IDL = marginfi_0_1_8_default;
14992
+ var MARGINFI_IDL = marginfi_0_1_7_default;
14879
14993
  function decodeInstruction(idl, encoded) {
14880
14994
  const coder = new anchor.BorshInstructionCoder(idl);
14881
14995
  return coder.decode(encoded, "base58");
@@ -15048,9 +15162,48 @@ var MintLayout = bufferLayout.struct([
15048
15162
  bufferLayoutUtils.publicKey("freezeAuthority")
15049
15163
  ]);
15050
15164
  MintLayout.span;
15165
+ var approveInstructionData = bufferLayout.struct([
15166
+ bufferLayout.u8("instruction"),
15167
+ bufferLayoutUtils.u64("amount")
15168
+ ]);
15169
+ function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
15170
+ const keys = addSigners(
15171
+ [
15172
+ { pubkey: account, isSigner: false, isWritable: true },
15173
+ { pubkey: delegate, isSigner: false, isWritable: false }
15174
+ ],
15175
+ owner,
15176
+ multiSigners
15177
+ );
15178
+ const data = buffer.Buffer.alloc(approveInstructionData.span);
15179
+ approveInstructionData.encode(
15180
+ {
15181
+ instruction: 4 /* Approve */,
15182
+ amount: BigInt(amount)
15183
+ },
15184
+ data
15185
+ );
15186
+ return new web3_js.TransactionInstruction({ keys, programId, data });
15187
+ }
15051
15188
  bufferLayout.struct([
15052
15189
  bufferLayout.u8("instruction")
15053
15190
  ]);
15191
+ function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
15192
+ const keys = [
15193
+ { pubkey: payer, isSigner: true, isWritable: true },
15194
+ { pubkey: associatedToken, isSigner: false, isWritable: true },
15195
+ { pubkey: owner, isSigner: false, isWritable: false },
15196
+ { pubkey: mint, isSigner: false, isWritable: false },
15197
+ { pubkey: web3_js.SystemProgram.programId, isSigner: false, isWritable: false },
15198
+ { pubkey: programId, isSigner: false, isWritable: false },
15199
+ { pubkey: web3_js.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }
15200
+ ];
15201
+ return new web3_js.TransactionInstruction({
15202
+ keys,
15203
+ programId: associatedTokenProgramId,
15204
+ data: buffer.Buffer.alloc(0)
15205
+ });
15206
+ }
15054
15207
  function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
15055
15208
  return buildAssociatedTokenAccountInstruction(
15056
15209
  payer,
@@ -15403,6 +15556,7 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
15403
15556
  bank,
15404
15557
  destinationTokenAccount,
15405
15558
  lendingMarket,
15559
+ reserveLiquidityMint,
15406
15560
  lendingMarketAuthority,
15407
15561
  reserveLiquiditySupply,
15408
15562
  reserveCollateralMint,
@@ -15417,6 +15571,7 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
15417
15571
  bank,
15418
15572
  destinationTokenAccount,
15419
15573
  lendingMarket,
15574
+ reserveLiquidityMint,
15420
15575
  lendingMarketAuthority,
15421
15576
  reserveLiquiditySupply,
15422
15577
  reserveCollateralMint,
@@ -15461,11 +15616,14 @@ function makeLendingAccountLiquidateIx(mfiProgram, accounts, args, remainingAcco
15461
15616
  tokenProgram
15462
15617
  }).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
15463
15618
  }
15464
- function makeLendingAccountClearEmissionsIx(mfiProgram, accounts) {
15465
- return mfiProgram.methods.lendingAccountClearEmissions().accounts({
15466
- marginfiAccount: accounts.marginfiAccount,
15467
- bank: accounts.bank
15468
- }).instruction();
15619
+ function makelendingAccountWithdrawEmissionIx(mfiProgram, accounts) {
15620
+ const { marginfiAccount, destinationAccount, bank, tokenProgram, ...optionalAccounts } = accounts;
15621
+ return mfiProgram.methods.lendingAccountWithdrawEmissions().accounts({
15622
+ marginfiAccount,
15623
+ destinationAccount,
15624
+ bank,
15625
+ tokenProgram
15626
+ }).accountsPartial(optionalAccounts).instruction();
15469
15627
  }
15470
15628
  function makePoolConfigureBankIx(mfiProgram, accounts, args) {
15471
15629
  const { bank, ...optionalAccounts } = accounts;
@@ -15565,7 +15723,7 @@ var instructions = {
15565
15723
  makeInitMarginfiAccountIx,
15566
15724
  makeInitMarginfiAccountPdaIx,
15567
15725
  makeLendingAccountLiquidateIx,
15568
- makeLendingAccountClearEmissionsIx,
15726
+ makelendingAccountWithdrawEmissionIx,
15569
15727
  makePoolAddBankIx,
15570
15728
  makePoolConfigureBankIx,
15571
15729
  makeBeginFlashLoanIx,
@@ -16070,7 +16228,7 @@ function parseEmodeSettingsRaw(emodeSettingsRaw) {
16070
16228
  };
16071
16229
  return emodeSettings;
16072
16230
  }
16073
- function parseBankRaw(address, accountParsed, bankMetadata, mintData) {
16231
+ function parseBankRaw(address, accountParsed, bankMetadata) {
16074
16232
  const flags = accountParsed.flags.toNumber();
16075
16233
  const mint = accountParsed.mint;
16076
16234
  const mintDecimals = accountParsed.mintDecimals;
@@ -16169,8 +16327,6 @@ function parseBankRaw(address, accountParsed, bankMetadata, mintData) {
16169
16327
  borrowingPositionCount,
16170
16328
  emode,
16171
16329
  tokenSymbol,
16172
- mintRate: mintData?.mintRate ?? null,
16173
- mintPrice: mintData?.mintPrice ?? 0,
16174
16330
  kaminoIntegrationAccounts,
16175
16331
  driftIntegrationAccounts,
16176
16332
  solendIntegrationAccounts,
@@ -16211,9 +16367,6 @@ function dtoToBank(bankDto) {
16211
16367
  feesDestinationAccount: bankDto.feesDestinationAccount ? new web3_js.PublicKey(bankDto.feesDestinationAccount) : void 0,
16212
16368
  lendingPositionCount: bankDto.lendingPositionCount ? new BigNumber3__default.default(bankDto.lendingPositionCount) : void 0,
16213
16369
  borrowingPositionCount: bankDto.borrowingPositionCount ? new BigNumber3__default.default(bankDto.borrowingPositionCount) : void 0,
16214
- mintRate: null,
16215
- // TODO: move these out
16216
- mintPrice: 0,
16217
16370
  kaminoIntegrationAccounts: bankDto.kaminoIntegrationAccounts ? {
16218
16371
  kaminoReserve: new web3_js.PublicKey(bankDto.kaminoIntegrationAccounts.kaminoReserve),
16219
16372
  kaminoObligation: new web3_js.PublicKey(bankDto.kaminoIntegrationAccounts.kaminoObligation)
@@ -43260,6 +43413,169 @@ new Fraction(new BN11__default.default(0));
43260
43413
  function roundNearest(decimal) {
43261
43414
  return decimal.toDecimalPlaces(0, Decimal3__default.default.ROUND_HALF_CEIL);
43262
43415
  }
43416
+ var SinglePoolInstruction = {
43417
+ initializePool: (voteAccount) => {
43418
+ const pool = findPoolAddress(voteAccount);
43419
+ const stake = findPoolStakeAddress(pool);
43420
+ const mint = findPoolMintAddress(pool);
43421
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
43422
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
43423
+ return createTransactionInstruction(
43424
+ SINGLE_POOL_PROGRAM_ID,
43425
+ [
43426
+ { pubkey: voteAccount, isSigner: false, isWritable: false },
43427
+ { pubkey: pool, isSigner: false, isWritable: true },
43428
+ { pubkey: stake, isSigner: false, isWritable: true },
43429
+ { pubkey: mint, isSigner: false, isWritable: true },
43430
+ { pubkey: stakeAuthority, isSigner: false, isWritable: false },
43431
+ { pubkey: mintAuthority, isSigner: false, isWritable: false },
43432
+ { pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
43433
+ { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
43434
+ { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
43435
+ { pubkey: web3_js.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
43436
+ { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
43437
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
43438
+ { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
43439
+ ],
43440
+ Buffer.from([0 /* InitializePool */])
43441
+ );
43442
+ },
43443
+ initializeOnRamp: (pool) => {
43444
+ const onRamp = findPoolOnRampAddress(pool);
43445
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
43446
+ return createTransactionInstruction(
43447
+ SINGLE_POOL_PROGRAM_ID,
43448
+ [
43449
+ { pubkey: pool, isSigner: false, isWritable: false },
43450
+ { pubkey: onRamp, isSigner: false, isWritable: true },
43451
+ { pubkey: stakeAuthority, isSigner: false, isWritable: false },
43452
+ { pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
43453
+ { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
43454
+ { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
43455
+ ],
43456
+ Buffer.from([6 /* InitializeOnRamp */])
43457
+ );
43458
+ },
43459
+ depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
43460
+ const stake = findPoolStakeAddress(pool);
43461
+ const mint = findPoolMintAddress(pool);
43462
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
43463
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
43464
+ return createTransactionInstruction(
43465
+ SINGLE_POOL_PROGRAM_ID,
43466
+ [
43467
+ { pubkey: pool, isSigner: false, isWritable: false },
43468
+ { pubkey: stake, isSigner: false, isWritable: true },
43469
+ { pubkey: mint, isSigner: false, isWritable: true },
43470
+ { pubkey: stakeAuthority, isSigner: false, isWritable: false },
43471
+ { pubkey: mintAuthority, isSigner: false, isWritable: false },
43472
+ { pubkey: userStakeAccount, isSigner: false, isWritable: true },
43473
+ { pubkey: userTokenAccount, isSigner: false, isWritable: true },
43474
+ { pubkey: userLamportAccount, isSigner: false, isWritable: true },
43475
+ { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
43476
+ { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
43477
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
43478
+ { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
43479
+ ],
43480
+ Buffer.from([2 /* DepositStake */])
43481
+ );
43482
+ },
43483
+ withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
43484
+ const stake = findPoolStakeAddress(pool);
43485
+ const mint = findPoolMintAddress(pool);
43486
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
43487
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
43488
+ const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
43489
+ const data = Buffer.concat([
43490
+ Buffer.from([3 /* WithdrawStake */]),
43491
+ userStakeAuthority.toBuffer(),
43492
+ Buffer.from(new BN11.BN(rawAmount.toString()).toArray("le", 8))
43493
+ ]);
43494
+ return createTransactionInstruction(
43495
+ SINGLE_POOL_PROGRAM_ID,
43496
+ [
43497
+ { pubkey: pool, isSigner: false, isWritable: false },
43498
+ { pubkey: stake, isSigner: false, isWritable: true },
43499
+ { pubkey: mint, isSigner: false, isWritable: true },
43500
+ { pubkey: stakeAuthority, isSigner: false, isWritable: false },
43501
+ { pubkey: mintAuthority, isSigner: false, isWritable: false },
43502
+ { pubkey: userStakeAccount, isSigner: false, isWritable: true },
43503
+ { pubkey: userTokenAccount, isSigner: false, isWritable: true },
43504
+ { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
43505
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
43506
+ { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
43507
+ ],
43508
+ data
43509
+ );
43510
+ },
43511
+ createTokenMetadata: async (pool, payer) => {
43512
+ const mint = findPoolMintAddress(pool);
43513
+ const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
43514
+ findPoolMintAuthorityAddress(pool),
43515
+ findPoolMplAuthorityAddress(pool),
43516
+ findMplMetadataAddress(mint)
43517
+ ]);
43518
+ return createTransactionInstruction(
43519
+ SINGLE_POOL_PROGRAM_ID,
43520
+ [
43521
+ { pubkey: pool, isSigner: false, isWritable: false },
43522
+ { pubkey: mint, isSigner: false, isWritable: false },
43523
+ { pubkey: mintAuthority, isSigner: false, isWritable: false },
43524
+ { pubkey: mplAuthority, isSigner: false, isWritable: false },
43525
+ { pubkey: payer, isSigner: true, isWritable: true },
43526
+ { pubkey: mplMetadata, isSigner: false, isWritable: true },
43527
+ { pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
43528
+ { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false }
43529
+ ],
43530
+ Buffer.from([4 /* CreateTokenMetadata */])
43531
+ );
43532
+ },
43533
+ updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
43534
+ if (tokenName.length > 32) {
43535
+ throw new Error("maximum token name length is 32 characters");
43536
+ }
43537
+ if (tokenSymbol.length > 10) {
43538
+ throw new Error("maximum token symbol length is 10 characters");
43539
+ }
43540
+ if (tokenUri.length > 200) {
43541
+ throw new Error("maximum token uri length is 200 characters");
43542
+ }
43543
+ const pool = findPoolAddress(voteAccount);
43544
+ const [mint, mplAuthority] = await Promise.all([
43545
+ findPoolMintAddress(pool),
43546
+ findPoolMplAuthorityAddress(pool)
43547
+ ]);
43548
+ const mplMetadata = await findMplMetadataAddress(mint);
43549
+ const data = Buffer.concat([
43550
+ Buffer.from([5 /* UpdateTokenMetadata */]),
43551
+ Buffer.from(new Uint32Array([tokenName.length]).buffer),
43552
+ Buffer.from(tokenName),
43553
+ Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
43554
+ Buffer.from(tokenSymbol),
43555
+ Buffer.from(new Uint32Array([tokenUri.length]).buffer),
43556
+ Buffer.from(tokenUri)
43557
+ ]);
43558
+ return createTransactionInstruction(
43559
+ SINGLE_POOL_PROGRAM_ID,
43560
+ [
43561
+ { pubkey: voteAccount, isSigner: false, isWritable: false },
43562
+ { pubkey: pool, isSigner: false, isWritable: false },
43563
+ { pubkey: mplAuthority, isSigner: false, isWritable: false },
43564
+ { pubkey: authorizedWithdrawer, isSigner: true, isWritable: false },
43565
+ { pubkey: mplMetadata, isSigner: false, isWritable: true },
43566
+ { pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
43567
+ ],
43568
+ data
43569
+ );
43570
+ }
43571
+ };
43572
+ var createTransactionInstruction = (programId, keys, data) => {
43573
+ return {
43574
+ programId,
43575
+ keys,
43576
+ data
43577
+ };
43578
+ };
43263
43579
  var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
43264
43580
  const [pda] = web3_js.PublicKey.findProgramAddressSync(
43265
43581
  [Buffer.from(prefix), baseAddress.toBuffer()],
@@ -43270,7 +43586,17 @@ var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
43270
43586
  var findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
43271
43587
  var findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
43272
43588
  var findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
43589
+ var findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
43590
+ var findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
43591
+ var findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
43273
43592
  var findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
43593
+ var findMplMetadataAddress = async (poolMintAddress) => {
43594
+ const [pda] = web3_js.PublicKey.findProgramAddressSync(
43595
+ [Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
43596
+ MPL_METADATA_PROGRAM_ID
43597
+ );
43598
+ return pda;
43599
+ };
43274
43600
  BigInt(33);
43275
43601
  BigInt(200);
43276
43602
  BigInt(82);
@@ -43825,7 +44151,7 @@ var SEED_RESERVE = "reserve";
43825
44151
  var SEED_RATE_MODEL = "rate_model";
43826
44152
  var SEED_USER_SUPPLY_POSITION = "user_supply_position";
43827
44153
  var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
43828
- function getAllDerivedJupLendAccounts(mint, tokenProgram) {
44154
+ function getAllDerivedJupLendAccounts(mint) {
43829
44155
  const [fTokenMint] = deriveJupLendFTokenMint(mint);
43830
44156
  const [lending] = deriveJupLendLending(mint, fTokenMint);
43831
44157
  const [liquidity] = deriveJupLendLiquidity();
@@ -43835,7 +44161,7 @@ function getAllDerivedJupLendAccounts(mint, tokenProgram) {
43835
44161
  supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
43836
44162
  lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
43837
44163
  rateModel: deriveJupLendRateModel(mint)[0],
43838
- vault: deriveJupLendLiquidityVaultAta(mint, liquidity, tokenProgram),
44164
+ vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
43839
44165
  liquidity,
43840
44166
  rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
43841
44167
  };
@@ -44282,7 +44608,7 @@ var DISCRIMINATORS = {
44282
44608
  LENDING_ACCOUNT_WITHDRAW: Buffer.from([36, 72, 74, 19, 210, 210, 192, 192]),
44283
44609
  LENDING_ACCOUNT_BORROW: Buffer.from([4, 126, 116, 53, 48, 5, 212, 31]),
44284
44610
  LENDING_ACCOUNT_LIQUIDATE: Buffer.from([214, 169, 151, 213, 251, 167, 86, 219]),
44285
- LENDING_ACCOUNT_CLEAR_EMISSIONS: Buffer.from([239, 4, 221, 98, 45, 167, 201, 244]),
44611
+ LENDING_ACCOUNT_WITHDRAW_EMISSIONS: Buffer.from([234, 22, 84, 214, 118, 176, 140, 170]),
44286
44612
  LENDING_POOL_ADD_BANK: Buffer.from([215, 68, 72, 78, 208, 218, 103, 182]),
44287
44613
  LENDING_POOL_CONFIGURE_BANK: Buffer.from([121, 173, 156, 40, 93, 148, 56, 237]),
44288
44614
  LENDING_ACCOUNT_START_FLASHLOAN: Buffer.from([14, 131, 33, 220, 81, 186, 180, 107]),
@@ -44369,7 +44695,7 @@ function makeWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
44369
44695
  const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
44370
44696
  const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
44371
44697
  const keys = [
44372
- { pubkey: accounts.group, isSigner: false, isWritable: false },
44698
+ { pubkey: accounts.group, isSigner: false, isWritable: true },
44373
44699
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44374
44700
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
44375
44701
  { pubkey: accounts.bank, isSigner: false, isWritable: true },
@@ -44525,7 +44851,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
44525
44851
  const liquidityVaultAuthority = deriveBankLiquidityVaultAuthority(programId, accounts.bank)[0];
44526
44852
  const liquidityVault = deriveBankLiquidityVault(programId, accounts.bank)[0];
44527
44853
  const keys = [
44528
- { pubkey: accounts.group, isSigner: false, isWritable: false },
44854
+ { pubkey: accounts.group, isSigner: false, isWritable: true },
44529
44855
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44530
44856
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
44531
44857
  { pubkey: accounts.bank, isSigner: false, isWritable: true },
@@ -44545,7 +44871,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
44545
44871
  },
44546
44872
  { pubkey: accounts.integrationAcc1, isSigner: false, isWritable: true },
44547
44873
  {
44548
- pubkey: accounts.mint,
44874
+ pubkey: accounts.reserveLiquidityMint,
44549
44875
  isSigner: false,
44550
44876
  isWritable: true
44551
44877
  },
@@ -44632,15 +44958,22 @@ function makeLendingAccountLiquidateIx2(programId, accounts, args, remainingAcco
44632
44958
  ]);
44633
44959
  return new web3_js.TransactionInstruction({ keys, programId, data });
44634
44960
  }
44635
- function makeLendingAccountClearEmissionsIx2(programId, accounts) {
44961
+ function makelendingAccountWithdrawEmissionIx2(programId, accounts) {
44636
44962
  const keys = [
44963
+ { pubkey: accounts.group, isSigner: false, isWritable: false },
44637
44964
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44638
- { pubkey: accounts.bank, isSigner: false, isWritable: false }
44965
+ { pubkey: accounts.authority, isSigner: true, isWritable: false },
44966
+ { pubkey: accounts.bank, isSigner: false, isWritable: true },
44967
+ { pubkey: accounts.emissionsMint, isSigner: false, isWritable: false },
44968
+ { pubkey: accounts.emissionsAuth, isSigner: false, isWritable: false },
44969
+ { pubkey: accounts.emissionsVault, isSigner: false, isWritable: true },
44970
+ { pubkey: accounts.destinationAccount, isSigner: false, isWritable: true },
44971
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
44639
44972
  ];
44640
44973
  return new web3_js.TransactionInstruction({
44641
44974
  keys,
44642
44975
  programId,
44643
- data: DISCRIMINATORS.LENDING_ACCOUNT_CLEAR_EMISSIONS
44976
+ data: DISCRIMINATORS.LENDING_ACCOUNT_WITHDRAW_EMISSIONS
44644
44977
  });
44645
44978
  }
44646
44979
  function makeCloseAccountIx2(programId, accounts) {
@@ -44803,7 +45136,7 @@ function makeDriftWithdrawIx2(programId, accounts, args, remainingAccounts = [])
44803
45136
  const DRIFT_PROGRAM_ID2 = new web3_js.PublicKey("dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH");
44804
45137
  const SYSTEM_PROGRAM_ID2 = new web3_js.PublicKey("11111111111111111111111111111111");
44805
45138
  const keys = [
44806
- { pubkey: accounts.group, isSigner: false, isWritable: false },
45139
+ { pubkey: accounts.group, isSigner: false, isWritable: true },
44807
45140
  { pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
44808
45141
  { pubkey: accounts.authority, isSigner: true, isWritable: false },
44809
45142
  { pubkey: accounts.bank, isSigner: false, isWritable: true }
@@ -44938,7 +45271,7 @@ var syncInstructions = {
44938
45271
  makeKaminoWithdrawIx: makeKaminoWithdrawIx2,
44939
45272
  makeBorrowIx: makeBorrowIx2,
44940
45273
  makeLendingAccountLiquidateIx: makeLendingAccountLiquidateIx2,
44941
- makeLendingAccountClearEmissionsIx: makeLendingAccountClearEmissionsIx2,
45274
+ makelendingAccountWithdrawEmissionIx: makelendingAccountWithdrawEmissionIx2,
44942
45275
  makePoolAddBankIx: makePoolAddBankIx2,
44943
45276
  makePoolConfigureBankIx: makePoolConfigureBankIx2,
44944
45277
  makeBeginFlashLoanIx: makeBeginFlashLoanIx2,
@@ -45230,7 +45563,7 @@ async function makeKaminoWithdrawIx3({
45230
45563
  lendingMarket,
45231
45564
  lendingMarketAuthority,
45232
45565
  integrationAcc1: bank.kaminoIntegrationAccounts.kaminoReserve,
45233
- mint: bank.mint,
45566
+ reserveLiquidityMint: bank.mint,
45234
45567
  reserveLiquiditySupply,
45235
45568
  reserveCollateralMint,
45236
45569
  reserveSourceCollateral: reserveDestinationDepositCollateral,
@@ -45254,7 +45587,7 @@ async function makeKaminoWithdrawIx3({
45254
45587
  bank: bank.address,
45255
45588
  destinationTokenAccount: userTokenAtaPk,
45256
45589
  lendingMarket,
45257
- mint: bank.mint,
45590
+ reserveLiquidityMint: bank.mint,
45258
45591
  lendingMarketAuthority,
45259
45592
  reserveLiquiditySupply,
45260
45593
  reserveCollateralMint,
@@ -45575,7 +45908,7 @@ async function makeJuplendWithdrawIx2({
45575
45908
  lendingAdmin,
45576
45909
  rateModel,
45577
45910
  vault,
45578
- liquidity} = getAllDerivedJupLendAccounts(bank.mint, tokenProgram);
45911
+ liquidity} = getAllDerivedJupLendAccounts(bank.mint);
45579
45912
  if (opts.observationBanksOverride) {
45580
45913
  remainingAccounts.push(...opts.observationBanksOverride);
45581
45914
  } else {
@@ -46198,7 +46531,7 @@ async function makeJuplendDepositIx2({
46198
46531
  if (!bank.jupLendIntegrationAccounts) {
46199
46532
  throw new Error("Bank has no JupLend integration accounts");
46200
46533
  }
46201
- const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint, tokenProgram);
46534
+ const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint);
46202
46535
  const {
46203
46536
  fTokenMint,
46204
46537
  lendingAdmin,
@@ -47147,14 +47480,37 @@ async function buildRepayWithCollatFlashloanTx({
47147
47480
  }
47148
47481
 
47149
47482
  // src/services/account/actions/emissions.ts
47150
- async function makeClearEmissionsIx(program, marginfiAccount, banks, bankAddress) {
47483
+ async function makeWithdrawEmissionsIx(program, marginfiAccount, banks, mintDatas, bankAddress) {
47151
47484
  const bank = banks.get(bankAddress.toBase58());
47152
47485
  if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
47153
- const clearEmissionsIx = await instructions_default.makeLendingAccountClearEmissionsIx(program, {
47486
+ const mintData = mintDatas.get(bankAddress.toBase58());
47487
+ if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);
47488
+ if (!mintData.emissionTokenProgram) {
47489
+ throw Error(`Emission token program not found for bank ${bankAddress.toBase58()}`);
47490
+ }
47491
+ let ixs = [];
47492
+ const userAta = getAssociatedTokenAddressSync(
47493
+ bank.emissionsMint,
47494
+ marginfiAccount.authority,
47495
+ true,
47496
+ mintData.emissionTokenProgram
47497
+ );
47498
+ const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(
47499
+ marginfiAccount.authority,
47500
+ userAta,
47501
+ marginfiAccount.authority,
47502
+ bank.emissionsMint,
47503
+ mintData.emissionTokenProgram
47504
+ );
47505
+ ixs.push(createAtaIdempotentIx);
47506
+ const withdrawEmissionsIx = await instructions_default.makelendingAccountWithdrawEmissionIx(program, {
47154
47507
  marginfiAccount: marginfiAccount.address,
47155
- bank: bank.address
47508
+ destinationAccount: userAta,
47509
+ bank: bank.address,
47510
+ tokenProgram: mintData.emissionTokenProgram
47156
47511
  });
47157
- return { instructions: [clearEmissionsIx], keys: [] };
47512
+ ixs.push(withdrawEmissionsIx);
47513
+ return { instructions: ixs, keys: [] };
47158
47514
  }
47159
47515
  async function makeSwapCollateralTx(params) {
47160
47516
  const {
@@ -47876,6 +48232,179 @@ async function buildSwapDebtFlashloanTx({
47876
48232
  }
47877
48233
  throw new Error("Failed to build swap debt flashloan tx");
47878
48234
  }
48235
+ var SYSVAR_CLOCK_ID2 = new web3_js.PublicKey("SysvarC1ock11111111111111111111111111111111");
48236
+ async function makeMintStakedLstIx(params) {
48237
+ const { amount, authority, stakeAccountPk, validator, connection } = params;
48238
+ const pool = findPoolAddress(validator);
48239
+ const lstMint = findPoolMintAddress(pool);
48240
+ const poolStakeAuth = findPoolStakeAuthorityAddress(pool);
48241
+ const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
48242
+ const [lstAccInfo, stakeAccInfoParsed, rentExemptReserve] = await Promise.all([
48243
+ connection.getAccountInfo(lstAta),
48244
+ connection.getParsedAccountInfo(stakeAccountPk),
48245
+ connection.getMinimumBalanceForRentExemption(web3_js.StakeProgram.space)
48246
+ ]);
48247
+ const stakeAccParsed = stakeAccInfoParsed?.value?.data;
48248
+ const amountLamports = Math.round(Number(amount) * web3_js.LAMPORTS_PER_SOL);
48249
+ const stakeAccLamports = Number(stakeAccParsed?.parsed?.info?.stake?.delegation?.stake ?? 0);
48250
+ const isFullStake = amountLamports >= stakeAccLamports;
48251
+ const instructions2 = [];
48252
+ const signers = [];
48253
+ if (!lstAccInfo) {
48254
+ instructions2.push(
48255
+ createAssociatedTokenAccountInstruction(authority, lstAta, authority, lstMint)
48256
+ );
48257
+ }
48258
+ let targetStakePubkey;
48259
+ if (!isFullStake) {
48260
+ const splitStakeAccount = web3_js.Keypair.generate();
48261
+ signers.push(splitStakeAccount);
48262
+ targetStakePubkey = splitStakeAccount.publicKey;
48263
+ instructions2.push(
48264
+ ...web3_js.StakeProgram.split(
48265
+ {
48266
+ stakePubkey: stakeAccountPk,
48267
+ authorizedPubkey: authority,
48268
+ splitStakePubkey: splitStakeAccount.publicKey,
48269
+ lamports: amountLamports
48270
+ },
48271
+ rentExemptReserve
48272
+ ).instructions
48273
+ );
48274
+ } else {
48275
+ targetStakePubkey = stakeAccountPk;
48276
+ }
48277
+ const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([
48278
+ web3_js.StakeProgram.authorize({
48279
+ stakePubkey: targetStakePubkey,
48280
+ authorizedPubkey: authority,
48281
+ newAuthorizedPubkey: poolStakeAuth,
48282
+ stakeAuthorizationType: web3_js.StakeAuthorizationLayout.Staker
48283
+ }).instructions,
48284
+ web3_js.StakeProgram.authorize({
48285
+ stakePubkey: targetStakePubkey,
48286
+ authorizedPubkey: authority,
48287
+ newAuthorizedPubkey: poolStakeAuth,
48288
+ stakeAuthorizationType: web3_js.StakeAuthorizationLayout.Withdrawer
48289
+ }).instructions
48290
+ ]);
48291
+ [authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {
48292
+ if (ix) {
48293
+ ix.keys = ix.keys.map((key) => ({
48294
+ ...key,
48295
+ isWritable: key.pubkey.equals(SYSVAR_CLOCK_ID2) ? false : key.isWritable
48296
+ }));
48297
+ }
48298
+ });
48299
+ instructions2.push(...authorizeStakerIx, ...authorizeWithdrawIx);
48300
+ const depositStakeIx = await SinglePoolInstruction.depositStake(
48301
+ pool,
48302
+ targetStakePubkey,
48303
+ lstAta,
48304
+ authority
48305
+ );
48306
+ instructions2.push(depositStakeIx);
48307
+ return { instructions: instructions2, keys: signers };
48308
+ }
48309
+ async function makeMintStakedLstTx(params) {
48310
+ const { connection, luts, blockhash: providedBlockhash } = params;
48311
+ const { instructions: instructions2, keys } = await makeMintStakedLstIx(params);
48312
+ const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
48313
+ const message = new web3_js.TransactionMessage({
48314
+ payerKey: params.authority,
48315
+ recentBlockhash: blockhash,
48316
+ instructions: instructions2
48317
+ }).compileToV0Message(luts);
48318
+ const tx = new web3_js.VersionedTransaction(message);
48319
+ return addTransactionMetadata(tx, {
48320
+ signers: keys,
48321
+ addressLookupTables: luts,
48322
+ type: "DEPOSIT_STAKE" /* DEPOSIT_STAKE */
48323
+ });
48324
+ }
48325
+ async function makeRedeemStakedLstIx(params) {
48326
+ const { amount, authority, validator, connection } = params;
48327
+ const pool = findPoolAddress(validator);
48328
+ const lstMint = findPoolMintAddress(pool);
48329
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
48330
+ const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
48331
+ const rentExemption = await connection.getMinimumBalanceForRentExemption(
48332
+ web3_js.StakeProgram.space
48333
+ );
48334
+ const stakeAmount = new BigNumber3__default.default(new BigNumber3__default.default(amount).toString());
48335
+ const instructions2 = [];
48336
+ const signers = [];
48337
+ const stakeAccount = web3_js.Keypair.generate();
48338
+ signers.push(stakeAccount);
48339
+ instructions2.push(
48340
+ web3_js.SystemProgram.createAccount({
48341
+ fromPubkey: authority,
48342
+ newAccountPubkey: stakeAccount.publicKey,
48343
+ lamports: rentExemption,
48344
+ space: web3_js.StakeProgram.space,
48345
+ programId: web3_js.StakeProgram.programId
48346
+ })
48347
+ );
48348
+ instructions2.push(
48349
+ createApproveInstruction(
48350
+ lstAta,
48351
+ mintAuthority,
48352
+ authority,
48353
+ BigInt(stakeAmount.multipliedBy(1e9).toFixed(0))
48354
+ )
48355
+ );
48356
+ const withdrawStakeIx = await SinglePoolInstruction.withdrawStake(
48357
+ pool,
48358
+ stakeAccount.publicKey,
48359
+ authority,
48360
+ lstAta,
48361
+ stakeAmount
48362
+ );
48363
+ instructions2.push(withdrawStakeIx);
48364
+ return { instructions: instructions2, keys: signers };
48365
+ }
48366
+ async function makeRedeemStakedLstTx(params) {
48367
+ const { connection, luts, blockhash: providedBlockhash } = params;
48368
+ const { instructions: instructions2, keys } = await makeRedeemStakedLstIx(params);
48369
+ const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
48370
+ const message = new web3_js.TransactionMessage({
48371
+ payerKey: params.authority,
48372
+ recentBlockhash: blockhash,
48373
+ instructions: instructions2
48374
+ }).compileToV0Message(luts);
48375
+ const tx = new web3_js.VersionedTransaction(message);
48376
+ return addTransactionMetadata(tx, {
48377
+ signers: keys,
48378
+ addressLookupTables: luts,
48379
+ type: "WITHDRAW_STAKE" /* WITHDRAW_STAKE */
48380
+ });
48381
+ }
48382
+ async function makeMergeStakeAccountsTx(params) {
48383
+ const {
48384
+ authority,
48385
+ sourceStakeAccount,
48386
+ destinationStakeAccount,
48387
+ connection,
48388
+ luts,
48389
+ blockhash: providedBlockhash
48390
+ } = params;
48391
+ const mergeIx = web3_js.StakeProgram.merge({
48392
+ stakePubkey: destinationStakeAccount,
48393
+ sourceStakePubKey: sourceStakeAccount,
48394
+ authorizedPubkey: authority
48395
+ }).instructions;
48396
+ const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
48397
+ const message = new web3_js.TransactionMessage({
48398
+ payerKey: authority,
48399
+ recentBlockhash: blockhash,
48400
+ instructions: mergeIx
48401
+ }).compileToV0Message(luts);
48402
+ const tx = new web3_js.VersionedTransaction(message);
48403
+ return addTransactionMetadata(tx, {
48404
+ addressLookupTables: luts,
48405
+ type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
48406
+ });
48407
+ }
47879
48408
 
47880
48409
  // src/services/account/services/account-simulation.service.ts
47881
48410
  async function simulateAccountHealthCacheWithFallback(params) {
@@ -49286,18 +49815,15 @@ var fetchPythOracleData = async (banks, opts) => {
49286
49815
  bankOraclePriceMap: /* @__PURE__ */ new Map()
49287
49816
  };
49288
49817
  }
49289
- pythStakedCollateralBanks.map((bank) => [
49290
- opts.validatorVoteAccountByBank?.[bank.address.toBase58()] ?? "",
49291
- bank.mint.toBase58()
49292
- ]);
49293
- const priceCoeffByBank = {};
49294
49818
  const combinedPythBanks = [
49295
49819
  ...pythPushBanks,
49820
+ ...pythStakedCollateralBanks,
49296
49821
  ...pythPushKaminosBanks,
49297
49822
  ...driftPythPullBanks,
49298
49823
  ...solendPythPullBanks,
49299
49824
  ...juplendPythPullBanks
49300
49825
  ];
49826
+ const priceCoeffByBank = {};
49301
49827
  const pythOracleKeys = extractPythOracleKeys(combinedPythBanks);
49302
49828
  const uniquePythOracleKeys = Array.from(new Set(pythOracleKeys));
49303
49829
  let oraclePrices;
@@ -50502,6 +51028,389 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
50502
51028
  }))
50503
51029
  };
50504
51030
  }
51031
+
51032
+ // src/services/native-stake/utils/metadata.data.ts
51033
+ var STAKED_BANK_METADATA_JSON = [
51034
+ {
51035
+ bankAddress: "8g5qG6PVygcVSXV1cJnjXaD1yhrDwcWAMQCY2wR9VuAf",
51036
+ validatorVoteAccount: "CooLbbZy5Xmdt7DiHPQ3ss2uRXawnTXXVgpMS8E8jDzr",
51037
+ tokenAddress: "BADo3D6nMtGnsAaTv3iEes8mMcq92TuFoBWebFe8kzeA",
51038
+ tokenName: "Cavey Cool",
51039
+ tokenSymbol: "COOL"
51040
+ },
51041
+ {
51042
+ bankAddress: "BuCckNm1djpp3vZVhvh1CrrniirY6sr2hwUmeP5kTcGz",
51043
+ validatorVoteAccount: "mrgn4t2JabSgvGnrCaHXMvz8ocr4F52scsxJnkQMQsQ",
51044
+ tokenAddress: "FUyAyVbYrMfiaN1QEQYFZTuBNzW5EJf3jWzjjymGqKLv",
51045
+ tokenName: "Project 0 Meridian",
51046
+ tokenSymbol: "MERIDIAN"
51047
+ },
51048
+ {
51049
+ bankAddress: "Hco1P3dGRXz3ZGFvMkbDgghZQy47Tp7vp7koSYRvP6nm",
51050
+ validatorVoteAccount: "mrgn6ETrBDM8mjjYN8rbVwFqVwF8z6rtmvGLbdGuVUU",
51051
+ tokenAddress: "A4B5MGQvcZCUqeiUEAB4ckZ2tvH2UmEg31vF7TiERDkH",
51052
+ tokenName: "MRGN 3",
51053
+ tokenSymbol: "MRGN3"
51054
+ },
51055
+ {
51056
+ bankAddress: "EPh2abWP8DusPH8myWnECAAeQUZgAz927aMbmwXt3eRY",
51057
+ validatorVoteAccount: "mrgn2vsZ5EJ8YEfAMNPXmRux7th9cNfBasQ1JJvVwPn",
51058
+ tokenAddress: "6Mt7tBWLUJfDxqCFTsjoRXF9wD55g4Lhs5nAyYp244pX",
51059
+ tokenName: "Project 0 Horizon",
51060
+ tokenSymbol: "HORIZON"
51061
+ },
51062
+ {
51063
+ bankAddress: "6wjAwhnxTMEzHk8NNHVXgkx1jSrb6TX1bC17j3S56FfB",
51064
+ validatorVoteAccount: "3N7s9zXMZ4QqvHQR15t5GNHyqc89KduzMP7423eWiD5g",
51065
+ tokenAddress: "DKPvRV4dxUejjGpr2XwFmzZbbbTD7vx9Jmt1kk43n4d5",
51066
+ tokenName: "Binance",
51067
+ tokenSymbol: "BINANCE"
51068
+ },
51069
+ {
51070
+ bankAddress: "J9tksvZEDSwtNtZ6yxYjWDDkzhPbwDMnihU61NkFG9FE",
51071
+ validatorVoteAccount: "he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk",
51072
+ tokenAddress: "2k79y8CApbU9jAvWhLS2j6uRbaVjpLJTUzstBTho9vGq",
51073
+ tokenName: "Helius",
51074
+ tokenSymbol: "HELIUS"
51075
+ },
51076
+ {
51077
+ bankAddress: "Dfr6Sf44ftecaJaoJMzFQABdkt3CEHfBwut1WyacRzaE",
51078
+ validatorVoteAccount: "SLaYv7tCwetrFGbPCRnqpHswG5qqKino78EYpbGF7xY",
51079
+ tokenAddress: "Vsw4JT33S7bLbhjySMMyrP3JKvTAcNi9WG5Doekrmgg",
51080
+ tokenName: "Solayer",
51081
+ tokenSymbol: "SOLAYER"
51082
+ },
51083
+ {
51084
+ bankAddress: "BZAm4qGscR8gg5bmWrEq6BTofgaZPbg7Fwfa7rFghEXL",
51085
+ validatorVoteAccount: "J1to3PQfXidUUhprQWgdKkQAMWPJAEqSJ7amkBDE9qhF",
51086
+ tokenAddress: "6B8hZSupE5mcACmjzozP6C1DR2uaCCtmrGqcYWC6SBCc",
51087
+ tokenName: "Bonk",
51088
+ tokenSymbol: "BONK"
51089
+ },
51090
+ {
51091
+ bankAddress: "3UrMZ26NRKu2y6c2dPE7gZVHwEmhpwKLcWACg3tjCVEt",
51092
+ validatorVoteAccount: "J2nUHEAgZFRyuJbFjdqPrAa9gyWDuc7hErtDQHPhsYRp",
51093
+ tokenAddress: "9M7oMo4oL6RDPG7WbAX3Zz4dPzbMgpiCzwrQPMwG4Wgq",
51094
+ tokenName: "Phantom",
51095
+ tokenSymbol: "PHANTOM"
51096
+ },
51097
+ {
51098
+ bankAddress: "8c269gkonvATm93nviuYiriCQ829f7ypx3aScYDR1YoQ",
51099
+ validatorVoteAccount: "D3QPJm7BDzzPeRG51YZSEz3LfV7GvFNu9NkcibzURxuj",
51100
+ tokenAddress: "8hXCCQmYFcDhU5Mkuvyixp2Q11sbyQComkceSSh3GY4a",
51101
+ tokenName: "Starke Finance",
51102
+ tokenSymbol: "STARKE"
51103
+ },
51104
+ {
51105
+ bankAddress: "37tiA2NTF6YCt85XzCidPo9ZVpuqkkmfVJCYQ5Yx5Uhs",
51106
+ validatorVoteAccount: "SBLZib4npE7svxFA7AsD3ytdQAfYNb39c8zsU82AA2E",
51107
+ tokenAddress: "96rXgCFy1Er49169XoKHkeLiKC2k4bTy1641q1TVrMm2",
51108
+ tokenName: "SolBlaze Validator",
51109
+ tokenSymbol: "SOLBLAZE"
51110
+ },
51111
+ {
51112
+ bankAddress: "J9trpcrVdFjVNg6VFrdF1XPGgjftQKZhbbWsxertdv9V",
51113
+ validatorVoteAccount: "FACqsS19VScz8oo2YhdMg35EsAy6xsCZ9Y58eJXGv8QJ",
51114
+ tokenAddress: "AH6fxpHS2gtMtJgBy8y8pEAPkqyop2pSugF6REs9NaTp",
51115
+ tokenName: "Lantern",
51116
+ tokenSymbol: "LNTRN"
51117
+ },
51118
+ {
51119
+ bankAddress: "EGTfrYiuWpPPZ4yfY9tCxnK6QMkY7pzVie9DxK772iGe",
51120
+ validatorVoteAccount: "EfnywDKqArxK6N6FS9ctsuzNdxfx3pzfXEQE5EevQ1SV",
51121
+ tokenAddress: "FcXEwHku68ZquqtSj1eSWS1SVWkhAZSyb4usfpiuEJAL",
51122
+ tokenName: "PROJECT SUPER",
51123
+ tokenSymbol: "SUPER"
51124
+ },
51125
+ {
51126
+ bankAddress: "A5e7UTE3g11ZfKgftqRCvxAgcDuFGyeDjMka96zJWSWe",
51127
+ validatorVoteAccount: "3ZUQekqiZoybB57y49eqtvSaoonqDwuNbeqEGwN88JkQ",
51128
+ tokenAddress: "F1XPjtpsEy23Q7po4JkWjp1jkDZcvFYSrqD8TR1YL3EF",
51129
+ tokenName: "Paws",
51130
+ tokenSymbol: "PAWS"
51131
+ },
51132
+ {
51133
+ bankAddress: "91jkdp4cF8vCDhjwude3SGSGrmVWFk5vTAtR6fsGVAfy",
51134
+ validatorVoteAccount: "gangtRyGPTvYWb8K3xS2feJQaCks4iJ7rytFUPtVqSY",
51135
+ tokenAddress: "6ZS7ZVDw91BVAC8gsz3SZBSeVeF2GtXtL2BHK31Kvyjm",
51136
+ tokenName: "Lotus Validator",
51137
+ tokenSymbol: "LOTUS"
51138
+ },
51139
+ {
51140
+ bankAddress: "72BS34HkCgq8RWQR7kuVVmiJMtKqSxG4CHX6ZXpSCwg7",
51141
+ validatorVoteAccount: "oRAnGeU5h8h2UkvbfnE5cjXnnAa4rBoaxmS4kbFymSe",
51142
+ tokenAddress: "9yF8pXctzicum2P73uuk4Dhqf2MVz6tzRAe8THGXCJcp",
51143
+ tokenName: "Orangefin Ventures",
51144
+ tokenSymbol: "ORANGEFIN"
51145
+ },
51146
+ {
51147
+ bankAddress: "8F4DsU3NMFunUxBZkWrpYR8zwhAfoAt7QuiEPMtyhWvX",
51148
+ validatorVoteAccount: "3xjfK9C9YNcta8MvK1US4sQ3bc6DEjoJoR3qLExGf9xE",
51149
+ tokenAddress: "Akib1NYJzzh9HkiDH41S2LUefUmR1bKsk65xgqUcW5C5",
51150
+ tokenName: "pico\u{1F644}.sol",
51151
+ tokenSymbol: "PICO"
51152
+ },
51153
+ {
51154
+ bankAddress: "GdtggomQth6cxuYPdiVhBbcX7VC9rnDDwLMfxipxE2Po",
51155
+ validatorVoteAccount: "oPaLTmyvoUhW26QCMwLA5JNUeBYy72PDpFoXQF8SeX4",
51156
+ tokenAddress: "C71A3W7g5XALUNwTDWTwHX3qhfypaYZ41aNZjBpcaC9D",
51157
+ tokenName: "Temporal Opal",
51158
+ tokenSymbol: "OPAL"
51159
+ },
51160
+ {
51161
+ bankAddress: "5sJCKePwAhyD3mzrzLRDM2PkFMc85nnvvarxHLsvWvpg",
51162
+ validatorVoteAccount: "9jYFwBfbjYmvasFbJyES9apLJDTkwtbgSDRWanHEvcRw",
51163
+ tokenAddress: "Hj69K1WbnfZFipLbrzdxgGhDqCR47q48bN5nUHt6xQZo",
51164
+ tokenName: "WATCHTOWER",
51165
+ tokenSymbol: "WATCHTOWER"
51166
+ },
51167
+ {
51168
+ bankAddress: "3F3QXT3BtkegaBfFjn2odKLurFYLHJHJ99xKV2TRTvrk",
51169
+ validatorVoteAccount: "6JfBwvcz5QUKQJ37BMKTLrf968DDJBtwoZLw19aHwFtQ",
51170
+ tokenAddress: "8FqX86cQofBHReetZgxrxxvzN4iqMVsj2hbiv7pj2h73",
51171
+ tokenName: "Spectrum Staking",
51172
+ tokenSymbol: "SPECTRUM"
51173
+ },
51174
+ {
51175
+ bankAddress: "CFmvdtEPQJPVqS1QRkeRcdQm2itAPk6k8hSJbmt88Sjc",
51176
+ validatorVoteAccount: "Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6",
51177
+ tokenAddress: "38ZUTefZnKSUJU3wxpUe3xpiw2j5WQPnmzSTNbS1JqLA",
51178
+ tokenName: "Temporal Emerald",
51179
+ tokenSymbol: "EMERALD"
51180
+ },
51181
+ {
51182
+ bankAddress: "CmBDHSVuodmUnanbBVFvY9cauLeosbdFQn9bJANMVYUG",
51183
+ validatorVoteAccount: "mintrNtxN3PhAB45Pt41XqyKghTTpqcoBkQTZqh96iR",
51184
+ tokenAddress: "GxGmv7s7s2co3pLZukns946fr5zmR8c5buWRD9prGd6v",
51185
+ tokenName: "Hanabi Staking",
51186
+ tokenSymbol: "haSOLmrgn"
51187
+ },
51188
+ {
51189
+ bankAddress: "7bLfrb4fWVYkVpZ9rg7dBUwKRAqLyiivCW4ahMMGcKyS",
51190
+ validatorVoteAccount: "76DafWkJ6pGK2hoD41HjrM4xTBhfKqrDYDazv13n5ir1",
51191
+ tokenAddress: "GT7n9uZbYzHv52YqDBowtZ5ZVW91umaBQTNPFQNeLUpR",
51192
+ tokenName: "Solana Japan Validator",
51193
+ tokenSymbol: "SolJAPAn"
51194
+ },
51195
+ {
51196
+ bankAddress: "6q5DB86DhCBQt5bqzZwgopV8EA96aCnngu5ebR1ooDFq",
51197
+ validatorVoteAccount: "Cue647T8jgwpRSDUb8ttTYx7NiEfJCRZNiiw1qmchXsG",
51198
+ tokenAddress: "EAR6LenhNstHxR9289rWakm82WgLJYvHD7NawfXtuyUx",
51199
+ tokenName: "KIWAMI",
51200
+ tokenSymbol: "KIWAMI"
51201
+ },
51202
+ {
51203
+ bankAddress: "GLSCJ39N82Xo21621jMheinvjQLrBrkG7gzo2C5L1y6y",
51204
+ validatorVoteAccount: "7emL18Bnve7wbYE9Az7vYJjikxN6YPU81igf6rVU5FN8",
51205
+ tokenAddress: "EQuMUgLZArKwWUk6uGPmTGYUgNbfgJrbBaNR7CQyZ5uf",
51206
+ tokenName: "Temporal Topaz",
51207
+ tokenSymbol: "TOPAZ"
51208
+ },
51209
+ {
51210
+ bankAddress: "4irzCCsU53ffh9XB7NxGzbbHjvSR7FTfPbn6KoXkt7kX",
51211
+ validatorVoteAccount: "2iWXwF2Q5W6o7yntV2mkbxncB4rYHnX61y3NU8a8EFMJ",
51212
+ tokenAddress: "14Pets6QpE9iXKkXg8Ri4GcDazRMfWR3guM6LZXnFChc",
51213
+ tokenName: "Bull Moose SOL",
51214
+ tokenSymbol: "bmsSOL"
51215
+ },
51216
+ {
51217
+ bankAddress: "C96do7nkEaaFjHq8jHzPpyPTdJSea5xEGwxDzDSepCzf",
51218
+ validatorVoteAccount: "voteRnv6PBzmiGP8NicWtQiqEJTwKKq2SxtqtdLUJjd",
51219
+ tokenAddress: "3YEDiJ4r4xRGNhq6nudRnkwrdKHG7PAtDim24CjTMtBH",
51220
+ tokenName: "diman",
51221
+ tokenSymbol: "DIMAN"
51222
+ },
51223
+ {
51224
+ bankAddress: "9dZiyG51FBR4BWpAs69XbDpr7GfVAEB1ZB89v38maV36",
51225
+ validatorVoteAccount: "Simpj3KyRQmpRkXuBvCQFS7DBBG6vqw93SkZb9UD1hp",
51226
+ tokenAddress: "77YLpVLQXr2KU66GM2JykbT9g5du7LarWgehbWD3CJaB",
51227
+ tokenName: "SIMPDIGIT",
51228
+ tokenSymbol: "SIMPDIGIT"
51229
+ },
51230
+ {
51231
+ bankAddress: "2foqT8wWzWRduyV37uRdj81DijkNMKzYD3D6JPfir7La",
51232
+ validatorVoteAccount: "48oxpSHQkM4sdXUY9NQ8KnEtebzZbyk8uUT7JRdVQNuf",
51233
+ tokenAddress: "42m7Ygk5VxREdKfcFrsH1HnuoqCke8BcVcxNeywMCfp2",
51234
+ tokenName: "Infinite Lux",
51235
+ tokenSymbol: "LUX"
51236
+ },
51237
+ {
51238
+ bankAddress: "FsdWEJzHXkUXejWnb7c1p9UJtF69hVWQNNoakjoXyRCJ",
51239
+ validatorVoteAccount: "4AUED4uj6nSTuANzaAUnGBPJQRmhpDYDwoWJNkoUUBBW",
51240
+ tokenAddress: "CiyQTfHJ9PbTwC7TGf4pXZk8szcWGJ8TeFhhCuUwybqi",
51241
+ tokenName: "Anagram",
51242
+ tokenSymbol: "ANAGRAM"
51243
+ },
51244
+ {
51245
+ bankAddress: "2hs1pHAzDWGqnn1d8VQkc8bZRfQ45grYvzfau8dnWFUk",
51246
+ validatorVoteAccount: "2NxEEbhqqj1Qptq5LXLbDTP5tLa9f7PqkU8zNgxbGU9P",
51247
+ tokenAddress: "9yQLxEzusZ7QiZNafDNdzbEaTCPuJToGjMhLRJtZbgsd",
51248
+ tokenName: "NANSEN",
51249
+ tokenSymbol: "NANSEN"
51250
+ },
51251
+ {
51252
+ bankAddress: "FCi8unSVCwJd3QkrhTtv6LTTjw1c4zV65D5cG5N1rAG6",
51253
+ validatorVoteAccount: "Va1idkzkB6LEmVFmxWbWU8Ao9qehC62Tjmf68L3uYKj",
51254
+ tokenAddress: "AExKb8oJ6mGPYJUyfiX49DMMi226h2AnWeG1G6neQBEz",
51255
+ tokenName: "VALIDATOR",
51256
+ tokenSymbol: "VALID"
51257
+ },
51258
+ {
51259
+ bankAddress: "HzS8RqaQ5syk6EHbVi7h9rFYN48PpxykUXEs6w9wNfNP",
51260
+ validatorVoteAccount: "sTach38ebT8jnGH8i2D1g8NDAS6An19whVMnSSWPXt4",
51261
+ tokenAddress: "AFDVYBqxADagPfN9DdbrNrf9zZqugub7CV4kUJEUrK6J",
51262
+ tokenName: "Stache Node",
51263
+ tokenSymbol: "STACHE"
51264
+ },
51265
+ {
51266
+ bankAddress: "9Hs4E6ACNw6Hmwjvm1duXzbaWmvXxSxN11agw4updEn1",
51267
+ validatorVoteAccount: "EtMSc3MvcDXUr6ChK5GxyFVwTxYA3zqP5XzjE9jwKvSV",
51268
+ tokenAddress: "ENKFyZQZHzNNSxcKYoaVsNLi2xoGPoStZH4A9xxezjbC",
51269
+ tokenName: "Mad Lads CN",
51270
+ tokenSymbol: "MadLadsCN"
51271
+ },
51272
+ {
51273
+ bankAddress: "4watsWcjTBAwsrZpArwQbnNX4bQ1yeHBxgdbrGT4eMu9",
51274
+ validatorVoteAccount: "EARNynHRWg6GfyJCmrrizcZxARB3HVzcaasvNa8kBS72",
51275
+ tokenAddress: "8fhkWcm2n28JuadzY7mRR8FFDZZfnaPfWgw7pLNVZCbE",
51276
+ tokenName: "Solana Compass Stake",
51277
+ tokenSymbol: "compaStake"
51278
+ },
51279
+ {
51280
+ bankAddress: "9d7MTvcz1VMB1rK6H73quMxkR26dLPz5HDaac2eGRjQx",
51281
+ validatorVoteAccount: "nymsndUdAZyUPpWYz5VEg8Ghj9cFvwTRgciLogpmYaQ",
51282
+ tokenAddress: "FWFeaqpkgDr3ejVSY3HjiUmUg3u9fcr5d66HvimnDLWE",
51283
+ tokenName: "Hypo Nyms",
51284
+ tokenSymbol: "NYMS"
51285
+ },
51286
+ {
51287
+ bankAddress: "6V4vCK3n3JVncfpS16mW8ceLoNPatvu61pKxFmWx8adi",
51288
+ validatorVoteAccount: "BT8LZUvQVwFHRGw2Dwv7UeqDUq7btfjegLpuz5bwgziD",
51289
+ tokenAddress: "9YRS7Stf9dVibTT1M4uVEAuRMcoS4MH1QxqXy9Lssrab",
51290
+ tokenName: "private",
51291
+ tokenSymbol: "private"
51292
+ },
51293
+ {
51294
+ bankAddress: "CK8qRAcmvkDXaqX2S5GkgTCZT5pCz34me1neQhpJYe1Z",
51295
+ validatorVoteAccount: "Ac1beBKixfNdrTAac7GRaTsJTxLyvgGvJjvy4qQfvyfc",
51296
+ tokenAddress: "DLTAbTL5NXhbqX6LX3ie3tf52pdtGpxe2DrZUr1RhgY6",
51297
+ tokenName: "Stronghold",
51298
+ tokenSymbol: "Stronghold"
51299
+ },
51300
+ {
51301
+ bankAddress: "H6CT1aiCgSNw9S6aq38npEhdoN2UPhSKe8Lj9fQqqjuu",
51302
+ validatorVoteAccount: "FREEL1BCzmPpNneC7FHCtBqzeWYrHRbtisFvi4N8XUP9",
51303
+ tokenAddress: "AKFuMoM5rjSpQSL4p6TBoc7D4dmEem9QrHhuSDCBYyZ8",
51304
+ tokenName: "Ross",
51305
+ tokenSymbol: "Ross"
51306
+ },
51307
+ {
51308
+ bankAddress: "G46aHuakgStymbE2WsLbja61mH5UXBPdSdpwf6Ci3saG",
51309
+ validatorVoteAccount: "mnvkHm47ZmRKoSWuQZAfXLRiDPiKCq8PWkMWrp1Wwqe",
51310
+ tokenAddress: "Cq9S5UB9BviPn5yoGkEDk3m7neQag4KJnhPWGyuev9W8",
51311
+ tokenName: "gripto staked sol",
51312
+ tokenSymbol: "GRIPTO"
51313
+ },
51314
+ {
51315
+ bankAddress: "75UmeEMdqVnGn3JHx8yVZEn7viybJ73XYSjhYCYfyhp2",
51316
+ validatorVoteAccount: "4m1PbxzwLdUnEwog3T9UKxgjktgriHgE1CfAhMqDw7Xx",
51317
+ tokenAddress: "432SogPNunjZMneDV6goZ8ZcCQz282GxoSJ4rwqx95pT",
51318
+ tokenName: "kumasol",
51319
+ tokenSymbol: "kumasol"
51320
+ },
51321
+ {
51322
+ bankAddress: "3zk6EmXANYQK12bwy9dySRAM4cT2vT5cDcAB79j8G33B",
51323
+ validatorVoteAccount: "HvsD9L5t62MGv3QBD2K7xjkipGYr9UZN7BtsW8NuSPpg",
51324
+ tokenAddress: "5vmwd6JHDCmX9W2XT1n2QpvYGA2kk4Xf7qWSayDU6caT",
51325
+ tokenName: "ArgenTerraSOL",
51326
+ tokenSymbol: "atSOL"
51327
+ },
51328
+ {
51329
+ bankAddress: "4C2vPweGNpiE6kTEbYvcbUBHNWxrn4ErQYaqWm5zDexx",
51330
+ validatorVoteAccount: "FnAPJkzf19s87sm24Qhv6bHZMZvZ43gjNUBRgjwXpD4v",
51331
+ tokenAddress: "6q4kVnwUpkE3i7W32dqaX6V12pbsrCnMqZ7TWz9yp1m5",
51332
+ tokenName: "BLOCKPORT",
51333
+ tokenSymbol: "BPT"
51334
+ },
51335
+ {
51336
+ bankAddress: "E5hZu5QQ1pRmGvyS4JHGXVQwzdUPaYM4yEiNKr64YzyG",
51337
+ validatorVoteAccount: "nfGcSJkP35SkPa5475iBChmq1UNcj7JE1uQHrrasymm",
51338
+ tokenAddress: "AQpQoJ3tJKGH9Yn8GSzoUsVcHPJjj3xYfQFp9XVr74F6",
51339
+ tokenName: "Test01",
51340
+ tokenSymbol: "TEST01"
51341
+ },
51342
+ {
51343
+ bankAddress: "3VCkXWAmE5DSwYRpqGFnkUz7vvD2RKbhFvrhzLuE8msu",
51344
+ validatorVoteAccount: "abc1zP7ihWsgQW8z5YmfQNqMckJE5Dfx8fwUNMNVNkY",
51345
+ tokenAddress: "BNisp3omkr6Rg5nHESWafjUbeCpGPy6MYq1iRJRgSAsh",
51346
+ tokenName: "ALGO STAKE",
51347
+ tokenSymbol: "ALGO"
51348
+ },
51349
+ {
51350
+ bankAddress: "7BHHMWw3P1AyebLhX9A8wnDeeGy8jgFXqqHuEZt7BVmW",
51351
+ validatorVoteAccount: "8Pep3GmYiijRALqrMKpez92cxvF4YPTzoZg83uXh14pW",
51352
+ tokenAddress: "zBH13AzXYCqHZKS8NGa4KR8zQhWiyvFdDY15nmfrHgS",
51353
+ tokenName: "8Pep",
51354
+ tokenSymbol: "8Pep"
51355
+ },
51356
+ {
51357
+ bankAddress: "9QWUatjtJtc98yts4ufWnmNeaWQRmaaLjFwbK3iMdS47",
51358
+ validatorVoteAccount: "CatzoSMUkTRidT5DwBxAC2pEtnwMBTpkCepHkFgZDiqb",
51359
+ tokenAddress: "98B1NMLYaNJQNxiQGr53vbjNFMNTYFmDqoCgj7qD9Vhm",
51360
+ tokenName: "JUPITER ",
51361
+ tokenSymbol: "JUPITER"
51362
+ },
51363
+ {
51364
+ bankAddress: "5q1wJkGqqRh6mSBtjG8sfjBsgJSGdA2QoXTWv4UQbHGk",
51365
+ validatorVoteAccount: "shft7Fry1js37Hm9wq4dfwcZSp2DyKszeWMvEpjYCQ1",
51366
+ tokenAddress: "C1KwBJZNwUaodUcP5kXqD52NCuZzThNAG2cw3vt5H6iE",
51367
+ tokenName: "BLUESHIFT",
51368
+ tokenSymbol: "SHIFT"
51369
+ },
51370
+ {
51371
+ bankAddress: "FZaHyfg9hmNMKpfUJ474wNKPaPdXMpnJouasKnndECiZ",
51372
+ validatorVoteAccount: "DdCNGDpP7qMgoAy6paFzhhak2EeyCZcgjH7ak5u5v28m",
51373
+ tokenAddress: "PhxXAYTkFZS23ZWvFcz6H6Uq4VnVBMa6hniiAyudjaW",
51374
+ tokenName: "KILN1",
51375
+ tokenSymbol: "KILN1"
51376
+ },
51377
+ {
51378
+ bankAddress: "5CBocarwfJeWGNozGemWktRYSz6kPikRPdfH8ZHSFrsg",
51379
+ validatorVoteAccount: "8zuMRTXThoPTTPLLvaiKiJshLLCqGMt9BdRjjCL19xBc",
51380
+ tokenAddress: "BDsEuxFWznAP5cUCannnfjyjDtTwqN57CkGfDbjx2nNZ",
51381
+ tokenName: "DawnLabs",
51382
+ tokenSymbol: "DawnLabs"
51383
+ },
51384
+ {
51385
+ bankAddress: "9ivswG37QpCUmkPkLMpRZT7PMyP64V9dDpZdteM254ec",
51386
+ validatorVoteAccount: "gaToR246dheK1DGAMEqxMdBJZwU4qFyt7DzhSwAHFWF",
51387
+ tokenAddress: "TjA2rtxoUFzyPVAw35VQGEQnNXiwcmNjKSk29nmkq1P",
51388
+ tokenName: "Valigator Open",
51389
+ tokenSymbol: "Valigator"
51390
+ }
51391
+ ];
51392
+
51393
+ // src/services/native-stake/utils/metadata.utils.ts
51394
+ var _metadataMap = null;
51395
+ var _voteAccountByBank = null;
51396
+ function getStakedBankMetadataMap() {
51397
+ if (!_metadataMap) {
51398
+ _metadataMap = /* @__PURE__ */ new Map();
51399
+ for (const entry of STAKED_BANK_METADATA_JSON) {
51400
+ _metadataMap.set(entry.bankAddress, entry);
51401
+ }
51402
+ }
51403
+ return _metadataMap;
51404
+ }
51405
+ function getValidatorVoteAccountByBank() {
51406
+ if (!_voteAccountByBank) {
51407
+ _voteAccountByBank = {};
51408
+ for (const entry of STAKED_BANK_METADATA_JSON) {
51409
+ _voteAccountByBank[entry.bankAddress] = entry.validatorVoteAccount;
51410
+ }
51411
+ }
51412
+ return _voteAccountByBank;
51413
+ }
50505
51414
  async function getKaminoMetadata(options) {
50506
51415
  const kaminoBanks = options.banks.filter((b) => b.config.assetTag === 3 /* KAMINO */);
50507
51416
  const DEFAULT_PUBKEY = web3_js.PublicKey.default;
@@ -50887,13 +51796,11 @@ async function fetchBankIntegrationMetadata(options) {
50887
51796
  return bankIntegrationMap;
50888
51797
  }
50889
51798
  var Bank = class _Bank {
50890
- 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) {
51799
+ 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) {
50891
51800
  this.address = address;
50892
51801
  this.mint = mint;
50893
51802
  this.mintDecimals = mintDecimals;
50894
51803
  this.group = group;
50895
- this.mintRate = mintRate;
50896
- this.mintPrice = mintPrice;
50897
51804
  this.assetShareValue = assetShareValue;
50898
51805
  this.liabilityShareValue = liabilityShareValue;
50899
51806
  this.liquidityVault = liquidityVault;
@@ -50963,8 +51870,6 @@ var Bank = class _Bank {
50963
51870
  bankType.mint,
50964
51871
  bankType.mintDecimals,
50965
51872
  bankType.group,
50966
- bankType.mintRate,
50967
- bankType.mintPrice,
50968
51873
  bankType.assetShareValue,
50969
51874
  bankType.liabilityShareValue,
50970
51875
  bankType.liquidityVault,
@@ -51006,8 +51911,6 @@ var Bank = class _Bank {
51006
51911
  props.mint,
51007
51912
  props.mintDecimals,
51008
51913
  props.group,
51009
- props.mintRate,
51010
- props.mintPrice,
51011
51914
  props.assetShareValue,
51012
51915
  props.liabilityShareValue,
51013
51916
  props.liquidityVault,
@@ -51734,14 +52637,15 @@ var MarginfiAccount = class _MarginfiAccount {
51734
52637
  *
51735
52638
  * @param program - The Marginfi program instance
51736
52639
  * @param banks - Map of all available banks
51737
- * @param bankAddress - The bank to clear emissions for
52640
+ * @param mintDatas - Map of mint data for token programs
52641
+ * @param bankAddress - The bank to withdraw emissions from
51738
52642
  *
51739
- * @returns Promise resolving to InstructionsWrapper containing the clear emissions instructions
52643
+ * @returns Promise resolving to InstructionsWrapper containing the withdraw emissions instructions
51740
52644
  *
51741
- * @see {@link makeClearEmissionsIx} for implementation
52645
+ * @see {@link makeWithdrawEmissionsIx} for implementation
51742
52646
  */
51743
- async makeClearEmissionsIx(program, banks, bankAddress) {
51744
- return makeClearEmissionsIx(program, this, banks, bankAddress);
52647
+ async makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress) {
52648
+ return makeWithdrawEmissionsIx(program, this, banks, mintDatas, bankAddress);
51745
52649
  }
51746
52650
  /**
51747
52651
  * Creates an instruction to begin a flash loan.
@@ -52424,12 +53328,17 @@ var MarginfiAccountWrapper = class {
52424
53328
  });
52425
53329
  }
52426
53330
  /**
52427
- * Creates a clear emissions instruction with auto-injected client data.
53331
+ * Creates a withdraw emissions instruction with auto-injected client data.
52428
53332
  *
52429
- * @param bankAddress - Bank address to clear emissions for
53333
+ * @param bankAddress - Bank address to withdraw emissions from
52430
53334
  */
52431
- async makeClearEmissionsIx(bankAddress) {
52432
- return this.account.makeClearEmissionsIx(this.client.program, this.client.bankMap, bankAddress);
53335
+ async makeWithdrawEmissionsIx(bankAddress) {
53336
+ return this.account.makeWithdrawEmissionsIx(
53337
+ this.client.program,
53338
+ this.client.bankMap,
53339
+ this.client.mintDataByBank,
53340
+ bankAddress
53341
+ );
52433
53342
  }
52434
53343
  /**
52435
53344
  * Creates a begin flash loan instruction.
@@ -52944,6 +53853,66 @@ var MarginfiAccountWrapper = class {
52944
53853
  return this.account.getHealthCheckAccounts(this.client.bankMap, mandatoryBanks, excludedBanks);
52945
53854
  }
52946
53855
  // ----------------------------------------------------------------------------
53856
+ // Native stake actions
53857
+ // Note: These call standalone action functions directly rather than routing
53858
+ // through this.account because they interact with the SPL stake pool program,
53859
+ // not the marginfi program. No MarginfiAccount state is needed.
53860
+ // ----------------------------------------------------------------------------
53861
+ /**
53862
+ * Creates a transaction to mint LST from a native stake account.
53863
+ *
53864
+ * Converts a native stake account (or a portion of it) into LST tokens
53865
+ * by depositing the stake into the single-validator pool.
53866
+ *
53867
+ * @param amount - SOL amount to convert (in UI units)
53868
+ * @param stakeAccountPk - The stake account to convert
53869
+ * @param validator - The validator vote account
53870
+ */
53871
+ async makeMintStakedLstTx(amount, stakeAccountPk, validator) {
53872
+ return makeMintStakedLstTx({
53873
+ amount,
53874
+ authority: this.authority,
53875
+ stakeAccountPk,
53876
+ validator,
53877
+ connection: this.client.program.provider.connection,
53878
+ luts: this.client.addressLookupTables
53879
+ });
53880
+ }
53881
+ /**
53882
+ * Creates a transaction to redeem LST tokens back to a native stake account.
53883
+ *
53884
+ * Burns LST tokens and withdraws the underlying stake into a new stake account.
53885
+ *
53886
+ * @param amount - LST amount to redeem (in UI units)
53887
+ * @param validator - The validator vote account
53888
+ */
53889
+ async makeRedeemStakedLstTx(amount, validator) {
53890
+ return makeRedeemStakedLstTx({
53891
+ amount,
53892
+ authority: this.authority,
53893
+ validator,
53894
+ connection: this.client.program.provider.connection,
53895
+ luts: this.client.addressLookupTables
53896
+ });
53897
+ }
53898
+ /**
53899
+ * Creates a transaction to merge two stake accounts.
53900
+ *
53901
+ * Both accounts must share the same authorized staker/withdrawer and vote account.
53902
+ *
53903
+ * @param sourceStakeAccount - The stake account to merge from (will be consumed)
53904
+ * @param destinationStakeAccount - The stake account to merge into
53905
+ */
53906
+ async makeMergeStakeAccountsTx(sourceStakeAccount, destinationStakeAccount) {
53907
+ return makeMergeStakeAccountsTx({
53908
+ authority: this.authority,
53909
+ sourceStakeAccount,
53910
+ destinationStakeAccount,
53911
+ connection: this.client.program.provider.connection,
53912
+ luts: this.client.addressLookupTables
53913
+ });
53914
+ }
53915
+ // ----------------------------------------------------------------------------
52947
53916
  // Helper methods
52948
53917
  // ----------------------------------------------------------------------------
52949
53918
  /**
@@ -53205,7 +54174,6 @@ var Project0Client = class _Project0Client {
53205
54174
  assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
53206
54175
  break;
53207
54176
  case 2 /* STAKED */:
53208
- assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
53209
54177
  break;
53210
54178
  case 0 /* DEFAULT */:
53211
54179
  case 1 /* SOL */:
@@ -53214,6 +54182,56 @@ var Project0Client = class _Project0Client {
53214
54182
  break;
53215
54183
  }
53216
54184
  });
54185
+ const stakedBanks = banksArray.filter((b) => b.config.assetTag === 2 /* STAKED */);
54186
+ if (stakedBanks.length > 0) {
54187
+ const metadataMap = getStakedBankMetadataMap();
54188
+ const stakedBankAddresses = [];
54189
+ const poolStakeAddresses = [];
54190
+ const lstMintAddresses = [];
54191
+ for (const bank of stakedBanks) {
54192
+ const metadata = metadataMap.get(bank.address.toBase58());
54193
+ if (!metadata) {
54194
+ assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
54195
+ continue;
54196
+ }
54197
+ const pool = findPoolAddress(new web3_js.PublicKey(metadata.validatorVoteAccount));
54198
+ stakedBankAddresses.push(bank.address.toBase58());
54199
+ poolStakeAddresses.push(findPoolStakeAddress(pool));
54200
+ lstMintAddresses.push(findPoolMintAddress(pool));
54201
+ }
54202
+ if (stakedBankAddresses.length > 0) {
54203
+ const allAddresses = [
54204
+ ...poolStakeAddresses.map((a) => a.toBase58()),
54205
+ ...lstMintAddresses.map((a) => a.toBase58())
54206
+ ];
54207
+ const accountInfos = await chunkedGetRawMultipleAccountInfoOrdered(
54208
+ connection,
54209
+ allAddresses
54210
+ );
54211
+ const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);
54212
+ const lstMintInfos = accountInfos.slice(poolStakeAddresses.length);
54213
+ for (let i = 0; i < stakedBankAddresses.length; i++) {
54214
+ const bankAddr = stakedBankAddresses[i];
54215
+ const poolStakeInfo = poolStakeInfos[i];
54216
+ const lstMintInfo = lstMintInfos[i];
54217
+ if (!poolStakeInfo || !lstMintInfo) {
54218
+ assetShareMultiplierByBank.set(bankAddr, new BigNumber3__default.default(1));
54219
+ continue;
54220
+ }
54221
+ const stakeLamports = poolStakeInfo.lamports;
54222
+ const supplyBuffer = lstMintInfo.data.slice(36, 44);
54223
+ const lstMintSupply = Number(Buffer.from(supplyBuffer).readBigUInt64LE(0));
54224
+ if (lstMintSupply === 0) {
54225
+ assetShareMultiplierByBank.set(bankAddr, new BigNumber3__default.default(1));
54226
+ continue;
54227
+ }
54228
+ const LAMPORTS_PER_SOL5 = 1e9;
54229
+ const adjustedStake = Math.max(stakeLamports - LAMPORTS_PER_SOL5, 0);
54230
+ const multiplier = new BigNumber3__default.default(adjustedStake).dividedBy(lstMintSupply);
54231
+ assetShareMultiplierByBank.set(bankAddr, multiplier);
54232
+ }
54233
+ }
54234
+ }
53217
54235
  const emodePairs = getEmodePairs(banksArray);
53218
54236
  return new _Project0Client(
53219
54237
  program,
@@ -53486,9 +54504,11 @@ exports.getOracleSourceFromOracleSetup = getOracleSourceFromOracleSetup;
53486
54504
  exports.getOracleSourceNameFromKey = getOracleSourceNameFromKey;
53487
54505
  exports.getPrice = getPrice;
53488
54506
  exports.getPriceWithConfidence = getPriceWithConfidence;
54507
+ exports.getStakedBankMetadataMap = getStakedBankMetadataMap;
53489
54508
  exports.getTotalAssetQuantity = getTotalAssetQuantity;
53490
54509
  exports.getTotalLiabilityQuantity = getTotalLiabilityQuantity;
53491
54510
  exports.getTxSize = getTxSize;
54511
+ exports.getValidatorVoteAccountByBank = getValidatorVoteAccountByBank;
53492
54512
  exports.groupToDto = groupToDto;
53493
54513
  exports.hasAccountFlag = hasAccountFlag;
53494
54514
  exports.hasEmodeEntryFlag = hasEmodeEntryFlag;
@@ -53504,7 +54524,6 @@ exports.makeBeginFlashLoanIx = makeBeginFlashLoanIx3;
53504
54524
  exports.makeBorrowIx = makeBorrowIx3;
53505
54525
  exports.makeBorrowTx = makeBorrowTx;
53506
54526
  exports.makeBundleTipIx = makeBundleTipIx;
53507
- exports.makeClearEmissionsIx = makeClearEmissionsIx;
53508
54527
  exports.makeCloseMarginfiAccountIx = makeCloseMarginfiAccountIx;
53509
54528
  exports.makeCloseMarginfiAccountTx = makeCloseMarginfiAccountTx;
53510
54529
  exports.makeCrankSwbFeedIx = makeCrankSwbFeedIx;
@@ -53529,11 +54548,16 @@ exports.makeKaminoDepositTx = makeKaminoDepositTx;
53529
54548
  exports.makeKaminoWithdrawIx = makeKaminoWithdrawIx3;
53530
54549
  exports.makeKaminoWithdrawTx = makeKaminoWithdrawTx;
53531
54550
  exports.makeLoopTx = makeLoopTx;
54551
+ exports.makeMergeStakeAccountsTx = makeMergeStakeAccountsTx;
54552
+ exports.makeMintStakedLstIx = makeMintStakedLstIx;
54553
+ exports.makeMintStakedLstTx = makeMintStakedLstTx;
53532
54554
  exports.makePoolAddBankIx = makePoolAddBankIx3;
53533
54555
  exports.makePoolConfigureBankIx = makePoolConfigureBankIx3;
53534
54556
  exports.makePriorityFeeIx = makePriorityFeeIx;
53535
54557
  exports.makePriorityFeeMicroIx = makePriorityFeeMicroIx;
53536
54558
  exports.makePulseHealthIx = makePulseHealthIx2;
54559
+ exports.makeRedeemStakedLstIx = makeRedeemStakedLstIx;
54560
+ exports.makeRedeemStakedLstTx = makeRedeemStakedLstTx;
53537
54561
  exports.makeRefreshKaminoBanksIxs = makeRefreshKaminoBanksIxs;
53538
54562
  exports.makeRepayIx = makeRepayIx3;
53539
54563
  exports.makeRepayTx = makeRepayTx;
@@ -53548,6 +54572,7 @@ exports.makeUpdateDriftMarketIxs = makeUpdateDriftMarketIxs;
53548
54572
  exports.makeUpdateJupLendRateIxs = makeUpdateJupLendRateIxs;
53549
54573
  exports.makeUpdateSwbFeedIx = makeUpdateSwbFeedIx;
53550
54574
  exports.makeVersionedTransaction = makeVersionedTransaction;
54575
+ exports.makeWithdrawEmissionsIx = makeWithdrawEmissionsIx;
53551
54576
  exports.makeWithdrawIx = makeWithdrawIx3;
53552
54577
  exports.makeWithdrawTx = makeWithdrawTx;
53553
54578
  exports.makeWrapSolIxs = makeWrapSolIxs;