@bsv/wallet-toolbox 1.1.6 → 1.1.7

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.1.6",
3
+ "version": "1.1.7",
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",
@@ -57,7 +57,7 @@
57
57
  "standard": "^17.1.0",
58
58
  "ts-jest": "^29.0.5",
59
59
  "ts-node": "^10.9.1",
60
- "ts2md": "^0.2.6",
60
+ "ts2md": "^0.2.7",
61
61
  "typescript": "^5.2.2"
62
62
  }
63
63
  }
@@ -160,7 +160,9 @@ export async function purgeData(
160
160
  let spentTxIds = nptxs.map(tx => tx.transactionId)
161
161
 
162
162
  if (spentTxIds.length > 0) {
163
- const update: Partial<table.Output> = { spentBy: undefined }
163
+ const update: Partial<table.Output> = {
164
+ spentBy: null as unknown as undefined
165
+ }
164
166
  qs.push({
165
167
  log: 'spent outputs no longer tracked by spentBy',
166
168
  q: storage
@@ -246,7 +248,7 @@ export async function purgeData(
246
248
  log: 'unspent outputs updated to spendable',
247
249
  q: storage
248
250
  .toDb(trx)<table.Output>('outputs')
249
- .update({ spendable: true, spentBy: undefined })
251
+ .update({ spendable: true, spentBy: null as unknown as undefined })
250
252
  .whereIn('spentBy', transactionIds)
251
253
  })
252
254
  }
@@ -53,7 +53,7 @@ export async function reviewStatus(
53
53
  where exists(select 1 from transactions as t where outputs.spentBy = t.transactionId and t.status = 'failed')
54
54
  */
55
55
  q: k<table.Output>('outputs')
56
- .update({ spentBy: undefined, spendable: true })
56
+ .update({ spentBy: null as unknown as undefined, spendable: true })
57
57
  .whereExists(function () {
58
58
  this.select(k.raw(1))
59
59
  .from('transactions as t')
@@ -191,6 +191,46 @@ describe('walletLive test', () => {
191
191
  `)
192
192
  })
193
193
 
194
+ test('5z send a wallet payment from myCtx to second wallet', async () => {
195
+ const tauriRootKey =
196
+ '1363ef9b14531a52648e1e7e7f430a10ceda1df8d514a2a75d8404094f14a649'
197
+ const tauriIdentityKey = PrivateKey.fromHex(tauriRootKey)
198
+ .toPublicKey()
199
+ .toString()
200
+
201
+ const r = await createWalletPaymentAction({
202
+ toIdentityKey: tauriIdentityKey,
203
+ outputSatoshis: 1000 * 1000,
204
+ keyDeriver: myCtx.keyDeriver,
205
+ wallet: myCtx.wallet,
206
+ logResult: true
207
+ })
208
+
209
+ const toCtx = await _tu.createTestWalletWithStorageClient({
210
+ rootKeyHex: tauriRootKey,
211
+ chain: env.chain
212
+ })
213
+
214
+ const args: InternalizeActionArgs = {
215
+ tx: Utils.toArray(r.atomicBEEF, 'hex'),
216
+ outputs: [
217
+ {
218
+ outputIndex: r.vout,
219
+ protocol: 'wallet payment',
220
+ paymentRemittance: {
221
+ derivationPrefix: r.derivationPrefix,
222
+ derivationSuffix: r.derivationSuffix,
223
+ senderIdentityKey: r.senderIdentityKey
224
+ }
225
+ }
226
+ ],
227
+ description: 'from tone wallet'
228
+ }
229
+
230
+ const rw = await toCtx.wallet.internalizeAction(args)
231
+ expect(rw.accepted).toBe(true)
232
+ })
233
+
194
234
  test('6 send a wallet payment from myCtx to second wallet', async () => {
195
235
  const r = await createWalletPaymentAction({
196
236
  toIdentityKey: myIdentityKey2,
package/ts2md.json CHANGED
@@ -4,35 +4,41 @@
4
4
  "inputFilename": "src/index.ts",
5
5
  "outputFilename": "docs/setup.md",
6
6
  "firstHeadingLevel": 2,
7
- "filenameSubString": "Setup"
7
+ "filenameSubString": "Setup",
8
+ "noDetailsSummary": true
8
9
  },
9
10
  {
10
11
  "inputFilename": "src/index.ts",
11
12
  "outputFilename": "docs/monitor.md",
12
13
  "firstHeadingLevel": 2,
13
- "filenameSubString": "monitor"
14
+ "filenameSubString": "monitor",
15
+ "noDetailsSummary": true
14
16
  },
15
17
  {
16
18
  "inputFilename": "src/index.ts",
17
19
  "outputFilename": "docs/services.md",
18
20
  "firstHeadingLevel": 2,
19
- "filenameSubString": "services"
21
+ "filenameSubString": "services",
22
+ "noDetailsSummary": true
20
23
  },
21
24
  {
22
25
  "inputFilename": "src/index.ts",
23
26
  "outputFilename": "docs/storage.md",
24
27
  "firstHeadingLevel": 2,
25
- "filenameSubString": "storage"
28
+ "filenameSubString": "storage",
29
+ "noDetailsSummary": true
26
30
  },
27
31
  {
28
32
  "inputFilename": "src/index.client.ts",
29
33
  "outputFilename": "docs/client.md",
30
- "firstHeadingLevel": 2
34
+ "firstHeadingLevel": 2,
35
+ "noDetailsSummary": true
31
36
  },
32
37
  {
33
38
  "inputFilename": "src/Wallet.ts",
34
39
  "outputFilename": "docs/wallet.md",
35
- "firstHeadingLevel": 2
40
+ "firstHeadingLevel": 2,
41
+ "noDetailsSummary": true
36
42
  }
37
43
  ]
38
44
  }