@drift-labs/sdk 2.106.0-beta.6 → 2.106.0-beta.8
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/VERSION +1 -1
- package/lib/browser/driftClient.d.ts +45 -0
- package/lib/browser/driftClient.js +144 -0
- package/lib/browser/idl/drift.json +176 -1
- package/lib/node/driftClient.d.ts +45 -0
- package/lib/node/driftClient.js +144 -0
- package/lib/node/idl/drift.json +176 -1
- package/package.json +1 -1
- package/src/driftClient.ts +265 -0
- package/src/idl/drift.json +176 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.106.0-beta.
|
|
1
|
+
2.106.0-beta.8
|
|
@@ -718,6 +718,51 @@ export declare class DriftClient {
|
|
|
718
718
|
getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
719
719
|
liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
720
720
|
getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
721
|
+
getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
|
|
722
|
+
jupiterClient: JupiterClient;
|
|
723
|
+
liabilityMarketIndex: number;
|
|
724
|
+
assetMarketIndex: number;
|
|
725
|
+
assetTokenAccount?: PublicKey;
|
|
726
|
+
liabilityTokenAccount?: PublicKey;
|
|
727
|
+
swapAmount: BN;
|
|
728
|
+
slippageBps?: number;
|
|
729
|
+
swapMode?: SwapMode;
|
|
730
|
+
onlyDirectRoutes?: boolean;
|
|
731
|
+
quote?: QuoteResponse;
|
|
732
|
+
userAccount: UserAccount;
|
|
733
|
+
userAccountPublicKey: PublicKey;
|
|
734
|
+
userStatsAccountPublicKey: PublicKey;
|
|
735
|
+
liquidatorSubAccountId?: number;
|
|
736
|
+
}): Promise<{
|
|
737
|
+
ixs: TransactionInstruction[];
|
|
738
|
+
lookupTables: AddressLookupTableAccount[];
|
|
739
|
+
}>;
|
|
740
|
+
/**
|
|
741
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
742
|
+
*
|
|
743
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
744
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
745
|
+
* @param amountIn the amount of the token to sell
|
|
746
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
747
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
748
|
+
* @param userAccount
|
|
749
|
+
* @param userAccountPublicKey
|
|
750
|
+
* @param userStatsAccountPublicKey
|
|
751
|
+
*/
|
|
752
|
+
getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
|
|
753
|
+
liabilityMarketIndex: number;
|
|
754
|
+
assetMarketIndex: number;
|
|
755
|
+
swapAmount: BN;
|
|
756
|
+
assetTokenAccount: PublicKey;
|
|
757
|
+
liabilityTokenAccount: PublicKey;
|
|
758
|
+
userAccount: UserAccount;
|
|
759
|
+
userAccountPublicKey: PublicKey;
|
|
760
|
+
userStatsAccountPublicKey: PublicKey;
|
|
761
|
+
liquidatorSubAccountId?: number;
|
|
762
|
+
}): Promise<{
|
|
763
|
+
beginSwapIx: TransactionInstruction;
|
|
764
|
+
endSwapIx: TransactionInstruction;
|
|
765
|
+
}>;
|
|
721
766
|
liquidateBorrowForPerpPnl(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
722
767
|
getLiquidateBorrowForPerpPnlIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
723
768
|
liquidatePerpPnlForDeposit(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
@@ -3820,6 +3820,150 @@ class DriftClient {
|
|
|
3820
3820
|
remainingAccounts: remainingAccounts,
|
|
3821
3821
|
});
|
|
3822
3822
|
}
|
|
3823
|
+
async getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }) {
|
|
3824
|
+
const liabilityMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
3825
|
+
const assetMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
3826
|
+
if (!quote) {
|
|
3827
|
+
const fetchedQuote = await jupiterClient.getQuote({
|
|
3828
|
+
inputMint: assetMarket.mint,
|
|
3829
|
+
outputMint: liabilityMarket.mint,
|
|
3830
|
+
amount: swapAmount,
|
|
3831
|
+
slippageBps,
|
|
3832
|
+
swapMode,
|
|
3833
|
+
onlyDirectRoutes,
|
|
3834
|
+
});
|
|
3835
|
+
quote = fetchedQuote;
|
|
3836
|
+
}
|
|
3837
|
+
if (!quote) {
|
|
3838
|
+
throw new Error("Could not fetch Jupiter's quote. Please try again.");
|
|
3839
|
+
}
|
|
3840
|
+
const amountIn = new anchor_1.BN(quote.inAmount);
|
|
3841
|
+
const transaction = await jupiterClient.getSwap({
|
|
3842
|
+
quote,
|
|
3843
|
+
userPublicKey: this.provider.wallet.publicKey,
|
|
3844
|
+
slippageBps,
|
|
3845
|
+
});
|
|
3846
|
+
const { transactionMessage, lookupTables } = await jupiterClient.getTransactionMessageAndLookupTables({
|
|
3847
|
+
transaction,
|
|
3848
|
+
});
|
|
3849
|
+
const jupiterInstructions = jupiterClient.getJupiterInstructions({
|
|
3850
|
+
transactionMessage,
|
|
3851
|
+
inputMint: assetMarket.mint,
|
|
3852
|
+
outputMint: liabilityMarket.mint,
|
|
3853
|
+
});
|
|
3854
|
+
const preInstructions = [];
|
|
3855
|
+
if (!liabilityTokenAccount) {
|
|
3856
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(liabilityMarket);
|
|
3857
|
+
liabilityTokenAccount = await this.getAssociatedTokenAccount(liabilityMarket.marketIndex, false, tokenProgram);
|
|
3858
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(liabilityTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, liabilityMarket.mint, tokenProgram));
|
|
3859
|
+
}
|
|
3860
|
+
if (!assetTokenAccount) {
|
|
3861
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(assetMarket);
|
|
3862
|
+
assetTokenAccount = await this.getAssociatedTokenAccount(assetMarket.marketIndex, false, tokenProgram);
|
|
3863
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(assetTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, assetMarket.mint, tokenProgram));
|
|
3864
|
+
}
|
|
3865
|
+
const { beginSwapIx, endSwapIx } = await this.getLiquidateSpotWithSwapIx({
|
|
3866
|
+
liabilityMarketIndex,
|
|
3867
|
+
assetMarketIndex,
|
|
3868
|
+
swapAmount: amountIn,
|
|
3869
|
+
assetTokenAccount,
|
|
3870
|
+
liabilityTokenAccount,
|
|
3871
|
+
userAccount,
|
|
3872
|
+
userAccountPublicKey,
|
|
3873
|
+
userStatsAccountPublicKey,
|
|
3874
|
+
liquidatorSubAccountId,
|
|
3875
|
+
});
|
|
3876
|
+
const ixs = [
|
|
3877
|
+
...preInstructions,
|
|
3878
|
+
beginSwapIx,
|
|
3879
|
+
...jupiterInstructions,
|
|
3880
|
+
endSwapIx,
|
|
3881
|
+
];
|
|
3882
|
+
return { ixs, lookupTables };
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
3886
|
+
*
|
|
3887
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
3888
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
3889
|
+
* @param amountIn the amount of the token to sell
|
|
3890
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
3891
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
3892
|
+
* @param userAccount
|
|
3893
|
+
* @param userAccountPublicKey
|
|
3894
|
+
* @param userStatsAccountPublicKey
|
|
3895
|
+
*/
|
|
3896
|
+
async getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }) {
|
|
3897
|
+
const liquidatorAccountPublicKey = await this.getUserAccountPublicKey(liquidatorSubAccountId);
|
|
3898
|
+
const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3899
|
+
const userAccounts = [userAccount];
|
|
3900
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
3901
|
+
userAccounts,
|
|
3902
|
+
writableSpotMarketIndexes: [liabilityMarketIndex, assetMarketIndex],
|
|
3903
|
+
readableSpotMarketIndexes: [numericConstants_1.QUOTE_SPOT_MARKET_INDEX],
|
|
3904
|
+
});
|
|
3905
|
+
const liabilitySpotMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
3906
|
+
const assetSpotMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
3907
|
+
const liabilityTokenProgram = this.getTokenProgramForSpotMarket(liabilitySpotMarket);
|
|
3908
|
+
const assetTokenProgram = this.getTokenProgramForSpotMarket(assetSpotMarket);
|
|
3909
|
+
if (!liabilityTokenProgram.equals(assetTokenProgram)) {
|
|
3910
|
+
remainingAccounts.push({
|
|
3911
|
+
pubkey: liabilityTokenProgram,
|
|
3912
|
+
isWritable: false,
|
|
3913
|
+
isSigner: false,
|
|
3914
|
+
});
|
|
3915
|
+
}
|
|
3916
|
+
if (liabilitySpotMarket.tokenProgram === 1 ||
|
|
3917
|
+
assetSpotMarket.tokenProgram === 1) {
|
|
3918
|
+
remainingAccounts.push({
|
|
3919
|
+
pubkey: assetSpotMarket.mint,
|
|
3920
|
+
isWritable: false,
|
|
3921
|
+
isSigner: false,
|
|
3922
|
+
});
|
|
3923
|
+
remainingAccounts.push({
|
|
3924
|
+
pubkey: liabilitySpotMarket.mint,
|
|
3925
|
+
isWritable: false,
|
|
3926
|
+
isSigner: false,
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
const beginSwapIx = await this.program.instruction.liquidateSpotWithSwapBegin(assetMarketIndex, liabilityMarketIndex, swapAmount, {
|
|
3930
|
+
accounts: {
|
|
3931
|
+
state: await this.getStatePublicKey(),
|
|
3932
|
+
user: userAccountPublicKey,
|
|
3933
|
+
userStats: userStatsAccountPublicKey,
|
|
3934
|
+
liquidator: liquidatorAccountPublicKey,
|
|
3935
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
3936
|
+
authority: this.wallet.publicKey,
|
|
3937
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
3938
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
3939
|
+
assetTokenAccount: assetTokenAccount,
|
|
3940
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
3941
|
+
tokenProgram: assetTokenProgram,
|
|
3942
|
+
driftSigner: this.getStateAccount().signer,
|
|
3943
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3944
|
+
},
|
|
3945
|
+
remainingAccounts,
|
|
3946
|
+
});
|
|
3947
|
+
const endSwapIx = await this.program.instruction.liquidateSpotWithSwapEnd(assetMarketIndex, liabilityMarketIndex, {
|
|
3948
|
+
accounts: {
|
|
3949
|
+
state: await this.getStatePublicKey(),
|
|
3950
|
+
user: userAccountPublicKey,
|
|
3951
|
+
userStats: userStatsAccountPublicKey,
|
|
3952
|
+
liquidator: liquidatorAccountPublicKey,
|
|
3953
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
3954
|
+
authority: this.wallet.publicKey,
|
|
3955
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
3956
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
3957
|
+
assetTokenAccount: assetTokenAccount,
|
|
3958
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
3959
|
+
tokenProgram: assetTokenProgram,
|
|
3960
|
+
driftSigner: this.getStateAccount().signer,
|
|
3961
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3962
|
+
},
|
|
3963
|
+
remainingAccounts,
|
|
3964
|
+
});
|
|
3965
|
+
return { beginSwapIx, endSwapIx };
|
|
3966
|
+
}
|
|
3823
3967
|
async liquidateBorrowForPerpPnl(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, txParams, liquidatorSubAccountId) {
|
|
3824
3968
|
const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(await this.getLiquidateBorrowForPerpPnlIx(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, liquidatorSubAccountId), txParams), [], this.opts);
|
|
3825
3969
|
this.perpMarketLastSlotCache.set(perpMarketIndex, slot);
|
|
@@ -2279,6 +2279,176 @@
|
|
|
2279
2279
|
}
|
|
2280
2280
|
]
|
|
2281
2281
|
},
|
|
2282
|
+
{
|
|
2283
|
+
"name": "liquidateSpotWithSwapBegin",
|
|
2284
|
+
"accounts": [
|
|
2285
|
+
{
|
|
2286
|
+
"name": "state",
|
|
2287
|
+
"isMut": false,
|
|
2288
|
+
"isSigner": false
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
"name": "authority",
|
|
2292
|
+
"isMut": false,
|
|
2293
|
+
"isSigner": true
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
"name": "liquidator",
|
|
2297
|
+
"isMut": true,
|
|
2298
|
+
"isSigner": false
|
|
2299
|
+
},
|
|
2300
|
+
{
|
|
2301
|
+
"name": "liquidatorStats",
|
|
2302
|
+
"isMut": true,
|
|
2303
|
+
"isSigner": false
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"name": "user",
|
|
2307
|
+
"isMut": true,
|
|
2308
|
+
"isSigner": false
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
"name": "userStats",
|
|
2312
|
+
"isMut": true,
|
|
2313
|
+
"isSigner": false
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
"name": "liabilitySpotMarketVault",
|
|
2317
|
+
"isMut": true,
|
|
2318
|
+
"isSigner": false
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
"name": "assetSpotMarketVault",
|
|
2322
|
+
"isMut": true,
|
|
2323
|
+
"isSigner": false
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
"name": "liabilityTokenAccount",
|
|
2327
|
+
"isMut": true,
|
|
2328
|
+
"isSigner": false
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
"name": "assetTokenAccount",
|
|
2332
|
+
"isMut": true,
|
|
2333
|
+
"isSigner": false
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
"name": "tokenProgram",
|
|
2337
|
+
"isMut": false,
|
|
2338
|
+
"isSigner": false
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
"name": "driftSigner",
|
|
2342
|
+
"isMut": false,
|
|
2343
|
+
"isSigner": false
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
"name": "instructions",
|
|
2347
|
+
"isMut": false,
|
|
2348
|
+
"isSigner": false,
|
|
2349
|
+
"docs": [
|
|
2350
|
+
"Instructions Sysvar for instruction introspection"
|
|
2351
|
+
]
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
"args": [
|
|
2355
|
+
{
|
|
2356
|
+
"name": "assetMarketIndex",
|
|
2357
|
+
"type": "u16"
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
"name": "liabilityMarketIndex",
|
|
2361
|
+
"type": "u16"
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
"name": "swapAmount",
|
|
2365
|
+
"type": "u64"
|
|
2366
|
+
}
|
|
2367
|
+
]
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
"name": "liquidateSpotWithSwapEnd",
|
|
2371
|
+
"accounts": [
|
|
2372
|
+
{
|
|
2373
|
+
"name": "state",
|
|
2374
|
+
"isMut": false,
|
|
2375
|
+
"isSigner": false
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
"name": "authority",
|
|
2379
|
+
"isMut": false,
|
|
2380
|
+
"isSigner": true
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
"name": "liquidator",
|
|
2384
|
+
"isMut": true,
|
|
2385
|
+
"isSigner": false
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
"name": "liquidatorStats",
|
|
2389
|
+
"isMut": true,
|
|
2390
|
+
"isSigner": false
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
"name": "user",
|
|
2394
|
+
"isMut": true,
|
|
2395
|
+
"isSigner": false
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
"name": "userStats",
|
|
2399
|
+
"isMut": true,
|
|
2400
|
+
"isSigner": false
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
"name": "liabilitySpotMarketVault",
|
|
2404
|
+
"isMut": true,
|
|
2405
|
+
"isSigner": false
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
"name": "assetSpotMarketVault",
|
|
2409
|
+
"isMut": true,
|
|
2410
|
+
"isSigner": false
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
"name": "liabilityTokenAccount",
|
|
2414
|
+
"isMut": true,
|
|
2415
|
+
"isSigner": false
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
"name": "assetTokenAccount",
|
|
2419
|
+
"isMut": true,
|
|
2420
|
+
"isSigner": false
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"name": "tokenProgram",
|
|
2424
|
+
"isMut": false,
|
|
2425
|
+
"isSigner": false
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
"name": "driftSigner",
|
|
2429
|
+
"isMut": false,
|
|
2430
|
+
"isSigner": false
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
"name": "instructions",
|
|
2434
|
+
"isMut": false,
|
|
2435
|
+
"isSigner": false,
|
|
2436
|
+
"docs": [
|
|
2437
|
+
"Instructions Sysvar for instruction introspection"
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
],
|
|
2441
|
+
"args": [
|
|
2442
|
+
{
|
|
2443
|
+
"name": "assetMarketIndex",
|
|
2444
|
+
"type": "u16"
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
"name": "liabilityMarketIndex",
|
|
2448
|
+
"type": "u16"
|
|
2449
|
+
}
|
|
2450
|
+
]
|
|
2451
|
+
},
|
|
2282
2452
|
{
|
|
2283
2453
|
"name": "liquidateBorrowForPerpPnl",
|
|
2284
2454
|
"accounts": [
|
|
@@ -6111,7 +6281,7 @@
|
|
|
6111
6281
|
{
|
|
6112
6282
|
"name": "fuelBoostDeposits",
|
|
6113
6283
|
"type": {
|
|
6114
|
-
"option": "
|
|
6284
|
+
"option": "i32"
|
|
6115
6285
|
}
|
|
6116
6286
|
},
|
|
6117
6287
|
{
|
|
@@ -14475,6 +14645,11 @@
|
|
|
14475
14645
|
"code": 6307,
|
|
14476
14646
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14477
14647
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14648
|
+
},
|
|
14649
|
+
{
|
|
14650
|
+
"code": 6308,
|
|
14651
|
+
"name": "InvalidLiquidateSpotWithSwap",
|
|
14652
|
+
"msg": "InvalidLiquidateSpotWithSwap"
|
|
14478
14653
|
}
|
|
14479
14654
|
]
|
|
14480
14655
|
}
|
|
@@ -718,6 +718,51 @@ export declare class DriftClient {
|
|
|
718
718
|
getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
719
719
|
liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
720
720
|
getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
721
|
+
getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
|
|
722
|
+
jupiterClient: JupiterClient;
|
|
723
|
+
liabilityMarketIndex: number;
|
|
724
|
+
assetMarketIndex: number;
|
|
725
|
+
assetTokenAccount?: PublicKey;
|
|
726
|
+
liabilityTokenAccount?: PublicKey;
|
|
727
|
+
swapAmount: BN;
|
|
728
|
+
slippageBps?: number;
|
|
729
|
+
swapMode?: SwapMode;
|
|
730
|
+
onlyDirectRoutes?: boolean;
|
|
731
|
+
quote?: QuoteResponse;
|
|
732
|
+
userAccount: UserAccount;
|
|
733
|
+
userAccountPublicKey: PublicKey;
|
|
734
|
+
userStatsAccountPublicKey: PublicKey;
|
|
735
|
+
liquidatorSubAccountId?: number;
|
|
736
|
+
}): Promise<{
|
|
737
|
+
ixs: TransactionInstruction[];
|
|
738
|
+
lookupTables: AddressLookupTableAccount[];
|
|
739
|
+
}>;
|
|
740
|
+
/**
|
|
741
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
742
|
+
*
|
|
743
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
744
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
745
|
+
* @param amountIn the amount of the token to sell
|
|
746
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
747
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
748
|
+
* @param userAccount
|
|
749
|
+
* @param userAccountPublicKey
|
|
750
|
+
* @param userStatsAccountPublicKey
|
|
751
|
+
*/
|
|
752
|
+
getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
|
|
753
|
+
liabilityMarketIndex: number;
|
|
754
|
+
assetMarketIndex: number;
|
|
755
|
+
swapAmount: BN;
|
|
756
|
+
assetTokenAccount: PublicKey;
|
|
757
|
+
liabilityTokenAccount: PublicKey;
|
|
758
|
+
userAccount: UserAccount;
|
|
759
|
+
userAccountPublicKey: PublicKey;
|
|
760
|
+
userStatsAccountPublicKey: PublicKey;
|
|
761
|
+
liquidatorSubAccountId?: number;
|
|
762
|
+
}): Promise<{
|
|
763
|
+
beginSwapIx: TransactionInstruction;
|
|
764
|
+
endSwapIx: TransactionInstruction;
|
|
765
|
+
}>;
|
|
721
766
|
liquidateBorrowForPerpPnl(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
722
767
|
getLiquidateBorrowForPerpPnlIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
723
768
|
liquidatePerpPnlForDeposit(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -3820,6 +3820,150 @@ class DriftClient {
|
|
|
3820
3820
|
remainingAccounts: remainingAccounts,
|
|
3821
3821
|
});
|
|
3822
3822
|
}
|
|
3823
|
+
async getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }) {
|
|
3824
|
+
const liabilityMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
3825
|
+
const assetMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
3826
|
+
if (!quote) {
|
|
3827
|
+
const fetchedQuote = await jupiterClient.getQuote({
|
|
3828
|
+
inputMint: assetMarket.mint,
|
|
3829
|
+
outputMint: liabilityMarket.mint,
|
|
3830
|
+
amount: swapAmount,
|
|
3831
|
+
slippageBps,
|
|
3832
|
+
swapMode,
|
|
3833
|
+
onlyDirectRoutes,
|
|
3834
|
+
});
|
|
3835
|
+
quote = fetchedQuote;
|
|
3836
|
+
}
|
|
3837
|
+
if (!quote) {
|
|
3838
|
+
throw new Error("Could not fetch Jupiter's quote. Please try again.");
|
|
3839
|
+
}
|
|
3840
|
+
const amountIn = new anchor_1.BN(quote.inAmount);
|
|
3841
|
+
const transaction = await jupiterClient.getSwap({
|
|
3842
|
+
quote,
|
|
3843
|
+
userPublicKey: this.provider.wallet.publicKey,
|
|
3844
|
+
slippageBps,
|
|
3845
|
+
});
|
|
3846
|
+
const { transactionMessage, lookupTables } = await jupiterClient.getTransactionMessageAndLookupTables({
|
|
3847
|
+
transaction,
|
|
3848
|
+
});
|
|
3849
|
+
const jupiterInstructions = jupiterClient.getJupiterInstructions({
|
|
3850
|
+
transactionMessage,
|
|
3851
|
+
inputMint: assetMarket.mint,
|
|
3852
|
+
outputMint: liabilityMarket.mint,
|
|
3853
|
+
});
|
|
3854
|
+
const preInstructions = [];
|
|
3855
|
+
if (!liabilityTokenAccount) {
|
|
3856
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(liabilityMarket);
|
|
3857
|
+
liabilityTokenAccount = await this.getAssociatedTokenAccount(liabilityMarket.marketIndex, false, tokenProgram);
|
|
3858
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(liabilityTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, liabilityMarket.mint, tokenProgram));
|
|
3859
|
+
}
|
|
3860
|
+
if (!assetTokenAccount) {
|
|
3861
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(assetMarket);
|
|
3862
|
+
assetTokenAccount = await this.getAssociatedTokenAccount(assetMarket.marketIndex, false, tokenProgram);
|
|
3863
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(assetTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, assetMarket.mint, tokenProgram));
|
|
3864
|
+
}
|
|
3865
|
+
const { beginSwapIx, endSwapIx } = await this.getLiquidateSpotWithSwapIx({
|
|
3866
|
+
liabilityMarketIndex,
|
|
3867
|
+
assetMarketIndex,
|
|
3868
|
+
swapAmount: amountIn,
|
|
3869
|
+
assetTokenAccount,
|
|
3870
|
+
liabilityTokenAccount,
|
|
3871
|
+
userAccount,
|
|
3872
|
+
userAccountPublicKey,
|
|
3873
|
+
userStatsAccountPublicKey,
|
|
3874
|
+
liquidatorSubAccountId,
|
|
3875
|
+
});
|
|
3876
|
+
const ixs = [
|
|
3877
|
+
...preInstructions,
|
|
3878
|
+
beginSwapIx,
|
|
3879
|
+
...jupiterInstructions,
|
|
3880
|
+
endSwapIx,
|
|
3881
|
+
];
|
|
3882
|
+
return { ixs, lookupTables };
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
3886
|
+
*
|
|
3887
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
3888
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
3889
|
+
* @param amountIn the amount of the token to sell
|
|
3890
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
3891
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
3892
|
+
* @param userAccount
|
|
3893
|
+
* @param userAccountPublicKey
|
|
3894
|
+
* @param userStatsAccountPublicKey
|
|
3895
|
+
*/
|
|
3896
|
+
async getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }) {
|
|
3897
|
+
const liquidatorAccountPublicKey = await this.getUserAccountPublicKey(liquidatorSubAccountId);
|
|
3898
|
+
const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3899
|
+
const userAccounts = [userAccount];
|
|
3900
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
3901
|
+
userAccounts,
|
|
3902
|
+
writableSpotMarketIndexes: [liabilityMarketIndex, assetMarketIndex],
|
|
3903
|
+
readableSpotMarketIndexes: [numericConstants_1.QUOTE_SPOT_MARKET_INDEX],
|
|
3904
|
+
});
|
|
3905
|
+
const liabilitySpotMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
3906
|
+
const assetSpotMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
3907
|
+
const liabilityTokenProgram = this.getTokenProgramForSpotMarket(liabilitySpotMarket);
|
|
3908
|
+
const assetTokenProgram = this.getTokenProgramForSpotMarket(assetSpotMarket);
|
|
3909
|
+
if (!liabilityTokenProgram.equals(assetTokenProgram)) {
|
|
3910
|
+
remainingAccounts.push({
|
|
3911
|
+
pubkey: liabilityTokenProgram,
|
|
3912
|
+
isWritable: false,
|
|
3913
|
+
isSigner: false,
|
|
3914
|
+
});
|
|
3915
|
+
}
|
|
3916
|
+
if (liabilitySpotMarket.tokenProgram === 1 ||
|
|
3917
|
+
assetSpotMarket.tokenProgram === 1) {
|
|
3918
|
+
remainingAccounts.push({
|
|
3919
|
+
pubkey: assetSpotMarket.mint,
|
|
3920
|
+
isWritable: false,
|
|
3921
|
+
isSigner: false,
|
|
3922
|
+
});
|
|
3923
|
+
remainingAccounts.push({
|
|
3924
|
+
pubkey: liabilitySpotMarket.mint,
|
|
3925
|
+
isWritable: false,
|
|
3926
|
+
isSigner: false,
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
const beginSwapIx = await this.program.instruction.liquidateSpotWithSwapBegin(assetMarketIndex, liabilityMarketIndex, swapAmount, {
|
|
3930
|
+
accounts: {
|
|
3931
|
+
state: await this.getStatePublicKey(),
|
|
3932
|
+
user: userAccountPublicKey,
|
|
3933
|
+
userStats: userStatsAccountPublicKey,
|
|
3934
|
+
liquidator: liquidatorAccountPublicKey,
|
|
3935
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
3936
|
+
authority: this.wallet.publicKey,
|
|
3937
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
3938
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
3939
|
+
assetTokenAccount: assetTokenAccount,
|
|
3940
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
3941
|
+
tokenProgram: assetTokenProgram,
|
|
3942
|
+
driftSigner: this.getStateAccount().signer,
|
|
3943
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3944
|
+
},
|
|
3945
|
+
remainingAccounts,
|
|
3946
|
+
});
|
|
3947
|
+
const endSwapIx = await this.program.instruction.liquidateSpotWithSwapEnd(assetMarketIndex, liabilityMarketIndex, {
|
|
3948
|
+
accounts: {
|
|
3949
|
+
state: await this.getStatePublicKey(),
|
|
3950
|
+
user: userAccountPublicKey,
|
|
3951
|
+
userStats: userStatsAccountPublicKey,
|
|
3952
|
+
liquidator: liquidatorAccountPublicKey,
|
|
3953
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
3954
|
+
authority: this.wallet.publicKey,
|
|
3955
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
3956
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
3957
|
+
assetTokenAccount: assetTokenAccount,
|
|
3958
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
3959
|
+
tokenProgram: assetTokenProgram,
|
|
3960
|
+
driftSigner: this.getStateAccount().signer,
|
|
3961
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3962
|
+
},
|
|
3963
|
+
remainingAccounts,
|
|
3964
|
+
});
|
|
3965
|
+
return { beginSwapIx, endSwapIx };
|
|
3966
|
+
}
|
|
3823
3967
|
async liquidateBorrowForPerpPnl(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, txParams, liquidatorSubAccountId) {
|
|
3824
3968
|
const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(await this.getLiquidateBorrowForPerpPnlIx(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, liquidatorSubAccountId), txParams), [], this.opts);
|
|
3825
3969
|
this.perpMarketLastSlotCache.set(perpMarketIndex, slot);
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -2279,6 +2279,176 @@
|
|
|
2279
2279
|
}
|
|
2280
2280
|
]
|
|
2281
2281
|
},
|
|
2282
|
+
{
|
|
2283
|
+
"name": "liquidateSpotWithSwapBegin",
|
|
2284
|
+
"accounts": [
|
|
2285
|
+
{
|
|
2286
|
+
"name": "state",
|
|
2287
|
+
"isMut": false,
|
|
2288
|
+
"isSigner": false
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
"name": "authority",
|
|
2292
|
+
"isMut": false,
|
|
2293
|
+
"isSigner": true
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
"name": "liquidator",
|
|
2297
|
+
"isMut": true,
|
|
2298
|
+
"isSigner": false
|
|
2299
|
+
},
|
|
2300
|
+
{
|
|
2301
|
+
"name": "liquidatorStats",
|
|
2302
|
+
"isMut": true,
|
|
2303
|
+
"isSigner": false
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"name": "user",
|
|
2307
|
+
"isMut": true,
|
|
2308
|
+
"isSigner": false
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
"name": "userStats",
|
|
2312
|
+
"isMut": true,
|
|
2313
|
+
"isSigner": false
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
"name": "liabilitySpotMarketVault",
|
|
2317
|
+
"isMut": true,
|
|
2318
|
+
"isSigner": false
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
"name": "assetSpotMarketVault",
|
|
2322
|
+
"isMut": true,
|
|
2323
|
+
"isSigner": false
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
"name": "liabilityTokenAccount",
|
|
2327
|
+
"isMut": true,
|
|
2328
|
+
"isSigner": false
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
"name": "assetTokenAccount",
|
|
2332
|
+
"isMut": true,
|
|
2333
|
+
"isSigner": false
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
"name": "tokenProgram",
|
|
2337
|
+
"isMut": false,
|
|
2338
|
+
"isSigner": false
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
"name": "driftSigner",
|
|
2342
|
+
"isMut": false,
|
|
2343
|
+
"isSigner": false
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
"name": "instructions",
|
|
2347
|
+
"isMut": false,
|
|
2348
|
+
"isSigner": false,
|
|
2349
|
+
"docs": [
|
|
2350
|
+
"Instructions Sysvar for instruction introspection"
|
|
2351
|
+
]
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
"args": [
|
|
2355
|
+
{
|
|
2356
|
+
"name": "assetMarketIndex",
|
|
2357
|
+
"type": "u16"
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
"name": "liabilityMarketIndex",
|
|
2361
|
+
"type": "u16"
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
"name": "swapAmount",
|
|
2365
|
+
"type": "u64"
|
|
2366
|
+
}
|
|
2367
|
+
]
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
"name": "liquidateSpotWithSwapEnd",
|
|
2371
|
+
"accounts": [
|
|
2372
|
+
{
|
|
2373
|
+
"name": "state",
|
|
2374
|
+
"isMut": false,
|
|
2375
|
+
"isSigner": false
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
"name": "authority",
|
|
2379
|
+
"isMut": false,
|
|
2380
|
+
"isSigner": true
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
"name": "liquidator",
|
|
2384
|
+
"isMut": true,
|
|
2385
|
+
"isSigner": false
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
"name": "liquidatorStats",
|
|
2389
|
+
"isMut": true,
|
|
2390
|
+
"isSigner": false
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
"name": "user",
|
|
2394
|
+
"isMut": true,
|
|
2395
|
+
"isSigner": false
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
"name": "userStats",
|
|
2399
|
+
"isMut": true,
|
|
2400
|
+
"isSigner": false
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
"name": "liabilitySpotMarketVault",
|
|
2404
|
+
"isMut": true,
|
|
2405
|
+
"isSigner": false
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
"name": "assetSpotMarketVault",
|
|
2409
|
+
"isMut": true,
|
|
2410
|
+
"isSigner": false
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
"name": "liabilityTokenAccount",
|
|
2414
|
+
"isMut": true,
|
|
2415
|
+
"isSigner": false
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
"name": "assetTokenAccount",
|
|
2419
|
+
"isMut": true,
|
|
2420
|
+
"isSigner": false
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"name": "tokenProgram",
|
|
2424
|
+
"isMut": false,
|
|
2425
|
+
"isSigner": false
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
"name": "driftSigner",
|
|
2429
|
+
"isMut": false,
|
|
2430
|
+
"isSigner": false
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
"name": "instructions",
|
|
2434
|
+
"isMut": false,
|
|
2435
|
+
"isSigner": false,
|
|
2436
|
+
"docs": [
|
|
2437
|
+
"Instructions Sysvar for instruction introspection"
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
],
|
|
2441
|
+
"args": [
|
|
2442
|
+
{
|
|
2443
|
+
"name": "assetMarketIndex",
|
|
2444
|
+
"type": "u16"
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
"name": "liabilityMarketIndex",
|
|
2448
|
+
"type": "u16"
|
|
2449
|
+
}
|
|
2450
|
+
]
|
|
2451
|
+
},
|
|
2282
2452
|
{
|
|
2283
2453
|
"name": "liquidateBorrowForPerpPnl",
|
|
2284
2454
|
"accounts": [
|
|
@@ -6111,7 +6281,7 @@
|
|
|
6111
6281
|
{
|
|
6112
6282
|
"name": "fuelBoostDeposits",
|
|
6113
6283
|
"type": {
|
|
6114
|
-
"option": "
|
|
6284
|
+
"option": "i32"
|
|
6115
6285
|
}
|
|
6116
6286
|
},
|
|
6117
6287
|
{
|
|
@@ -14475,6 +14645,11 @@
|
|
|
14475
14645
|
"code": 6307,
|
|
14476
14646
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14477
14647
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14648
|
+
},
|
|
14649
|
+
{
|
|
14650
|
+
"code": 6308,
|
|
14651
|
+
"name": "InvalidLiquidateSpotWithSwap",
|
|
14652
|
+
"msg": "InvalidLiquidateSpotWithSwap"
|
|
14478
14653
|
}
|
|
14479
14654
|
]
|
|
14480
14655
|
}
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -7219,6 +7219,271 @@ export class DriftClient {
|
|
|
7219
7219
|
);
|
|
7220
7220
|
}
|
|
7221
7221
|
|
|
7222
|
+
public async getJupiterLiquidateSpotWithSwapIxV6({
|
|
7223
|
+
jupiterClient,
|
|
7224
|
+
liabilityMarketIndex,
|
|
7225
|
+
assetMarketIndex,
|
|
7226
|
+
swapAmount,
|
|
7227
|
+
assetTokenAccount,
|
|
7228
|
+
liabilityTokenAccount,
|
|
7229
|
+
slippageBps,
|
|
7230
|
+
swapMode,
|
|
7231
|
+
onlyDirectRoutes,
|
|
7232
|
+
quote,
|
|
7233
|
+
userAccount,
|
|
7234
|
+
userAccountPublicKey,
|
|
7235
|
+
userStatsAccountPublicKey,
|
|
7236
|
+
liquidatorSubAccountId,
|
|
7237
|
+
}: {
|
|
7238
|
+
jupiterClient: JupiterClient;
|
|
7239
|
+
liabilityMarketIndex: number;
|
|
7240
|
+
assetMarketIndex: number;
|
|
7241
|
+
assetTokenAccount?: PublicKey;
|
|
7242
|
+
liabilityTokenAccount?: PublicKey;
|
|
7243
|
+
swapAmount: BN;
|
|
7244
|
+
slippageBps?: number;
|
|
7245
|
+
swapMode?: SwapMode;
|
|
7246
|
+
onlyDirectRoutes?: boolean;
|
|
7247
|
+
quote?: QuoteResponse;
|
|
7248
|
+
userAccount: UserAccount;
|
|
7249
|
+
userAccountPublicKey: PublicKey;
|
|
7250
|
+
userStatsAccountPublicKey: PublicKey;
|
|
7251
|
+
liquidatorSubAccountId?: number;
|
|
7252
|
+
}): Promise<{
|
|
7253
|
+
ixs: TransactionInstruction[];
|
|
7254
|
+
lookupTables: AddressLookupTableAccount[];
|
|
7255
|
+
}> {
|
|
7256
|
+
const liabilityMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
7257
|
+
const assetMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
7258
|
+
|
|
7259
|
+
if (!quote) {
|
|
7260
|
+
const fetchedQuote = await jupiterClient.getQuote({
|
|
7261
|
+
inputMint: assetMarket.mint,
|
|
7262
|
+
outputMint: liabilityMarket.mint,
|
|
7263
|
+
amount: swapAmount,
|
|
7264
|
+
slippageBps,
|
|
7265
|
+
swapMode,
|
|
7266
|
+
onlyDirectRoutes,
|
|
7267
|
+
});
|
|
7268
|
+
|
|
7269
|
+
quote = fetchedQuote;
|
|
7270
|
+
}
|
|
7271
|
+
|
|
7272
|
+
if (!quote) {
|
|
7273
|
+
throw new Error("Could not fetch Jupiter's quote. Please try again.");
|
|
7274
|
+
}
|
|
7275
|
+
|
|
7276
|
+
const amountIn = new BN(quote.inAmount);
|
|
7277
|
+
|
|
7278
|
+
const transaction = await jupiterClient.getSwap({
|
|
7279
|
+
quote,
|
|
7280
|
+
userPublicKey: this.provider.wallet.publicKey,
|
|
7281
|
+
slippageBps,
|
|
7282
|
+
});
|
|
7283
|
+
|
|
7284
|
+
const { transactionMessage, lookupTables } =
|
|
7285
|
+
await jupiterClient.getTransactionMessageAndLookupTables({
|
|
7286
|
+
transaction,
|
|
7287
|
+
});
|
|
7288
|
+
|
|
7289
|
+
const jupiterInstructions = jupiterClient.getJupiterInstructions({
|
|
7290
|
+
transactionMessage,
|
|
7291
|
+
inputMint: assetMarket.mint,
|
|
7292
|
+
outputMint: liabilityMarket.mint,
|
|
7293
|
+
});
|
|
7294
|
+
|
|
7295
|
+
const preInstructions = [];
|
|
7296
|
+
if (!liabilityTokenAccount) {
|
|
7297
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(liabilityMarket);
|
|
7298
|
+
liabilityTokenAccount = await this.getAssociatedTokenAccount(
|
|
7299
|
+
liabilityMarket.marketIndex,
|
|
7300
|
+
false,
|
|
7301
|
+
tokenProgram
|
|
7302
|
+
);
|
|
7303
|
+
|
|
7304
|
+
preInstructions.push(
|
|
7305
|
+
this.createAssociatedTokenAccountIdempotentInstruction(
|
|
7306
|
+
liabilityTokenAccount,
|
|
7307
|
+
this.provider.wallet.publicKey,
|
|
7308
|
+
this.provider.wallet.publicKey,
|
|
7309
|
+
liabilityMarket.mint,
|
|
7310
|
+
tokenProgram
|
|
7311
|
+
)
|
|
7312
|
+
);
|
|
7313
|
+
}
|
|
7314
|
+
|
|
7315
|
+
if (!assetTokenAccount) {
|
|
7316
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(assetMarket);
|
|
7317
|
+
assetTokenAccount = await this.getAssociatedTokenAccount(
|
|
7318
|
+
assetMarket.marketIndex,
|
|
7319
|
+
false,
|
|
7320
|
+
tokenProgram
|
|
7321
|
+
);
|
|
7322
|
+
|
|
7323
|
+
preInstructions.push(
|
|
7324
|
+
this.createAssociatedTokenAccountIdempotentInstruction(
|
|
7325
|
+
assetTokenAccount,
|
|
7326
|
+
this.provider.wallet.publicKey,
|
|
7327
|
+
this.provider.wallet.publicKey,
|
|
7328
|
+
assetMarket.mint,
|
|
7329
|
+
tokenProgram
|
|
7330
|
+
)
|
|
7331
|
+
);
|
|
7332
|
+
}
|
|
7333
|
+
|
|
7334
|
+
const { beginSwapIx, endSwapIx } = await this.getLiquidateSpotWithSwapIx({
|
|
7335
|
+
liabilityMarketIndex,
|
|
7336
|
+
assetMarketIndex,
|
|
7337
|
+
swapAmount: amountIn,
|
|
7338
|
+
assetTokenAccount,
|
|
7339
|
+
liabilityTokenAccount,
|
|
7340
|
+
userAccount,
|
|
7341
|
+
userAccountPublicKey,
|
|
7342
|
+
userStatsAccountPublicKey,
|
|
7343
|
+
liquidatorSubAccountId,
|
|
7344
|
+
});
|
|
7345
|
+
|
|
7346
|
+
const ixs = [
|
|
7347
|
+
...preInstructions,
|
|
7348
|
+
beginSwapIx,
|
|
7349
|
+
...jupiterInstructions,
|
|
7350
|
+
endSwapIx,
|
|
7351
|
+
];
|
|
7352
|
+
|
|
7353
|
+
return { ixs, lookupTables };
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
/**
|
|
7357
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
7358
|
+
*
|
|
7359
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
7360
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
7361
|
+
* @param amountIn the amount of the token to sell
|
|
7362
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
7363
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
7364
|
+
* @param userAccount
|
|
7365
|
+
* @param userAccountPublicKey
|
|
7366
|
+
* @param userStatsAccountPublicKey
|
|
7367
|
+
*/
|
|
7368
|
+
public async getLiquidateSpotWithSwapIx({
|
|
7369
|
+
liabilityMarketIndex,
|
|
7370
|
+
assetMarketIndex,
|
|
7371
|
+
swapAmount: swapAmount,
|
|
7372
|
+
assetTokenAccount,
|
|
7373
|
+
liabilityTokenAccount,
|
|
7374
|
+
userAccount,
|
|
7375
|
+
userAccountPublicKey,
|
|
7376
|
+
userStatsAccountPublicKey,
|
|
7377
|
+
liquidatorSubAccountId,
|
|
7378
|
+
}: {
|
|
7379
|
+
liabilityMarketIndex: number;
|
|
7380
|
+
assetMarketIndex: number;
|
|
7381
|
+
swapAmount: BN;
|
|
7382
|
+
assetTokenAccount: PublicKey;
|
|
7383
|
+
liabilityTokenAccount: PublicKey;
|
|
7384
|
+
userAccount: UserAccount;
|
|
7385
|
+
userAccountPublicKey: PublicKey;
|
|
7386
|
+
userStatsAccountPublicKey: PublicKey;
|
|
7387
|
+
liquidatorSubAccountId?: number;
|
|
7388
|
+
}): Promise<{
|
|
7389
|
+
beginSwapIx: TransactionInstruction;
|
|
7390
|
+
endSwapIx: TransactionInstruction;
|
|
7391
|
+
}> {
|
|
7392
|
+
const liquidatorAccountPublicKey = await this.getUserAccountPublicKey(
|
|
7393
|
+
liquidatorSubAccountId
|
|
7394
|
+
);
|
|
7395
|
+
const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
7396
|
+
|
|
7397
|
+
const userAccounts = [userAccount];
|
|
7398
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
7399
|
+
userAccounts,
|
|
7400
|
+
writableSpotMarketIndexes: [liabilityMarketIndex, assetMarketIndex],
|
|
7401
|
+
readableSpotMarketIndexes: [QUOTE_SPOT_MARKET_INDEX],
|
|
7402
|
+
});
|
|
7403
|
+
|
|
7404
|
+
const liabilitySpotMarket = this.getSpotMarketAccount(liabilityMarketIndex);
|
|
7405
|
+
const assetSpotMarket = this.getSpotMarketAccount(assetMarketIndex);
|
|
7406
|
+
|
|
7407
|
+
const liabilityTokenProgram =
|
|
7408
|
+
this.getTokenProgramForSpotMarket(liabilitySpotMarket);
|
|
7409
|
+
const assetTokenProgram =
|
|
7410
|
+
this.getTokenProgramForSpotMarket(assetSpotMarket);
|
|
7411
|
+
|
|
7412
|
+
if (!liabilityTokenProgram.equals(assetTokenProgram)) {
|
|
7413
|
+
remainingAccounts.push({
|
|
7414
|
+
pubkey: liabilityTokenProgram,
|
|
7415
|
+
isWritable: false,
|
|
7416
|
+
isSigner: false,
|
|
7417
|
+
});
|
|
7418
|
+
}
|
|
7419
|
+
|
|
7420
|
+
if (
|
|
7421
|
+
liabilitySpotMarket.tokenProgram === 1 ||
|
|
7422
|
+
assetSpotMarket.tokenProgram === 1
|
|
7423
|
+
) {
|
|
7424
|
+
remainingAccounts.push({
|
|
7425
|
+
pubkey: assetSpotMarket.mint,
|
|
7426
|
+
isWritable: false,
|
|
7427
|
+
isSigner: false,
|
|
7428
|
+
});
|
|
7429
|
+
remainingAccounts.push({
|
|
7430
|
+
pubkey: liabilitySpotMarket.mint,
|
|
7431
|
+
isWritable: false,
|
|
7432
|
+
isSigner: false,
|
|
7433
|
+
});
|
|
7434
|
+
}
|
|
7435
|
+
|
|
7436
|
+
const beginSwapIx =
|
|
7437
|
+
await this.program.instruction.liquidateSpotWithSwapBegin(
|
|
7438
|
+
assetMarketIndex,
|
|
7439
|
+
liabilityMarketIndex,
|
|
7440
|
+
swapAmount,
|
|
7441
|
+
{
|
|
7442
|
+
accounts: {
|
|
7443
|
+
state: await this.getStatePublicKey(),
|
|
7444
|
+
user: userAccountPublicKey,
|
|
7445
|
+
userStats: userStatsAccountPublicKey,
|
|
7446
|
+
liquidator: liquidatorAccountPublicKey,
|
|
7447
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
7448
|
+
authority: this.wallet.publicKey,
|
|
7449
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
7450
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
7451
|
+
assetTokenAccount: assetTokenAccount,
|
|
7452
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
7453
|
+
tokenProgram: assetTokenProgram,
|
|
7454
|
+
driftSigner: this.getStateAccount().signer,
|
|
7455
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
7456
|
+
},
|
|
7457
|
+
remainingAccounts,
|
|
7458
|
+
}
|
|
7459
|
+
);
|
|
7460
|
+
|
|
7461
|
+
const endSwapIx = await this.program.instruction.liquidateSpotWithSwapEnd(
|
|
7462
|
+
assetMarketIndex,
|
|
7463
|
+
liabilityMarketIndex,
|
|
7464
|
+
{
|
|
7465
|
+
accounts: {
|
|
7466
|
+
state: await this.getStatePublicKey(),
|
|
7467
|
+
user: userAccountPublicKey,
|
|
7468
|
+
userStats: userStatsAccountPublicKey,
|
|
7469
|
+
liquidator: liquidatorAccountPublicKey,
|
|
7470
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
7471
|
+
authority: this.wallet.publicKey,
|
|
7472
|
+
liabilitySpotMarketVault: liabilitySpotMarket.vault,
|
|
7473
|
+
assetSpotMarketVault: assetSpotMarket.vault,
|
|
7474
|
+
assetTokenAccount: assetTokenAccount,
|
|
7475
|
+
liabilityTokenAccount: liabilityTokenAccount,
|
|
7476
|
+
tokenProgram: assetTokenProgram,
|
|
7477
|
+
driftSigner: this.getStateAccount().signer,
|
|
7478
|
+
instructions: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
7479
|
+
},
|
|
7480
|
+
remainingAccounts,
|
|
7481
|
+
}
|
|
7482
|
+
);
|
|
7483
|
+
|
|
7484
|
+
return { beginSwapIx, endSwapIx };
|
|
7485
|
+
}
|
|
7486
|
+
|
|
7222
7487
|
public async liquidateBorrowForPerpPnl(
|
|
7223
7488
|
userAccountPublicKey: PublicKey,
|
|
7224
7489
|
userAccount: UserAccount,
|
package/src/idl/drift.json
CHANGED
|
@@ -2279,6 +2279,176 @@
|
|
|
2279
2279
|
}
|
|
2280
2280
|
]
|
|
2281
2281
|
},
|
|
2282
|
+
{
|
|
2283
|
+
"name": "liquidateSpotWithSwapBegin",
|
|
2284
|
+
"accounts": [
|
|
2285
|
+
{
|
|
2286
|
+
"name": "state",
|
|
2287
|
+
"isMut": false,
|
|
2288
|
+
"isSigner": false
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
"name": "authority",
|
|
2292
|
+
"isMut": false,
|
|
2293
|
+
"isSigner": true
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
"name": "liquidator",
|
|
2297
|
+
"isMut": true,
|
|
2298
|
+
"isSigner": false
|
|
2299
|
+
},
|
|
2300
|
+
{
|
|
2301
|
+
"name": "liquidatorStats",
|
|
2302
|
+
"isMut": true,
|
|
2303
|
+
"isSigner": false
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"name": "user",
|
|
2307
|
+
"isMut": true,
|
|
2308
|
+
"isSigner": false
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
"name": "userStats",
|
|
2312
|
+
"isMut": true,
|
|
2313
|
+
"isSigner": false
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
"name": "liabilitySpotMarketVault",
|
|
2317
|
+
"isMut": true,
|
|
2318
|
+
"isSigner": false
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
"name": "assetSpotMarketVault",
|
|
2322
|
+
"isMut": true,
|
|
2323
|
+
"isSigner": false
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
"name": "liabilityTokenAccount",
|
|
2327
|
+
"isMut": true,
|
|
2328
|
+
"isSigner": false
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
"name": "assetTokenAccount",
|
|
2332
|
+
"isMut": true,
|
|
2333
|
+
"isSigner": false
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
"name": "tokenProgram",
|
|
2337
|
+
"isMut": false,
|
|
2338
|
+
"isSigner": false
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
"name": "driftSigner",
|
|
2342
|
+
"isMut": false,
|
|
2343
|
+
"isSigner": false
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
"name": "instructions",
|
|
2347
|
+
"isMut": false,
|
|
2348
|
+
"isSigner": false,
|
|
2349
|
+
"docs": [
|
|
2350
|
+
"Instructions Sysvar for instruction introspection"
|
|
2351
|
+
]
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
"args": [
|
|
2355
|
+
{
|
|
2356
|
+
"name": "assetMarketIndex",
|
|
2357
|
+
"type": "u16"
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
"name": "liabilityMarketIndex",
|
|
2361
|
+
"type": "u16"
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
"name": "swapAmount",
|
|
2365
|
+
"type": "u64"
|
|
2366
|
+
}
|
|
2367
|
+
]
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
"name": "liquidateSpotWithSwapEnd",
|
|
2371
|
+
"accounts": [
|
|
2372
|
+
{
|
|
2373
|
+
"name": "state",
|
|
2374
|
+
"isMut": false,
|
|
2375
|
+
"isSigner": false
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
"name": "authority",
|
|
2379
|
+
"isMut": false,
|
|
2380
|
+
"isSigner": true
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
"name": "liquidator",
|
|
2384
|
+
"isMut": true,
|
|
2385
|
+
"isSigner": false
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
"name": "liquidatorStats",
|
|
2389
|
+
"isMut": true,
|
|
2390
|
+
"isSigner": false
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
"name": "user",
|
|
2394
|
+
"isMut": true,
|
|
2395
|
+
"isSigner": false
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
"name": "userStats",
|
|
2399
|
+
"isMut": true,
|
|
2400
|
+
"isSigner": false
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
"name": "liabilitySpotMarketVault",
|
|
2404
|
+
"isMut": true,
|
|
2405
|
+
"isSigner": false
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
"name": "assetSpotMarketVault",
|
|
2409
|
+
"isMut": true,
|
|
2410
|
+
"isSigner": false
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
"name": "liabilityTokenAccount",
|
|
2414
|
+
"isMut": true,
|
|
2415
|
+
"isSigner": false
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
"name": "assetTokenAccount",
|
|
2419
|
+
"isMut": true,
|
|
2420
|
+
"isSigner": false
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"name": "tokenProgram",
|
|
2424
|
+
"isMut": false,
|
|
2425
|
+
"isSigner": false
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
"name": "driftSigner",
|
|
2429
|
+
"isMut": false,
|
|
2430
|
+
"isSigner": false
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
"name": "instructions",
|
|
2434
|
+
"isMut": false,
|
|
2435
|
+
"isSigner": false,
|
|
2436
|
+
"docs": [
|
|
2437
|
+
"Instructions Sysvar for instruction introspection"
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
],
|
|
2441
|
+
"args": [
|
|
2442
|
+
{
|
|
2443
|
+
"name": "assetMarketIndex",
|
|
2444
|
+
"type": "u16"
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
"name": "liabilityMarketIndex",
|
|
2448
|
+
"type": "u16"
|
|
2449
|
+
}
|
|
2450
|
+
]
|
|
2451
|
+
},
|
|
2282
2452
|
{
|
|
2283
2453
|
"name": "liquidateBorrowForPerpPnl",
|
|
2284
2454
|
"accounts": [
|
|
@@ -6111,7 +6281,7 @@
|
|
|
6111
6281
|
{
|
|
6112
6282
|
"name": "fuelBoostDeposits",
|
|
6113
6283
|
"type": {
|
|
6114
|
-
"option": "
|
|
6284
|
+
"option": "i32"
|
|
6115
6285
|
}
|
|
6116
6286
|
},
|
|
6117
6287
|
{
|
|
@@ -14475,6 +14645,11 @@
|
|
|
14475
14645
|
"code": 6307,
|
|
14476
14646
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14477
14647
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14648
|
+
},
|
|
14649
|
+
{
|
|
14650
|
+
"code": 6308,
|
|
14651
|
+
"name": "InvalidLiquidateSpotWithSwap",
|
|
14652
|
+
"msg": "InvalidLiquidateSpotWithSwap"
|
|
14478
14653
|
}
|
|
14479
14654
|
]
|
|
14480
14655
|
}
|