@shapeshiftoss/swapper 17.7.3 → 17.8.0

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 (124) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/constants.js +35 -26
  3. package/dist/cjs/index.d.ts +1 -0
  4. package/dist/cjs/index.js +1 -0
  5. package/dist/cjs/swappers/ArbitrumBridgeSwapper/getTradeQuote/getTradeQuote.test.js +12 -4
  6. package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +9 -5
  7. package/dist/cjs/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +1 -9
  8. package/dist/cjs/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +9 -13
  9. package/dist/cjs/swappers/BebopSwapper/types.d.ts +64 -78
  10. package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +0 -16
  11. package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.js +49 -82
  12. package/dist/cjs/swappers/BobGatewaySwapper/BobGatewaySwapper.d.ts +2 -0
  13. package/dist/cjs/swappers/BobGatewaySwapper/BobGatewaySwapper.js +8 -0
  14. package/dist/cjs/swappers/BobGatewaySwapper/endpoints.d.ts +2 -0
  15. package/dist/cjs/swappers/BobGatewaySwapper/endpoints.js +143 -0
  16. package/dist/cjs/swappers/BobGatewaySwapper/index.d.ts +3 -0
  17. package/dist/cjs/swappers/BobGatewaySwapper/index.js +22 -0
  18. package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.d.ts +3 -0
  19. package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.js +90 -0
  20. package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeRate.d.ts +3 -0
  21. package/dist/cjs/swappers/BobGatewaySwapper/swapperApi/getTradeRate.js +73 -0
  22. package/dist/cjs/swappers/BobGatewaySwapper/types.d.ts +20 -0
  23. package/dist/cjs/swappers/BobGatewaySwapper/types.js +2 -0
  24. package/dist/cjs/swappers/BobGatewaySwapper/utils/constants.d.ts +13 -0
  25. package/dist/cjs/swappers/BobGatewaySwapper/utils/constants.js +31 -0
  26. package/dist/cjs/swappers/BobGatewaySwapper/utils/helpers.d.ts +49 -0
  27. package/dist/cjs/swappers/BobGatewaySwapper/utils/helpers.js +314 -0
  28. package/dist/cjs/swappers/ChainflipSwapper/ChainflipSwapper.js +1 -0
  29. package/dist/cjs/swappers/ChainflipSwapper/constants.d.ts +1 -1
  30. package/dist/cjs/swappers/ChainflipSwapper/constants.js +3 -0
  31. package/dist/cjs/swappers/ChainflipSwapper/endpoints.js +20 -0
  32. package/dist/cjs/swappers/ChainflipSwapper/types.d.ts +2 -1
  33. package/dist/cjs/swappers/ChainflipSwapper/types.js +1 -0
  34. package/dist/cjs/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +23 -3
  35. package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.d.ts +2 -2
  36. package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.js +2 -1
  37. package/dist/cjs/swappers/CowSwapper/utils/helpers/helpers.test.js +3 -3
  38. package/dist/cjs/swappers/RelaySwapper/constant.js +1 -1
  39. package/dist/cjs/swappers/SunioSwapper/endpoints.js +19 -36
  40. package/dist/cjs/swappers/SunioSwapper/utils/buildSwapContractCall.d.ts +6 -0
  41. package/dist/cjs/swappers/SunioSwapper/utils/buildSwapContractCall.js +33 -0
  42. package/dist/cjs/swappers/SunioSwapper/utils/buildSwapRouteParameters.js +6 -6
  43. package/dist/cjs/swappers/SunioSwapper/utils/constants.d.ts +2 -0
  44. package/dist/cjs/swappers/SunioSwapper/utils/constants.js +7 -1
  45. package/dist/cjs/swappers/SunioSwapper/utils/estimateSunioNetworkFee.d.ts +12 -0
  46. package/dist/cjs/swappers/SunioSwapper/utils/estimateSunioNetworkFee.js +78 -0
  47. package/dist/cjs/swappers/SunioSwapper/utils/getQuoteOrRate.js +16 -74
  48. package/dist/cjs/swappers/SunioSwapper/utils/getSunioTransactionFees.d.ts +2 -0
  49. package/dist/cjs/swappers/SunioSwapper/utils/getSunioTransactionFees.js +36 -0
  50. package/dist/cjs/swappers/utils/helpers/helpers.js +1 -0
  51. package/dist/cjs/thorchain-utils/getL1RateOrQuote.js +5 -2
  52. package/dist/cjs/thorchain-utils/getQuote.js +27 -29
  53. package/dist/cjs/thorchain-utils/tron/getTronTransactionFees.js +8 -5
  54. package/dist/cjs/thorchain-utils/types.d.ts +1 -1
  55. package/dist/cjs/types.d.ts +10 -3
  56. package/dist/cjs/types.js +5 -0
  57. package/dist/esm/.tsbuildinfo +1 -1
  58. package/dist/esm/constants.js +9 -0
  59. package/dist/esm/index.d.ts +1 -0
  60. package/dist/esm/index.js +1 -0
  61. package/dist/esm/swappers/ArbitrumBridgeSwapper/getTradeQuote/getTradeQuote.test.js +12 -4
  62. package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +10 -6
  63. package/dist/esm/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +1 -9
  64. package/dist/esm/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +10 -14
  65. package/dist/esm/swappers/BebopSwapper/types.d.ts +64 -78
  66. package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +0 -16
  67. package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.js +45 -76
  68. package/dist/esm/swappers/BobGatewaySwapper/BobGatewaySwapper.d.ts +2 -0
  69. package/dist/esm/swappers/BobGatewaySwapper/BobGatewaySwapper.js +5 -0
  70. package/dist/esm/swappers/BobGatewaySwapper/endpoints.d.ts +2 -0
  71. package/dist/esm/swappers/BobGatewaySwapper/endpoints.js +140 -0
  72. package/dist/esm/swappers/BobGatewaySwapper/index.d.ts +3 -0
  73. package/dist/esm/swappers/BobGatewaySwapper/index.js +3 -0
  74. package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.d.ts +3 -0
  75. package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.js +86 -0
  76. package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeRate.d.ts +3 -0
  77. package/dist/esm/swappers/BobGatewaySwapper/swapperApi/getTradeRate.js +69 -0
  78. package/dist/esm/swappers/BobGatewaySwapper/types.d.ts +20 -0
  79. package/dist/esm/swappers/BobGatewaySwapper/utils/constants.d.ts +13 -0
  80. package/dist/esm/swappers/BobGatewaySwapper/utils/constants.js +27 -0
  81. package/dist/esm/swappers/BobGatewaySwapper/utils/helpers.d.ts +49 -0
  82. package/dist/esm/swappers/BobGatewaySwapper/utils/helpers.js +299 -0
  83. package/dist/esm/swappers/ChainflipSwapper/ChainflipSwapper.js +2 -1
  84. package/dist/esm/swappers/ChainflipSwapper/constants.d.ts +1 -1
  85. package/dist/esm/swappers/ChainflipSwapper/constants.js +4 -1
  86. package/dist/esm/swappers/ChainflipSwapper/endpoints.js +20 -0
  87. package/dist/esm/swappers/ChainflipSwapper/types.d.ts +2 -1
  88. package/dist/esm/swappers/ChainflipSwapper/types.js +1 -0
  89. package/dist/esm/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +24 -4
  90. package/dist/esm/swappers/ChainflipSwapper/utils/helpers.d.ts +2 -2
  91. package/dist/esm/swappers/ChainflipSwapper/utils/helpers.js +2 -1
  92. package/dist/esm/swappers/CowSwapper/utils/helpers/helpers.test.js +3 -3
  93. package/dist/esm/swappers/RelaySwapper/constant.js +1 -1
  94. package/dist/esm/swappers/SunioSwapper/endpoints.js +19 -36
  95. package/dist/esm/swappers/SunioSwapper/utils/buildSwapContractCall.d.ts +6 -0
  96. package/dist/esm/swappers/SunioSwapper/utils/buildSwapContractCall.js +29 -0
  97. package/dist/esm/swappers/SunioSwapper/utils/buildSwapRouteParameters.js +6 -6
  98. package/dist/esm/swappers/SunioSwapper/utils/constants.d.ts +2 -0
  99. package/dist/esm/swappers/SunioSwapper/utils/constants.js +6 -0
  100. package/dist/esm/swappers/SunioSwapper/utils/estimateSunioNetworkFee.d.ts +12 -0
  101. package/dist/esm/swappers/SunioSwapper/utils/estimateSunioNetworkFee.js +74 -0
  102. package/dist/esm/swappers/SunioSwapper/utils/getQuoteOrRate.js +16 -74
  103. package/dist/esm/swappers/SunioSwapper/utils/getSunioTransactionFees.d.ts +2 -0
  104. package/dist/esm/swappers/SunioSwapper/utils/getSunioTransactionFees.js +32 -0
  105. package/dist/esm/swappers/utils/helpers/helpers.js +2 -1
  106. package/dist/esm/thorchain-utils/getL1RateOrQuote.js +5 -2
  107. package/dist/esm/thorchain-utils/getQuote.js +27 -29
  108. package/dist/esm/thorchain-utils/tron/getTronTransactionFees.js +8 -5
  109. package/dist/esm/thorchain-utils/types.d.ts +1 -1
  110. package/dist/esm/types.d.ts +10 -3
  111. package/dist/esm/types.js +5 -0
  112. package/package.json +8 -7
  113. package/dist/cjs/swappers/SunioSwapper/utils/buildSwapTransaction.d.ts +0 -11
  114. package/dist/cjs/swappers/SunioSwapper/utils/buildSwapTransaction.js +0 -57
  115. package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +0 -12
  116. package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +0 -47
  117. package/dist/cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +0 -100
  118. package/dist/esm/swappers/SunioSwapper/utils/buildSwapTransaction.d.ts +0 -11
  119. package/dist/esm/swappers/SunioSwapper/utils/buildSwapTransaction.js +0 -53
  120. package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.d.ts +0 -12
  121. package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.js +0 -41
  122. package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.d.ts +0 -1
  123. package/dist/esm/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.js +0 -98
  124. /package/dist/{cjs/thorchain-utils/getThresholdedAffiliateBps/getThresholdedAffiliateBps.test.d.ts → esm/swappers/BobGatewaySwapper/types.js} +0 -0
