@haven-fi/solauto-sdk 1.0.710 → 1.0.711
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jupSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/swap/jupSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,aAAa,EAEd,MAAM,aAAa,CAAC;AAWrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"jupSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/swap/jupSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,aAAa,EAEd,MAAM,aAAa,CAAC;AAWrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,SAAS;IACxB,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;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,qBAAa,cAAc;IAKb,OAAO,CAAC,MAAM;IAJ1B,MAAM,mCAA4B;IAE3B,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAa;gBAEnC,MAAM,EAAE,MAAM;IAErB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;YA+BhD,kBAAkB;IAsChC,cAAc;IAId,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,0BAA0B;IAc5B,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA2CnE,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAYlE"}
|
@@ -12,8 +12,13 @@ class JupSwapManager {
|
|
12
12
|
this.jupQuote = undefined;
|
13
13
|
}
|
14
14
|
async getQuote(data) {
|
15
|
-
const
|
16
|
-
const
|
15
|
+
const inputMintInfo = (0, utils_1.tokenInfo)(data.inputMint);
|
16
|
+
const outputMintInfo = (0, utils_1.tokenInfo)(data.outputMint);
|
17
|
+
const lowLiquidityMint = !inputMintInfo ||
|
18
|
+
inputMintInfo?.isMeme ||
|
19
|
+
!outputMintInfo ||
|
20
|
+
outputMintInfo?.isMeme;
|
21
|
+
const slippageBps = data.slippageBps ?? (lowLiquidityMint ? 250 : 100);
|
17
22
|
return await (0, utils_1.retryWithExponentialBackoff)(async (attemptNum) => await this.jupApi.quoteGet({
|
18
23
|
amount: Number(data.amount),
|
19
24
|
inputMint: data.inputMint.toString(),
|
@@ -24,7 +29,9 @@ class JupSwapManager {
|
|
24
29
|
? "ExactIn"
|
25
30
|
: undefined,
|
26
31
|
slippageBps,
|
27
|
-
maxAccounts: !data.exactOut
|
32
|
+
maxAccounts: !data.exactOut
|
33
|
+
? (lowLiquidityMint ? 25 : 15) + attemptNum * 5
|
34
|
+
: undefined,
|
28
35
|
}), 6, 250);
|
29
36
|
}
|
30
37
|
async getJupInstructions(data) {
|
package/package.json
CHANGED
@@ -21,6 +21,7 @@ import {
|
|
21
21
|
tokenInfo,
|
22
22
|
} from "../../utils";
|
23
23
|
import { TransactionItemInputs } from "../../types";
|
24
|
+
import { TokenInfo } from "../../constants";
|
24
25
|
|
25
26
|
export interface SwapInput {
|
26
27
|
inputMint: PublicKey;
|
@@ -53,9 +54,14 @@ export class JupSwapManager {
|
|
53
54
|
constructor(private signer: Signer) {}
|
54
55
|
|
55
56
|
public async getQuote(data: SwapInput): Promise<QuoteResponse> {
|
56
|
-
const
|
57
|
-
|
58
|
-
const
|
57
|
+
const inputMintInfo: TokenInfo | undefined = tokenInfo(data.inputMint);
|
58
|
+
const outputMintInfo: TokenInfo | undefined = tokenInfo(data.outputMint);
|
59
|
+
const lowLiquidityMint =
|
60
|
+
!inputMintInfo ||
|
61
|
+
inputMintInfo?.isMeme ||
|
62
|
+
!outputMintInfo ||
|
63
|
+
outputMintInfo?.isMeme;
|
64
|
+
const slippageBps = data.slippageBps ?? (lowLiquidityMint ? 250 : 100);
|
59
65
|
|
60
66
|
return await retryWithExponentialBackoff(
|
61
67
|
async (attemptNum: number) =>
|
@@ -69,7 +75,9 @@ export class JupSwapManager {
|
|
69
75
|
? "ExactIn"
|
70
76
|
: undefined,
|
71
77
|
slippageBps,
|
72
|
-
maxAccounts: !data.exactOut
|
78
|
+
maxAccounts: !data.exactOut
|
79
|
+
? (lowLiquidityMint ? 25 : 15) + attemptNum * 5
|
80
|
+
: undefined,
|
73
81
|
}),
|
74
82
|
6,
|
75
83
|
250
|