@bsv/sdk 1.3.15 → 1.3.18

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 +2 -1
  2. package/dist/cjs/src/script/ScriptTemplateUnlock.js +3 -0
  3. package/dist/cjs/src/script/ScriptTemplateUnlock.js.map +1 -0
  4. package/dist/cjs/src/script/index.js.map +1 -1
  5. package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js +8 -1
  6. package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
  7. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  8. package/dist/esm/src/script/ScriptTemplateUnlock.js +2 -0
  9. package/dist/esm/src/script/ScriptTemplateUnlock.js.map +1 -0
  10. package/dist/esm/src/script/index.js.map +1 -1
  11. package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js +8 -1
  12. package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
  13. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  14. package/dist/types/src/script/ScriptTemplate.d.ts +6 -10
  15. package/dist/types/src/script/ScriptTemplate.d.ts.map +1 -1
  16. package/dist/types/src/script/ScriptTemplateUnlock.d.ts +7 -0
  17. package/dist/types/src/script/ScriptTemplateUnlock.d.ts.map +1 -0
  18. package/dist/types/src/script/index.d.ts +1 -0
  19. package/dist/types/src/script/index.d.ts.map +1 -1
  20. package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts.map +1 -1
  21. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  22. package/dist/umd/bundle.js +1 -1
  23. package/docs/auth.md +0 -54
  24. package/docs/compat.md +0 -24
  25. package/docs/overlay-tools.md +0 -48
  26. package/docs/primitives.md +0 -144
  27. package/docs/script.md +17 -56
  28. package/docs/totp.md +0 -6
  29. package/docs/transaction.md +0 -78
  30. package/docs/wallet.md +0 -24
  31. package/package.json +2 -1
  32. package/src/script/ScriptTemplate.ts +6 -10
  33. package/src/script/ScriptTemplateUnlock.ts +7 -0
  34. package/src/script/index.ts +1 -0
  35. package/src/wallet/substrates/HTTPWalletJSON.ts +8 -1