@@ -2,12 +2,12 @@ import { bn } from '@shapeshiftoss/utils';
2
2
  export const buildSwapRouteParameters = (route, sellAmountCryptoBaseUnit, minBuyAmountCryptoBaseUnit, recipient, slippageTolerancePercentageDecimal) => {
3
3
  const path = route.tokens;
4
4
  const poolVersion = route.poolVersions;
5
- const versionLen = poolVersion.map((_, index) => {
6
- if (index === poolVersion.length - 1) {
7
- return path.length - index;
8
- }
9
- return 2;
10
- });
5
+ // The SmartExchangeRouter expects sum(versionLen) === path.length: the first
6
+ // pool segment consumes 2 tokens (input + output) and each subsequent pool
7
+ // reuses the previous output, consuming 1 new token. This relies on the Sun.io
8
+ // API returning poolVersions per-hop (poolVersions.length === tokens.length - 1),
9
+ // which it does — the router also accepts this un-collapsed form for same-version hops.
10
+ const versionLen = poolVersion.map((_, index) => (index === 0 ? 2 : 1));
11
11
  const fees = route.poolFees.map(fee => Number(fee));
12
12
  const amountOutWithSlippage = bn(minBuyAmountCryptoBaseUnit)
13
13
  .times(bn(1).minus(slippageTolerancePercentageDecimal))
@@ -2,5 +2,7 @@ export declare const SUNIO_SUPPORTED_CHAIN_IDS: readonly [import("@shapeshiftoss
2
2
  export declare const SUNIO_API_BASE_URL = "https://rot.endjgfsv.link";
3
3
  export declare const SUNIO_SMART_ROUTER_CONTRACT: "TCFNp179Lg46D16zKoumd4Poa2WFFdtqYj";
4
4
  export declare const DEFAULT_SLIPPAGE_PERCENTAGE = "0.005";
5
+ export declare const SUNIO_FALLBACK_SWAP_ENERGY_NATIVE = 215000;
6
+ export declare const SUNIO_FALLBACK_SWAP_ENERGY_TRC20 = 375000;
5
7
  export declare const SUNIO_DEX_TYPES: "PSM,CURVE,CURVE_COMBINATION,WTRX,SUNSWAP_V1,SUNSWAP_V2,SUNSWAP_V3";
6
8
  export declare const SUNIO_TRON_NATIVE_ADDRESS: "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb";
@@ -8,6 +8,12 @@ export const SUNIO_API_BASE_URL = 'https://rot.endjgfsv.link';
8
8
  // This is the current mainnet router that sun.io's frontend uses
9
9
  export const SUNIO_SMART_ROUTER_CONTRACT = 'TCFNp179Lg46D16zKoumd4Poa2WFFdtqYj';
10
10
  export const DEFAULT_SLIPPAGE_PERCENTAGE = '0.005';
11
+ // Energy fallbacks for when we can't simulate a swap (no address, or the simulation reverts
12
+ // pre-approval for TRC20 sells). Set to observed average energy so the 1.2x margin applied at
13
+ // estimate time lifts them to cover the worst case (native ~245k, TRC20 ~415k due to the extra
14
+ // transferFrom token pull) without double-counting safety.
15
+ export const SUNIO_FALLBACK_SWAP_ENERGY_NATIVE = 215_000;
16
+ export const SUNIO_FALLBACK_SWAP_ENERGY_TRC20 = 375_000;
11
17
  export const SUNIO_DEX_TYPES = 'PSM,CURVE,CURVE_COMBINATION,WTRX,SUNSWAP_V1,SUNSWAP_V2,SUNSWAP_V3';
12
18
  // Native TRX token address (used when assetId is not a TRC-20 token)
13
19
  export const SUNIO_TRON_NATIVE_ADDRESS = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb';
@@ -0,0 +1,12 @@
1
+ import type { SunioRoute } from '../types.js';
2
+ type EstimateSunioNetworkFeeArgs = {
3
+ rpcUrl: string;
4
+ apiKey: string;
5
+ route: SunioRoute;
6
+ sellAmountCryptoBaseUnit: string;
7
+ isSellingNativeTrx: boolean;
8
+ address: string | undefined;
9
+ slippageTolerancePercentageDecimal: string | undefined;
10
+ };
11
+ export declare const estimateSunioNetworkFeeCryptoBaseUnit: ({ rpcUrl, apiKey, route, sellAmountCryptoBaseUnit, isSellingNativeTrx, address, slippageTolerancePercentageDecimal, }: EstimateSunioNetworkFeeArgs) => Promise<string>;
12
+ export {};
@@ -0,0 +1,74 @@
1
+ import { bn } from '@shapeshiftoss/utils';
2
+ import { TronWeb } from 'tronweb';
3
+ import { buildSwapExactInputParameters, SUNIO_SWAP_EXACT_INPUT_SELECTOR, } from './buildSwapContractCall.js';
4
+ import { buildSwapRouteParameters } from './buildSwapRouteParameters.js';
5
+ import { DEFAULT_SLIPPAGE_PERCENTAGE, SUNIO_FALLBACK_SWAP_ENERGY_NATIVE, SUNIO_FALLBACK_SWAP_ENERGY_TRC20, SUNIO_SMART_ROUTER_CONTRACT, SUNIO_TRON_NATIVE_ADDRESS, } from './constants.js';
6
+ // Estimates the network fee (in TRX base units) for a Sun.io swap. The router sponsors only ~1%
7
+ // of energy (origin_energy_usage); the user pays the rest, so we simulate the real swapExactInput
8
+ // call when we have an address to estimate from. The simulation reverts before approval for TRC20
9
+ // sells (and when the account lacks the sell balance), so we fall back to a conservative per-sell-
10
+ // type constant. Used both at quote time and re-run at confirm time, where a now-granted allowance
11
+ // lets the simulation produce the true cost.
12
+ export const estimateSunioNetworkFeeCryptoBaseUnit = async ({ rpcUrl, apiKey, route, sellAmountCryptoBaseUnit, isSellingNativeTrx, address, slippageTolerancePercentageDecimal, }) => {
13
+ const tronGridHeaders = apiKey ? { 'TRON-PRO-API-KEY': apiKey } : {};
14
+ const tronWeb = new TronWeb({ fullHost: rpcUrl, headers: tronGridHeaders });
15
+ // Live network prices, defaulting if the node is unavailable so we still produce a fee
16
+ const { bandwidthPrice, energyPrice } = await (async () => {
17
+ try {
18
+ const params = await tronWeb.trx.getChainParameters();
19
+ return {
20
+ bandwidthPrice: params.find(p => p.key === 'getTransactionFee')?.value ?? 1000,
21
+ energyPrice: params.find(p => p.key === 'getEnergyFee')?.value ?? 100,
22
+ };
23
+ }
24
+ catch {
25
+ return { bandwidthPrice: 1000, energyPrice: 100 };
26
+ }
27
+ })();
28
+ // Account activation (1 TRX) is only charged when the recipient receives native TRX, mirroring
29
+ // the chain adapter. A TRC20 buy doesn't incur the flat activation fee (its account-creation
30
+ // cost is folded into energy). Only checkable with an address.
31
+ const isBuyingNativeTrx = route.tokens[route.tokens.length - 1] === SUNIO_TRON_NATIVE_ADDRESS;
32
+ const accountActivationFee = await (async () => {
33
+ if (!address || !isBuyingNativeTrx)
34
+ return 0;
35
+ try {
36
+ const recipientInfoResponse = await fetch(`${rpcUrl}/wallet/getaccount`, {
37
+ method: 'POST',
38
+ headers: { 'Content-Type': 'application/json', ...tronGridHeaders },
39
+ body: JSON.stringify({ address, visible: true }),
40
+ });
41
+ const recipientInfo = await recipientInfoResponse.json();
42
+ const recipientExists = recipientInfo && Object.keys(recipientInfo).length > 1;
43
+ return recipientExists ? 0 : 1_000_000; // 1 TRX
44
+ }
45
+ catch {
46
+ return 0;
47
+ }
48
+ })();
49
+ const energyUsed = await (async () => {
50
+ // TRC20 sells cost far more energy than native sells (the extra transferFrom token pull)
51
+ const fallbackEnergy = isSellingNativeTrx
52
+ ? SUNIO_FALLBACK_SWAP_ENERGY_NATIVE
53
+ : SUNIO_FALLBACK_SWAP_ENERGY_TRC20;
54
+ if (!address)
55
+ return fallbackEnergy;
56
+ try {
57
+ const routeParams = buildSwapRouteParameters(route, sellAmountCryptoBaseUnit, '0', address, slippageTolerancePercentageDecimal ?? DEFAULT_SLIPPAGE_PERCENTAGE);
58
+ const callValue = isSellingNativeTrx ? Number(sellAmountCryptoBaseUnit) : 0;
59
+ const result = await tronWeb.transactionBuilder.triggerConstantContract(SUNIO_SMART_ROUTER_CONTRACT, SUNIO_SWAP_EXACT_INPUT_SELECTOR, { callValue }, buildSwapExactInputParameters(routeParams), address);
60
+ // A reverted simulation (e.g. TRC20 sell pre-approval) can still return a small energy_used;
61
+ // only trust it when the call actually succeeded, otherwise use the conservative fallback.
62
+ if (result?.result?.result !== true || result.energy_used == null)
63
+ return fallbackEnergy;
64
+ return result.energy_used;
65
+ }
66
+ catch {
67
+ return fallbackEnergy;
68
+ }
69
+ })();
70
+ // 1.2x safety margin for energy price/usage variance between estimate and execution
71
+ const energyFee = Math.ceil(energyUsed * energyPrice * 1.2);
72
+ const bandwidthFee = 1100 * bandwidthPrice;
73
+ return bn(energyFee).plus(bandwidthFee).plus(accountActivationFee).toFixed(0);
74
+ };
@@ -1,11 +1,11 @@
1
1
  import { tronChainId } from '@shapeshiftoss/caip';
2
2
  import { BigAmount, bn, contractAddressOrUndefined } from '@shapeshiftoss/utils';
3
3
  import { Err, Ok } from '@sniptt/monads';
4
- import { TronWeb } from 'tronweb';
5
4
  import { SwapperName, TradeQuoteError } from '../../../types.js';
6
5
  import { getInputOutputRate, makeSwapErrorRight } from '../../../utils.js';
7
6
  import { buildAffiliateFee } from '../../utils/affiliateFee.js';
8
7
  import { DEFAULT_SLIPPAGE_PERCENTAGE, SUNIO_SMART_ROUTER_CONTRACT } from './constants.js';
8
+ import { estimateSunioNetworkFeeCryptoBaseUnit } from './estimateSunioNetworkFee.js';
9
9
  import { fetchSunioQuote } from './fetchFromSunio.js';
10
10
  import { isSupportedChainId } from './helpers/helpers.js';
11
11
  import { sunioServiceFactory } from './sunioService.js';
@@ -57,83 +57,25 @@ export async function getQuoteOrRate(input, deps) {
57
57
  code: TradeQuoteError.InternalError,
58
58
  }));
59
59
  }
