@haven-fi/solauto-sdk 1.0.545 → 1.0.546
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,13 +1,8 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { PublicKey as UmiPublicKey } from "@metaplex-foundation/umi";
|
3
|
-
import { QuoteGetSwapModeEnum } from "@jup-ag/api";
|
4
3
|
export declare function fetchTokenPrices(mints: PublicKey[]): Promise<number[]>;
|
5
4
|
export declare function getPythPrices(mints: PublicKey[]): Promise<number[]>;
|
6
5
|
export declare function getSwitchboardPrices(mints: PublicKey[]): Promise<number[]>;
|
7
6
|
export declare function getJupTokenPrices(mints: PublicKey[], mayIncludeSpamTokens?: boolean): Promise<number[]>;
|
8
|
-
export declare function safeGetPrice(mint: PublicKey | UmiPublicKey | undefined): number | undefined;
|
9
|
-
export declare function getPriceImpact(inputMint: PublicKey, outputMint: PublicKey, amount: bigint, swapMode: QuoteGetSwapModeEnum): Promise<{
|
10
|
-
priceImpact: number;
|
11
|
-
quote: import("@jup-ag/api").QuoteResponse;
|
12
|
-
}>;
|
7
|
+
export declare function safeGetPrice(mint: PublicKey | UmiPublicKey | string | undefined): number | undefined;
|
13
8
|
//# sourceMappingURL=priceUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"priceUtils.d.ts","sourceRoot":"","sources":["../../src/utils/priceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"priceUtils.d.ts","sourceRoot":"","sources":["../../src/utils/priceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAerE,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyC5E;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,qBAwCrD;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,SAAS,EAAE,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAoDnB;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,SAAS,EAAE,EAClB,oBAAoB,CAAC,EAAE,OAAO,qBAqB/B;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAClD,MAAM,GAAG,SAAS,CAKpB"}
|
package/dist/utils/priceUtils.js
CHANGED
@@ -28,7 +28,6 @@ exports.getPythPrices = getPythPrices;
|
|
28
28
|
exports.getSwitchboardPrices = getSwitchboardPrices;
|
29
29
|
exports.getJupTokenPrices = getJupTokenPrices;
|
30
30
|
exports.safeGetPrice = safeGetPrice;
|
31
|
-
exports.getPriceImpact = getPriceImpact;
|
32
31
|
const pythConstants_1 = require("../constants/pythConstants");
|
33
32
|
const numberUtils_1 = require("./numberUtils");
|
34
33
|
const solautoConstants_1 = require("../constants/solautoConstants");
|
@@ -140,16 +139,3 @@ function safeGetPrice(mint) {
|
|
140
139
|
}
|
141
140
|
return undefined;
|
142
141
|
}
|
143
|
-
async function getPriceImpact(inputMint, outputMint, amount, swapMode) {
|
144
|
-
const quoteResponse = await (0, jupiterUtils_1.getJupQuote)({
|
145
|
-
inputMint,
|
146
|
-
outputMint,
|
147
|
-
amount,
|
148
|
-
exactIn: swapMode === "ExactIn",
|
149
|
-
exactOut: swapMode === "ExactOut",
|
150
|
-
});
|
151
|
-
return {
|
152
|
-
priceImpact: parseFloat(quoteResponse.priceImpactPct),
|
153
|
-
quote: quoteResponse,
|
154
|
-
};
|
155
|
-
}
|
package/package.json
CHANGED
package/src/utils/priceUtils.ts
CHANGED
@@ -181,30 +181,10 @@ export async function getJupTokenPrices(
|
|
181
181
|
}
|
182
182
|
|
183
183
|
export function safeGetPrice(
|
184
|
-
mint: PublicKey | UmiPublicKey | undefined
|
184
|
+
mint: PublicKey | UmiPublicKey | string | undefined
|
185
185
|
): number | undefined {
|
186
186
|
if (mint && mint?.toString() in PRICES) {
|
187
187
|
return PRICES[mint!.toString()].price;
|
188
188
|
}
|
189
189
|
return undefined;
|
190
|
-
}
|
191
|
-
|
192
|
-
export async function getPriceImpact(
|
193
|
-
inputMint: PublicKey,
|
194
|
-
outputMint: PublicKey,
|
195
|
-
amount: bigint,
|
196
|
-
swapMode: QuoteGetSwapModeEnum
|
197
|
-
) {
|
198
|
-
const quoteResponse = await getJupQuote({
|
199
|
-
inputMint,
|
200
|
-
outputMint,
|
201
|
-
amount,
|
202
|
-
exactIn: swapMode === "ExactIn",
|
203
|
-
exactOut: swapMode === "ExactOut",
|
204
|
-
});
|
205
|
-
|
206
|
-
return {
|
207
|
-
priceImpact: parseFloat(quoteResponse.priceImpactPct),
|
208
|
-
quote: quoteResponse,
|
209
|
-
};
|
210
|
-
}
|
190
|
+
}
|