@nockbox/iris-wasm 0.1.2 → 0.2.0-alpha.1

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.
@@ -0,0 +1,1877 @@
1
+ /*
2
+ * Generated type guards for "iris_wasm.d.ts".
3
+ * WARNING: Do not manually change this file.
4
+ */
5
+ import type { ReadableStreamType, TxNotes, PbCom1TimeLockIntent, PbCom1Input, PbCom1BlockHeightDelta, PbCom1NamedInput, PbCom1Belt, PbCom1PageResponse, PbCom1SignatureEntry, PbCom1TimeLockRangeNeither, PbCom1Base58Pubkey, PbCom1EightBelt, PbCom1BalanceEntry, PbCom1Source, PbCom1Signature, PbCom1NoteVersion, PbCom1Note, PbCom1SchnorrSignature, PbCom1TimeLockRangeRelative, PbCom1WireTag, PbCom1TimeLockRangeAbsoluteAndRelative, PbCom1Lock, PbCom1BlockHeight, PbCom1ErrorStatus, PbCom1TimeLockRangeAbsolute, PbCom1PageRequest, PbCom1WalletBalanceData, PbCom1Wire, PbCom1SixBelt, PbCom1OutputSource, PbCom1Acknowledged, PbCom1SchnorrPubkey, PbCom1Base58Hash, PbCom1CheetahPoint, PbCom1Hash, PbCom1Name, PbCom1Seed, PbCom1Nicks, PbCom1Spend, PbCom1ErrorCode, PbCom1RawTransaction, PbCom2SpendCondition, PbCom2Seed, PbCom2MerkleProof, PbCom2PkhSignatureEntry, PbCom2SpendEntry, PbCom2BalanceEntry, PbCom2LockMerkleProof, PbCom2WitnessSpend, PbCom2Spend, PbCom2NoteDataEntry, PbCom2LockTim, PbCom2HaxLock, PbCom2HaxPreimage, PbCom2BurnLock, PbCom2PkhSignature, PbCom2RawTransaction, PbCom2Note, PbCom2NoteV1, PbCom2Balance, PbCom2NoteData, PbCom2Witness, PbCom2PkhLock, PbCom2LegacySpend, PbCom2LockPrimitive, PbPub2WalletGetBalanceRequestSelector, PbCom1TimeLockIntentValue, PbCom2LockPrimitivePrimitive, PbCom2SpendSpendKind, PbCom2NoteNoteVersion, PbCom1WireTagValue, PbPub2WalletGetBalanceResponse, PbPub2TransactionAcceptedResponse, PbPub2TransactionAcceptedRequest, PbPub2WalletSendTransactionResponse, PbPub2WalletSendTransactionRequest, PbPub2WalletGetBalanceRequest, PbPub2TransactionAcceptedResponseResult, PbPub2WalletGetBalanceResponseResult, PbPub2WalletSendTransactionResponseResult, NoteData, Hax, SpendsV1, SpendCondition, Pkh, Witness, LockMetadata, Spend0V1, WitnessData, LockPrimitive, LockMerkleProof, Spend1V1, NockchainTx, LockRoot, SeedsV1, MerkleProof, PkhSignature, NoteV1, RawTxV1, SpendV1, InputDisplay, SeedV1, TransactionDisplay, MissingUnlocks, Balance, BalanceUpdate, Version, TimelockRange, Nicks, Source, Name, Note, Sig, RawTxV0, Timelock, Inputs, SeedsV0, NoteV0, SeedV0, Input, SpendV0, NoteInner, LegacySignature, TimelockIntent, RawTx, Signature, PublicKey, Noun, CheetahPoint, Digest, ZBase, ZMap, ZMapEntry, ZSet, ZSetEntry, InitInput, InitOutput, SyncInitInput, TxId, BlockHeight, LockTim } from "./iris_wasm.js";
6
+
7
+
8
+ export function isTxNotes(obj: unknown): obj is TxNotes {
9
+ const typedObj = obj as any
10
+ return (
11
+ (typedObj !== null &&
12
+ typeof typedObj === "object" ||
13
+ typeof typedObj === "function") &&
14
+ Array.isArray(typedObj["notes"]) &&
15
+ typedObj["notes"].every((e: any) =>
16
+ isNote(e) as boolean
17
+ ) &&
18
+ Array.isArray(typedObj["spend_conditions"]) &&
19
+ typedObj["spend_conditions"].every((e: any) =>
20
+ isSpendCondition(e) as boolean
21
+ )
22
+ )
23
+ }
24
+
25
+ export function isPbCom1TimeLockIntent(obj: unknown): obj is PbCom1TimeLockIntent {
26
+ const typedObj = obj as any
27
+ return (
28
+ (typedObj !== null &&
29
+ typeof typedObj === "object" ||
30
+ typeof typedObj === "function") &&
31
+ (typeof typedObj["value"] === "undefined" ||
32
+ (typedObj["value"] !== null &&
33
+ typeof typedObj["value"] === "object" ||
34
+ typeof typedObj["value"] === "function") &&
35
+ isPbCom1TimeLockRangeAbsolute(typedObj["value"]["Absolute"]) as boolean ||
36
+ (typedObj["value"] !== null &&
37
+ typeof typedObj["value"] === "object" ||
38
+ typeof typedObj["value"] === "function") &&
39
+ isPbCom1TimeLockRangeRelative(typedObj["value"]["Relative"]) as boolean ||
40
+ (typedObj["value"] !== null &&
41
+ typeof typedObj["value"] === "object" ||
42
+ typeof typedObj["value"] === "function") &&
43
+ isPbCom1TimeLockRangeAbsoluteAndRelative(typedObj["value"]["AbsoluteAndRelative"]) as boolean ||
44
+ (typedObj["value"] !== null &&
45
+ typeof typedObj["value"] === "object" ||
46
+ typeof typedObj["value"] === "function") &&
47
+ isPbCom1TimeLockRangeNeither(typedObj["value"]["Neither"]) as boolean)
48
+ )
49
+ }
50
+
51
+ export function isPbCom1Input(obj: unknown): obj is PbCom1Input {
52
+ const typedObj = obj as any
53
+ return (
54
+ (typedObj !== null &&
55
+ typeof typedObj === "object" ||
56
+ typeof typedObj === "function") &&
57
+ (typeof typedObj["note"] === "undefined" ||
58
+ isPbCom1Note(typedObj["note"]) as boolean) &&
59
+ (typeof typedObj["spend"] === "undefined" ||
60
+ isPbCom1Spend(typedObj["spend"]) as boolean)
61
+ )
62
+ }
63
+
64
+ export function isPbCom1BlockHeightDelta(obj: unknown): obj is PbCom1BlockHeightDelta {
65
+ const typedObj = obj as any
66
+ return (
67
+ (typedObj !== null &&
68
+ typeof typedObj === "object" ||
69
+ typeof typedObj === "function") &&
70
+ isNicks(typedObj["value"]) as boolean
71
+ )
72
+ }
73
+
74
+ export function isPbCom1NamedInput(obj: unknown): obj is PbCom1NamedInput {
75
+ const typedObj = obj as any
76
+ return (
77
+ (typedObj !== null &&
78
+ typeof typedObj === "object" ||
79
+ typeof typedObj === "function") &&
80
+ (typeof typedObj["name"] === "undefined" ||
81
+ isPbCom1Name(typedObj["name"]) as boolean) &&
82
+ (typeof typedObj["input"] === "undefined" ||
83
+ isPbCom1Input(typedObj["input"]) as boolean)
84
+ )
85
+ }
86
+
87
+ export function isPbCom1Belt(obj: unknown): obj is PbCom1Belt {
88
+ const typedObj = obj as any
89
+ return (
90
+ (typedObj !== null &&
91
+ typeof typedObj === "object" ||
92
+ typeof typedObj === "function") &&
93
+ isNicks(typedObj["value"]) as boolean
94
+ )
95
+ }
96
+
97
+ export function isPbCom1PageResponse(obj: unknown): obj is PbCom1PageResponse {
98
+ const typedObj = obj as any
99
+ return (
100
+ (typedObj !== null &&
101
+ typeof typedObj === "object" ||
102
+ typeof typedObj === "function") &&
103
+ isNicks(typedObj["next_page_token"]) as boolean
104
+ )
105
+ }
106
+
107
+ export function isPbCom1SignatureEntry(obj: unknown): obj is PbCom1SignatureEntry {
108
+ const typedObj = obj as any
109
+ return (
110
+ (typedObj !== null &&
111
+ typeof typedObj === "object" ||
112
+ typeof typedObj === "function") &&
113
+ (typeof typedObj["schnorr_pubkey"] === "undefined" ||
114
+ isPbCom1SchnorrPubkey(typedObj["schnorr_pubkey"]) as boolean) &&
115
+ (typeof typedObj["signature"] === "undefined" ||
116
+ isPbCom1SchnorrSignature(typedObj["signature"]) as boolean)
117
+ )
118
+ }
119
+
120
+ export function isPbCom1TimeLockRangeNeither(obj: unknown): obj is PbCom1TimeLockRangeNeither {
121
+ const typedObj = obj as any
122
+ return (
123
+ (typedObj !== null &&
124
+ typeof typedObj === "object" ||
125
+ typeof typedObj === "function")
126
+ )
127
+ }
128
+
129
+ export function isPbCom1Base58Pubkey(obj: unknown): obj is PbCom1Base58Pubkey {
130
+ const typedObj = obj as any
131
+ return (
132
+ (typedObj !== null &&
133
+ typeof typedObj === "object" ||
134
+ typeof typedObj === "function") &&
135
+ isNicks(typedObj["key"]) as boolean
136
+ )
137
+ }
138
+
139
+ export function isPbCom1EightBelt(obj: unknown): obj is PbCom1EightBelt {
140
+ const typedObj = obj as any
141
+ return (
142
+ (typedObj !== null &&
143
+ typeof typedObj === "object" ||
144
+ typeof typedObj === "function") &&
145
+ (typeof typedObj["belt_1"] === "undefined" ||
146
+ isPbCom1Belt(typedObj["belt_1"]) as boolean) &&
147
+ (typeof typedObj["belt_2"] === "undefined" ||
148
+ isPbCom1Belt(typedObj["belt_2"]) as boolean) &&
149
+ (typeof typedObj["belt_3"] === "undefined" ||
150
+ isPbCom1Belt(typedObj["belt_3"]) as boolean) &&
151
+ (typeof typedObj["belt_4"] === "undefined" ||
152
+ isPbCom1Belt(typedObj["belt_4"]) as boolean) &&
153
+ (typeof typedObj["belt_5"] === "undefined" ||
154
+ isPbCom1Belt(typedObj["belt_5"]) as boolean) &&
155
+ (typeof typedObj["belt_6"] === "undefined" ||
156
+ isPbCom1Belt(typedObj["belt_6"]) as boolean) &&
157
+ (typeof typedObj["belt_7"] === "undefined" ||
158
+ isPbCom1Belt(typedObj["belt_7"]) as boolean) &&
159
+ (typeof typedObj["belt_8"] === "undefined" ||
160
+ isPbCom1Belt(typedObj["belt_8"]) as boolean)
161
+ )
162
+ }
163
+
164
+ export function isPbCom1BalanceEntry(obj: unknown): obj is PbCom1BalanceEntry {
165
+ const typedObj = obj as any
166
+ return (
167
+ (typedObj !== null &&
168
+ typeof typedObj === "object" ||
169
+ typeof typedObj === "function") &&
170
+ (typeof typedObj["name"] === "undefined" ||
171
+ isPbCom1Name(typedObj["name"]) as boolean) &&
172
+ (typeof typedObj["note"] === "undefined" ||
173
+ isPbCom1Note(typedObj["note"]) as boolean)
174
+ )
175
+ }
176
+
177
+ export function isPbCom1Source(obj: unknown): obj is PbCom1Source {
178
+ const typedObj = obj as any
179
+ return (
180
+ (typedObj !== null &&
181
+ typeof typedObj === "object" ||
182
+ typeof typedObj === "function") &&
183
+ isNicks(typedObj["hash"]) as boolean &&
184
+ typeof typedObj["coinbase"] === "boolean"
185
+ )
186
+ }
187
+
188
+ export function isPbCom1Signature(obj: unknown): obj is PbCom1Signature {
189
+ const typedObj = obj as any
190
+ return (
191
+ (typedObj !== null &&
192
+ typeof typedObj === "object" ||
193
+ typeof typedObj === "function") &&
194
+ Array.isArray(typedObj["entries"]) &&
195
+ typedObj["entries"].every((e: any) =>
196
+ isPbCom1SignatureEntry(e) as boolean
197
+ )
198
+ )
199
+ }
200
+
201
+ export function isPbCom1NoteVersion(obj: unknown): obj is PbCom1NoteVersion {
202
+ const typedObj = obj as any
203
+ return (
204
+ (typedObj !== null &&
205
+ typeof typedObj === "object" ||
206
+ typeof typedObj === "function") &&
207
+ isNicks(typedObj["value"]) as boolean
208
+ )
209
+ }
210
+
211
+ export function isPbCom1Note(obj: unknown): obj is PbCom1Note {
212
+ const typedObj = obj as any
213
+ return (
214
+ (typedObj !== null &&
215
+ typeof typedObj === "object" ||
216
+ typeof typedObj === "function") &&
217
+ (typeof typedObj["origin_page"] === "undefined" ||
218
+ isPbCom1BlockHeight(typedObj["origin_page"]) as boolean) &&
219
+ (typeof typedObj["timelock"] === "undefined" ||
220
+ isPbCom1TimeLockIntent(typedObj["timelock"]) as boolean) &&
221
+ (typeof typedObj["name"] === "undefined" ||
222
+ isPbCom1Name(typedObj["name"]) as boolean) &&
223
+ (typeof typedObj["lock"] === "undefined" ||
224
+ isPbCom1Lock(typedObj["lock"]) as boolean) &&
225
+ (typeof typedObj["source"] === "undefined" ||
226
+ isPbCom1Source(typedObj["source"]) as boolean) &&
227
+ (typeof typedObj["assets"] === "undefined" ||
228
+ isPbCom1Nicks(typedObj["assets"]) as boolean) &&
229
+ (typeof typedObj["version"] === "undefined" ||
230
+ isPbCom1NoteVersion(typedObj["version"]) as boolean)
231
+ )
232
+ }
233
+
234
+ export function isPbCom1SchnorrSignature(obj: unknown): obj is PbCom1SchnorrSignature {
235
+ const typedObj = obj as any
236
+ return (
237
+ (typedObj !== null &&
238
+ typeof typedObj === "object" ||
239
+ typeof typedObj === "function") &&
240
+ (typeof typedObj["chal"] === "undefined" ||
241
+ isPbCom1EightBelt(typedObj["chal"]) as boolean) &&
242
+ (typeof typedObj["sig"] === "undefined" ||
243
+ isPbCom1EightBelt(typedObj["sig"]) as boolean)
244
+ )
245
+ }
246
+
247
+ export function isPbCom1TimeLockRangeRelative(obj: unknown): obj is PbCom1TimeLockRangeRelative {
248
+ const typedObj = obj as any
249
+ return (
250
+ (typedObj !== null &&
251
+ typeof typedObj === "object" ||
252
+ typeof typedObj === "function") &&
253
+ (typeof typedObj["min"] === "undefined" ||
254
+ isPbCom1BlockHeightDelta(typedObj["min"]) as boolean) &&
255
+ (typeof typedObj["max"] === "undefined" ||
256
+ isPbCom1BlockHeightDelta(typedObj["max"]) as boolean)
257
+ )
258
+ }
259
+
260
+ export function isPbCom1WireTag(obj: unknown): obj is PbCom1WireTag {
261
+ const typedObj = obj as any
262
+ return (
263
+ (typedObj !== null &&
264
+ typeof typedObj === "object" ||
265
+ typeof typedObj === "function") &&
266
+ (typeof typedObj["value"] === "undefined" ||
267
+ (typedObj["value"] !== null &&
268
+ typeof typedObj["value"] === "object" ||
269
+ typeof typedObj["value"] === "function") &&
270
+ isNicks(typedObj["value"]["Text"]) as boolean ||
271
+ (typedObj["value"] !== null &&
272
+ typeof typedObj["value"] === "object" ||
273
+ typeof typedObj["value"] === "function") &&
274
+ isBlockHeight(typedObj["value"]["Number"]) as boolean)
275
+ )
276
+ }
277
+
278
+ export function isPbCom1TimeLockRangeAbsoluteAndRelative(obj: unknown): obj is PbCom1TimeLockRangeAbsoluteAndRelative {
279
+ const typedObj = obj as any
280
+ return (
281
+ (typedObj !== null &&
282
+ typeof typedObj === "object" ||
283
+ typeof typedObj === "function") &&
284
+ (typeof typedObj["absolute"] === "undefined" ||
285
+ isPbCom1TimeLockRangeAbsolute(typedObj["absolute"]) as boolean) &&
286
+ (typeof typedObj["relative"] === "undefined" ||
287
+ isPbCom1TimeLockRangeRelative(typedObj["relative"]) as boolean)
288
+ )
289
+ }
290
+
291
+ export function isPbCom1Lock(obj: unknown): obj is PbCom1Lock {
292
+ const typedObj = obj as any
293
+ return (
294
+ (typedObj !== null &&
295
+ typeof typedObj === "object" ||
296
+ typeof typedObj === "function") &&
297
+ isBlockHeight(typedObj["keys_required"]) as boolean &&
298
+ Array.isArray(typedObj["schnorr_pubkeys"]) &&
299
+ typedObj["schnorr_pubkeys"].every((e: any) =>
300
+ isPbCom1SchnorrPubkey(e) as boolean
301
+ )
302
+ )
303
+ }
304
+
305
+ export function isPbCom1BlockHeight(obj: unknown): obj is PbCom1BlockHeight {
306
+ const typedObj = obj as any
307
+ return (
308
+ (typedObj !== null &&
309
+ typeof typedObj === "object" ||
310
+ typeof typedObj === "function") &&
311
+ isNicks(typedObj["value"]) as boolean
312
+ )
313
+ }
314
+
315
+ export function isPbCom1ErrorStatus(obj: unknown): obj is PbCom1ErrorStatus {
316
+ const typedObj = obj as any
317
+ return (
318
+ (typedObj !== null &&
319
+ typeof typedObj === "object" ||
320
+ typeof typedObj === "function") &&
321
+ isBlockHeight(typedObj["code"]) as boolean &&
322
+ isNicks(typedObj["message"]) as boolean &&
323
+ (typeof typedObj["details"] === "undefined" ||
324
+ isNicks(typedObj["details"]) as boolean)
325
+ )
326
+ }
327
+
328
+ export function isPbCom1TimeLockRangeAbsolute(obj: unknown): obj is PbCom1TimeLockRangeAbsolute {
329
+ const typedObj = obj as any
330
+ return (
331
+ (typedObj !== null &&
332
+ typeof typedObj === "object" ||
333
+ typeof typedObj === "function") &&
334
+ (typeof typedObj["min"] === "undefined" ||
335
+ isPbCom1BlockHeight(typedObj["min"]) as boolean) &&
336
+ (typeof typedObj["max"] === "undefined" ||
337
+ isPbCom1BlockHeight(typedObj["max"]) as boolean)
338
+ )
339
+ }
340
+
341
+ export function isPbCom1PageRequest(obj: unknown): obj is PbCom1PageRequest {
342
+ const typedObj = obj as any
343
+ return (
344
+ (typedObj !== null &&
345
+ typeof typedObj === "object" ||
346
+ typeof typedObj === "function") &&
347
+ isBlockHeight(typedObj["client_page_items_limit"]) as boolean &&
348
+ isNicks(typedObj["page_token"]) as boolean &&
349
+ isBlockHeight(typedObj["max_bytes"]) as boolean
350
+ )
351
+ }
352
+
353
+ export function isPbCom1WalletBalanceData(obj: unknown): obj is PbCom1WalletBalanceData {
354
+ const typedObj = obj as any
355
+ return (
356
+ (typedObj !== null &&
357
+ typeof typedObj === "object" ||
358
+ typeof typedObj === "function") &&
359
+ Array.isArray(typedObj["notes"]) &&
360
+ typedObj["notes"].every((e: any) =>
361
+ isPbCom1BalanceEntry(e) as boolean
362
+ ) &&
363
+ (typeof typedObj["height"] === "undefined" ||
364
+ isPbCom1BlockHeight(typedObj["height"]) as boolean) &&
365
+ (typeof typedObj["block_id"] === "undefined" ||
366
+ isPbCom1Hash(typedObj["block_id"]) as boolean) &&
367
+ (typeof typedObj["page"] === "undefined" ||
368
+ isPbCom1PageResponse(typedObj["page"]) as boolean)
369
+ )
370
+ }
371
+
372
+ export function isPbCom1Wire(obj: unknown): obj is PbCom1Wire {
373
+ const typedObj = obj as any
374
+ return (
375
+ (typedObj !== null &&
376
+ typeof typedObj === "object" ||
377
+ typeof typedObj === "function") &&
378
+ isNicks(typedObj["source"]) as boolean &&
379
+ isBlockHeight(typedObj["version"]) as boolean &&
380
+ Array.isArray(typedObj["tags"]) &&
381
+ typedObj["tags"].every((e: any) =>
382
+ isPbCom1WireTag(e) as boolean
383
+ )
384
+ )
385
+ }
386
+
387
+ export function isPbCom1SixBelt(obj: unknown): obj is PbCom1SixBelt {
388
+ const typedObj = obj as any
389
+ return (
390
+ (typedObj !== null &&
391
+ typeof typedObj === "object" ||
392
+ typeof typedObj === "function") &&
393
+ (typeof typedObj["belt_1"] === "undefined" ||
394
+ isPbCom1Belt(typedObj["belt_1"]) as boolean) &&
395
+ (typeof typedObj["belt_2"] === "undefined" ||
396
+ isPbCom1Belt(typedObj["belt_2"]) as boolean) &&
397
+ (typeof typedObj["belt_3"] === "undefined" ||
398
+ isPbCom1Belt(typedObj["belt_3"]) as boolean) &&
399
+ (typeof typedObj["belt_4"] === "undefined" ||
400
+ isPbCom1Belt(typedObj["belt_4"]) as boolean) &&
401
+ (typeof typedObj["belt_5"] === "undefined" ||
402
+ isPbCom1Belt(typedObj["belt_5"]) as boolean) &&
403
+ (typeof typedObj["belt_6"] === "undefined" ||
404
+ isPbCom1Belt(typedObj["belt_6"]) as boolean)
405
+ )
406
+ }
407
+
408
+ export function isPbCom1OutputSource(obj: unknown): obj is PbCom1OutputSource {
409
+ const typedObj = obj as any
410
+ return (
411
+ (typedObj !== null &&
412
+ typeof typedObj === "object" ||
413
+ typeof typedObj === "function") &&
414
+ (typeof typedObj["source"] === "undefined" ||
415
+ isPbCom1Source(typedObj["source"]) as boolean)
416
+ )
417
+ }
418
+
419
+ export function isPbCom1Acknowledged(obj: unknown): obj is PbCom1Acknowledged {
420
+ const typedObj = obj as any
421
+ return (
422
+ (typedObj !== null &&
423
+ typeof typedObj === "object" ||
424
+ typeof typedObj === "function")
425
+ )
426
+ }
427
+
428
+ export function isPbCom1SchnorrPubkey(obj: unknown): obj is PbCom1SchnorrPubkey {
429
+ const typedObj = obj as any
430
+ return (
431
+ (typedObj !== null &&
432
+ typeof typedObj === "object" ||
433
+ typeof typedObj === "function") &&
434
+ (typeof typedObj["value"] === "undefined" ||
435
+ isPbCom1CheetahPoint(typedObj["value"]) as boolean)
436
+ )
437
+ }
438
+
439
+ export function isPbCom1Base58Hash(obj: unknown): obj is PbCom1Base58Hash {
440
+ const typedObj = obj as any
441
+ return (
442
+ (typedObj !== null &&
443
+ typeof typedObj === "object" ||
444
+ typeof typedObj === "function") &&
445
+ isNicks(typedObj["hash"]) as boolean
446
+ )
447
+ }
448
+
449
+ export function isPbCom1CheetahPoint(obj: unknown): obj is PbCom1CheetahPoint {
450
+ const typedObj = obj as any
451
+ return (
452
+ (typedObj !== null &&
453
+ typeof typedObj === "object" ||
454
+ typeof typedObj === "function") &&
455
+ (typeof typedObj["x"] === "undefined" ||
456
+ isPbCom1SixBelt(typedObj["x"]) as boolean) &&
457
+ (typeof typedObj["y"] === "undefined" ||
458
+ isPbCom1SixBelt(typedObj["y"]) as boolean) &&
459
+ typeof typedObj["inf"] === "boolean"
460
+ )
461
+ }
462
+
463
+ export function isPbCom1Hash(obj: unknown): obj is PbCom1Hash {
464
+ const typedObj = obj as any
465
+ return (
466
+ (typedObj !== null &&
467
+ typeof typedObj === "object" ||
468
+ typeof typedObj === "function") &&
469
+ (typeof typedObj["belt_1"] === "undefined" ||
470
+ isPbCom1Belt(typedObj["belt_1"]) as boolean) &&
471
+ (typeof typedObj["belt_2"] === "undefined" ||
472
+ isPbCom1Belt(typedObj["belt_2"]) as boolean) &&
473
+ (typeof typedObj["belt_3"] === "undefined" ||
474
+ isPbCom1Belt(typedObj["belt_3"]) as boolean) &&
475
+ (typeof typedObj["belt_4"] === "undefined" ||
476
+ isPbCom1Belt(typedObj["belt_4"]) as boolean) &&
477
+ (typeof typedObj["belt_5"] === "undefined" ||
478
+ isPbCom1Belt(typedObj["belt_5"]) as boolean)
479
+ )
480
+ }
481
+
482
+ export function isPbCom1Name(obj: unknown): obj is PbCom1Name {
483
+ const typedObj = obj as any
484
+ return (
485
+ (typedObj !== null &&
486
+ typeof typedObj === "object" ||
487
+ typeof typedObj === "function") &&
488
+ isNicks(typedObj["first"]) as boolean &&
489
+ isNicks(typedObj["last"]) as boolean
490
+ )
491
+ }
492
+
493
+ export function isPbCom1Seed(obj: unknown): obj is PbCom1Seed {
494
+ const typedObj = obj as any
495
+ return (
496
+ (typedObj !== null &&
497
+ typeof typedObj === "object" ||
498
+ typeof typedObj === "function") &&
499
+ (typeof typedObj["output_source"] === "undefined" ||
500
+ isPbCom1OutputSource(typedObj["output_source"]) as boolean) &&
501
+ (typeof typedObj["recipient"] === "undefined" ||
502
+ isPbCom1Lock(typedObj["recipient"]) as boolean) &&
503
+ (typeof typedObj["timelock_intent"] === "undefined" ||
504
+ isPbCom1TimeLockIntent(typedObj["timelock_intent"]) as boolean) &&
505
+ (typeof typedObj["gift"] === "undefined" ||
506
+ isPbCom1Nicks(typedObj["gift"]) as boolean) &&
507
+ isNicks(typedObj["parent_hash"]) as boolean
508
+ )
509
+ }
510
+
511
+ export function isPbCom1Nicks(obj: unknown): obj is PbCom1Nicks {
512
+ const typedObj = obj as any
513
+ return (
514
+ (typedObj !== null &&
515
+ typeof typedObj === "object" ||
516
+ typeof typedObj === "function") &&
517
+ isNicks(typedObj["value"]) as boolean
518
+ )
519
+ }
520
+
521
+ export function isPbCom1Spend(obj: unknown): obj is PbCom1Spend {
522
+ const typedObj = obj as any
523
+ return (
524
+ (typedObj !== null &&
525
+ typeof typedObj === "object" ||
526
+ typeof typedObj === "function") &&
527
+ (typeof typedObj["signature"] === "undefined" ||
528
+ isPbCom1Signature(typedObj["signature"]) as boolean) &&
529
+ Array.isArray(typedObj["seeds"]) &&
530
+ typedObj["seeds"].every((e: any) =>
531
+ isPbCom1Seed(e) as boolean
532
+ ) &&
533
+ (typeof typedObj["miner_fee_nicks"] === "undefined" ||
534
+ isPbCom1Nicks(typedObj["miner_fee_nicks"]) as boolean)
535
+ )
536
+ }
537
+
538
+ export function isPbCom1ErrorCode(obj: unknown): obj is PbCom1ErrorCode {
539
+ const typedObj = obj as any
540
+ return (
541
+ (typedObj === "Unspecified" ||
542
+ typedObj === "InvalidRequest" ||
543
+ typedObj === "PeekFailed" ||
544
+ typedObj === "PeekReturnedNoData" ||
545
+ typedObj === "PokeFailed" ||
546
+ typedObj === "NackappError" ||
547
+ typedObj === "Timeout" ||
548
+ typedObj === "InternalError" ||
549
+ typedObj === "NotFound" ||
550
+ typedObj === "PermissionDenied" ||
551
+ typedObj === "InvalidWire" ||
552
+ typedObj === "KernelError")
553
+ )
554
+ }
555
+
556
+ export function isPbCom1RawTransaction(obj: unknown): obj is PbCom1RawTransaction {
557
+ const typedObj = obj as any
558
+ return (
559
+ (typedObj !== null &&
560
+ typeof typedObj === "object" ||
561
+ typeof typedObj === "function") &&
562
+ Array.isArray(typedObj["named_inputs"]) &&
563
+ typedObj["named_inputs"].every((e: any) =>
564
+ isPbCom1NamedInput(e) as boolean
565
+ ) &&
566
+ (typeof typedObj["timelock_range"] === "undefined" ||
567
+ isPbCom1TimeLockRangeAbsolute(typedObj["timelock_range"]) as boolean) &&
568
+ (typeof typedObj["total_fees"] === "undefined" ||
569
+ isPbCom1Nicks(typedObj["total_fees"]) as boolean) &&
570
+ isNicks(typedObj["id"]) as boolean
571
+ )
572
+ }
573
+
574
+ export function isPbCom2SpendCondition(obj: unknown): obj is PbCom2SpendCondition {
575
+ const typedObj = obj as any
576
+ return (
577
+ (typedObj !== null &&
578
+ typeof typedObj === "object" ||
579
+ typeof typedObj === "function") &&
580
+ Array.isArray(typedObj["primitives"]) &&
581
+ typedObj["primitives"].every((e: any) =>
582
+ isPbCom2LockPrimitive(e) as boolean
583
+ )
584
+ )
585
+ }
586
+
587
+ export function isPbCom2Seed(obj: unknown): obj is PbCom2Seed {
588
+ const typedObj = obj as any
589
+ return (
590
+ (typedObj !== null &&
591
+ typeof typedObj === "object" ||
592
+ typeof typedObj === "function") &&
593
+ (typeof typedObj["output_source"] === "undefined" ||
594
+ isPbCom1Source(typedObj["output_source"]) as boolean) &&
595
+ isNicks(typedObj["lock_root"]) as boolean &&
596
+ (typeof typedObj["note_data"] === "undefined" ||
597
+ isPbCom2NoteData(typedObj["note_data"]) as boolean) &&
598
+ (typeof typedObj["gift"] === "undefined" ||
599
+ isPbCom1Nicks(typedObj["gift"]) as boolean) &&
600
+ isNicks(typedObj["parent_hash"]) as boolean
601
+ )
602
+ }
603
+
604
+ export function isPbCom2MerkleProof(obj: unknown): obj is PbCom2MerkleProof {
605
+ const typedObj = obj as any
606
+ return (
607
+ (typedObj !== null &&
608
+ typeof typedObj === "object" ||
609
+ typeof typedObj === "function") &&
610
+ isNicks(typedObj["root"]) as boolean &&
611
+ Array.isArray(typedObj["path"]) &&
612
+ typedObj["path"].every((e: any) =>
613
+ isNicks(e) as boolean
614
+ )
615
+ )
616
+ }
617
+
618
+ export function isPbCom2PkhSignatureEntry(obj: unknown): obj is PbCom2PkhSignatureEntry {
619
+ const typedObj = obj as any
620
+ return (
621
+ (typedObj !== null &&
622
+ typeof typedObj === "object" ||
623
+ typeof typedObj === "function") &&
624
+ isNicks(typedObj["hash"]) as boolean &&
625
+ (typeof typedObj["pubkey"] === "undefined" ||
626
+ isPbCom1SchnorrPubkey(typedObj["pubkey"]) as boolean) &&
627
+ (typeof typedObj["signature"] === "undefined" ||
628
+ isPbCom1SchnorrSignature(typedObj["signature"]) as boolean)
629
+ )
630
+ }
631
+
632
+ export function isPbCom2SpendEntry(obj: unknown): obj is PbCom2SpendEntry {
633
+ const typedObj = obj as any
634
+ return (
635
+ (typedObj !== null &&
636
+ typeof typedObj === "object" ||
637
+ typeof typedObj === "function") &&
638
+ (typeof typedObj["name"] === "undefined" ||
639
+ isPbCom1Name(typedObj["name"]) as boolean) &&
640
+ (typeof typedObj["spend"] === "undefined" ||
641
+ isPbCom2Spend(typedObj["spend"]) as boolean)
642
+ )
643
+ }
644
+
645
+ export function isPbCom2BalanceEntry(obj: unknown): obj is PbCom2BalanceEntry {
646
+ const typedObj = obj as any
647
+ return (
648
+ (typedObj !== null &&
649
+ typeof typedObj === "object" ||
650
+ typeof typedObj === "function") &&
651
+ (typeof typedObj["name"] === "undefined" ||
652
+ isPbCom1Name(typedObj["name"]) as boolean) &&
653
+ (typeof typedObj["note"] === "undefined" ||
654
+ isPbCom2Note(typedObj["note"]) as boolean)
655
+ )
656
+ }
657
+
658
+ export function isPbCom2LockMerkleProof(obj: unknown): obj is PbCom2LockMerkleProof {
659
+ const typedObj = obj as any
660
+ return (
661
+ (typedObj !== null &&
662
+ typeof typedObj === "object" ||
663
+ typeof typedObj === "function") &&
664
+ (typeof typedObj["spend_condition"] === "undefined" ||
665
+ isPbCom2SpendCondition(typedObj["spend_condition"]) as boolean) &&
666
+ isBlockHeight(typedObj["axis"]) as boolean &&
667
+ (typeof typedObj["proof"] === "undefined" ||
668
+ isPbCom2MerkleProof(typedObj["proof"]) as boolean)
669
+ )
670
+ }
671
+
672
+ export function isPbCom2WitnessSpend(obj: unknown): obj is PbCom2WitnessSpend {
673
+ const typedObj = obj as any
674
+ return (
675
+ (typedObj !== null &&
676
+ typeof typedObj === "object" ||
677
+ typeof typedObj === "function") &&
678
+ (typeof typedObj["witness"] === "undefined" ||
679
+ isPbCom2Witness(typedObj["witness"]) as boolean) &&
680
+ Array.isArray(typedObj["seeds"]) &&
681
+ typedObj["seeds"].every((e: any) =>
682
+ isPbCom2Seed(e) as boolean
683
+ ) &&
684
+ (typeof typedObj["fee"] === "undefined" ||
685
+ isPbCom1Nicks(typedObj["fee"]) as boolean)
686
+ )
687
+ }
688
+
689
+ export function isPbCom2Spend(obj: unknown): obj is PbCom2Spend {
690
+ const typedObj = obj as any
691
+ return (
692
+ (typedObj !== null &&
693
+ typeof typedObj === "object" ||
694
+ typeof typedObj === "function") &&
695
+ (typeof typedObj["spend_kind"] === "undefined" ||
696
+ (typedObj["spend_kind"] !== null &&
697
+ typeof typedObj["spend_kind"] === "object" ||
698
+ typeof typedObj["spend_kind"] === "function") &&
699
+ isPbCom2LegacySpend(typedObj["spend_kind"]["Legacy"]) as boolean ||
700
+ (typedObj["spend_kind"] !== null &&
701
+ typeof typedObj["spend_kind"] === "object" ||
702
+ typeof typedObj["spend_kind"] === "function") &&
703
+ isPbCom2WitnessSpend(typedObj["spend_kind"]["Witness"]) as boolean)
704
+ )
705
+ }
706
+
707
+ export function isPbCom2NoteDataEntry(obj: unknown): obj is PbCom2NoteDataEntry {
708
+ const typedObj = obj as any
709
+ return (
710
+ (typedObj !== null &&
711
+ typeof typedObj === "object" ||
712
+ typeof typedObj === "function") &&
713
+ isNicks(typedObj["key"]) as boolean &&
714
+ Array.isArray(typedObj["blob"]) &&
715
+ typedObj["blob"].every((e: any) =>
716
+ isBlockHeight(e) as boolean
717
+ )
718
+ )
719
+ }
720
+
721
+ export function isPbCom2LockTim(obj: unknown): obj is PbCom2LockTim {
722
+ const typedObj = obj as any
723
+ return (
724
+ (typedObj !== null &&
725
+ typeof typedObj === "object" ||
726
+ typeof typedObj === "function") &&
727
+ (typeof typedObj["rel"] === "undefined" ||
728
+ isPbCom1TimeLockRangeRelative(typedObj["rel"]) as boolean) &&
729
+ (typeof typedObj["abs"] === "undefined" ||
730
+ isPbCom1TimeLockRangeAbsolute(typedObj["abs"]) as boolean)
731
+ )
732
+ }
733
+
734
+ export function isPbCom2HaxLock(obj: unknown): obj is PbCom2HaxLock {
735
+ const typedObj = obj as any
736
+ return (
737
+ (typedObj !== null &&
738
+ typeof typedObj === "object" ||
739
+ typeof typedObj === "function") &&
740
+ Array.isArray(typedObj["hashes"]) &&
741
+ typedObj["hashes"].every((e: any) =>
742
+ isPbCom1Hash(e) as boolean
743
+ )
744
+ )
745
+ }
746
+
747
+ export function isPbCom2HaxPreimage(obj: unknown): obj is PbCom2HaxPreimage {
748
+ const typedObj = obj as any
749
+ return (
750
+ (typedObj !== null &&
751
+ typeof typedObj === "object" ||
752
+ typeof typedObj === "function") &&
753
+ (typeof typedObj["hash"] === "undefined" ||
754
+ isPbCom1Hash(typedObj["hash"]) as boolean) &&
755
+ Array.isArray(typedObj["value"]) &&
756
+ typedObj["value"].every((e: any) =>
757
+ isBlockHeight(e) as boolean
758
+ )
759
+ )
760
+ }
761
+
762
+ export function isPbCom2BurnLock(obj: unknown): obj is PbCom2BurnLock {
763
+ const typedObj = obj as any
764
+ return (
765
+ (typedObj !== null &&
766
+ typeof typedObj === "object" ||
767
+ typeof typedObj === "function")
768
+ )
769
+ }
770
+
771
+ export function isPbCom2PkhSignature(obj: unknown): obj is PbCom2PkhSignature {
772
+ const typedObj = obj as any
773
+ return (
774
+ (typedObj !== null &&
775
+ typeof typedObj === "object" ||
776
+ typeof typedObj === "function") &&
777
+ Array.isArray(typedObj["entries"]) &&
778
+ typedObj["entries"].every((e: any) =>
779
+ isPbCom2PkhSignatureEntry(e) as boolean
780
+ )
781
+ )
782
+ }
783
+
784
+ export function isPbCom2RawTransaction(obj: unknown): obj is PbCom2RawTransaction {
785
+ const typedObj = obj as any
786
+ return (
787
+ (typedObj !== null &&
788
+ typeof typedObj === "object" ||
789
+ typeof typedObj === "function") &&
790
+ (typeof typedObj["version"] === "undefined" ||
791
+ isPbCom1NoteVersion(typedObj["version"]) as boolean) &&
792
+ isNicks(typedObj["id"]) as boolean &&
793
+ Array.isArray(typedObj["spends"]) &&
794
+ typedObj["spends"].every((e: any) =>
795
+ isPbCom2SpendEntry(e) as boolean
796
+ )
797
+ )
798
+ }
799
+
800
+ export function isPbCom2Note(obj: unknown): obj is PbCom2Note {
801
+ const typedObj = obj as any
802
+ return (
803
+ (typedObj !== null &&
804
+ typeof typedObj === "object" ||
805
+ typeof typedObj === "function") &&
806
+ (typeof typedObj["note_version"] === "undefined" ||
807
+ (typedObj["note_version"] !== null &&
808
+ typeof typedObj["note_version"] === "object" ||
809
+ typeof typedObj["note_version"] === "function") &&
810
+ isPbCom1Note(typedObj["note_version"]["Legacy"]) as boolean ||
811
+ (typedObj["note_version"] !== null &&
812
+ typeof typedObj["note_version"] === "object" ||
813
+ typeof typedObj["note_version"] === "function") &&
814
+ isPbCom2NoteV1(typedObj["note_version"]["V1"]) as boolean)
815
+ )
816
+ }
817
+
818
+ export function isPbCom2NoteV1(obj: unknown): obj is PbCom2NoteV1 {
819
+ const typedObj = obj as any
820
+ return (
821
+ (typedObj !== null &&
822
+ typeof typedObj === "object" ||
823
+ typeof typedObj === "function") &&
824
+ (typeof typedObj["version"] === "undefined" ||
825
+ isPbCom1NoteVersion(typedObj["version"]) as boolean) &&
826
+ (typeof typedObj["origin_page"] === "undefined" ||
827
+ isPbCom1BlockHeight(typedObj["origin_page"]) as boolean) &&
828
+ (typeof typedObj["name"] === "undefined" ||
829
+ isPbCom1Name(typedObj["name"]) as boolean) &&
830
+ (typeof typedObj["note_data"] === "undefined" ||
831
+ isPbCom2NoteData(typedObj["note_data"]) as boolean) &&
832
+ (typeof typedObj["assets"] === "undefined" ||
833
+ isPbCom1Nicks(typedObj["assets"]) as boolean)
834
+ )
835
+ }
836
+
837
+ export function isPbCom2Balance(obj: unknown): obj is PbCom2Balance {
838
+ const typedObj = obj as any
839
+ return (
840
+ (typedObj !== null &&
841
+ typeof typedObj === "object" ||
842
+ typeof typedObj === "function") &&
843
+ Array.isArray(typedObj["notes"]) &&
844
+ typedObj["notes"].every((e: any) =>
845
+ isPbCom2BalanceEntry(e) as boolean
846
+ ) &&
847
+ (typeof typedObj["height"] === "undefined" ||
848
+ isPbCom1BlockHeight(typedObj["height"]) as boolean) &&
849
+ isNicks(typedObj["block_id"]) as boolean &&
850
+ (typeof typedObj["page"] === "undefined" ||
851
+ isPbCom1PageResponse(typedObj["page"]) as boolean)
852
+ )
853
+ }
854
+
855
+ export function isPbCom2NoteData(obj: unknown): obj is PbCom2NoteData {
856
+ const typedObj = obj as any
857
+ return (
858
+ (typedObj !== null &&
859
+ typeof typedObj === "object" ||
860
+ typeof typedObj === "function") &&
861
+ Array.isArray(typedObj["entries"]) &&
862
+ typedObj["entries"].every((e: any) =>
863
+ isPbCom2NoteDataEntry(e) as boolean
864
+ )
865
+ )
866
+ }
867
+
868
+ export function isPbCom2Witness(obj: unknown): obj is PbCom2Witness {
869
+ const typedObj = obj as any
870
+ return (
871
+ (typedObj !== null &&
872
+ typeof typedObj === "object" ||
873
+ typeof typedObj === "function") &&
874
+ (typeof typedObj["lock_merkle_proof"] === "undefined" ||
875
+ isPbCom2LockMerkleProof(typedObj["lock_merkle_proof"]) as boolean) &&
876
+ (typeof typedObj["pkh_signature"] === "undefined" ||
877
+ isPbCom2PkhSignature(typedObj["pkh_signature"]) as boolean) &&
878
+ Array.isArray(typedObj["hax"]) &&
879
+ typedObj["hax"].every((e: any) =>
880
+ isPbCom2HaxPreimage(e) as boolean
881
+ )
882
+ )
883
+ }
884
+
885
+ export function isPbCom2PkhLock(obj: unknown): obj is PbCom2PkhLock {
886
+ const typedObj = obj as any
887
+ return (
888
+ (typedObj !== null &&
889
+ typeof typedObj === "object" ||
890
+ typeof typedObj === "function") &&
891
+ isBlockHeight(typedObj["m"]) as boolean &&
892
+ Array.isArray(typedObj["hashes"]) &&
893
+ typedObj["hashes"].every((e: any) =>
894
+ isNicks(e) as boolean
895
+ )
896
+ )
897
+ }
898
+
899
+ export function isPbCom2LegacySpend(obj: unknown): obj is PbCom2LegacySpend {
900
+ const typedObj = obj as any
901
+ return (
902
+ (typedObj !== null &&
903
+ typeof typedObj === "object" ||
904
+ typeof typedObj === "function") &&
905
+ (typeof typedObj["signature"] === "undefined" ||
906
+ isPbCom1Signature(typedObj["signature"]) as boolean) &&
907
+ Array.isArray(typedObj["seeds"]) &&
908
+ typedObj["seeds"].every((e: any) =>
909
+ isPbCom2Seed(e) as boolean
910
+ ) &&
911
+ (typeof typedObj["fee"] === "undefined" ||
912
+ isPbCom1Nicks(typedObj["fee"]) as boolean)
913
+ )
914
+ }
915
+
916
+ export function isPbCom2LockPrimitive(obj: unknown): obj is PbCom2LockPrimitive {
917
+ const typedObj = obj as any
918
+ return (
919
+ (typedObj !== null &&
920
+ typeof typedObj === "object" ||
921
+ typeof typedObj === "function") &&
922
+ (typeof typedObj["primitive"] === "undefined" ||
923
+ (typedObj["primitive"] !== null &&
924
+ typeof typedObj["primitive"] === "object" ||
925
+ typeof typedObj["primitive"] === "function") &&
926
+ isPbCom2PkhLock(typedObj["primitive"]["Pkh"]) as boolean ||
927
+ (typedObj["primitive"] !== null &&
928
+ typeof typedObj["primitive"] === "object" ||
929
+ typeof typedObj["primitive"] === "function") &&
930
+ isPbCom2LockTim(typedObj["primitive"]["Tim"]) as boolean ||
931
+ (typedObj["primitive"] !== null &&
932
+ typeof typedObj["primitive"] === "object" ||
933
+ typeof typedObj["primitive"] === "function") &&
934
+ isPbCom2HaxLock(typedObj["primitive"]["Hax"]) as boolean ||
935
+ (typedObj["primitive"] !== null &&
936
+ typeof typedObj["primitive"] === "object" ||
937
+ typeof typedObj["primitive"] === "function") &&
938
+ isPbCom2BurnLock(typedObj["primitive"]["Burn"]) as boolean)
939
+ )
940
+ }
941
+
942
+ export function isPbPub2WalletGetBalanceRequestSelector(obj: unknown): obj is PbPub2WalletGetBalanceRequestSelector {
943
+ const typedObj = obj as any
944
+ return (
945
+ ((typedObj !== null &&
946
+ typeof typedObj === "object" ||
947
+ typeof typedObj === "function") &&
948
+ isPbCom1Base58Pubkey(typedObj["Address"]) as boolean ||
949
+ (typedObj !== null &&
950
+ typeof typedObj === "object" ||
951
+ typeof typedObj === "function") &&
952
+ isPbCom1Base58Hash(typedObj["FirstName"]) as boolean)
953
+ )
954
+ }
955
+
956
+ export function isPbCom1TimeLockIntentValue(obj: unknown): obj is PbCom1TimeLockIntentValue {
957
+ const typedObj = obj as any
958
+ return (
959
+ ((typedObj !== null &&
960
+ typeof typedObj === "object" ||
961
+ typeof typedObj === "function") &&
962
+ isPbCom1TimeLockRangeAbsolute(typedObj["Absolute"]) as boolean ||
963
+ (typedObj !== null &&
964
+ typeof typedObj === "object" ||
965
+ typeof typedObj === "function") &&
966
+ isPbCom1TimeLockRangeRelative(typedObj["Relative"]) as boolean ||
967
+ (typedObj !== null &&
968
+ typeof typedObj === "object" ||
969
+ typeof typedObj === "function") &&
970
+ isPbCom1TimeLockRangeAbsoluteAndRelative(typedObj["AbsoluteAndRelative"]) as boolean ||
971
+ (typedObj !== null &&
972
+ typeof typedObj === "object" ||
973
+ typeof typedObj === "function") &&
974
+ isPbCom1TimeLockRangeNeither(typedObj["Neither"]) as boolean)
975
+ )
976
+ }
977
+
978
+ export function isPbCom2LockPrimitivePrimitive(obj: unknown): obj is PbCom2LockPrimitivePrimitive {
979
+ const typedObj = obj as any
980
+ return (
981
+ ((typedObj !== null &&
982
+ typeof typedObj === "object" ||
983
+ typeof typedObj === "function") &&
984
+ isPbCom2PkhLock(typedObj["Pkh"]) as boolean ||
985
+ (typedObj !== null &&
986
+ typeof typedObj === "object" ||
987
+ typeof typedObj === "function") &&
988
+ isPbCom2LockTim(typedObj["Tim"]) as boolean ||
989
+ (typedObj !== null &&
990
+ typeof typedObj === "object" ||
991
+ typeof typedObj === "function") &&
992
+ isPbCom2HaxLock(typedObj["Hax"]) as boolean ||
993
+ (typedObj !== null &&
994
+ typeof typedObj === "object" ||
995
+ typeof typedObj === "function") &&
996
+ isPbCom2BurnLock(typedObj["Burn"]) as boolean)
997
+ )
998
+ }
999
+
1000
+ export function isPbCom2SpendSpendKind(obj: unknown): obj is PbCom2SpendSpendKind {
1001
+ const typedObj = obj as any
1002
+ return (
1003
+ ((typedObj !== null &&
1004
+ typeof typedObj === "object" ||
1005
+ typeof typedObj === "function") &&
1006
+ isPbCom2LegacySpend(typedObj["Legacy"]) as boolean ||
1007
+ (typedObj !== null &&
1008
+ typeof typedObj === "object" ||
1009
+ typeof typedObj === "function") &&
1010
+ isPbCom2WitnessSpend(typedObj["Witness"]) as boolean)
1011
+ )
1012
+ }
1013
+
1014
+ export function isPbCom2NoteNoteVersion(obj: unknown): obj is PbCom2NoteNoteVersion {
1015
+ const typedObj = obj as any
1016
+ return (
1017
+ ((typedObj !== null &&
1018
+ typeof typedObj === "object" ||
1019
+ typeof typedObj === "function") &&
1020
+ isPbCom1Note(typedObj["Legacy"]) as boolean ||
1021
+ (typedObj !== null &&
1022
+ typeof typedObj === "object" ||
1023
+ typeof typedObj === "function") &&
1024
+ isPbCom2NoteV1(typedObj["V1"]) as boolean)
1025
+ )
1026
+ }
1027
+
1028
+ export function isPbCom1WireTagValue(obj: unknown): obj is PbCom1WireTagValue {
1029
+ const typedObj = obj as any
1030
+ return (
1031
+ ((typedObj !== null &&
1032
+ typeof typedObj === "object" ||
1033
+ typeof typedObj === "function") &&
1034
+ isNicks(typedObj["Text"]) as boolean ||
1035
+ (typedObj !== null &&
1036
+ typeof typedObj === "object" ||
1037
+ typeof typedObj === "function") &&
1038
+ isBlockHeight(typedObj["Number"]) as boolean)
1039
+ )
1040
+ }
1041
+
1042
+ export function isPbPub2WalletGetBalanceResponse(obj: unknown): obj is PbPub2WalletGetBalanceResponse {
1043
+ const typedObj = obj as any
1044
+ return (
1045
+ (typedObj !== null &&
1046
+ typeof typedObj === "object" ||
1047
+ typeof typedObj === "function") &&
1048
+ (typeof typedObj["result"] === "undefined" ||
1049
+ (typedObj["result"] !== null &&
1050
+ typeof typedObj["result"] === "object" ||
1051
+ typeof typedObj["result"] === "function") &&
1052
+ isPbCom2Balance(typedObj["result"]["Balance"]) as boolean ||
1053
+ (typedObj["result"] !== null &&
1054
+ typeof typedObj["result"] === "object" ||
1055
+ typeof typedObj["result"] === "function") &&
1056
+ isPbCom1ErrorStatus(typedObj["result"]["Error"]) as boolean)
1057
+ )
1058
+ }
1059
+
1060
+ export function isPbPub2TransactionAcceptedResponse(obj: unknown): obj is PbPub2TransactionAcceptedResponse {
1061
+ const typedObj = obj as any
1062
+ return (
1063
+ (typedObj !== null &&
1064
+ typeof typedObj === "object" ||
1065
+ typeof typedObj === "function") &&
1066
+ (typeof typedObj["result"] === "undefined" ||
1067
+ (typedObj["result"] !== null &&
1068
+ typeof typedObj["result"] === "object" ||
1069
+ typeof typedObj["result"] === "function") &&
1070
+ typeof typedObj["result"]["Accepted"] === "boolean" ||
1071
+ (typedObj["result"] !== null &&
1072
+ typeof typedObj["result"] === "object" ||
1073
+ typeof typedObj["result"] === "function") &&
1074
+ isPbCom1ErrorStatus(typedObj["result"]["Error"]) as boolean)
1075
+ )
1076
+ }
1077
+
1078
+ export function isPbPub2TransactionAcceptedRequest(obj: unknown): obj is PbPub2TransactionAcceptedRequest {
1079
+ const typedObj = obj as any
1080
+ return (
1081
+ (typedObj !== null &&
1082
+ typeof typedObj === "object" ||
1083
+ typeof typedObj === "function") &&
1084
+ (typeof typedObj["tx_id"] === "undefined" ||
1085
+ isPbCom1Base58Hash(typedObj["tx_id"]) as boolean)
1086
+ )
1087
+ }
1088
+
1089
+ export function isPbPub2WalletSendTransactionResponse(obj: unknown): obj is PbPub2WalletSendTransactionResponse {
1090
+ const typedObj = obj as any
1091
+ return (
1092
+ (typedObj !== null &&
1093
+ typeof typedObj === "object" ||
1094
+ typeof typedObj === "function") &&
1095
+ (typeof typedObj["result"] === "undefined" ||
1096
+ (typedObj["result"] !== null &&
1097
+ typeof typedObj["result"] === "object" ||
1098
+ typeof typedObj["result"] === "function") &&
1099
+ isPbCom1Acknowledged(typedObj["result"]["Ack"]) as boolean ||
1100
+ (typedObj["result"] !== null &&
1101
+ typeof typedObj["result"] === "object" ||
1102
+ typeof typedObj["result"] === "function") &&
1103
+ isPbCom1ErrorStatus(typedObj["result"]["Error"]) as boolean)
1104
+ )
1105
+ }
1106
+
1107
+ export function isPbPub2WalletSendTransactionRequest(obj: unknown): obj is PbPub2WalletSendTransactionRequest {
1108
+ const typedObj = obj as any
1109
+ return (
1110
+ (typedObj !== null &&
1111
+ typeof typedObj === "object" ||
1112
+ typeof typedObj === "function") &&
1113
+ (typeof typedObj["tx_id"] === "undefined" ||
1114
+ isPbCom1Hash(typedObj["tx_id"]) as boolean) &&
1115
+ (typeof typedObj["raw_tx"] === "undefined" ||
1116
+ isPbCom2RawTransaction(typedObj["raw_tx"]) as boolean)
1117
+ )
1118
+ }
1119
+
1120
+ export function isPbPub2WalletGetBalanceRequest(obj: unknown): obj is PbPub2WalletGetBalanceRequest {
1121
+ const typedObj = obj as any
1122
+ return (
1123
+ (typedObj !== null &&
1124
+ typeof typedObj === "object" ||
1125
+ typeof typedObj === "function") &&
1126
+ (typeof typedObj["page"] === "undefined" ||
1127
+ isPbCom1PageRequest(typedObj["page"]) as boolean) &&
1128
+ (typeof typedObj["selector"] === "undefined" ||
1129
+ (typedObj["selector"] !== null &&
1130
+ typeof typedObj["selector"] === "object" ||
1131
+ typeof typedObj["selector"] === "function") &&
1132
+ isPbCom1Base58Pubkey(typedObj["selector"]["Address"]) as boolean ||
1133
+ (typedObj["selector"] !== null &&
1134
+ typeof typedObj["selector"] === "object" ||
1135
+ typeof typedObj["selector"] === "function") &&
1136
+ isPbCom1Base58Hash(typedObj["selector"]["FirstName"]) as boolean)
1137
+ )
1138
+ }
1139
+
1140
+ export function isPbPub2TransactionAcceptedResponseResult(obj: unknown): obj is PbPub2TransactionAcceptedResponseResult {
1141
+ const typedObj = obj as any
1142
+ return (
1143
+ ((typedObj !== null &&
1144
+ typeof typedObj === "object" ||
1145
+ typeof typedObj === "function") &&
1146
+ typeof typedObj["Accepted"] === "boolean" ||
1147
+ (typedObj !== null &&
1148
+ typeof typedObj === "object" ||
1149
+ typeof typedObj === "function") &&
1150
+ isPbCom1ErrorStatus(typedObj["Error"]) as boolean)
1151
+ )
1152
+ }
1153
+
1154
+ export function isPbPub2WalletGetBalanceResponseResult(obj: unknown): obj is PbPub2WalletGetBalanceResponseResult {
1155
+ const typedObj = obj as any
1156
+ return (
1157
+ ((typedObj !== null &&
1158
+ typeof typedObj === "object" ||
1159
+ typeof typedObj === "function") &&
1160
+ isPbCom2Balance(typedObj["Balance"]) as boolean ||
1161
+ (typedObj !== null &&
1162
+ typeof typedObj === "object" ||
1163
+ typeof typedObj === "function") &&
1164
+ isPbCom1ErrorStatus(typedObj["Error"]) as boolean)
1165
+ )
1166
+ }
1167
+
1168
+ export function isPbPub2WalletSendTransactionResponseResult(obj: unknown): obj is PbPub2WalletSendTransactionResponseResult {
1169
+ const typedObj = obj as any
1170
+ return (
1171
+ ((typedObj !== null &&
1172
+ typeof typedObj === "object" ||
1173
+ typeof typedObj === "function") &&
1174
+ isPbCom1Acknowledged(typedObj["Ack"]) as boolean ||
1175
+ (typedObj !== null &&
1176
+ typeof typedObj === "object" ||
1177
+ typeof typedObj === "function") &&
1178
+ isPbCom1ErrorStatus(typedObj["Error"]) as boolean)
1179
+ )
1180
+ }
1181
+
1182
+ export function isNoteData(obj: unknown): obj is NoteData {
1183
+ const typedObj = obj as any
1184
+ return (
1185
+ Array.isArray(typedObj) &&
1186
+ typedObj.every((e: any) =>
1187
+ Array.isArray(e) &&
1188
+ isNicks(e[0]) as boolean &&
1189
+ isNoun(e[1]) as boolean
1190
+ )
1191
+ )
1192
+ }
1193
+
1194
+ export function isHax(obj: unknown): obj is Hax {
1195
+ const typedObj = obj as any
1196
+ return (
1197
+ Array.isArray(typedObj) &&
1198
+ typedObj.every((e: any) =>
1199
+ isNicks(e) as boolean
1200
+ )
1201
+ )
1202
+ }
1203
+
1204
+ export function isSpendsV1(obj: unknown): obj is SpendsV1 {
1205
+ const typedObj = obj as any
1206
+ return (
1207
+ Array.isArray(typedObj) &&
1208
+ typedObj.every((e: any) =>
1209
+ Array.isArray(e) &&
1210
+ isName(e[0]) as boolean &&
1211
+ isSpendV1(e[1]) as boolean
1212
+ )
1213
+ )
1214
+ }
1215
+
1216
+ export function isSpendCondition(obj: unknown): obj is SpendCondition {
1217
+ const typedObj = obj as any
1218
+ return (
1219
+ Array.isArray(typedObj) &&
1220
+ typedObj.every((e: any) =>
1221
+ isLockPrimitive(e) as boolean
1222
+ )
1223
+ )
1224
+ }
1225
+
1226
+ export function isPkh(obj: unknown): obj is Pkh {
1227
+ const typedObj = obj as any
1228
+ return (
1229
+ (typedObj !== null &&
1230
+ typeof typedObj === "object" ||
1231
+ typeof typedObj === "function") &&
1232
+ isBlockHeight(typedObj["m"]) as boolean &&
1233
+ Array.isArray(typedObj["hashes"]) &&
1234
+ typedObj["hashes"].every((e: any) =>
1235
+ isNicks(e) as boolean
1236
+ )
1237
+ )
1238
+ }
1239
+
1240
+ export function isWitness(obj: unknown): obj is Witness {
1241
+ const typedObj = obj as any
1242
+ return (
1243
+ (typedObj !== null &&
1244
+ typeof typedObj === "object" ||
1245
+ typeof typedObj === "function") &&
1246
+ isLockMerkleProof(typedObj["lock_merkle_proof"]) as boolean &&
1247
+ isPkhSignature(typedObj["pkh_signature"]) as boolean &&
1248
+ Array.isArray(typedObj["hax_map"]) &&
1249
+ typedObj["hax_map"].every((e: any) =>
1250
+ Array.isArray(e) &&
1251
+ isNicks(e[0]) as boolean &&
1252
+ isNoun(e[1]) as boolean
1253
+ ) &&
1254
+ typeof typedObj["tim"] === "undefined"
1255
+ )
1256
+ }
1257
+
1258
+ export function isLockMetadata(obj: unknown): obj is LockMetadata {
1259
+ const typedObj = obj as any
1260
+ return (
1261
+ (typedObj !== null &&
1262
+ typeof typedObj === "object" ||
1263
+ typeof typedObj === "function") &&
1264
+ isSpendCondition(typedObj["lock"]) as boolean &&
1265
+ typeof typedObj["include_data"] === "boolean"
1266
+ )
1267
+ }
1268
+
1269
+ export function isSpend0V1(obj: unknown): obj is Spend0V1 {
1270
+ const typedObj = obj as any
1271
+ return (
1272
+ (typedObj !== null &&
1273
+ typeof typedObj === "object" ||
1274
+ typeof typedObj === "function") &&
1275
+ isLegacySignature(typedObj["signature"]) as boolean &&
1276
+ isSeedsV1(typedObj["seeds"]) as boolean &&
1277
+ isNicks(typedObj["fee"]) as boolean
1278
+ )
1279
+ }
1280
+
1281
+ export function isWitnessData(obj: unknown): obj is WitnessData {
1282
+ const typedObj = obj as any
1283
+ return (
1284
+ (typedObj !== null &&
1285
+ typeof typedObj === "object" ||
1286
+ typeof typedObj === "function") &&
1287
+ Array.isArray(typedObj["data"]) &&
1288
+ typedObj["data"].every((e: any) =>
1289
+ Array.isArray(e) &&
1290
+ isName(e[0]) as boolean &&
1291
+ isWitness(e[1]) as boolean
1292
+ )
1293
+ )
1294
+ }
1295
+
1296
+ export function isLockPrimitive(obj: unknown): obj is LockPrimitive {
1297
+ const typedObj = obj as any
1298
+ return (
1299
+ ((typedObj !== null &&
1300
+ typeof typedObj === "object" ||
1301
+ typeof typedObj === "function") &&
1302
+ isPkh(typedObj["Pkh"]) as boolean ||
1303
+ (typedObj !== null &&
1304
+ typeof typedObj === "object" ||
1305
+ typeof typedObj === "function") &&
1306
+ isTimelock(typedObj["Tim"]) as boolean ||
1307
+ (typedObj !== null &&
1308
+ typeof typedObj === "object" ||
1309
+ typeof typedObj === "function") &&
1310
+ isHax(typedObj["Hax"]) as boolean ||
1311
+ typedObj === "Brn")
1312
+ )
1313
+ }
1314
+
1315
+ export function isLockMerkleProof(obj: unknown): obj is LockMerkleProof {
1316
+ const typedObj = obj as any
1317
+ return (
1318
+ (typedObj !== null &&
1319
+ typeof typedObj === "object" ||
1320
+ typeof typedObj === "function") &&
1321
+ isSpendCondition(typedObj["spend_condition"]) as boolean &&
1322
+ isBlockHeight(typedObj["axis"]) as boolean &&
1323
+ isMerkleProof(typedObj["proof"]) as boolean
1324
+ )
1325
+ }
1326
+
1327
+ export function isSpend1V1(obj: unknown): obj is Spend1V1 {
1328
+ const typedObj = obj as any
1329
+ return (
1330
+ (typedObj !== null &&
1331
+ typeof typedObj === "object" ||
1332
+ typeof typedObj === "function") &&
1333
+ isWitness(typedObj["witness"]) as boolean &&
1334
+ isSeedsV1(typedObj["seeds"]) as boolean &&
1335
+ isNicks(typedObj["fee"]) as boolean
1336
+ )
1337
+ }
1338
+
1339
+ export function isNockchainTx(obj: unknown): obj is NockchainTx {
1340
+ const typedObj = obj as any
1341
+ return (
1342
+ (typedObj !== null &&
1343
+ typeof typedObj === "object" ||
1344
+ typeof typedObj === "function") &&
1345
+ isVersion(typedObj["version"]) as boolean &&
1346
+ isNicks(typedObj["id"]) as boolean &&
1347
+ isSpendsV1(typedObj["spends"]) as boolean &&
1348
+ isTransactionDisplay(typedObj["display"]) as boolean &&
1349
+ isWitnessData(typedObj["witness_data"]) as boolean
1350
+ )
1351
+ }
1352
+
1353
+ export function isLockRoot(obj: unknown): obj is LockRoot {
1354
+ const typedObj = obj as any
1355
+ return (
1356
+ ((typedObj !== null &&
1357
+ typeof typedObj === "object" ||
1358
+ typeof typedObj === "function") &&
1359
+ isNicks(typedObj["Hash"]) as boolean ||
1360
+ (typedObj !== null &&
1361
+ typeof typedObj === "object" ||
1362
+ typeof typedObj === "function") &&
1363
+ isSpendCondition(typedObj["Lock"]) as boolean)
1364
+ )
1365
+ }
1366
+
1367
+ export function isSeedsV1(obj: unknown): obj is SeedsV1 {
1368
+ const typedObj = obj as any
1369
+ return (
1370
+ Array.isArray(typedObj) &&
1371
+ typedObj.every((e: any) =>
1372
+ isSeedV1(e) as boolean
1373
+ )
1374
+ )
1375
+ }
1376
+
1377
+ export function isMerkleProof(obj: unknown): obj is MerkleProof {
1378
+ const typedObj = obj as any
1379
+ return (
1380
+ (typedObj !== null &&
1381
+ typeof typedObj === "object" ||
1382
+ typeof typedObj === "function") &&
1383
+ isNicks(typedObj["root"]) as boolean &&
1384
+ Array.isArray(typedObj["path"]) &&
1385
+ typedObj["path"].every((e: any) =>
1386
+ isNicks(e) as boolean
1387
+ )
1388
+ )
1389
+ }
1390
+
1391
+ export function isPkhSignature(obj: unknown): obj is PkhSignature {
1392
+ const typedObj = obj as any
1393
+ return (
1394
+ Array.isArray(typedObj) &&
1395
+ typedObj.every((e: any) =>
1396
+ Array.isArray(e) &&
1397
+ isNicks(e[0]) as boolean &&
1398
+ Array.isArray(e[1]) &&
1399
+ isNicks(e[1][0]) as boolean &&
1400
+ isSignature(e[1][1]) as boolean
1401
+ )
1402
+ )
1403
+ }
1404
+
1405
+ export function isNoteV1(obj: unknown): obj is NoteV1 {
1406
+ const typedObj = obj as any
1407
+ return (
1408
+ (typedObj !== null &&
1409
+ typeof typedObj === "object" ||
1410
+ typeof typedObj === "function") &&
1411
+ isVersion(typedObj["version"]) as boolean &&
1412
+ isBlockHeight(typedObj["origin_page"]) as boolean &&
1413
+ isName(typedObj["name"]) as boolean &&
1414
+ isNoteData(typedObj["note_data"]) as boolean &&
1415
+ isNicks(typedObj["assets"]) as boolean
1416
+ )
1417
+ }
1418
+
1419
+ export function isRawTxV1(obj: unknown): obj is RawTxV1 {
1420
+ const typedObj = obj as any
1421
+ return (
1422
+ (typedObj !== null &&
1423
+ typeof typedObj === "object" ||
1424
+ typeof typedObj === "function") &&
1425
+ typedObj["version"] === 1 &&
1426
+ isNicks(typedObj["id"]) as boolean &&
1427
+ isSpendsV1(typedObj["spends"]) as boolean
1428
+ )
1429
+ }
1430
+
1431
+ export function isSpendV1(obj: unknown): obj is SpendV1 {
1432
+ const typedObj = obj as any
1433
+ return (
1434
+ ((typedObj !== null &&
1435
+ typeof typedObj === "object" ||
1436
+ typeof typedObj === "function") &&
1437
+ typedObj["version"] === 0 &&
1438
+ isSpend0V1(typedObj["spend"]) as boolean ||
1439
+ (typedObj !== null &&
1440
+ typeof typedObj === "object" ||
1441
+ typeof typedObj === "function") &&
1442
+ typedObj["version"] === 1 &&
1443
+ isSpend1V1(typedObj["spend"]) as boolean)
1444
+ )
1445
+ }
1446
+
1447
+ export function isInputDisplay(obj: unknown): obj is InputDisplay {
1448
+ const typedObj = obj as any
1449
+ return (
1450
+ ((typedObj !== null &&
1451
+ typeof typedObj === "object" ||
1452
+ typeof typedObj === "function") &&
1453
+ typedObj["version"] === 0 &&
1454
+ Array.isArray(typedObj["p"]) &&
1455
+ typedObj["p"].every((e: any) =>
1456
+ Array.isArray(e) &&
1457
+ isName(e[0]) as boolean &&
1458
+ isSig(e[1]) as boolean
1459
+ ) ||
1460
+ (typedObj !== null &&
1461
+ typeof typedObj === "object" ||
1462
+ typeof typedObj === "function") &&
1463
+ typedObj["version"] === 1 &&
1464
+ Array.isArray(typedObj["p"]) &&
1465
+ typedObj["p"].every((e: any) =>
1466
+ Array.isArray(e) &&
1467
+ isName(e[0]) as boolean &&
1468
+ isSpendCondition(e[1]) as boolean
1469
+ ))
1470
+ )
1471
+ }
1472
+
1473
+ export function isSeedV1(obj: unknown): obj is SeedV1 {
1474
+ const typedObj = obj as any
1475
+ return (
1476
+ (typedObj !== null &&
1477
+ typeof typedObj === "object" ||
1478
+ typeof typedObj === "function") &&
1479
+ (typeof typedObj["output_source"] === "undefined" ||
1480
+ isSource(typedObj["output_source"]) as boolean) &&
1481
+ isLockRoot(typedObj["lock_root"]) as boolean &&
1482
+ isNoteData(typedObj["note_data"]) as boolean &&
1483
+ isNicks(typedObj["gift"]) as boolean &&
1484
+ isNicks(typedObj["parent_hash"]) as boolean
1485
+ )
1486
+ }
1487
+
1488
+ export function isTransactionDisplay(obj: unknown): obj is TransactionDisplay {
1489
+ const typedObj = obj as any
1490
+ return (
1491
+ (typedObj !== null &&
1492
+ typeof typedObj === "object" ||
1493
+ typeof typedObj === "function") &&
1494
+ isInputDisplay(typedObj["inputs"]) as boolean &&
1495
+ Array.isArray(typedObj["outputs"]) &&
1496
+ typedObj["outputs"].every((e: any) =>
1497
+ Array.isArray(e) &&
1498
+ isNicks(e[0]) as boolean &&
1499
+ isLockMetadata(e[1]) as boolean
1500
+ )
1501
+ )
1502
+ }
1503
+
1504
+ export function isMissingUnlocks(obj: unknown): obj is MissingUnlocks {
1505
+ const typedObj = obj as any
1506
+ return (
1507
+ (typedObj === "Brn" ||
1508
+ (typedObj !== null &&
1509
+ typeof typedObj === "object" ||
1510
+ typeof typedObj === "function") &&
1511
+ (typedObj["Pkh"] !== null &&
1512
+ typeof typedObj["Pkh"] === "object" ||
1513
+ typeof typedObj["Pkh"] === "function") &&
1514
+ isBlockHeight(typedObj["Pkh"]["num_sigs"]) as boolean &&
1515
+ Array.isArray(typedObj["Pkh"]["sig_of"]) &&
1516
+ typedObj["Pkh"]["sig_of"].every((e: any) =>
1517
+ isNicks(e) as boolean
1518
+ ) ||
1519
+ (typedObj !== null &&
1520
+ typeof typedObj === "object" ||
1521
+ typeof typedObj === "function") &&
1522
+ (typedObj["Hax"] !== null &&
1523
+ typeof typedObj["Hax"] === "object" ||
1524
+ typeof typedObj["Hax"] === "function") &&
1525
+ Array.isArray(typedObj["Hax"]["preimages_for"]) &&
1526
+ typedObj["Hax"]["preimages_for"].every((e: any) =>
1527
+ isNicks(e) as boolean
1528
+ ) ||
1529
+ (typedObj !== null &&
1530
+ typeof typedObj === "object" ||
1531
+ typeof typedObj === "function") &&
1532
+ (typedObj["Sig"] !== null &&
1533
+ typeof typedObj["Sig"] === "object" ||
1534
+ typeof typedObj["Sig"] === "function") &&
1535
+ isBlockHeight(typedObj["Sig"]["num_sigs"]) as boolean &&
1536
+ Array.isArray(typedObj["Sig"]["sig_of"]) &&
1537
+ typedObj["Sig"]["sig_of"].every((e: any) =>
1538
+ isNicks(e) as boolean
1539
+ ))
1540
+ )
1541
+ }
1542
+
1543
+ export function isBalance(obj: unknown): obj is Balance {
1544
+ const typedObj = obj as any
1545
+ return (
1546
+ Array.isArray(typedObj) &&
1547
+ typedObj.every((e: any) =>
1548
+ Array.isArray(e) &&
1549
+ isName(e[0]) as boolean &&
1550
+ isNote(e[1]) as boolean
1551
+ )
1552
+ )
1553
+ }
1554
+
1555
+ export function isBalanceUpdate(obj: unknown): obj is BalanceUpdate {
1556
+ const typedObj = obj as any
1557
+ return (
1558
+ (typedObj !== null &&
1559
+ typeof typedObj === "object" ||
1560
+ typeof typedObj === "function") &&
1561
+ isBlockHeight(typedObj["height"]) as boolean &&
1562
+ isNicks(typedObj["block_id"]) as boolean &&
1563
+ isBalance(typedObj["notes"]) as boolean
1564
+ )
1565
+ }
1566
+
1567
+ export function isVersion(obj: unknown): obj is Version {
1568
+ const typedObj = obj as any
1569
+ return (
1570
+ (typedObj === 0 ||
1571
+ typedObj === 2 ||
1572
+ typedObj === 1)
1573
+ )
1574
+ }
1575
+
1576
+ export function isTimelockRange(obj: unknown): obj is TimelockRange {
1577
+ const typedObj = obj as any
1578
+ return (
1579
+ (typedObj !== null &&
1580
+ typeof typedObj === "object" ||
1581
+ typeof typedObj === "function") &&
1582
+ (typeof typedObj["min"] === "undefined" ||
1583
+ isBlockHeight(typedObj["min"]) as boolean) &&
1584
+ (typeof typedObj["max"] === "undefined" ||
1585
+ isBlockHeight(typedObj["max"]) as boolean)
1586
+ )
1587
+ }
1588
+
1589
+ export function isNicks(obj: unknown): obj is Nicks {
1590
+ const typedObj = obj as any
1591
+ return (
1592
+ typeof typedObj === "string"
1593
+ )
1594
+ }
1595
+
1596
+ export function isSource(obj: unknown): obj is Source {
1597
+ const typedObj = obj as any
1598
+ return (
1599
+ (typedObj !== null &&
1600
+ typeof typedObj === "object" ||
1601
+ typeof typedObj === "function") &&
1602
+ isNicks(typedObj["hash"]) as boolean &&
1603
+ typeof typedObj["is_coinbase"] === "boolean"
1604
+ )
1605
+ }
1606
+
1607
+ export function isName(obj: unknown): obj is Name {
1608
+ const typedObj = obj as any
1609
+ return (
1610
+ (typedObj !== null &&
1611
+ typeof typedObj === "object" ||
1612
+ typeof typedObj === "function") &&
1613
+ isNicks(typedObj["first"]) as boolean &&
1614
+ isNicks(typedObj["last"]) as boolean &&
1615
+ isBlockHeight(typedObj["_sig"]) as boolean
1616
+ )
1617
+ }
1618
+
1619
+ export function isNote(obj: unknown): obj is Note {
1620
+ const typedObj = obj as any
1621
+ return (
1622
+ (isNoteV1(typedObj) as boolean ||
1623
+ isNoteV0(typedObj) as boolean)
1624
+ )
1625
+ }
1626
+
1627
+ export function isSig(obj: unknown): obj is Sig {
1628
+ const typedObj = obj as any
1629
+ return (
1630
+ (typedObj !== null &&
1631
+ typeof typedObj === "object" ||
1632
+ typeof typedObj === "function") &&
1633
+ isBlockHeight(typedObj["m"]) as boolean &&
1634
+ Array.isArray(typedObj["pubkeys"]) &&
1635
+ typedObj["pubkeys"].every((e: any) =>
1636
+ isNicks(e) as boolean
1637
+ )
1638
+ )
1639
+ }
1640
+
1641
+ export function isRawTxV0(obj: unknown): obj is RawTxV0 {
1642
+ const typedObj = obj as any
1643
+ return (
1644
+ (typedObj !== null &&
1645
+ typeof typedObj === "object" ||
1646
+ typeof typedObj === "function") &&
1647
+ isNicks(typedObj["id"]) as boolean &&
1648
+ isInputs(typedObj["inputs"]) as boolean &&
1649
+ isTimelockRange(typedObj["timelock_range"]) as boolean &&
1650
+ isNicks(typedObj["total_fees"]) as boolean
1651
+ )
1652
+ }
1653
+
1654
+ export function isTimelock(obj: unknown): obj is Timelock {
1655
+ const typedObj = obj as any
1656
+ return (
1657
+ (typedObj !== null &&
1658
+ typeof typedObj === "object" ||
1659
+ typeof typedObj === "function") &&
1660
+ isTimelockRange(typedObj["rel"]) as boolean &&
1661
+ isTimelockRange(typedObj["abs"]) as boolean
1662
+ )
1663
+ }
1664
+
1665
+ export function isInputs(obj: unknown): obj is Inputs {
1666
+ const typedObj = obj as any
1667
+ return (
1668
+ Array.isArray(typedObj) &&
1669
+ typedObj.every((e: any) =>
1670
+ Array.isArray(e) &&
1671
+ isName(e[0]) as boolean &&
1672
+ isInput(e[1]) as boolean
1673
+ )
1674
+ )
1675
+ }
1676
+
1677
+ export function isSeedsV0(obj: unknown): obj is SeedsV0 {
1678
+ const typedObj = obj as any
1679
+ return (
1680
+ Array.isArray(typedObj) &&
1681
+ typedObj.every((e: any) =>
1682
+ isSeedV0(e) as boolean
1683
+ )
1684
+ )
1685
+ }
1686
+
1687
+ export function isNoteV0(obj: unknown): obj is NoteV0 {
1688
+ const typedObj = obj as any
1689
+ return (
1690
+ (typedObj !== null &&
1691
+ typeof typedObj === "object" ||
1692
+ typeof typedObj === "function") &&
1693
+ isNoteInner(typedObj["inner"]) as boolean &&
1694
+ isName(typedObj["name"]) as boolean &&
1695
+ isSig(typedObj["sig"]) as boolean &&
1696
+ isSource(typedObj["source"]) as boolean &&
1697
+ isNicks(typedObj["assets"]) as boolean
1698
+ )
1699
+ }
1700
+
1701
+ export function isSeedV0(obj: unknown): obj is SeedV0 {
1702
+ const typedObj = obj as any
1703
+ return (
1704
+ (typedObj !== null &&
1705
+ typeof typedObj === "object" ||
1706
+ typeof typedObj === "function") &&
1707
+ (typeof typedObj["output_source"] === "undefined" ||
1708
+ isSource(typedObj["output_source"]) as boolean) &&
1709
+ isSig(typedObj["recipient"]) as boolean &&
1710
+ isTimelockIntent(typedObj["timelock_intent"]) as boolean &&
1711
+ isNicks(typedObj["gift"]) as boolean &&
1712
+ isNicks(typedObj["parent_hash"]) as boolean
1713
+ )
1714
+ }
1715
+
1716
+ export function isInput(obj: unknown): obj is Input {
1717
+ const typedObj = obj as any
1718
+ return (
1719
+ (typedObj !== null &&
1720
+ typeof typedObj === "object" ||
1721
+ typeof typedObj === "function") &&
1722
+ isNoteV0(typedObj["note"]) as boolean &&
1723
+ isSpendV0(typedObj["spend"]) as boolean
1724
+ )
1725
+ }
1726
+
1727
+ export function isSpendV0(obj: unknown): obj is SpendV0 {
1728
+ const typedObj = obj as any
1729
+ return (
1730
+ (typedObj !== null &&
1731
+ typeof typedObj === "object" ||
1732
+ typeof typedObj === "function") &&
1733
+ (typeof typedObj["signature"] === "undefined" ||
1734
+ isLegacySignature(typedObj["signature"]) as boolean) &&
1735
+ isSeedsV0(typedObj["seeds"]) as boolean &&
1736
+ isNicks(typedObj["fee"]) as boolean
1737
+ )
1738
+ }
1739
+
1740
+ export function isNoteInner(obj: unknown): obj is NoteInner {
1741
+ const typedObj = obj as any
1742
+ return (
1743
+ (typedObj !== null &&
1744
+ typeof typedObj === "object" ||
1745
+ typeof typedObj === "function") &&
1746
+ isVersion(typedObj["version"]) as boolean &&
1747
+ isBlockHeight(typedObj["origin_page"]) as boolean &&
1748
+ isTimelockIntent(typedObj["timelock"]) as boolean
1749
+ )
1750
+ }
1751
+
1752
+ export function isLegacySignature(obj: unknown): obj is LegacySignature {
1753
+ const typedObj = obj as any
1754
+ return (
1755
+ Array.isArray(typedObj) &&
1756
+ typedObj.every((e: any) =>
1757
+ Array.isArray(e) &&
1758
+ isNicks(e[0]) as boolean &&
1759
+ isSignature(e[1]) as boolean
1760
+ )
1761
+ )
1762
+ }
1763
+
1764
+ export function isTimelockIntent(obj: unknown): obj is TimelockIntent {
1765
+ const typedObj = obj as any
1766
+ return (
1767
+ (typedObj !== null &&
1768
+ typeof typedObj === "object" ||
1769
+ typeof typedObj === "function") &&
1770
+ (typeof typedObj["tim"] === "undefined" ||
1771
+ isTimelock(typedObj["tim"]) as boolean)
1772
+ )
1773
+ }
1774
+
1775
+ export function isRawTx(obj: unknown): obj is RawTx {
1776
+ const typedObj = obj as any
1777
+ return (
1778
+ (isRawTxV1(typedObj) as boolean ||
1779
+ isRawTxV0(typedObj) as boolean)
1780
+ )
1781
+ }
1782
+
1783
+ export function isSignature(obj: unknown): obj is Signature {
1784
+ const typedObj = obj as any
1785
+ return (
1786
+ (typedObj !== null &&
1787
+ typeof typedObj === "object" ||
1788
+ typeof typedObj === "function") &&
1789
+ typedObj["c"] instanceof Uint8Array &&
1790
+ typedObj["s"] instanceof Uint8Array
1791
+ )
1792
+ }
1793
+
1794
+ export function isPublicKey(obj: unknown): obj is PublicKey {
1795
+ const typedObj = obj as any
1796
+ return (
1797
+ typeof typedObj === "string"
1798
+ )
1799
+ }
1800
+
1801
+ export function isNoun(obj: unknown): obj is Noun {
1802
+ const typedObj = obj as any
1803
+ return (
1804
+ (isNicks(typedObj) as boolean ||
1805
+ Array.isArray(typedObj) &&
1806
+ isNoun(typedObj[0]) as boolean)
1807
+ )
1808
+ }
1809
+
1810
+ export function isCheetahPoint(obj: unknown): obj is CheetahPoint {
1811
+ const typedObj = obj as any
1812
+ return (
1813
+ typeof typedObj === "string"
1814
+ )
1815
+ }
1816
+
1817
+ export function isDigest(obj: unknown): obj is Digest {
1818
+ const typedObj = obj as any
1819
+ return (
1820
+ typeof typedObj === "string"
1821
+ )
1822
+ }
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1829
+
1830
+
1831
+
1832
+ export function isTxId(obj: unknown): obj is TxId {
1833
+ const typedObj = obj as any
1834
+ return (
1835
+ typeof typedObj === "string"
1836
+ )
1837
+ }
1838
+
1839
+ export function isBlockHeight(obj: unknown): obj is BlockHeight {
1840
+ const typedObj = obj as any
1841
+ return (
1842
+ typeof typedObj === "number"
1843
+ )
1844
+ }
1845
+
1846
+ export function isLockTim(obj: unknown): obj is LockTim {
1847
+ const typedObj = obj as any
1848
+ return (
1849
+ (typedObj !== null &&
1850
+ typeof typedObj === "object" ||
1851
+ typeof typedObj === "function") &&
1852
+ isTimelockRange(typedObj["rel"]) as boolean &&
1853
+ isTimelockRange(typedObj["abs"]) as boolean
1854
+ )
1855
+ }
1856
+
1857
+
1858
+ export function isZBase<E>(obj: unknown, isE: (e: unknown) => e is E): obj is ZBase<E> {
1859
+ return Array.isArray(obj) && obj.every(isE);
1860
+ }
1861
+
1862
+ export function isZSetEntry<T>(obj: unknown, isT: (t: unknown) => t is T): obj is ZSetEntry<T> {
1863
+ return isT(obj);
1864
+ }
1865
+
1866
+ export function isZSet<T>(obj: unknown, isT: (t: unknown) => t is T): obj is ZSet<T> {
1867
+ return isZBase(obj, (e): e is ZSetEntry<T> => isZSetEntry(e, isT));
1868
+ }
1869
+
1870
+ export function isZMapEntry<K, V>(obj: unknown, isK: (k: unknown) => k is K, isV: (v: unknown) => v is V): obj is ZMapEntry<K, V> {
1871
+ return Array.isArray(obj) && obj.length === 2 && isK(obj[0]) && isV(obj[1]);
1872
+ }
1873
+
1874
+ export function isZMap<K, V>(obj: unknown, isK: (k: unknown) => k is K, isV: (v: unknown) => v is V): obj is ZMap<K, V> {
1875
+ if (!Array.isArray(obj)) return false;
1876
+ return obj.every((entry) => isZMapEntry(entry, isK, isV));
1877
+ }