60
- // Fetch network fees for both quotes and rates (when wallet connected)
61
- let networkFeeCryptoBaseUnit = undefined;
62
- // Estimate fees when we have an address to estimate from
63
- if (receiveAddress) {
60
+ const networkFeeCryptoBaseUnit = await (async () => {
64
61
  try {
65
- const contractAddress = contractAddressOrUndefined(sellAsset.assetId);
66
- const isSellingNativeTrx = !contractAddress;
67
- const tronWeb = new TronWeb({ fullHost: deps.config.VITE_TRON_NODE_URL });
68
- // Get chain parameters for pricing
69
- const params = await tronWeb.trx.getChainParameters();
70
- const bandwidthPrice = params.find(p => p.key === 'getTransactionFee')?.value ?? 1000;
71
- const energyPrice = params.find(p => p.key === 'getEnergyFee')?.value ?? 100;
72
- // Check if recipient needs activation (applies to all swaps)
73
- let accountActivationFee = 0;
74
- try {
75
- const recipientInfoResponse = await fetch(`${deps.config.VITE_TRON_NODE_URL}/wallet/getaccount`, {
76
- method: 'POST',
77
- headers: { 'Content-Type': 'application/json' },
78
- body: JSON.stringify({ address: receiveAddress, visible: true }),
79
- });
80
- const recipientInfo = await recipientInfoResponse.json();
81
- const recipientExists = recipientInfo && Object.keys(recipientInfo).length > 1;
82
- if (!recipientExists) {
83
- accountActivationFee = 1_000_000; // 1 TRX
84
- }
85
- }
86
- catch {
87
- // Ignore activation check errors
88
- }
89
- // For native TRX swaps, Sun.io uses a contract call with value
90
- // We need to estimate energy for the swap contract, not just bandwidth
91
- if (isSellingNativeTrx) {
92
- try {
93
- // Sun.io contract owner provides most energy (~117k), users only pay ~2k
94
- // Use fixed 2k energy estimate instead of querying (which returns total 120k)
95
- const energyUsed = 2000; // User pays ~2k energy, contract covers the rest
96
- const energyFee = energyUsed * energyPrice; // No multiplier - contract provides energy
97
- // Estimate bandwidth for contract call (much larger than simple transfer)
98
- const bandwidthFee = 1100 * bandwidthPrice; // ~1100 bytes for contract call (with safety buffer)
99
- networkFeeCryptoBaseUnit = bn(energyFee)
100
- .plus(bandwidthFee)
101
- .plus(accountActivationFee)
102
- .toFixed(0);
103
- }
104
- catch (estimationError) {
105
- // Fallback estimate: ~2k energy + ~1100 bytes bandwidth + activation fee
106
- const fallbackEnergyFee = 2000 * energyPrice;
107
- const fallbackBandwidthFee = 1100 * bandwidthPrice;
108
- networkFeeCryptoBaseUnit = bn(fallbackEnergyFee)
109
- .plus(fallbackBandwidthFee)
110
- .plus(accountActivationFee)
111
- .toFixed(0);
112
- }
113
- }
114
- else {
115
- // For TRC-20 swaps through Sun.io router
116
- // Same as TRX: contract owner provides most energy, user pays ~2k
117
- // Sun.io provides ~217k energy, user pays ~2k
118
- const energyFee = 2000 * energyPrice;
119
- const bandwidthFee = 1100 * bandwidthPrice;
120
- networkFeeCryptoBaseUnit = bn(energyFee)
121
- .plus(bandwidthFee)
122
- .plus(accountActivationFee)
123
- .toFixed(0);
124
- }
62
+ return await estimateSunioNetworkFeeCryptoBaseUnit({
63
+ rpcUrl: deps.config.VITE_TRON_NODE_URL,
64
+ apiKey: deps.config.VITE_TRON_GRID_API_KEY,
65
+ route: bestRoute,
66
+ sellAmountCryptoBaseUnit: sellAmountIncludingProtocolFeesCryptoBaseUnit,
67
+ isSellingNativeTrx: !contractAddressOrUndefined(sellAsset.assetId),
68
+ address: receiveAddress,
69
+ slippageTolerancePercentageDecimal,
70
+ });
125
71
  }
126
72
  catch (error) {
127
- // For rates, fall back to '0' on estimation failure
128
- // For quotes, let it error (required for accurate swap)
129
- if (!isQuote) {
130
- networkFeeCryptoBaseUnit = '0';
131
- }
132
- else {
133
- throw error;
134
- }
73
+ // For rates, fall back to '0' on unexpected failure; quotes require an accurate fee
74
+ if (!isQuote)
75
+ return '0';
76
+ throw error;
135
77
  }
136
- }
78
+ })();
137
79
  const buyAmountCryptoBaseUnit = BigAmount.fromPrecision({
138
80
  value: bestRoute.amountOut,
139
81
  precision: buyAsset.precision,
@@ -0,0 +1,2 @@
1
+ import type { GetUnsignedTronTransactionArgs } from '../../../types.js';
2
+ export declare const getSunioTransactionFees: ({ tradeQuote, stepIndex, from, slippageTolerancePercentageDecimal, assertGetTronChainAdapter, config, }: GetUnsignedTronTransactionArgs) => Promise<string>;
@@ -0,0 +1,32 @@
1
+ import { tronAssetId, tronChainId } from '@shapeshiftoss/caip';
2
+ import { getExecutableTradeStep, isExecutableTradeQuote } from '../../../utils.js';
3
+ import { estimateSunioNetworkFeeCryptoBaseUnit } from './estimateSunioNetworkFee.js';
4
+ export const getSunioTransactionFees = async ({ tradeQuote, stepIndex, from, slippageTolerancePercentageDecimal, assertGetTronChainAdapter, config, }) => {
5
+ if (!isExecutableTradeQuote(tradeQuote))
6
+ throw new Error('Unable to execute a trade rate quote');
7
+ const step = getExecutableTradeStep(tradeQuote, stepIndex);
8
+ const storedNetworkFeeCryptoBaseUnit = step.feeData.networkFeeCryptoBaseUnit;
9
+ const route = step.sunioTransactionMetadata?.route;
10
+ if (!route) {
11
+ if (!storedNetworkFeeCryptoBaseUnit)
12
+ throw new Error('Missing network fee in quote');
13
+ return storedNetworkFeeCryptoBaseUnit;
14
+ }
15
+ try {
16
+ const adapter = assertGetTronChainAdapter(tronChainId);
17
+ return await estimateSunioNetworkFeeCryptoBaseUnit({
18
+ rpcUrl: adapter.httpProvider.getRpcUrl(),
19
+ apiKey: config.VITE_TRON_GRID_API_KEY,
20
+ route,
21
+ sellAmountCryptoBaseUnit: step.sellAmountIncludingProtocolFeesCryptoBaseUnit,
22
+ isSellingNativeTrx: step.sellAsset.assetId === tronAssetId,
23
+ address: from,
24
+ slippageTolerancePercentageDecimal,
25
+ });
26
+ }
27
+ catch {
28
+ if (!storedNetworkFeeCryptoBaseUnit)
29
+ throw new Error('Missing network fee in quote');
30
+ return storedNetworkFeeCryptoBaseUnit;
31
+ }
32
+ };
@@ -1,6 +1,6 @@
1
1
  import { arbitrumAssetId, avalancheAssetId, baseAssetId, bscAssetId, ethAssetId, fromAssetId, gnosisAssetId, katanaAssetId, monadAssetId, optimismAssetId, plasmaAssetId, polygonAssetId, } from '@shapeshiftoss/caip';
2
2
  import { KnownChainIds } from '@shapeshiftoss/types';
3
- import { DAO_TREASURY_ARBITRUM, DAO_TREASURY_AVALANCHE, DAO_TREASURY_BASE, DAO_TREASURY_BITCOIN, DAO_TREASURY_BSC, DAO_TREASURY_ETHEREUM_MAINNET, DAO_TREASURY_GNOSIS, DAO_TREASURY_HYPEREVM, DAO_TREASURY_MONAD, DAO_TREASURY_OPTIMISM, DAO_TREASURY_POLYGON, DAO_TREASURY_SOLANA, DAO_TREASURY_STARKNET, DAO_TREASURY_TON, isTreasuryChainId, } from '@shapeshiftoss/utils';
3
+ import { DAO_TREASURY_ARBITRUM, DAO_TREASURY_AVALANCHE, DAO_TREASURY_BASE, DAO_TREASURY_BITCOIN, DAO_TREASURY_BOB, DAO_TREASURY_BSC, DAO_TREASURY_ETHEREUM_MAINNET, DAO_TREASURY_GNOSIS, DAO_TREASURY_HYPEREVM, DAO_TREASURY_MONAD, DAO_TREASURY_OPTIMISM, DAO_TREASURY_POLYGON, DAO_TREASURY_SOLANA, DAO_TREASURY_STARKNET, DAO_TREASURY_TON, isTreasuryChainId, } from '@shapeshiftoss/utils';
4
4
  export const isNativeEvmAsset = (assetId) => {
5
5
  const { chainId } = fromAssetId(assetId);
6
6
  switch (chainId) {
@@ -45,6 +45,7 @@ const DAO_TREASURY_BY_CHAIN_ID = {
45
45
  [KnownChainIds.TonMainnet]: DAO_TREASURY_TON,
46
46
  [KnownChainIds.MonadMainnet]: DAO_TREASURY_MONAD,
47
47
  [KnownChainIds.HyperEvmMainnet]: DAO_TREASURY_HYPEREVM,
48
+ [KnownChainIds.BobMainnet]: DAO_TREASURY_BOB,
48
49
  };
49
50
  export const getTreasuryAddressFromChainId = (chainId) => {
50
51
  const maybeTreasuryChainId = isTreasuryChainId(chainId) ? chainId : undefined;
@@ -104,7 +104,7 @@ export const getL1RateOrQuote = async (input, deps, streamingInterval, tradeType
104
104
  const protocolFees = {};
105
105
  if (!buyAssetTradeFeeBuyAssetCryptoBaseUnit.isZero()) {
106
106
  protocolFees[buyAsset.assetId] = {
107
- amountCryptoBaseUnit: buyAssetTradeFeeBuyAssetCryptoBaseUnit.toString(),
107
+ amountCryptoBaseUnit: buyAssetTradeFeeBuyAssetCryptoBaseUnit.toFixed(0),
108
108
  requiresBalance: false,
109
109
  asset: buyAsset,
110
110
  };
@@ -135,7 +135,7 @@ export const getL1RateOrQuote = async (input, deps, streamingInterval, tradeType
135
135
  value: route.expectedAmountOutThorBaseUnit,
136
136
  inputExponent: buyAssetNativePrecision,
137
137
  outputExponent: buyAsset.precision,
138
- }).toFixed();
138
+ }).toFixed(0);
139
139
  const rate = getInputOutputRate({
140
140
  sellAmountCryptoBaseUnit,
141
141
  buyAmountCryptoBaseUnit: buyAmountAfterFeesCryptoBaseUnit,
@@ -375,6 +375,9 @@ export const getL1RateOrQuote = async (input, deps, streamingInterval, tradeType
375
375
  // Estimate fees using the receive address for accurate energy calculation
376
376
  const tronWeb = new TronWeb({
377
377
  fullHost: deps.config.VITE_TRON_NODE_URL,
378
+ headers: deps.config.VITE_TRON_GRID_API_KEY
379
+ ? { 'TRON-PRO-API-KEY': deps.config.VITE_TRON_GRID_API_KEY }
380
+ : {},
378
381
  });
379
382
  const params = await tronWeb.trx.getChainParameters();
380
383
  const bandwidthPrice = params.find(p => p.key === 'getTransactionFee')?.value ?? 1000;
@@ -4,19 +4,10 @@ import { Err, Ok } from '@sniptt/monads';
4
4
  import qs from 'qs';
5
5
  import { TradeQuoteError } from '../types.js';
6
6
  import { createTradeAmountTooSmallErr, makeSwapErrorRight } from '../utils.js';
7
- import { getThresholdedAffiliateBps } from './getThresholdedAffiliateBps/getThresholdedAffiliateBps.js';
8
7
  import { getAffiliate, getDaemonUrl, getNativePrecision, getPoolAssetId } from './index.js';
9
8
  import { thorService } from './service.js';
10
9
  export const getQuote = async (input, deps) => {
11
10
  const { buyAssetId, receiveAddress, sellAsset, sellAmountCryptoBaseUnit, streaming, streamingInterval, affiliateBps, swapperName, } = input;
12
- // don't apply an affiliate fee if it's below the outbound fee for the inbound pool
13
- const thresholdedAffiliateBps = await getThresholdedAffiliateBps({
14
- sellAsset,
15
- sellAmountCryptoBaseUnit,
16
- affiliateBps,
17
- config: deps.config,
18
- swapperName,
19
- });
20
11
  const buyPoolId = getPoolAssetId({ assetId: buyAssetId, swapperName });
21
12
  const sellPoolId = getPoolAssetId({ assetId: sellAsset.assetId, swapperName });
22
13
  const sellAmountCryptoPrecision = BigAmount.fromBaseUnit({
@@ -37,33 +28,40 @@ export const getQuote = async (input, deps) => {
37
28
  from_asset: sellPoolId,
38
29
  to_asset: buyPoolId,
39
30
  destination: parsedReceiveAddress,
40
- affiliate_bps: thresholdedAffiliateBps,
31
+ affiliate_bps: affiliateBps,
41
32
  affiliate: getAffiliate(swapperName),
42
33
  ...(streaming && { streaming_interval: streamingInterval }),
43
34
  });
44
35
  const daemonUrl = getDaemonUrl(deps.config, swapperName);
45
36
  const res = await thorService.get(`${daemonUrl}/quote/swap?${queryString}`);
46
- if (res.isErr())
47
- return Err(res.unwrapErr());
48
- const { data } = res.unwrap();
49
- const isError = 'error' in data;
50
- const notEnoughFeeError = isError && /not enough fee/i.test(data.error);
51
- const notEnoughToPayTxFeeError = isError && /not enough to pay transaction fee/i.test(data.error);
52
- const tradingIsHaltedError = isError && /trading is halted/.test(data.error);
53
- if (notEnoughFeeError || notEnoughToPayTxFeeError)
54
- return Err(createTradeAmountTooSmallErr());
55
- if (tradingIsHaltedError) {
56
- return Err(makeSwapErrorRight({
57
- message: `[getQuote]: Trading is halted, cannot process swap`,
58
- code: TradeQuoteError.TradingHalted,
59
- details: { sellAssetId: sellAsset.assetId, buyAssetId },
60
- }));
61
- }
62
- if (isError) {
37
+ // Thornode returns errors as `{ error: string }` in both the 2xx body and the 4xx body.
38
+ // On 4xx axios rejects, so the body lands on `cause.response.data` instead of in the success data.
39
+ const errorMessage = (() => {
40
+ if (res.isErr()) {
41
+ const cause = res.unwrapErr().cause;
42
+ return cause?.response?.data?.error;
43
+ }
44
+ const { data } = res.unwrap();
45
+ return 'error' in data ? data.error : undefined;
46
+ })();
47
+ if (errorMessage) {
48
+ if (/not enough fee/i.test(errorMessage) ||
49
+ /not enough to pay transaction fee/i.test(errorMessage)) {
50
+ return Err(createTradeAmountTooSmallErr());
51
+ }
52
+ if (/trading is halted/i.test(errorMessage)) {
53
+ return Err(makeSwapErrorRight({
54
+ message: `[getQuote]: Trading is halted, cannot process swap`,
55
+ code: TradeQuoteError.TradingHalted,
56
+ details: { sellAssetId: sellAsset.assetId, buyAssetId },
57
+ }));
58
+ }
63
59
  return Err(makeSwapErrorRight({
64
- message: data.error,
60
+ message: errorMessage,
65
61
  code: TradeQuoteError.UnknownError,
66
62
  }));
67
63
  }
68
- return Ok(data);
64
+ if (res.isErr())
65
+ return Err(res.unwrapErr());
66
+ return Ok(res.unwrap().data);
69
67
  };
@@ -2,9 +2,9 @@ import { bnOrZero, contractAddressOrUndefined } from '@shapeshiftoss/utils';
2
2
  import { TronWeb } from 'tronweb';
3
3
  import { getExecutableTradeStep, isExecutableTradeQuote } from '../../utils.js';
4
4
  import { getThorTxData } from './getThorTxData.js';
5
- const getChainPrices = async (rpcUrl) => {
5
+ const getChainPrices = async (rpcUrl, headers) => {
6
6
  try {
7
- const tronWeb = new TronWeb({ fullHost: rpcUrl });
7
+ const tronWeb = new TronWeb({ fullHost: rpcUrl, headers });
8
8
  const params = await tronWeb.trx.getChainParameters();
9
9
  const bandwidthPrice = params.find(p => p.key === 'getTransactionFee')?.value ?? 1000;
10
10
  const energyPrice = params.find(p => p.key === 'getEnergyFee')?.value ?? 420;
@@ -26,11 +26,14 @@ export const getTronTransactionFees = async (args, swapperName) => {
26
26
  const { vault } = await getThorTxData({ sellAsset, config, swapperName });
27
27
  const contractAddress = contractAddressOrUndefined(sellAsset.assetId);
28
28
  const rpcUrl = config.VITE_TRON_NODE_URL;
29
+ const tronGridHeaders = config.VITE_TRON_GRID_API_KEY
30
+ ? { 'TRON-PRO-API-KEY': config.VITE_TRON_GRID_API_KEY }
31
+ : {};
29
32
  try {
30
- const tronWeb = new TronWeb({ fullHost: rpcUrl });
33
+ const tronWeb = new TronWeb({ fullHost: rpcUrl, headers: tronGridHeaders });
31
34
  if (contractAddress) {
32
35
  // TRC20 transfer - estimate energy cost
33
- const { energyPrice } = await getChainPrices(rpcUrl);
36
+ const { energyPrice } = await getChainPrices(rpcUrl, tronGridHeaders);
34
37
  const result = await tronWeb.transactionBuilder.triggerConstantContract(contractAddress, 'transfer(address,uint256)', {}, [
35
38
  { type: 'address', value: vault },
36
39
  { type: 'uint256', value: sellAmountIncludingProtocolFeesCryptoBaseUnit },
@@ -41,7 +44,7 @@ export const getTronTransactionFees = async (args, swapperName) => {
41
44
  }
42
45
  else {
43
46
  // TRX transfer with memo - build transaction to get accurate size
44
- const { bandwidthPrice } = await getChainPrices(rpcUrl);
47
+ const { bandwidthPrice } = await getChainPrices(rpcUrl, tronGridHeaders);
45
48
  let tx = await tronWeb.transactionBuilder.sendTrx(vault, bnOrZero(sellAmountIncludingProtocolFeesCryptoBaseUnit).toNumber(), from);
46
49
  // Add memo to get accurate size with memo overhead
47
50
  const txWithMemo = await tronWeb.transactionBuilder.addUpdateData(tx, memo, 'utf8');
@@ -71,7 +71,7 @@ export type ThornodeQuoteResponseSuccess = {
71
71
  total_swap_seconds?: number;
72
72
  warning: string;
73
73
  };
74
- type ThornodeResponseError = {
74
+ export type ThornodeResponseError = {
75
75
  error: string;
76
76
  };
77
77
  export type ThornodeQuoteResponse = ThornodeQuoteResponseSuccess | ThornodeResponseError;
@@ -11,6 +11,7 @@ import type Polyglot from 'node-polyglot';
11
11
  import type { InterpolationOptions } from 'node-polyglot';
12
12
  import type { Address, Hex } from 'viem';
13
13
  import type { AcrossTransactionMetadata } from './swappers/AcrossSwapper/utils/types.js';
14
+ import type { BobGatewayMetadata } from './swappers/BobGatewaySwapper/types.js';
14
15
  import type { CowMessageToSign } from './swappers/CowSwapper/types.js';
15
16
  import type { DebridgeTransactionMetadata } from './swappers/DebridgeSwapper/utils/types.js';
16
17
  import type { RelayTransactionMetadata } from './swappers/RelaySwapper/utils/types.js';
@@ -22,6 +23,7 @@ export type SwapperConfig = {
22
23
  VITE_THORCHAIN_NODE_URL: string;
23
24
  VITE_MAYACHAIN_NODE_URL: string;
24
25
  VITE_TRON_NODE_URL: string;
26
+ VITE_TRON_GRID_API_KEY: string;
25
27
  VITE_FEATURE_THORCHAINSWAP_LONGTAIL: boolean;
26
28
  VITE_FEATURE_THORCHAINSWAP_L1_TO_LONGTAIL: boolean;
27
29
  VITE_THORCHAIN_MIDGARD_URL: string;
@@ -50,6 +52,7 @@ export type SwapperConfig = {
50
52
  VITE_ACROSS_API_URL: string;
51
53
  VITE_ACROSS_INTEGRATOR_ID: string;
52
54
  VITE_DEBRIDGE_API_URL: string;
55
+ VITE_BOB_GATEWAY_API_KEY: string;
53
56
  };
54
57
  export declare enum SwapperName {
55
58
  Thorchain = "THORChain",
@@ -69,7 +72,8 @@ export declare enum SwapperName {
69
72
  Avnu = "AVNU",
70
73
  Stonfi = "STON.fi",
71
74
  Across = "Across",
72
- Debridge = "deBridge"
75
+ Debridge = "deBridge",
76
+ BobGateway = "BOB Gateway"
73
77
  }
74
78
  export type SwapSource = SwapperName | `${SwapperName} • ${string}`;
75
79
  export type SwapErrorRight = {
@@ -95,7 +99,9 @@ export declare enum TradeQuoteError {
95
99
  FinalQuoteMaxSlippageExceeded = "FinalQuoteMaxSlippageExceeded",
96
100
  FinalQuoteExecutionReverted = "FinalQuoteExecutionReverted",
97
101
  Timeout = "Timeout",
98
- UnknownError = "UnknownError"
102
+ UnknownError = "UnknownError",
103
+ InsufficientFunds = "InsufficientFunds",
104
+ InsufficientFundsUnconfirmed = "InsufficientFundsUnconfirmed"
99
105
  }
100
106
  export type UtxoFeeData = {
101
107
  satsPerByte: string;
@@ -133,7 +139,6 @@ type CommonTradeInputBase = {
133
139
  buyAsset: Asset;
134
140
  sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
135
141
  affiliateBps: string;
136
- affiliateAddress?: string;
137
142
  allowMultiHop: boolean;
138
143
  slippageTolerancePercentageDecimal?: string;
139
144
  };
@@ -402,6 +407,7 @@ export type TradeQuoteStep = {
402
407
  };
403
408
  acrossTransactionMetadata?: AcrossTransactionMetadata;
404
409
  debridgeTransactionMetadata?: DebridgeTransactionMetadata;
410
+ bobSpecific?: BobGatewayMetadata;
405
411
  affiliateFee?: AffiliateFee;
406
412
  };
407
413
  export type TradeRateStep = Omit<TradeQuoteStep, 'accountNumber'> & {
@@ -458,6 +464,7 @@ export type SwapperSpecificMetadata = {
458
464
  relayTransactionMetadata: RelayTransactionMetadata | undefined;
459
465
  acrossTransactionMetadata: AcrossTransactionMetadata | undefined;
460
466
  debridgeTransactionMetadata: DebridgeTransactionMetadata | undefined;
467
+ bobSpecific?: BobGatewayMetadata;
461
468
  relayerExplorerTxLink: string | undefined;
462
469
  relayerTxHash: string | undefined;
463
470
  stepIndex: SupportedTradeQuoteStepIndex;
package/dist/esm/types.js CHANGED
@@ -18,6 +18,7 @@ export var SwapperName;
18
18
  SwapperName["Stonfi"] = "STON.fi";
19
19
  SwapperName["Across"] = "Across";
20
20
  SwapperName["Debridge"] = "deBridge";
21
+ SwapperName["BobGateway"] = "BOB Gateway";
21
22
  })(SwapperName || (SwapperName = {}));
22
23
  export var TradeQuoteError;
23
24
  (function (TradeQuoteError) {
@@ -53,6 +54,10 @@ export var TradeQuoteError;
53
54
  TradeQuoteError["Timeout"] = "Timeout";
54
55
  // catch-all for unknown issues
55
56
  TradeQuoteError["UnknownError"] = "UnknownError";
57
+ // the swapper performed on chain balance checks and determined the user didn't have the funds to perform the swap
58
+ TradeQuoteError["InsufficientFunds"] = "InsufficientFunds";
59
+ // the user's confirmed balance is insufficient — funds may exist but are still confirming on chain (e.g. unconfirmed UTXO deposits)
60
+ TradeQuoteError["InsufficientFundsUnconfirmed"] = "InsufficientFundsUnconfirmed";
56
61
  })(TradeQuoteError || (TradeQuoteError = {}));
57
62
  export var TransactionExecutionState;
58
63
  (function (TransactionExecutionState) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "17.7.3",
3
+ "version": "17.8.0",
4
4
  "repository": "https://github.com/shapeshift/web",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,6 +28,7 @@
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
+ "@gobob/bob-sdk": "5.6.0",
31
32
  "@mysten/sui": "^1.45.2",
32
33
  "@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.0",
33
34
  "@sniptt/monads": "^0.5.10",
@@ -49,13 +50,13 @@
49
50
  "retry-axios": "^2.6.0",
50
51
  "uuid": "^9.0.0",
51
52
  "viem": "2.43.5",
52
- "@shapeshiftoss/caip": "^8.16.7",
53
- "@shapeshiftoss/chain-adapters": "^11.3.9",
54
- "@shapeshiftoss/contracts": "^1.0.5-coderabbit-fix.2",
55
- "@shapeshiftoss/types": "^8.6.7",
53
+ "@shapeshiftoss/caip": "^8.16.9",
54
+ "@shapeshiftoss/chain-adapters": "^11.4.0",
55
+ "@shapeshiftoss/contracts": "^1.0.7",
56
56
  "@shapeshiftoss/hdwallet-core": "^1.62.41",
57
- "@shapeshiftoss/unchained-client": "^10.14.10",
58
- "@shapeshiftoss/utils": "^1.0.5"
57
+ "@shapeshiftoss/types": "^8.6.8",
58
+ "@shapeshiftoss/utils": "^1.1.0",
59
+ "@shapeshiftoss/unchained-client": "^10.14.11"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@types/lodash": "^4.14.178",
@@ -1,11 +0,0 @@
1
- import type { SunioRoute } from '../types';
2
- export type BuildSwapTransactionArgs = {
3
- route: SunioRoute;
4
- from: string;
5
- to: string;
6
- sellAmountCryptoBaseUnit: string;
7
- minBuyAmountCryptoBaseUnit: string;
8
- rpcUrl: string;
9
- deadline?: number;
10
- };
11
- export declare const buildSunioSwapTransaction: (args: BuildSwapTransactionArgs) => Promise<any>;