@shapeshiftoss/swapper 17.6.6-alpha.1 → 17.6.7

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.
Files changed (93) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/constants.js +27 -18
  3. package/dist/cjs/index.d.ts +1 -0
  4. package/dist/cjs/index.js +1 -0
  5. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +2 -0
  6. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeRate.test.js +4 -0
  7. package/dist/cjs/swappers/CetusSwapper/CetusSwapper.d.ts +2 -0
  8. package/dist/cjs/swappers/CetusSwapper/CetusSwapper.js +7 -0
  9. package/dist/cjs/swappers/CetusSwapper/endpoints.d.ts +2 -0
  10. package/dist/cjs/swappers/CetusSwapper/endpoints.js +87 -0
  11. package/dist/cjs/swappers/CetusSwapper/index.d.ts +1 -0
  12. package/dist/cjs/swappers/CetusSwapper/index.js +17 -0
  13. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeQuote.d.ts +3 -0
  14. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeQuote.js +122 -0
  15. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeRate.d.ts +3 -0
  16. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeRate.js +110 -0
  17. package/dist/cjs/swappers/CetusSwapper/utils/constants.d.ts +3 -0
  18. package/dist/cjs/swappers/CetusSwapper/utils/constants.js +9 -0
  19. package/dist/cjs/swappers/CetusSwapper/utils/helpers.d.ts +13 -0
  20. package/dist/cjs/swappers/CetusSwapper/utils/helpers.js +118 -0
  21. package/dist/cjs/swappers/NearIntentsSwapper/NearIntentsSwapper.js +2 -0
  22. package/dist/cjs/swappers/NearIntentsSwapper/endpoints.js +43 -0
  23. package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +50 -10
  24. package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +65 -9
  25. package/dist/cjs/swappers/NearIntentsSwapper/types.d.ts +2 -2
  26. package/dist/cjs/swappers/NearIntentsSwapper/types.js +4 -0
  27. package/dist/cjs/swappers/NearIntentsSwapper/utils/helpers/helpers.js +12 -7
  28. package/dist/cjs/swappers/RelaySwapper/RelaySwapper.js +1 -0
  29. package/dist/cjs/swappers/RelaySwapper/constant.d.ts +2 -2
  30. package/dist/cjs/swappers/RelaySwapper/constant.js +27 -36
  31. package/dist/cjs/swappers/RelaySwapper/endpoints.js +4 -0
  32. package/dist/cjs/swappers/RelaySwapper/utils/getRelayAssetAddress.js +2 -0
  33. package/dist/cjs/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
  34. package/dist/cjs/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.js +2 -0
  35. package/dist/cjs/swappers/RelaySwapper/utils/getRelayPsbtRelayer.js +1 -1
  36. package/dist/cjs/swappers/RelaySwapper/utils/getTrade.js +7 -2
  37. package/dist/cjs/swappers/RelaySwapper/utils/relayTokenToAssetId.js +15 -0
  38. package/dist/cjs/thorchain-utils/getL1RateOrQuote.js +12 -0
  39. package/dist/cjs/tron-utils/getTronTransactionFees.d.ts +2 -0
  40. package/dist/cjs/tron-utils/getTronTransactionFees.js +14 -0
  41. package/dist/cjs/tron-utils/getUnsignedTronTransaction.d.ts +2 -0
  42. package/dist/cjs/tron-utils/getUnsignedTronTransaction.js +28 -0
  43. package/dist/cjs/types.d.ts +56 -11
  44. package/dist/cjs/types.js +1 -0
  45. package/dist/cjs/utils.d.ts +11 -3
  46. package/dist/cjs/utils.js +34 -1
  47. package/dist/esm/.tsbuildinfo +1 -1
  48. package/dist/esm/constants.js +9 -0
  49. package/dist/esm/index.d.ts +1 -0
  50. package/dist/esm/index.js +1 -0
  51. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +2 -0
  52. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeRate.test.js +4 -0
  53. package/dist/esm/swappers/CetusSwapper/CetusSwapper.d.ts +2 -0
  54. package/dist/esm/swappers/CetusSwapper/CetusSwapper.js +4 -0
  55. package/dist/esm/swappers/CetusSwapper/endpoints.d.ts +2 -0
  56. package/dist/esm/swappers/CetusSwapper/endpoints.js +84 -0
  57. package/dist/esm/swappers/CetusSwapper/index.d.ts +1 -0
  58. package/dist/esm/swappers/CetusSwapper/index.js +1 -0
  59. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeQuote.d.ts +3 -0
  60. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeQuote.js +118 -0
  61. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeRate.d.ts +3 -0
  62. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeRate.js +106 -0
  63. package/dist/esm/swappers/CetusSwapper/utils/constants.d.ts +3 -0
  64. package/dist/esm/swappers/CetusSwapper/utils/constants.js +5 -0
  65. package/dist/esm/swappers/CetusSwapper/utils/helpers.d.ts +13 -0
  66. package/dist/esm/swappers/CetusSwapper/utils/helpers.js +86 -0
  67. package/dist/esm/swappers/NearIntentsSwapper/NearIntentsSwapper.js +3 -1
  68. package/dist/esm/swappers/NearIntentsSwapper/endpoints.js +43 -0
  69. package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +51 -11
  70. package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +66 -10
  71. package/dist/esm/swappers/NearIntentsSwapper/types.d.ts +2 -2
  72. package/dist/esm/swappers/NearIntentsSwapper/types.js +4 -0
  73. package/dist/esm/swappers/NearIntentsSwapper/utils/helpers/helpers.js +13 -8
  74. package/dist/esm/swappers/RelaySwapper/RelaySwapper.js +2 -1
  75. package/dist/esm/swappers/RelaySwapper/constant.d.ts +2 -2
  76. package/dist/esm/swappers/RelaySwapper/constant.js +6 -15
  77. package/dist/esm/swappers/RelaySwapper/endpoints.js +4 -0
  78. package/dist/esm/swappers/RelaySwapper/utils/getRelayAssetAddress.js +4 -2
  79. package/dist/esm/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
  80. package/dist/esm/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.js +4 -2
  81. package/dist/esm/swappers/RelaySwapper/utils/getRelayPsbtRelayer.js +1 -1
  82. package/dist/esm/swappers/RelaySwapper/utils/getTrade.js +8 -3
  83. package/dist/esm/swappers/RelaySwapper/utils/relayTokenToAssetId.js +17 -2
  84. package/dist/esm/thorchain-utils/getL1RateOrQuote.js +12 -0
  85. package/dist/esm/tron-utils/getTronTransactionFees.d.ts +2 -0
  86. package/dist/esm/tron-utils/getTronTransactionFees.js +10 -0
  87. package/dist/esm/tron-utils/getUnsignedTronTransaction.d.ts +2 -0
  88. package/dist/esm/tron-utils/getUnsignedTronTransaction.js +24 -0
  89. package/dist/esm/types.d.ts +56 -11
  90. package/dist/esm/types.js +1 -0
  91. package/dist/esm/utils.d.ts +11 -3
  92. package/dist/esm/utils.js +31 -1
  93. package/package.json +17 -10
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.calculateSwapAmounts = exports.findBestPool = exports.calculateAmountLimit = exports.determineSwapDirection = exports.getCoinType = exports.getCetusSDK = void 0;
27
+ const caip_1 = require("@shapeshiftoss/caip");
28
+ const utils_1 = require("@shapeshiftoss/utils");
29
+ let sdkInstance;
30
+ const getCetusSDK = async () => {
31
+ if (!sdkInstance) {
32
+ const { initMainnetSDK } = await Promise.resolve().then(() => __importStar(require('@cetusprotocol/cetus-sui-clmm-sdk')));
33
+ sdkInstance = initMainnetSDK();
34
+ }
35
+ return sdkInstance;
36
+ };
37
+ exports.getCetusSDK = getCetusSDK;
38
+ const getCoinType = (asset) => {
39
+ const { assetReference, assetNamespace } = (0, caip_1.fromAssetId)(asset.assetId);
40
+ // For native SUI token, the assetReference is 'slip44:784' but Cetus expects '0x2::sui::SUI'
41
+ if (assetNamespace === 'slip44') {
42
+ return '0x2::sui::SUI';
43
+ }
44
+ // For other tokens, the assetReference should be the full coin type
45
+ return assetReference;
46
+ };
47
+ exports.getCoinType = getCoinType;
48
+ const determineSwapDirection = (pool, sellCoinType, buyCoinType) => {
49
+ if (pool.coinTypeA === sellCoinType && pool.coinTypeB === buyCoinType) {
50
+ return true;
51
+ }
52
+ if (pool.coinTypeA === buyCoinType && pool.coinTypeB === sellCoinType) {
53
+ return false;
54
+ }
55
+ throw new Error('Pool does not match the swap pair');
56
+ };
57
+ exports.determineSwapDirection = determineSwapDirection;
58
+ const calculateAmountLimit = (estimatedAmount, slippageTolerancePercentageDecimal, isBuyAmount) => {
59
+ if (!slippageTolerancePercentageDecimal) {
60
+ return estimatedAmount;
61
+ }
62
+ const slippageFactor = (0, utils_1.bn)(1).minus(slippageTolerancePercentageDecimal);
63
+ if (isBuyAmount) {
64
+ return (0, utils_1.bnOrZero)(estimatedAmount).times(slippageFactor).toFixed(0);
65
+ }
66
+ const maxSlippageFactor = (0, utils_1.bn)(1).plus(slippageTolerancePercentageDecimal);
67
+ return (0, utils_1.bnOrZero)(estimatedAmount).times(maxSlippageFactor).toFixed(0);
68
+ };
69
+ exports.calculateAmountLimit = calculateAmountLimit;
70
+ const findBestPool = async (sdk, sellCoinType, buyCoinType) => {
71
+ const pools = await sdk.Pool.getPoolByCoins([sellCoinType, buyCoinType]);
72
+ if (!pools || pools.length === 0) {
73
+ return undefined;
74
+ }
75
+ const poolWithLiquidity = pools.find(pool => {
76
+ const hasLiquidity = pool.liquidity && (0, utils_1.bnOrZero)(pool.liquidity).gt(0);
77
+ return hasLiquidity;
78
+ });
79
+ if (!poolWithLiquidity) {
80
+ console.warn('[Cetus] No pools with liquidity found for', sellCoinType, buyCoinType, {
81
+ totalPools: pools.length,
82
+ pools: pools.map(p => ({ id: p.poolAddress, liquidity: p.liquidity })),
83
+ });
84
+ }
85
+ return poolWithLiquidity;
86
+ };
87
+ exports.findBestPool = findBestPool;
88
+ const calculateSwapAmounts = async (sdk, pool, sellAsset, buyAsset, sellAmount) => {
89
+ const sellCoinType = (0, exports.getCoinType)(sellAsset);
90
+ const buyCoinType = (0, exports.getCoinType)(buyAsset);
91
+ const a2b = (0, exports.determineSwapDirection)(pool, sellCoinType, buyCoinType);
92
+ const decimalsA = pool.coinTypeA === sellCoinType ? sellAsset.precision : buyAsset.precision;
93
+ const decimalsB = pool.coinTypeA === sellCoinType ? buyAsset.precision : sellAsset.precision;
94
+ const preSwapParams = {
95
+ pool,
96
+ currentSqrtPrice: pool.current_sqrt_price,
97
+ coinTypeA: pool.coinTypeA,
98
+ coinTypeB: pool.coinTypeB,
99
+ decimalsA,
100
+ decimalsB,
101
+ a2b,
102
+ byAmountIn: true,
103
+ amount: sellAmount,
104
+ };
105
+ const preSwapResult = await sdk.Swap.preswap(preSwapParams);
106
+ if (!preSwapResult) {
107
+ return undefined;
108
+ }
109
+ if (preSwapResult.estimatedAmountOut === '0' || preSwapResult.estimatedAmountOut === '') {
110
+ return undefined;
111
+ }
112
+ return {
113
+ estimatedAmountOut: preSwapResult.estimatedAmountOut,
114
+ estimatedAmountIn: preSwapResult.estimatedAmountIn,
115
+ estimatedFeeAmount: preSwapResult.estimatedFeeAmount,
116
+ };
117
+ };
118
+ exports.calculateSwapAmounts = calculateSwapAmounts;
@@ -5,6 +5,8 @@ const utils_1 = require("../../utils");
5
5
  exports.nearIntentsSwapper = {
6
6
  executeEvmTransaction: utils_1.executeEvmTransaction,
7
7
  executeSolanaTransaction: utils_1.executeSolanaTransaction,
8
+ executeTronTransaction: utils_1.executeTronTransaction,
9
+ executeSuiTransaction: utils_1.executeSuiTransaction,
8
10
  executeUtxoTransaction: (txToSign, { signAndBroadcastTransaction }) => {
9
11
  return signAndBroadcastTransaction(txToSign);
10
12
  },
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nearIntentsApi = void 0;
4
4
  const chain_adapters_1 = require("@shapeshiftoss/chain-adapters");
5
5
  const utils_1 = require("@shapeshiftoss/utils");
6
+ const getTronTransactionFees_1 = require("../../tron-utils/getTronTransactionFees");
7
+ const getUnsignedTronTransaction_1 = require("../../tron-utils/getUnsignedTronTransaction");
6
8
  const utils_2 = require("../../utils");
7
9
  const helpers_1 = require("../utils/helpers/helpers");
8
10
  const getTradeQuote_1 = require("./swapperApi/getTradeQuote");
@@ -139,6 +141,45 @@ exports.nearIntentsApi = {
139
141
  }
140
142
  return Promise.resolve(step.feeData.networkFeeCryptoBaseUnit);
141
143
  },
