@chainflip/bitcoin 1.2.5 → 1.2.6

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/index.cjs CHANGED
@@ -185,10 +185,16 @@ var makeRequest = async (rpcUrl, method, params) => {
185
185
  params
186
186
  })
187
187
  });
188
- if (res.status !== 200) {
189
- throw new Error(`HTTP error [${res.status}]: ${await res.text() || res.statusText}`);
188
+ const text = await res.text();
189
+ let json;
190
+ try {
191
+ json = JSON.parse(text);
192
+ } catch {
193
+ if (res.status !== 200) {
194
+ throw new Error(`HTTP error [${res.status}]: ${text || res.statusText}`);
195
+ }
196
+ throw new Error(`Invalid JSON response: ${text}`);
190
197
  }
191
- const json = await res.json();
192
198
  const result = rpcResponse.parse(json);
193
199
  if (result.error) {
194
200
  if (result.error.code === -5) return null;
package/dist/index.js CHANGED
@@ -158,10 +158,16 @@ var makeRequest = async (rpcUrl, method, params) => {
158
158
  params
159
159
  })
160
160
  });
161
- if (res.status !== 200) {
162
- throw new Error(`HTTP error [${res.status}]: ${await res.text() || res.statusText}`);
161
+ const text = await res.text();
162
+ let json;
163
+ try {
164
+ json = JSON.parse(text);
165
+ } catch {
166
+ if (res.status !== 200) {
167
+ throw new Error(`HTTP error [${res.status}]: ${text || res.statusText}`);
168
+ }
169
+ throw new Error(`Invalid JSON response: ${text}`);
163
170
  }
164
- const json = await res.json();
165
171
  const result = rpcResponse.parse(json);
166
172
  if (result.error) {
167
173
  if (result.error.code === -5) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/bitcoin",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/chainflip-io/chainflip-product-toolkit.git",
6
6
  "publishConfig": {
@@ -11,14 +11,24 @@
11
11
  "dist",
12
12
  "README.md"
13
13
  ],
14
- "main": "dist/index.cjs",
15
- "module": "dist/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ },
20
+ "import": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ }
25
+ },
16
26
  "dependencies": {
17
- "@chainflip/utils": "0.8.3",
18
- "bignumber.js": "^9.2.0",
27
+ "@chainflip/utils": "0.8.6",
28
+ "bignumber.js": "^9.3.0",
19
29
  "bitcoinjs-lib": "7.0.0-rc.0",
20
30
  "scale-ts": "^1.6.1",
21
- "zod": "^3.24.2"
31
+ "zod": "^3.25.67"
22
32
  },
23
33
  "scripts": {
24
34
  "eslint:check": "pnpm eslint --max-warnings 0 './**/*.ts'",