@bsv/sdk 1.4.8 → 1.4.10

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.
Files changed (35) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/auth/clients/AuthFetch.js +6 -1
  3. package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
  4. package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js +3 -0
  5. package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
  6. package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js +3 -0
  7. package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
  8. package/dist/cjs/src/wallet/substrates/window.CWI.js.map +1 -1
  9. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  10. package/dist/esm/src/auth/clients/AuthFetch.js +6 -1
  11. package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
  12. package/dist/esm/src/wallet/substrates/WalletWireProcessor.js +3 -0
  13. package/dist/esm/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
  14. package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js +3 -0
  15. package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
  16. package/dist/esm/src/wallet/substrates/window.CWI.js.map +1 -1
  17. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  18. package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
  19. package/dist/types/src/wallet/Wallet.interfaces.d.ts +1 -1
  20. package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
  21. package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts.map +1 -1
  22. package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts.map +1 -1
  23. package/dist/types/src/wallet/substrates/window.CWI.d.ts +1 -1
  24. package/dist/types/src/wallet/substrates/window.CWI.d.ts.map +1 -1
  25. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  26. package/dist/umd/bundle.js +1 -1
  27. package/docs/README.md +4 -2
  28. package/docs/wallet-substrates.md +1 -1
  29. package/docs/wallet.md +2 -2
  30. package/package.json +1 -1
  31. package/src/auth/clients/AuthFetch.ts +5 -1
  32. package/src/wallet/Wallet.interfaces.ts +1 -0
  33. package/src/wallet/substrates/WalletWireProcessor.ts +3 -0
  34. package/src/wallet/substrates/WalletWireTransceiver.ts +7 -17
  35. package/src/wallet/substrates/window.CWI.ts +1 -0
package/docs/README.md CHANGED
@@ -7,13 +7,15 @@ The documentation is split into various pages, each covering a set of related fu
7
7
  - [Transaction](./transaction.md) — Covers transaction construction, signing, broadcasters, fee models, merkle proofs, and SPV structures like BUMP
8
8
  - [Messages](./messages.md) — Covers generalizable message signing, verification, encryption and decryption
9
9
  - [TOTP](./totp.md) - Covers Time-based One Time Password, useful for validating counterparties across unsecured mediums.
10
- - [Wallet](./wallet-substrates.md) - Covers the Wallet Substrates for communication between applications and wallets using a standard interface.
10
+ - [Wallet](./wallet.md) - Covers the Wallet interface for communication between applications and wallets using a standard interface.
11
+ - [Wallet Substrates](./wallet-substrates.md) - Covers the Wallet Substrates which facilitate communication between apps and wallets.
11
12
  - [Overlay Tools](./overlay-tools.md) - Covers the use of Overlays for broadcast of transactions based on topics, as well as distributed lookup of tokens.
12
13
  - [Auth](./auth.md) - Mutual Authentication and Service Monetization Framework
14
+ - [Storage](./storage.md) — Covers a UHRP client for storing and retrieving data from distributed data storage services by hash.
13
15
  - [Compat](./compat.md) — Covers deprecated functionality for legacy systems like BIP32 and ECIES
14
16
 
15
17
  ## Swagger
16
18
 