144
+ getUnsignedTronTransaction: getUnsignedTronTransaction_1.getUnsignedTronTransaction,
145
+ getTronTransactionFees: getTronTransactionFees_1.getTronTransactionFees,
146
+ getUnsignedSuiTransaction: async ({ stepIndex, tradeQuote, from, assertGetSuiChainAdapter, }) => {
147
+ if (!(0, utils_2.isExecutableTradeQuote)(tradeQuote))
148
+ throw new Error('Unable to execute a trade rate quote');
149
+ const step = (0, utils_2.getExecutableTradeStep)(tradeQuote, stepIndex);
150
+ const { accountNumber, sellAsset, nearIntentsSpecific } = step;
151
+ if (!nearIntentsSpecific)
152
+ throw new Error('nearIntentsSpecific is required');
153
+ const adapter = assertGetSuiChainAdapter(sellAsset.chainId);
154
+ const to = nearIntentsSpecific.depositAddress;
155
+ const value = step.sellAmountIncludingProtocolFeesCryptoBaseUnit;
156
+ const tokenId = (0, utils_1.contractAddressOrUndefined)(sellAsset.assetId);
157
+ const { fast } = await adapter.getFeeData({
158
+ to,
159
+ value,
160
+ chainSpecific: { from, tokenId },
161
+ });
162
+ return adapter.buildSendApiTransaction({
163
+ to,
164
+ from,
165
+ value,
166
+ accountNumber,
167
+ chainSpecific: {
168
+ tokenId,
169
+ gasBudget: fast.chainSpecific.gasBudget,
170
+ gasPrice: fast.chainSpecific.gasPrice,
171
+ },
172
+ });
173
+ },
174
+ getSuiTransactionFees: ({ tradeQuote, stepIndex }) => {
175
+ if (!(0, utils_2.isExecutableTradeQuote)(tradeQuote))
176
+ throw new Error('Unable to execute a trade rate quote');
177
+ const step = (0, utils_2.getExecutableTradeStep)(tradeQuote, stepIndex);
178
+ if (!step.feeData.networkFeeCryptoBaseUnit) {
179
+ throw new Error('Missing network fee in quote');
180
+ }
181
+ return Promise.resolve(step.feeData.networkFeeCryptoBaseUnit);
182
+ },
142
183
  checkTradeStatus: async ({ config, swap }) => {
143
184
  const { nearIntentsSpecific } = swap?.metadata ?? {};
144
185
  if (!nearIntentsSpecific?.depositAddress) {
@@ -152,10 +193,12 @@ exports.nearIntentsApi = {
152
193
  const message = (0, helpers_2.getNearIntentsStatusMessage)(statusResponse.status);
153
194
  // Extract buyTxHash from destination chain transactions
154
195
  const buyTxHash = statusResponse.swapDetails?.destinationChainTxHashes?.[0]?.hash;
196
+ const actualBuyAmountCryptoBaseUnit = statusResponse.swapDetails?.amountOut;
155
197
  return {
156
198
  status: txStatus,
157
199
  buyTxHash,
158
200
  message,
201
+ actualBuyAmountCryptoBaseUnit,
159
202
  };
160
203
  }
161
204
  catch (error) {
@@ -39,11 +39,16 @@ const getTradeQuote = async (input, deps) => {
39
39
  (0, oneClickService_1.initializeOneClickService)(deps.config.VITE_NEAR_INTENTS_API_KEY);
40
40
  const originAsset = await (0, helpers_2.assetToNearIntentsAsset)(sellAsset);
41
41
  const destinationAsset = await (0, helpers_2.assetToNearIntentsAsset)(buyAsset);
42
- // This shouldn't be the case since we already got a rate and know these exist, but...
43
- if (!(originAsset && destinationAsset)) {
42
+ if (!originAsset) {
44
43
  return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
45
44
  code: types_1.TradeQuoteError.UnsupportedTradePair,
46
- message: 'Unsupported asset',
45
+ message: `Asset ${sellAsset.symbol} on ${sellAsset.networkName || sellAsset.chainId} is not supported by NEAR Intents`,
46
+ }));
47
+ }
48
+ if (!destinationAsset) {
49
+ return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
50
+ code: types_1.TradeQuoteError.UnsupportedTradePair,
51
+ message: `Asset ${buyAsset.symbol} on ${buyAsset.networkName || buyAsset.chainId} is not supported by NEAR Intents`,
47
52
  }));
