@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 +1644 -619
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +583 -356
- package/dist/index.d.ts +583 -356
- package/dist/index.js +1639 -621
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +28 -2
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +22 -2
- package/dist/vendor.d.ts +22 -2
- package/dist/vendor.js +27 -3
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY,
|
|
1
|
+
import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, StakeProgram, Keypair, StakeAuthorizationLayout, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, TransactionInstruction, LAMPORTS_PER_SOL, SYSVAR_INSTRUCTIONS_PUBKEY, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1 } from '@solana/web3.js';
|
|
2
2
|
import { object, string, enums, array, assert } from 'superstruct';
|
|
3
3
|
import BigNumber3, { BigNumber } from 'bignumber.js';
|
|
4
|
-
import BN11 from 'bn.js';
|
|
4
|
+
import BN11, { BN } from 'bn.js';
|
|
5
5
|
import Decimal3, { Decimal } from 'decimal.js';
|
|
6
6
|
import { BorshCoder, BorshAccountsCoder, BorshInstructionCoder, AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
7
7
|
import { struct, u32, u8 } from '@solana/buffer-layout';
|
|
@@ -576,8 +576,8 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
|
|
|
576
576
|
return bundleTipInstruction;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
// src/idl/marginfi_0.1.
|
|
580
|
-
var
|
|
579
|
+
// src/idl/marginfi_0.1.7.json
|
|
580
|
+
var marginfi_0_1_7_default = {
|
|
581
581
|
address: "",
|
|
582
582
|
metadata: {
|
|
583
583
|
name: "marginfi",
|
|
@@ -627,7 +627,7 @@ var marginfi_0_1_8_default = {
|
|
|
627
627
|
{
|
|
628
628
|
name: "configure_bank_rate_limits",
|
|
629
629
|
docs: [
|
|
630
|
-
"(admin
|
|
630
|
+
"(admin only) Configure bank-level rate limits for withdraw/borrow.",
|
|
631
631
|
"Rate limits track net outflow in native tokens. Deposits offset withdraws.",
|
|
632
632
|
"Set to 0 to disable. Hourly and daily windows are independent."
|
|
633
633
|
],
|
|
@@ -639,7 +639,8 @@ var marginfi_0_1_8_default = {
|
|
|
639
639
|
},
|
|
640
640
|
{
|
|
641
641
|
name: "admin",
|
|
642
|
-
signer: true
|
|
642
|
+
signer: true,
|
|
643
|
+
relations: ["group"]
|
|
643
644
|
},
|
|
644
645
|
{
|
|
645
646
|
name: "bank",
|
|
@@ -663,9 +664,7 @@ var marginfi_0_1_8_default = {
|
|
|
663
664
|
},
|
|
664
665
|
{
|
|
665
666
|
name: "configure_deleverage_withdrawal_limit",
|
|
666
|
-
docs: [
|
|
667
|
-
"(admin or delegate_limit_admin) Set the daily withdrawal limit for deleverages per group."
|
|
668
|
-
],
|
|
667
|
+
docs: ["(group admin only) Set the daily withdrawal limit for deleverages per group."],
|
|
669
668
|
discriminator: [28, 132, 205, 158, 67, 77, 177, 63],
|
|
670
669
|
accounts: [
|
|
671
670
|
{
|
|
@@ -674,7 +673,8 @@ var marginfi_0_1_8_default = {
|
|
|
674
673
|
},
|
|
675
674
|
{
|
|
676
675
|
name: "admin",
|
|
677
|
-
signer: true
|
|
676
|
+
signer: true,
|
|
677
|
+
relations: ["marginfi_group"]
|
|
678
678
|
}
|
|
679
679
|
],
|
|
680
680
|
args: [
|
|
@@ -687,7 +687,7 @@ var marginfi_0_1_8_default = {
|
|
|
687
687
|
{
|
|
688
688
|
name: "configure_group_rate_limits",
|
|
689
689
|
docs: [
|
|
690
|
-
"(admin
|
|
690
|
+
"(admin only) Configure group-level rate limits for withdraw/borrow.",
|
|
691
691
|
"Rate limits track aggregate net outflow in USD.",
|
|
692
692
|
"Example: $10M = 10_000_000. Set to 0 to disable."
|
|
693
693
|
],
|
|
@@ -699,7 +699,8 @@ var marginfi_0_1_8_default = {
|
|
|
699
699
|
},
|
|
700
700
|
{
|
|
701
701
|
name: "admin",
|
|
702
|
-
signer: true
|
|
702
|
+
signer: true,
|
|
703
|
+
relations: ["marginfi_group"]
|
|
703
704
|
}
|
|
704
705
|
],
|
|
705
706
|
args: [
|
|
@@ -727,6 +728,7 @@ var marginfi_0_1_8_default = {
|
|
|
727
728
|
accounts: [
|
|
728
729
|
{
|
|
729
730
|
name: "group",
|
|
731
|
+
writable: true,
|
|
730
732
|
relations: ["marginfi_account", "bank"]
|
|
731
733
|
},
|
|
732
734
|
{
|
|
@@ -1314,6 +1316,7 @@ var marginfi_0_1_8_default = {
|
|
|
1314
1316
|
accounts: [
|
|
1315
1317
|
{
|
|
1316
1318
|
name: "group",
|
|
1319
|
+
writable: true,
|
|
1317
1320
|
relations: ["marginfi_account", "bank"]
|
|
1318
1321
|
},
|
|
1319
1322
|
{
|
|
@@ -1847,7 +1850,6 @@ var marginfi_0_1_8_default = {
|
|
|
1847
1850
|
accounts: [
|
|
1848
1851
|
{
|
|
1849
1852
|
name: "group",
|
|
1850
|
-
writable: true,
|
|
1851
1853
|
relations: ["marginfi_account", "bank"]
|
|
1852
1854
|
},
|
|
1853
1855
|
{
|
|
@@ -1856,7 +1858,8 @@ var marginfi_0_1_8_default = {
|
|
|
1856
1858
|
},
|
|
1857
1859
|
{
|
|
1858
1860
|
name: "authority",
|
|
1859
|
-
signer: true
|
|
1861
|
+
signer: true,
|
|
1862
|
+
relations: ["marginfi_account"]
|
|
1860
1863
|
},
|
|
1861
1864
|
{
|
|
1862
1865
|
name: "bank",
|
|
@@ -2146,6 +2149,7 @@ var marginfi_0_1_8_default = {
|
|
|
2146
2149
|
accounts: [
|
|
2147
2150
|
{
|
|
2148
2151
|
name: "group",
|
|
2152
|
+
writable: true,
|
|
2149
2153
|
relations: ["marginfi_account", "bank"]
|
|
2150
2154
|
},
|
|
2151
2155
|
{
|
|
@@ -2320,6 +2324,7 @@ var marginfi_0_1_8_default = {
|
|
|
2320
2324
|
accounts: [
|
|
2321
2325
|
{
|
|
2322
2326
|
name: "group",
|
|
2327
|
+
writable: true,
|
|
2323
2328
|
relations: ["marginfi_account", "bank"]
|
|
2324
2329
|
},
|
|
2325
2330
|
{
|
|
@@ -2848,6 +2853,7 @@ var marginfi_0_1_8_default = {
|
|
|
2848
2853
|
accounts: [
|
|
2849
2854
|
{
|
|
2850
2855
|
name: "group",
|
|
2856
|
+
writable: true,
|
|
2851
2857
|
relations: ["marginfi_account", "bank"]
|
|
2852
2858
|
},
|
|
2853
2859
|
{
|
|
@@ -2944,13 +2950,12 @@ var marginfi_0_1_8_default = {
|
|
|
2944
2950
|
relations: ["bank"]
|
|
2945
2951
|
},
|
|
2946
2952
|
{
|
|
2947
|
-
name: "
|
|
2953
|
+
name: "reserve_liquidity_mint",
|
|
2948
2954
|
docs: [
|
|
2949
2955
|
"The liquidity token mint (e.g., USDC)",
|
|
2950
2956
|
"Needs serde to get the mint decimals for transfer checked"
|
|
2951
2957
|
],
|
|
2952
|
-
writable: true
|
|
2953
|
-
relations: ["bank"]
|
|
2958
|
+
writable: true
|
|
2954
2959
|
},
|
|
2955
2960
|
{
|
|
2956
2961
|
name: "reserve_liquidity_supply",
|
|
@@ -3025,6 +3030,7 @@ var marginfi_0_1_8_default = {
|
|
|
3025
3030
|
accounts: [
|
|
3026
3031
|
{
|
|
3027
3032
|
name: "group",
|
|
3033
|
+
writable: true,
|
|
3028
3034
|
relations: ["marginfi_account", "bank"]
|
|
3029
3035
|
},
|
|
3030
3036
|
{
|
|
@@ -3096,26 +3102,11 @@ var marginfi_0_1_8_default = {
|
|
|
3096
3102
|
]
|
|
3097
3103
|
},
|
|
3098
3104
|
{
|
|
3099
|
-
name: "
|
|
3105
|
+
name: "lending_account_close_balance",
|
|
3100
3106
|
docs: [
|
|
3101
|
-
"(
|
|
3102
|
-
"
|
|
3107
|
+
"(account authority) Close a balance position with dust-level amounts. Claims outstanding",
|
|
3108
|
+
"emissions before closing."
|
|
3103
3109
|
],
|
|
3104
|
-
discriminator: [239, 4, 221, 98, 45, 167, 201, 244],
|
|
3105
|
-
accounts: [
|
|
3106
|
-
{
|
|
3107
|
-
name: "marginfi_account",
|
|
3108
|
-
writable: true
|
|
3109
|
-
},
|
|
3110
|
-
{
|
|
3111
|
-
name: "bank"
|
|
3112
|
-
}
|
|
3113
|
-
],
|
|
3114
|
-
args: []
|
|
3115
|
-
},
|
|
3116
|
-
{
|
|
3117
|
-
name: "lending_account_close_balance",
|
|
3118
|
-
docs: ["(account authority) Close a balance position with dust-level amounts."],
|
|
3119
3110
|
discriminator: [245, 54, 41, 4, 243, 202, 31, 17],
|
|
3120
3111
|
accounts: [
|
|
3121
3112
|
{
|
|
@@ -3147,219 +3138,7 @@ var marginfi_0_1_8_default = {
|
|
|
3147
3138
|
accounts: [
|
|
3148
3139
|
{
|
|
3149
3140
|
name: "group",
|
|
3150
|
-
relations: ["marginfi_account", "bank"]
|
|
3151
|
-
},
|
|
3152
|
-
{
|
|
3153
|
-
name: "marginfi_account",
|
|
3154
|
-
writable: true
|
|
3155
|
-
},
|
|
3156
|
-
{
|
|
3157
|
-
name: "authority",
|
|
3158
|
-
signer: true
|
|
3159
|
-
},
|
|
3160
|
-
{
|
|
3161
|
-
name: "bank",
|
|
3162
|
-
writable: true
|
|
3163
|
-
},
|
|
3164
|
-
{
|
|
3165
|
-
name: "signer_token_account",
|
|
3166
|
-
writable: true
|
|
3167
|
-
},
|
|
3168
|
-
{
|
|
3169
|
-
name: "liquidity_vault",
|
|
3170
3141
|
writable: true,
|
|
3171
|
-
relations: ["bank"]
|
|
3172
|
-
},
|
|
3173
|
-
{
|
|
3174
|
-
name: "token_program"
|
|
3175
|
-
}
|
|
3176
|
-
],
|
|
3177
|
-
args: [
|
|
3178
|
-
{
|
|
3179
|
-
name: "amount",
|
|
3180
|
-
type: "u64"
|
|
3181
|
-
},
|
|
3182
|
-
{
|
|
3183
|
-
name: "deposit_up_to_limit",
|
|
3184
|
-
type: {
|
|
3185
|
-
option: "bool"
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
]
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
name: "lending_account_end_flashloan",
|
|
3192
|
-
docs: ["(account authority) End a flash loan and run the health check."],
|
|
3193
|
-
discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
|
|
3194
|
-
accounts: [
|
|
3195
|
-
{
|
|
3196
|
-
name: "marginfi_account",
|
|
3197
|
-
writable: true
|
|
3198
|
-
},
|
|
3199
|
-
{
|
|
3200
|
-
name: "authority",
|
|
3201
|
-
signer: true,
|
|
3202
|
-
relations: ["marginfi_account"]
|
|
3203
|
-
}
|
|
3204
|
-
],
|
|
3205
|
-
args: []
|
|
3206
|
-
},
|
|
3207
|
-
{
|
|
3208
|
-
name: "lending_account_liquidate",
|
|
3209
|
-
docs: [
|
|
3210
|
-
"(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
|
|
3211
|
-
"The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
|
|
3212
|
-
"fee + 2.5% insurance fee).",
|
|
3213
|
-
"* `asset_amount` - amount of collateral to liquidate",
|
|
3214
|
-
"* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
|
|
3215
|
-
"* `liquidator_accounts` - number of remaining accounts for the liquidator"
|
|
3216
|
-
],
|
|
3217
|
-
discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
|
|
3218
|
-
accounts: [
|
|
3219
|
-
{
|
|
3220
|
-
name: "group",
|
|
3221
|
-
relations: [
|
|
3222
|
-
"asset_bank",
|
|
3223
|
-
"liab_bank",
|
|
3224
|
-
"liquidator_marginfi_account",
|
|
3225
|
-
"liquidatee_marginfi_account"
|
|
3226
|
-
]
|
|
3227
|
-
},
|
|
3228
|
-
{
|
|
3229
|
-
name: "asset_bank",
|
|
3230
|
-
writable: true
|
|
3231
|
-
},
|
|
3232
|
-
{
|
|
3233
|
-
name: "liab_bank",
|
|
3234
|
-
writable: true
|
|
3235
|
-
},
|
|
3236
|
-
{
|
|
3237
|
-
name: "liquidator_marginfi_account",
|
|
3238
|
-
writable: true
|
|
3239
|
-
},
|
|
3240
|
-
{
|
|
3241
|
-
name: "authority",
|
|
3242
|
-
signer: true
|
|
3243
|
-
},
|
|
3244
|
-
{
|
|
3245
|
-
name: "liquidatee_marginfi_account",
|
|
3246
|
-
writable: true
|
|
3247
|
-
},
|
|
3248
|
-
{
|
|
3249
|
-
name: "bank_liquidity_vault_authority",
|
|
3250
|
-
pda: {
|
|
3251
|
-
seeds: [
|
|
3252
|
-
{
|
|
3253
|
-
kind: "const",
|
|
3254
|
-
value: [
|
|
3255
|
-
108,
|
|
3256
|
-
105,
|
|
3257
|
-
113,
|
|
3258
|
-
117,
|
|
3259
|
-
105,
|
|
3260
|
-
100,
|
|
3261
|
-
105,
|
|
3262
|
-
116,
|
|
3263
|
-
121,
|
|
3264
|
-
95,
|
|
3265
|
-
118,
|
|
3266
|
-
97,
|
|
3267
|
-
117,
|
|
3268
|
-
108,
|
|
3269
|
-
116,
|
|
3270
|
-
95,
|
|
3271
|
-
97,
|
|
3272
|
-
117,
|
|
3273
|
-
116,
|
|
3274
|
-
104
|
|
3275
|
-
]
|
|
3276
|
-
},
|
|
3277
|
-
{
|
|
3278
|
-
kind: "account",
|
|
3279
|
-
path: "liab_bank"
|
|
3280
|
-
}
|
|
3281
|
-
]
|
|
3282
|
-
}
|
|
3283
|
-
},
|
|
3284
|
-
{
|
|
3285
|
-
name: "bank_liquidity_vault",
|
|
3286
|
-
writable: true,
|
|
3287
|
-
pda: {
|
|
3288
|
-
seeds: [
|
|
3289
|
-
{
|
|
3290
|
-
kind: "const",
|
|
3291
|
-
value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
|
|
3292
|
-
},
|
|
3293
|
-
{
|
|
3294
|
-
kind: "account",
|
|
3295
|
-
path: "liab_bank"
|
|
3296
|
-
}
|
|
3297
|
-
]
|
|
3298
|
-
}
|
|
3299
|
-
},
|
|
3300
|
-
{
|
|
3301
|
-
name: "bank_insurance_vault",
|
|
3302
|
-
writable: true,
|
|
3303
|
-
pda: {
|
|
3304
|
-
seeds: [
|
|
3305
|
-
{
|
|
3306
|
-
kind: "const",
|
|
3307
|
-
value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
|
|
3308
|
-
},
|
|
3309
|
-
{
|
|
3310
|
-
kind: "account",
|
|
3311
|
-
path: "liab_bank"
|
|
3312
|
-
}
|
|
3313
|
-
]
|
|
3314
|
-
}
|
|
3315
|
-
},
|
|
3316
|
-
{
|
|
3317
|
-
name: "token_program"
|
|
3318
|
-
}
|
|
3319
|
-
],
|
|
3320
|
-
args: [
|
|
3321
|
-
{
|
|
3322
|
-
name: "asset_amount",
|
|
3323
|
-
type: "u64"
|
|
3324
|
-
},
|
|
3325
|
-
{
|
|
3326
|
-
name: "liquidatee_accounts",
|
|
3327
|
-
type: "u8"
|
|
3328
|
-
},
|
|
3329
|
-
{
|
|
3330
|
-
name: "liquidator_accounts",
|
|
3331
|
-
type: "u8"
|
|
3332
|
-
}
|
|
3333
|
-
]
|
|
3334
|
-
},
|
|
3335
|
-
{
|
|
3336
|
-
name: "lending_account_pulse_health",
|
|
3337
|
-
docs: [
|
|
3338
|
-
"(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
|
|
3339
|
-
"other consumers that want to see the internal risk state of a user account. This cache is",
|
|
3340
|
-
"read-only and serves no purpose except being populated by this ix.",
|
|
3341
|
-
"* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
|
|
3342
|
-
"user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
|
|
3343
|
-
],
|
|
3344
|
-
discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
|
|
3345
|
-
accounts: [
|
|
3346
|
-
{
|
|
3347
|
-
name: "marginfi_account",
|
|
3348
|
-
writable: true
|
|
3349
|
-
}
|
|
3350
|
-
],
|
|
3351
|
-
args: []
|
|
3352
|
-
},
|
|
3353
|
-
{
|
|
3354
|
-
name: "lending_account_repay",
|
|
3355
|
-
docs: [
|
|
3356
|
-
"(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
|
|
3357
|
-
"interest, records repayment, and transfers tokens to the bank's liquidity vault."
|
|
3358
|
-
],
|
|
3359
|
-
discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
|
|
3360
|
-
accounts: [
|
|
3361
|
-
{
|
|
3362
|
-
name: "group",
|
|
3363
3142
|
relations: ["marginfi_account", "bank"]
|
|
3364
3143
|
},
|
|
3365
3144
|
{
|
|
@@ -3368,12 +3147,226 @@ var marginfi_0_1_8_default = {
|
|
|
3368
3147
|
},
|
|
3369
3148
|
{
|
|
3370
3149
|
name: "authority",
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3150
|
+
signer: true
|
|
3151
|
+
},
|
|
3152
|
+
{
|
|
3153
|
+
name: "bank",
|
|
3154
|
+
writable: true
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
name: "signer_token_account",
|
|
3158
|
+
writable: true
|
|
3159
|
+
},
|
|
3160
|
+
{
|
|
3161
|
+
name: "liquidity_vault",
|
|
3162
|
+
writable: true,
|
|
3163
|
+
relations: ["bank"]
|
|
3164
|
+
},
|
|
3165
|
+
{
|
|
3166
|
+
name: "token_program"
|
|
3167
|
+
}
|
|
3168
|
+
],
|
|
3169
|
+
args: [
|
|
3170
|
+
{
|
|
3171
|
+
name: "amount",
|
|
3172
|
+
type: "u64"
|
|
3173
|
+
},
|
|
3174
|
+
{
|
|
3175
|
+
name: "deposit_up_to_limit",
|
|
3176
|
+
type: {
|
|
3177
|
+
option: "bool"
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
]
|
|
3181
|
+
},
|
|
3182
|
+
{
|
|
3183
|
+
name: "lending_account_end_flashloan",
|
|
3184
|
+
docs: ["(account authority) End a flash loan and run the health check."],
|
|
3185
|
+
discriminator: [105, 124, 201, 106, 153, 2, 8, 156],
|
|
3186
|
+
accounts: [
|
|
3187
|
+
{
|
|
3188
|
+
name: "marginfi_account",
|
|
3189
|
+
writable: true
|
|
3190
|
+
},
|
|
3191
|
+
{
|
|
3192
|
+
name: "authority",
|
|
3193
|
+
signer: true,
|
|
3194
|
+
relations: ["marginfi_account"]
|
|
3195
|
+
}
|
|
3196
|
+
],
|
|
3197
|
+
args: []
|
|
3198
|
+
},
|
|
3199
|
+
{
|
|
3200
|
+
name: "lending_account_liquidate",
|
|
3201
|
+
docs: [
|
|
3202
|
+
"(permissionless) Liquidate a lending account balance of an unhealthy marginfi account.",
|
|
3203
|
+
"The liquidator takes on the liability and receives discounted collateral (2.5% liquidator",
|
|
3204
|
+
"fee + 2.5% insurance fee).",
|
|
3205
|
+
"* `asset_amount` - amount of collateral to liquidate",
|
|
3206
|
+
"* `liquidatee_accounts` - number of remaining accounts for the liquidatee",
|
|
3207
|
+
"* `liquidator_accounts` - number of remaining accounts for the liquidator"
|
|
3208
|
+
],
|
|
3209
|
+
discriminator: [214, 169, 151, 213, 251, 167, 86, 219],
|
|
3210
|
+
accounts: [
|
|
3211
|
+
{
|
|
3212
|
+
name: "group",
|
|
3213
|
+
relations: [
|
|
3214
|
+
"asset_bank",
|
|
3215
|
+
"liab_bank",
|
|
3216
|
+
"liquidator_marginfi_account",
|
|
3217
|
+
"liquidatee_marginfi_account"
|
|
3218
|
+
]
|
|
3219
|
+
},
|
|
3220
|
+
{
|
|
3221
|
+
name: "asset_bank",
|
|
3222
|
+
writable: true
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
name: "liab_bank",
|
|
3226
|
+
writable: true
|
|
3227
|
+
},
|
|
3228
|
+
{
|
|
3229
|
+
name: "liquidator_marginfi_account",
|
|
3230
|
+
writable: true
|
|
3231
|
+
},
|
|
3232
|
+
{
|
|
3233
|
+
name: "authority",
|
|
3234
|
+
signer: true
|
|
3235
|
+
},
|
|
3236
|
+
{
|
|
3237
|
+
name: "liquidatee_marginfi_account",
|
|
3238
|
+
writable: true
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
name: "bank_liquidity_vault_authority",
|
|
3242
|
+
pda: {
|
|
3243
|
+
seeds: [
|
|
3244
|
+
{
|
|
3245
|
+
kind: "const",
|
|
3246
|
+
value: [
|
|
3247
|
+
108,
|
|
3248
|
+
105,
|
|
3249
|
+
113,
|
|
3250
|
+
117,
|
|
3251
|
+
105,
|
|
3252
|
+
100,
|
|
3253
|
+
105,
|
|
3254
|
+
116,
|
|
3255
|
+
121,
|
|
3256
|
+
95,
|
|
3257
|
+
118,
|
|
3258
|
+
97,
|
|
3259
|
+
117,
|
|
3260
|
+
108,
|
|
3261
|
+
116,
|
|
3262
|
+
95,
|
|
3263
|
+
97,
|
|
3264
|
+
117,
|
|
3265
|
+
116,
|
|
3266
|
+
104
|
|
3267
|
+
]
|
|
3268
|
+
},
|
|
3269
|
+
{
|
|
3270
|
+
kind: "account",
|
|
3271
|
+
path: "liab_bank"
|
|
3272
|
+
}
|
|
3273
|
+
]
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
{
|
|
3277
|
+
name: "bank_liquidity_vault",
|
|
3278
|
+
writable: true,
|
|
3279
|
+
pda: {
|
|
3280
|
+
seeds: [
|
|
3281
|
+
{
|
|
3282
|
+
kind: "const",
|
|
3283
|
+
value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
|
|
3284
|
+
},
|
|
3285
|
+
{
|
|
3286
|
+
kind: "account",
|
|
3287
|
+
path: "liab_bank"
|
|
3288
|
+
}
|
|
3289
|
+
]
|
|
3290
|
+
}
|
|
3291
|
+
},
|
|
3292
|
+
{
|
|
3293
|
+
name: "bank_insurance_vault",
|
|
3294
|
+
writable: true,
|
|
3295
|
+
pda: {
|
|
3296
|
+
seeds: [
|
|
3297
|
+
{
|
|
3298
|
+
kind: "const",
|
|
3299
|
+
value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
|
|
3300
|
+
},
|
|
3301
|
+
{
|
|
3302
|
+
kind: "account",
|
|
3303
|
+
path: "liab_bank"
|
|
3304
|
+
}
|
|
3305
|
+
]
|
|
3306
|
+
}
|
|
3307
|
+
},
|
|
3308
|
+
{
|
|
3309
|
+
name: "token_program"
|
|
3310
|
+
}
|
|
3311
|
+
],
|
|
3312
|
+
args: [
|
|
3313
|
+
{
|
|
3314
|
+
name: "asset_amount",
|
|
3315
|
+
type: "u64"
|
|
3316
|
+
},
|
|
3317
|
+
{
|
|
3318
|
+
name: "liquidatee_accounts",
|
|
3319
|
+
type: "u8"
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
name: "liquidator_accounts",
|
|
3323
|
+
type: "u8"
|
|
3324
|
+
}
|
|
3325
|
+
]
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
name: "lending_account_pulse_health",
|
|
3329
|
+
docs: [
|
|
3330
|
+
"(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and",
|
|
3331
|
+
"other consumers that want to see the internal risk state of a user account. This cache is",
|
|
3332
|
+
"read-only and serves no purpose except being populated by this ix.",
|
|
3333
|
+
"* remaining accounts expected in the same order as borrow, etc. I.e., for each balance the",
|
|
3334
|
+
"user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>"
|
|
3335
|
+
],
|
|
3336
|
+
discriminator: [186, 52, 117, 97, 34, 74, 39, 253],
|
|
3337
|
+
accounts: [
|
|
3338
|
+
{
|
|
3339
|
+
name: "marginfi_account",
|
|
3340
|
+
writable: true
|
|
3341
|
+
}
|
|
3342
|
+
],
|
|
3343
|
+
args: []
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
name: "lending_account_repay",
|
|
3347
|
+
docs: [
|
|
3348
|
+
"(account authority, or any signer during receivership) Repay borrowed assets. Accrues",
|
|
3349
|
+
"interest, records repayment, and transfers tokens to the bank's liquidity vault."
|
|
3350
|
+
],
|
|
3351
|
+
discriminator: [79, 209, 172, 177, 222, 51, 173, 151],
|
|
3352
|
+
accounts: [
|
|
3353
|
+
{
|
|
3354
|
+
name: "group",
|
|
3355
|
+
writable: true,
|
|
3356
|
+
relations: ["marginfi_account", "bank"]
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
name: "marginfi_account",
|
|
3360
|
+
writable: true
|
|
3361
|
+
},
|
|
3362
|
+
{
|
|
3363
|
+
name: "authority",
|
|
3364
|
+
docs: [
|
|
3365
|
+
"Must be marginfi_account's authority, unless in liquidation/deleverage receivership or order execution",
|
|
3366
|
+
"",
|
|
3367
|
+
"Note: during receivership and order execution, there are no signer checks whatsoever: any key can repay as",
|
|
3368
|
+
"long as the invariants checked at the end of execution are met."
|
|
3369
|
+
],
|
|
3377
3370
|
signer: true
|
|
3378
3371
|
},
|
|
3379
3372
|
{
|
|
@@ -3406,6 +3399,24 @@ var marginfi_0_1_8_default = {
|
|
|
3406
3399
|
}
|
|
3407
3400
|
]
|
|
3408
3401
|
},
|
|
3402
|
+
{
|
|
3403
|
+
name: "lending_account_settle_emissions",
|
|
3404
|
+
docs: [
|
|
3405
|
+
"(permissionless) Settle unclaimed emissions into a user's balance without withdrawing."
|
|
3406
|
+
],
|
|
3407
|
+
discriminator: [161, 58, 136, 174, 242, 223, 156, 176],
|
|
3408
|
+
accounts: [
|
|
3409
|
+
{
|
|
3410
|
+
name: "marginfi_account",
|
|
3411
|
+
writable: true
|
|
3412
|
+
},
|
|
3413
|
+
{
|
|
3414
|
+
name: "bank",
|
|
3415
|
+
writable: true
|
|
3416
|
+
}
|
|
3417
|
+
],
|
|
3418
|
+
args: []
|
|
3419
|
+
},
|
|
3409
3420
|
{
|
|
3410
3421
|
name: "lending_account_start_flashloan",
|
|
3411
3422
|
docs: [
|
|
@@ -3446,6 +3457,7 @@ var marginfi_0_1_8_default = {
|
|
|
3446
3457
|
accounts: [
|
|
3447
3458
|
{
|
|
3448
3459
|
name: "group",
|
|
3460
|
+
writable: true,
|
|
3449
3461
|
relations: ["marginfi_account", "bank"]
|
|
3450
3462
|
},
|
|
3451
3463
|
{
|
|
@@ -3528,6 +3540,253 @@ var marginfi_0_1_8_default = {
|
|
|
3528
3540
|
}
|
|
3529
3541
|
]
|
|
3530
3542
|
},
|
|
3543
|
+
{
|
|
3544
|
+
name: "lending_account_withdraw_emissions",
|
|
3545
|
+
docs: [
|
|
3546
|
+
"(account authority) Settle and withdraw emissions rewards to a destination token account."
|
|
3547
|
+
],
|
|
3548
|
+
discriminator: [234, 22, 84, 214, 118, 176, 140, 170],
|
|
3549
|
+
accounts: [
|
|
3550
|
+
{
|
|
3551
|
+
name: "group",
|
|
3552
|
+
relations: ["marginfi_account", "bank"]
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
name: "marginfi_account",
|
|
3556
|
+
writable: true
|
|
3557
|
+
},
|
|
3558
|
+
{
|
|
3559
|
+
name: "authority",
|
|
3560
|
+
signer: true
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
name: "bank",
|
|
3564
|
+
writable: true
|
|
3565
|
+
},
|
|
3566
|
+
{
|
|
3567
|
+
name: "emissions_mint",
|
|
3568
|
+
relations: ["bank"]
|
|
3569
|
+
},
|
|
3570
|
+
{
|
|
3571
|
+
name: "emissions_auth",
|
|
3572
|
+
pda: {
|
|
3573
|
+
seeds: [
|
|
3574
|
+
{
|
|
3575
|
+
kind: "const",
|
|
3576
|
+
value: [
|
|
3577
|
+
101,
|
|
3578
|
+
109,
|
|
3579
|
+
105,
|
|
3580
|
+
115,
|
|
3581
|
+
115,
|
|
3582
|
+
105,
|
|
3583
|
+
111,
|
|
3584
|
+
110,
|
|
3585
|
+
115,
|
|
3586
|
+
95,
|
|
3587
|
+
97,
|
|
3588
|
+
117,
|
|
3589
|
+
116,
|
|
3590
|
+
104,
|
|
3591
|
+
95,
|
|
3592
|
+
115,
|
|
3593
|
+
101,
|
|
3594
|
+
101,
|
|
3595
|
+
100
|
|
3596
|
+
]
|
|
3597
|
+
},
|
|
3598
|
+
{
|
|
3599
|
+
kind: "account",
|
|
3600
|
+
path: "bank"
|
|
3601
|
+
},
|
|
3602
|
+
{
|
|
3603
|
+
kind: "account",
|
|
3604
|
+
path: "emissions_mint"
|
|
3605
|
+
}
|
|
3606
|
+
]
|
|
3607
|
+
}
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
name: "emissions_vault",
|
|
3611
|
+
writable: true,
|
|
3612
|
+
pda: {
|
|
3613
|
+
seeds: [
|
|
3614
|
+
{
|
|
3615
|
+
kind: "const",
|
|
3616
|
+
value: [
|
|
3617
|
+
101,
|
|
3618
|
+
109,
|
|
3619
|
+
105,
|
|
3620
|
+
115,
|
|
3621
|
+
115,
|
|
3622
|
+
105,
|
|
3623
|
+
111,
|
|
3624
|
+
110,
|
|
3625
|
+
115,
|
|
3626
|
+
95,
|
|
3627
|
+
116,
|
|
3628
|
+
111,
|
|
3629
|
+
107,
|
|
3630
|
+
101,
|
|
3631
|
+
110,
|
|
3632
|
+
95,
|
|
3633
|
+
97,
|
|
3634
|
+
99,
|
|
3635
|
+
99,
|
|
3636
|
+
111,
|
|
3637
|
+
117,
|
|
3638
|
+
110,
|
|
3639
|
+
116,
|
|
3640
|
+
95,
|
|
3641
|
+
115,
|
|
3642
|
+
101,
|
|
3643
|
+
101,
|
|
3644
|
+
100
|
|
3645
|
+
]
|
|
3646
|
+
},
|
|
3647
|
+
{
|
|
3648
|
+
kind: "account",
|
|
3649
|
+
path: "bank"
|
|
3650
|
+
},
|
|
3651
|
+
{
|
|
3652
|
+
kind: "account",
|
|
3653
|
+
path: "emissions_mint"
|
|
3654
|
+
}
|
|
3655
|
+
]
|
|
3656
|
+
}
|
|
3657
|
+
},
|
|
3658
|
+
{
|
|
3659
|
+
name: "destination_account",
|
|
3660
|
+
writable: true
|
|
3661
|
+
},
|
|
3662
|
+
{
|
|
3663
|
+
name: "token_program"
|
|
3664
|
+
}
|
|
3665
|
+
],
|
|
3666
|
+
args: []
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
name: "lending_account_withdraw_emissions_permissionless",
|
|
3670
|
+
docs: [
|
|
3671
|
+
"(permissionless) Withdraw emissions to the user's pre-configured emissions destination ATA."
|
|
3672
|
+
],
|
|
3673
|
+
discriminator: [4, 174, 124, 203, 44, 49, 145, 150],
|
|
3674
|
+
accounts: [
|
|
3675
|
+
{
|
|
3676
|
+
name: "group",
|
|
3677
|
+
relations: ["marginfi_account", "bank"]
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
name: "marginfi_account",
|
|
3681
|
+
writable: true
|
|
3682
|
+
},
|
|
3683
|
+
{
|
|
3684
|
+
name: "bank",
|
|
3685
|
+
writable: true
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
name: "emissions_mint",
|
|
3689
|
+
relations: ["bank"]
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
name: "emissions_auth",
|
|
3693
|
+
pda: {
|
|
3694
|
+
seeds: [
|
|
3695
|
+
{
|
|
3696
|
+
kind: "const",
|
|
3697
|
+
value: [
|
|
3698
|
+
101,
|
|
3699
|
+
109,
|
|
3700
|
+
105,
|
|
3701
|
+
115,
|
|
3702
|
+
115,
|
|
3703
|
+
105,
|
|
3704
|
+
111,
|
|
3705
|
+
110,
|
|
3706
|
+
115,
|
|
3707
|
+
95,
|
|
3708
|
+
97,
|
|
3709
|
+
117,
|
|
3710
|
+
116,
|
|
3711
|
+
104,
|
|
3712
|
+
95,
|
|
3713
|
+
115,
|
|
3714
|
+
101,
|
|
3715
|
+
101,
|
|
3716
|
+
100
|
|
3717
|
+
]
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
kind: "account",
|
|
3721
|
+
path: "bank"
|
|
3722
|
+
},
|
|
3723
|
+
{
|
|
3724
|
+
kind: "account",
|
|
3725
|
+
path: "emissions_mint"
|
|
3726
|
+
}
|
|
3727
|
+
]
|
|
3728
|
+
}
|
|
3729
|
+
},
|
|
3730
|
+
{
|
|
3731
|
+
name: "emissions_vault",
|
|
3732
|
+
writable: true,
|
|
3733
|
+
pda: {
|
|
3734
|
+
seeds: [
|
|
3735
|
+
{
|
|
3736
|
+
kind: "const",
|
|
3737
|
+
value: [
|
|
3738
|
+
101,
|
|
3739
|
+
109,
|
|
3740
|
+
105,
|
|
3741
|
+
115,
|
|
3742
|
+
115,
|
|
3743
|
+
105,
|
|
3744
|
+
111,
|
|
3745
|
+
110,
|
|
3746
|
+
115,
|
|
3747
|
+
95,
|
|
3748
|
+
116,
|
|
3749
|
+
111,
|
|
3750
|
+
107,
|
|
3751
|
+
101,
|
|
3752
|
+
110,
|
|
3753
|
+
95,
|
|
3754
|
+
97,
|
|
3755
|
+
99,
|
|
3756
|
+
99,
|
|
3757
|
+
111,
|
|
3758
|
+
117,
|
|
3759
|
+
110,
|
|
3760
|
+
116,
|
|
3761
|
+
95,
|
|
3762
|
+
115,
|
|
3763
|
+
101,
|
|
3764
|
+
101,
|
|
3765
|
+
100
|
|
3766
|
+
]
|
|
3767
|
+
},
|
|
3768
|
+
{
|
|
3769
|
+
kind: "account",
|
|
3770
|
+
path: "bank"
|
|
3771
|
+
},
|
|
3772
|
+
{
|
|
3773
|
+
kind: "account",
|
|
3774
|
+
path: "emissions_mint"
|
|
3775
|
+
}
|
|
3776
|
+
]
|
|
3777
|
+
}
|
|
3778
|
+
},
|
|
3779
|
+
{
|
|
3780
|
+
name: "destination_account",
|
|
3781
|
+
docs: ["registered on `marginfi_account`"],
|
|
3782
|
+
writable: true
|
|
3783
|
+
},
|
|
3784
|
+
{
|
|
3785
|
+
name: "token_program"
|
|
3786
|
+
}
|
|
3787
|
+
],
|
|
3788
|
+
args: []
|
|
3789
|
+
},
|
|
3531
3790
|
{
|
|
3532
3791
|
name: "lending_pool_accrue_bank_interest",
|
|
3533
3792
|
docs: [
|
|
@@ -5929,6 +6188,7 @@ var marginfi_0_1_8_default = {
|
|
|
5929
6188
|
accounts: [
|
|
5930
6189
|
{
|
|
5931
6190
|
name: "group",
|
|
6191
|
+
writable: true,
|
|
5932
6192
|
relations: ["bank"]
|
|
5933
6193
|
},
|
|
5934
6194
|
{
|
|
@@ -5939,17 +6199,50 @@ var marginfi_0_1_8_default = {
|
|
|
5939
6199
|
args: []
|
|
5940
6200
|
},
|
|
5941
6201
|
{
|
|
5942
|
-
name: "
|
|
5943
|
-
docs: [
|
|
5944
|
-
|
|
5945
|
-
|
|
6202
|
+
name: "lending_pool_set_fixed_oracle_price",
|
|
6203
|
+
docs: ["(admin only)"],
|
|
6204
|
+
discriminator: [28, 126, 127, 127, 60, 37, 211, 125],
|
|
6205
|
+
accounts: [
|
|
6206
|
+
{
|
|
6207
|
+
name: "group",
|
|
6208
|
+
relations: ["bank"]
|
|
6209
|
+
},
|
|
6210
|
+
{
|
|
6211
|
+
name: "admin",
|
|
6212
|
+
signer: true,
|
|
6213
|
+
relations: ["group"]
|
|
6214
|
+
},
|
|
6215
|
+
{
|
|
6216
|
+
name: "bank",
|
|
6217
|
+
writable: true
|
|
6218
|
+
}
|
|
5946
6219
|
],
|
|
5947
|
-
|
|
6220
|
+
args: [
|
|
6221
|
+
{
|
|
6222
|
+
name: "price",
|
|
6223
|
+
type: {
|
|
6224
|
+
defined: {
|
|
6225
|
+
name: "WrappedI80F48"
|
|
6226
|
+
}
|
|
6227
|
+
}
|
|
6228
|
+
}
|
|
6229
|
+
]
|
|
6230
|
+
},
|
|
6231
|
+
{
|
|
6232
|
+
name: "lending_pool_setup_emissions",
|
|
6233
|
+
docs: ["(delegate_emissions_admin only)"],
|
|
6234
|
+
discriminator: [206, 97, 120, 172, 113, 204, 169, 70],
|
|
5948
6235
|
accounts: [
|
|
5949
6236
|
{
|
|
5950
6237
|
name: "group",
|
|
5951
6238
|
relations: ["bank"]
|
|
5952
6239
|
},
|
|
6240
|
+
{
|
|
6241
|
+
name: "delegate_emissions_admin",
|
|
6242
|
+
writable: true,
|
|
6243
|
+
signer: true,
|
|
6244
|
+
relations: ["group"]
|
|
6245
|
+
},
|
|
5953
6246
|
{
|
|
5954
6247
|
name: "bank",
|
|
5955
6248
|
writable: true
|
|
@@ -5997,7 +6290,7 @@ var marginfi_0_1_8_default = {
|
|
|
5997
6290
|
}
|
|
5998
6291
|
},
|
|
5999
6292
|
{
|
|
6000
|
-
name: "
|
|
6293
|
+
name: "emissions_token_account",
|
|
6001
6294
|
writable: true,
|
|
6002
6295
|
pda: {
|
|
6003
6296
|
seeds: [
|
|
@@ -6046,53 +6339,129 @@ var marginfi_0_1_8_default = {
|
|
|
6046
6339
|
}
|
|
6047
6340
|
},
|
|
6048
6341
|
{
|
|
6049
|
-
name: "
|
|
6050
|
-
|
|
6051
|
-
seeds: [
|
|
6052
|
-
{
|
|
6053
|
-
kind: "const",
|
|
6054
|
-
value: [102, 101, 101, 115, 116, 97, 116, 101]
|
|
6055
|
-
}
|
|
6056
|
-
]
|
|
6057
|
-
}
|
|
6058
|
-
},
|
|
6059
|
-
{
|
|
6060
|
-
name: "destination_account",
|
|
6061
|
-
docs: ["emissions mint (validated in handler)."],
|
|
6342
|
+
name: "emissions_funding_account",
|
|
6343
|
+
docs: ["NOTE: This is a TokenAccount, spl transfer will validate it.", ""],
|
|
6062
6344
|
writable: true
|
|
6063
6345
|
},
|
|
6064
6346
|
{
|
|
6065
6347
|
name: "token_program"
|
|
6348
|
+
},
|
|
6349
|
+
{
|
|
6350
|
+
name: "system_program",
|
|
6351
|
+
address: "11111111111111111111111111111111"
|
|
6066
6352
|
}
|
|
6067
6353
|
],
|
|
6068
|
-
args: [
|
|
6354
|
+
args: [
|
|
6355
|
+
{
|
|
6356
|
+
name: "flags",
|
|
6357
|
+
type: "u64"
|
|
6358
|
+
},
|
|
6359
|
+
{
|
|
6360
|
+
name: "rate",
|
|
6361
|
+
type: "u64"
|
|
6362
|
+
},
|
|
6363
|
+
{
|
|
6364
|
+
name: "total_emissions",
|
|
6365
|
+
type: "u64"
|
|
6366
|
+
}
|
|
6367
|
+
]
|
|
6069
6368
|
},
|
|
6070
6369
|
{
|
|
6071
|
-
name: "
|
|
6072
|
-
docs: ["(
|
|
6073
|
-
discriminator: [
|
|
6370
|
+
name: "lending_pool_update_emissions_parameters",
|
|
6371
|
+
docs: ["(delegate_emissions_admin only)"],
|
|
6372
|
+
discriminator: [55, 213, 224, 168, 153, 53, 197, 40],
|
|
6074
6373
|
accounts: [
|
|
6075
6374
|
{
|
|
6076
6375
|
name: "group",
|
|
6077
6376
|
relations: ["bank"]
|
|
6078
6377
|
},
|
|
6079
6378
|
{
|
|
6080
|
-
name: "
|
|
6379
|
+
name: "delegate_emissions_admin",
|
|
6380
|
+
writable: true,
|
|
6081
6381
|
signer: true,
|
|
6082
6382
|
relations: ["group"]
|
|
6083
6383
|
},
|
|
6084
6384
|
{
|
|
6085
6385
|
name: "bank",
|
|
6086
6386
|
writable: true
|
|
6387
|
+
},
|
|
6388
|
+
{
|
|
6389
|
+
name: "emissions_mint"
|
|
6390
|
+
},
|
|
6391
|
+
{
|
|
6392
|
+
name: "emissions_token_account",
|
|
6393
|
+
writable: true,
|
|
6394
|
+
pda: {
|
|
6395
|
+
seeds: [
|
|
6396
|
+
{
|
|
6397
|
+
kind: "const",
|
|
6398
|
+
value: [
|
|
6399
|
+
101,
|
|
6400
|
+
109,
|
|
6401
|
+
105,
|
|
6402
|
+
115,
|
|
6403
|
+
115,
|
|
6404
|
+
105,
|
|
6405
|
+
111,
|
|
6406
|
+
110,
|
|
6407
|
+
115,
|
|
6408
|
+
95,
|
|
6409
|
+
116,
|
|
6410
|
+
111,
|
|
6411
|
+
107,
|
|
6412
|
+
101,
|
|
6413
|
+
110,
|
|
6414
|
+
95,
|
|
6415
|
+
97,
|
|
6416
|
+
99,
|
|
6417
|
+
99,
|
|
6418
|
+
111,
|
|
6419
|
+
117,
|
|
6420
|
+
110,
|
|
6421
|
+
116,
|
|
6422
|
+
95,
|
|
6423
|
+
115,
|
|
6424
|
+
101,
|
|
6425
|
+
101,
|
|
6426
|
+
100
|
|
6427
|
+
]
|
|
6428
|
+
},
|
|
6429
|
+
{
|
|
6430
|
+
kind: "account",
|
|
6431
|
+
path: "bank"
|
|
6432
|
+
},
|
|
6433
|
+
{
|
|
6434
|
+
kind: "account",
|
|
6435
|
+
path: "emissions_mint"
|
|
6436
|
+
}
|
|
6437
|
+
]
|
|
6438
|
+
}
|
|
6439
|
+
},
|
|
6440
|
+
{
|
|
6441
|
+
name: "emissions_funding_account",
|
|
6442
|
+
writable: true
|
|
6443
|
+
},
|
|
6444
|
+
{
|
|
6445
|
+
name: "token_program"
|
|
6087
6446
|
}
|
|
6088
6447
|
],
|
|
6089
6448
|
args: [
|
|
6090
6449
|
{
|
|
6091
|
-
name: "
|
|
6450
|
+
name: "emissions_flags",
|
|
6092
6451
|
type: {
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6452
|
+
option: "u64"
|
|
6453
|
+
}
|
|
6454
|
+
},
|
|
6455
|
+
{
|
|
6456
|
+
name: "emissions_rate",
|
|
6457
|
+
type: {
|
|
6458
|
+
option: "u64"
|
|
6459
|
+
}
|
|
6460
|
+
},
|
|
6461
|
+
{
|
|
6462
|
+
name: "additional_emissions",
|
|
6463
|
+
type: {
|
|
6464
|
+
option: "u64"
|
|
6096
6465
|
}
|
|
6097
6466
|
}
|
|
6098
6467
|
]
|
|
@@ -6602,7 +6971,7 @@ var marginfi_0_1_8_default = {
|
|
|
6602
6971
|
name: "marginfi_account_keeper_close_order",
|
|
6603
6972
|
docs: [
|
|
6604
6973
|
"(permissionless keeper) Close an existing Order after the user account was closed, or it no",
|
|
6605
|
-
"longer
|
|
6974
|
+
"longer as the associated positions, or the user has executed",
|
|
6606
6975
|
"`marginfi_account_set_keeper_close_flags`. Keeper keeps the rent."
|
|
6607
6976
|
],
|
|
6608
6977
|
discriminator: [128, 114, 71, 46, 194, 71, 186, 106],
|
|
@@ -6828,7 +7197,8 @@ var marginfi_0_1_8_default = {
|
|
|
6828
7197
|
{
|
|
6829
7198
|
name: "marginfi_account_update_emissions_destination_account",
|
|
6830
7199
|
docs: [
|
|
6831
|
-
"(account authority) Set the wallet whose canonical ATA will receive
|
|
7200
|
+
"(account authority) Set the wallet whose canonical ATA will receive permissionless emissions",
|
|
7201
|
+
"withdrawals."
|
|
6832
7202
|
],
|
|
6833
7203
|
discriminator: [73, 185, 162, 201, 111, 24, 116, 185],
|
|
6834
7204
|
accounts: [
|
|
@@ -6838,11 +7208,12 @@ var marginfi_0_1_8_default = {
|
|
|
6838
7208
|
},
|
|
6839
7209
|
{
|
|
6840
7210
|
name: "authority",
|
|
6841
|
-
signer: true
|
|
7211
|
+
signer: true,
|
|
7212
|
+
relations: ["marginfi_account"]
|
|
6842
7213
|
},
|
|
6843
7214
|
{
|
|
6844
7215
|
name: "destination_account",
|
|
6845
|
-
docs: ["the canonical ATA
|
|
7216
|
+
docs: ["User's earned emissions will be sent to the canonical ATA of this wallet.", ""]
|
|
6846
7217
|
}
|
|
6847
7218
|
],
|
|
6848
7219
|
args: []
|
|
@@ -6891,12 +7262,6 @@ var marginfi_0_1_8_default = {
|
|
|
6891
7262
|
option: "pubkey"
|
|
6892
7263
|
}
|
|
6893
7264
|
},
|
|
6894
|
-
{
|
|
6895
|
-
name: "new_flow_admin",
|
|
6896
|
-
type: {
|
|
6897
|
-
option: "pubkey"
|
|
6898
|
-
}
|
|
6899
|
-
},
|
|
6900
7265
|
{
|
|
6901
7266
|
name: "new_emissions_admin",
|
|
6902
7267
|
type: {
|
|
@@ -7145,6 +7510,7 @@ var marginfi_0_1_8_default = {
|
|
|
7145
7510
|
accounts: [
|
|
7146
7511
|
{
|
|
7147
7512
|
name: "group",
|
|
7513
|
+
writable: true,
|
|
7148
7514
|
relations: ["marginfi_account", "bank"]
|
|
7149
7515
|
},
|
|
7150
7516
|
{
|
|
@@ -7466,6 +7832,7 @@ var marginfi_0_1_8_default = {
|
|
|
7466
7832
|
accounts: [
|
|
7467
7833
|
{
|
|
7468
7834
|
name: "group",
|
|
7835
|
+
writable: true,
|
|
7469
7836
|
relations: ["marginfi_account", "bank"]
|
|
7470
7837
|
},
|
|
7471
7838
|
{
|
|
@@ -7805,91 +8172,6 @@ var marginfi_0_1_8_default = {
|
|
|
7805
8172
|
}
|
|
7806
8173
|
]
|
|
7807
8174
|
},
|
|
7808
|
-
{
|
|
7809
|
-
name: "update_deleverage_withdrawals",
|
|
7810
|
-
docs: [
|
|
7811
|
-
"(delegate_flow_admin only) Update the deleverage daily withdraw outflow with",
|
|
7812
|
-
"aggregated data. The delegate flow admin aggregates",
|
|
7813
|
-
"`DeleverageWithdrawFlowEvent` events off-chain and calls this instruction at intervals."
|
|
7814
|
-
],
|
|
7815
|
-
discriminator: [56, 3, 181, 118, 27, 247, 207, 227],
|
|
7816
|
-
accounts: [
|
|
7817
|
-
{
|
|
7818
|
-
name: "marginfi_group",
|
|
7819
|
-
writable: true
|
|
7820
|
-
},
|
|
7821
|
-
{
|
|
7822
|
-
name: "delegate_flow_admin",
|
|
7823
|
-
signer: true,
|
|
7824
|
-
relations: ["marginfi_group"]
|
|
7825
|
-
}
|
|
7826
|
-
],
|
|
7827
|
-
args: [
|
|
7828
|
-
{
|
|
7829
|
-
name: "outflow_usd",
|
|
7830
|
-
type: "u32"
|
|
7831
|
-
},
|
|
7832
|
-
{
|
|
7833
|
-
name: "update_seq",
|
|
7834
|
-
type: "u64"
|
|
7835
|
-
},
|
|
7836
|
-
{
|
|
7837
|
-
name: "event_start_slot",
|
|
7838
|
-
type: "u64"
|
|
7839
|
-
},
|
|
7840
|
-
{
|
|
7841
|
-
name: "event_end_slot",
|
|
7842
|
-
type: "u64"
|
|
7843
|
-
}
|
|
7844
|
-
]
|
|
7845
|
-
},
|
|
7846
|
-
{
|
|
7847
|
-
name: "update_group_rate_limiter",
|
|
7848
|
-
docs: [
|
|
7849
|
-
"(delegate_flow_admin only) Update the group rate limiter with aggregated",
|
|
7850
|
-
"inflow/outflow. The delegate flow admin aggregates",
|
|
7851
|
-
"`RateLimitFlowEvent` events off-chain, converts to USD, and calls this instruction at",
|
|
7852
|
-
"intervals to update group rate limiter state."
|
|
7853
|
-
],
|
|
7854
|
-
discriminator: [23, 78, 60, 139, 187, 44, 129, 37],
|
|
7855
|
-
accounts: [
|
|
7856
|
-
{
|
|
7857
|
-
name: "marginfi_group",
|
|
7858
|
-
writable: true
|
|
7859
|
-
},
|
|
7860
|
-
{
|
|
7861
|
-
name: "delegate_flow_admin",
|
|
7862
|
-
signer: true,
|
|
7863
|
-
relations: ["marginfi_group"]
|
|
7864
|
-
}
|
|
7865
|
-
],
|
|
7866
|
-
args: [
|
|
7867
|
-
{
|
|
7868
|
-
name: "outflow_usd",
|
|
7869
|
-
type: {
|
|
7870
|
-
option: "u64"
|
|
7871
|
-
}
|
|
7872
|
-
},
|
|
7873
|
-
{
|
|
7874
|
-
name: "inflow_usd",
|
|
7875
|
-
type: {
|
|
7876
|
-
option: "u64"
|
|
7877
|
-
}
|
|
7878
|
-
},
|
|
7879
|
-
{
|
|
7880
|
-
name: "update_seq",
|
|
7881
|
-
type: "u64"
|
|
7882
|
-
},
|
|
7883
|
-
{
|
|
7884
|
-
name: "event_start_slot",
|
|
7885
|
-
type: "u64"
|
|
7886
|
-
},
|
|
7887
|
-
{
|
|
7888
|
-
name: "event_end_slot",
|
|
7889
|
-
type: "u64"
|
|
7890
|
-
}
|
|
7891
|
-
]
|
|
7892
|
-
},
|
|
7893
8175
|
{
|
|
7894
8176
|
name: "write_bank_metadata",
|
|
7895
8177
|
docs: [
|
|
@@ -8000,10 +8282,6 @@ var marginfi_0_1_8_default = {
|
|
|
8000
8282
|
name: "DeleverageEvent",
|
|
8001
8283
|
discriminator: [161, 8, 108, 204, 209, 198, 12, 30]
|
|
8002
8284
|
},
|
|
8003
|
-
{
|
|
8004
|
-
name: "DeleverageWithdrawFlowEvent",
|
|
8005
|
-
discriminator: [109, 90, 139, 200, 10, 204, 84, 176]
|
|
8006
|
-
},
|
|
8007
8285
|
{
|
|
8008
8286
|
name: "EditStakedSettingsEvent",
|
|
8009
8287
|
discriminator: [29, 58, 155, 191, 75, 220, 145, 206]
|
|
@@ -8100,10 +8378,6 @@ var marginfi_0_1_8_default = {
|
|
|
8100
8378
|
name: "MarginfiGroupCreateEvent",
|
|
8101
8379
|
discriminator: [233, 125, 61, 14, 98, 240, 136, 253]
|
|
8102
8380
|
},
|
|
8103
|
-
{
|
|
8104
|
-
name: "RateLimitFlowEvent",
|
|
8105
|
-
discriminator: [229, 5, 73, 200, 0, 107, 105, 109]
|
|
8106
|
-
},
|
|
8107
8381
|
{
|
|
8108
8382
|
name: "SetKeeperCloseFlagsEvent",
|
|
8109
8383
|
discriminator: [193, 230, 93, 128, 117, 87, 96, 21]
|
|
@@ -8710,66 +8984,6 @@ var marginfi_0_1_8_default = {
|
|
|
8710
8984
|
name: "InvalidRateLimitPrice",
|
|
8711
8985
|
msg: "Invalid rate limit price: pass oracle or pre-crank cache"
|
|
8712
8986
|
},
|
|
8713
|
-
{
|
|
8714
|
-
code: 6120,
|
|
8715
|
-
name: "GroupRateLimiterUpdateEmpty",
|
|
8716
|
-
msg: "Group rate limiter admin update must include inflow and/or outflow"
|
|
8717
|
-
},
|
|
8718
|
-
{
|
|
8719
|
-
code: 6121,
|
|
8720
|
-
name: "GroupRateLimiterUpdateInvalidSlotRange",
|
|
8721
|
-
msg: "Group rate limiter admin update slot range is invalid"
|
|
8722
|
-
},
|
|
8723
|
-
{
|
|
8724
|
-
code: 6122,
|
|
8725
|
-
name: "GroupRateLimiterUpdateFutureSlot",
|
|
8726
|
-
msg: "Group rate limiter admin update cannot reference future slots"
|
|
8727
|
-
},
|
|
8728
|
-
{
|
|
8729
|
-
code: 6123,
|
|
8730
|
-
name: "GroupRateLimiterUpdateStale",
|
|
8731
|
-
msg: "Group rate limiter admin update is too stale"
|
|
8732
|
-
},
|
|
8733
|
-
{
|
|
8734
|
-
code: 6124,
|
|
8735
|
-
name: "GroupRateLimiterUpdateOutOfOrderSlot",
|
|
8736
|
-
msg: "Group rate limiter admin update slot progression is out of order"
|
|
8737
|
-
},
|
|
8738
|
-
{
|
|
8739
|
-
code: 6125,
|
|
8740
|
-
name: "GroupRateLimiterUpdateOutOfOrderSeq",
|
|
8741
|
-
msg: "Group rate limiter admin update sequence is out of order"
|
|
8742
|
-
},
|
|
8743
|
-
{
|
|
8744
|
-
code: 6126,
|
|
8745
|
-
name: "DeleverageWithdrawalUpdateEmpty",
|
|
8746
|
-
msg: "Deleverage withdrawal admin update must include outflow"
|
|
8747
|
-
},
|
|
8748
|
-
{
|
|
8749
|
-
code: 6127,
|
|
8750
|
-
name: "DeleverageWithdrawalUpdateInvalidSlotRange",
|
|
8751
|
-
msg: "Deleverage withdrawal admin update slot range is invalid"
|
|
8752
|
-
},
|
|
8753
|
-
{
|
|
8754
|
-
code: 6128,
|
|
8755
|
-
name: "DeleverageWithdrawalUpdateFutureSlot",
|
|
8756
|
-
msg: "Deleverage withdrawal admin update cannot reference future slots"
|
|
8757
|
-
},
|
|
8758
|
-
{
|
|
8759
|
-
code: 6129,
|
|
8760
|
-
name: "DeleverageWithdrawalUpdateStale",
|
|
8761
|
-
msg: "Deleverage withdrawal admin update is too stale"
|
|
8762
|
-
},
|
|
8763
|
-
{
|
|
8764
|
-
code: 6130,
|
|
8765
|
-
name: "DeleverageWithdrawalUpdateOutOfOrderSlot",
|
|
8766
|
-
msg: "Deleverage withdrawal admin update slot progression is out of order"
|
|
8767
|
-
},
|
|
8768
|
-
{
|
|
8769
|
-
code: 6131,
|
|
8770
|
-
name: "DeleverageWithdrawalUpdateOutOfOrderSeq",
|
|
8771
|
-
msg: "Deleverage withdrawal admin update sequence is out of order"
|
|
8772
|
-
},
|
|
8773
8987
|
{
|
|
8774
8988
|
code: 6200,
|
|
8775
8989
|
name: "WrongAssetTagForStandardInstructions",
|
|
@@ -9575,7 +9789,7 @@ var marginfi_0_1_8_default = {
|
|
|
9575
9789
|
{
|
|
9576
9790
|
name: "_pad_0",
|
|
9577
9791
|
type: {
|
|
9578
|
-
array: ["u8",
|
|
9792
|
+
array: ["u8", 8]
|
|
9579
9793
|
}
|
|
9580
9794
|
},
|
|
9581
9795
|
{
|
|
@@ -9693,10 +9907,8 @@ var marginfi_0_1_8_default = {
|
|
|
9693
9907
|
"Liquidate as an additional safeguard, if the liquidation prices stored here were to be",
|
|
9694
9908
|
"edited between start and end, it would completely break the risk engine. End validates that",
|
|
9695
9909
|
"the lock is set, panics if not, and removes it - which prevents footguns if the cache was",
|
|
9696
|
-
"e.g. accidently set to default. The lock is also removed when a Balance is closed
|
|
9697
|
-
"
|
|
9698
|
-
"ACCOUNT_IN_RECEIVERSHIP set, so that operations on unrelated accounts sharing the same",
|
|
9699
|
-
"bank do not interfere with an in-progress liquidation."
|
|
9910
|
+
"e.g. accidently set to default. The lock is also removed when a Balance is closed with",
|
|
9911
|
+
"repay_all or withdraw_all, since those Balances can be omitted from the risk check at End."
|
|
9700
9912
|
],
|
|
9701
9913
|
type: "u8"
|
|
9702
9914
|
},
|
|
@@ -10339,6 +10551,16 @@ var marginfi_0_1_8_default = {
|
|
|
10339
10551
|
name: "RateLimitWindow"
|
|
10340
10552
|
}
|
|
10341
10553
|
}
|
|
10554
|
+
},
|
|
10555
|
+
{
|
|
10556
|
+
name: "untracked_inflow",
|
|
10557
|
+
docs: [
|
|
10558
|
+
"Native token inflows pending USD conversion for group rate limiter.",
|
|
10559
|
+
"When deposits/repays occur without a valid oracle price, the amount is",
|
|
10560
|
+
"recorded here and later applied to the group rate limiter when a valid",
|
|
10561
|
+
"price becomes available (e.g., during pulse_bank_price_cache or outflow operations)."
|
|
10562
|
+
],
|
|
10563
|
+
type: "i64"
|
|
10342
10564
|
}
|
|
10343
10565
|
]
|
|
10344
10566
|
}
|
|
@@ -10367,41 +10589,6 @@ var marginfi_0_1_8_default = {
|
|
|
10367
10589
|
]
|
|
10368
10590
|
}
|
|
10369
10591
|
},
|
|
10370
|
-
{
|
|
10371
|
-
name: "DeleverageWithdrawFlowEvent",
|
|
10372
|
-
docs: [
|
|
10373
|
-
"Emitted for deleverage-only withdraw outflows.",
|
|
10374
|
-
"The delegate flow admin aggregates these off-chain and",
|
|
10375
|
-
"updates the deleverage daily withdraws via `update_deleverage_withdrawals`."
|
|
10376
|
-
],
|
|
10377
|
-
type: {
|
|
10378
|
-
kind: "struct",
|
|
10379
|
-
fields: [
|
|
10380
|
-
{
|
|
10381
|
-
name: "group",
|
|
10382
|
-
type: "pubkey"
|
|
10383
|
-
},
|
|
10384
|
-
{
|
|
10385
|
-
name: "bank",
|
|
10386
|
-
type: "pubkey"
|
|
10387
|
-
},
|
|
10388
|
-
{
|
|
10389
|
-
name: "mint",
|
|
10390
|
-
type: "pubkey"
|
|
10391
|
-
},
|
|
10392
|
-
{
|
|
10393
|
-
name: "outflow_usd",
|
|
10394
|
-
docs: ["Equity-denominated outflow value in USD, rounded to integer."],
|
|
10395
|
-
type: "u32"
|
|
10396
|
-
},
|
|
10397
|
-
{
|
|
10398
|
-
name: "current_timestamp",
|
|
10399
|
-
docs: ["Unix timestamp when the flow was recorded"],
|
|
10400
|
-
type: "i64"
|
|
10401
|
-
}
|
|
10402
|
-
]
|
|
10403
|
-
}
|
|
10404
|
-
},
|
|
10405
10592
|
{
|
|
10406
10593
|
name: "DriftConfigCompact",
|
|
10407
10594
|
docs: [
|
|
@@ -11710,7 +11897,7 @@ var marginfi_0_1_8_default = {
|
|
|
11710
11897
|
"(i.e. no implicit padding). This is important because `Pubkey` has alignment=1 while `u64`",
|
|
11711
11898
|
"has alignment=8; using plain `repr(C)` would insert padding before the first `u64`."
|
|
11712
11899
|
],
|
|
11713
|
-
serialization: "
|
|
11900
|
+
serialization: "bytemuckunsafe",
|
|
11714
11901
|
repr: {
|
|
11715
11902
|
kind: "c",
|
|
11716
11903
|
packed: true
|
|
@@ -12557,7 +12744,12 @@ var marginfi_0_1_8_default = {
|
|
|
12557
12744
|
},
|
|
12558
12745
|
{
|
|
12559
12746
|
name: "emissions_destination_account",
|
|
12560
|
-
docs: [
|
|
12747
|
+
docs: [
|
|
12748
|
+
"Set with `update_emissions_destination_account`. Emissions rewards can be withdrawn to the",
|
|
12749
|
+
"canonical ATA of this wallet without the user's input (withdraw_emissions_permissionless).",
|
|
12750
|
+
"If pubkey default, the user has not opted into this feature, and must claim emissions",
|
|
12751
|
+
"manually (withdraw_emissions)."
|
|
12752
|
+
],
|
|
12561
12753
|
type: "pubkey"
|
|
12562
12754
|
},
|
|
12563
12755
|
{
|
|
@@ -12830,7 +13022,7 @@ var marginfi_0_1_8_default = {
|
|
|
12830
13022
|
name: "emode_admin",
|
|
12831
13023
|
docs: [
|
|
12832
13024
|
"This admin can configure collateral ratios above (but not below) the collateral ratio of",
|
|
12833
|
-
"certain banks, e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
|
|
13025
|
+
"certain banks , e.g. allow SOL to count as 90% collateral when borrowing an LST instead of",
|
|
12834
13026
|
"the default rate."
|
|
12835
13027
|
],
|
|
12836
13028
|
type: "pubkey"
|
|
@@ -12931,40 +13123,6 @@ var marginfi_0_1_8_default = {
|
|
|
12931
13123
|
}
|
|
12932
13124
|
}
|
|
12933
13125
|
},
|
|
12934
|
-
{
|
|
12935
|
-
name: "rate_limiter_last_admin_update_slot",
|
|
12936
|
-
docs: ["Last slot covered by an admin group rate limiter aggregation update."],
|
|
12937
|
-
type: "u64"
|
|
12938
|
-
},
|
|
12939
|
-
{
|
|
12940
|
-
name: "rate_limiter_last_admin_update_seq",
|
|
12941
|
-
docs: [
|
|
12942
|
-
"Monotonic sequence number for admin group rate limiter updates.",
|
|
12943
|
-
"This is used to enforce strict ordering and prevent duplicate/replayed batches",
|
|
12944
|
-
"when slot ranges overlap or multiple updates happen in the same slot."
|
|
12945
|
-
],
|
|
12946
|
-
type: "u64"
|
|
12947
|
-
},
|
|
12948
|
-
{
|
|
12949
|
-
name: "deleverage_withdraw_last_admin_update_slot",
|
|
12950
|
-
docs: ["Last slot covered by an admin deleverage withdraw-limit aggregation update."],
|
|
12951
|
-
type: "u64"
|
|
12952
|
-
},
|
|
12953
|
-
{
|
|
12954
|
-
name: "deleverage_withdraw_last_admin_update_seq",
|
|
12955
|
-
docs: ["Monotonic sequence number for admin deleverage withdraw-limit updates."],
|
|
12956
|
-
type: "u64"
|
|
12957
|
-
},
|
|
12958
|
-
{
|
|
12959
|
-
name: "delegate_flow_admin",
|
|
12960
|
-
docs: [
|
|
12961
|
-
"Can modify flow-control status for the group, i.e. update the withdraw caches with flow",
|
|
12962
|
-
"information from banks. Typically this is a hot wallet that lives in e.g. some cron job. If",
|
|
12963
|
-
"compromised, flow control can be effectively disabled until the admin is restored, which",
|
|
12964
|
-
"does not itself compromise any funds, and is merely annoying."
|
|
12965
|
-
],
|
|
12966
|
-
type: "pubkey"
|
|
12967
|
-
},
|
|
12968
13126
|
{
|
|
12969
13127
|
name: "_padding_0",
|
|
12970
13128
|
type: {
|
|
@@ -12972,7 +13130,7 @@ var marginfi_0_1_8_default = {
|
|
|
12972
13130
|
{
|
|
12973
13131
|
array: ["u64", 2]
|
|
12974
13132
|
},
|
|
12975
|
-
|
|
13133
|
+
6
|
|
12976
13134
|
]
|
|
12977
13135
|
}
|
|
12978
13136
|
},
|
|
@@ -14083,50 +14241,6 @@ var marginfi_0_1_8_default = {
|
|
|
14083
14241
|
]
|
|
14084
14242
|
}
|
|
14085
14243
|
},
|
|
14086
|
-
{
|
|
14087
|
-
name: "RateLimitFlowEvent",
|
|
14088
|
-
docs: [
|
|
14089
|
-
"Emitted when a bank-level inflow or outflow is recorded.",
|
|
14090
|
-
"The delegate flow admin aggregates these off-chain and",
|
|
14091
|
-
"updates the group rate limiter via `update_group_rate_limiter`."
|
|
14092
|
-
],
|
|
14093
|
-
type: {
|
|
14094
|
-
kind: "struct",
|
|
14095
|
-
fields: [
|
|
14096
|
-
{
|
|
14097
|
-
name: "group",
|
|
14098
|
-
type: "pubkey"
|
|
14099
|
-
},
|
|
14100
|
-
{
|
|
14101
|
-
name: "bank",
|
|
14102
|
-
type: "pubkey"
|
|
14103
|
-
},
|
|
14104
|
-
{
|
|
14105
|
-
name: "mint",
|
|
14106
|
-
type: "pubkey"
|
|
14107
|
-
},
|
|
14108
|
-
{
|
|
14109
|
-
name: "flow_direction",
|
|
14110
|
-
docs: ["0 = outflow (withdraw/borrow), 1 = inflow (deposit/repay)"],
|
|
14111
|
-
type: "u8"
|
|
14112
|
-
},
|
|
14113
|
-
{
|
|
14114
|
-
name: "native_amount",
|
|
14115
|
-
docs: ["Amount in native tokens"],
|
|
14116
|
-
type: "u64"
|
|
14117
|
-
},
|
|
14118
|
-
{
|
|
14119
|
-
name: "mint_decimals",
|
|
14120
|
-
type: "u8"
|
|
14121
|
-
},
|
|
14122
|
-
{
|
|
14123
|
-
name: "current_timestamp",
|
|
14124
|
-
docs: ["Unix timestamp when the flow was recorded"],
|
|
14125
|
-
type: "i64"
|
|
14126
|
-
}
|
|
14127
|
-
]
|
|
14128
|
-
}
|
|
14129
|
-
},
|
|
14130
14244
|
{
|
|
14131
14245
|
name: "RateLimitWindow",
|
|
14132
14246
|
docs: [
|
|
@@ -14849,7 +14963,7 @@ var marginfi_0_1_8_default = {
|
|
|
14849
14963
|
};
|
|
14850
14964
|
|
|
14851
14965
|
// src/idl/index.ts
|
|
14852
|
-
var MARGINFI_IDL =
|
|
14966
|
+
var MARGINFI_IDL = marginfi_0_1_7_default;
|
|
14853
14967
|
function decodeInstruction(idl, encoded) {
|
|
14854
14968
|
const coder = new BorshInstructionCoder(idl);
|
|
14855
14969
|
return coder.decode(encoded, "base58");
|
|
@@ -15022,9 +15136,48 @@ var MintLayout = struct([
|
|
|
15022
15136
|
publicKey("freezeAuthority")
|
|
15023
15137
|
]);
|
|
15024
15138
|
MintLayout.span;
|
|
15139
|
+
var approveInstructionData = struct([
|
|
15140
|
+
u8("instruction"),
|
|
15141
|
+
u64("amount")
|
|
15142
|
+
]);
|
|
15143
|
+
function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
|
|
15144
|
+
const keys = addSigners(
|
|
15145
|
+
[
|
|
15146
|
+
{ pubkey: account, isSigner: false, isWritable: true },
|
|
15147
|
+
{ pubkey: delegate, isSigner: false, isWritable: false }
|
|
15148
|
+
],
|
|
15149
|
+
owner,
|
|
15150
|
+
multiSigners
|
|
15151
|
+
);
|
|
15152
|
+
const data = Buffer$1.alloc(approveInstructionData.span);
|
|
15153
|
+
approveInstructionData.encode(
|
|
15154
|
+
{
|
|
15155
|
+
instruction: 4 /* Approve */,
|
|
15156
|
+
amount: BigInt(amount)
|
|
15157
|
+
},
|
|
15158
|
+
data
|
|
15159
|
+
);
|
|
15160
|
+
return new TransactionInstruction({ keys, programId, data });
|
|
15161
|
+
}
|
|
15025
15162
|
struct([
|
|
15026
15163
|
u8("instruction")
|
|
15027
15164
|
]);
|
|
15165
|
+
function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15166
|
+
const keys = [
|
|
15167
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
15168
|
+
{ pubkey: associatedToken, isSigner: false, isWritable: true },
|
|
15169
|
+
{ pubkey: owner, isSigner: false, isWritable: false },
|
|
15170
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
15171
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
15172
|
+
{ pubkey: programId, isSigner: false, isWritable: false },
|
|
15173
|
+
{ pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }
|
|
15174
|
+
];
|
|
15175
|
+
return new TransactionInstruction({
|
|
15176
|
+
keys,
|
|
15177
|
+
programId: associatedTokenProgramId,
|
|
15178
|
+
data: Buffer$1.alloc(0)
|
|
15179
|
+
});
|
|
15180
|
+
}
|
|
15028
15181
|
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15029
15182
|
return buildAssociatedTokenAccountInstruction(
|
|
15030
15183
|
payer,
|
|
@@ -15377,6 +15530,7 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
|
|
|
15377
15530
|
bank,
|
|
15378
15531
|
destinationTokenAccount,
|
|
15379
15532
|
lendingMarket,
|
|
15533
|
+
reserveLiquidityMint,
|
|
15380
15534
|
lendingMarketAuthority,
|
|
15381
15535
|
reserveLiquiditySupply,
|
|
15382
15536
|
reserveCollateralMint,
|
|
@@ -15391,6 +15545,7 @@ async function makeKaminoWithdrawIx(mfProgram, accounts, args, remainingAccounts
|
|
|
15391
15545
|
bank,
|
|
15392
15546
|
destinationTokenAccount,
|
|
15393
15547
|
lendingMarket,
|
|
15548
|
+
reserveLiquidityMint,
|
|
15394
15549
|
lendingMarketAuthority,
|
|
15395
15550
|
reserveLiquiditySupply,
|
|
15396
15551
|
reserveCollateralMint,
|
|
@@ -15435,11 +15590,14 @@ function makeLendingAccountLiquidateIx(mfiProgram, accounts, args, remainingAcco
|
|
|
15435
15590
|
tokenProgram
|
|
15436
15591
|
}).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
|
|
15437
15592
|
}
|
|
15438
|
-
function
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15593
|
+
function makelendingAccountWithdrawEmissionIx(mfiProgram, accounts) {
|
|
15594
|
+
const { marginfiAccount, destinationAccount, bank, tokenProgram, ...optionalAccounts } = accounts;
|
|
15595
|
+
return mfiProgram.methods.lendingAccountWithdrawEmissions().accounts({
|
|
15596
|
+
marginfiAccount,
|
|
15597
|
+
destinationAccount,
|
|
15598
|
+
bank,
|
|
15599
|
+
tokenProgram
|
|
15600
|
+
}).accountsPartial(optionalAccounts).instruction();
|
|
15443
15601
|
}
|
|
15444
15602
|
function makePoolConfigureBankIx(mfiProgram, accounts, args) {
|
|
15445
15603
|
const { bank, ...optionalAccounts } = accounts;
|
|
@@ -15539,7 +15697,7 @@ var instructions = {
|
|
|
15539
15697
|
makeInitMarginfiAccountIx,
|
|
15540
15698
|
makeInitMarginfiAccountPdaIx,
|
|
15541
15699
|
makeLendingAccountLiquidateIx,
|
|
15542
|
-
|
|
15700
|
+
makelendingAccountWithdrawEmissionIx,
|
|
15543
15701
|
makePoolAddBankIx,
|
|
15544
15702
|
makePoolConfigureBankIx,
|
|
15545
15703
|
makeBeginFlashLoanIx,
|
|
@@ -16044,7 +16202,7 @@ function parseEmodeSettingsRaw(emodeSettingsRaw) {
|
|
|
16044
16202
|
};
|
|
16045
16203
|
return emodeSettings;
|
|
16046
16204
|
}
|
|
16047
|
-
function parseBankRaw(address, accountParsed, bankMetadata
|
|
16205
|
+
function parseBankRaw(address, accountParsed, bankMetadata) {
|
|
16048
16206
|
const flags = accountParsed.flags.toNumber();
|
|
16049
16207
|
const mint = accountParsed.mint;
|
|
16050
16208
|
const mintDecimals = accountParsed.mintDecimals;
|
|
@@ -16143,8 +16301,6 @@ function parseBankRaw(address, accountParsed, bankMetadata, mintData) {
|
|
|
16143
16301
|
borrowingPositionCount,
|
|
16144
16302
|
emode,
|
|
16145
16303
|
tokenSymbol,
|
|
16146
|
-
mintRate: mintData?.mintRate ?? null,
|
|
16147
|
-
mintPrice: mintData?.mintPrice ?? 0,
|
|
16148
16304
|
kaminoIntegrationAccounts,
|
|
16149
16305
|
driftIntegrationAccounts,
|
|
16150
16306
|
solendIntegrationAccounts,
|
|
@@ -16185,9 +16341,6 @@ function dtoToBank(bankDto) {
|
|
|
16185
16341
|
feesDestinationAccount: bankDto.feesDestinationAccount ? new PublicKey(bankDto.feesDestinationAccount) : void 0,
|
|
16186
16342
|
lendingPositionCount: bankDto.lendingPositionCount ? new BigNumber3(bankDto.lendingPositionCount) : void 0,
|
|
16187
16343
|
borrowingPositionCount: bankDto.borrowingPositionCount ? new BigNumber3(bankDto.borrowingPositionCount) : void 0,
|
|
16188
|
-
mintRate: null,
|
|
16189
|
-
// TODO: move these out
|
|
16190
|
-
mintPrice: 0,
|
|
16191
16344
|
kaminoIntegrationAccounts: bankDto.kaminoIntegrationAccounts ? {
|
|
16192
16345
|
kaminoReserve: new PublicKey(bankDto.kaminoIntegrationAccounts.kaminoReserve),
|
|
16193
16346
|
kaminoObligation: new PublicKey(bankDto.kaminoIntegrationAccounts.kaminoObligation)
|
|
@@ -43234,6 +43387,169 @@ new Fraction(new BN11(0));
|
|
|
43234
43387
|
function roundNearest(decimal) {
|
|
43235
43388
|
return decimal.toDecimalPlaces(0, Decimal3.ROUND_HALF_CEIL);
|
|
43236
43389
|
}
|
|
43390
|
+
var SinglePoolInstruction = {
|
|
43391
|
+
initializePool: (voteAccount) => {
|
|
43392
|
+
const pool = findPoolAddress(voteAccount);
|
|
43393
|
+
const stake = findPoolStakeAddress(pool);
|
|
43394
|
+
const mint = findPoolMintAddress(pool);
|
|
43395
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43396
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43397
|
+
return createTransactionInstruction(
|
|
43398
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43399
|
+
[
|
|
43400
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43401
|
+
{ pubkey: pool, isSigner: false, isWritable: true },
|
|
43402
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43403
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43404
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43405
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43406
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43407
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43408
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43409
|
+
{ pubkey: STAKE_CONFIG_ID$1, isSigner: false, isWritable: false },
|
|
43410
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43411
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43412
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43413
|
+
],
|
|
43414
|
+
Buffer.from([0 /* InitializePool */])
|
|
43415
|
+
);
|
|
43416
|
+
},
|
|
43417
|
+
initializeOnRamp: (pool) => {
|
|
43418
|
+
const onRamp = findPoolOnRampAddress(pool);
|
|
43419
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43420
|
+
return createTransactionInstruction(
|
|
43421
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43422
|
+
[
|
|
43423
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43424
|
+
{ pubkey: onRamp, isSigner: false, isWritable: true },
|
|
43425
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43426
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43427
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43428
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43429
|
+
],
|
|
43430
|
+
Buffer.from([6 /* InitializeOnRamp */])
|
|
43431
|
+
);
|
|
43432
|
+
},
|
|
43433
|
+
depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
|
|
43434
|
+
const stake = findPoolStakeAddress(pool);
|
|
43435
|
+
const mint = findPoolMintAddress(pool);
|
|
43436
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43437
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43438
|
+
return createTransactionInstruction(
|
|
43439
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43440
|
+
[
|
|
43441
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43442
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43443
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43444
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43445
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43446
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43447
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43448
|
+
{ pubkey: userLamportAccount, isSigner: false, isWritable: true },
|
|
43449
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43450
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43451
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43452
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43453
|
+
],
|
|
43454
|
+
Buffer.from([2 /* DepositStake */])
|
|
43455
|
+
);
|
|
43456
|
+
},
|
|
43457
|
+
withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
|
|
43458
|
+
const stake = findPoolStakeAddress(pool);
|
|
43459
|
+
const mint = findPoolMintAddress(pool);
|
|
43460
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43461
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43462
|
+
const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
|
|
43463
|
+
const data = Buffer.concat([
|
|
43464
|
+
Buffer.from([3 /* WithdrawStake */]),
|
|
43465
|
+
userStakeAuthority.toBuffer(),
|
|
43466
|
+
Buffer.from(new BN(rawAmount.toString()).toArray("le", 8))
|
|
43467
|
+
]);
|
|
43468
|
+
return createTransactionInstruction(
|
|
43469
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43470
|
+
[
|
|
43471
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43472
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43473
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43474
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43475
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43476
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43477
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43478
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43479
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43480
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43481
|
+
],
|
|
43482
|
+
data
|
|
43483
|
+
);
|
|
43484
|
+
},
|
|
43485
|
+
createTokenMetadata: async (pool, payer) => {
|
|
43486
|
+
const mint = findPoolMintAddress(pool);
|
|
43487
|
+
const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
|
|
43488
|
+
findPoolMintAuthorityAddress(pool),
|
|
43489
|
+
findPoolMplAuthorityAddress(pool),
|
|
43490
|
+
findMplMetadataAddress(mint)
|
|
43491
|
+
]);
|
|
43492
|
+
return createTransactionInstruction(
|
|
43493
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43494
|
+
[
|
|
43495
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43496
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
43497
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43498
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43499
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
43500
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43501
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43502
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43503
|
+
],
|
|
43504
|
+
Buffer.from([4 /* CreateTokenMetadata */])
|
|
43505
|
+
);
|
|
43506
|
+
},
|
|
43507
|
+
updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
|
|
43508
|
+
if (tokenName.length > 32) {
|
|
43509
|
+
throw new Error("maximum token name length is 32 characters");
|
|
43510
|
+
}
|
|
43511
|
+
if (tokenSymbol.length > 10) {
|
|
43512
|
+
throw new Error("maximum token symbol length is 10 characters");
|
|
43513
|
+
}
|
|
43514
|
+
if (tokenUri.length > 200) {
|
|
43515
|
+
throw new Error("maximum token uri length is 200 characters");
|
|
43516
|
+
}
|
|
43517
|
+
const pool = findPoolAddress(voteAccount);
|
|
43518
|
+
const [mint, mplAuthority] = await Promise.all([
|
|
43519
|
+
findPoolMintAddress(pool),
|
|
43520
|
+
findPoolMplAuthorityAddress(pool)
|
|
43521
|
+
]);
|
|
43522
|
+
const mplMetadata = await findMplMetadataAddress(mint);
|
|
43523
|
+
const data = Buffer.concat([
|
|
43524
|
+
Buffer.from([5 /* UpdateTokenMetadata */]),
|
|
43525
|
+
Buffer.from(new Uint32Array([tokenName.length]).buffer),
|
|
43526
|
+
Buffer.from(tokenName),
|
|
43527
|
+
Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
|
|
43528
|
+
Buffer.from(tokenSymbol),
|
|
43529
|
+
Buffer.from(new Uint32Array([tokenUri.length]).buffer),
|
|
43530
|
+
Buffer.from(tokenUri)
|
|
43531
|
+
]);
|
|
43532
|
+
return createTransactionInstruction(
|
|
43533
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43534
|
+
[
|
|
43535
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43536
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43537
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43538
|
+
{ pubkey: authorizedWithdrawer, isSigner: true, isWritable: false },
|
|
43539
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43540
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43541
|
+
],
|
|
43542
|
+
data
|
|
43543
|
+
);
|
|
43544
|
+
}
|
|
43545
|
+
};
|
|
43546
|
+
var createTransactionInstruction = (programId, keys, data) => {
|
|
43547
|
+
return {
|
|
43548
|
+
programId,
|
|
43549
|
+
keys,
|
|
43550
|
+
data
|
|
43551
|
+
};
|
|
43552
|
+
};
|
|
43237
43553
|
var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
43238
43554
|
const [pda] = PublicKey.findProgramAddressSync(
|
|
43239
43555
|
[Buffer.from(prefix), baseAddress.toBuffer()],
|
|
@@ -43244,7 +43560,17 @@ var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
|
43244
43560
|
var findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
|
|
43245
43561
|
var findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
|
|
43246
43562
|
var findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
|
|
43563
|
+
var findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
|
|
43564
|
+
var findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
|
|
43565
|
+
var findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
|
|
43247
43566
|
var findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
|
|
43567
|
+
var findMplMetadataAddress = async (poolMintAddress) => {
|
|
43568
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
43569
|
+
[Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
|
|
43570
|
+
MPL_METADATA_PROGRAM_ID
|
|
43571
|
+
);
|
|
43572
|
+
return pda;
|
|
43573
|
+
};
|
|
43248
43574
|
BigInt(33);
|
|
43249
43575
|
BigInt(200);
|
|
43250
43576
|
BigInt(82);
|
|
@@ -43799,7 +44125,7 @@ var SEED_RESERVE = "reserve";
|
|
|
43799
44125
|
var SEED_RATE_MODEL = "rate_model";
|
|
43800
44126
|
var SEED_USER_SUPPLY_POSITION = "user_supply_position";
|
|
43801
44127
|
var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
|
|
43802
|
-
function getAllDerivedJupLendAccounts(mint
|
|
44128
|
+
function getAllDerivedJupLendAccounts(mint) {
|
|
43803
44129
|
const [fTokenMint] = deriveJupLendFTokenMint(mint);
|
|
43804
44130
|
const [lending] = deriveJupLendLending(mint, fTokenMint);
|
|
43805
44131
|
const [liquidity] = deriveJupLendLiquidity();
|
|
@@ -43809,7 +44135,7 @@ function getAllDerivedJupLendAccounts(mint, tokenProgram) {
|
|
|
43809
44135
|
supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
|
|
43810
44136
|
lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
|
|
43811
44137
|
rateModel: deriveJupLendRateModel(mint)[0],
|
|
43812
|
-
vault: deriveJupLendLiquidityVaultAta(mint, liquidity
|
|
44138
|
+
vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
|
|
43813
44139
|
liquidity,
|
|
43814
44140
|
rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
|
|
43815
44141
|
};
|
|
@@ -44256,7 +44582,7 @@ var DISCRIMINATORS = {
|
|
|
44256
44582
|
LENDING_ACCOUNT_WITHDRAW: Buffer.from([36, 72, 74, 19, 210, 210, 192, 192]),
|
|
44257
44583
|
LENDING_ACCOUNT_BORROW: Buffer.from([4, 126, 116, 53, 48, 5, 212, 31]),
|
|
44258
44584
|
LENDING_ACCOUNT_LIQUIDATE: Buffer.from([214, 169, 151, 213, 251, 167, 86, 219]),
|
|
44259
|
-
|
|
44585
|
+
LENDING_ACCOUNT_WITHDRAW_EMISSIONS: Buffer.from([234, 22, 84, 214, 118, 176, 140, 170]),
|
|
44260
44586
|
LENDING_POOL_ADD_BANK: Buffer.from([215, 68, 72, 78, 208, 218, 103, 182]),
|
|
44261
44587
|
LENDING_POOL_CONFIGURE_BANK: Buffer.from([121, 173, 156, 40, 93, 148, 56, 237]),
|
|
44262
44588
|
LENDING_ACCOUNT_START_FLASHLOAN: Buffer.from([14, 131, 33, 220, 81, 186, 180, 107]),
|
|
@@ -44343,7 +44669,7 @@ function makeWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
|
|
|
44343
44669
|
const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
|
|
44344
44670
|
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
44345
44671
|
const keys = [
|
|
44346
|
-
{ pubkey: accounts.group, isSigner: false, isWritable:
|
|
44672
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: true },
|
|
44347
44673
|
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
44348
44674
|
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
44349
44675
|
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
@@ -44499,7 +44825,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
|
|
|
44499
44825
|
const liquidityVaultAuthority = deriveBankLiquidityVaultAuthority(programId, accounts.bank)[0];
|
|
44500
44826
|
const liquidityVault = deriveBankLiquidityVault(programId, accounts.bank)[0];
|
|
44501
44827
|
const keys = [
|
|
44502
|
-
{ pubkey: accounts.group, isSigner: false, isWritable:
|
|
44828
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: true },
|
|
44503
44829
|
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
44504
44830
|
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
44505
44831
|
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
@@ -44519,7 +44845,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
|
|
|
44519
44845
|
},
|
|
44520
44846
|
{ pubkey: accounts.integrationAcc1, isSigner: false, isWritable: true },
|
|
44521
44847
|
{
|
|
44522
|
-
pubkey: accounts.
|
|
44848
|
+
pubkey: accounts.reserveLiquidityMint,
|
|
44523
44849
|
isSigner: false,
|
|
44524
44850
|
isWritable: true
|
|
44525
44851
|
},
|
|
@@ -44606,15 +44932,22 @@ function makeLendingAccountLiquidateIx2(programId, accounts, args, remainingAcco
|
|
|
44606
44932
|
]);
|
|
44607
44933
|
return new TransactionInstruction({ keys, programId, data });
|
|
44608
44934
|
}
|
|
44609
|
-
function
|
|
44935
|
+
function makelendingAccountWithdrawEmissionIx2(programId, accounts) {
|
|
44610
44936
|
const keys = [
|
|
44937
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
44611
44938
|
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
44612
|
-
{ pubkey: accounts.
|
|
44939
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
44940
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
44941
|
+
{ pubkey: accounts.emissionsMint, isSigner: false, isWritable: false },
|
|
44942
|
+
{ pubkey: accounts.emissionsAuth, isSigner: false, isWritable: false },
|
|
44943
|
+
{ pubkey: accounts.emissionsVault, isSigner: false, isWritable: true },
|
|
44944
|
+
{ pubkey: accounts.destinationAccount, isSigner: false, isWritable: true },
|
|
44945
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
44613
44946
|
];
|
|
44614
44947
|
return new TransactionInstruction({
|
|
44615
44948
|
keys,
|
|
44616
44949
|
programId,
|
|
44617
|
-
data: DISCRIMINATORS.
|
|
44950
|
+
data: DISCRIMINATORS.LENDING_ACCOUNT_WITHDRAW_EMISSIONS
|
|
44618
44951
|
});
|
|
44619
44952
|
}
|
|
44620
44953
|
function makeCloseAccountIx2(programId, accounts) {
|
|
@@ -44777,7 +45110,7 @@ function makeDriftWithdrawIx2(programId, accounts, args, remainingAccounts = [])
|
|
|
44777
45110
|
const DRIFT_PROGRAM_ID2 = new PublicKey("dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH");
|
|
44778
45111
|
const SYSTEM_PROGRAM_ID2 = new PublicKey("11111111111111111111111111111111");
|
|
44779
45112
|
const keys = [
|
|
44780
|
-
{ pubkey: accounts.group, isSigner: false, isWritable:
|
|
45113
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: true },
|
|
44781
45114
|
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
44782
45115
|
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
44783
45116
|
{ pubkey: accounts.bank, isSigner: false, isWritable: true }
|
|
@@ -44912,7 +45245,7 @@ var syncInstructions = {
|
|
|
44912
45245
|
makeKaminoWithdrawIx: makeKaminoWithdrawIx2,
|
|
44913
45246
|
makeBorrowIx: makeBorrowIx2,
|
|
44914
45247
|
makeLendingAccountLiquidateIx: makeLendingAccountLiquidateIx2,
|
|
44915
|
-
|
|
45248
|
+
makelendingAccountWithdrawEmissionIx: makelendingAccountWithdrawEmissionIx2,
|
|
44916
45249
|
makePoolAddBankIx: makePoolAddBankIx2,
|
|
44917
45250
|
makePoolConfigureBankIx: makePoolConfigureBankIx2,
|
|
44918
45251
|
makeBeginFlashLoanIx: makeBeginFlashLoanIx2,
|
|
@@ -45204,7 +45537,7 @@ async function makeKaminoWithdrawIx3({
|
|
|
45204
45537
|
lendingMarket,
|
|
45205
45538
|
lendingMarketAuthority,
|
|
45206
45539
|
integrationAcc1: bank.kaminoIntegrationAccounts.kaminoReserve,
|
|
45207
|
-
|
|
45540
|
+
reserveLiquidityMint: bank.mint,
|
|
45208
45541
|
reserveLiquiditySupply,
|
|
45209
45542
|
reserveCollateralMint,
|
|
45210
45543
|
reserveSourceCollateral: reserveDestinationDepositCollateral,
|
|
@@ -45228,7 +45561,7 @@ async function makeKaminoWithdrawIx3({
|
|
|
45228
45561
|
bank: bank.address,
|
|
45229
45562
|
destinationTokenAccount: userTokenAtaPk,
|
|
45230
45563
|
lendingMarket,
|
|
45231
|
-
|
|
45564
|
+
reserveLiquidityMint: bank.mint,
|
|
45232
45565
|
lendingMarketAuthority,
|
|
45233
45566
|
reserveLiquiditySupply,
|
|
45234
45567
|
reserveCollateralMint,
|
|
@@ -45549,7 +45882,7 @@ async function makeJuplendWithdrawIx2({
|
|
|
45549
45882
|
lendingAdmin,
|
|
45550
45883
|
rateModel,
|
|
45551
45884
|
vault,
|
|
45552
|
-
liquidity} = getAllDerivedJupLendAccounts(bank.mint
|
|
45885
|
+
liquidity} = getAllDerivedJupLendAccounts(bank.mint);
|
|
45553
45886
|
if (opts.observationBanksOverride) {
|
|
45554
45887
|
remainingAccounts.push(...opts.observationBanksOverride);
|
|
45555
45888
|
} else {
|
|
@@ -46172,7 +46505,7 @@ async function makeJuplendDepositIx2({
|
|
|
46172
46505
|
if (!bank.jupLendIntegrationAccounts) {
|
|
46173
46506
|
throw new Error("Bank has no JupLend integration accounts");
|
|
46174
46507
|
}
|
|
46175
|
-
const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint
|
|
46508
|
+
const derivedAccounts = getAllDerivedJupLendAccounts(bank.mint);
|
|
46176
46509
|
const {
|
|
46177
46510
|
fTokenMint,
|
|
46178
46511
|
lendingAdmin,
|
|
@@ -47121,14 +47454,37 @@ async function buildRepayWithCollatFlashloanTx({
|
|
|
47121
47454
|
}
|
|
47122
47455
|
|
|
47123
47456
|
// src/services/account/actions/emissions.ts
|
|
47124
|
-
async function
|
|
47457
|
+
async function makeWithdrawEmissionsIx(program, marginfiAccount, banks, mintDatas, bankAddress) {
|
|
47125
47458
|
const bank = banks.get(bankAddress.toBase58());
|
|
47126
47459
|
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
47127
|
-
const
|
|
47460
|
+
const mintData = mintDatas.get(bankAddress.toBase58());
|
|
47461
|
+
if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);
|
|
47462
|
+
if (!mintData.emissionTokenProgram) {
|
|
47463
|
+
throw Error(`Emission token program not found for bank ${bankAddress.toBase58()}`);
|
|
47464
|
+
}
|
|
47465
|
+
let ixs = [];
|
|
47466
|
+
const userAta = getAssociatedTokenAddressSync(
|
|
47467
|
+
bank.emissionsMint,
|
|
47468
|
+
marginfiAccount.authority,
|
|
47469
|
+
true,
|
|
47470
|
+
mintData.emissionTokenProgram
|
|
47471
|
+
);
|
|
47472
|
+
const createAtaIdempotentIx = createAssociatedTokenAccountIdempotentInstruction(
|
|
47473
|
+
marginfiAccount.authority,
|
|
47474
|
+
userAta,
|
|
47475
|
+
marginfiAccount.authority,
|
|
47476
|
+
bank.emissionsMint,
|
|
47477
|
+
mintData.emissionTokenProgram
|
|
47478
|
+
);
|
|
47479
|
+
ixs.push(createAtaIdempotentIx);
|
|
47480
|
+
const withdrawEmissionsIx = await instructions_default.makelendingAccountWithdrawEmissionIx(program, {
|
|
47128
47481
|
marginfiAccount: marginfiAccount.address,
|
|
47129
|
-
|
|
47482
|
+
destinationAccount: userAta,
|
|
47483
|
+
bank: bank.address,
|
|
47484
|
+
tokenProgram: mintData.emissionTokenProgram
|
|
47130
47485
|
});
|
|
47131
|
-
|
|
47486
|
+
ixs.push(withdrawEmissionsIx);
|
|
47487
|
+
return { instructions: ixs, keys: [] };
|
|
47132
47488
|
}
|
|
47133
47489
|
async function makeSwapCollateralTx(params) {
|
|
47134
47490
|
const {
|
|
@@ -47850,6 +48206,179 @@ async function buildSwapDebtFlashloanTx({
|
|
|
47850
48206
|
}
|
|
47851
48207
|
throw new Error("Failed to build swap debt flashloan tx");
|
|
47852
48208
|
}
|
|
48209
|
+
var SYSVAR_CLOCK_ID2 = new PublicKey("SysvarC1ock11111111111111111111111111111111");
|
|
48210
|
+
async function makeMintStakedLstIx(params) {
|
|
48211
|
+
const { amount, authority, stakeAccountPk, validator, connection } = params;
|
|
48212
|
+
const pool = findPoolAddress(validator);
|
|
48213
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48214
|
+
const poolStakeAuth = findPoolStakeAuthorityAddress(pool);
|
|
48215
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48216
|
+
const [lstAccInfo, stakeAccInfoParsed, rentExemptReserve] = await Promise.all([
|
|
48217
|
+
connection.getAccountInfo(lstAta),
|
|
48218
|
+
connection.getParsedAccountInfo(stakeAccountPk),
|
|
48219
|
+
connection.getMinimumBalanceForRentExemption(StakeProgram.space)
|
|
48220
|
+
]);
|
|
48221
|
+
const stakeAccParsed = stakeAccInfoParsed?.value?.data;
|
|
48222
|
+
const amountLamports = Math.round(Number(amount) * LAMPORTS_PER_SOL);
|
|
48223
|
+
const stakeAccLamports = Number(stakeAccParsed?.parsed?.info?.stake?.delegation?.stake ?? 0);
|
|
48224
|
+
const isFullStake = amountLamports >= stakeAccLamports;
|
|
48225
|
+
const instructions2 = [];
|
|
48226
|
+
const signers = [];
|
|
48227
|
+
if (!lstAccInfo) {
|
|
48228
|
+
instructions2.push(
|
|
48229
|
+
createAssociatedTokenAccountInstruction(authority, lstAta, authority, lstMint)
|
|
48230
|
+
);
|
|
48231
|
+
}
|
|
48232
|
+
let targetStakePubkey;
|
|
48233
|
+
if (!isFullStake) {
|
|
48234
|
+
const splitStakeAccount = Keypair.generate();
|
|
48235
|
+
signers.push(splitStakeAccount);
|
|
48236
|
+
targetStakePubkey = splitStakeAccount.publicKey;
|
|
48237
|
+
instructions2.push(
|
|
48238
|
+
...StakeProgram.split(
|
|
48239
|
+
{
|
|
48240
|
+
stakePubkey: stakeAccountPk,
|
|
48241
|
+
authorizedPubkey: authority,
|
|
48242
|
+
splitStakePubkey: splitStakeAccount.publicKey,
|
|
48243
|
+
lamports: amountLamports
|
|
48244
|
+
},
|
|
48245
|
+
rentExemptReserve
|
|
48246
|
+
).instructions
|
|
48247
|
+
);
|
|
48248
|
+
} else {
|
|
48249
|
+
targetStakePubkey = stakeAccountPk;
|
|
48250
|
+
}
|
|
48251
|
+
const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([
|
|
48252
|
+
StakeProgram.authorize({
|
|
48253
|
+
stakePubkey: targetStakePubkey,
|
|
48254
|
+
authorizedPubkey: authority,
|
|
48255
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48256
|
+
stakeAuthorizationType: StakeAuthorizationLayout.Staker
|
|
48257
|
+
}).instructions,
|
|
48258
|
+
StakeProgram.authorize({
|
|
48259
|
+
stakePubkey: targetStakePubkey,
|
|
48260
|
+
authorizedPubkey: authority,
|
|
48261
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48262
|
+
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer
|
|
48263
|
+
}).instructions
|
|
48264
|
+
]);
|
|
48265
|
+
[authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {
|
|
48266
|
+
if (ix) {
|
|
48267
|
+
ix.keys = ix.keys.map((key) => ({
|
|
48268
|
+
...key,
|
|
48269
|
+
isWritable: key.pubkey.equals(SYSVAR_CLOCK_ID2) ? false : key.isWritable
|
|
48270
|
+
}));
|
|
48271
|
+
}
|
|
48272
|
+
});
|
|
48273
|
+
instructions2.push(...authorizeStakerIx, ...authorizeWithdrawIx);
|
|
48274
|
+
const depositStakeIx = await SinglePoolInstruction.depositStake(
|
|
48275
|
+
pool,
|
|
48276
|
+
targetStakePubkey,
|
|
48277
|
+
lstAta,
|
|
48278
|
+
authority
|
|
48279
|
+
);
|
|
48280
|
+
instructions2.push(depositStakeIx);
|
|
48281
|
+
return { instructions: instructions2, keys: signers };
|
|
48282
|
+
}
|
|
48283
|
+
async function makeMintStakedLstTx(params) {
|
|
48284
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48285
|
+
const { instructions: instructions2, keys } = await makeMintStakedLstIx(params);
|
|
48286
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48287
|
+
const message = new TransactionMessage({
|
|
48288
|
+
payerKey: params.authority,
|
|
48289
|
+
recentBlockhash: blockhash,
|
|
48290
|
+
instructions: instructions2
|
|
48291
|
+
}).compileToV0Message(luts);
|
|
48292
|
+
const tx = new VersionedTransaction(message);
|
|
48293
|
+
return addTransactionMetadata(tx, {
|
|
48294
|
+
signers: keys,
|
|
48295
|
+
addressLookupTables: luts,
|
|
48296
|
+
type: "DEPOSIT_STAKE" /* DEPOSIT_STAKE */
|
|
48297
|
+
});
|
|
48298
|
+
}
|
|
48299
|
+
async function makeRedeemStakedLstIx(params) {
|
|
48300
|
+
const { amount, authority, validator, connection } = params;
|
|
48301
|
+
const pool = findPoolAddress(validator);
|
|
48302
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48303
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
48304
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48305
|
+
const rentExemption = await connection.getMinimumBalanceForRentExemption(
|
|
48306
|
+
StakeProgram.space
|
|
48307
|
+
);
|
|
48308
|
+
const stakeAmount = new BigNumber3(new BigNumber3(amount).toString());
|
|
48309
|
+
const instructions2 = [];
|
|
48310
|
+
const signers = [];
|
|
48311
|
+
const stakeAccount = Keypair.generate();
|
|
48312
|
+
signers.push(stakeAccount);
|
|
48313
|
+
instructions2.push(
|
|
48314
|
+
SystemProgram.createAccount({
|
|
48315
|
+
fromPubkey: authority,
|
|
48316
|
+
newAccountPubkey: stakeAccount.publicKey,
|
|
48317
|
+
lamports: rentExemption,
|
|
48318
|
+
space: StakeProgram.space,
|
|
48319
|
+
programId: StakeProgram.programId
|
|
48320
|
+
})
|
|
48321
|
+
);
|
|
48322
|
+
instructions2.push(
|
|
48323
|
+
createApproveInstruction(
|
|
48324
|
+
lstAta,
|
|
48325
|
+
mintAuthority,
|
|
48326
|
+
authority,
|
|
48327
|
+
BigInt(stakeAmount.multipliedBy(1e9).toFixed(0))
|
|
48328
|
+
)
|
|
48329
|
+
);
|
|
48330
|
+
const withdrawStakeIx = await SinglePoolInstruction.withdrawStake(
|
|
48331
|
+
pool,
|
|
48332
|
+
stakeAccount.publicKey,
|
|
48333
|
+
authority,
|
|
48334
|
+
lstAta,
|
|
48335
|
+
stakeAmount
|
|
48336
|
+
);
|
|
48337
|
+
instructions2.push(withdrawStakeIx);
|
|
48338
|
+
return { instructions: instructions2, keys: signers };
|
|
48339
|
+
}
|
|
48340
|
+
async function makeRedeemStakedLstTx(params) {
|
|
48341
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48342
|
+
const { instructions: instructions2, keys } = await makeRedeemStakedLstIx(params);
|
|
48343
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48344
|
+
const message = new TransactionMessage({
|
|
48345
|
+
payerKey: params.authority,
|
|
48346
|
+
recentBlockhash: blockhash,
|
|
48347
|
+
instructions: instructions2
|
|
48348
|
+
}).compileToV0Message(luts);
|
|
48349
|
+
const tx = new VersionedTransaction(message);
|
|
48350
|
+
return addTransactionMetadata(tx, {
|
|
48351
|
+
signers: keys,
|
|
48352
|
+
addressLookupTables: luts,
|
|
48353
|
+
type: "WITHDRAW_STAKE" /* WITHDRAW_STAKE */
|
|
48354
|
+
});
|
|
48355
|
+
}
|
|
48356
|
+
async function makeMergeStakeAccountsTx(params) {
|
|
48357
|
+
const {
|
|
48358
|
+
authority,
|
|
48359
|
+
sourceStakeAccount,
|
|
48360
|
+
destinationStakeAccount,
|
|
48361
|
+
connection,
|
|
48362
|
+
luts,
|
|
48363
|
+
blockhash: providedBlockhash
|
|
48364
|
+
} = params;
|
|
48365
|
+
const mergeIx = StakeProgram.merge({
|
|
48366
|
+
stakePubkey: destinationStakeAccount,
|
|
48367
|
+
sourceStakePubKey: sourceStakeAccount,
|
|
48368
|
+
authorizedPubkey: authority
|
|
48369
|
+
}).instructions;
|
|
48370
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48371
|
+
const message = new TransactionMessage({
|
|
48372
|
+
payerKey: authority,
|
|
48373
|
+
recentBlockhash: blockhash,
|
|
48374
|
+
instructions: mergeIx
|
|
48375
|
+
}).compileToV0Message(luts);
|
|
48376
|
+
const tx = new VersionedTransaction(message);
|
|
48377
|
+
return addTransactionMetadata(tx, {
|
|
48378
|
+
addressLookupTables: luts,
|
|
48379
|
+
type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
|
|
48380
|
+
});
|
|
48381
|
+
}
|
|
47853
48382
|
|
|
47854
48383
|
// src/services/account/services/account-simulation.service.ts
|
|
47855
48384
|
async function simulateAccountHealthCacheWithFallback(params) {
|
|
@@ -49260,18 +49789,15 @@ var fetchPythOracleData = async (banks, opts) => {
|
|
|
49260
49789
|
bankOraclePriceMap: /* @__PURE__ */ new Map()
|
|
49261
49790
|
};
|
|
49262
49791
|
}
|
|
49263
|
-
pythStakedCollateralBanks.map((bank) => [
|
|
49264
|
-
opts.validatorVoteAccountByBank?.[bank.address.toBase58()] ?? "",
|
|
49265
|
-
bank.mint.toBase58()
|
|
49266
|
-
]);
|
|
49267
|
-
const priceCoeffByBank = {};
|
|
49268
49792
|
const combinedPythBanks = [
|
|
49269
49793
|
...pythPushBanks,
|
|
49794
|
+
...pythStakedCollateralBanks,
|
|
49270
49795
|
...pythPushKaminosBanks,
|
|
49271
49796
|
...driftPythPullBanks,
|
|
49272
49797
|
...solendPythPullBanks,
|
|
49273
49798
|
...juplendPythPullBanks
|
|
49274
49799
|
];
|
|
49800
|
+
const priceCoeffByBank = {};
|
|
49275
49801
|
const pythOracleKeys = extractPythOracleKeys(combinedPythBanks);
|
|
49276
49802
|
const uniquePythOracleKeys = Array.from(new Set(pythOracleKeys));
|
|
49277
49803
|
let oraclePrices;
|
|
@@ -50476,6 +51002,389 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
|
|
|
50476
51002
|
}))
|
|
50477
51003
|
};
|
|
50478
51004
|
}
|
|
51005
|
+
|
|
51006
|
+
// src/services/native-stake/utils/metadata.data.ts
|
|
51007
|
+
var STAKED_BANK_METADATA_JSON = [
|
|
51008
|
+
{
|
|
51009
|
+
bankAddress: "8g5qG6PVygcVSXV1cJnjXaD1yhrDwcWAMQCY2wR9VuAf",
|
|
51010
|
+
validatorVoteAccount: "CooLbbZy5Xmdt7DiHPQ3ss2uRXawnTXXVgpMS8E8jDzr",
|
|
51011
|
+
tokenAddress: "BADo3D6nMtGnsAaTv3iEes8mMcq92TuFoBWebFe8kzeA",
|
|
51012
|
+
tokenName: "Cavey Cool",
|
|
51013
|
+
tokenSymbol: "COOL"
|
|
51014
|
+
},
|
|
51015
|
+
{
|
|
51016
|
+
bankAddress: "BuCckNm1djpp3vZVhvh1CrrniirY6sr2hwUmeP5kTcGz",
|
|
51017
|
+
validatorVoteAccount: "mrgn4t2JabSgvGnrCaHXMvz8ocr4F52scsxJnkQMQsQ",
|
|
51018
|
+
tokenAddress: "FUyAyVbYrMfiaN1QEQYFZTuBNzW5EJf3jWzjjymGqKLv",
|
|
51019
|
+
tokenName: "Project 0 Meridian",
|
|
51020
|
+
tokenSymbol: "MERIDIAN"
|
|
51021
|
+
},
|
|
51022
|
+
{
|
|
51023
|
+
bankAddress: "Hco1P3dGRXz3ZGFvMkbDgghZQy47Tp7vp7koSYRvP6nm",
|
|
51024
|
+
validatorVoteAccount: "mrgn6ETrBDM8mjjYN8rbVwFqVwF8z6rtmvGLbdGuVUU",
|
|
51025
|
+
tokenAddress: "A4B5MGQvcZCUqeiUEAB4ckZ2tvH2UmEg31vF7TiERDkH",
|
|
51026
|
+
tokenName: "MRGN 3",
|
|
51027
|
+
tokenSymbol: "MRGN3"
|
|
51028
|
+
},
|
|
51029
|
+
{
|
|
51030
|
+
bankAddress: "EPh2abWP8DusPH8myWnECAAeQUZgAz927aMbmwXt3eRY",
|
|
51031
|
+
validatorVoteAccount: "mrgn2vsZ5EJ8YEfAMNPXmRux7th9cNfBasQ1JJvVwPn",
|
|
51032
|
+
tokenAddress: "6Mt7tBWLUJfDxqCFTsjoRXF9wD55g4Lhs5nAyYp244pX",
|
|
51033
|
+
tokenName: "Project 0 Horizon",
|
|
51034
|
+
tokenSymbol: "HORIZON"
|
|
51035
|
+
},
|
|
51036
|
+
{
|
|
51037
|
+
bankAddress: "6wjAwhnxTMEzHk8NNHVXgkx1jSrb6TX1bC17j3S56FfB",
|
|
51038
|
+
validatorVoteAccount: "3N7s9zXMZ4QqvHQR15t5GNHyqc89KduzMP7423eWiD5g",
|
|
51039
|
+
tokenAddress: "DKPvRV4dxUejjGpr2XwFmzZbbbTD7vx9Jmt1kk43n4d5",
|
|
51040
|
+
tokenName: "Binance",
|
|
51041
|
+
tokenSymbol: "BINANCE"
|
|
51042
|
+
},
|
|
51043
|
+
{
|
|
51044
|
+
bankAddress: "J9tksvZEDSwtNtZ6yxYjWDDkzhPbwDMnihU61NkFG9FE",
|
|
51045
|
+
validatorVoteAccount: "he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk",
|
|
51046
|
+
tokenAddress: "2k79y8CApbU9jAvWhLS2j6uRbaVjpLJTUzstBTho9vGq",
|
|
51047
|
+
tokenName: "Helius",
|
|
51048
|
+
tokenSymbol: "HELIUS"
|
|
51049
|
+
},
|
|
51050
|
+
{
|
|
51051
|
+
bankAddress: "Dfr6Sf44ftecaJaoJMzFQABdkt3CEHfBwut1WyacRzaE",
|
|
51052
|
+
validatorVoteAccount: "SLaYv7tCwetrFGbPCRnqpHswG5qqKino78EYpbGF7xY",
|
|
51053
|
+
tokenAddress: "Vsw4JT33S7bLbhjySMMyrP3JKvTAcNi9WG5Doekrmgg",
|
|
51054
|
+
tokenName: "Solayer",
|
|
51055
|
+
tokenSymbol: "SOLAYER"
|
|
51056
|
+
},
|
|
51057
|
+
{
|
|
51058
|
+
bankAddress: "BZAm4qGscR8gg5bmWrEq6BTofgaZPbg7Fwfa7rFghEXL",
|
|
51059
|
+
validatorVoteAccount: "J1to3PQfXidUUhprQWgdKkQAMWPJAEqSJ7amkBDE9qhF",
|
|
51060
|
+
tokenAddress: "6B8hZSupE5mcACmjzozP6C1DR2uaCCtmrGqcYWC6SBCc",
|
|
51061
|
+
tokenName: "Bonk",
|
|
51062
|
+
tokenSymbol: "BONK"
|
|
51063
|
+
},
|
|
51064
|
+
{
|
|
51065
|
+
bankAddress: "3UrMZ26NRKu2y6c2dPE7gZVHwEmhpwKLcWACg3tjCVEt",
|
|
51066
|
+
validatorVoteAccount: "J2nUHEAgZFRyuJbFjdqPrAa9gyWDuc7hErtDQHPhsYRp",
|
|
51067
|
+
tokenAddress: "9M7oMo4oL6RDPG7WbAX3Zz4dPzbMgpiCzwrQPMwG4Wgq",
|
|
51068
|
+
tokenName: "Phantom",
|
|
51069
|
+
tokenSymbol: "PHANTOM"
|
|
51070
|
+
},
|
|
51071
|
+
{
|
|
51072
|
+
bankAddress: "8c269gkonvATm93nviuYiriCQ829f7ypx3aScYDR1YoQ",
|
|
51073
|
+
validatorVoteAccount: "D3QPJm7BDzzPeRG51YZSEz3LfV7GvFNu9NkcibzURxuj",
|
|
51074
|
+
tokenAddress: "8hXCCQmYFcDhU5Mkuvyixp2Q11sbyQComkceSSh3GY4a",
|
|
51075
|
+
tokenName: "Starke Finance",
|
|
51076
|
+
tokenSymbol: "STARKE"
|
|
51077
|
+
},
|
|
51078
|
+
{
|
|
51079
|
+
bankAddress: "37tiA2NTF6YCt85XzCidPo9ZVpuqkkmfVJCYQ5Yx5Uhs",
|
|
51080
|
+
validatorVoteAccount: "SBLZib4npE7svxFA7AsD3ytdQAfYNb39c8zsU82AA2E",
|
|
51081
|
+
tokenAddress: "96rXgCFy1Er49169XoKHkeLiKC2k4bTy1641q1TVrMm2",
|
|
51082
|
+
tokenName: "SolBlaze Validator",
|
|
51083
|
+
tokenSymbol: "SOLBLAZE"
|
|
51084
|
+
},
|
|
51085
|
+
{
|
|
51086
|
+
bankAddress: "J9trpcrVdFjVNg6VFrdF1XPGgjftQKZhbbWsxertdv9V",
|
|
51087
|
+
validatorVoteAccount: "FACqsS19VScz8oo2YhdMg35EsAy6xsCZ9Y58eJXGv8QJ",
|
|
51088
|
+
tokenAddress: "AH6fxpHS2gtMtJgBy8y8pEAPkqyop2pSugF6REs9NaTp",
|
|
51089
|
+
tokenName: "Lantern",
|
|
51090
|
+
tokenSymbol: "LNTRN"
|
|
51091
|
+
},
|
|
51092
|
+
{
|
|
51093
|
+
bankAddress: "EGTfrYiuWpPPZ4yfY9tCxnK6QMkY7pzVie9DxK772iGe",
|
|
51094
|
+
validatorVoteAccount: "EfnywDKqArxK6N6FS9ctsuzNdxfx3pzfXEQE5EevQ1SV",
|
|
51095
|
+
tokenAddress: "FcXEwHku68ZquqtSj1eSWS1SVWkhAZSyb4usfpiuEJAL",
|
|
51096
|
+
tokenName: "PROJECT SUPER",
|
|
51097
|
+
tokenSymbol: "SUPER"
|
|
51098
|
+
},
|
|
51099
|
+
{
|
|
51100
|
+
bankAddress: "A5e7UTE3g11ZfKgftqRCvxAgcDuFGyeDjMka96zJWSWe",
|
|
51101
|
+
validatorVoteAccount: "3ZUQekqiZoybB57y49eqtvSaoonqDwuNbeqEGwN88JkQ",
|
|
51102
|
+
tokenAddress: "F1XPjtpsEy23Q7po4JkWjp1jkDZcvFYSrqD8TR1YL3EF",
|
|
51103
|
+
tokenName: "Paws",
|
|
51104
|
+
tokenSymbol: "PAWS"
|
|
51105
|
+
},
|
|
51106
|
+
{
|
|
51107
|
+
bankAddress: "91jkdp4cF8vCDhjwude3SGSGrmVWFk5vTAtR6fsGVAfy",
|
|
51108
|
+
validatorVoteAccount: "gangtRyGPTvYWb8K3xS2feJQaCks4iJ7rytFUPtVqSY",
|
|
51109
|
+
tokenAddress: "6ZS7ZVDw91BVAC8gsz3SZBSeVeF2GtXtL2BHK31Kvyjm",
|
|
51110
|
+
tokenName: "Lotus Validator",
|
|
51111
|
+
tokenSymbol: "LOTUS"
|
|
51112
|
+
},
|
|
51113
|
+
{
|
|
51114
|
+
bankAddress: "72BS34HkCgq8RWQR7kuVVmiJMtKqSxG4CHX6ZXpSCwg7",
|
|
51115
|
+
validatorVoteAccount: "oRAnGeU5h8h2UkvbfnE5cjXnnAa4rBoaxmS4kbFymSe",
|
|
51116
|
+
tokenAddress: "9yF8pXctzicum2P73uuk4Dhqf2MVz6tzRAe8THGXCJcp",
|
|
51117
|
+
tokenName: "Orangefin Ventures",
|
|
51118
|
+
tokenSymbol: "ORANGEFIN"
|
|
51119
|
+
},
|
|
51120
|
+
{
|
|
51121
|
+
bankAddress: "8F4DsU3NMFunUxBZkWrpYR8zwhAfoAt7QuiEPMtyhWvX",
|
|
51122
|
+
validatorVoteAccount: "3xjfK9C9YNcta8MvK1US4sQ3bc6DEjoJoR3qLExGf9xE",
|
|
51123
|
+
tokenAddress: "Akib1NYJzzh9HkiDH41S2LUefUmR1bKsk65xgqUcW5C5",
|
|
51124
|
+
tokenName: "pico\u{1F644}.sol",
|
|
51125
|
+
tokenSymbol: "PICO"
|
|
51126
|
+
},
|
|
51127
|
+
{
|
|
51128
|
+
bankAddress: "GdtggomQth6cxuYPdiVhBbcX7VC9rnDDwLMfxipxE2Po",
|
|
51129
|
+
validatorVoteAccount: "oPaLTmyvoUhW26QCMwLA5JNUeBYy72PDpFoXQF8SeX4",
|
|
51130
|
+
tokenAddress: "C71A3W7g5XALUNwTDWTwHX3qhfypaYZ41aNZjBpcaC9D",
|
|
51131
|
+
tokenName: "Temporal Opal",
|
|
51132
|
+
tokenSymbol: "OPAL"
|
|
51133
|
+
},
|
|
51134
|
+
{
|
|
51135
|
+
bankAddress: "5sJCKePwAhyD3mzrzLRDM2PkFMc85nnvvarxHLsvWvpg",
|
|
51136
|
+
validatorVoteAccount: "9jYFwBfbjYmvasFbJyES9apLJDTkwtbgSDRWanHEvcRw",
|
|
51137
|
+
tokenAddress: "Hj69K1WbnfZFipLbrzdxgGhDqCR47q48bN5nUHt6xQZo",
|
|
51138
|
+
tokenName: "WATCHTOWER",
|
|
51139
|
+
tokenSymbol: "WATCHTOWER"
|
|
51140
|
+
},
|
|
51141
|
+
{
|
|
51142
|
+
bankAddress: "3F3QXT3BtkegaBfFjn2odKLurFYLHJHJ99xKV2TRTvrk",
|
|
51143
|
+
validatorVoteAccount: "6JfBwvcz5QUKQJ37BMKTLrf968DDJBtwoZLw19aHwFtQ",
|
|
51144
|
+
tokenAddress: "8FqX86cQofBHReetZgxrxxvzN4iqMVsj2hbiv7pj2h73",
|
|
51145
|
+
tokenName: "Spectrum Staking",
|
|
51146
|
+
tokenSymbol: "SPECTRUM"
|
|
51147
|
+
},
|
|
51148
|
+
{
|
|
51149
|
+
bankAddress: "CFmvdtEPQJPVqS1QRkeRcdQm2itAPk6k8hSJbmt88Sjc",
|
|
51150
|
+
validatorVoteAccount: "Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6",
|
|
51151
|
+
tokenAddress: "38ZUTefZnKSUJU3wxpUe3xpiw2j5WQPnmzSTNbS1JqLA",
|
|
51152
|
+
tokenName: "Temporal Emerald",
|
|
51153
|
+
tokenSymbol: "EMERALD"
|
|
51154
|
+
},
|
|
51155
|
+
{
|
|
51156
|
+
bankAddress: "CmBDHSVuodmUnanbBVFvY9cauLeosbdFQn9bJANMVYUG",
|
|
51157
|
+
validatorVoteAccount: "mintrNtxN3PhAB45Pt41XqyKghTTpqcoBkQTZqh96iR",
|
|
51158
|
+
tokenAddress: "GxGmv7s7s2co3pLZukns946fr5zmR8c5buWRD9prGd6v",
|
|
51159
|
+
tokenName: "Hanabi Staking",
|
|
51160
|
+
tokenSymbol: "haSOLmrgn"
|
|
51161
|
+
},
|
|
51162
|
+
{
|
|
51163
|
+
bankAddress: "7bLfrb4fWVYkVpZ9rg7dBUwKRAqLyiivCW4ahMMGcKyS",
|
|
51164
|
+
validatorVoteAccount: "76DafWkJ6pGK2hoD41HjrM4xTBhfKqrDYDazv13n5ir1",
|
|
51165
|
+
tokenAddress: "GT7n9uZbYzHv52YqDBowtZ5ZVW91umaBQTNPFQNeLUpR",
|
|
51166
|
+
tokenName: "Solana Japan Validator",
|
|
51167
|
+
tokenSymbol: "SolJAPAn"
|
|
51168
|
+
},
|
|
51169
|
+
{
|
|
51170
|
+
bankAddress: "6q5DB86DhCBQt5bqzZwgopV8EA96aCnngu5ebR1ooDFq",
|
|
51171
|
+
validatorVoteAccount: "Cue647T8jgwpRSDUb8ttTYx7NiEfJCRZNiiw1qmchXsG",
|
|
51172
|
+
tokenAddress: "EAR6LenhNstHxR9289rWakm82WgLJYvHD7NawfXtuyUx",
|
|
51173
|
+
tokenName: "KIWAMI",
|
|
51174
|
+
tokenSymbol: "KIWAMI"
|
|
51175
|
+
},
|
|
51176
|
+
{
|
|
51177
|
+
bankAddress: "GLSCJ39N82Xo21621jMheinvjQLrBrkG7gzo2C5L1y6y",
|
|
51178
|
+
validatorVoteAccount: "7emL18Bnve7wbYE9Az7vYJjikxN6YPU81igf6rVU5FN8",
|
|
51179
|
+
tokenAddress: "EQuMUgLZArKwWUk6uGPmTGYUgNbfgJrbBaNR7CQyZ5uf",
|
|
51180
|
+
tokenName: "Temporal Topaz",
|
|
51181
|
+
tokenSymbol: "TOPAZ"
|
|
51182
|
+
},
|
|
51183
|
+
{
|
|
51184
|
+
bankAddress: "4irzCCsU53ffh9XB7NxGzbbHjvSR7FTfPbn6KoXkt7kX",
|
|
51185
|
+
validatorVoteAccount: "2iWXwF2Q5W6o7yntV2mkbxncB4rYHnX61y3NU8a8EFMJ",
|
|
51186
|
+
tokenAddress: "14Pets6QpE9iXKkXg8Ri4GcDazRMfWR3guM6LZXnFChc",
|
|
51187
|
+
tokenName: "Bull Moose SOL",
|
|
51188
|
+
tokenSymbol: "bmsSOL"
|
|
51189
|
+
},
|
|
51190
|
+
{
|
|
51191
|
+
bankAddress: "C96do7nkEaaFjHq8jHzPpyPTdJSea5xEGwxDzDSepCzf",
|
|
51192
|
+
validatorVoteAccount: "voteRnv6PBzmiGP8NicWtQiqEJTwKKq2SxtqtdLUJjd",
|
|
51193
|
+
tokenAddress: "3YEDiJ4r4xRGNhq6nudRnkwrdKHG7PAtDim24CjTMtBH",
|
|
51194
|
+
tokenName: "diman",
|
|
51195
|
+
tokenSymbol: "DIMAN"
|
|
51196
|
+
},
|
|
51197
|
+
{
|
|
51198
|
+
bankAddress: "9dZiyG51FBR4BWpAs69XbDpr7GfVAEB1ZB89v38maV36",
|
|
51199
|
+
validatorVoteAccount: "Simpj3KyRQmpRkXuBvCQFS7DBBG6vqw93SkZb9UD1hp",
|
|
51200
|
+
tokenAddress: "77YLpVLQXr2KU66GM2JykbT9g5du7LarWgehbWD3CJaB",
|
|
51201
|
+
tokenName: "SIMPDIGIT",
|
|
51202
|
+
tokenSymbol: "SIMPDIGIT"
|
|
51203
|
+
},
|
|
51204
|
+
{
|
|
51205
|
+
bankAddress: "2foqT8wWzWRduyV37uRdj81DijkNMKzYD3D6JPfir7La",
|
|
51206
|
+
validatorVoteAccount: "48oxpSHQkM4sdXUY9NQ8KnEtebzZbyk8uUT7JRdVQNuf",
|
|
51207
|
+
tokenAddress: "42m7Ygk5VxREdKfcFrsH1HnuoqCke8BcVcxNeywMCfp2",
|
|
51208
|
+
tokenName: "Infinite Lux",
|
|
51209
|
+
tokenSymbol: "LUX"
|
|
51210
|
+
},
|
|
51211
|
+
{
|
|
51212
|
+
bankAddress: "FsdWEJzHXkUXejWnb7c1p9UJtF69hVWQNNoakjoXyRCJ",
|
|
51213
|
+
validatorVoteAccount: "4AUED4uj6nSTuANzaAUnGBPJQRmhpDYDwoWJNkoUUBBW",
|
|
51214
|
+
tokenAddress: "CiyQTfHJ9PbTwC7TGf4pXZk8szcWGJ8TeFhhCuUwybqi",
|
|
51215
|
+
tokenName: "Anagram",
|
|
51216
|
+
tokenSymbol: "ANAGRAM"
|
|
51217
|
+
},
|
|
51218
|
+
{
|
|
51219
|
+
bankAddress: "2hs1pHAzDWGqnn1d8VQkc8bZRfQ45grYvzfau8dnWFUk",
|
|
51220
|
+
validatorVoteAccount: "2NxEEbhqqj1Qptq5LXLbDTP5tLa9f7PqkU8zNgxbGU9P",
|
|
51221
|
+
tokenAddress: "9yQLxEzusZ7QiZNafDNdzbEaTCPuJToGjMhLRJtZbgsd",
|
|
51222
|
+
tokenName: "NANSEN",
|
|
51223
|
+
tokenSymbol: "NANSEN"
|
|
51224
|
+
},
|
|
51225
|
+
{
|
|
51226
|
+
bankAddress: "FCi8unSVCwJd3QkrhTtv6LTTjw1c4zV65D5cG5N1rAG6",
|
|
51227
|
+
validatorVoteAccount: "Va1idkzkB6LEmVFmxWbWU8Ao9qehC62Tjmf68L3uYKj",
|
|
51228
|
+
tokenAddress: "AExKb8oJ6mGPYJUyfiX49DMMi226h2AnWeG1G6neQBEz",
|
|
51229
|
+
tokenName: "VALIDATOR",
|
|
51230
|
+
tokenSymbol: "VALID"
|
|
51231
|
+
},
|
|
51232
|
+
{
|
|
51233
|
+
bankAddress: "HzS8RqaQ5syk6EHbVi7h9rFYN48PpxykUXEs6w9wNfNP",
|
|
51234
|
+
validatorVoteAccount: "sTach38ebT8jnGH8i2D1g8NDAS6An19whVMnSSWPXt4",
|
|
51235
|
+
tokenAddress: "AFDVYBqxADagPfN9DdbrNrf9zZqugub7CV4kUJEUrK6J",
|
|
51236
|
+
tokenName: "Stache Node",
|
|
51237
|
+
tokenSymbol: "STACHE"
|
|
51238
|
+
},
|
|
51239
|
+
{
|
|
51240
|
+
bankAddress: "9Hs4E6ACNw6Hmwjvm1duXzbaWmvXxSxN11agw4updEn1",
|
|
51241
|
+
validatorVoteAccount: "EtMSc3MvcDXUr6ChK5GxyFVwTxYA3zqP5XzjE9jwKvSV",
|
|
51242
|
+
tokenAddress: "ENKFyZQZHzNNSxcKYoaVsNLi2xoGPoStZH4A9xxezjbC",
|
|
51243
|
+
tokenName: "Mad Lads CN",
|
|
51244
|
+
tokenSymbol: "MadLadsCN"
|
|
51245
|
+
},
|
|
51246
|
+
{
|
|
51247
|
+
bankAddress: "4watsWcjTBAwsrZpArwQbnNX4bQ1yeHBxgdbrGT4eMu9",
|
|
51248
|
+
validatorVoteAccount: "EARNynHRWg6GfyJCmrrizcZxARB3HVzcaasvNa8kBS72",
|
|
51249
|
+
tokenAddress: "8fhkWcm2n28JuadzY7mRR8FFDZZfnaPfWgw7pLNVZCbE",
|
|
51250
|
+
tokenName: "Solana Compass Stake",
|
|
51251
|
+
tokenSymbol: "compaStake"
|
|
51252
|
+
},
|
|
51253
|
+
{
|
|
51254
|
+
bankAddress: "9d7MTvcz1VMB1rK6H73quMxkR26dLPz5HDaac2eGRjQx",
|
|
51255
|
+
validatorVoteAccount: "nymsndUdAZyUPpWYz5VEg8Ghj9cFvwTRgciLogpmYaQ",
|
|
51256
|
+
tokenAddress: "FWFeaqpkgDr3ejVSY3HjiUmUg3u9fcr5d66HvimnDLWE",
|
|
51257
|
+
tokenName: "Hypo Nyms",
|
|
51258
|
+
tokenSymbol: "NYMS"
|
|
51259
|
+
},
|
|
51260
|
+
{
|
|
51261
|
+
bankAddress: "6V4vCK3n3JVncfpS16mW8ceLoNPatvu61pKxFmWx8adi",
|
|
51262
|
+
validatorVoteAccount: "BT8LZUvQVwFHRGw2Dwv7UeqDUq7btfjegLpuz5bwgziD",
|
|
51263
|
+
tokenAddress: "9YRS7Stf9dVibTT1M4uVEAuRMcoS4MH1QxqXy9Lssrab",
|
|
51264
|
+
tokenName: "private",
|
|
51265
|
+
tokenSymbol: "private"
|
|
51266
|
+
},
|
|
51267
|
+
{
|
|
51268
|
+
bankAddress: "CK8qRAcmvkDXaqX2S5GkgTCZT5pCz34me1neQhpJYe1Z",
|
|
51269
|
+
validatorVoteAccount: "Ac1beBKixfNdrTAac7GRaTsJTxLyvgGvJjvy4qQfvyfc",
|
|
51270
|
+
tokenAddress: "DLTAbTL5NXhbqX6LX3ie3tf52pdtGpxe2DrZUr1RhgY6",
|
|
51271
|
+
tokenName: "Stronghold",
|
|
51272
|
+
tokenSymbol: "Stronghold"
|
|
51273
|
+
},
|
|
51274
|
+
{
|
|
51275
|
+
bankAddress: "H6CT1aiCgSNw9S6aq38npEhdoN2UPhSKe8Lj9fQqqjuu",
|
|
51276
|
+
validatorVoteAccount: "FREEL1BCzmPpNneC7FHCtBqzeWYrHRbtisFvi4N8XUP9",
|
|
51277
|
+
tokenAddress: "AKFuMoM5rjSpQSL4p6TBoc7D4dmEem9QrHhuSDCBYyZ8",
|
|
51278
|
+
tokenName: "Ross",
|
|
51279
|
+
tokenSymbol: "Ross"
|
|
51280
|
+
},
|
|
51281
|
+
{
|
|
51282
|
+
bankAddress: "G46aHuakgStymbE2WsLbja61mH5UXBPdSdpwf6Ci3saG",
|
|
51283
|
+
validatorVoteAccount: "mnvkHm47ZmRKoSWuQZAfXLRiDPiKCq8PWkMWrp1Wwqe",
|
|
51284
|
+
tokenAddress: "Cq9S5UB9BviPn5yoGkEDk3m7neQag4KJnhPWGyuev9W8",
|
|
51285
|
+
tokenName: "gripto staked sol",
|
|
51286
|
+
tokenSymbol: "GRIPTO"
|
|
51287
|
+
},
|
|
51288
|
+
{
|
|
51289
|
+
bankAddress: "75UmeEMdqVnGn3JHx8yVZEn7viybJ73XYSjhYCYfyhp2",
|
|
51290
|
+
validatorVoteAccount: "4m1PbxzwLdUnEwog3T9UKxgjktgriHgE1CfAhMqDw7Xx",
|
|
51291
|
+
tokenAddress: "432SogPNunjZMneDV6goZ8ZcCQz282GxoSJ4rwqx95pT",
|
|
51292
|
+
tokenName: "kumasol",
|
|
51293
|
+
tokenSymbol: "kumasol"
|
|
51294
|
+
},
|
|
51295
|
+
{
|
|
51296
|
+
bankAddress: "3zk6EmXANYQK12bwy9dySRAM4cT2vT5cDcAB79j8G33B",
|
|
51297
|
+
validatorVoteAccount: "HvsD9L5t62MGv3QBD2K7xjkipGYr9UZN7BtsW8NuSPpg",
|
|
51298
|
+
tokenAddress: "5vmwd6JHDCmX9W2XT1n2QpvYGA2kk4Xf7qWSayDU6caT",
|
|
51299
|
+
tokenName: "ArgenTerraSOL",
|
|
51300
|
+
tokenSymbol: "atSOL"
|
|
51301
|
+
},
|
|
51302
|
+
{
|
|
51303
|
+
bankAddress: "4C2vPweGNpiE6kTEbYvcbUBHNWxrn4ErQYaqWm5zDexx",
|
|
51304
|
+
validatorVoteAccount: "FnAPJkzf19s87sm24Qhv6bHZMZvZ43gjNUBRgjwXpD4v",
|
|
51305
|
+
tokenAddress: "6q4kVnwUpkE3i7W32dqaX6V12pbsrCnMqZ7TWz9yp1m5",
|
|
51306
|
+
tokenName: "BLOCKPORT",
|
|
51307
|
+
tokenSymbol: "BPT"
|
|
51308
|
+
},
|
|
51309
|
+
{
|
|
51310
|
+
bankAddress: "E5hZu5QQ1pRmGvyS4JHGXVQwzdUPaYM4yEiNKr64YzyG",
|
|
51311
|
+
validatorVoteAccount: "nfGcSJkP35SkPa5475iBChmq1UNcj7JE1uQHrrasymm",
|
|
51312
|
+
tokenAddress: "AQpQoJ3tJKGH9Yn8GSzoUsVcHPJjj3xYfQFp9XVr74F6",
|
|
51313
|
+
tokenName: "Test01",
|
|
51314
|
+
tokenSymbol: "TEST01"
|
|
51315
|
+
},
|
|
51316
|
+
{
|
|
51317
|
+
bankAddress: "3VCkXWAmE5DSwYRpqGFnkUz7vvD2RKbhFvrhzLuE8msu",
|
|
51318
|
+
validatorVoteAccount: "abc1zP7ihWsgQW8z5YmfQNqMckJE5Dfx8fwUNMNVNkY",
|
|
51319
|
+
tokenAddress: "BNisp3omkr6Rg5nHESWafjUbeCpGPy6MYq1iRJRgSAsh",
|
|
51320
|
+
tokenName: "ALGO STAKE",
|
|
51321
|
+
tokenSymbol: "ALGO"
|
|
51322
|
+
},
|
|
51323
|
+
{
|
|
51324
|
+
bankAddress: "7BHHMWw3P1AyebLhX9A8wnDeeGy8jgFXqqHuEZt7BVmW",
|
|
51325
|
+
validatorVoteAccount: "8Pep3GmYiijRALqrMKpez92cxvF4YPTzoZg83uXh14pW",
|
|
51326
|
+
tokenAddress: "zBH13AzXYCqHZKS8NGa4KR8zQhWiyvFdDY15nmfrHgS",
|
|
51327
|
+
tokenName: "8Pep",
|
|
51328
|
+
tokenSymbol: "8Pep"
|
|
51329
|
+
},
|
|
51330
|
+
{
|
|
51331
|
+
bankAddress: "9QWUatjtJtc98yts4ufWnmNeaWQRmaaLjFwbK3iMdS47",
|
|
51332
|
+
validatorVoteAccount: "CatzoSMUkTRidT5DwBxAC2pEtnwMBTpkCepHkFgZDiqb",
|
|
51333
|
+
tokenAddress: "98B1NMLYaNJQNxiQGr53vbjNFMNTYFmDqoCgj7qD9Vhm",
|
|
51334
|
+
tokenName: "JUPITER ",
|
|
51335
|
+
tokenSymbol: "JUPITER"
|
|
51336
|
+
},
|
|
51337
|
+
{
|
|
51338
|
+
bankAddress: "5q1wJkGqqRh6mSBtjG8sfjBsgJSGdA2QoXTWv4UQbHGk",
|
|
51339
|
+
validatorVoteAccount: "shft7Fry1js37Hm9wq4dfwcZSp2DyKszeWMvEpjYCQ1",
|
|
51340
|
+
tokenAddress: "C1KwBJZNwUaodUcP5kXqD52NCuZzThNAG2cw3vt5H6iE",
|
|
51341
|
+
tokenName: "BLUESHIFT",
|
|
51342
|
+
tokenSymbol: "SHIFT"
|
|
51343
|
+
},
|
|
51344
|
+
{
|
|
51345
|
+
bankAddress: "FZaHyfg9hmNMKpfUJ474wNKPaPdXMpnJouasKnndECiZ",
|
|
51346
|
+
validatorVoteAccount: "DdCNGDpP7qMgoAy6paFzhhak2EeyCZcgjH7ak5u5v28m",
|
|
51347
|
+
tokenAddress: "PhxXAYTkFZS23ZWvFcz6H6Uq4VnVBMa6hniiAyudjaW",
|
|
51348
|
+
tokenName: "KILN1",
|
|
51349
|
+
tokenSymbol: "KILN1"
|
|
51350
|
+
},
|
|
51351
|
+
{
|
|
51352
|
+
bankAddress: "5CBocarwfJeWGNozGemWktRYSz6kPikRPdfH8ZHSFrsg",
|
|
51353
|
+
validatorVoteAccount: "8zuMRTXThoPTTPLLvaiKiJshLLCqGMt9BdRjjCL19xBc",
|
|
51354
|
+
tokenAddress: "BDsEuxFWznAP5cUCannnfjyjDtTwqN57CkGfDbjx2nNZ",
|
|
51355
|
+
tokenName: "DawnLabs",
|
|
51356
|
+
tokenSymbol: "DawnLabs"
|
|
51357
|
+
},
|
|
51358
|
+
{
|
|
51359
|
+
bankAddress: "9ivswG37QpCUmkPkLMpRZT7PMyP64V9dDpZdteM254ec",
|
|
51360
|
+
validatorVoteAccount: "gaToR246dheK1DGAMEqxMdBJZwU4qFyt7DzhSwAHFWF",
|
|
51361
|
+
tokenAddress: "TjA2rtxoUFzyPVAw35VQGEQnNXiwcmNjKSk29nmkq1P",
|
|
51362
|
+
tokenName: "Valigator Open",
|
|
51363
|
+
tokenSymbol: "Valigator"
|
|
51364
|
+
}
|
|
51365
|
+
];
|
|
51366
|
+
|
|
51367
|
+
// src/services/native-stake/utils/metadata.utils.ts
|
|
51368
|
+
var _metadataMap = null;
|
|
51369
|
+
var _voteAccountByBank = null;
|
|
51370
|
+
function getStakedBankMetadataMap() {
|
|
51371
|
+
if (!_metadataMap) {
|
|
51372
|
+
_metadataMap = /* @__PURE__ */ new Map();
|
|
51373
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51374
|
+
_metadataMap.set(entry.bankAddress, entry);
|
|
51375
|
+
}
|
|
51376
|
+
}
|
|
51377
|
+
return _metadataMap;
|
|
51378
|
+
}
|
|
51379
|
+
function getValidatorVoteAccountByBank() {
|
|
51380
|
+
if (!_voteAccountByBank) {
|
|
51381
|
+
_voteAccountByBank = {};
|
|
51382
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51383
|
+
_voteAccountByBank[entry.bankAddress] = entry.validatorVoteAccount;
|
|
51384
|
+
}
|
|
51385
|
+
}
|
|
51386
|
+
return _voteAccountByBank;
|
|
51387
|
+
}
|
|
50479
51388
|
async function getKaminoMetadata(options) {
|
|
50480
51389
|
const kaminoBanks = options.banks.filter((b) => b.config.assetTag === 3 /* KAMINO */);
|
|
50481
51390
|
const DEFAULT_PUBKEY = PublicKey.default;
|
|
@@ -50861,13 +51770,11 @@ async function fetchBankIntegrationMetadata(options) {
|
|
|
50861
51770
|
return bankIntegrationMap;
|
|
50862
51771
|
}
|
|
50863
51772
|
var Bank = class _Bank {
|
|
50864
|
-
constructor(address, mint, mintDecimals, group,
|
|
51773
|
+
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) {
|
|
50865
51774
|
this.address = address;
|
|
50866
51775
|
this.mint = mint;
|
|
50867
51776
|
this.mintDecimals = mintDecimals;
|
|
50868
51777
|
this.group = group;
|
|
50869
|
-
this.mintRate = mintRate;
|
|
50870
|
-
this.mintPrice = mintPrice;
|
|
50871
51778
|
this.assetShareValue = assetShareValue;
|
|
50872
51779
|
this.liabilityShareValue = liabilityShareValue;
|
|
50873
51780
|
this.liquidityVault = liquidityVault;
|
|
@@ -50937,8 +51844,6 @@ var Bank = class _Bank {
|
|
|
50937
51844
|
bankType.mint,
|
|
50938
51845
|
bankType.mintDecimals,
|
|
50939
51846
|
bankType.group,
|
|
50940
|
-
bankType.mintRate,
|
|
50941
|
-
bankType.mintPrice,
|
|
50942
51847
|
bankType.assetShareValue,
|
|
50943
51848
|
bankType.liabilityShareValue,
|
|
50944
51849
|
bankType.liquidityVault,
|
|
@@ -50980,8 +51885,6 @@ var Bank = class _Bank {
|
|
|
50980
51885
|
props.mint,
|
|
50981
51886
|
props.mintDecimals,
|
|
50982
51887
|
props.group,
|
|
50983
|
-
props.mintRate,
|
|
50984
|
-
props.mintPrice,
|
|
50985
51888
|
props.assetShareValue,
|
|
50986
51889
|
props.liabilityShareValue,
|
|
50987
51890
|
props.liquidityVault,
|
|
@@ -51708,14 +52611,15 @@ var MarginfiAccount = class _MarginfiAccount {
|
|
|
51708
52611
|
*
|
|
51709
52612
|
* @param program - The Marginfi program instance
|
|
51710
52613
|
* @param banks - Map of all available banks
|
|
51711
|
-
* @param
|
|
52614
|
+
* @param mintDatas - Map of mint data for token programs
|
|
52615
|
+
* @param bankAddress - The bank to withdraw emissions from
|
|
51712
52616
|
*
|
|
51713
|
-
* @returns Promise resolving to InstructionsWrapper containing the
|
|
52617
|
+
* @returns Promise resolving to InstructionsWrapper containing the withdraw emissions instructions
|
|
51714
52618
|
*
|
|
51715
|
-
* @see {@link
|
|
52619
|
+
* @see {@link makeWithdrawEmissionsIx} for implementation
|
|
51716
52620
|
*/
|
|
51717
|
-
async
|
|
51718
|
-
return
|
|
52621
|
+
async makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress) {
|
|
52622
|
+
return makeWithdrawEmissionsIx(program, this, banks, mintDatas, bankAddress);
|
|
51719
52623
|
}
|
|
51720
52624
|
/**
|
|
51721
52625
|
* Creates an instruction to begin a flash loan.
|
|
@@ -52398,12 +53302,17 @@ var MarginfiAccountWrapper = class {
|
|
|
52398
53302
|
});
|
|
52399
53303
|
}
|
|
52400
53304
|
/**
|
|
52401
|
-
* Creates a
|
|
53305
|
+
* Creates a withdraw emissions instruction with auto-injected client data.
|
|
52402
53306
|
*
|
|
52403
|
-
* @param bankAddress - Bank address to
|
|
53307
|
+
* @param bankAddress - Bank address to withdraw emissions from
|
|
52404
53308
|
*/
|
|
52405
|
-
async
|
|
52406
|
-
return this.account.
|
|
53309
|
+
async makeWithdrawEmissionsIx(bankAddress) {
|
|
53310
|
+
return this.account.makeWithdrawEmissionsIx(
|
|
53311
|
+
this.client.program,
|
|
53312
|
+
this.client.bankMap,
|
|
53313
|
+
this.client.mintDataByBank,
|
|
53314
|
+
bankAddress
|
|
53315
|
+
);
|
|
52407
53316
|
}
|
|
52408
53317
|
/**
|
|
52409
53318
|
* Creates a begin flash loan instruction.
|
|
@@ -52918,6 +53827,66 @@ var MarginfiAccountWrapper = class {
|
|
|
52918
53827
|
return this.account.getHealthCheckAccounts(this.client.bankMap, mandatoryBanks, excludedBanks);
|
|
52919
53828
|
}
|
|
52920
53829
|
// ----------------------------------------------------------------------------
|
|
53830
|
+
// Native stake actions
|
|
53831
|
+
// Note: These call standalone action functions directly rather than routing
|
|
53832
|
+
// through this.account because they interact with the SPL stake pool program,
|
|
53833
|
+
// not the marginfi program. No MarginfiAccount state is needed.
|
|
53834
|
+
// ----------------------------------------------------------------------------
|
|
53835
|
+
/**
|
|
53836
|
+
* Creates a transaction to mint LST from a native stake account.
|
|
53837
|
+
*
|
|
53838
|
+
* Converts a native stake account (or a portion of it) into LST tokens
|
|
53839
|
+
* by depositing the stake into the single-validator pool.
|
|
53840
|
+
*
|
|
53841
|
+
* @param amount - SOL amount to convert (in UI units)
|
|
53842
|
+
* @param stakeAccountPk - The stake account to convert
|
|
53843
|
+
* @param validator - The validator vote account
|
|
53844
|
+
*/
|
|
53845
|
+
async makeMintStakedLstTx(amount, stakeAccountPk, validator) {
|
|
53846
|
+
return makeMintStakedLstTx({
|
|
53847
|
+
amount,
|
|
53848
|
+
authority: this.authority,
|
|
53849
|
+
stakeAccountPk,
|
|
53850
|
+
validator,
|
|
53851
|
+
connection: this.client.program.provider.connection,
|
|
53852
|
+
luts: this.client.addressLookupTables
|
|
53853
|
+
});
|
|
53854
|
+
}
|
|
53855
|
+
/**
|
|
53856
|
+
* Creates a transaction to redeem LST tokens back to a native stake account.
|
|
53857
|
+
*
|
|
53858
|
+
* Burns LST tokens and withdraws the underlying stake into a new stake account.
|
|
53859
|
+
*
|
|
53860
|
+
* @param amount - LST amount to redeem (in UI units)
|
|
53861
|
+
* @param validator - The validator vote account
|
|
53862
|
+
*/
|
|
53863
|
+
async makeRedeemStakedLstTx(amount, validator) {
|
|
53864
|
+
return makeRedeemStakedLstTx({
|
|
53865
|
+
amount,
|
|
53866
|
+
authority: this.authority,
|
|
53867
|
+
validator,
|
|
53868
|
+
connection: this.client.program.provider.connection,
|
|
53869
|
+
luts: this.client.addressLookupTables
|
|
53870
|
+
});
|
|
53871
|
+
}
|
|
53872
|
+
/**
|
|
53873
|
+
* Creates a transaction to merge two stake accounts.
|
|
53874
|
+
*
|
|
53875
|
+
* Both accounts must share the same authorized staker/withdrawer and vote account.
|
|
53876
|
+
*
|
|
53877
|
+
* @param sourceStakeAccount - The stake account to merge from (will be consumed)
|
|
53878
|
+
* @param destinationStakeAccount - The stake account to merge into
|
|
53879
|
+
*/
|
|
53880
|
+
async makeMergeStakeAccountsTx(sourceStakeAccount, destinationStakeAccount) {
|
|
53881
|
+
return makeMergeStakeAccountsTx({
|
|
53882
|
+
authority: this.authority,
|
|
53883
|
+
sourceStakeAccount,
|
|
53884
|
+
destinationStakeAccount,
|
|
53885
|
+
connection: this.client.program.provider.connection,
|
|
53886
|
+
luts: this.client.addressLookupTables
|
|
53887
|
+
});
|
|
53888
|
+
}
|
|
53889
|
+
// ----------------------------------------------------------------------------
|
|
52921
53890
|
// Helper methods
|
|
52922
53891
|
// ----------------------------------------------------------------------------
|
|
52923
53892
|
/**
|
|
@@ -53179,7 +54148,6 @@ var Project0Client = class _Project0Client {
|
|
|
53179
54148
|
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
53180
54149
|
break;
|
|
53181
54150
|
case 2 /* STAKED */:
|
|
53182
|
-
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
53183
54151
|
break;
|
|
53184
54152
|
case 0 /* DEFAULT */:
|
|
53185
54153
|
case 1 /* SOL */:
|
|
@@ -53188,6 +54156,56 @@ var Project0Client = class _Project0Client {
|
|
|
53188
54156
|
break;
|
|
53189
54157
|
}
|
|
53190
54158
|
});
|
|
54159
|
+
const stakedBanks = banksArray.filter((b) => b.config.assetTag === 2 /* STAKED */);
|
|
54160
|
+
if (stakedBanks.length > 0) {
|
|
54161
|
+
const metadataMap = getStakedBankMetadataMap();
|
|
54162
|
+
const stakedBankAddresses = [];
|
|
54163
|
+
const poolStakeAddresses = [];
|
|
54164
|
+
const lstMintAddresses = [];
|
|
54165
|
+
for (const bank of stakedBanks) {
|
|
54166
|
+
const metadata = metadataMap.get(bank.address.toBase58());
|
|
54167
|
+
if (!metadata) {
|
|
54168
|
+
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
54169
|
+
continue;
|
|
54170
|
+
}
|
|
54171
|
+
const pool = findPoolAddress(new PublicKey(metadata.validatorVoteAccount));
|
|
54172
|
+
stakedBankAddresses.push(bank.address.toBase58());
|
|
54173
|
+
poolStakeAddresses.push(findPoolStakeAddress(pool));
|
|
54174
|
+
lstMintAddresses.push(findPoolMintAddress(pool));
|
|
54175
|
+
}
|
|
54176
|
+
if (stakedBankAddresses.length > 0) {
|
|
54177
|
+
const allAddresses = [
|
|
54178
|
+
...poolStakeAddresses.map((a) => a.toBase58()),
|
|
54179
|
+
...lstMintAddresses.map((a) => a.toBase58())
|
|
54180
|
+
];
|
|
54181
|
+
const accountInfos = await chunkedGetRawMultipleAccountInfoOrdered(
|
|
54182
|
+
connection,
|
|
54183
|
+
allAddresses
|
|
54184
|
+
);
|
|
54185
|
+
const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);
|
|
54186
|
+
const lstMintInfos = accountInfos.slice(poolStakeAddresses.length);
|
|
54187
|
+
for (let i = 0; i < stakedBankAddresses.length; i++) {
|
|
54188
|
+
const bankAddr = stakedBankAddresses[i];
|
|
54189
|
+
const poolStakeInfo = poolStakeInfos[i];
|
|
54190
|
+
const lstMintInfo = lstMintInfos[i];
|
|
54191
|
+
if (!poolStakeInfo || !lstMintInfo) {
|
|
54192
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3(1));
|
|
54193
|
+
continue;
|
|
54194
|
+
}
|
|
54195
|
+
const stakeLamports = poolStakeInfo.lamports;
|
|
54196
|
+
const supplyBuffer = lstMintInfo.data.slice(36, 44);
|
|
54197
|
+
const lstMintSupply = Number(Buffer.from(supplyBuffer).readBigUInt64LE(0));
|
|
54198
|
+
if (lstMintSupply === 0) {
|
|
54199
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3(1));
|
|
54200
|
+
continue;
|
|
54201
|
+
}
|
|
54202
|
+
const LAMPORTS_PER_SOL5 = 1e9;
|
|
54203
|
+
const adjustedStake = Math.max(stakeLamports - LAMPORTS_PER_SOL5, 0);
|
|
54204
|
+
const multiplier = new BigNumber3(adjustedStake).dividedBy(lstMintSupply);
|
|
54205
|
+
assetShareMultiplierByBank.set(bankAddr, multiplier);
|
|
54206
|
+
}
|
|
54207
|
+
}
|
|
54208
|
+
}
|
|
53191
54209
|
const emodePairs = getEmodePairs(banksArray);
|
|
53192
54210
|
return new _Project0Client(
|
|
53193
54211
|
program,
|
|
@@ -53229,6 +54247,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
53229
54247
|
}
|
|
53230
54248
|
};
|
|
53231
54249
|
|
|
53232
|
-
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx,
|
|
54250
|
+
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
53233
54251
|
//# sourceMappingURL=index.js.map
|
|
53234
54252
|
//# sourceMappingURL=index.js.map
|