17
19
  [BRC-100](https://brc.dev/100) defines a Unified, Vendor-Neutral, Unchanging, and Open BSV Blockchain Standard Wallet-to-Application Interface which is implemented in this library within the WalletClient class. The API is laid out here as a swagger openapi document to offer a fast-track to understanding the interface which is implemented across multiple substrates. The JSON api is generally considered a developer friendly introduction to the WalletClient, where an binary equivalent ABI may be preferred for production use cases.
18
20
 
19
- - [Wallet JSON API Swagger](./swagger)
21
+ - [Wallet JSON API Swagger](./swagger)
@@ -382,7 +382,7 @@ export default class WindowCWISubstrate implements WalletInterface {
382
382
  actions: Array<{
383
383
  txid: TXIDHexString;
384
384
  satoshis: SatoshiValue;
385
- status: "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal";
385
+ status: "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal" | "failed";
386
386
  isOutgoing: boolean;
387
387
  description: DescriptionString5to50Bytes;
388
388
  labels?: LabelStringUnder300Bytes[];
package/docs/wallet.md CHANGED
@@ -2660,7 +2660,7 @@ export default class WindowCWISubstrate implements WalletInterface {
2660
2660
  actions: Array<{
2661
2661
  txid: TXIDHexString;
2662
2662
  satoshis: SatoshiValue;
2663
- status: "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal";
2663
+ status: "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal" | "failed";
2664
2664
  isOutgoing: boolean;
2665
2665
  description: DescriptionString5to50Bytes;
2666
2666
  labels?: LabelStringUnder300Bytes[];
@@ -3501,7 +3501,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
3501
3501
  ### Type: ActionStatus
3502
3502
 
3503
3503
  ```ts
3504
- export type ActionStatus = "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal"
3504
+ export type ActionStatus = "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal" | "failed"
3505
3505
  ```
3506
3506
 
3507
3507
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -355,11 +355,15 @@ export class AuthFetch {
355
355
  const includedHeaders: [string, string][] = []
356
356
  for (let [k, v] of Object.entries(headers)) {
357
357
  k = k.toLowerCase() // We will always sign lower-case header keys
358
- if (k.startsWith('x-bsv-') || k === 'content-type' || k === 'authorization') {
358
+ if (k.startsWith('x-bsv-') || k === 'authorization') {
359
359
  if (k.startsWith('x-bsv-auth')) {
360
360
  throw new Error('No BSV auth headers allowed here!')
361
361
  }
362
362
  includedHeaders.push([k, v])
363
+ } else if (k.startsWith('content-type')) {
364
+ // Normalize the Content-Type header by removing any parameters (e.g., "; charset=utf-8")
365
+ v = (v as string).split(';')[0].trim()
366
+ includedHeaders.push([k, v])
363
367
  } else {
364
368
  throw new Error('Unsupported header in the simplified fetch implementation. Only content-type, authorization, and x-bsv-* headers are supported.')
365
369
  }
@@ -230,6 +230,7 @@ export type ActionStatus =
230
230
  | 'unsigned'
231
231
  | 'nosend'
232
232
  | 'nonfinal'
233
+ | 'failed'
233
234
 
234
235
  /**
235
236
  * Controls behavior of input BEEF validation.
@@ -626,6 +626,9 @@ export default class WalletWireProcessor implements WalletWire {
626
626
  case 'nonfinal':
627
627
  statusCode = 7
628
628
  break
629
+ case 'failed':
630
+ statusCode = 8
631
+ break
629
632
  default:
630
633
  statusCode = -1
631
634
  break
@@ -43,7 +43,8 @@ import {
43
43
  SignActionResult,
44
44
  TXIDHexString,
45
45
  VersionString7To30Bytes,
46
- WalletInterface
46
+ WalletInterface,
47
+ ActionStatus
47
48
  } from '../Wallet.interfaces.js'
48
49
  import WalletWire from './WalletWire.js'
49
50
  import Certificate from '../../auth/certificates/Certificate.js'
@@ -602,14 +603,7 @@ export default class WalletWireTransceiver implements WalletInterface {
602
603
  const actions: Array<{
603
604
  txid: TXIDHexString
604
605
  satoshis: SatoshiValue
605
- status:
606
- | 'completed'
607
- | 'unprocessed'
608
- | 'sending'
609
- | 'unproven'
610
- | 'unsigned'
611
- | 'nosend'
612
- | 'nonfinal'
606
+ status: ActionStatus
613
607
  isOutgoing: boolean
614
608
  description: DescriptionString5to50Bytes
615
609
  labels?: LabelStringUnder300Bytes[]
@@ -643,14 +637,7 @@ export default class WalletWireTransceiver implements WalletInterface {
643
637
  const satoshis = resultReader.readVarIntNum()
644
638
 
645
639
  const statusCode = resultReader.readInt8()
646
- let status:
647
- | 'completed'
648
- | 'unprocessed'
649
- | 'sending'
650
- | 'unproven'
651
- | 'unsigned'
652
- | 'nosend'
653
- | 'nonfinal'
640
+ let status: ActionStatus
654
641
  switch (statusCode) {
655
642
  case 1:
656
643
  status = 'completed'
@@ -673,6 +660,9 @@ export default class WalletWireTransceiver implements WalletInterface {
673
660
  case 7:
674
661
  status = 'nonfinal'
675
662
  break
663
+ case 8:
664
+ status = 'failed'
665
+ break
676
666
  default:
677
667
  throw new Error(`Unknown status code: ${statusCode}`)
678
668
  }
@@ -161,6 +161,7 @@ export default class WindowCWISubstrate implements WalletInterface {
161
161
  | 'unsigned'
162
162
  | 'nosend'
163
163
  | 'nonfinal'
164
+ | 'failed'
164
165
  isOutgoing: boolean
165
166
  description: DescriptionString5to50Bytes
166
167
  labels?: LabelStringUnder300Bytes[]