48
53
  }
49
54
  const quoteRequest = {
@@ -141,6 +146,30 @@ const getTradeQuote = async (input, deps) => {
141
146
  const totalFee = (0, utils_1.bn)(txFee).plus(ataCreationCost).toString();
142
147
  return { networkFeeCryptoBaseUnit: totalFee };
143
148
  }
149
+ case caip_1.CHAIN_NAMESPACE.Tron: {
150
+ const sellAdapter = deps.assertGetTronChainAdapter(sellAsset.chainId);
151
+ const feeData = await sellAdapter.getFeeData({
152
+ to: depositAddress,
153
+ value: sellAmount,
154
+ });
155
+ return { networkFeeCryptoBaseUnit: feeData.fast.txFee };
156
+ }
157
+ case caip_1.CHAIN_NAMESPACE.Sui: {
158
+ const sellAdapter = deps.assertGetSuiChainAdapter(sellAsset.chainId);
159
+ const tokenId = (0, utils_1.isToken)(sellAsset.assetId)
160
+ ? (0, caip_1.fromAssetId)(sellAsset.assetId).assetReference
161
+ : undefined;
162
+ const feeData = await sellAdapter.getFeeData({
163
+ to: depositAddress,
164
+ value: sellAmount,
165
+ chainSpecific: {
166
+ from,
167
+ tokenId,
168
+ },
169
+ sendMax: false,
170
+ });
171
+ return { networkFeeCryptoBaseUnit: feeData.fast.txFee };
172
+ }
144
173
  default:
145
174
  throw new Error(`Unsupported chain namespace: ${chainNamespace}`);
146
175
  }
