@shapeshiftoss/swapper 17.6.11 → 17.7.1
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/constants.js +16 -26
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/solana-utils/getUnsignedSolanaTransaction.js +4 -2
- package/dist/cjs/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +3 -1
- package/dist/cjs/swappers/ChainflipSwapper/endpoints.js +14 -4
- package/dist/cjs/swappers/ChainflipSwapper/types.d.ts +1 -0
- package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +1 -1
- package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.js +7 -9
- package/dist/cjs/swappers/RelaySwapper/RelaySwapper.d.ts +1 -0
- package/dist/cjs/swappers/RelaySwapper/RelaySwapper.js +15 -0
- package/dist/cjs/swappers/RelaySwapper/constant.js +3 -7
- package/dist/cjs/swappers/RelaySwapper/endpoints.js +1 -1
- package/dist/cjs/swappers/RelaySwapper/utils/getTrade.js +12 -2
- package/dist/cjs/swappers/RelaySwapper/utils/relayTokenToAssetId.js +5 -0
- package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +2 -1
- package/dist/cjs/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +0 -1
- package/dist/cjs/tron-utils/getUnsignedTronTransaction.js +16 -0
- package/dist/cjs/types.d.ts +3 -6
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/utils.d.ts +3 -0
- package/dist/cjs/utils.js +9 -3
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/constants.js +0 -10
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/solana-utils/getUnsignedSolanaTransaction.js +3 -1
- package/dist/esm/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +3 -1
- package/dist/esm/swappers/ChainflipSwapper/endpoints.js +14 -4
- package/dist/esm/swappers/ChainflipSwapper/types.d.ts +1 -0
- package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +1 -1
- package/dist/esm/swappers/DebridgeSwapper/utils/getTrade.js +7 -9
- package/dist/esm/swappers/RelaySwapper/RelaySwapper.d.ts +1 -0
- package/dist/esm/swappers/RelaySwapper/RelaySwapper.js +1 -0
- package/dist/esm/swappers/RelaySwapper/constant.js +4 -8
- package/dist/esm/swappers/RelaySwapper/endpoints.js +2 -2
- package/dist/esm/swappers/RelaySwapper/utils/getTrade.js +13 -3
- package/dist/esm/swappers/RelaySwapper/utils/relayTokenToAssetId.js +5 -0
- package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +2 -1
- package/dist/esm/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +0 -1
- package/dist/esm/tron-utils/getUnsignedTronTransaction.js +16 -0
- package/dist/esm/types.d.ts +3 -6
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils.d.ts +3 -0
- package/dist/esm/utils.js +7 -2
- package/package.json +2 -3
- package/dist/cjs/swappers/JupiterSwapper/JupiterSwapper.d.ts +0 -2
- package/dist/cjs/swappers/JupiterSwapper/JupiterSwapper.js +0 -27
- package/dist/cjs/swappers/JupiterSwapper/endpoints.d.ts +0 -2
- package/dist/cjs/swappers/JupiterSwapper/endpoints.js +0 -15
- package/dist/cjs/swappers/JupiterSwapper/errorPatterns.d.ts +0 -15
- package/dist/cjs/swappers/JupiterSwapper/errorPatterns.js +0 -29
- package/dist/cjs/swappers/JupiterSwapper/idls/referral.d.ts +0 -739
- package/dist/cjs/swappers/JupiterSwapper/idls/referral.js +0 -741
- package/dist/cjs/swappers/JupiterSwapper/index.d.ts +0 -2
- package/dist/cjs/swappers/JupiterSwapper/index.js +0 -18
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeQuote.d.ts +0 -3
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +0 -223
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeRate.d.ts +0 -3
- package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeRate.js +0 -181
- package/dist/cjs/swappers/JupiterSwapper/utils/constants.d.ts +0 -9
- package/dist/cjs/swappers/JupiterSwapper/utils/constants.js +0 -14
- package/dist/cjs/swappers/JupiterSwapper/utils/helpers.d.ts +0 -56
- package/dist/cjs/swappers/JupiterSwapper/utils/helpers.js +0 -178
- package/dist/cjs/swappers/JupiterSwapper/utils/jupiterService.d.ts +0 -5
- package/dist/cjs/swappers/JupiterSwapper/utils/jupiterService.js +0 -15
- package/dist/esm/swappers/JupiterSwapper/JupiterSwapper.d.ts +0 -2
- package/dist/esm/swappers/JupiterSwapper/JupiterSwapper.js +0 -24
- package/dist/esm/swappers/JupiterSwapper/endpoints.d.ts +0 -2
- package/dist/esm/swappers/JupiterSwapper/endpoints.js +0 -12
- package/dist/esm/swappers/JupiterSwapper/errorPatterns.d.ts +0 -15
- package/dist/esm/swappers/JupiterSwapper/errorPatterns.js +0 -25
- package/dist/esm/swappers/JupiterSwapper/idls/referral.d.ts +0 -739
- package/dist/esm/swappers/JupiterSwapper/idls/referral.js +0 -738
- package/dist/esm/swappers/JupiterSwapper/index.d.ts +0 -2
- package/dist/esm/swappers/JupiterSwapper/index.js +0 -2
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeQuote.d.ts +0 -3
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +0 -219
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeRate.d.ts +0 -3
- package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeRate.js +0 -177
- package/dist/esm/swappers/JupiterSwapper/utils/constants.d.ts +0 -9
- package/dist/esm/swappers/JupiterSwapper/utils/constants.js +0 -11
- package/dist/esm/swappers/JupiterSwapper/utils/helpers.d.ts +0 -56
- package/dist/esm/swappers/JupiterSwapper/utils/helpers.js +0 -169
- package/dist/esm/swappers/JupiterSwapper/utils/jupiterService.d.ts +0 -5
- package/dist/esm/swappers/JupiterSwapper/utils/jupiterService.js +0 -12
package/dist/esm/constants.js
CHANGED
|
@@ -17,8 +17,6 @@ import { cowSwapper } from './swappers/CowSwapper/CowSwapper.js';
|
|
|
17
17
|
import { cowApi } from './swappers/CowSwapper/endpoints.js';
|
|
18
18
|
import { debridgeSwapper } from './swappers/DebridgeSwapper/index.js';
|
|
19
19
|
import { debridgeApi } from './swappers/DebridgeSwapper/endpoints.js';
|
|
20
|
-
import { jupiterApi } from './swappers/JupiterSwapper/endpoints.js';
|
|
21
|
-
import { jupiterSwapper } from './swappers/JupiterSwapper/JupiterSwapper.js';
|
|
22
20
|
import { mayachainApi } from './swappers/MayachainSwapper/endpoints.js';
|
|
23
21
|
import { mayachainSwapper } from './swappers/MayachainSwapper/MayachainSwapper.js';
|
|
24
22
|
import { nearIntentsApi } from './swappers/NearIntentsSwapper/endpoints.js';
|
|
@@ -73,10 +71,6 @@ export const swappers = {
|
|
|
73
71
|
...chainflipSwapper,
|
|
74
72
|
...chainflipApi,
|
|
75
73
|
},
|
|
76
|
-
[SwapperName.Jupiter]: {
|
|
77
|
-
...jupiterSwapper,
|
|
78
|
-
...jupiterApi,
|
|
79
|
-
},
|
|
80
74
|
[SwapperName.Relay]: {
|
|
81
75
|
...relaySwapper,
|
|
82
76
|
...relayApi,
|
|
@@ -155,8 +149,6 @@ export const getDefaultSlippageDecimalPercentageForSwapper = (swapperName) => {
|
|
|
155
149
|
return DEFAULT_ARBITRUM_BRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE;
|
|
156
150
|
case SwapperName.Chainflip:
|
|
157
151
|
return DEFAULT_CHAINFLIP_SLIPPAGE_DECIMAL_PERCENTAGE;
|
|
158
|
-
case SwapperName.Jupiter:
|
|
159
|
-
throw new Error('Default slippage not supported by Jupiter');
|
|
160
152
|
case SwapperName.Relay:
|
|
161
153
|
throw new Error('Default slippage not supported by Relay');
|
|
162
154
|
case SwapperName.Across:
|
|
@@ -181,8 +173,6 @@ export const getDefaultSlippageDecimalPercentageForSwapper = (swapperName) => {
|
|
|
181
173
|
};
|
|
182
174
|
export const isAutoSlippageSupportedBySwapper = (swapperName) => {
|
|
183
175
|
switch (swapperName) {
|
|
184
|
-
case SwapperName.Jupiter:
|
|
185
|
-
return true;
|
|
186
176
|
case SwapperName.Relay:
|
|
187
177
|
case SwapperName.Across:
|
|
188
178
|
case SwapperName.Debridge:
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export * from './swappers/ChainflipSwapper/index.js';
|
|
|
10
10
|
export * from './swappers/SunioSwapper/index.js';
|
|
11
11
|
export * from './swappers/CowSwapper/index.js';
|
|
12
12
|
export * from './swappers/DebridgeSwapper/index.js';
|
|
13
|
-
export * from './swappers/JupiterSwapper/index.js';
|
|
14
13
|
export * from './swappers/PortalsSwapper/index.js';
|
|
15
14
|
export * from './swappers/ThorchainSwapper/index.js';
|
|
16
15
|
export * from './swappers/MayachainSwapper/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export * from './swappers/ChainflipSwapper/index.js';
|
|
|
10
10
|
export * from './swappers/SunioSwapper/index.js';
|
|
11
11
|
export * from './swappers/CowSwapper/index.js';
|
|
12
12
|
export * from './swappers/DebridgeSwapper/index.js';
|
|
13
|
-
export * from './swappers/JupiterSwapper/index.js';
|
|
14
13
|
export * from './swappers/PortalsSwapper/index.js';
|
|
15
14
|
export * from './swappers/ThorchainSwapper/index.js';
|
|
16
15
|
export * from './swappers/MayachainSwapper/index.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { bnOrZero } from '@shapeshiftoss/utils';
|
|
2
|
-
import { COMPUTE_UNIT_MARGIN_MULTIPLIER } from '../swappers/JupiterSwapper/index.js';
|
|
3
2
|
import { getExecutableTradeStep, isExecutableTradeQuote } from '../utils.js';
|
|
3
|
+
// Jupiter (and Relay which uses Jupiter under the hood) use 40% as a compute unit margin while
|
|
4
|
+
// calculating them, some TX reverts without this. For stability purposes we add 60% margin.
|
|
5
|
+
const COMPUTE_UNIT_MARGIN_MULTIPLIER = 1.6;
|
|
4
6
|
export const getUnsignedSolanaTransaction = async ({ stepIndex, tradeQuote, from, assertGetSolanaChainAdapter, }) => {
|
|
5
7
|
if (!isExecutableTradeQuote(tradeQuote))
|
|
6
8
|
throw new Error('Unable to execute a trade rate quote');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getQuotes } from '@avnu/avnu-sdk';
|
|
2
|
+
import { starknetChainId } from '@shapeshiftoss/caip';
|
|
2
3
|
import { bn } from '@shapeshiftoss/utils';
|
|
3
4
|
import { Err, Ok } from '@sniptt/monads';
|
|
4
5
|
import { validateAndParseAddress } from 'starknet';
|
|
@@ -56,7 +57,8 @@ export const getTradeQuote = async (input, deps) => {
|
|
|
56
57
|
takerAddress: normalizedSendAddress,
|
|
57
58
|
size: 1,
|
|
58
59
|
integratorFees: affiliateBps ? BigInt(affiliateBps) : undefined,
|
|
59
|
-
integratorFeeRecipient: getTreasuryAddressFromChainId(
|
|
60
|
+
integratorFeeRecipient: getTreasuryAddressFromChainId(starknetChainId),
|
|
61
|
+
integratorName: 'shapeshift',
|
|
60
62
|
});
|
|
61
63
|
if (!quotes || quotes.length === 0) {
|
|
62
64
|
return Err(makeSwapErrorRight({
|
|
@@ -123,6 +123,9 @@ export const chainflipApi = {
|
|
|
123
123
|
value,
|
|
124
124
|
chainSpecific: { from, tokenId },
|
|
125
125
|
});
|
|
126
|
+
// Chainflip deposit addresses are program-owned accounts that require more compute
|
|
127
|
+
// than a regular SOL transfer. Apply a safety margin to avoid "Computational budget exceeded".
|
|
128
|
+
const computeUnits = Math.ceil(Math.max(Number(fast.chainSpecific.computeUnits), 50_000) * 1.6);
|
|
126
129
|
return adapter.buildSendApiTransaction({
|
|
127
130
|
to,
|
|
128
131
|
from,
|
|
@@ -130,7 +133,7 @@ export const chainflipApi = {
|
|
|
130
133
|
accountNumber,
|
|
131
134
|
chainSpecific: {
|
|
132
135
|
tokenId,
|
|
133
|
-
computeUnitLimit:
|
|
136
|
+
computeUnitLimit: String(computeUnits),
|
|
134
137
|
computeUnitPrice: fast.chainSpecific.priorityFee,
|
|
135
138
|
},
|
|
136
139
|
});
|
|
@@ -153,11 +156,16 @@ export const chainflipApi = {
|
|
|
153
156
|
tokenId: contractAddressOrUndefined(sellAsset.assetId),
|
|
154
157
|
},
|
|
155
158
|
});
|
|
156
|
-
|
|
159
|
+
// Mirror the same compute budget boost as getUnsignedSolanaTransaction
|
|
160
|
+
// to avoid underquoting fees for Chainflip deposit addresses
|
|
161
|
+
const simulatedUnits = Number(fast.chainSpecific.computeUnits);
|
|
162
|
+
const boostedUnits = Math.ceil(Math.max(simulatedUnits, 50_000) * 1.6);
|
|
163
|
+
const ratio = simulatedUnits > 0 ? boostedUnits / simulatedUnits : 1;
|
|
164
|
+
return String(Math.ceil(Number(fast.txFee) * ratio));
|
|
157
165
|
},
|
|
158
166
|
checkTradeStatus: async ({ config, swap }) => {
|
|
159
167
|
const chainflipSwapId = swap?.metadata.chainflipSwapId;
|
|
160
|
-
if (
|
|
168
|
+
if (chainflipSwapId == null)
|
|
161
169
|
throw Error(`chainflipSwapId is required`);
|
|
162
170
|
const brokerUrl = config.VITE_CHAINFLIP_API_URL;
|
|
163
171
|
const apiKey = config.VITE_CHAINFLIP_API_KEY;
|
|
@@ -171,13 +179,14 @@ export const chainflipApi = {
|
|
|
171
179
|
};
|
|
172
180
|
}
|
|
173
181
|
const { data: statusResponse } = maybeStatusResponse.unwrap();
|
|
174
|
-
const { status: { swapEgress }, } = statusResponse;
|
|
182
|
+
const { status: { swapEgress, swapId }, } = statusResponse;
|
|
175
183
|
// Assume no outbound Tx is a pending Tx
|
|
176
184
|
if (!swapEgress?.transactionReference) {
|
|
177
185
|
return {
|
|
178
186
|
buyTxHash: undefined,
|
|
179
187
|
status: TxStatus.Pending,
|
|
180
188
|
message: getLatestChainflipStatusMessage(statusResponse),
|
|
189
|
+
chainflipSwapId: swapId ?? undefined,
|
|
181
190
|
};
|
|
182
191
|
}
|
|
183
192
|
// Assume as soon as we have an outbound Tx, the swap is complete.
|
|
@@ -186,6 +195,7 @@ export const chainflipApi = {
|
|
|
186
195
|
buyTxHash: swapEgress.transactionReference,
|
|
187
196
|
status: TxStatus.Confirmed,
|
|
188
197
|
message: undefined,
|
|
198
|
+
chainflipSwapId: swapId ?? undefined,
|
|
189
199
|
};
|
|
190
200
|
},
|
|
191
201
|
};
|
|
@@ -3,6 +3,7 @@ import type { ChainflipBaasStatusSwap } from './models/ChainflipBaasStatusSwap.j
|
|
|
3
3
|
export type ChainFlipStatus = {
|
|
4
4
|
status: {
|
|
5
5
|
state: 'waiting' | 'receiving' | 'swapping' | 'sending' | 'sent' | 'completed' | 'failed';
|
|
6
|
+
swapId?: string;
|
|
6
7
|
swap?: ChainflipBaasStatusSwap;
|
|
7
8
|
swapEgress?: ChainflipBaasStatusEgress;
|
|
8
9
|
};
|
|
@@ -13,7 +13,7 @@ export type DebridgeFetchQuoteParams = {
|
|
|
13
13
|
srcChainOrderAuthorityAddress?: string;
|
|
14
14
|
dstChainOrderAuthorityAddress?: string;
|
|
15
15
|
senderAddress?: string;
|
|
16
|
-
prependOperatingExpenses: 'true';
|
|
16
|
+
prependOperatingExpenses: 'true' | 'false';
|
|
17
17
|
affiliateFeePercent?: string;
|
|
18
18
|
affiliateFeeRecipient?: string;
|
|
19
19
|
};
|
|
@@ -54,7 +54,7 @@ export async function getTrade({ input, deps, }) {
|
|
|
54
54
|
return input.receiveAddress;
|
|
55
55
|
})();
|
|
56
56
|
const affiliateFeePercent = (() => {
|
|
57
|
-
if (!isTreasuryChainId(
|
|
57
|
+
if (!isTreasuryChainId(sellAsset.chainId))
|
|
58
58
|
return undefined;
|
|
59
59
|
const bps = bnOrZero(affiliateBps);
|
|
60
60
|
if (!bps.isFinite() || bps.lte(0))
|
|
@@ -65,10 +65,10 @@ export async function getTrade({ input, deps, }) {
|
|
|
65
65
|
if (affiliateFeePercent === undefined)
|
|
66
66
|
return undefined;
|
|
67
67
|
try {
|
|
68
|
-
return getTreasuryAddressFromChainId(
|
|
68
|
+
return getTreasuryAddressFromChainId(sellAsset.chainId).toLowerCase();
|
|
69
69
|
}
|
|
70
70
|
catch (e) {
|
|
71
|
-
console.error(`[getTrade] Failed to get treasury address for chainId ${
|
|
71
|
+
console.error(`[getTrade] Failed to get treasury address for chainId ${sellAsset.chainId}, affiliate fee will not be applied`, e);
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
74
|
})();
|
|
@@ -101,7 +101,7 @@ export async function getTrade({ input, deps, }) {
|
|
|
101
101
|
srcChainOrderAuthorityAddress: senderAddress,
|
|
102
102
|
dstChainOrderAuthorityAddress: recipientAddress,
|
|
103
103
|
senderAddress,
|
|
104
|
-
prependOperatingExpenses: '
|
|
104
|
+
prependOperatingExpenses: 'false',
|
|
105
105
|
affiliateFeePercent,
|
|
106
106
|
affiliateFeeRecipient,
|
|
107
107
|
}, deps.config);
|
|
@@ -116,9 +116,7 @@ export async function getTrade({ input, deps, }) {
|
|
|
116
116
|
sellAsset,
|
|
117
117
|
buyAsset,
|
|
118
118
|
});
|
|
119
|
-
const
|
|
120
|
-
.plus(bnOrZero(quote.prependedOperatingExpenseCost))
|
|
121
|
-
.toFixed();
|
|
119
|
+
const fixFee = bnOrZero(quote.fixFee).toFixed();
|
|
122
120
|
const buyAmountBeforeFeesCryptoBaseUnit = buyAmountAfterFeesCryptoBaseUnit;
|
|
123
121
|
const allowanceContract = isEvmChainId(sellAsset.chainId) ? quote.tx.to : '';
|
|
124
122
|
const debridgeTransactionMetadata = {
|
|
@@ -152,10 +150,10 @@ export async function getTrade({ input, deps, }) {
|
|
|
152
150
|
accountNumber,
|
|
153
151
|
feeData: {
|
|
154
152
|
networkFeeCryptoBaseUnit,
|
|
155
|
-
protocolFees: protocolFeeAssetIdForFees && bnOrZero(
|
|
153
|
+
protocolFees: protocolFeeAssetIdForFees && bnOrZero(fixFee).gt(0)
|
|
156
154
|
? {
|
|
157
155
|
[protocolFeeAssetIdForFees]: {
|
|
158
|
-
amountCryptoBaseUnit:
|
|
156
|
+
amountCryptoBaseUnit: fixFee,
|
|
159
157
|
asset: getBaseAsset(sellAsset.chainId),
|
|
160
158
|
requiresBalance: true,
|
|
161
159
|
},
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { arbitrumChainId, avalancheChainId, baseChainId, berachainChainId, blastChainId, bobChainId, bscChainId, btcChainId, celoChainId, cronosChainId, ethChainId, etherealChainId, flowEvmChainId, gnosisChainId, hemiChainId, hyperEvmChainId, inkChainId, katanaChainId, lineaChainId, mantleChainId, megaethChainId, modeChainId, monadChainId, optimismChainId, plasmaChainId, plumeChainId, polygonChainId, scrollChainId, seiChainId, solanaChainId, soneiumChainId, sonicChainId, storyChainId, unichainChainId, worldChainChainId, zkSyncEraChainId, } from '@shapeshiftoss/caip';
|
|
1
|
+
import { abstractChainId, arbitrumChainId, avalancheChainId, baseChainId, berachainChainId, blastChainId, bobChainId, bscChainId, btcChainId, celoChainId, cronosChainId, ethChainId, etherealChainId, flowEvmChainId, gnosisChainId, hemiChainId, hyperEvmChainId, inkChainId, katanaChainId, lineaChainId, mantleChainId, megaethChainId, modeChainId, monadChainId, optimismChainId, plasmaChainId, plumeChainId, polygonChainId, scrollChainId, seiChainId, solanaChainId, soneiumChainId, sonicChainId, storyChainId, tronChainId, unichainChainId, worldChainChainId, zkSyncEraChainId, } from '@shapeshiftoss/caip';
|
|
2
2
|
import invert from 'lodash/invert';
|
|
3
3
|
import { zeroAddress } from 'viem';
|
|
4
4
|
import { arbitrum, avalanche, base, berachain, blast, bob, bsc, celo, cronos, flowMainnet, gnosis, hemi, hyperEvm, ink, katana, linea, mainnet as ethereum, mantle, mode, monad, optimism, plasma, plumeMainnet, polygon, scroll, sei, soneium, sonic, story, unichain, worldchain, zksync, } from 'viem/chains';
|
|
5
5
|
import { TradeQuoteError } from '../../types.js';
|
|
6
6
|
import { RelayErrorCode } from './utils/types.js';
|
|
7
|
+
// https://docs.relay.link/resources/supported-chains
|
|
7
8
|
export const chainIdToRelayChainId = {
|
|
8
|
-
// https://docs.relay.link/resources/supported-chains
|
|
9
9
|
[btcChainId]: 8253038,
|
|
10
10
|
[ethChainId]: ethereum.id,
|
|
11
11
|
[arbitrumChainId]: arbitrum.id,
|
|
12
12
|
[baseChainId]: base.id,
|
|
13
13
|
[optimismChainId]: optimism.id,
|
|
14
14
|
[polygonChainId]: polygon.id,
|
|
15
|
-
// https://docs.relay.link/resources/supported-chains
|
|
16
15
|
[solanaChainId]: 792703809,
|
|
17
16
|
[gnosisChainId]: gnosis.id,
|
|
18
17
|
[avalancheChainId]: avalanche.id,
|
|
19
18
|
[bscChainId]: bsc.id,
|
|
20
|
-
|
|
21
|
-
// and the Relay indexer notification is never sent for non-EVM chains. This causes deposits to be
|
|
22
|
-
// untracked by Relay, resulting in stuck/lost funds. Re-enable once the Tron transaction building
|
|
23
|
-
// is verified to use the Relay quote calldata (depositErc20) correctly.
|
|
24
|
-
// [tronChainId]: 728126428,
|
|
19
|
+
[tronChainId]: 728126428,
|
|
25
20
|
[monadChainId]: monad.id,
|
|
26
21
|
[hyperEvmChainId]: hyperEvm.id,
|
|
27
22
|
[mantleChainId]: mantle.id,
|
|
@@ -48,6 +43,7 @@ export const chainIdToRelayChainId = {
|
|
|
48
43
|
[modeChainId]: mode.id,
|
|
49
44
|
[soneiumChainId]: soneium.id,
|
|
50
45
|
[seiChainId]: sei.id,
|
|
46
|
+
[abstractChainId]: 2741,
|
|
51
47
|
};
|
|
52
48
|
export var RelayStatusMessage;
|
|
53
49
|
(function (RelayStatusMessage) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { evm
|
|
1
|
+
import { evm } from '@shapeshiftoss/chain-adapters';
|
|
2
2
|
import { TxStatus } from '@shapeshiftoss/unchained-client';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
4
|
import { getSolanaTransactionFees } from '../../solana-utils/getSolanaTransactionFees.js';
|
|
@@ -143,7 +143,7 @@ export const relayApi = {
|
|
|
143
143
|
}
|
|
144
144
|
if (swap.metadata.relayTransactionMetadata &&
|
|
145
145
|
!txIndexingMap.has(swap.id) &&
|
|
146
|
-
|
|
146
|
+
chainIdToRelayChainId[chainId] !== undefined) {
|
|
147
147
|
const relayTxParam = {
|
|
148
148
|
...swap.metadata.relayTransactionMetadata,
|
|
149
149
|
txHash,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { baseChainId, btcChainId, fromChainId, monadChainId, solanaChainId, tronChainId, } from '@shapeshiftoss/caip';
|
|
2
2
|
import { evm, isEvmChainId } from '@shapeshiftoss/chain-adapters';
|
|
3
|
-
import { bnOrZero, chainIdToFeeAssetId, convertBasisPointsToPercentage, convertDecimalPercentageToBasisPoints, convertPrecision, DAO_TREASURY_BASE, } from '@shapeshiftoss/utils';
|
|
3
|
+
import { bnOrZero, chainIdToFeeAssetId, convertBasisPointsToPercentage, convertDecimalPercentageToBasisPoints, convertPrecision, DAO_TREASURY_BASE, isToken, } from '@shapeshiftoss/utils';
|
|
4
4
|
import { Err, Ok } from '@sniptt/monads';
|
|
5
5
|
import { AddressLookupTableAccount, MessageV0, PublicKey, VersionedTransaction, } from '@solana/web3.js';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -480,13 +480,23 @@ export async function getTrade({ input, deps, relayChainMap, }) {
|
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
482
|
if (isRelayQuoteTronItemData(selectedItem.data)) {
|
|
483
|
+
const contractAddress = selectedItem.data.parameter?.contract_address;
|
|
484
|
+
const callData = selectedItem.data.parameter?.data;
|
|
485
|
+
const isTronToken = isToken(sellAsset.assetId);
|
|
486
|
+
if (isTronToken && !contractAddress) {
|
|
487
|
+
throw new Error('Missing Relay Tron contract address');
|
|
488
|
+
}
|
|
489
|
+
if (isTronToken && !callData) {
|
|
490
|
+
throw new Error('Missing Relay Tron transaction data');
|
|
491
|
+
}
|
|
483
492
|
return {
|
|
484
|
-
allowanceContract: '',
|
|
493
|
+
allowanceContract: contractAddress ?? '',
|
|
485
494
|
solanaTransactionMetadata: undefined,
|
|
486
495
|
relayTransactionMetadata: {
|
|
487
496
|
relayId: quote.steps[0].requestId,
|
|
488
497
|
orderId,
|
|
489
|
-
to:
|
|
498
|
+
to: contractAddress,
|
|
499
|
+
data: callData,
|
|
490
500
|
},
|
|
491
501
|
};
|
|
492
502
|
}
|
|
@@ -224,6 +224,11 @@ export const relayTokenToAssetId = (relayToken) => {
|
|
|
224
224
|
assetReference: ASSET_REFERENCE.Sei,
|
|
225
225
|
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
226
226
|
};
|
|
227
|
+
case CHAIN_REFERENCE.AbstractMainnet:
|
|
228
|
+
return {
|
|
229
|
+
assetReference: ASSET_REFERENCE.Abstract,
|
|
230
|
+
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
231
|
+
};
|
|
227
232
|
default:
|
|
228
233
|
throw Error(`chainId '${relayToken.chainId}' not supported`);
|
|
229
234
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tonChainId } from '@shapeshiftoss/caip';
|
|
1
2
|
import { Err, Ok } from '@sniptt/monads';
|
|
2
3
|
import { SettlementMethod } from '@ston-fi/omniston-sdk';
|
|
3
4
|
import { SwapperName, TradeQuoteError } from '../../../types.js';
|
|
@@ -37,7 +38,7 @@ export const getTradeQuote = async (input) => {
|
|
|
37
38
|
try {
|
|
38
39
|
const slippageBps = slippageDecimalToBps(slippageTolerancePercentageDecimal, STONFI_DEFAULT_SLIPPAGE_BPS);
|
|
39
40
|
const referrerFeeBps = affiliateBpsToNumber(affiliateBps);
|
|
40
|
-
const tonTreasuryAddress = getTreasuryAddressFromChainId(
|
|
41
|
+
const tonTreasuryAddress = getTreasuryAddressFromChainId(tonChainId);
|
|
41
42
|
const referrerAddress = tonAddressToOmnistonAddress(tonTreasuryAddress);
|
|
42
43
|
const quoteResult = await waitForQuote(omniston, {
|
|
43
44
|
settlementMethods: [SettlementMethod.SETTLEMENT_METHOD_SWAP],
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"AVAX.SOL-0XFE6B19286885A4F7F55ADAD09C3CD1F906D2478F": "eip155:43114/erc20:0xfe6b19286885a4f7f55adad09c3cd1f906d2478f",
|
|
4
4
|
"AVAX.USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E": "eip155:43114/erc20:0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
5
5
|
"AVAX.USDT-0X9702230A8EA53601F5CD2DC00FDBC13D4DF4A8C7": "eip155:43114/erc20:0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
|
|
6
|
-
"BASE.CBBTC-0XCBB7C0000AB88B473B1F5AFD9EF808440EED33BF": "eip155:8453/erc20:0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf",
|
|
7
6
|
"BASE.ETH": "eip155:8453/slip44:60",
|
|
8
7
|
"BASE.USDC-0X833589FCD6EDB6E08F4C7C32D4F71B54BDA02913": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
9
8
|
"BASE.VVV-0XACFE6019ED1A7DC6F7B508C02D1B04EC88CC21BF": "eip155:8453/erc20:0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tronAssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { contractAddressOrUndefined } from '@shapeshiftoss/utils';
|
|
3
|
+
import { TronWeb } from 'tronweb';
|
|
3
4
|
import { getExecutableTradeStep, isExecutableTradeQuote } from '../utils.js';
|
|
4
5
|
export const getUnsignedTronTransaction = ({ stepIndex, tradeQuote, from, assertGetTronChainAdapter, }) => {
|
|
5
6
|
if (!isExecutableTradeQuote(tradeQuote))
|
|
@@ -27,6 +28,21 @@ export const getUnsignedTronTransaction = ({ stepIndex, tradeQuote, from, assert
|
|
|
27
28
|
args,
|
|
28
29
|
});
|
|
29
30
|
}
|
|
31
|
+
if (relayTransactionMetadata?.data) {
|
|
32
|
+
if (!relayTransactionMetadata.to) {
|
|
33
|
+
throw new Error('Missing Relay transaction destination address');
|
|
34
|
+
}
|
|
35
|
+
const to = TronWeb.address.fromHex(relayTransactionMetadata.to);
|
|
36
|
+
const isNativeTron = sellAsset.assetId === tronAssetId;
|
|
37
|
+
const value = isNativeTron ? step.sellAmountIncludingProtocolFeesCryptoBaseUnit : '0';
|
|
38
|
+
return adapter.buildCustomApiTx({
|
|
39
|
+
from,
|
|
40
|
+
to,
|
|
41
|
+
accountNumber,
|
|
42
|
+
data: relayTransactionMetadata.data,
|
|
43
|
+
value,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
30
46
|
const to = relayTransactionMetadata?.to ?? nearIntentsSpecific?.depositAddress;
|
|
31
47
|
if (!to)
|
|
32
48
|
throw new Error('Missing transaction destination address');
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { QuoteResponse } from '@jup-ag/api';
|
|
2
1
|
import type { AccountId, AssetId, ChainId, Nominal } from '@shapeshiftoss/caip';
|
|
3
2
|
import type { ChainAdapter, CosmosSdkChainAdapter, EvmChainAdapter, near, SignTx, solana, starknet, sui, ton, tron, UtxoChainAdapter } from '@shapeshiftoss/chain-adapters';
|
|
4
3
|
import type { HDWallet, SolanaSignTx, StarknetSignTx, SuiSignTx } from '@shapeshiftoss/hdwallet-core';
|
|
@@ -41,7 +40,6 @@ export type SwapperConfig = {
|
|
|
41
40
|
VITE_CHAINFLIP_API_KEY: string;
|
|
42
41
|
VITE_CHAINFLIP_API_URL: string;
|
|
43
42
|
VITE_FEATURE_CHAINFLIP_SWAP_DCA: boolean;
|
|
44
|
-
VITE_JUPITER_API_URL: string;
|
|
45
43
|
VITE_RELAY_API_URL: string;
|
|
46
44
|
VITE_BEBOP_API_KEY: string;
|
|
47
45
|
VITE_NEAR_INTENTS_API_KEY: string;
|
|
@@ -62,7 +60,6 @@ export declare enum SwapperName {
|
|
|
62
60
|
ArbitrumBridge = "Arbitrum Bridge",
|
|
63
61
|
Portals = "Portals",
|
|
64
62
|
Chainflip = "Chainflip",
|
|
65
|
-
Jupiter = "Jupiter",
|
|
66
63
|
Relay = "Relay",
|
|
67
64
|
ButterSwap = "ButterSwap",
|
|
68
65
|
Bebop = "Bebop",
|
|
@@ -307,7 +304,6 @@ export type TradeQuoteStep = {
|
|
|
307
304
|
};
|
|
308
305
|
bebopSolanaSerializedTx?: string;
|
|
309
306
|
bebopQuoteId?: string;
|
|
310
|
-
jupiterQuoteResponse?: QuoteResponse;
|
|
311
307
|
solanaTransactionMetadata?: {
|
|
312
308
|
addressLookupTableAddresses: string[];
|
|
313
309
|
instructions?: TransactionInstruction[];
|
|
@@ -316,7 +312,7 @@ export type TradeQuoteStep = {
|
|
|
316
312
|
};
|
|
317
313
|
cowswapQuoteResponse?: OrderQuoteResponse;
|
|
318
314
|
chainflipSpecific?: {
|
|
319
|
-
chainflipSwapId?: number;
|
|
315
|
+
chainflipSwapId?: number | string;
|
|
320
316
|
chainflipDepositAddress?: string;
|
|
321
317
|
chainflipNumberOfChunks?: number;
|
|
322
318
|
chainflipChunkIntervalBlocks?: number;
|
|
@@ -446,7 +442,7 @@ export type SwapExecutionMetadata = {
|
|
|
446
442
|
inboundAddress?: string;
|
|
447
443
|
};
|
|
448
444
|
export type SwapperSpecificMetadata = {
|
|
449
|
-
chainflipSwapId: number | undefined;
|
|
445
|
+
chainflipSwapId: number | string | undefined;
|
|
450
446
|
nearIntentsSpecific?: {
|
|
451
447
|
depositAddress: string;
|
|
452
448
|
depositMemo?: string;
|
|
@@ -646,6 +642,7 @@ export type TradeStatus = {
|
|
|
646
642
|
relayerExplorerTxLink?: string | undefined;
|
|
647
643
|
message: string | [string, InterpolationOptions] | undefined;
|
|
648
644
|
actualBuyAmountCryptoBaseUnit?: string;
|
|
645
|
+
chainflipSwapId?: number | string;
|
|
649
646
|
};
|
|
650
647
|
export type TradeQuoteResult = Result<TradeQuote[], SwapErrorRight>;
|
|
651
648
|
export type TradeRateResult = Result<TradeRate[], SwapErrorRight>;
|
package/dist/esm/types.js
CHANGED
|
@@ -8,7 +8,6 @@ export var SwapperName;
|
|
|
8
8
|
SwapperName["ArbitrumBridge"] = "Arbitrum Bridge";
|
|
9
9
|
SwapperName["Portals"] = "Portals";
|
|
10
10
|
SwapperName["Chainflip"] = "Chainflip";
|
|
11
|
-
SwapperName["Jupiter"] = "Jupiter";
|
|
12
11
|
SwapperName["Relay"] = "Relay";
|
|
13
12
|
SwapperName["ButterSwap"] = "ButterSwap";
|
|
14
13
|
SwapperName["Bebop"] = "Bebop";
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -75,3 +75,6 @@ export declare const checkStarknetSwapStatus: ({ txHash, assertGetStarknetChainA
|
|
|
75
75
|
txHash: string;
|
|
76
76
|
assertGetStarknetChainAdapter: (chainId: ChainId) => starknet.ChainAdapter;
|
|
77
77
|
}) => Promise<TradeStatus>;
|
|
78
|
+
export declare class SolanaLogsError extends Error {
|
|
79
|
+
constructor(name: string);
|
|
80
|
+
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -169,8 +169,7 @@ export const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEv
|
|
|
169
169
|
message: undefined,
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
catch
|
|
173
|
-
console.error(e);
|
|
172
|
+
catch {
|
|
174
173
|
return createDefaultStatusResponse(txHash);
|
|
175
174
|
}
|
|
176
175
|
};
|
|
@@ -287,3 +286,9 @@ export const checkStarknetSwapStatus = async ({ txHash, assertGetStarknetChainAd
|
|
|
287
286
|
return createDefaultStatusResponse(txHash);
|
|
288
287
|
}
|
|
289
288
|
};
|
|
289
|
+
export class SolanaLogsError extends Error {
|
|
290
|
+
constructor(name) {
|
|
291
|
+
super(name);
|
|
292
|
+
this.name = name;
|
|
293
|
+
}
|
|
294
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/swapper",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.1",
|
|
4
4
|
"repository": "https://github.com/shapeshift/web",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@coral-xyz/anchor": "0.29.0",
|
|
29
29
|
"@cowprotocol/app-data": "^2.3.0",
|
|
30
30
|
"@defuse-protocol/one-click-sdk-typescript": "^0.1.1-0.2",
|
|
31
|
-
"@jup-ag/api": "^6.0.30",
|
|
32
31
|
"@mysten/sui": "^1.45.2",
|
|
33
32
|
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.0",
|
|
34
33
|
"@sniptt/monads": "^0.5.10",
|
|
@@ -51,10 +50,10 @@
|
|
|
51
50
|
"uuid": "^9.0.0",
|
|
52
51
|
"viem": "2.43.5",
|
|
53
52
|
"@shapeshiftoss/caip": "^8.16.7",
|
|
53
|
+
"@shapeshiftoss/chain-adapters": "^11.3.9",
|
|
54
54
|
"@shapeshiftoss/contracts": "^1.0.5-coderabbit-fix.2",
|
|
55
55
|
"@shapeshiftoss/hdwallet-core": "^1.62.41",
|
|
56
56
|
"@shapeshiftoss/types": "^8.6.7",
|
|
57
|
-
"@shapeshiftoss/chain-adapters": "^11.3.9",
|
|
58
57
|
"@shapeshiftoss/unchained-client": "^10.14.10",
|
|
59
58
|
"@shapeshiftoss/utils": "^1.0.5"
|
|
60
59
|
},
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jupiterSwapper = void 0;
|
|
4
|
-
const __1 = require("../..");
|
|
5
|
-
const errorPatterns_1 = require("./errorPatterns");
|
|
6
|
-
exports.jupiterSwapper = {
|
|
7
|
-
executeSolanaTransaction: async (txToSign, callbacks) => {
|
|
8
|
-
try {
|
|
9
|
-
const txid = await (0, __1.executeSolanaTransaction)(txToSign, callbacks);
|
|
10
|
-
return txid;
|
|
11
|
-
}
|
|
12
|
-
catch (e) {
|
|
13
|
-
if (e instanceof Error) {
|
|
14
|
-
const errorMessage = e.message;
|
|
15
|
-
const swapperErrorType = Object.keys(errorPatterns_1.JUPITER_ERRORS).reduce((acc, errorPattern) => {
|
|
16
|
-
if (errorMessage.includes(errorPattern)) {
|
|
17
|
-
acc = errorPatterns_1.JUPITER_ERRORS[errorPattern];
|
|
18
|
-
}
|
|
19
|
-
return acc;
|
|
20
|
-
}, undefined);
|
|
21
|
-
if (swapperErrorType)
|
|
22
|
-
throw new errorPatterns_1.SolanaLogsError(swapperErrorType);
|
|
23
|
-
}
|
|
24
|
-
throw e;
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jupiterApi = void 0;
|
|
4
|
-
const getSolanaTransactionFees_1 = require("../../solana-utils/getSolanaTransactionFees");
|
|
5
|
-
const getUnsignedSolanaTransaction_1 = require("../../solana-utils/getUnsignedSolanaTransaction");
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const getTradeQuote_1 = require("./swapperApi/getTradeQuote");
|
|
8
|
-
const getTradeRate_1 = require("./swapperApi/getTradeRate");
|
|
9
|
-
exports.jupiterApi = {
|
|
10
|
-
getTradeRate: getTradeRate_1.getTradeRate,
|
|
11
|
-
getTradeQuote: getTradeQuote_1.getTradeQuote,
|
|
12
|
-
getUnsignedSolanaTransaction: getUnsignedSolanaTransaction_1.getUnsignedSolanaTransaction,
|
|
13
|
-
getSolanaTransactionFees: getSolanaTransactionFees_1.getSolanaTransactionFees,
|
|
14
|
-
checkTradeStatus: utils_1.checkSolanaSwapStatus,
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class SolanaLogsError extends Error {
|
|
2
|
-
constructor(name: string);
|
|
3
|
-
}
|
|
4
|
-
export declare enum JUPITER_ERROR_PATTERNS {
|
|
5
|
-
SLIPPAGE_TOLERANCE_EXCEEDED = "SlippageToleranceExceeded",
|
|
6
|
-
JUPITER_SLIPPAGE_ERROR_CODE = "0x1771",
|
|
7
|
-
UNDER_MINIMUM_AMOUNT = "RequireGteViolated",
|
|
8
|
-
CONSUMED_MORE_FEES = "exceeded CUs meter"
|
|
9
|
-
}
|
|
10
|
-
export declare enum JUPITER_ERROR_NAME {
|
|
11
|
-
SLIPPAGE_TOLERANCE_EXCEEDED = "SlippageToleranceExceeded",
|
|
12
|
-
UNDER_MINIMUM_AMOUNT = "UnderMinimumAmount",
|
|
13
|
-
CONSUMED_MORE_FEES = "ConsumedMoreFees"
|
|
14
|
-
}
|
|
15
|
-
export declare const JUPITER_ERRORS: Record<JUPITER_ERROR_PATTERNS | string, string>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JUPITER_ERRORS = exports.JUPITER_ERROR_NAME = exports.JUPITER_ERROR_PATTERNS = exports.SolanaLogsError = void 0;
|
|
4
|
-
class SolanaLogsError extends Error {
|
|
5
|
-
constructor(name) {
|
|
6
|
-
super(name);
|
|
7
|
-
this.name = name;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.SolanaLogsError = SolanaLogsError;
|
|
11
|
-
var JUPITER_ERROR_PATTERNS;
|
|
12
|
-
(function (JUPITER_ERROR_PATTERNS) {
|
|
13
|
-
JUPITER_ERROR_PATTERNS["SLIPPAGE_TOLERANCE_EXCEEDED"] = "SlippageToleranceExceeded";
|
|
14
|
-
JUPITER_ERROR_PATTERNS["JUPITER_SLIPPAGE_ERROR_CODE"] = "0x1771";
|
|
15
|
-
JUPITER_ERROR_PATTERNS["UNDER_MINIMUM_AMOUNT"] = "RequireGteViolated";
|
|
16
|
-
JUPITER_ERROR_PATTERNS["CONSUMED_MORE_FEES"] = "exceeded CUs meter";
|
|
17
|
-
})(JUPITER_ERROR_PATTERNS || (exports.JUPITER_ERROR_PATTERNS = JUPITER_ERROR_PATTERNS = {}));
|
|
18
|
-
var JUPITER_ERROR_NAME;
|
|
19
|
-
(function (JUPITER_ERROR_NAME) {
|
|
20
|
-
JUPITER_ERROR_NAME["SLIPPAGE_TOLERANCE_EXCEEDED"] = "SlippageToleranceExceeded";
|
|
21
|
-
JUPITER_ERROR_NAME["UNDER_MINIMUM_AMOUNT"] = "UnderMinimumAmount";
|
|
22
|
-
JUPITER_ERROR_NAME["CONSUMED_MORE_FEES"] = "ConsumedMoreFees";
|
|
23
|
-
})(JUPITER_ERROR_NAME || (exports.JUPITER_ERROR_NAME = JUPITER_ERROR_NAME = {}));
|
|
24
|
-
exports.JUPITER_ERRORS = {
|
|
25
|
-
[JUPITER_ERROR_PATTERNS.SLIPPAGE_TOLERANCE_EXCEEDED]: JUPITER_ERROR_NAME.SLIPPAGE_TOLERANCE_EXCEEDED,
|
|
26
|
-
[JUPITER_ERROR_PATTERNS.JUPITER_SLIPPAGE_ERROR_CODE]: JUPITER_ERROR_NAME.SLIPPAGE_TOLERANCE_EXCEEDED,
|
|
27
|
-
[JUPITER_ERROR_PATTERNS.UNDER_MINIMUM_AMOUNT]: JUPITER_ERROR_NAME.UNDER_MINIMUM_AMOUNT,
|
|
28
|
-
[JUPITER_ERROR_PATTERNS.CONSUMED_MORE_FEES]: JUPITER_ERROR_NAME.CONSUMED_MORE_FEES,
|
|
29
|
-
};
|