@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.6.10",
3
+ "version": "1.6.11",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -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
  })