@@ -191,13 +220,24 @@ const getTradeQuote = async (input, deps) => {
191
220
  }
192
221
  catch (error) {
193
222
  console.error('[NEAR Intents] getTradeQuote error:', error);
194
- if (error instanceof oneClickService_1.ApiError &&
195
- (error.body?.message === 'tokenIn is not valid' ||
196
- error.body?.message === 'tokenOut is not valid')) {
197
- return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
198
- code: types_1.TradeQuoteError.UnsupportedTradePair,
199
- message: 'Unsupported asset',
200
- }));
223
+ if (error instanceof oneClickService_1.ApiError) {
224
+ if (error.body?.message === 'tokenIn is not valid' ||
225
+ error.body?.message === 'tokenOut is not valid') {
226
+ return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
227
+ code: types_1.TradeQuoteError.UnsupportedTradePair,
228
+ message: 'Unsupported asset',
229
+ }));
230
+ }
231
+ if (error.body?.message?.includes('Amount is too low')) {
232
+ const match = error.body.message.match(/try at least (\d+)/);
233
+ if (match) {
234
+ const minAmountCryptoBaseUnit = match[1];
235
+ return (0, monads_1.Err)((0, utils_2.createTradeAmountTooSmallErr)({
236
+ minAmountCryptoBaseUnit,
237
+ assetId: sellAsset.assetId,
238
+ }));
239
+ }
240
+ }
201
241
  }
202
242
  return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
203
243
  message: error instanceof Error ? error.message : 'Unknown error getting NEAR Intents quote',
@@ -22,10 +22,18 @@ const getTradeRate = async (input, deps) => {
22
22
  (0, oneClickService_1.initializeOneClickService)(deps.config.VITE_NEAR_INTENTS_API_KEY);
23
23
  const originAsset = await (0, helpers_2.assetToNearIntentsAsset)(sellAsset);
24
24
  const destinationAsset = await (0, helpers_2.assetToNearIntentsAsset)(buyAsset);
25
- if (!(originAsset && destinationAsset)) {
25
+ if (!originAsset) {
26
+ console.log('[NEAR] Returning error - originAsset not supported');
26
27
  return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
27
28
  code: types_1.TradeQuoteError.UnsupportedTradePair,
28
- message: 'Unsupported asset',
29
+ message: `Asset ${sellAsset.symbol} on ${sellAsset.networkName || sellAsset.chainId} is not supported by NEAR Intents`,
30
+ }));
31
+ }
32
+ if (!destinationAsset) {
33
+ console.log('[NEAR] Returning error - destinationAsset not supported');
34
+ return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
35
+ code: types_1.TradeQuoteError.UnsupportedTradePair,
36
+ message: `Asset ${buyAsset.symbol} on ${buyAsset.networkName || buyAsset.chainId} is not supported by NEAR Intents`,
29
37
  }));
30
38
  }
31
39
  // Wallet connected: use actual addresses
@@ -148,6 +156,43 @@ const getTradeRate = async (input, deps) => {
148
156
  return '0';
149
157
  }
150
158
  }
159
+ case caip_1.CHAIN_NAMESPACE.Tron: {
160
+ try {
161
+ const sellAdapter = deps.assertGetTronChainAdapter(sellAsset.chainId);
162
+ const feeData = await sellAdapter.getFeeData({
163
+ to: depositAddress,
164
+ value: sellAmount,
165
+ });
166
+ return feeData.fast.txFee;
167
+ }
168
+ catch (error) {
169
+ return '0';
170
+ }
171
+ }
172
+ case caip_1.CHAIN_NAMESPACE.Sui: {
173
+ try {
174
+ const sellAdapter = deps.assertGetSuiChainAdapter(sellAsset.chainId);
175
+ const tokenId = (0, utils_1.isToken)(sellAsset.assetId)
176
+ ? (0, caip_1.fromAssetId)(sellAsset.assetId).assetReference
177
+ : undefined;
178
+ if (!sendAddress) {
179
+ return '0';
180
+ }
181
+ const feeData = await sellAdapter.getFeeData({
182
+ to: depositAddress,
183
+ value: sellAmount,
184
+ chainSpecific: {
185
+ from: sendAddress,
186
+ tokenId,
187
+ },
188
+ sendMax: false,
189
+ });
190
+ return feeData.fast.txFee;
191
+ }
192
+ catch (error) {
193
+ return '0';
194
+ }
195
+ }
151
196
  default:
