@haven-fi/solauto-sdk 1.0.551 → 1.0.553
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.
@@ -13,6 +13,7 @@ export interface JupSwapDetails extends JupSwapInput {
|
|
13
13
|
slippageIncFactor?: number;
|
14
14
|
addPadding?: boolean;
|
15
15
|
jupQuote?: QuoteResponse;
|
16
|
+
wrapAndUnwrapSol?: boolean;
|
16
17
|
}
|
17
18
|
export declare function getJupQuote(swapDetails: JupSwapInput): Promise<QuoteResponse>;
|
18
19
|
export interface JupSwapTransaction {
|
@@ -22,6 +23,7 @@ export interface JupSwapTransaction {
|
|
22
23
|
setupInstructions: TransactionBuilder;
|
23
24
|
tokenLedgerIx?: TransactionBuilder;
|
24
25
|
swapIx: TransactionBuilder;
|
26
|
+
cleanupInstruction?: TransactionBuilder;
|
25
27
|
}
|
26
28
|
export declare function getJupSwapTransaction(signer: Signer, swapDetails: JupSwapDetails, attemptNum?: number): Promise<JupSwapTransaction>;
|
27
29
|
export declare function getJupPriceData(mints: PublicKey[], mayIncludeSpamTokens?: boolean): Promise<{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jupiterUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jupiterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA0B,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAGL,aAAa,EACd,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,iBAAiB,EAAE,SAAS,CAA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ClB,OAAO,CAAC,kBAAkB,CAAC,CA2F7B;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,SAAS,EAAE,EAClB,oBAAoB,CAAC,EAAE,OAAO;;GAwC/B"}
|
@@ -49,7 +49,7 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
49
49
|
swapRequest: {
|
50
50
|
userPublicKey: signer.publicKey.toString(),
|
51
51
|
quoteResponse,
|
52
|
-
wrapAndUnwrapSol: false,
|
52
|
+
wrapAndUnwrapSol: swapDetails.wrapAndUnwrapSol ?? false,
|
53
53
|
useTokenLedger: !swapDetails.exactOut && !swapDetails.exactIn,
|
54
54
|
destinationTokenAccount: (0, accountUtils_1.getTokenAccount)(swapDetails.destinationWallet, swapDetails.outputMint).toString(),
|
55
55
|
},
|
@@ -77,10 +77,13 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
77
77
|
priceImpactBps: finalPriceImpactBps,
|
78
78
|
lookupTableAddresses: instructions.addressLookupTableAddresses,
|
79
79
|
setupInstructions: (0, umi_1.transactionBuilder)().add((instructions.setupInstructions ?? []).map((ix) => (0, solanaUtils_1.getWrappedInstruction)(signer, createTransactionInstruction(ix)))),
|
80
|
-
tokenLedgerIx: instructions.tokenLedgerInstruction
|
80
|
+
tokenLedgerIx: instructions.tokenLedgerInstruction
|
81
81
|
? (0, umi_1.transactionBuilder)().add((0, solanaUtils_1.getWrappedInstruction)(signer, createTransactionInstruction(instructions.tokenLedgerInstruction)))
|
82
82
|
: undefined,
|
83
83
|
swapIx: (0, umi_1.transactionBuilder)().add((0, solanaUtils_1.getWrappedInstruction)(signer, createTransactionInstruction(instructions.swapInstruction))),
|
84
|
+
cleanupInstruction: instructions.cleanupInstruction
|
85
|
+
? (0, umi_1.transactionBuilder)().add((0, solanaUtils_1.getWrappedInstruction)(signer, createTransactionInstruction(instructions.cleanupInstruction)))
|
86
|
+
: undefined,
|
84
87
|
};
|
85
88
|
}
|
86
89
|
async function getJupPriceData(mints, mayIncludeSpamTokens) {
|
package/package.json
CHANGED
@@ -33,6 +33,7 @@ export interface JupSwapDetails extends JupSwapInput {
|
|
33
33
|
slippageIncFactor?: number;
|
34
34
|
addPadding?: boolean;
|
35
35
|
jupQuote?: QuoteResponse;
|
36
|
+
wrapAndUnwrapSol?: boolean;
|
36
37
|
}
|
37
38
|
|
38
39
|
function createTransactionInstruction(
|
@@ -76,6 +77,7 @@ export interface JupSwapTransaction {
|
|
76
77
|
setupInstructions: TransactionBuilder;
|
77
78
|
tokenLedgerIx?: TransactionBuilder;
|
78
79
|
swapIx: TransactionBuilder;
|
80
|
+
cleanupInstruction?: TransactionBuilder;
|
79
81
|
}
|
80
82
|
|
81
83
|
export async function getJupSwapTransaction(
|
@@ -102,7 +104,7 @@ export async function getJupSwapTransaction(
|
|
102
104
|
swapRequest: {
|
103
105
|
userPublicKey: signer.publicKey.toString(),
|
104
106
|
quoteResponse,
|
105
|
-
wrapAndUnwrapSol: false,
|
107
|
+
wrapAndUnwrapSol: swapDetails.wrapAndUnwrapSol ?? false,
|
106
108
|
useTokenLedger: !swapDetails.exactOut && !swapDetails.exactIn,
|
107
109
|
destinationTokenAccount: getTokenAccount(
|
108
110
|
swapDetails.destinationWallet,
|
@@ -150,21 +152,28 @@ export async function getJupSwapTransaction(
|
|
150
152
|
getWrappedInstruction(signer, createTransactionInstruction(ix))
|
151
153
|
)
|
152
154
|
),
|
153
|
-
tokenLedgerIx:
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
createTransactionInstruction(instructions.tokenLedgerInstruction)
|
159
|
-
)
|
155
|
+
tokenLedgerIx: instructions.tokenLedgerInstruction
|
156
|
+
? transactionBuilder().add(
|
157
|
+
getWrappedInstruction(
|
158
|
+
signer,
|
159
|
+
createTransactionInstruction(instructions.tokenLedgerInstruction)
|
160
160
|
)
|
161
|
-
|
161
|
+
)
|
162
|
+
: undefined,
|
162
163
|
swapIx: transactionBuilder().add(
|
163
164
|
getWrappedInstruction(
|
164
165
|
signer,
|
165
166
|
createTransactionInstruction(instructions.swapInstruction)
|
166
167
|
)
|
167
168
|
),
|
169
|
+
cleanupInstruction: instructions.cleanupInstruction
|
170
|
+
? transactionBuilder().add(
|
171
|
+
getWrappedInstruction(
|
172
|
+
signer,
|
173
|
+
createTransactionInstruction(instructions.cleanupInstruction)
|
174
|
+
)
|
175
|
+
)
|
176
|
+
: undefined,
|
168
177
|
};
|
169
178
|
}
|
170
179
|
|