@jup-ag/plugin 1.0.11 → 1.0.12
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.d.ts +16 -17
- package/dist/index.js +10 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { WalletContextState } from '@jup-ag/wallet-adapter';
|
|
|
6
6
|
import * as superstruct from 'superstruct';
|
|
7
7
|
import { Infer } from 'superstruct';
|
|
8
8
|
import { PublicKey } from '@solana/web3.js';
|
|
9
|
-
import JSBI from 'jsbi';
|
|
10
9
|
|
|
11
10
|
declare const AGGREGATOR_SOURCES: {
|
|
12
11
|
readonly METIS: "metis";
|
|
@@ -46,10 +45,10 @@ interface UltraQuoteResponse {
|
|
|
46
45
|
declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
47
46
|
inputMint: PublicKey;
|
|
48
47
|
outputMint: PublicKey;
|
|
49
|
-
inAmount:
|
|
50
|
-
outAmount:
|
|
48
|
+
inAmount: bigint;
|
|
49
|
+
outAmount: bigint;
|
|
51
50
|
feeBps: number;
|
|
52
|
-
otherAmountThreshold:
|
|
51
|
+
otherAmountThreshold: bigint;
|
|
53
52
|
priceImpactPct: string;
|
|
54
53
|
routePlan: {
|
|
55
54
|
swapInfo: {
|
|
@@ -57,8 +56,8 @@ declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
|
57
56
|
outputMint: string;
|
|
58
57
|
label: string;
|
|
59
58
|
ammKey: PublicKey;
|
|
60
|
-
inAmount:
|
|
61
|
-
outAmount:
|
|
59
|
+
inAmount: bigint;
|
|
60
|
+
outAmount: bigint;
|
|
62
61
|
};
|
|
63
62
|
percent: number;
|
|
64
63
|
}[];
|
|
@@ -82,10 +81,10 @@ declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
|
82
81
|
errorMessage?: string | undefined;
|
|
83
82
|
}, {
|
|
84
83
|
inputMint: superstruct.Struct<PublicKey, null>;
|
|
85
|
-
inAmount: superstruct.Struct<
|
|
84
|
+
inAmount: superstruct.Struct<bigint, null>;
|
|
86
85
|
outputMint: superstruct.Struct<PublicKey, null>;
|
|
87
|
-
outAmount: superstruct.Struct<
|
|
88
|
-
otherAmountThreshold: superstruct.Struct<
|
|
86
|
+
outAmount: superstruct.Struct<bigint, null>;
|
|
87
|
+
otherAmountThreshold: superstruct.Struct<bigint, null>;
|
|
89
88
|
priceImpactPct: superstruct.Struct<string, null>;
|
|
90
89
|
routePlan: superstruct.Struct<{
|
|
91
90
|
swapInfo: {
|
|
@@ -93,8 +92,8 @@ declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
|
93
92
|
outputMint: string;
|
|
94
93
|
label: string;
|
|
95
94
|
ammKey: PublicKey;
|
|
96
|
-
inAmount:
|
|
97
|
-
outAmount:
|
|
95
|
+
inAmount: bigint;
|
|
96
|
+
outAmount: bigint;
|
|
98
97
|
};
|
|
99
98
|
percent: number;
|
|
100
99
|
}[], superstruct.Struct<{
|
|
@@ -103,8 +102,8 @@ declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
|
103
102
|
outputMint: string;
|
|
104
103
|
label: string;
|
|
105
104
|
ammKey: PublicKey;
|
|
106
|
-
inAmount:
|
|
107
|
-
outAmount:
|
|
105
|
+
inAmount: bigint;
|
|
106
|
+
outAmount: bigint;
|
|
108
107
|
};
|
|
109
108
|
percent: number;
|
|
110
109
|
}, {
|
|
@@ -113,15 +112,15 @@ declare const FormattedUltraQuoteResponse: superstruct.Struct<{
|
|
|
113
112
|
outputMint: string;
|
|
114
113
|
label: string;
|
|
115
114
|
ammKey: PublicKey;
|
|
116
|
-
inAmount:
|
|
117
|
-
outAmount:
|
|
115
|
+
inAmount: bigint;
|
|
116
|
+
outAmount: bigint;
|
|
118
117
|
}, {
|
|
119
118
|
ammKey: superstruct.Struct<PublicKey, null>;
|
|
120
119
|
label: superstruct.Struct<string, null>;
|
|
121
120
|
inputMint: superstruct.Struct<string, null>;
|
|
122
121
|
outputMint: superstruct.Struct<string, null>;
|
|
123
|
-
inAmount: superstruct.Struct<
|
|
124
|
-
outAmount: superstruct.Struct<
|
|
122
|
+
inAmount: superstruct.Struct<bigint, null>;
|
|
123
|
+
outAmount: superstruct.Struct<bigint, null>;
|
|
125
124
|
}>;
|
|
126
125
|
percent: superstruct.Struct<number, null>;
|
|
127
126
|
}>>;
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ var require_package = __commonJS({
|
|
|
85
85
|
"package.json"(exports2, module2) {
|
|
86
86
|
module2.exports = {
|
|
87
87
|
name: "@jup-ag/plugin",
|
|
88
|
-
version: "1.0.
|
|
88
|
+
version: "1.0.12",
|
|
89
89
|
private: false,
|
|
90
90
|
license: "MIT",
|
|
91
91
|
scripts: {
|
|
@@ -637,7 +637,6 @@ var ScreenProvider = ({ children }) => {
|
|
|
637
637
|
|
|
638
638
|
// src/contexts/SwapContext.tsx
|
|
639
639
|
var import_decimal2 = __toESM(require("decimal.js"));
|
|
640
|
-
var import_jsbi2 = __toESM(require("jsbi"));
|
|
641
640
|
var import_react7 = require("react");
|
|
642
641
|
|
|
643
642
|
// src/constants/index.ts
|
|
@@ -979,10 +978,9 @@ var ultraSwapService = new UltraSwapService();
|
|
|
979
978
|
|
|
980
979
|
// src/entity/FormattedUltraQuoteResponse.ts
|
|
981
980
|
var import_web33 = require("@solana/web3.js");
|
|
982
|
-
var import_jsbi = __toESM(require("jsbi"));
|
|
983
981
|
var import_superstruct = require("superstruct");
|
|
984
982
|
var PublicKeyFromString = (0, import_superstruct.coerce)((0, import_superstruct.instance)(import_web33.PublicKey), (0, import_superstruct.string)(), (value) => new import_web33.PublicKey(value));
|
|
985
|
-
var AmountFromString = (0, import_superstruct.coerce)((0, import_superstruct.
|
|
983
|
+
var AmountFromString = (0, import_superstruct.coerce)((0, import_superstruct.bigint)(), (0, import_superstruct.string)(), (value) => BigInt(value));
|
|
986
984
|
var NumberFromString = (0, import_superstruct.coerce)((0, import_superstruct.string)(), (0, import_superstruct.number)(), (value) => Number(value));
|
|
987
985
|
var SwapInfo = (0, import_superstruct.type)({
|
|
988
986
|
ammKey: PublicKeyFromString,
|
|
@@ -1215,18 +1213,18 @@ var SwapContextProvider = (props) => {
|
|
|
1215
1213
|
);
|
|
1216
1214
|
const amount = (0, import_react7.useMemo)(() => {
|
|
1217
1215
|
if (!fromTokenInfo || !toTokenInfo) {
|
|
1218
|
-
return
|
|
1216
|
+
return BigInt(0);
|
|
1219
1217
|
}
|
|
1220
1218
|
if (isToPairFocused.current === true) {
|
|
1221
1219
|
if (!debouncedForm.toValue || !hasNumericValue(debouncedForm.toValue)) {
|
|
1222
|
-
return
|
|
1220
|
+
return BigInt(0);
|
|
1223
1221
|
}
|
|
1224
|
-
return
|
|
1222
|
+
return BigInt(new import_decimal2.default(debouncedForm.toValue).mul(Math.pow(10, toTokenInfo.decimals)).floor().toFixed());
|
|
1225
1223
|
} else {
|
|
1226
1224
|
if (!debouncedForm.fromValue || !hasNumericValue(debouncedForm.fromValue)) {
|
|
1227
|
-
return
|
|
1225
|
+
return BigInt(0);
|
|
1228
1226
|
}
|
|
1229
|
-
return
|
|
1227
|
+
return BigInt(
|
|
1230
1228
|
new import_decimal2.default(debouncedForm.fromValue).mul(Math.pow(10, fromTokenInfo.decimals)).floor().toFixed()
|
|
1231
1229
|
);
|
|
1232
1230
|
}
|
|
@@ -1772,7 +1770,6 @@ var CoinBalanceUSD = (props) => {
|
|
|
1772
1770
|
|
|
1773
1771
|
// src/components/PriceInfo/index.tsx
|
|
1774
1772
|
var import_decimal6 = __toESM(require("decimal.js"));
|
|
1775
|
-
var import_jsbi3 = __toESM(require("jsbi"));
|
|
1776
1773
|
var import_react14 = require("react");
|
|
1777
1774
|
|
|
1778
1775
|
// src/components/ExchangeRate.tsx
|
|
@@ -1948,10 +1945,10 @@ var Index = ({
|
|
|
1948
1945
|
containerClassName
|
|
1949
1946
|
}) => {
|
|
1950
1947
|
const rateParams = {
|
|
1951
|
-
inAmount: (quoteResponse == null ? void 0 : quoteResponse.quoteResponse.inAmount) ||
|
|
1948
|
+
inAmount: (quoteResponse == null ? void 0 : quoteResponse.quoteResponse.inAmount) || BigInt(0),
|
|
1952
1949
|
// If there's no selectedRoute, we will use first route value to temporarily calculate
|
|
1953
1950
|
inputDecimal: fromTokenInfo.decimals,
|
|
1954
|
-
outAmount: (quoteResponse == null ? void 0 : quoteResponse.quoteResponse.outAmount) ||
|
|
1951
|
+
outAmount: (quoteResponse == null ? void 0 : quoteResponse.quoteResponse.outAmount) || BigInt(0),
|
|
1955
1952
|
// If there's no selectedRoute, we will use first route value to temporarily calculate
|
|
1956
1953
|
outputDecimal: toTokenInfo.decimals
|
|
1957
1954
|
};
|
|
@@ -1982,7 +1979,7 @@ var Index = ({
|
|
|
1982
1979
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4 ", containerClassName), children: [
|
|
1983
1980
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
1984
1981
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Rate" }) }),
|
|
1985
|
-
|
|
1982
|
+
rateParams.inAmount > BigInt(0) && rateParams.outAmount > BigInt(0) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1986
1983
|
ExchangeRate_default,
|
|
1987
1984
|
{
|
|
1988
1985
|
loading,
|