152
197
  return undefined;
153
198
  }
@@ -190,13 +235,24 @@ const getTradeRate = async (input, deps) => {
190
235
  return (0, monads_1.Ok)([tradeRate]);
191
236
  }
192
237
  catch (error) {
193
- if (error instanceof oneClickService_1.ApiError &&
194
- (error.body?.message === 'tokenIn is not valid' ||
195
- error.body?.message === 'tokenOut is not valid')) {
196
- return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
197
- code: types_1.TradeQuoteError.UnsupportedTradePair,
198
- message: 'Unsupported asset',
199
- }));
238
+ if (error instanceof oneClickService_1.ApiError) {
239
+ if (error.body?.message === 'tokenIn is not valid' ||
240
+ error.body?.message === 'tokenOut is not valid') {
241
+ return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
242
+ code: types_1.TradeQuoteError.UnsupportedTradePair,
243
+ message: 'Unsupported asset',
244
+ }));
245
+ }
246
+ if (error.body?.message?.includes('Amount is too low')) {
247
+ const match = error.body.message.match(/try at least (\d+)/);
248
+ if (match) {
249
+ const minAmountCryptoBaseUnit = match[1];
250
+ return (0, monads_1.Err)((0, utils_2.createTradeAmountTooSmallErr)({
251
+ minAmountCryptoBaseUnit,
252
+ assetId: sellAsset.assetId,
253
+ }));
254
+ }
255
+ }
200
256
  }