@@ -36,10 +36,6 @@ export interface ArcConfig {
36
36
 
37
37
  See also: [HttpClient](./transaction.md#interface-httpclient)
38
38
 
39
- <details>
40
-
41
- <summary>Interface ArcConfig Details</summary>
42
-
43
39
  #### Property apiKey
44
40
 
45
41
  Authentication token for the ARC API
@@ -89,8 +85,6 @@ httpClient?: HttpClient
89
85
  ```
90
86
  See also: [HttpClient](./transaction.md#interface-httpclient)
91
87
 
92
- </details>
93
-
94
88
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
95
89
 
96
90
  ---
@@ -205,10 +199,6 @@ export interface FetchOptions {
205
199
  }
206
200
  ```
207
201
 
208
- <details>
209
-
210
- <summary>Interface FetchOptions Details</summary>
211
-
212
202
  #### Property body
213
203
 
214
204
  An object or null to set request's body.
@@ -233,8 +223,6 @@ A string to set request's method.
233
223
  method?: string
234
224
  ```
235
225
 
236
- </details>
237
-
238
226
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
239
227
 
240
228
  ---
@@ -250,10 +238,6 @@ export interface HttpClient {
250
238
 
251
239
  See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientrequestoptions), [HttpClientResponse](./transaction.md#type-httpclientresponse)
252
240
 
253
- <details>
254
-
255
- <summary>Interface HttpClient Details</summary>
256
-
257
241
  #### Property request
258
242
 
259
243
  Makes a request to the server.
@@ -263,8 +247,6 @@ request: <T = any, D = any>(url: string, options: HttpClientRequestOptions<D>) =
263
247
  ```
264
248
  See also: [HttpClientRequestOptions](./transaction.md#interface-httpclientrequestoptions), [HttpClientResponse](./transaction.md#type-httpclientresponse)
265
249
 
266
- </details>
267
-
268
250
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
269
251
 
270
252
  ---
@@ -280,10 +262,6 @@ export interface HttpClientRequestOptions<Data = any> {
280
262
  }
281
263
  ```
282
264
 
283
- <details>
284
-
285
- <summary>Interface HttpClientRequestOptions Details</summary>
286
-
287
265
  #### Property data
288
266
 
289
267
  An object or null to set request's body.
@@ -308,8 +286,6 @@ A string to set request's method.
308
286
  method?: string
309
287
  ```
310
288
 
311
- </details>
312
-
313
289
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
314
290
 
315
291
  ---
@@ -442,10 +418,6 @@ export interface WhatsOnChainConfig {
442
418
 
443
419
  See also: [HttpClient](./transaction.md#interface-httpclient)
444
420
 
445
- <details>
446
-
447
- <summary>Interface WhatsOnChainConfig Details</summary>
448
-
449
421
  #### Property apiKey
450
422
 
451
423
  Authentication token for the WhatsOnChain API
@@ -463,8 +435,6 @@ httpClient?: HttpClient
463
435
  ```
464
436
  See also: [HttpClient](./transaction.md#interface-httpclient)
465
437
 
466
- </details>
467
-
468
438
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
469
439
 
470
440
  ---
@@ -509,10 +479,6 @@ export default class ARC implements Broadcaster {
509
479
 
510
480
  See also: [ArcConfig](./transaction.md#interface-arcconfig), [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [Transaction](./transaction.md#class-transaction)
511
481
 
512
- <details>
513
-
514
- <summary>Class ARC Details</summary>
515
-
516
482
  #### Constructor
517
483
 
518
484
  Constructs an instance of the ARC broadcaster.
@@ -581,8 +547,6 @@ Argument Details
581
547
  + **txs**
582
548
  + Array of transactions to be broadcasted.
583
549
 
584
- </details>
585
-
586
550
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
587
551
 
588
552
  ---
@@ -633,10 +597,6 @@ export class Beef {
633
597
 
634
598
  See also: [BEEF_V2](./transaction.md#variable-beef_v2), [BeefTx](./transaction.md#class-beeftx), [ChainTracker](./transaction.md#interface-chaintracker), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
635
599
 
636
- <details>
637
-
638
- <summary>Class Beef Details</summary>
639
-
640
600
  #### Method addComputedLeaves
641
601
 
642
602
  In some circumstances it may be helpful for the BUMP MerklePaths to include
@@ -990,8 +950,6 @@ Argument Details
990
950
  + **allowTxidOnly**
991
951
  + optional. If true, transaction txid is assumed valid
992
952
 
993
- </details>
994
-
995
953
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
996
954
 
997
955
  ---
@@ -1031,10 +989,6 @@ export class BeefParty extends Beef {
1031
989
 
1032
990
  See also: [Beef](./transaction.md#class-beef)
1033
991
 
1034
- <details>
1035
-
1036
- <summary>Class BeefParty Details</summary>
1037
-
1038
992
  #### Constructor
1039
993
 
1040
994
  ```ts
@@ -1120,8 +1074,6 @@ mergeBeefFromParty(party: string, beef: number[] | Beef): void
1120
1074
  ```
1121
1075
  See also: [Beef](./transaction.md#class-beef)
1122
1076
 
1123
- </details>
1124
-
1125
1077
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1126
1078
 
1127
1079
  ---
@@ -1161,10 +1113,6 @@ export default class BeefTx {
1161
1113
 
1162
1114
  See also: [Reader](./primitives.md#class-reader), [Transaction](./transaction.md#class-transaction), [Writer](./primitives.md#class-writer)
1163
1115
 
1164
- <details>
1165
-
1166
- <summary>Class BeefTx Details</summary>
1167
-
1168
1116
  #### Constructor
1169
1117
 
1170
1118
  ```ts
@@ -1189,8 +1137,6 @@ Typically set by sorting transactions by proven dependency chains.
1189
1137
  isValid?: boolean = undefined
1190
1138
  ```
1191
1139
 
1192
- </details>
1193
-
1194
1140
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1195
1141
 
1196
1142
  ---
@@ -1255,10 +1201,6 @@ export default class MerklePath {
1255
1201
 
1256
1202
  See also: [ChainTracker](./transaction.md#interface-chaintracker), [MerklePathLeaf](./transaction.md#interface-merklepathleaf), [Reader](./primitives.md#class-reader), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
1257
1203
 
1258
- <details>
1259
-
1260
- <summary>Class MerklePath Details</summary>
1261
-
1262
1204
  #### Method combine
1263
1205
 
1264
1206
  Combines this MerklePath with another to create a compound proof.
@@ -1417,8 +1359,6 @@ Argument Details
1417
1359
  + **chainTracker**
1418
1360
  + The ChainTracker instance used to verify the Merkle root.
1419
1361
 
1420
- </details>
1421
-
1422
1362
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1423
1363
 
1424
1364
  ---
@@ -1452,10 +1392,6 @@ export default class SatoshisPerKilobyte implements FeeModel {
1452
1392
 
1453
1393
  See also: [FeeModel](./transaction.md#interface-feemodel), [Transaction](./transaction.md#class-transaction)
1454
1394
 
1455
- <details>
1456
-
1457
- <summary>Class SatoshisPerKilobyte Details</summary>
1458
-
1459
1395
  #### Constructor
1460
1396
 
1461
1397
  Constructs an instance of the sat/kb fee model.
@@ -1487,8 +1423,6 @@ Argument Details
1487
1423
  + **tx**
1488
1424
  + The transaction for which a fee is to be computed.
1489
1425
 
1490
- </details>
1491
-
1492
1426
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1493
1427
 
1494
1428
  ---
@@ -1565,10 +1499,6 @@ export default class Transaction {
1565
1499
 
1566
1500
  See also: [BroadcastFailure](./transaction.md#interface-broadcastfailure), [BroadcastResponse](./transaction.md#interface-broadcastresponse), [Broadcaster](./transaction.md#interface-broadcaster), [ChainTracker](./transaction.md#interface-chaintracker), [FeeModel](./transaction.md#interface-feemodel), [MerklePath](./transaction.md#class-merklepath), [Reader](./primitives.md#class-reader), [SatoshisPerKilobyte](./transaction.md#class-satoshisperkilobyte), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput), [defaultBroadcaster](./transaction.md#function-defaultbroadcaster), [defaultChainTracker](./transaction.md#function-defaultchaintracker), [sign](./compat.md#variable-sign), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
1567
1501
 
1568
- <details>
1569
-
1570
- <summary>Class Transaction Details</summary>
1571
-
1572
1502
  #### Method addInput
1573
1503
 
1574
1504
  Adds a new input to the transaction.
@@ -2063,8 +1993,6 @@ Example
2063
1993
  tx.verify(new WhatsOnChain(), new SatoshisPerKilobyte(1))
2064
1994
  ```
2065
1995
 
2066
- </details>
2067
-
2068
1996
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
2069
1997
 
2070
1998
  ---
@@ -2084,10 +2012,6 @@ export default class WhatsOnChain implements ChainTracker {
2084
2012
 
2085
2013
  See also: [ChainTracker](./transaction.md#interface-chaintracker), [WhatsOnChainConfig](./transaction.md#interface-whatsonchainconfig)
2086
2014
 
2087
- <details>
2088
-
2089
- <summary>Class WhatsOnChain Details</summary>
2090
-
2091
2015
  #### Constructor
2092
2016
 
2093
2017
  Constructs an instance of the WhatsOnChain ChainTracker.
@@ -2104,8 +2028,6 @@ Argument Details
2104
2028
  + **config**
2105
2029
  + Configuration options for the WhatsOnChain ChainTracker.
2106
2030
 
2107
- </details>
2108
-
2109
2031
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
2110
2032
 
2111
2033
  ---
package/docs/wallet.md CHANGED
@@ -502,10 +502,6 @@ export interface KeyDeriverApi {
502
502
 
503
503
  See also: [Counterparty](./wallet.md#type-counterparty), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey), [SymmetricKey](./primitives.md#class-symmetrickey), [WalletProtocol](./wallet.md#type-walletprotocol)
504
504
 
505
- <details>
506
-
507
- <summary>Interface KeyDeriverApi Details</summary>
508
-
509
505
  #### Property derivePrivateKey
510
506
 
511
507
  Derives a private key based on protocol ID, key ID, and counterparty.
@@ -570,8 +566,6 @@ rootKey: PrivateKey
570
566
  ```
571
567
  See also: [PrivateKey](./primitives.md#class-privatekey)
572
568
 
573
- </details>
574
-
575
569
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
576
570
 
577
571
  ---
@@ -1197,10 +1191,6 @@ export interface WalletInterface {
1197
1191
 
1198
1192
  See also: [AbortActionArgs](./wallet.md#interface-abortactionargs), [AbortActionResult](./wallet.md#interface-abortactionresult), [AcquireCertificateArgs](./wallet.md#interface-acquirecertificateargs), [AuthenticatedResult](./wallet.md#interface-authenticatedresult), [CreateActionArgs](./wallet.md#interface-createactionargs), [CreateActionResult](./wallet.md#interface-createactionresult), [CreateHmacArgs](./wallet.md#interface-createhmacargs), [CreateHmacResult](./wallet.md#interface-createhmacresult), [CreateSignatureArgs](./wallet.md#interface-createsignatureargs), [CreateSignatureResult](./wallet.md#interface-createsignatureresult), [DiscoverByAttributesArgs](./wallet.md#interface-discoverbyattributesargs), [DiscoverByIdentityKeyArgs](./wallet.md#interface-discoverbyidentitykeyargs), [DiscoverCertificatesResult](./wallet.md#interface-discovercertificatesresult), [GetHeaderArgs](./wallet.md#interface-getheaderargs), [GetHeaderResult](./wallet.md#interface-getheaderresult), [GetHeightResult](./wallet.md#interface-getheightresult), [GetNetworkResult](./wallet.md#interface-getnetworkresult), [GetPublicKeyArgs](./wallet.md#interface-getpublickeyargs), [GetPublicKeyResult](./wallet.md#interface-getpublickeyresult), [GetVersionResult](./wallet.md#interface-getversionresult), [InternalizeActionArgs](./wallet.md#interface-internalizeactionargs), [InternalizeActionResult](./wallet.md#interface-internalizeactionresult), [ListActionsArgs](./wallet.md#interface-listactionsargs), [ListActionsResult](./wallet.md#interface-listactionsresult), [ListCertificatesArgs](./wallet.md#interface-listcertificatesargs), [ListCertificatesResult](./wallet.md#interface-listcertificatesresult), [ListOutputsArgs](./wallet.md#interface-listoutputsargs), [ListOutputsResult](./wallet.md#interface-listoutputsresult), [OriginatorDomainNameStringUnder250Bytes](./wallet.md#type-originatordomainnamestringunder250bytes), [ProveCertificateArgs](./wallet.md#interface-provecertificateargs), [ProveCertificateResult](./wallet.md#interface-provecertificateresult), [RelinquishCertificateArgs](./wallet.md#interface-relinquishcertificateargs), [RelinquishCertificateResult](./wallet.md#interface-relinquishcertificateresult), [RelinquishOutputArgs](./wallet.md#interface-relinquishoutputargs), [RelinquishOutputResult](./wallet.md#interface-relinquishoutputresult), [RevealCounterpartyKeyLinkageArgs](./wallet.md#interface-revealcounterpartykeylinkageargs), [RevealCounterpartyKeyLinkageResult](./wallet.md#interface-revealcounterpartykeylinkageresult), [RevealSpecificKeyLinkageArgs](./wallet.md#interface-revealspecifickeylinkageargs), [RevealSpecificKeyLinkageResult](./wallet.md#interface-revealspecifickeylinkageresult), [SignActionArgs](./wallet.md#interface-signactionargs), [SignActionResult](./wallet.md#interface-signactionresult), [VerifyHmacArgs](./wallet.md#interface-verifyhmacargs), [VerifyHmacResult](./wallet.md#interface-verifyhmacresult), [VerifySignatureArgs](./wallet.md#interface-verifysignatureargs), [VerifySignatureResult](./wallet.md#interface-verifysignatureresult), [WalletCertificate](./wallet.md#interface-walletcertificate), [WalletDecryptArgs](./wallet.md#interface-walletdecryptargs), [WalletDecryptResult](./wallet.md#interface-walletdecryptresult), [WalletEncryptArgs](./wallet.md#interface-walletencryptargs), [WalletEncryptResult](./wallet.md#interface-walletencryptresult), [decrypt](./messages.md#variable-decrypt), [encrypt](./messages.md#variable-encrypt)
1199
1193
 
1200
- <details>
1201
-
1202
- <summary>Interface WalletInterface Details</summary>
1203
-
1204
1194
  #### Property abortAction
1205
1195
 
1206
1196
  Aborts a transaction that is in progress and has not yet been finalized or sent to the network.
@@ -1453,8 +1443,6 @@ waitForAuthentication: (args: object, originator?: OriginatorDomainNameStringUnd
1453
1443
  ```
1454
1444
  See also: [AuthenticatedResult](./wallet.md#interface-authenticatedresult), [OriginatorDomainNameStringUnder250Bytes](./wallet.md#type-originatordomainnamestringunder250bytes)
1455
1445
 
1456
- </details>
1457
-
1458
1446
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1459
1447
 
1460
1448
  ---
@@ -1546,10 +1534,6 @@ export default class CachedKeyDeriver {
1546
1534
 
1547
1535
  See also: [Counterparty](./wallet.md#type-counterparty), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey), [SymmetricKey](./primitives.md#class-symmetrickey), [WalletProtocol](./wallet.md#type-walletprotocol)
1548
1536
 
1549
- <details>
1550
-
1551
- <summary>Class CachedKeyDeriver Details</summary>
1552
-
1553
1537
  #### Constructor
1554
1538
 
1555
1539
  Initializes the CachedKeyDeriver instance with a root private key and optional cache settings.
@@ -1689,8 +1673,6 @@ Argument Details
1689
1673
  + **keyID**
1690
1674
  + The key identifier.
1691
1675
 
1692
- </details>
1693
-
1694
1676
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
1695
1677
 
1696
1678
  ---
@@ -1955,10 +1937,6 @@ export class KeyDeriver implements KeyDeriverApi {
1955
1937
 
1956
1938
  See also: [Counterparty](./wallet.md#type-counterparty), [KeyDeriverApi](./wallet.md#interface-keyderiverapi), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey), [SymmetricKey](./primitives.md#class-symmetrickey), [WalletProtocol](./wallet.md#type-walletprotocol)
1957
1939
 
1958
- <details>
1959
-
1960
- <summary>Class KeyDeriver Details</summary>
1961
-
1962
1940
  #### Constructor
1963
1941
 
1964
1942
  Initializes the KeyDeriver instance with a root private key.
@@ -2087,8 +2065,6 @@ Argument Details
2087
2065
  + **keyID**
2088
2066
  + The key identifier.
2089
2067
 
2090
- </details>
2091
-
2092
2068
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
2093
2069
 
2094
2070
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.3.15",
3
+ "version": "1.3.18",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -239,6 +239,7 @@
239
239
  "project": "tsconfig.eslint.json",
240
240
  "ignore": [
241
241
  "dist",
242
+ "src/script/ScriptTemplate.ts",
242
243
  "src/transaction/Transaction.ts",
243
244
  "src/auth/transports/SimplifiedFetchTransport.ts"
244
245
  ]
@@ -1,6 +1,5 @@
1
1
  import LockingScript from './LockingScript.js'
2
- import UnlockingScript from './UnlockingScript.js'
3
- import Transaction from '../transaction/Transaction.js'
2
+ import ScriptTemplateUnlock from './ScriptTemplateUnlock.js'
4
3
 
5
4
  /**
6
5
  * @interface
@@ -12,10 +11,10 @@ export default interface ScriptTemplate {
12
11
  /**
13
12
  * Creates a locking script with the given parameters.
14
13
  *
15
- * @param {...any} params - The parameters required to create the locking script.
14
+ * @param {...any[]} params - The parameters required to create the locking script.
16
15
  * @returns {LockingScript} - An instance of LockingScript, or a Promise for one.
17
16
  */
18
- lock: (...params: unknown[]) => LockingScript | Promise<LockingScript>
17
+ lock: (...params: any[]) => LockingScript | Promise<LockingScript>
19
18
 
20
19
  /**
21
20
  * Creates a function that generates an unlocking script along with its signature and length estimation.
@@ -24,11 +23,8 @@ export default interface ScriptTemplate {
24
23
  * 1. `sign` - A function that, when called with a transaction and an input index, returns an UnlockingScript instance.
25
24
  * 2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
26
25
  *
27
- * @param {...any} params - The parameters required to create the unlocking script.
28
- * @returns {Object} - An object containing the `sign` and `estimateLength` functions.
26
+ * @param {...any[]} params - The parameters required to create the unlocking script.
27
+ * @returns {ScriptTemplateUnlock} - An object containing the `sign` and `estimateLength` functions.
29
28
  */
30
- unlock: (...params: unknown[]) => {
31
- sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>
32
- estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>
33
- }
29
+ unlock: (...params: any[]) => ScriptTemplateUnlock
34
30
  }
@@ -0,0 +1,7 @@
1
+ import UnlockingScript from './UnlockingScript.js'
2
+ import Transaction from '../transaction/Transaction.js'
3
+
4
+ export default interface ScriptTemplateUnlock {
5
+ sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>
6
+ estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>
7
+ }
@@ -3,5 +3,6 @@ export { default as Script } from './Script.js'
3
3
  export { default as LockingScript } from './LockingScript.js'
4
4
  export { default as UnlockingScript } from './UnlockingScript.js'
5
5
  export { default as Spend } from './Spend.js'
6
+ export type { default as ScriptTemplateUnlock } from './ScriptTemplateUnlock.js'
6
7
  export type { default as ScriptTemplate } from './ScriptTemplate.js'
7
8
  export * from './templates/index.js'
@@ -64,9 +64,16 @@ export default class HTTPWalletJSON implements WalletInterface {
64
64
  body: JSON.stringify(args)
65
65
  })
66
66
  ).json()
67
+ if (!response.ok) {
68
+ const err = {
69
+ call,
70
+ args,
71
+ message: response.message || `HTTP Client error ${response.status}`
72
+ }
73
+ throw new Error(JSON.stringify(err))
74
+ }
67
75
  return response
68
76
  } catch (error) {
69
- console.log({ HTTPWalletJSON: { call, args, error } })
70
77
  throw error
71
78
  }
72
79
  }