@bsv/wallet-toolbox 1.6.30 → 1.6.32

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/wallet-toolbox",
3
- "version": "1.6.30",
3
+ "version": "1.6.32",
4
4
  "description": "BRC100 conforming wallet, wallet storage and wallet signer components",
5
5
  "main": "./out/src/index.js",
6
6
  "types": "./out/src/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@bsv/auth-express-middleware": "^1.2.3",
35
35
  "@bsv/payment-express-middleware": "^1.2.3",
36
- "@bsv/sdk": "^1.8.2",
36
+ "@bsv/sdk": "^1.8.6",
37
37
  "express": "^4.21.2",
38
38
  "idb": "^8.0.2",
39
39
  "knex": "^3.1.0",
@@ -54,8 +54,6 @@
54
54
  "fake-indexeddb": "^6.0.0",
55
55
  "fs-extra": "^11.2.0",
56
56
  "jest": "^29.7.0",
57
- "jest-diff": "^29.7.0",
58
- "jest-simple-summary": "^1.0.2",
59
57
  "prettier": "^3.4.2",
60
58
  "ts-jest": "^29.0.5",
61
59
  "ts-node": "^10.9.1",
@@ -46,7 +46,7 @@ export class ChaintracksFetch implements ChaintracksFetchApi {
46
46
  throw new Error(`Failed to fetch JSON from ${url}: ${response.statusText}`)
47
47
  }
48
48
  json = (await response.json()) as R
49
- break;
49
+ break
50
50
  }
51
51
  return json
52
52
  }
@@ -8,8 +8,10 @@ import {
8
8
  PubKeyHex,
9
9
  PublicKey,
10
10
  Random,
11
+ ReviewActionResult,
11
12
  Script,
12
- Utils
13
+ Utils,
14
+ WERR_REVIEW_ACTIONS
13
15
  } from '@bsv/sdk'
14
16
  import {
15
17
  generateChangeSdk,
@@ -224,11 +226,25 @@ async function createNewInputs(
224
226
  if (o) {
225
227
  await storage.transaction(async trx => {
226
228
  const o2 = verifyOne(await storage.findOutputs({ partial: { outputId: o.outputId }, trx }))
227
- if (o2.spendable != true || o2.spentBy !== undefined)
229
+ if (o2.spentBy !== undefined) {
230
+ const spendingTx = await storage.findTransactionById(verifyId(o2.spentBy), trx)
231
+ if (spendingTx && spendingTx.txid) {
232
+ const beef = await storage.getBeefForTransaction(spendingTx.txid, {})
233
+ const rar: ReviewActionResult = {
234
+ txid: '',
235
+ status: 'doubleSpend',
236
+ competingTxs: [spendingTx.txid!],
237
+ competingBeef: beef.toBinary()
238
+ }
239
+ throw new WERR_REVIEW_ACTIONS([rar], [])
240
+ }
241
+ }
242
+ if (o2.spendable != true) {
228
243
  throw new WERR_INVALID_PARAMETER(
229
244
  `inputs[${i.vin}]`,
230
245
  `spendable output. output ${o.txid}:${o.vout} appears to have been spent.`
231
246
  )
247
+ }
232
248
  await storage.updateOutput(
233
249
  o.outputId!,
234
250
  {