@cityofzion/bs-multichain 3.1.14 → 3.1.15

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.
@@ -50,7 +50,7 @@ class SimpleSwapApi {
50
50
  }
51
51
  catch (error) {
52
52
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
53
- throw new Error(error.response.data.message);
53
+ throw new Error(error.response.data.message, { cause: error });
54
54
  }
55
55
  throw error;
56
56
  }
@@ -69,7 +69,7 @@ class SimpleSwapApi {
69
69
  }
70
70
  catch (error) {
71
71
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
72
- throw new Error(error.response.data.message);
72
+ throw new Error(error.response.data.message, { cause: error });
73
73
  }
74
74
  throw error;
75
75
  }
@@ -88,7 +88,7 @@ class SimpleSwapApi {
88
88
  }
89
89
  catch (error) {
90
90
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
91
- throw new Error(error.response.data.message);
91
+ throw new Error(error.response.data.message, { cause: error });
92
92
  }
93
93
  throw error;
94
94
  }
@@ -108,7 +108,7 @@ class SimpleSwapApi {
108
108
  }
109
109
  catch (error) {
110
110
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
111
- throw new Error(error.response.data.message);
111
+ throw new Error(error.response.data.message, { cause: error });
112
112
  }
113
113
  throw error;
114
114
  }
@@ -133,7 +133,7 @@ class SimpleSwapApi {
133
133
  }
134
134
  catch (error) {
135
135
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
136
- throw new Error(error.response.data.message);
136
+ throw new Error(error.response.data.message, { cause: error });
137
137
  }
138
138
  throw error;
139
139
  }
@@ -150,7 +150,7 @@ class SimpleSwapApi {
150
150
  }
151
151
  catch (error) {
152
152
  if (axios_1.default.isAxiosError(error) && error.response?.data.message) {
153
- throw new Error(error.response.data.message);
153
+ throw new Error(error.response.data.message, { cause: error });
154
154
  }
155
155
  throw error;
156
156
  }
@@ -390,10 +390,12 @@ _SimpleSwapOrchestrator_api = new WeakMap(), _SimpleSwapOrchestrator_blockchainS
390
390
  }
391
391
  if (shouldRecalculateAmountToReceive && __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToReceive_get).value && __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_amountToUse_get).value) {
392
392
  try {
393
- const estimate = await __classPrivateFieldGet(this, _SimpleSwapOrchestrator_api, "f").getEstimate(__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToUse_get).value, __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToReceive_get).value, __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_amountToUse_get).value);
394
- __classPrivateFieldSet(this, _SimpleSwapOrchestrator_instances, {
395
- value: estimate,
396
- }, "a", _SimpleSwapOrchestrator_amountToReceive_set);
393
+ const estimatedValue = await __classPrivateFieldGet(this, _SimpleSwapOrchestrator_api, "f").getEstimate(__classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToUse_get).value, __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToReceive_get).value, __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_amountToUse_get).value);
394
+ const decimals = __classPrivateFieldGet(this, _SimpleSwapOrchestrator_instances, "a", _SimpleSwapOrchestrator_tokenToReceive_get).value.decimals;
395
+ const value = typeof decimals === 'number' && !isNaN(decimals)
396
+ ? new blockchain_service_1.BSBigHumanAmount(estimatedValue, decimals).toFormatted()
397
+ : estimatedValue;
398
+ __classPrivateFieldSet(this, _SimpleSwapOrchestrator_instances, { value }, "a", _SimpleSwapOrchestrator_amountToReceive_set);
397
399
  }
398
400
  catch (error) {
399
401
  this.eventEmitter.emit('error', error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-multichain",
3
- "version": "3.1.14",
3
+ "version": "3.1.15",
4
4
  "repository": "https://github.com/CityOfZion/blockchain-services",
5
5
  "license": "GPL-3.0-only",
6
6
  "author": "Coz",
@@ -13,7 +13,7 @@
13
13
  "@walletconnect/utils": "~2.21.9",
14
14
  "@walletconnect/jsonrpc-utils": "~1.0.8",
15
15
  "axios": "~1.15.0",
16
- "@cityofzion/blockchain-service": "3.1.14"
16
+ "@cityofzion/blockchain-service": "3.1.15"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "~24.5.2",
@@ -23,13 +23,13 @@
23
23
  "typed-emitter": "~2.1.0",
24
24
  "typescript": "~5.9.2",
25
25
  "vitest": "~4.0.18",
26
- "@cityofzion/bs-ethereum": "3.1.14",
27
- "@cityofzion/bs-neo3": "3.1.14",
28
- "@cityofzion/bs-bitcoin": "3.1.14",
29
- "@cityofzion/bs-neox": "3.1.14",
30
- "@cityofzion/bs-neo-legacy": "3.1.14",
31
- "@cityofzion/bs-stellar": "3.1.14",
32
- "@cityofzion/bs-solana": "3.1.14"
26
+ "@cityofzion/bs-neo3": "3.1.15",
27
+ "@cityofzion/bs-neox": "3.1.15",
28
+ "@cityofzion/bs-bitcoin": "3.1.15",
29
+ "@cityofzion/bs-ethereum": "3.1.15",
30
+ "@cityofzion/bs-neo-legacy": "3.1.15",
31
+ "@cityofzion/bs-solana": "3.1.15",
32
+ "@cityofzion/bs-stellar": "3.1.15"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rm -rf ./dist && rm -f *.tgz && npm run typecheck && tsc --project tsconfig.build.json",