@bsv/sdk 1.3.21 → 1.3.22
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/cjs/package.json +1 -1
- package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js +20 -23
- package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js +19 -22
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/primitives.md +1 -1
- package/package.json +1 -1
- package/src/wallet/substrates/HTTPWalletJSON.ts +22 -22
package/docs/primitives.md
CHANGED
package/package.json
CHANGED
|
@@ -52,30 +52,30 @@ export default class HTTPWalletJSON implements WalletInterface {
|
|
|
52
52
|
this.httpClient = httpClient
|
|
53
53
|
|
|
54
54
|
this.api = async (call: string, args: object) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
const res = await (
|
|
56
|
+
await httpClient(`${this.baseUrl}/${call}`, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
Accept: 'application/json',
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
Originator: this.originator ?? ''
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify(args)
|
|
64
|
+
})
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
const data = await res.json()
|
|
68
|
+
|
|
69
|
+
// Check the HTTP status on the original response
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
const err = {
|
|
72
|
+
call,
|
|
73
|
+
args,
|
|
74
|
+
message: data.message ?? `HTTP Client error ${res.status}`
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
} catch (error) {
|
|
77
|
-
throw error
|
|
76
|
+
throw new Error(JSON.stringify(err))
|
|
78
77
|
}
|
|
78
|
+
return data
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|