@bsv/sdk 1.6.10 → 1.6.11
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 +5 -1
- 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 +5 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/package.json +1 -1
- package/src/wallet/substrates/HTTPWalletJSON.ts +6 -1
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ export default class HTTPWalletJSON implements WalletInterface {
|
|
|
54
54
|
this.httpClient = httpClient
|
|
55
55
|
|
|
56
56
|
// Detect if we're in a browser environment
|
|
57
|
-
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'
|
|
57
|
+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window?.origin !== 'file://'
|
|
58
58
|
|
|
59
59
|
this.api = async (call: string, args: object) => {
|
|
60
60
|
// In browser environments, let the browser handle Origin header automatically
|
|
@@ -63,6 +63,10 @@ export default class HTTPWalletJSON implements WalletInterface {
|
|
|
63
63
|
? toOriginHeader(this.originator, 'http')
|
|
64
64
|
: undefined
|
|
65
65
|
|
|
66
|
+
if (!isBrowser && origin === undefined) {
|
|
67
|
+
console.error('Originator is required in Node.js environments')
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
const res = await (
|
|
67
71
|
await httpClient(`${this.baseUrl}/${call}`, {
|
|
68
72
|
method: 'POST',
|
|
@@ -70,6 +74,7 @@ export default class HTTPWalletJSON implements WalletInterface {
|
|
|
70
74
|
Accept: 'application/json',
|
|
71
75
|
'Content-Type': 'application/json',
|
|
72
76
|
...(origin ? { Origin: origin } : {}),
|
|
77
|
+
...(origin ? { Originator: origin } : {}),
|
|
73
78
|
},
|
|
74
79
|
body: JSON.stringify(args)
|
|
75
80
|
})
|