201
257
  return (0, monads_1.Err)((0, utils_2.makeSwapErrorRight)({
202
258
  message: error instanceof Error ? error.message : 'Unknown error getting NEAR Intents rate',
@@ -1,6 +1,6 @@
1
1
  import { KnownChainIds } from '@shapeshiftoss/types';
2
2
  export { QuoteRequest } from '@defuse-protocol/one-click-sdk-typescript';
3
- export type { QuoteResponse, GetExecutionStatusResponse, TokenResponse, } from '@defuse-protocol/one-click-sdk-typescript';
4
- export declare const nearIntentsSupportedChainIds: readonly [KnownChainIds.EthereumMainnet, KnownChainIds.ArbitrumMainnet, KnownChainIds.BaseMainnet, KnownChainIds.GnosisMainnet, KnownChainIds.BnbSmartChainMainnet, KnownChainIds.PolygonMainnet, KnownChainIds.AvalancheMainnet, KnownChainIds.OptimismMainnet, KnownChainIds.BitcoinMainnet, KnownChainIds.DogecoinMainnet, KnownChainIds.SolanaMainnet];
3
+ export type { GetExecutionStatusResponse, QuoteResponse, TokenResponse, } from '@defuse-protocol/one-click-sdk-typescript';
4
+ export declare const nearIntentsSupportedChainIds: readonly [KnownChainIds.EthereumMainnet, KnownChainIds.ArbitrumMainnet, KnownChainIds.BaseMainnet, KnownChainIds.GnosisMainnet, KnownChainIds.BnbSmartChainMainnet, KnownChainIds.PolygonMainnet, KnownChainIds.AvalancheMainnet, KnownChainIds.OptimismMainnet, KnownChainIds.BitcoinMainnet, KnownChainIds.DogecoinMainnet, KnownChainIds.SolanaMainnet, KnownChainIds.TronMainnet, KnownChainIds.SuiMainnet];
5
5
  export type NearIntentsSupportedChainId = (typeof nearIntentsSupportedChainIds)[number];
6
6
  export declare const chainIdToNearIntentsChain: Record<NearIntentsSupportedChainId, string>;
@@ -16,6 +16,8 @@ exports.nearIntentsSupportedChainIds = [
16
16
  types_1.KnownChainIds.BitcoinMainnet,
17
17
  types_1.KnownChainIds.DogecoinMainnet,
18
18
  types_1.KnownChainIds.SolanaMainnet,
19
+ types_1.KnownChainIds.TronMainnet,
20
+ types_1.KnownChainIds.SuiMainnet,
19
21
  ];
20
22
  exports.chainIdToNearIntentsChain = {
21
23
  [types_1.KnownChainIds.EthereumMainnet]: 'eth',
@@ -29,4 +31,6 @@ exports.chainIdToNearIntentsChain = {
29
31
  [types_1.KnownChainIds.BitcoinMainnet]: 'btc',
30
32
  [types_1.KnownChainIds.DogecoinMainnet]: 'doge',
31
33
  [types_1.KnownChainIds.SolanaMainnet]: 'sol',
34
+ [types_1.KnownChainIds.TronMainnet]: 'tron',
35
+ [types_1.KnownChainIds.SuiMainnet]: 'sui',
32
36
  };
@@ -28,19 +28,23 @@ const getNearIntentsAsset = ({ nearNetwork, contractAddress, }) => {
28
28
  return `nep141:${nearNetwork}-${contractAddress.toLowerCase()}.omft.near`;
29
29
  };
30
30
  exports.getNearIntentsAsset = getNearIntentsAsset;
31
- const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op'];
31
+ const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op', 'tron'];
32
+ const TOKEN_LOOKUP_CHAINS = ['sui'];
32
33
  const assetToNearIntentsAsset = async (asset) => {
33
34
  const nearNetwork = types_1.chainIdToNearIntentsChain[asset.chainId];
34
35
  if (!nearNetwork)
35
36
  return null;
36
- // NEP-245 chains (BSC, Polygon, Avalanche, Optimism) and Solana require token lookup
37
+ // NEP-245 chains (BSC, Polygon, Avalanche, Optimism, TRON, SUI) and Solana require token lookup
37
38
  // Asset IDs use hashed format that can't be generated from contract addresses
38
- const requiresLookup = NEP245_CHAINS.includes(nearNetwork) || asset.chainId === caip_1.solanaChainId;
39
+ const requiresLookup = NEP245_CHAINS.includes(nearNetwork) ||
40
+ TOKEN_LOOKUP_CHAINS.includes(nearNetwork) ||
41
+ asset.chainId === caip_1.solanaChainId ||
42
+ asset.chainId === caip_1.suiChainId;
39
43
  if (requiresLookup) {
40
44
  const tokens = await oneClickService_1.OneClickService.getTokens();
41
- const contractAddress = (0, utils_1.isToken)(asset.assetId)
42
- ? (0, caip_1.fromAssetId)(asset.assetId).assetReference.toLowerCase()
43
- : null;
45
+ const { assetNamespace, assetReference } = (0, caip_1.fromAssetId)(asset.assetId);
46
+ const isNativeAsset = assetNamespace === 'slip44';
47
+ const contractAddress = !isNativeAsset ? assetReference.toLowerCase() : null;
44
48
  const match = tokens.find((t) => {
45
49
  if (t.blockchain !== nearNetwork)
46
50
  return false;
@@ -48,8 +52,9 @@ const assetToNearIntentsAsset = async (asset) => {
48
52
  ? t.contractAddress?.toLowerCase() === contractAddress
49
53
  : !t.contractAddress;
50
54
  });
51
- if (!match)
55
+ if (!match) {
52
56
  return null;
57
+ }
53
58
  return match.assetId;
54
59
  }
55
60
  // NEP-141 chains (ETH, ARB, BASE, GNOSIS, BTC, DOGE): use predictable format
@@ -5,6 +5,7 @@ const utils_1 = require("../../utils");
5
5
  exports.relaySwapper = {
6
6
  executeEvmTransaction: utils_1.executeEvmTransaction,
7
7
  executeSolanaTransaction: utils_1.executeSolanaTransaction,
8
+ executeTronTransaction: utils_1.executeTronTransaction,
8
9
  executeUtxoTransaction: (txToSign, { signAndBroadcastTransaction }) => {
9
10
  return signAndBroadcastTransaction(txToSign);
10
11
  },
@@ -1,7 +1,5 @@
1
- import { KnownChainIds } from '@shapeshiftoss/types';
2
1
  import { TradeQuoteError } from '../../types';
3
2
  import { RelayErrorCode } from './utils/types';
4
- export declare const relaySupportedChainIds: KnownChainIds[];
5
3
  export declare const chainIdToRelayChainId: {
6
4
  [x: string]: number;
7
5
  };
@@ -16,8 +14,10 @@ export declare const relayChainIdToChainId: import("lodash").Dictionary<string>;
16
14
  export declare const DEFAULT_RELAY_EVM_TOKEN_ADDRESS: "0x0000000000000000000000000000000000000000";
17
15
  export declare const RELAY_BTC_TOKEN_ADDRESS = "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8";
18
16
  export declare const RELAY_SOLANA_TOKEN_ADDRESS = "11111111111111111111111111111111";
17
+ export declare const RELAY_TRON_TOKEN_ADDRESS = "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb";
19
18
  export declare const DEFAULT_RELAY_EVM_USER_ADDRESS = "0x000000000000000000000000000000000000dead";
20
19
  export declare const DEFAULT_RELAY_BTC_USER_ADDRESS = "bc1q4vxn43l44h30nkluqfxd9eckf45vr2awz38lwa";
21
20
  export declare const DEFAULT_RELAY_SOLANA_USER_ADDRESS = "CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr";
21
+ export declare const DEFAULT_RELAY_TRON_USER_ADDRESS = "TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy";
22
22
  export declare const MAXIMUM_SUPPORTED_RELAY_STEPS = 2;
23
23
  export declare const relayErrorCodeToTradeQuoteError: Record<RelayErrorCode, TradeQuoteError>;
@@ -3,26 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.relayErrorCodeToTradeQuoteError = exports.MAXIMUM_SUPPORTED_RELAY_STEPS = exports.DEFAULT_RELAY_SOLANA_USER_ADDRESS = exports.DEFAULT_RELAY_BTC_USER_ADDRESS = exports.DEFAULT_RELAY_EVM_USER_ADDRESS = exports.RELAY_SOLANA_TOKEN_ADDRESS = exports.RELAY_BTC_TOKEN_ADDRESS = exports.DEFAULT_RELAY_EVM_TOKEN_ADDRESS = exports.relayChainIdToChainId = exports.RelayStatusMessage = exports.chainIdToRelayChainId = exports.relaySupportedChainIds = void 0;
6
+ exports.relayErrorCodeToTradeQuoteError = exports.MAXIMUM_SUPPORTED_RELAY_STEPS = exports.DEFAULT_RELAY_TRON_USER_ADDRESS = exports.DEFAULT_RELAY_SOLANA_USER_ADDRESS = exports.DEFAULT_RELAY_BTC_USER_ADDRESS = exports.DEFAULT_RELAY_EVM_USER_ADDRESS = exports.RELAY_TRON_TOKEN_ADDRESS = exports.RELAY_SOLANA_TOKEN_ADDRESS = exports.RELAY_BTC_TOKEN_ADDRESS = exports.DEFAULT_RELAY_EVM_TOKEN_ADDRESS = exports.relayChainIdToChainId = exports.RelayStatusMessage = exports.chainIdToRelayChainId = void 0;
7
7
  const caip_1 = require("@shapeshiftoss/caip");
8
- const types_1 = require("@shapeshiftoss/types");
9
8
  const invert_1 = __importDefault(require("lodash/invert"));
10
9
  const viem_1 = require("viem");
11
10
  const chains_1 = require("viem/chains");
12
- const types_2 = require("../../types");
13
- const types_3 = require("./utils/types");
14
- exports.relaySupportedChainIds = [
15
- types_1.KnownChainIds.EthereumMainnet,
16
- types_1.KnownChainIds.ArbitrumMainnet,
17
- types_1.KnownChainIds.BaseMainnet,
18
- types_1.KnownChainIds.OptimismMainnet,
19
- types_1.KnownChainIds.PolygonMainnet,
20
- types_1.KnownChainIds.GnosisMainnet,
21
- types_1.KnownChainIds.AvalancheMainnet,
22
- types_1.KnownChainIds.BitcoinMainnet,
23
- types_1.KnownChainIds.SolanaMainnet,
24
- types_1.KnownChainIds.BnbSmartChainMainnet,
25
- ];
11
+ const types_1 = require("../../types");
12
+ const types_2 = require("./utils/types");
26
13
  exports.chainIdToRelayChainId = {
27
14
  // https://docs.relay.link/resources/supported-chains
28
15
  [caip_1.btcChainId]: 8253038,
@@ -36,6 +23,8 @@ exports.chainIdToRelayChainId = {
36
23
  [caip_1.gnosisChainId]: chains_1.gnosis.id,
37
24
  [caip_1.avalancheChainId]: chains_1.avalanche.id,
38
25
  [caip_1.bscChainId]: chains_1.bsc.id,
26
+ [caip_1.tronChainId]: 728126428,
27
+ [caip_1.monadChainId]: chains_1.monad.id,
39
28
  };
40
29
  var RelayStatusMessage;
41
30
  (function (RelayStatusMessage) {
@@ -49,29 +38,31 @@ exports.relayChainIdToChainId = (0, invert_1.default)(exports.chainIdToRelayChai
49
38
  exports.DEFAULT_RELAY_EVM_TOKEN_ADDRESS = viem_1.zeroAddress;
50
39
  exports.RELAY_BTC_TOKEN_ADDRESS = 'bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8';
51
40
  exports.RELAY_SOLANA_TOKEN_ADDRESS = '11111111111111111111111111111111';
41
+ exports.RELAY_TRON_TOKEN_ADDRESS = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb';
52
42
  exports.DEFAULT_RELAY_EVM_USER_ADDRESS = '0x000000000000000000000000000000000000dead';
53
43
  exports.DEFAULT_RELAY_BTC_USER_ADDRESS = 'bc1q4vxn43l44h30nkluqfxd9eckf45vr2awz38lwa';
54
44
  exports.DEFAULT_RELAY_SOLANA_USER_ADDRESS = 'CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr';
45
+ exports.DEFAULT_RELAY_TRON_USER_ADDRESS = 'TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy';
55
46
  exports.MAXIMUM_SUPPORTED_RELAY_STEPS = 2;
56
47
  exports.relayErrorCodeToTradeQuoteError = {
57
- [types_3.RelayErrorCode.AmountTooLow]: types_2.TradeQuoteError.SellAmountBelowMinimum,
58
- [types_3.RelayErrorCode.ChainDisabled]: types_2.TradeQuoteError.TradingHalted,
59
- [types_3.RelayErrorCode.Erc20RouterAddressNotFound]: types_2.TradeQuoteError.UnsupportedTradePair,
60
- [types_3.RelayErrorCode.ExtraTransactionsNotSupported]: types_2.TradeQuoteError.UnsupportedTradePair,
61
- [types_3.RelayErrorCode.InsufficientFunds]: types_2.TradeQuoteError.SellAmountBelowTradeFee,
62
- [types_3.RelayErrorCode.InsufficientLiquidity]: types_2.TradeQuoteError.SellAmountBelowTradeFee,
63
- [types_3.RelayErrorCode.InvalidAddress]: types_2.TradeQuoteError.UnsupportedTradePair,
64
- [types_3.RelayErrorCode.InvalidExtraTransactions]: types_2.TradeQuoteError.UnsupportedTradePair,
65
- [types_3.RelayErrorCode.NoQuotes]: types_2.TradeQuoteError.NoRouteFound,
66
- [types_3.RelayErrorCode.NoSwapRoutesFound]: types_2.TradeQuoteError.NoRouteFound,
67
- [types_3.RelayErrorCode.UnsupportedRoute]: types_2.TradeQuoteError.UnsupportedTradePair,
68
- [types_3.RelayErrorCode.UnsupportedExecutionType]: types_2.TradeQuoteError.UnknownError,
69
- [types_3.RelayErrorCode.UserRecipientMismatch]: types_2.TradeQuoteError.UnknownError,
70
- [types_3.RelayErrorCode.PermitFailed]: types_2.TradeQuoteError.UnknownError,
71
- [types_3.RelayErrorCode.SwapImpactTooHigh]: types_2.TradeQuoteError.UnknownError,
72
- [types_3.RelayErrorCode.SwapQuoteFailed]: types_2.TradeQuoteError.UnknownError,
73
- [types_3.RelayErrorCode.Unauthorized]: types_2.TradeQuoteError.UnknownError,
74
- [types_3.RelayErrorCode.UnknownError]: types_2.TradeQuoteError.UnknownError,
75
- [types_3.RelayErrorCode.UnsupportedChain]: types_2.TradeQuoteError.UnknownError,
76
- [types_3.RelayErrorCode.UnsupportedCurrency]: types_2.TradeQuoteError.UnknownError,
48
+ [types_2.RelayErrorCode.AmountTooLow]: types_1.TradeQuoteError.SellAmountBelowMinimum,
49
+ [types_2.RelayErrorCode.ChainDisabled]: types_1.TradeQuoteError.TradingHalted,
50
+ [types_2.RelayErrorCode.Erc20RouterAddressNotFound]: types_1.TradeQuoteError.UnsupportedTradePair,
51
+ [types_2.RelayErrorCode.ExtraTransactionsNotSupported]: types_1.TradeQuoteError.UnsupportedTradePair,
52
+ [types_2.RelayErrorCode.InsufficientFunds]: types_1.TradeQuoteError.SellAmountBelowTradeFee,
53
+ [types_2.RelayErrorCode.InsufficientLiquidity]: types_1.TradeQuoteError.SellAmountBelowTradeFee,
54
+ [types_2.RelayErrorCode.InvalidAddress]: types_1.TradeQuoteError.UnsupportedTradePair,
55
+ [types_2.RelayErrorCode.InvalidExtraTransactions]: types_1.TradeQuoteError.UnsupportedTradePair,
56
+ [types_2.RelayErrorCode.NoQuotes]: types_1.TradeQuoteError.NoRouteFound,
57
+ [types_2.RelayErrorCode.NoSwapRoutesFound]: types_1.TradeQuoteError.NoRouteFound,
58
+ [types_2.RelayErrorCode.UnsupportedRoute]: types_1.TradeQuoteError.UnsupportedTradePair,
59
+ [types_2.RelayErrorCode.UnsupportedExecutionType]: types_1.TradeQuoteError.UnknownError,
60
+ [types_2.RelayErrorCode.UserRecipientMismatch]: types_1.TradeQuoteError.UnknownError,
61
+ [types_2.RelayErrorCode.PermitFailed]: types_1.TradeQuoteError.UnknownError,
62
+ [types_2.RelayErrorCode.SwapImpactTooHigh]: types_1.TradeQuoteError.UnknownError,
63
+ [types_2.RelayErrorCode.SwapQuoteFailed]: types_1.TradeQuoteError.UnknownError,
64
+ [types_2.RelayErrorCode.Unauthorized]: types_1.TradeQuoteError.UnknownError,
65
+ [types_2.RelayErrorCode.UnknownError]: types_1.TradeQuoteError.UnknownError,
66
+ [types_2.RelayErrorCode.UnsupportedChain]: types_1.TradeQuoteError.UnknownError,
67
+ [types_2.RelayErrorCode.UnsupportedCurrency]: types_1.TradeQuoteError.UnknownError,
77
68
  };
@@ -9,6 +9,8 @@ const unchained_client_1 = require("@shapeshiftoss/unchained-client");
9
9
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
10
10
  const getSolanaTransactionFees_1 = require("../../solana-utils/getSolanaTransactionFees");
11
11
  const getUnsignedSolanaTransaction_1 = require("../../solana-utils/getUnsignedSolanaTransaction");
12
+ const getTronTransactionFees_1 = require("../../tron-utils/getTronTransactionFees");
13
+ const getUnsignedTronTransaction_1 = require("../../tron-utils/getUnsignedTronTransaction");
12
14
  const utils_1 = require("../../utils");
13
15
  const constant_1 = require("./constant");
14
16
  const getTradeQuote_1 = require("./getTradeQuote/getTradeQuote");
@@ -125,6 +127,8 @@ exports.relayApi = {
125
127
  },
126
128
  getSolanaTransactionFees: getSolanaTransactionFees_1.getSolanaTransactionFees,
127
129
  getUnsignedSolanaTransaction: getUnsignedSolanaTransaction_1.getUnsignedSolanaTransaction,
130
+ getTronTransactionFees: getTronTransactionFees_1.getTronTransactionFees,
131
+ getUnsignedTronTransaction: getUnsignedTronTransaction_1.getUnsignedTronTransaction,
128
132
  checkTradeStatus: async ({ swap, txHash, chainId, address, config, fetchIsSmartContractAddressQuery, assertGetEvmChainAdapter, }) => {
129
133
  const maybeSafeTransactionStatus = await (0, utils_1.checkSafeTransactionStatus)({
130
134
  txHash,
@@ -9,6 +9,8 @@ const getRelayAssetAddress = (asset) => {
9
9
  return constant_1.RELAY_BTC_TOKEN_ADDRESS;
10
10
  if (asset.assetId === caip_1.solAssetId)
11
11
  return constant_1.RELAY_SOLANA_TOKEN_ADDRESS;
12
+ if (asset.assetId === caip_1.tronAssetId)
13
+ return constant_1.RELAY_TRON_TOKEN_ADDRESS;
12
14
  if ((0, helpers_1.isNativeEvmAsset)(asset.assetId))
13
15
  return constant_1.DEFAULT_RELAY_EVM_TOKEN_ADDRESS;
14
16
  const { assetReference } = (0, caip_1.fromAssetId)(asset.assetId);
@@ -1,2 +1,2 @@
1
1
  import type { ChainId } from '@shapeshiftoss/caip';
2
- export declare const getRelayDefaultUserAddress: (chainId: ChainId) => "0x000000000000000000000000000000000000dead" | "bc1q4vxn43l44h30nkluqfxd9eckf45vr2awz38lwa" | "CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr";
2
+ export declare const getRelayDefaultUserAddress: (chainId: ChainId) => "0x000000000000000000000000000000000000dead" | "bc1q4vxn43l44h30nkluqfxd9eckf45vr2awz38lwa" | "CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr" | "TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy";
@@ -9,6 +9,8 @@ const getRelayDefaultUserAddress = (chainId) => {
9
9
  return constant_1.DEFAULT_RELAY_BTC_USER_ADDRESS;
10
10
  case caip_1.solanaChainId:
11
11
  return constant_1.DEFAULT_RELAY_SOLANA_USER_ADDRESS;
12
+ case caip_1.tronChainId:
13
+ return constant_1.DEFAULT_RELAY_TRON_USER_ADDRESS;
12
14
  default:
13
15
  return constant_1.DEFAULT_RELAY_EVM_USER_ADDRESS;
14
16
  }
@@ -35,7 +35,7 @@ const getRelayPsbtRelayer = (psbtHex, sellAmountCryptoBaseUnit) => {
35
35
  try {
36
36
  const address = bitcoin.address.fromOutputScript(script);
37
37
  // Assuming the destination address is the one with the exact amount of sellAmountCryptoBaseUnit
38
- if (output.value === Number(sellAmountCryptoBaseUnit)) {
38
+ if (output.value === BigInt(sellAmountCryptoBaseUnit)) {
39
39
  return address;
40
40
  }
41
41
  }