@t2000/sdk 0.16.28 → 0.16.29

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.
@@ -951,12 +951,20 @@ async function buildSwapTx(params) {
951
951
  }
952
952
  const rawAmount = BigInt(Math.floor(amount * 10 ** fromInfo.decimals));
953
953
  const aggClient = createAggregatorClient(client, address);
954
- const result = await aggClient.findRouters({
955
- from: fromInfo.type,
956
- target: toInfo.type,
957
- amount: rawAmount,
958
- byAmountIn: true
959
- });
954
+ const _origLog = console.log;
955
+ console.log = () => {
956
+ };
957
+ let result;
958
+ try {
959
+ result = await aggClient.findRouters({
960
+ from: fromInfo.type,
961
+ target: toInfo.type,
962
+ amount: rawAmount,
963
+ byAmountIn: true
964
+ });
965
+ } finally {
966
+ console.log = _origLog;
967
+ }
960
968
  if (!result || result.insufficientLiquidity) {
961
969
  throw new T2000Error(
962
970
  "ASSET_NOT_SUPPORTED",
@@ -965,11 +973,17 @@ async function buildSwapTx(params) {
965
973
  }
966
974
  const tx = new Transaction();
967
975
  const slippage = maxSlippageBps / 1e4;
968
- await aggClient.fastRouterSwap({
969
- router: result,
970
- txb: tx,
971
- slippage
972
- });
976
+ console.log = () => {
977
+ };
978
+ try {
979
+ await aggClient.fastRouterSwap({
980
+ router: result,
981
+ txb: tx,
982
+ slippage
983
+ });
984
+ } finally {
985
+ console.log = _origLog;
986
+ }
973
987
  const estimatedOut = Number(result.amountOut.toString());
974
988
  return {
975
989
  tx,
@@ -986,12 +1000,20 @@ async function addSwapToTx(params) {
986
1000
  }
987
1001
  const rawAmount = BigInt(Math.floor(amount * 10 ** fromInfo.decimals));
988
1002
  const aggClient = createAggregatorClient(client, address);
989
- const result = await aggClient.findRouters({
990
- from: fromInfo.type,
991
- target: toInfo.type,
992
- amount: rawAmount,
993
- byAmountIn: true
994
- });
1003
+ const _origLog = console.log;
1004
+ console.log = () => {
1005
+ };
1006
+ let result;
1007
+ try {
1008
+ result = await aggClient.findRouters({
1009
+ from: fromInfo.type,
1010
+ target: toInfo.type,
1011
+ amount: rawAmount,
1012
+ byAmountIn: true
1013
+ });
1014
+ } finally {
1015
+ console.log = _origLog;
1016
+ }
995
1017
  if (!result || result.insufficientLiquidity) {
996
1018
  throw new T2000Error(
997
1019
  "ASSET_NOT_SUPPORTED",
@@ -999,12 +1021,19 @@ async function addSwapToTx(params) {
999
1021
  );
1000
1022
  }
1001
1023
  const slippage = maxSlippageBps / 1e4;
1002
- const outputCoin = await aggClient.routerSwap({
1003
- router: result,
1004
- txb: tx,
1005
- inputCoin,
1006
- slippage
1007
- });
1024
+ console.log = () => {
1025
+ };
1026
+ let outputCoin;
1027
+ try {
1028
+ outputCoin = await aggClient.routerSwap({
1029
+ router: result,
1030
+ txb: tx,
1031
+ inputCoin,
1032
+ slippage
1033
+ });
1034
+ } finally {
1035
+ console.log = _origLog;
1036
+ }
1008
1037
  const estimatedOut = Number(result.amountOut.toString());
1009
1038
  return {
1010
1039
  outputCoin,