@nockbox/iris-wasm 0.2.0-alpha.0 → 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.
package/iris_wasm.js CHANGED
@@ -220,51 +220,91 @@ function takeFromExternrefTable0(idx) {
220
220
  return value;
221
221
  }
222
222
 
223
- function _assertClass(instance, klass) {
224
- if (!(instance instanceof klass)) {
225
- throw new Error(`expected instance of ${klass.name}`);
223
+ function passArray8ToWasm0(arg, malloc) {
224
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
225
+ getUint8ArrayMemory0().set(arg, ptr / 1);
226
+ WASM_VECTOR_LEN = arg.length;
227
+ return ptr;
228
+ }
229
+ /**
230
+ * Verify a signature with a public key
231
+ * @param {Uint8Array} public_key_bytes
232
+ * @param {Signature} signature
233
+ * @param {string} message
234
+ * @returns {boolean}
235
+ */
236
+ export function verifySignature(public_key_bytes, signature, message) {
237
+ const ptr0 = passArray8ToWasm0(public_key_bytes, wasm.__wbindgen_malloc);
238
+ const len0 = WASM_VECTOR_LEN;
239
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
+ const len1 = WASM_VECTOR_LEN;
241
+ const ret = wasm.verifySignature(ptr0, len0, signature, ptr1, len1);
242
+ if (ret[2]) {
243
+ throw takeFromExternrefTable0(ret[1]);
226
244
  }
245
+ return ret[0] !== 0;
227
246
  }
228
247
 
229
- function getArrayJsValueFromWasm0(ptr, len) {
230
- ptr = ptr >>> 0;
231
- const mem = getDataViewMemory0();
232
- const result = [];
233
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
234
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
235
- }
236
- wasm.__externref_drop_slice(ptr, len);
237
- return result;
248
+ /**
249
+ * Derive master key from seed bytes
250
+ * @param {Uint8Array} seed
251
+ * @returns {ExtendedKey}
252
+ */
253
+ export function deriveMasterKey(seed) {
254
+ const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
255
+ const len0 = WASM_VECTOR_LEN;
256
+ const ret = wasm.deriveMasterKey(ptr0, len0);
257
+ return ExtendedKey.__wrap(ret);
238
258
  }
239
259
 
240
- function passArrayJsValueToWasm0(array, malloc) {
241
- const ptr = malloc(array.length * 4, 4) >>> 0;
242
- for (let i = 0; i < array.length; i++) {
243
- const add = addToExternrefTable0(array[i]);
244
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
260
+ /**
261
+ * Hash a u64 value
262
+ * @param {bigint} value
263
+ * @returns {string}
264
+ */
265
+ export function hashU64(value) {
266
+ let deferred1_0;
267
+ let deferred1_1;
268
+ try {
269
+ const ret = wasm.hashU64(value);
270
+ deferred1_0 = ret[0];
271
+ deferred1_1 = ret[1];
272
+ return getStringFromWasm0(ret[0], ret[1]);
273
+ } finally {
274
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
245
275
  }
246
- WASM_VECTOR_LEN = array.length;
247
- return ptr;
248
276
  }
249
277
 
250
- function passArray8ToWasm0(arg, malloc) {
251
- const ptr = malloc(arg.length * 1, 1) >>> 0;
252
- getUint8ArrayMemory0().set(arg, ptr / 1);
253
- WASM_VECTOR_LEN = arg.length;
254
- return ptr;
278
+ /**
279
+ * Derive master key from BIP39 mnemonic phrase
280
+ * @param {string} mnemonic
281
+ * @param {string | null} [passphrase]
282
+ * @returns {ExtendedKey}
283
+ */
284
+ export function deriveMasterKeyFromMnemonic(mnemonic, passphrase) {
285
+ const ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ var ptr1 = isLikeNone(passphrase) ? 0 : passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
288
+ var len1 = WASM_VECTOR_LEN;
289
+ const ret = wasm.deriveMasterKeyFromMnemonic(ptr0, len0, ptr1, len1);
290
+ if (ret[2]) {
291
+ throw takeFromExternrefTable0(ret[1]);
292
+ }
293
+ return ExtendedKey.__wrap(ret[0]);
255
294
  }
295
+
256
296
  /**
257
- * Hash a noun (jam as input)
258
- * @param {Uint8Array} noun
297
+ * Hash a public key to get its digest (for use in PKH)
298
+ * @param {Uint8Array} public_key_bytes
259
299
  * @returns {string}
260
300
  */
261
- export function hashNoun(noun) {
301
+ export function hashPublicKey(public_key_bytes) {
262
302
  let deferred3_0;
263
303
  let deferred3_1;
264
304
  try {
265
- const ptr0 = passArray8ToWasm0(noun, wasm.__wbindgen_malloc);
305
+ const ptr0 = passArray8ToWasm0(public_key_bytes, wasm.__wbindgen_malloc);
266
306
  const len0 = WASM_VECTOR_LEN;
267
- const ret = wasm.hashNoun(ptr0, len0);
307
+ const ret = wasm.hashPublicKey(ptr0, len0);
268
308
  var ptr2 = ret[0];
269
309
  var len2 = ret[1];
270
310
  if (ret[3]) {
@@ -294,19 +334,130 @@ export function signMessage(private_key_bytes, message) {
294
334
  if (ret[2]) {
295
335
  throw takeFromExternrefTable0(ret[1]);
296
336
  }
297
- return Signature.__wrap(ret[0]);
337
+ return takeFromExternrefTable0(ret[0]);
298
338
  }
299
339
 
300
340
  /**
301
- * Hash a u64 value
302
- * @param {bigint} value
341
+ * Hash a noun (jam as input)
342
+ * @param {Uint8Array} noun
303
343
  * @returns {string}
304
344
  */
305
- export function hashU64(value) {
345
+ export function hashNoun(noun) {
346
+ let deferred3_0;
347
+ let deferred3_1;
348
+ try {
349
+ const ptr0 = passArray8ToWasm0(noun, wasm.__wbindgen_malloc);
350
+ const len0 = WASM_VECTOR_LEN;
351
+ const ret = wasm.hashNoun(ptr0, len0);
352
+ var ptr2 = ret[0];
353
+ var len2 = ret[1];
354
+ if (ret[3]) {
355
+ ptr2 = 0; len2 = 0;
356
+ throw takeFromExternrefTable0(ret[2]);
357
+ }
358
+ deferred3_0 = ptr2;
359
+ deferred3_1 = len2;
360
+ return getStringFromWasm0(ptr2, len2);
361
+ } finally {
362
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
363
+ }
364
+ }
365
+
366
+ /**
367
+ * @param {Uint8Array} jam
368
+ * @returns {Noun}
369
+ */
370
+ export function cue(jam) {
371
+ const ptr0 = passArray8ToWasm0(jam, wasm.__wbindgen_malloc);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ const ret = wasm.cue(ptr0, len0);
374
+ if (ret[2]) {
375
+ throw takeFromExternrefTable0(ret[1]);
376
+ }
377
+ return takeFromExternrefTable0(ret[0]);
378
+ }
379
+
380
+ /**
381
+ * @param {Noun} noun
382
+ * @returns {Uint8Array}
383
+ */
384
+ export function jam(noun) {
385
+ const ret = wasm.jam(noun);
386
+ if (ret[3]) {
387
+ throw takeFromExternrefTable0(ret[2]);
388
+ }
389
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
390
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
391
+ return v1;
392
+ }
393
+
394
+ function getArrayJsValueFromWasm0(ptr, len) {
395
+ ptr = ptr >>> 0;
396
+ const mem = getDataViewMemory0();
397
+ const result = [];
398
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
399
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
400
+ }
401
+ wasm.__externref_drop_slice(ptr, len);
402
+ return result;
403
+ }
404
+
405
+ function passArrayJsValueToWasm0(array, malloc) {
406
+ const ptr = malloc(array.length * 4, 4) >>> 0;
407
+ for (let i = 0; i < array.length; i++) {
408
+ const add = addToExternrefTable0(array[i]);
409
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
410
+ }
411
+ WASM_VECTOR_LEN = array.length;
412
+ return ptr;
413
+ }
414
+
415
+ function _assertClass(instance, klass) {
416
+ if (!(instance instanceof klass)) {
417
+ throw new Error(`expected instance of ${klass.name}`);
418
+ }
419
+ }
420
+ /**
421
+ * @param {string} s
422
+ * @returns {Digest}
423
+ */
424
+ export function hex_to_digest(s) {
425
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
426
+ const len0 = WASM_VECTOR_LEN;
427
+ const ret = wasm.hex_to_digest(ptr0, len0);
428
+ if (ret[2]) {
429
+ throw takeFromExternrefTable0(ret[1]);
430
+ }
431
+ return takeFromExternrefTable0(ret[0]);
432
+ }
433
+
434
+ /**
435
+ * @param {Note} note
436
+ * @returns {Digest}
437
+ */
438
+ export function note_hash(note) {
439
+ const ret = wasm.note_hash(note);
440
+ return ret;
441
+ }
442
+
443
+ /**
444
+ * @param {Note} note
445
+ * @returns {PbCom2Note}
446
+ */
447
+ export function note_to_protobuf(note) {
448
+ const ret = wasm.note_to_protobuf(note);
449
+ return ret;
450
+ }
451
+
452
+ /**
453
+ * @param {Digest} d
454
+ * @returns {string}
455
+ */
456
+ export function digest_to_hex(d) {
306
457
  let deferred1_0;
307
458
  let deferred1_1;
308
459
  try {
309
- const ret = wasm.hashU64(value);
460
+ const ret = wasm.digest_to_hex(d);
310
461
  deferred1_0 = ret[0];
311
462
  deferred1_1 = ret[1];
312
463
  return getStringFromWasm0(ret[0], ret[1]);
@@ -316,79 +467,72 @@ export function hashU64(value) {
316
467
  }
317
468
 
318
469
  /**
319
- * Derive master key from seed bytes
320
- * @param {Uint8Array} seed
321
- * @returns {ExtendedKey}
470
+ * @param {number} origin_page
471
+ * @param {bigint} sig_m
472
+ * @param {Uint8Array[]} sig_pubkeys
473
+ * @param {Digest} source_hash
474
+ * @param {boolean} is_coinbase
475
+ * @param {Timelock | null | undefined} timelock
476
+ * @param {Nicks} assets
477
+ * @returns {Note}
322
478
  */
323
- export function deriveMasterKey(seed) {
324
- const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
479
+ export function create_note_v0(origin_page, sig_m, sig_pubkeys, source_hash, is_coinbase, timelock, assets) {
480
+ const ptr0 = passArrayJsValueToWasm0(sig_pubkeys, wasm.__wbindgen_malloc);
325
481
  const len0 = WASM_VECTOR_LEN;
326
- const ret = wasm.deriveMasterKey(ptr0, len0);
327
- return ExtendedKey.__wrap(ret);
482
+ const ret = wasm.create_note_v0(origin_page, sig_m, ptr0, len0, source_hash, is_coinbase, isLikeNone(timelock) ? 0 : addToExternrefTable0(timelock), assets);
483
+ if (ret[2]) {
484
+ throw takeFromExternrefTable0(ret[1]);
485
+ }
486
+ return takeFromExternrefTable0(ret[0]);
328
487
  }
329
488
 
330
489
  /**
331
- * Verify a signature with a public key
332
- * @param {Uint8Array} public_key_bytes
333
- * @param {Signature} signature
334
- * @param {string} message
335
- * @returns {boolean}
490
+ * @param {PbCom1Hash} value
491
+ * @returns {Digest}
336
492
  */
337
- export function verifySignature(public_key_bytes, signature, message) {
338
- const ptr0 = passArray8ToWasm0(public_key_bytes, wasm.__wbindgen_malloc);
339
- const len0 = WASM_VECTOR_LEN;
340
- _assertClass(signature, Signature);
341
- const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
- const len1 = WASM_VECTOR_LEN;
343
- const ret = wasm.verifySignature(ptr0, len0, signature.__wbg_ptr, ptr1, len1);
493
+ export function digest_from_protobuf(value) {
494
+ const ret = wasm.digest_from_protobuf(value);
344
495
  if (ret[2]) {
345
496
  throw takeFromExternrefTable0(ret[1]);
346
497
  }
347
- return ret[0] !== 0;
498
+ return takeFromExternrefTable0(ret[0]);
348
499
  }
349
500
 
350
501
  /**
351
- * Derive master key from BIP39 mnemonic phrase
352
- * @param {string} mnemonic
353
- * @param {string | null} [passphrase]
354
- * @returns {ExtendedKey}
502
+ * @param {Digest} d
503
+ * @returns {PbCom1Hash}
355
504
  */
356
- export function deriveMasterKeyFromMnemonic(mnemonic, passphrase) {
357
- const ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
358
- const len0 = WASM_VECTOR_LEN;
359
- var ptr1 = isLikeNone(passphrase) ? 0 : passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
360
- var len1 = WASM_VECTOR_LEN;
361
- const ret = wasm.deriveMasterKeyFromMnemonic(ptr0, len0, ptr1, len1);
505
+ export function digest_to_protobuf(d) {
506
+ const ret = wasm.digest_to_protobuf(d);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * @param {PbCom2Note} value
512
+ * @returns {Note}
513
+ */
514
+ export function note_from_protobuf(value) {
515
+ const ret = wasm.note_from_protobuf(value);
362
516
  if (ret[2]) {
363
517
  throw takeFromExternrefTable0(ret[1]);
364
518
  }
365
- return ExtendedKey.__wrap(ret[0]);
519
+ return takeFromExternrefTable0(ret[0]);
366
520
  }
367
521
 
368
522
  /**
369
- * Hash a public key to get its digest (for use in PKH)
370
- * @param {Uint8Array} public_key_bytes
371
- * @returns {string}
523
+ * @param {Version} version
524
+ * @param {number} origin_page
525
+ * @param {Name} name
526
+ * @param {NoteData} note_data
527
+ * @param {Nicks} assets
528
+ * @returns {Note}
372
529
  */
373
- export function hashPublicKey(public_key_bytes) {
374
- let deferred3_0;
375
- let deferred3_1;
376
- try {
377
- const ptr0 = passArray8ToWasm0(public_key_bytes, wasm.__wbindgen_malloc);
378
- const len0 = WASM_VECTOR_LEN;
379
- const ret = wasm.hashPublicKey(ptr0, len0);
380
- var ptr2 = ret[0];
381
- var len2 = ret[1];
382
- if (ret[3]) {
383
- ptr2 = 0; len2 = 0;
384
- throw takeFromExternrefTable0(ret[2]);
385
- }
386
- deferred3_0 = ptr2;
387
- deferred3_1 = len2;
388
- return getStringFromWasm0(ptr2, len2);
389
- } finally {
390
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
530
+ export function create_note_v1(version, origin_page, name, note_data, assets) {
531
+ const ret = wasm.create_note_v1(version, origin_page, name, note_data, assets);
532
+ if (ret[2]) {
533
+ throw takeFromExternrefTable0(ret[1]);
391
534
  }
535
+ return takeFromExternrefTable0(ret[0]);
392
536
  }
393
537
 
394
538
  function wasm_bindgen__convert__closures_____invoke__hbf186e27576c509b(arg0, arg1, arg2) {
@@ -407,1727 +551,281 @@ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache
407
551
 
408
552
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
409
553
 
410
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
411
-
412
- const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
413
-
414
- const DigestFinalization = (typeof FinalizationRegistry === 'undefined')
415
- ? { register: () => {}, unregister: () => {} }
416
- : new FinalizationRegistry(ptr => wasm.__wbg_digest_free(ptr >>> 0, 1));
417
-
418
- export class Digest {
419
-
420
- static __wrap(ptr) {
421
- ptr = ptr >>> 0;
422
- const obj = Object.create(Digest.prototype);
423
- obj.__wbg_ptr = ptr;
424
- DigestFinalization.register(obj, obj.__wbg_ptr, obj);
425
- return obj;
426
- }
427
-
428
- static __unwrap(jsValue) {
429
- if (!(jsValue instanceof Digest)) {
430
- return 0;
431
- }
432
- return jsValue.__destroy_into_raw();
433
- }
434
-
435
- __destroy_into_raw() {
436
- const ptr = this.__wbg_ptr;
437
- this.__wbg_ptr = 0;
438
- DigestFinalization.unregister(this);
439
- return ptr;
440
- }
441
-
442
- free() {
443
- const ptr = this.__destroy_into_raw();
444
- wasm.__wbg_digest_free(ptr, 0);
445
- }
446
- /**
447
- * @returns {any}
448
- */
449
- toProtobuf() {
450
- const ret = wasm.digest_toProtobuf(this.__wbg_ptr);
451
- if (ret[2]) {
452
- throw takeFromExternrefTable0(ret[1]);
453
- }
454
- return takeFromExternrefTable0(ret[0]);
455
- }
456
- /**
457
- * @param {any} value
458
- * @returns {Digest}
459
- */
460
- static fromProtobuf(value) {
461
- const ret = wasm.digest_fromProtobuf(value);
462
- if (ret[2]) {
463
- throw takeFromExternrefTable0(ret[1]);
464
- }
465
- return Digest.__wrap(ret[0]);
466
- }
467
- /**
468
- * @param {string} value
469
- */
470
- constructor(value) {
471
- const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
- const len0 = WASM_VECTOR_LEN;
473
- const ret = wasm.digest_new(ptr0, len0);
474
- this.__wbg_ptr = ret >>> 0;
475
- DigestFinalization.register(this, this.__wbg_ptr, this);
476
- return this;
477
- }
478
- /**
479
- * @returns {string}
480
- */
481
- get value() {
482
- let deferred1_0;
483
- let deferred1_1;
484
- try {
485
- const ret = wasm.digest_value(this.__wbg_ptr);
486
- deferred1_0 = ret[0];
487
- deferred1_1 = ret[1];
488
- return getStringFromWasm0(ret[0], ret[1]);
489
- } finally {
490
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
491
- }
492
- }
493
- }
494
- if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
495
-
496
- const ExtendedKeyFinalization = (typeof FinalizationRegistry === 'undefined')
497
- ? { register: () => {}, unregister: () => {} }
498
- : new FinalizationRegistry(ptr => wasm.__wbg_extendedkey_free(ptr >>> 0, 1));
499
-
500
- export class ExtendedKey {
501
-
502
- static __wrap(ptr) {
503
- ptr = ptr >>> 0;
504
- const obj = Object.create(ExtendedKey.prototype);
505
- obj.__wbg_ptr = ptr;
506
- ExtendedKeyFinalization.register(obj, obj.__wbg_ptr, obj);
507
- return obj;
508
- }
509
-
510
- __destroy_into_raw() {
511
- const ptr = this.__wbg_ptr;
512
- this.__wbg_ptr = 0;
513
- ExtendedKeyFinalization.unregister(this);
514
- return ptr;
515
- }
516
-
517
- free() {
518
- const ptr = this.__destroy_into_raw();
519
- wasm.__wbg_extendedkey_free(ptr, 0);
520
- }
521
- /**
522
- * @returns {Uint8Array}
523
- */
524
- get chainCode() {
525
- const ret = wasm.extendedkey_chainCode(this.__wbg_ptr);
526
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
527
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
528
- return v1;
529
- }
530
- /**
531
- * @returns {Uint8Array}
532
- */
533
- get publicKey() {
534
- const ret = wasm.extendedkey_publicKey(this.__wbg_ptr);
535
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
536
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
537
- return v1;
538
- }
539
- /**
540
- * @returns {Uint8Array | undefined}
541
- */
542
- get privateKey() {
543
- const ret = wasm.extendedkey_privateKey(this.__wbg_ptr);
544
- let v1;
545
- if (ret[0] !== 0) {
546
- v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
547
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
548
- }
549
- return v1;
550
- }
551
- /**
552
- * Derive a child key at the given index
553
- * @param {number} index
554
- * @returns {ExtendedKey}
555
- */
556
- deriveChild(index) {
557
- const ret = wasm.extendedkey_deriveChild(this.__wbg_ptr, index);
558
- if (ret[2]) {
559
- throw takeFromExternrefTable0(ret[1]);
560
- }
561
- return ExtendedKey.__wrap(ret[0]);
562
- }
563
- }
564
- if (Symbol.dispose) ExtendedKey.prototype[Symbol.dispose] = ExtendedKey.prototype.free;
565
-
566
- const GrpcClientFinalization = (typeof FinalizationRegistry === 'undefined')
567
- ? { register: () => {}, unregister: () => {} }
568
- : new FinalizationRegistry(ptr => wasm.__wbg_grpcclient_free(ptr >>> 0, 1));
569
-
570
- export class GrpcClient {
571
-
572
- __destroy_into_raw() {
573
- const ptr = this.__wbg_ptr;
574
- this.__wbg_ptr = 0;
575
- GrpcClientFinalization.unregister(this);
576
- return ptr;
577
- }
578
-
579
- free() {
580
- const ptr = this.__destroy_into_raw();
581
- wasm.__wbg_grpcclient_free(ptr, 0);
582
- }
583
- /**
584
- * Send a transaction
585
- * @param {any} raw_tx
586
- * @returns {Promise<any>}
587
- */
588
- sendTransaction(raw_tx) {
589
- const ret = wasm.grpcclient_sendTransaction(this.__wbg_ptr, raw_tx);
590
- return ret;
591
- }
592
- /**
593
- * Check if a transaction was accepted
594
- * @param {string} tx_id
595
- * @returns {Promise<boolean>}
596
- */
597
- transactionAccepted(tx_id) {
598
- const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
599
- const len0 = WASM_VECTOR_LEN;
600
- const ret = wasm.grpcclient_transactionAccepted(this.__wbg_ptr, ptr0, len0);
601
- return ret;
602
- }
603
- /**
604
- * Get balance for a wallet address
605
- * @param {string} address
606
- * @returns {Promise<any>}
607
- */
608
- getBalanceByAddress(address) {
609
- const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
610
- const len0 = WASM_VECTOR_LEN;
611
- const ret = wasm.grpcclient_getBalanceByAddress(this.__wbg_ptr, ptr0, len0);
612
- return ret;
613
- }
614
- /**
615
- * Get balance for a first name
616
- * @param {string} first_name
617
- * @returns {Promise<any>}
618
- */
619
- getBalanceByFirstName(first_name) {
620
- const ptr0 = passStringToWasm0(first_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
621
- const len0 = WASM_VECTOR_LEN;
622
- const ret = wasm.grpcclient_getBalanceByFirstName(this.__wbg_ptr, ptr0, len0);
623
- return ret;
624
- }
625
- /**
626
- * @param {string} endpoint
627
- */
628
- constructor(endpoint) {
629
- const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
630
- const len0 = WASM_VECTOR_LEN;
631
- const ret = wasm.grpcclient_new(ptr0, len0);
632
- this.__wbg_ptr = ret >>> 0;
633
- GrpcClientFinalization.register(this, this.__wbg_ptr, this);
634
- return this;
635
- }
636
- }
637
- if (Symbol.dispose) GrpcClient.prototype[Symbol.dispose] = GrpcClient.prototype.free;
638
-
639
- const HaxFinalization = (typeof FinalizationRegistry === 'undefined')
640
- ? { register: () => {}, unregister: () => {} }
641
- : new FinalizationRegistry(ptr => wasm.__wbg_hax_free(ptr >>> 0, 1));
642
-
643
- export class Hax {
644
-
645
- __destroy_into_raw() {
646
- const ptr = this.__wbg_ptr;
647
- this.__wbg_ptr = 0;
648
- HaxFinalization.unregister(this);
649
- return ptr;
650
- }
651
-
652
- free() {
653
- const ptr = this.__destroy_into_raw();
654
- wasm.__wbg_hax_free(ptr, 0);
655
- }
656
- /**
657
- * @param {Digest[]} digests
658
- */
659
- constructor(digests) {
660
- const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_malloc);
661
- const len0 = WASM_VECTOR_LEN;
662
- const ret = wasm.hax_new(ptr0, len0);
663
- this.__wbg_ptr = ret >>> 0;
664
- HaxFinalization.register(this, this.__wbg_ptr, this);
665
- return this;
666
- }
667
- /**
668
- * @returns {Digest[]}
669
- */
670
- get digests() {
671
- const ret = wasm.hax_digests(this.__wbg_ptr);
672
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
673
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
674
- return v1;
675
- }
676
- }
677
- if (Symbol.dispose) Hax.prototype[Symbol.dispose] = Hax.prototype.free;
678
-
679
- const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
680
- ? { register: () => {}, unregister: () => {} }
681
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
682
-
683
- export class IntoUnderlyingByteSource {
684
-
685
- __destroy_into_raw() {
686
- const ptr = this.__wbg_ptr;
687
- this.__wbg_ptr = 0;
688
- IntoUnderlyingByteSourceFinalization.unregister(this);
689
- return ptr;
690
- }
691
-
692
- free() {
693
- const ptr = this.__destroy_into_raw();
694
- wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
695
- }
696
- /**
697
- * @returns {number}
698
- */
699
- get autoAllocateChunkSize() {
700
- const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
701
- return ret >>> 0;
702
- }
703
- /**
704
- * @param {ReadableByteStreamController} controller
705
- * @returns {Promise<any>}
706
- */
707
- pull(controller) {
708
- const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
709
- return ret;
710
- }
711
- /**
712
- * @param {ReadableByteStreamController} controller
713
- */
714
- start(controller) {
715
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
716
- }
717
- /**
718
- * @returns {ReadableStreamType}
719
- */
720
- get type() {
721
- const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
722
- return __wbindgen_enum_ReadableStreamType[ret];
723
- }
724
- cancel() {
725
- const ptr = this.__destroy_into_raw();
726
- wasm.intounderlyingbytesource_cancel(ptr);
727
- }
728
- }
729
- if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
730
-
731
- const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
732
- ? { register: () => {}, unregister: () => {} }
733
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
734
-
735
- export class IntoUnderlyingSink {
736
-
737
- __destroy_into_raw() {
738
- const ptr = this.__wbg_ptr;
739
- this.__wbg_ptr = 0;
740
- IntoUnderlyingSinkFinalization.unregister(this);
741
- return ptr;
742
- }
743
-
744
- free() {
745
- const ptr = this.__destroy_into_raw();
746
- wasm.__wbg_intounderlyingsink_free(ptr, 0);
747
- }
748
- /**
749
- * @param {any} reason
750
- * @returns {Promise<any>}
751
- */
752
- abort(reason) {
753
- const ptr = this.__destroy_into_raw();
754
- const ret = wasm.intounderlyingsink_abort(ptr, reason);
755
- return ret;
756
- }
757
- /**
758
- * @returns {Promise<any>}
759
- */
760
- close() {
761
- const ptr = this.__destroy_into_raw();
762
- const ret = wasm.intounderlyingsink_close(ptr);
763
- return ret;
764
- }
765
- /**
766
- * @param {any} chunk
767
- * @returns {Promise<any>}
768
- */
769
- write(chunk) {
770
- const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
771
- return ret;
772
- }
773
- }
774
- if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
775
-
776
- const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
777
- ? { register: () => {}, unregister: () => {} }
778
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
779
-
780
- export class IntoUnderlyingSource {
781
-
782
- __destroy_into_raw() {
783
- const ptr = this.__wbg_ptr;
784
- this.__wbg_ptr = 0;
785
- IntoUnderlyingSourceFinalization.unregister(this);
786
- return ptr;
787
- }
788
-
789
- free() {
790
- const ptr = this.__destroy_into_raw();
791
- wasm.__wbg_intounderlyingsource_free(ptr, 0);
792
- }
793
- /**
794
- * @param {ReadableStreamDefaultController} controller
795
- * @returns {Promise<any>}
796
- */
797
- pull(controller) {
798
- const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
799
- return ret;
800
- }
801
- cancel() {
802
- const ptr = this.__destroy_into_raw();
803
- wasm.intounderlyingsource_cancel(ptr);
804
- }
805
- }
806
- if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
807
-
808
- const LockPrimitiveFinalization = (typeof FinalizationRegistry === 'undefined')
809
- ? { register: () => {}, unregister: () => {} }
810
- : new FinalizationRegistry(ptr => wasm.__wbg_lockprimitive_free(ptr >>> 0, 1));
811
-
812
- export class LockPrimitive {
813
-
814
- static __wrap(ptr) {
815
- ptr = ptr >>> 0;
816
- const obj = Object.create(LockPrimitive.prototype);
817
- obj.__wbg_ptr = ptr;
818
- LockPrimitiveFinalization.register(obj, obj.__wbg_ptr, obj);
819
- return obj;
820
- }
821
-
822
- static __unwrap(jsValue) {
823
- if (!(jsValue instanceof LockPrimitive)) {
824
- return 0;
825
- }
826
- return jsValue.__destroy_into_raw();
827
- }
828
-
829
- __destroy_into_raw() {
830
- const ptr = this.__wbg_ptr;
831
- this.__wbg_ptr = 0;
832
- LockPrimitiveFinalization.unregister(this);
833
- return ptr;
834
- }
835
-
836
- free() {
837
- const ptr = this.__destroy_into_raw();
838
- wasm.__wbg_lockprimitive_free(ptr, 0);
839
- }
840
- /**
841
- * @returns {any}
842
- */
843
- toProtobuf() {
844
- const ret = wasm.lockprimitive_toProtobuf(this.__wbg_ptr);
845
- if (ret[2]) {
846
- throw takeFromExternrefTable0(ret[1]);
847
- }
848
- return takeFromExternrefTable0(ret[0]);
849
- }
850
- /**
851
- * @param {any} value
852
- * @returns {LockPrimitive}
853
- */
854
- static fromProtobuf(value) {
855
- const ret = wasm.lockprimitive_fromProtobuf(value);
856
- if (ret[2]) {
857
- throw takeFromExternrefTable0(ret[1]);
858
- }
859
- return LockPrimitive.__wrap(ret[0]);
860
- }
861
- /**
862
- * @returns {LockPrimitive}
863
- */
864
- static newBrn() {
865
- const ret = wasm.lockprimitive_newBrn();
866
- return LockPrimitive.__wrap(ret);
867
- }
868
- /**
869
- * @param {Hax} hax
870
- * @returns {LockPrimitive}
871
- */
872
- static newHax(hax) {
873
- _assertClass(hax, Hax);
874
- var ptr0 = hax.__destroy_into_raw();
875
- const ret = wasm.lockprimitive_newHax(ptr0);
876
- return LockPrimitive.__wrap(ret);
877
- }
878
- /**
879
- * @param {Pkh} pkh
880
- * @returns {LockPrimitive}
881
- */
882
- static newPkh(pkh) {
883
- _assertClass(pkh, Pkh);
884
- var ptr0 = pkh.__destroy_into_raw();
885
- const ret = wasm.lockprimitive_newPkh(ptr0);
886
- return LockPrimitive.__wrap(ret);
887
- }
888
- /**
889
- * @param {LockTim} tim
890
- * @returns {LockPrimitive}
891
- */
892
- static newTim(tim) {
893
- _assertClass(tim, LockTim);
894
- var ptr0 = tim.__destroy_into_raw();
895
- const ret = wasm.lockprimitive_newTim(ptr0);
896
- return LockPrimitive.__wrap(ret);
897
- }
898
- }
899
- if (Symbol.dispose) LockPrimitive.prototype[Symbol.dispose] = LockPrimitive.prototype.free;
900
-
901
- const LockRootFinalization = (typeof FinalizationRegistry === 'undefined')
902
- ? { register: () => {}, unregister: () => {} }
903
- : new FinalizationRegistry(ptr => wasm.__wbg_lockroot_free(ptr >>> 0, 1));
904
-
905
- export class LockRoot {
906
-
907
- static __wrap(ptr) {
908
- ptr = ptr >>> 0;
909
- const obj = Object.create(LockRoot.prototype);
910
- obj.__wbg_ptr = ptr;
911
- LockRootFinalization.register(obj, obj.__wbg_ptr, obj);
912
- return obj;
913
- }
914
-
915
- __destroy_into_raw() {
916
- const ptr = this.__wbg_ptr;
917
- this.__wbg_ptr = 0;
918
- LockRootFinalization.unregister(this);
919
- return ptr;
920
- }
921
-
922
- free() {
923
- const ptr = this.__destroy_into_raw();
924
- wasm.__wbg_lockroot_free(ptr, 0);
925
- }
926
- /**
927
- * @param {SpendCondition} cond
928
- * @returns {LockRoot}
929
- */
930
- static fromSpendCondition(cond) {
931
- _assertClass(cond, SpendCondition);
932
- var ptr0 = cond.__destroy_into_raw();
933
- const ret = wasm.lockroot_fromSpendCondition(ptr0);
934
- if (ret[2]) {
935
- throw takeFromExternrefTable0(ret[1]);
936
- }
937
- return LockRoot.__wrap(ret[0]);
938
- }
939
- /**
940
- * @returns {Digest}
941
- */
942
- get hash() {
943
- const ret = wasm.lockroot_hash(this.__wbg_ptr);
944
- return Digest.__wrap(ret);
945
- }
946
- /**
947
- * @returns {SpendCondition | undefined}
948
- */
949
- get lock() {
950
- const ret = wasm.lockroot_lock(this.__wbg_ptr);
951
- return ret === 0 ? undefined : SpendCondition.__wrap(ret);
952
- }
953
- /**
954
- * @param {Digest} hash
955
- * @returns {LockRoot}
956
- */
957
- static fromHash(hash) {
958
- _assertClass(hash, Digest);
959
- var ptr0 = hash.__destroy_into_raw();
960
- const ret = wasm.lockroot_fromHash(ptr0);
961
- if (ret[2]) {
962
- throw takeFromExternrefTable0(ret[1]);
963
- }
964
- return LockRoot.__wrap(ret[0]);
965
- }
966
- }
967
- if (Symbol.dispose) LockRoot.prototype[Symbol.dispose] = LockRoot.prototype.free;
968
-
969
- const LockTimFinalization = (typeof FinalizationRegistry === 'undefined')
970
- ? { register: () => {}, unregister: () => {} }
971
- : new FinalizationRegistry(ptr => wasm.__wbg_locktim_free(ptr >>> 0, 1));
972
-
973
- export class LockTim {
974
-
975
- static __wrap(ptr) {
976
- ptr = ptr >>> 0;
977
- const obj = Object.create(LockTim.prototype);
978
- obj.__wbg_ptr = ptr;
979
- LockTimFinalization.register(obj, obj.__wbg_ptr, obj);
980
- return obj;
981
- }
982
-
983
- __destroy_into_raw() {
984
- const ptr = this.__wbg_ptr;
985
- this.__wbg_ptr = 0;
986
- LockTimFinalization.unregister(this);
987
- return ptr;
988
- }
989
-
990
- free() {
991
- const ptr = this.__destroy_into_raw();
992
- wasm.__wbg_locktim_free(ptr, 0);
993
- }
994
- /**
995
- * @returns {any}
996
- */
997
- toProtobuf() {
998
- const ret = wasm.locktim_toProtobuf(this.__wbg_ptr);
999
- if (ret[2]) {
1000
- throw takeFromExternrefTable0(ret[1]);
1001
- }
1002
- return takeFromExternrefTable0(ret[0]);
1003
- }
1004
- /**
1005
- * @param {any} value
1006
- * @returns {LockTim}
1007
- */
1008
- static fromProtobuf(value) {
1009
- const ret = wasm.locktim_fromProtobuf(value);
1010
- if (ret[2]) {
1011
- throw takeFromExternrefTable0(ret[1]);
1012
- }
1013
- return LockTim.__wrap(ret[0]);
1014
- }
1015
- /**
1016
- * @returns {TimelockRange}
1017
- */
1018
- get abs() {
1019
- const ret = wasm.locktim_abs(this.__wbg_ptr);
1020
- return TimelockRange.__wrap(ret);
1021
- }
1022
- /**
1023
- * @param {TimelockRange} rel
1024
- * @param {TimelockRange} abs
1025
- */
1026
- constructor(rel, abs) {
1027
- _assertClass(rel, TimelockRange);
1028
- var ptr0 = rel.__destroy_into_raw();
1029
- _assertClass(abs, TimelockRange);
1030
- var ptr1 = abs.__destroy_into_raw();
1031
- const ret = wasm.locktim_new(ptr0, ptr1);
1032
- this.__wbg_ptr = ret >>> 0;
1033
- LockTimFinalization.register(this, this.__wbg_ptr, this);
1034
- return this;
1035
- }
1036
- /**
1037
- * @returns {TimelockRange}
1038
- */
1039
- get rel() {
1040
- const ret = wasm.locktim_rel(this.__wbg_ptr);
1041
- return TimelockRange.__wrap(ret);
1042
- }
1043
- /**
1044
- * @returns {LockTim}
1045
- */
1046
- static coinbase() {
1047
- const ret = wasm.locktim_coinbase();
1048
- return LockTim.__wrap(ret);
1049
- }
1050
- }
1051
- if (Symbol.dispose) LockTim.prototype[Symbol.dispose] = LockTim.prototype.free;
1052
-
1053
- const NameFinalization = (typeof FinalizationRegistry === 'undefined')
1054
- ? { register: () => {}, unregister: () => {} }
1055
- : new FinalizationRegistry(ptr => wasm.__wbg_name_free(ptr >>> 0, 1));
1056
-
1057
- export class Name {
1058
-
1059
- static __wrap(ptr) {
1060
- ptr = ptr >>> 0;
1061
- const obj = Object.create(Name.prototype);
1062
- obj.__wbg_ptr = ptr;
1063
- NameFinalization.register(obj, obj.__wbg_ptr, obj);
1064
- return obj;
1065
- }
1066
-
1067
- __destroy_into_raw() {
1068
- const ptr = this.__wbg_ptr;
1069
- this.__wbg_ptr = 0;
1070
- NameFinalization.unregister(this);
1071
- return ptr;
1072
- }
1073
-
1074
- free() {
1075
- const ptr = this.__destroy_into_raw();
1076
- wasm.__wbg_name_free(ptr, 0);
1077
- }
1078
- /**
1079
- * @returns {any}
1080
- */
1081
- toProtobuf() {
1082
- const ret = wasm.name_toProtobuf(this.__wbg_ptr);
1083
- if (ret[2]) {
1084
- throw takeFromExternrefTable0(ret[1]);
1085
- }
1086
- return takeFromExternrefTable0(ret[0]);
1087
- }
1088
- /**
1089
- * @param {any} value
1090
- * @returns {Name}
1091
- */
1092
- static fromProtobuf(value) {
1093
- const ret = wasm.name_fromProtobuf(value);
1094
- if (ret[2]) {
1095
- throw takeFromExternrefTable0(ret[1]);
1096
- }
1097
- return Name.__wrap(ret[0]);
1098
- }
1099
- /**
1100
- * @param {string} first
1101
- * @param {string} last
1102
- */
1103
- constructor(first, last) {
1104
- const ptr0 = passStringToWasm0(first, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1105
- const len0 = WASM_VECTOR_LEN;
1106
- const ptr1 = passStringToWasm0(last, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1107
- const len1 = WASM_VECTOR_LEN;
1108
- const ret = wasm.name_new(ptr0, len0, ptr1, len1);
1109
- if (ret[2]) {
1110
- throw takeFromExternrefTable0(ret[1]);
1111
- }
1112
- this.__wbg_ptr = ret[0] >>> 0;
1113
- NameFinalization.register(this, this.__wbg_ptr, this);
1114
- return this;
1115
- }
1116
- /**
1117
- * @returns {string}
1118
- */
1119
- get last() {
1120
- let deferred1_0;
1121
- let deferred1_1;
1122
- try {
1123
- const ret = wasm.name_last(this.__wbg_ptr);
1124
- deferred1_0 = ret[0];
1125
- deferred1_1 = ret[1];
1126
- return getStringFromWasm0(ret[0], ret[1]);
1127
- } finally {
1128
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1129
- }
1130
- }
1131
- /**
1132
- * @returns {string}
1133
- */
1134
- get first() {
1135
- let deferred1_0;
1136
- let deferred1_1;
1137
- try {
1138
- const ret = wasm.name_first(this.__wbg_ptr);
1139
- deferred1_0 = ret[0];
1140
- deferred1_1 = ret[1];
1141
- return getStringFromWasm0(ret[0], ret[1]);
1142
- } finally {
1143
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1144
- }
1145
- }
1146
- }
1147
- if (Symbol.dispose) Name.prototype[Symbol.dispose] = Name.prototype.free;
1148
-
1149
- const NockchainTxFinalization = (typeof FinalizationRegistry === 'undefined')
1150
- ? { register: () => {}, unregister: () => {} }
1151
- : new FinalizationRegistry(ptr => wasm.__wbg_nockchaintx_free(ptr >>> 0, 1));
1152
-
1153
- export class NockchainTx {
1154
-
1155
- static __wrap(ptr) {
1156
- ptr = ptr >>> 0;
1157
- const obj = Object.create(NockchainTx.prototype);
1158
- obj.__wbg_ptr = ptr;
1159
- NockchainTxFinalization.register(obj, obj.__wbg_ptr, obj);
1160
- return obj;
1161
- }
1162
-
1163
- __destroy_into_raw() {
1164
- const ptr = this.__wbg_ptr;
1165
- this.__wbg_ptr = 0;
1166
- NockchainTxFinalization.unregister(this);
1167
- return ptr;
1168
- }
1169
-
1170
- free() {
1171
- const ptr = this.__destroy_into_raw();
1172
- wasm.__wbg_nockchaintx_free(ptr, 0);
1173
- }
1174
- /**
1175
- * @returns {Digest}
1176
- */
1177
- get id() {
1178
- const ret = wasm.nockchaintx_id(this.__wbg_ptr);
1179
- return Digest.__wrap(ret);
1180
- }
1181
- /**
1182
- * @returns {string}
1183
- */
1184
- get name() {
1185
- let deferred1_0;
1186
- let deferred1_1;
1187
- try {
1188
- const ret = wasm.nockchaintx_name(this.__wbg_ptr);
1189
- deferred1_0 = ret[0];
1190
- deferred1_1 = ret[1];
1191
- return getStringFromWasm0(ret[0], ret[1]);
1192
- } finally {
1193
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1194
- }
1195
- }
1196
- /**
1197
- * Convert to jammed transaction file for inspecting through CLI
1198
- * @returns {Uint8Array}
1199
- */
1200
- toJam() {
1201
- const ret = wasm.nockchaintx_toJam(this.__wbg_ptr);
1202
- return ret;
1203
- }
1204
- /**
1205
- * @returns {Note[]}
1206
- */
1207
- outputs() {
1208
- const ret = wasm.nockchaintx_outputs(this.__wbg_ptr);
1209
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1210
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1211
- return v1;
1212
- }
1213
- /**
1214
- * @returns {Version}
1215
- */
1216
- get version() {
1217
- const ret = wasm.nockchaintx_version(this.__wbg_ptr);
1218
- return Version.__wrap(ret);
1219
- }
1220
- /**
1221
- * Convert from CLI-compatible jammed transaction file
1222
- * @param {Uint8Array} jam
1223
- * @returns {NockchainTx}
1224
- */
1225
- static fromJam(jam) {
1226
- const ptr0 = passArray8ToWasm0(jam, wasm.__wbindgen_malloc);
1227
- const len0 = WASM_VECTOR_LEN;
1228
- const ret = wasm.nockchaintx_fromJam(ptr0, len0);
1229
- if (ret[2]) {
1230
- throw takeFromExternrefTable0(ret[1]);
1231
- }
1232
- return NockchainTx.__wrap(ret[0]);
1233
- }
1234
- /**
1235
- * @returns {RawTx}
1236
- */
1237
- toRawTx() {
1238
- const ret = wasm.nockchaintx_toRawTx(this.__wbg_ptr);
1239
- return RawTx.__wrap(ret);
1240
- }
1241
- }
1242
- if (Symbol.dispose) NockchainTx.prototype[Symbol.dispose] = NockchainTx.prototype.free;
1243
-
1244
- const NoteFinalization = (typeof FinalizationRegistry === 'undefined')
1245
- ? { register: () => {}, unregister: () => {} }
1246
- : new FinalizationRegistry(ptr => wasm.__wbg_note_free(ptr >>> 0, 1));
1247
-
1248
- export class Note {
1249
-
1250
- static __wrap(ptr) {
1251
- ptr = ptr >>> 0;
1252
- const obj = Object.create(Note.prototype);
1253
- obj.__wbg_ptr = ptr;
1254
- NoteFinalization.register(obj, obj.__wbg_ptr, obj);
1255
- return obj;
1256
- }
1257
-
1258
- static __unwrap(jsValue) {
1259
- if (!(jsValue instanceof Note)) {
1260
- return 0;
1261
- }
1262
- return jsValue.__destroy_into_raw();
1263
- }
1264
-
1265
- __destroy_into_raw() {
1266
- const ptr = this.__wbg_ptr;
1267
- this.__wbg_ptr = 0;
1268
- NoteFinalization.unregister(this);
1269
- return ptr;
1270
- }
1271
-
1272
- free() {
1273
- const ptr = this.__destroy_into_raw();
1274
- wasm.__wbg_note_free(ptr, 0);
1275
- }
1276
- /**
1277
- * @returns {bigint}
1278
- */
1279
- get originPage() {
1280
- const ret = wasm.note_originPage(this.__wbg_ptr);
1281
- return BigInt.asUintN(64, ret);
1282
- }
1283
- /**
1284
- * @returns {any}
1285
- */
1286
- toProtobuf() {
1287
- const ret = wasm.note_toProtobuf(this.__wbg_ptr);
1288
- if (ret[2]) {
1289
- throw takeFromExternrefTable0(ret[1]);
1290
- }
1291
- return takeFromExternrefTable0(ret[0]);
1292
- }
1293
- /**
1294
- * Create a WasmNote from a protobuf Note object (from get_balance response)
1295
- * Expects response.notes[i].note (handles version internally)
1296
- * @param {any} pb_note
1297
- * @returns {Note}
1298
- */
1299
- static fromProtobuf(pb_note) {
1300
- const ret = wasm.note_fromProtobuf(pb_note);
1301
- if (ret[2]) {
1302
- throw takeFromExternrefTable0(ret[1]);
1303
- }
1304
- return Note.__wrap(ret[0]);
1305
- }
1306
- /**
1307
- * Create a new V1 note (the default for new notes)
1308
- * @param {Version} version
1309
- * @param {bigint} origin_page
1310
- * @param {Name} name
1311
- * @param {NoteData} note_data
1312
- * @param {bigint} assets
1313
- */
1314
- constructor(version, origin_page, name, note_data, assets) {
1315
- _assertClass(version, Version);
1316
- var ptr0 = version.__destroy_into_raw();
1317
- _assertClass(name, Name);
1318
- var ptr1 = name.__destroy_into_raw();
1319
- _assertClass(note_data, NoteData);
1320
- var ptr2 = note_data.__destroy_into_raw();
1321
- const ret = wasm.note_new(ptr0, origin_page, ptr1, ptr2, assets);
1322
- if (ret[2]) {
1323
- throw takeFromExternrefTable0(ret[1]);
1324
- }
1325
- this.__wbg_ptr = ret[0] >>> 0;
1326
- NoteFinalization.register(this, this.__wbg_ptr, this);
1327
- return this;
1328
- }
1329
- /**
1330
- * @returns {Digest}
1331
- */
1332
- hash() {
1333
- const ret = wasm.note_hash(this.__wbg_ptr);
1334
- return Digest.__wrap(ret);
1335
- }
1336
- /**
1337
- * @returns {Name}
1338
- */
1339
- get name() {
1340
- const ret = wasm.note_name(this.__wbg_ptr);
1341
- return Name.__wrap(ret);
1342
- }
1343
- /**
1344
- * Check if this is a V0 (legacy) note
1345
- * @returns {boolean}
1346
- */
1347
- get isV0() {
1348
- const ret = wasm.note_isV0(this.__wbg_ptr);
1349
- return ret !== 0;
1350
- }
1351
- /**
1352
- * Check if this is a V1 note
1353
- * @returns {boolean}
1354
- */
1355
- get isV1() {
1356
- const ret = wasm.note_isV1(this.__wbg_ptr);
1357
- return ret !== 0;
1358
- }
1359
- /**
1360
- * @returns {bigint}
1361
- */
1362
- get assets() {
1363
- const ret = wasm.note_assets(this.__wbg_ptr);
1364
- return BigInt.asUintN(64, ret);
1365
- }
1366
- /**
1367
- * Create a new V0 (legacy) note
1368
- *
1369
- * V0 notes are legacy notes that use public keys directly instead of spend conditions.
1370
- * - `origin_page`: Block height where the note originated
1371
- * - `sig_m`: Number of required signatures (m-of-n)
1372
- * - `sig_pubkeys`: Public keys as 97-byte arrays (big-endian format)
1373
- * - `source_hash`: Hash of the source (seeds that created this note)
1374
- * - `is_coinbase`: Whether this is a coinbase note
1375
- * - `timelock`: Optional timelock constraints (must have at least one constraint if provided)
1376
- * - `assets`: Amount of nicks in this note
1377
- * @param {bigint} origin_page
1378
- * @param {bigint} sig_m
1379
- * @param {Uint8Array[]} sig_pubkeys
1380
- * @param {Digest} source_hash
1381
- * @param {boolean} is_coinbase
1382
- * @param {Timelock | null | undefined} timelock
1383
- * @param {bigint} assets
1384
- * @returns {Note}
1385
- */
1386
- static newV0(origin_page, sig_m, sig_pubkeys, source_hash, is_coinbase, timelock, assets) {
1387
- const ptr0 = passArrayJsValueToWasm0(sig_pubkeys, wasm.__wbindgen_malloc);
1388
- const len0 = WASM_VECTOR_LEN;
1389
- _assertClass(source_hash, Digest);
1390
- var ptr1 = source_hash.__destroy_into_raw();
1391
- let ptr2 = 0;
1392
- if (!isLikeNone(timelock)) {
1393
- _assertClass(timelock, Timelock);
1394
- ptr2 = timelock.__destroy_into_raw();
1395
- }
1396
- const ret = wasm.note_newV0(origin_page, sig_m, ptr0, len0, ptr1, is_coinbase, ptr2, assets);
1397
- if (ret[2]) {
1398
- throw takeFromExternrefTable0(ret[1]);
1399
- }
1400
- return Note.__wrap(ret[0]);
1401
- }
1402
- /**
1403
- * @returns {Version}
1404
- */
1405
- get version() {
1406
- const ret = wasm.note_version(this.__wbg_ptr);
1407
- return Version.__wrap(ret);
1408
- }
1409
- /**
1410
- * Returns note data. For V0 notes this returns empty NoteData since V0 doesn't have this field.
1411
- * @returns {NoteData}
1412
- */
1413
- get noteData() {
1414
- const ret = wasm.note_noteData(this.__wbg_ptr);
1415
- return NoteData.__wrap(ret);
1416
- }
1417
- }
1418
- if (Symbol.dispose) Note.prototype[Symbol.dispose] = Note.prototype.free;
1419
-
1420
- const NoteDataFinalization = (typeof FinalizationRegistry === 'undefined')
1421
- ? { register: () => {}, unregister: () => {} }
1422
- : new FinalizationRegistry(ptr => wasm.__wbg_notedata_free(ptr >>> 0, 1));
1423
-
1424
- export class NoteData {
1425
-
1426
- static __wrap(ptr) {
1427
- ptr = ptr >>> 0;
1428
- const obj = Object.create(NoteData.prototype);
1429
- obj.__wbg_ptr = ptr;
1430
- NoteDataFinalization.register(obj, obj.__wbg_ptr, obj);
1431
- return obj;
1432
- }
1433
-
1434
- __destroy_into_raw() {
1435
- const ptr = this.__wbg_ptr;
1436
- this.__wbg_ptr = 0;
1437
- NoteDataFinalization.unregister(this);
1438
- return ptr;
1439
- }
1440
-
1441
- free() {
1442
- const ptr = this.__destroy_into_raw();
1443
- wasm.__wbg_notedata_free(ptr, 0);
1444
- }
1445
- /**
1446
- * @returns {any}
1447
- */
1448
- toProtobuf() {
1449
- const ret = wasm.notedata_toProtobuf(this.__wbg_ptr);
1450
- if (ret[2]) {
1451
- throw takeFromExternrefTable0(ret[1]);
1452
- }
1453
- return takeFromExternrefTable0(ret[0]);
1454
- }
1455
- /**
1456
- * @param {any} value
1457
- * @returns {NoteData}
1458
- */
1459
- static fromProtobuf(value) {
1460
- const ret = wasm.notedata_fromProtobuf(value);
1461
- if (ret[2]) {
1462
- throw takeFromExternrefTable0(ret[1]);
1463
- }
1464
- return NoteData.__wrap(ret[0]);
1465
- }
1466
- /**
1467
- * @param {NoteDataEntry[]} entries
1468
- */
1469
- constructor(entries) {
1470
- const ptr0 = passArrayJsValueToWasm0(entries, wasm.__wbindgen_malloc);
1471
- const len0 = WASM_VECTOR_LEN;
1472
- const ret = wasm.notedata_new(ptr0, len0);
1473
- this.__wbg_ptr = ret >>> 0;
1474
- NoteDataFinalization.register(this, this.__wbg_ptr, this);
1475
- return this;
1476
- }
1477
- /**
1478
- * @returns {NoteData}
1479
- */
1480
- static empty() {
1481
- const ret = wasm.notedata_empty();
1482
- return NoteData.__wrap(ret);
1483
- }
1484
- /**
1485
- * @returns {NoteDataEntry[]}
1486
- */
1487
- get entries() {
1488
- const ret = wasm.notedata_entries(this.__wbg_ptr);
1489
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1490
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1491
- return v1;
1492
- }
1493
- /**
1494
- * @param {Pkh} pkh
1495
- * @returns {NoteData}
1496
- */
1497
- static fromPkh(pkh) {
1498
- _assertClass(pkh, Pkh);
1499
- var ptr0 = pkh.__destroy_into_raw();
1500
- const ret = wasm.notedata_fromPkh(ptr0);
1501
- if (ret[2]) {
1502
- throw takeFromExternrefTable0(ret[1]);
1503
- }
1504
- return NoteData.__wrap(ret[0]);
1505
- }
1506
- }
1507
- if (Symbol.dispose) NoteData.prototype[Symbol.dispose] = NoteData.prototype.free;
1508
-
1509
- const NoteDataEntryFinalization = (typeof FinalizationRegistry === 'undefined')
1510
- ? { register: () => {}, unregister: () => {} }
1511
- : new FinalizationRegistry(ptr => wasm.__wbg_notedataentry_free(ptr >>> 0, 1));
1512
-
1513
- export class NoteDataEntry {
1514
-
1515
- static __wrap(ptr) {
1516
- ptr = ptr >>> 0;
1517
- const obj = Object.create(NoteDataEntry.prototype);
1518
- obj.__wbg_ptr = ptr;
1519
- NoteDataEntryFinalization.register(obj, obj.__wbg_ptr, obj);
1520
- return obj;
1521
- }
1522
-
1523
- static __unwrap(jsValue) {
1524
- if (!(jsValue instanceof NoteDataEntry)) {
1525
- return 0;
1526
- }
1527
- return jsValue.__destroy_into_raw();
1528
- }
1529
-
1530
- __destroy_into_raw() {
1531
- const ptr = this.__wbg_ptr;
1532
- this.__wbg_ptr = 0;
1533
- NoteDataEntryFinalization.unregister(this);
1534
- return ptr;
1535
- }
1536
-
1537
- free() {
1538
- const ptr = this.__destroy_into_raw();
1539
- wasm.__wbg_notedataentry_free(ptr, 0);
1540
- }
1541
- /**
1542
- * @returns {any}
1543
- */
1544
- toProtobuf() {
1545
- const ret = wasm.notedataentry_toProtobuf(this.__wbg_ptr);
1546
- if (ret[2]) {
1547
- throw takeFromExternrefTable0(ret[1]);
1548
- }
1549
- return takeFromExternrefTable0(ret[0]);
1550
- }
1551
- /**
1552
- * @param {any} value
1553
- * @returns {NoteDataEntry}
1554
- */
1555
- static fromProtobuf(value) {
1556
- const ret = wasm.notedataentry_fromProtobuf(value);
1557
- if (ret[2]) {
1558
- throw takeFromExternrefTable0(ret[1]);
1559
- }
1560
- return NoteDataEntry.__wrap(ret[0]);
1561
- }
1562
- /**
1563
- * @returns {string}
1564
- */
1565
- get key() {
1566
- let deferred1_0;
1567
- let deferred1_1;
1568
- try {
1569
- const ret = wasm.notedataentry_key(this.__wbg_ptr);
1570
- deferred1_0 = ret[0];
1571
- deferred1_1 = ret[1];
1572
- return getStringFromWasm0(ret[0], ret[1]);
1573
- } finally {
1574
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1575
- }
1576
- }
1577
- /**
1578
- * @param {string} key
1579
- * @param {Uint8Array} blob
1580
- */
1581
- constructor(key, blob) {
1582
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1583
- const len0 = WASM_VECTOR_LEN;
1584
- const ptr1 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
1585
- const len1 = WASM_VECTOR_LEN;
1586
- const ret = wasm.notedataentry_new(ptr0, len0, ptr1, len1);
1587
- this.__wbg_ptr = ret >>> 0;
1588
- NoteDataEntryFinalization.register(this, this.__wbg_ptr, this);
1589
- return this;
1590
- }
1591
- /**
1592
- * @returns {Uint8Array}
1593
- */
1594
- get blob() {
1595
- const ret = wasm.notedataentry_blob(this.__wbg_ptr);
1596
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1597
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1598
- return v1;
1599
- }
1600
- }
1601
- if (Symbol.dispose) NoteDataEntry.prototype[Symbol.dispose] = NoteDataEntry.prototype.free;
1602
-
1603
- const NounFinalization = (typeof FinalizationRegistry === 'undefined')
1604
- ? { register: () => {}, unregister: () => {} }
1605
- : new FinalizationRegistry(ptr => wasm.__wbg_noun_free(ptr >>> 0, 1));
1606
-
1607
- export class Noun {
1608
-
1609
- static __wrap(ptr) {
1610
- ptr = ptr >>> 0;
1611
- const obj = Object.create(Noun.prototype);
1612
- obj.__wbg_ptr = ptr;
1613
- NounFinalization.register(obj, obj.__wbg_ptr, obj);
1614
- return obj;
1615
- }
1616
-
1617
- __destroy_into_raw() {
1618
- const ptr = this.__wbg_ptr;
1619
- this.__wbg_ptr = 0;
1620
- NounFinalization.unregister(this);
1621
- return ptr;
1622
- }
1623
-
1624
- free() {
1625
- const ptr = this.__destroy_into_raw();
1626
- wasm.__wbg_noun_free(ptr, 0);
1627
- }
1628
- /**
1629
- * @param {Uint8Array} jam
1630
- * @returns {Noun}
1631
- */
1632
- static cue(jam) {
1633
- const ptr0 = passArray8ToWasm0(jam, wasm.__wbindgen_malloc);
1634
- const len0 = WASM_VECTOR_LEN;
1635
- const ret = wasm.noun_cue(ptr0, len0);
1636
- if (ret[2]) {
1637
- throw takeFromExternrefTable0(ret[1]);
1638
- }
1639
- return Noun.__wrap(ret[0]);
1640
- }
1641
- /**
1642
- * @returns {Uint8Array}
1643
- */
1644
- jam() {
1645
- const ret = wasm.noun_jam(this.__wbg_ptr);
1646
- if (ret[3]) {
1647
- throw takeFromExternrefTable0(ret[2]);
1648
- }
1649
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1650
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1651
- return v1;
1652
- }
1653
- /**
1654
- * @param {any} value
1655
- * @returns {Noun}
1656
- */
1657
- static fromJs(value) {
1658
- const ret = wasm.noun_fromJs(value);
1659
- if (ret[2]) {
1660
- throw takeFromExternrefTable0(ret[1]);
1661
- }
1662
- return Noun.__wrap(ret[0]);
1663
- }
1664
- /**
1665
- * @returns {any}
1666
- */
1667
- toJs() {
1668
- const ret = wasm.noun_toJs(this.__wbg_ptr);
1669
- if (ret[2]) {
1670
- throw takeFromExternrefTable0(ret[1]);
1671
- }
1672
- return takeFromExternrefTable0(ret[0]);
1673
- }
1674
- }
1675
- if (Symbol.dispose) Noun.prototype[Symbol.dispose] = Noun.prototype.free;
554
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
555
+
556
+ const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
1676
557
 
1677
- const PkhFinalization = (typeof FinalizationRegistry === 'undefined')
558
+ const ExtendedKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1678
559
  ? { register: () => {}, unregister: () => {} }
1679
- : new FinalizationRegistry(ptr => wasm.__wbg_pkh_free(ptr >>> 0, 1));
560
+ : new FinalizationRegistry(ptr => wasm.__wbg_extendedkey_free(ptr >>> 0, 1));
1680
561
 
1681
- export class Pkh {
562
+ export class ExtendedKey {
1682
563
 
1683
564
  static __wrap(ptr) {
1684
565
  ptr = ptr >>> 0;
1685
- const obj = Object.create(Pkh.prototype);
566
+ const obj = Object.create(ExtendedKey.prototype);
1686
567
  obj.__wbg_ptr = ptr;
1687
- PkhFinalization.register(obj, obj.__wbg_ptr, obj);
568
+ ExtendedKeyFinalization.register(obj, obj.__wbg_ptr, obj);
1688
569
  return obj;
1689
570
  }
1690
571
 
1691
572
  __destroy_into_raw() {
1692
573
  const ptr = this.__wbg_ptr;
1693
574
  this.__wbg_ptr = 0;
1694
- PkhFinalization.unregister(this);
575
+ ExtendedKeyFinalization.unregister(this);
1695
576
  return ptr;
1696
577
  }
1697
578
 
1698
579
  free() {
1699
580
  const ptr = this.__destroy_into_raw();
1700
- wasm.__wbg_pkh_free(ptr, 0);
1701
- }
1702
- /**
1703
- * @returns {any}
1704
- */
1705
- toProtobuf() {
1706
- const ret = wasm.pkh_toProtobuf(this.__wbg_ptr);
1707
- if (ret[2]) {
1708
- throw takeFromExternrefTable0(ret[1]);
1709
- }
1710
- return takeFromExternrefTable0(ret[0]);
1711
- }
1712
- /**
1713
- * @param {any} value
1714
- * @returns {Pkh}
1715
- */
1716
- static fromProtobuf(value) {
1717
- const ret = wasm.pkh_fromProtobuf(value);
1718
- if (ret[2]) {
1719
- throw takeFromExternrefTable0(ret[1]);
1720
- }
1721
- return Pkh.__wrap(ret[0]);
581
+ wasm.__wbg_extendedkey_free(ptr, 0);
1722
582
  }
1723
583
  /**
1724
- * @returns {bigint}
584
+ * @returns {Uint8Array}
1725
585
  */
1726
- get m() {
1727
- const ret = wasm.pkh_m(this.__wbg_ptr);
1728
- return BigInt.asUintN(64, ret);
586
+ get chainCode() {
587
+ const ret = wasm.extendedkey_chainCode(this.__wbg_ptr);
588
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
589
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
590
+ return v1;
1729
591
  }
1730
592
  /**
1731
- * @param {bigint} m
1732
- * @param {string[]} hashes
593
+ * @returns {Uint8Array}
1733
594
  */
1734
- constructor(m, hashes) {
1735
- const ptr0 = passArrayJsValueToWasm0(hashes, wasm.__wbindgen_malloc);
1736
- const len0 = WASM_VECTOR_LEN;
1737
- const ret = wasm.pkh_new(m, ptr0, len0);
1738
- this.__wbg_ptr = ret >>> 0;
1739
- PkhFinalization.register(this, this.__wbg_ptr, this);
1740
- return this;
595
+ get publicKey() {
596
+ const ret = wasm.extendedkey_publicKey(this.__wbg_ptr);
597
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
598
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
599
+ return v1;
1741
600
  }
1742
601
  /**
1743
- * @returns {string[]}
602
+ * @returns {Uint8Array | undefined}
1744
603
  */
1745
- get hashes() {
1746
- const ret = wasm.pkh_hashes(this.__wbg_ptr);
1747
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1748
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
604
+ get privateKey() {
605
+ const ret = wasm.extendedkey_privateKey(this.__wbg_ptr);
606
+ let v1;
607
+ if (ret[0] !== 0) {
608
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
609
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
610
+ }
1749
611
  return v1;
1750
612
  }
1751
613
  /**
1752
- * @param {string} hash
1753
- * @returns {Pkh}
614
+ * Derive a child key at the given index
615
+ * @param {number} index
616
+ * @returns {ExtendedKey}
1754
617
  */
1755
- static single(hash) {
1756
- const ptr0 = passStringToWasm0(hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1757
- const len0 = WASM_VECTOR_LEN;
1758
- const ret = wasm.pkh_single(ptr0, len0);
1759
- return Pkh.__wrap(ret);
618
+ deriveChild(index) {
619
+ const ret = wasm.extendedkey_deriveChild(this.__wbg_ptr, index);
620
+ if (ret[2]) {
621
+ throw takeFromExternrefTable0(ret[1]);
622
+ }
623
+ return ExtendedKey.__wrap(ret[0]);
1760
624
  }
1761
625
  }
1762
- if (Symbol.dispose) Pkh.prototype[Symbol.dispose] = Pkh.prototype.free;
626
+ if (Symbol.dispose) ExtendedKey.prototype[Symbol.dispose] = ExtendedKey.prototype.free;
1763
627
 
1764
- const RawTxFinalization = (typeof FinalizationRegistry === 'undefined')
628
+ const GrpcClientFinalization = (typeof FinalizationRegistry === 'undefined')
1765
629
  ? { register: () => {}, unregister: () => {} }
1766
- : new FinalizationRegistry(ptr => wasm.__wbg_rawtx_free(ptr >>> 0, 1));
1767
-
1768
- export class RawTx {
630
+ : new FinalizationRegistry(ptr => wasm.__wbg_grpcclient_free(ptr >>> 0, 1));
1769
631
 
1770
- static __wrap(ptr) {
1771
- ptr = ptr >>> 0;
1772
- const obj = Object.create(RawTx.prototype);
1773
- obj.__wbg_ptr = ptr;
1774
- RawTxFinalization.register(obj, obj.__wbg_ptr, obj);
1775
- return obj;
1776
- }
632
+ export class GrpcClient {
1777
633
 
1778
634
  __destroy_into_raw() {
1779
635
  const ptr = this.__wbg_ptr;
1780
636
  this.__wbg_ptr = 0;
1781
- RawTxFinalization.unregister(this);
637
+ GrpcClientFinalization.unregister(this);
1782
638
  return ptr;
1783
639
  }
1784
640
 
1785
641
  free() {
1786
642
  const ptr = this.__destroy_into_raw();
1787
- wasm.__wbg_rawtx_free(ptr, 0);
1788
- }
1789
- /**
1790
- * Convert to protobuf RawTransaction for sending via gRPC
1791
- * @returns {any}
1792
- */
1793
- toProtobuf() {
1794
- const ret = wasm.rawtx_toProtobuf(this.__wbg_ptr);
1795
- if (ret[2]) {
1796
- throw takeFromExternrefTable0(ret[1]);
1797
- }
1798
- return takeFromExternrefTable0(ret[0]);
1799
- }
1800
- /**
1801
- * @param {any} value
1802
- * @returns {RawTx}
1803
- */
1804
- static fromProtobuf(value) {
1805
- const ret = wasm.rawtx_fromProtobuf(value);
1806
- if (ret[2]) {
1807
- throw takeFromExternrefTable0(ret[1]);
1808
- }
1809
- return RawTx.__wrap(ret[0]);
1810
- }
1811
- /**
1812
- * @returns {NockchainTx}
1813
- */
1814
- toNockchainTx() {
1815
- const ret = wasm.rawtx_toNockchainTx(this.__wbg_ptr);
1816
- if (ret[2]) {
1817
- throw takeFromExternrefTable0(ret[1]);
1818
- }
1819
- return NockchainTx.__wrap(ret[0]);
1820
- }
1821
- /**
1822
- * @returns {Digest}
1823
- */
1824
- get id() {
1825
- const ret = wasm.rawtx_id(this.__wbg_ptr);
1826
- return Digest.__wrap(ret);
643
+ wasm.__wbg_grpcclient_free(ptr, 0);
1827
644
  }
1828
645
  /**
1829
- * @returns {string}
646
+ * Send a transaction
647
+ * @param {PbCom2RawTransaction} raw_tx
648
+ * @returns {Promise<string>}
1830
649
  */
1831
- get name() {
1832
- let deferred1_0;
1833
- let deferred1_1;
1834
- try {
1835
- const ret = wasm.rawtx_name(this.__wbg_ptr);
1836
- deferred1_0 = ret[0];
1837
- deferred1_1 = ret[1];
1838
- return getStringFromWasm0(ret[0], ret[1]);
1839
- } finally {
1840
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1841
- }
650
+ sendTransaction(raw_tx) {
651
+ const ret = wasm.grpcclient_sendTransaction(this.__wbg_ptr, raw_tx);
652
+ return ret;
1842
653
  }
1843
654
  /**
1844
- * Convert to jammed transaction file for inspecting through CLI
1845
- * @returns {Uint8Array}
655
+ * Check if a transaction was accepted
656
+ * @param {string} tx_id
657
+ * @returns {Promise<boolean>}
1846
658
  */
1847
- toJam() {
1848
- const ret = wasm.rawtx_toJam(this.__wbg_ptr);
659
+ transactionAccepted(tx_id) {
660
+ const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
661
+ const len0 = WASM_VECTOR_LEN;
662
+ const ret = wasm.grpcclient_transactionAccepted(this.__wbg_ptr, ptr0, len0);
1849
663
  return ret;
1850
664
  }
1851
665
  /**
1852
- * Calculate output notes from the transaction spends.
1853
- * @returns {Note[]}
666
+ * Get balance for a wallet address
667
+ * @param {string} address
668
+ * @returns {Promise<PbCom2Balance>}
1854
669
  */
1855
- outputs() {
1856
- const ret = wasm.rawtx_outputs(this.__wbg_ptr);
1857
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1858
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1859
- return v1;
670
+ getBalanceByAddress(address) {
671
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
672
+ const len0 = WASM_VECTOR_LEN;
673
+ const ret = wasm.grpcclient_getBalanceByAddress(this.__wbg_ptr, ptr0, len0);
674
+ return ret;
1860
675
  }
1861
676
  /**
1862
- * @returns {Version}
677
+ * Get balance for a first name
678
+ * @param {string} first_name
679
+ * @returns {Promise<PbCom2Balance>}
1863
680
  */
1864
- get version() {
1865
- const ret = wasm.rawtx_version(this.__wbg_ptr);
1866
- return Version.__wrap(ret);
681
+ getBalanceByFirstName(first_name) {
682
+ const ptr0 = passStringToWasm0(first_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
+ const len0 = WASM_VECTOR_LEN;
684
+ const ret = wasm.grpcclient_getBalanceByFirstName(this.__wbg_ptr, ptr0, len0);
685
+ return ret;
1867
686
  }
1868
687
  /**
1869
- * @param {Uint8Array} jam
1870
- * @returns {RawTx}
688
+ * @param {string} endpoint
1871
689
  */
1872
- static fromJam(jam) {
1873
- const ptr0 = passArray8ToWasm0(jam, wasm.__wbindgen_malloc);
690
+ constructor(endpoint) {
691
+ const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1874
692
  const len0 = WASM_VECTOR_LEN;
1875
- const ret = wasm.rawtx_fromJam(ptr0, len0);
1876
- if (ret[2]) {
1877
- throw takeFromExternrefTable0(ret[1]);
1878
- }
1879
- return RawTx.__wrap(ret[0]);
693
+ const ret = wasm.grpcclient_new(ptr0, len0);
694
+ this.__wbg_ptr = ret >>> 0;
695
+ GrpcClientFinalization.register(this, this.__wbg_ptr, this);
696
+ return this;
1880
697
  }
1881
698
  }
1882
- if (Symbol.dispose) RawTx.prototype[Symbol.dispose] = RawTx.prototype.free;
699
+ if (Symbol.dispose) GrpcClient.prototype[Symbol.dispose] = GrpcClient.prototype.free;
1883
700
 
1884
- const SeedFinalization = (typeof FinalizationRegistry === 'undefined')
701
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1885
702
  ? { register: () => {}, unregister: () => {} }
1886
- : new FinalizationRegistry(ptr => wasm.__wbg_seed_free(ptr >>> 0, 1));
1887
-
1888
- export class Seed {
703
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
1889
704
 
1890
- static __wrap(ptr) {
1891
- ptr = ptr >>> 0;
1892
- const obj = Object.create(Seed.prototype);
1893
- obj.__wbg_ptr = ptr;
1894
- SeedFinalization.register(obj, obj.__wbg_ptr, obj);
1895
- return obj;
1896
- }
705
+ export class IntoUnderlyingByteSource {
1897
706
 
1898
707
  __destroy_into_raw() {
1899
708
  const ptr = this.__wbg_ptr;
1900
709
  this.__wbg_ptr = 0;
1901
- SeedFinalization.unregister(this);
710
+ IntoUnderlyingByteSourceFinalization.unregister(this);
1902
711
  return ptr;
1903
712
  }
1904
713
 
1905
714
  free() {
1906
715
  const ptr = this.__destroy_into_raw();
1907
- wasm.__wbg_seed_free(ptr, 0);
1908
- }
1909
- /**
1910
- * @returns {Digest}
1911
- */
1912
- get parentHash() {
1913
- const ret = wasm.seed_parentHash(this.__wbg_ptr);
1914
- return Digest.__wrap(ret);
1915
- }
1916
- /**
1917
- * @returns {Source | undefined}
1918
- */
1919
- get outputSource() {
1920
- const ret = wasm.seed_outputSource(this.__wbg_ptr);
1921
- return ret === 0 ? undefined : Source.__wrap(ret);
1922
- }
1923
- /**
1924
- * @param {LockRoot} lock_root
1925
- */
1926
- set lockRoot(lock_root) {
1927
- _assertClass(lock_root, LockRoot);
1928
- var ptr0 = lock_root.__destroy_into_raw();
1929
- wasm.seed_set_lockRoot(this.__wbg_ptr, ptr0);
1930
- }
1931
- /**
1932
- * @param {NoteData} note_data
1933
- */
1934
- set noteData(note_data) {
1935
- _assertClass(note_data, NoteData);
1936
- var ptr0 = note_data.__destroy_into_raw();
1937
- wasm.seed_set_noteData(this.__wbg_ptr, ptr0);
1938
- }
1939
- /**
1940
- * @param {Digest} pkh
1941
- * @param {bigint} gift
1942
- * @param {Digest} parent_hash
1943
- * @param {boolean} include_lock_data
1944
- * @returns {Seed}
1945
- */
1946
- static newSinglePkh(pkh, gift, parent_hash, include_lock_data) {
1947
- _assertClass(pkh, Digest);
1948
- var ptr0 = pkh.__destroy_into_raw();
1949
- _assertClass(parent_hash, Digest);
1950
- var ptr1 = parent_hash.__destroy_into_raw();
1951
- const ret = wasm.seed_newSinglePkh(ptr0, gift, ptr1, include_lock_data);
1952
- if (ret[2]) {
1953
- throw takeFromExternrefTable0(ret[1]);
1954
- }
1955
- return Seed.__wrap(ret[0]);
1956
- }
1957
- /**
1958
- * @param {Digest} parent_hash
1959
- */
1960
- set parentHash(parent_hash) {
1961
- _assertClass(parent_hash, Digest);
1962
- var ptr0 = parent_hash.__destroy_into_raw();
1963
- wasm.seed_set_parentHash(this.__wbg_ptr, ptr0);
1964
- }
1965
- /**
1966
- * @param {Source | null} [output_source]
1967
- */
1968
- set outputSource(output_source) {
1969
- let ptr0 = 0;
1970
- if (!isLikeNone(output_source)) {
1971
- _assertClass(output_source, Source);
1972
- ptr0 = output_source.__destroy_into_raw();
1973
- }
1974
- wasm.seed_set_outputSource(this.__wbg_ptr, ptr0);
716
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
1975
717
  }
1976
718
  /**
1977
- * @param {Source | null | undefined} output_source
1978
- * @param {LockRoot} lock_root
1979
- * @param {bigint} gift
1980
- * @param {NoteData} note_data
1981
- * @param {Digest} parent_hash
719
+ * @returns {number}
1982
720
  */
1983
- constructor(output_source, lock_root, gift, note_data, parent_hash) {
1984
- let ptr0 = 0;
1985
- if (!isLikeNone(output_source)) {
1986
- _assertClass(output_source, Source);
1987
- ptr0 = output_source.__destroy_into_raw();
1988
- }
1989
- _assertClass(lock_root, LockRoot);
1990
- var ptr1 = lock_root.__destroy_into_raw();
1991
- _assertClass(note_data, NoteData);
1992
- var ptr2 = note_data.__destroy_into_raw();
1993
- _assertClass(parent_hash, Digest);
1994
- var ptr3 = parent_hash.__destroy_into_raw();
1995
- const ret = wasm.seed_new(ptr0, ptr1, gift, ptr2, ptr3);
1996
- this.__wbg_ptr = ret >>> 0;
1997
- SeedFinalization.register(this, this.__wbg_ptr, this);
1998
- return this;
721
+ get autoAllocateChunkSize() {
722
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
723
+ return ret >>> 0;
1999
724
  }
2000
725
  /**
2001
- * @returns {bigint}
726
+ * @param {ReadableByteStreamController} controller
727
+ * @returns {Promise<any>}
2002
728
  */
2003
- get gift() {
2004
- const ret = wasm.seed_gift(this.__wbg_ptr);
2005
- return BigInt.asUintN(64, ret);
729
+ pull(controller) {
730
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
731
+ return ret;
2006
732
  }
2007
733
  /**
2008
- * @param {bigint} gift
734
+ * @param {ReadableByteStreamController} controller
2009
735
  */
2010
- set gift(gift) {
2011
- wasm.seed_set_gift(this.__wbg_ptr, gift);
736
+ start(controller) {
737
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
2012
738
  }
2013
739
  /**
2014
- * @returns {LockRoot}
740
+ * @returns {ReadableStreamType}
2015
741
  */
2016
- get lockRoot() {
2017
- const ret = wasm.seed_lockRoot(this.__wbg_ptr);
2018
- return LockRoot.__wrap(ret);
742
+ get type() {
743
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
744
+ return __wbindgen_enum_ReadableStreamType[ret];
2019
745
  }
2020
- /**
2021
- * @returns {NoteData}
2022
- */
2023
- get noteData() {
2024
- const ret = wasm.seed_noteData(this.__wbg_ptr);
2025
- return NoteData.__wrap(ret);
746
+ cancel() {
747
+ const ptr = this.__destroy_into_raw();
748
+ wasm.intounderlyingbytesource_cancel(ptr);
2026
749
  }
2027
750
  }
2028
- if (Symbol.dispose) Seed.prototype[Symbol.dispose] = Seed.prototype.free;
751
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
2029
752
 
2030
- const SignatureFinalization = (typeof FinalizationRegistry === 'undefined')
753
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
2031
754
  ? { register: () => {}, unregister: () => {} }
2032
- : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0, 1));
2033
-
2034
- export class Signature {
755
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
2035
756
 
2036
- static __wrap(ptr) {
2037
- ptr = ptr >>> 0;
2038
- const obj = Object.create(Signature.prototype);
2039
- obj.__wbg_ptr = ptr;
2040
- SignatureFinalization.register(obj, obj.__wbg_ptr, obj);
2041
- return obj;
2042
- }
757
+ export class IntoUnderlyingSink {
2043
758
 
2044
759
  __destroy_into_raw() {
2045
760
  const ptr = this.__wbg_ptr;
2046
761
  this.__wbg_ptr = 0;
2047
- SignatureFinalization.unregister(this);
762
+ IntoUnderlyingSinkFinalization.unregister(this);
2048
763
  return ptr;
2049
764
  }
2050
765
 
2051
766
  free() {
2052
767
  const ptr = this.__destroy_into_raw();
2053
- wasm.__wbg_signature_free(ptr, 0);
768
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
2054
769
  }
2055
770
  /**
2056
- * @returns {Uint8Array}
771
+ * @param {any} reason
772
+ * @returns {Promise<any>}
2057
773
  */
2058
- get c() {
2059
- const ret = wasm.signature_c(this.__wbg_ptr);
2060
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2061
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2062
- return v1;
774
+ abort(reason) {
775
+ const ptr = this.__destroy_into_raw();
776
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
777
+ return ret;
2063
778
  }
2064
779
  /**
2065
- * @returns {Uint8Array}
780
+ * @returns {Promise<any>}
2066
781
  */
2067
- get s() {
2068
- const ret = wasm.signature_s(this.__wbg_ptr);
2069
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2070
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2071
- return v1;
782
+ close() {
783
+ const ptr = this.__destroy_into_raw();
784
+ const ret = wasm.intounderlyingsink_close(ptr);
785
+ return ret;
2072
786
  }
2073
787
  /**
2074
- * @param {Uint8Array} c
2075
- * @param {Uint8Array} s
788
+ * @param {any} chunk
789
+ * @returns {Promise<any>}
2076
790
  */
2077
- constructor(c, s) {
2078
- const ptr0 = passArray8ToWasm0(c, wasm.__wbindgen_malloc);
2079
- const len0 = WASM_VECTOR_LEN;
2080
- const ptr1 = passArray8ToWasm0(s, wasm.__wbindgen_malloc);
2081
- const len1 = WASM_VECTOR_LEN;
2082
- const ret = wasm.signature_new(ptr0, len0, ptr1, len1);
2083
- this.__wbg_ptr = ret >>> 0;
2084
- SignatureFinalization.register(this, this.__wbg_ptr, this);
2085
- return this;
791
+ write(chunk) {
792
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
793
+ return ret;
2086
794
  }
2087
795
  }
2088
- if (Symbol.dispose) Signature.prototype[Symbol.dispose] = Signature.prototype.free;
796
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
2089
797
 
2090
- const SourceFinalization = (typeof FinalizationRegistry === 'undefined')
798
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2091
799
  ? { register: () => {}, unregister: () => {} }
2092
- : new FinalizationRegistry(ptr => wasm.__wbg_source_free(ptr >>> 0, 1));
2093
-
2094
- export class Source {
800
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
2095
801
 
2096
- static __wrap(ptr) {
2097
- ptr = ptr >>> 0;
2098
- const obj = Object.create(Source.prototype);
2099
- obj.__wbg_ptr = ptr;
2100
- SourceFinalization.register(obj, obj.__wbg_ptr, obj);
2101
- return obj;
2102
- }
802
+ export class IntoUnderlyingSource {
2103
803
 
2104
804
  __destroy_into_raw() {
2105
805
  const ptr = this.__wbg_ptr;
2106
806
  this.__wbg_ptr = 0;
2107
- SourceFinalization.unregister(this);
807
+ IntoUnderlyingSourceFinalization.unregister(this);
2108
808
  return ptr;
2109
809
  }
2110
810
 
2111
811
  free() {
2112
812
  const ptr = this.__destroy_into_raw();
2113
- wasm.__wbg_source_free(ptr, 0);
813
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
2114
814
  }
2115
815
  /**
2116
- * @returns {boolean}
816
+ * @param {ReadableStreamDefaultController} controller
817
+ * @returns {Promise<any>}
2117
818
  */
2118
- get isCoinbase() {
2119
- const ret = wasm.source_isCoinbase(this.__wbg_ptr);
2120
- return ret !== 0;
819
+ pull(controller) {
820
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
821
+ return ret;
2121
822
  }
2122
- /**
2123
- * @returns {Digest}
2124
- */
2125
- get hash() {
2126
- const ret = wasm.source_hash(this.__wbg_ptr);
2127
- return Digest.__wrap(ret);
823
+ cancel() {
824
+ const ptr = this.__destroy_into_raw();
825
+ wasm.intounderlyingsource_cancel(ptr);
2128
826
  }
2129
827
  }
2130
- if (Symbol.dispose) Source.prototype[Symbol.dispose] = Source.prototype.free;
828
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
2131
829
 
2132
830
  const SpendBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
2133
831
  ? { register: () => {}, unregister: () => {} }
@@ -2155,17 +853,13 @@ export class SpendBuilder {
2155
853
  wasm.__wbg_spendbuilder_free(ptr, 0);
2156
854
  }
2157
855
  /**
2158
- * Get current refund
2159
- * @returns {Seed | undefined}
856
+ * @returns {SeedV1 | undefined}
2160
857
  */
2161
858
  curRefund() {
2162
859
  const ret = wasm.spendbuilder_curRefund(this.__wbg_ptr);
2163
- return ret === 0 ? undefined : Seed.__wrap(ret);
860
+ return ret;
2164
861
  }
2165
862
  /**
2166
- * Checks whether note.assets = seeds + fee
2167
- *
2168
- * This function needs to return true for `TxBuilder::validate` to pass
2169
863
  * @returns {boolean}
2170
864
  */
2171
865
  isBalanced() {
@@ -2173,7 +867,6 @@ export class SpendBuilder {
2173
867
  return ret !== 0;
2174
868
  }
2175
869
  /**
2176
- * Attatch a preimage to this spend
2177
870
  * @param {Uint8Array} preimage_jam
2178
871
  * @returns {Digest | undefined}
2179
872
  */
@@ -2184,35 +877,19 @@ export class SpendBuilder {
2184
877
  if (ret[2]) {
2185
878
  throw takeFromExternrefTable0(ret[1]);
2186
879
  }
2187
- return ret[0] === 0 ? undefined : Digest.__wrap(ret[0]);
880
+ return takeFromExternrefTable0(ret[0]);
2188
881
  }
2189
882
  /**
2190
- * Compute refund from any spare assets, given `refund_lock` was passed
2191
883
  * @param {boolean} include_lock_data
2192
884
  */
2193
885
  computeRefund(include_lock_data) {
2194
886
  wasm.spendbuilder_computeRefund(this.__wbg_ptr, include_lock_data);
2195
887
  }
2196
- /**
2197
- * Manually invalidate signatures
2198
- *
2199
- * Each spend's fee+seeds are bound to one or more signatures. If they get changed, the
2200
- * signature becomes invalid. This builder automatically invalidates signatures upon relevant
2201
- * modifications, but this functionality is provided nonetheless.
2202
- */
2203
888
  invalidateSigs() {
2204
889
  wasm.spendbuilder_invalidateSigs(this.__wbg_ptr);
2205
890
  }
2206
891
  /**
2207
- * Get the list of missing "unlocks"
2208
- *
2209
- * An unlock is a spend condition to be satisfied. For instance, for a `Pkh` spend condition,
2210
- * if the transaction is unsigned, this function will return a Pkh type missing unlock, with
2211
- * the list of valid PKH's and number of signatures needed. This will not return PKHs that are
2212
- * already attatched to the spend (relevant for multisigs). For `Hax` spend condition, this
2213
- * will return any missing preimages. This function will return a list of not-yet-validated
2214
- * spend conditions.
2215
- * @returns {any[]}
892
+ * @returns {MissingUnlocks[]}
2216
893
  */
2217
894
  missingUnlocks() {
2218
895
  const ret = wasm.spendbuilder_missingUnlocks(this.__wbg_ptr);
@@ -2224,8 +901,7 @@ export class SpendBuilder {
2224
901
  return v1;
2225
902
  }
2226
903
  /**
2227
- * Set the fee of this spend
2228
- * @param {bigint} fee
904
+ * @param {Nicks} fee
2229
905
  */
2230
906
  fee(fee) {
2231
907
  wasm.spendbuilder_fee(this.__wbg_ptr, fee);
@@ -2237,19 +913,7 @@ export class SpendBuilder {
2237
913
  * @param {SpendCondition | null} [refund_lock]
2238
914
  */
2239
915
  constructor(note, spend_condition, refund_lock) {
2240
- _assertClass(note, Note);
2241
- var ptr0 = note.__destroy_into_raw();
2242
- let ptr1 = 0;
2243
- if (!isLikeNone(spend_condition)) {
2244
- _assertClass(spend_condition, SpendCondition);
2245
- ptr1 = spend_condition.__destroy_into_raw();
2246
- }
2247
- let ptr2 = 0;
2248
- if (!isLikeNone(refund_lock)) {
2249
- _assertClass(refund_lock, SpendCondition);
2250
- ptr2 = refund_lock.__destroy_into_raw();
2251
- }
2252
- const ret = wasm.spendbuilder_new(ptr0, ptr1, ptr2);
916
+ const ret = wasm.spendbuilder_new(note, isLikeNone(spend_condition) ? 0 : addToExternrefTable0(spend_condition), isLikeNone(refund_lock) ? 0 : addToExternrefTable0(refund_lock));
2253
917
  if (ret[2]) {
2254
918
  throw takeFromExternrefTable0(ret[1]);
2255
919
  }
@@ -2258,24 +922,15 @@ export class SpendBuilder {
2258
922
  return this;
2259
923
  }
2260
924
  /**
2261
- * Add seed to this spend
2262
- *
2263
- * Seed is an output with a recipient (as defined by the spend condition).
2264
- *
2265
- * Nockchain transaction engine will take all seeds with matching lock from all spends in the
2266
- * transaction, and merge them into one output note.
2267
- * @param {Seed} seed
925
+ * @param {SeedV1} seed
2268
926
  */
2269
927
  seed(seed) {
2270
- _assertClass(seed, Seed);
2271
- var ptr0 = seed.__destroy_into_raw();
2272
- const ret = wasm.spendbuilder_seed(this.__wbg_ptr, ptr0);
928
+ const ret = wasm.spendbuilder_seed(this.__wbg_ptr, seed);
2273
929
  if (ret[1]) {
2274
930
  throw takeFromExternrefTable0(ret[0]);
2275
931
  }
2276
932
  }
2277
933
  /**
2278
- * Sign the transaction with a given private key
2279
934
  * @param {Uint8Array} signing_key_bytes
2280
935
  * @returns {boolean}
2281
936
  */
@@ -2291,211 +946,6 @@ export class SpendBuilder {
2291
946
  }
2292
947
  if (Symbol.dispose) SpendBuilder.prototype[Symbol.dispose] = SpendBuilder.prototype.free;
2293
948
 
2294
- const SpendConditionFinalization = (typeof FinalizationRegistry === 'undefined')
2295
- ? { register: () => {}, unregister: () => {} }
2296
- : new FinalizationRegistry(ptr => wasm.__wbg_spendcondition_free(ptr >>> 0, 1));
2297
-
2298
- export class SpendCondition {
2299
-
2300
- static __wrap(ptr) {
2301
- ptr = ptr >>> 0;
2302
- const obj = Object.create(SpendCondition.prototype);
2303
- obj.__wbg_ptr = ptr;
2304
- SpendConditionFinalization.register(obj, obj.__wbg_ptr, obj);
2305
- return obj;
2306
- }
2307
-
2308
- static __unwrap(jsValue) {
2309
- if (!(jsValue instanceof SpendCondition)) {
2310
- return 0;
2311
- }
2312
- return jsValue.__destroy_into_raw();
2313
- }
2314
-
2315
- __destroy_into_raw() {
2316
- const ptr = this.__wbg_ptr;
2317
- this.__wbg_ptr = 0;
2318
- SpendConditionFinalization.unregister(this);
2319
- return ptr;
2320
- }
2321
-
2322
- free() {
2323
- const ptr = this.__destroy_into_raw();
2324
- wasm.__wbg_spendcondition_free(ptr, 0);
2325
- }
2326
- /**
2327
- * @returns {Digest}
2328
- */
2329
- firstName() {
2330
- const ret = wasm.spendcondition_firstName(this.__wbg_ptr);
2331
- if (ret[2]) {
2332
- throw takeFromExternrefTable0(ret[1]);
2333
- }
2334
- return Digest.__wrap(ret[0]);
2335
- }
2336
- /**
2337
- * @returns {any}
2338
- */
2339
- toProtobuf() {
2340
- const ret = wasm.spendcondition_toProtobuf(this.__wbg_ptr);
2341
- if (ret[2]) {
2342
- throw takeFromExternrefTable0(ret[1]);
2343
- }
2344
- return takeFromExternrefTable0(ret[0]);
2345
- }
2346
- /**
2347
- * @param {any} value
2348
- * @returns {SpendCondition}
2349
- */
2350
- static fromProtobuf(value) {
2351
- const ret = wasm.spendcondition_fromProtobuf(value);
2352
- if (ret[2]) {
2353
- throw takeFromExternrefTable0(ret[1]);
2354
- }
2355
- return SpendCondition.__wrap(ret[0]);
2356
- }
2357
- /**
2358
- * @param {LockPrimitive[]} primitives
2359
- */
2360
- constructor(primitives) {
2361
- const ptr0 = passArrayJsValueToWasm0(primitives, wasm.__wbindgen_malloc);
2362
- const len0 = WASM_VECTOR_LEN;
2363
- const ret = wasm.spendcondition_new(ptr0, len0);
2364
- this.__wbg_ptr = ret >>> 0;
2365
- SpendConditionFinalization.register(this, this.__wbg_ptr, this);
2366
- return this;
2367
- }
2368
- /**
2369
- * @returns {Digest}
2370
- */
2371
- hash() {
2372
- const ret = wasm.spendcondition_hash(this.__wbg_ptr);
2373
- if (ret[2]) {
2374
- throw takeFromExternrefTable0(ret[1]);
2375
- }
2376
- return Digest.__wrap(ret[0]);
2377
- }
2378
- /**
2379
- * @param {Pkh} pkh
2380
- * @returns {SpendCondition}
2381
- */
2382
- static newPkh(pkh) {
2383
- _assertClass(pkh, Pkh);
2384
- var ptr0 = pkh.__destroy_into_raw();
2385
- const ret = wasm.spendcondition_newPkh(ptr0);
2386
- return SpendCondition.__wrap(ret);
2387
- }
2388
- }
2389
- if (Symbol.dispose) SpendCondition.prototype[Symbol.dispose] = SpendCondition.prototype.free;
2390
-
2391
- const TimelockFinalization = (typeof FinalizationRegistry === 'undefined')
2392
- ? { register: () => {}, unregister: () => {} }
2393
- : new FinalizationRegistry(ptr => wasm.__wbg_timelock_free(ptr >>> 0, 1));
2394
- /**
2395
- * Timelock for V0 (legacy) notes
2396
- *
2397
- * This is similar to LockTim but used for v0 notes' timelock constraints.
2398
- * At least one constraint (min or max in either rel or abs) must be set.
2399
- */
2400
- export class Timelock {
2401
-
2402
- __destroy_into_raw() {
2403
- const ptr = this.__wbg_ptr;
2404
- this.__wbg_ptr = 0;
2405
- TimelockFinalization.unregister(this);
2406
- return ptr;
2407
- }
2408
-
2409
- free() {
2410
- const ptr = this.__destroy_into_raw();
2411
- wasm.__wbg_timelock_free(ptr, 0);
2412
- }
2413
- /**
2414
- * @returns {TimelockRange}
2415
- */
2416
- get abs() {
2417
- const ret = wasm.locktim_abs(this.__wbg_ptr);
2418
- return TimelockRange.__wrap(ret);
2419
- }
2420
- /**
2421
- * @param {TimelockRange} rel
2422
- * @param {TimelockRange} abs
2423
- */
2424
- constructor(rel, abs) {
2425
- _assertClass(rel, TimelockRange);
2426
- var ptr0 = rel.__destroy_into_raw();
2427
- _assertClass(abs, TimelockRange);
2428
- var ptr1 = abs.__destroy_into_raw();
2429
- const ret = wasm.timelock_new(ptr0, ptr1);
2430
- if (ret[2]) {
2431
- throw takeFromExternrefTable0(ret[1]);
2432
- }
2433
- this.__wbg_ptr = ret[0] >>> 0;
2434
- TimelockFinalization.register(this, this.__wbg_ptr, this);
2435
- return this;
2436
- }
2437
- /**
2438
- * @returns {TimelockRange}
2439
- */
2440
- get rel() {
2441
- const ret = wasm.locktim_rel(this.__wbg_ptr);
2442
- return TimelockRange.__wrap(ret);
2443
- }
2444
- }
2445
- if (Symbol.dispose) Timelock.prototype[Symbol.dispose] = Timelock.prototype.free;
2446
-
2447
- const TimelockRangeFinalization = (typeof FinalizationRegistry === 'undefined')
2448
- ? { register: () => {}, unregister: () => {} }
2449
- : new FinalizationRegistry(ptr => wasm.__wbg_timelockrange_free(ptr >>> 0, 1));
2450
-
2451
- export class TimelockRange {
2452
-
2453
- static __wrap(ptr) {
2454
- ptr = ptr >>> 0;
2455
- const obj = Object.create(TimelockRange.prototype);
2456
- obj.__wbg_ptr = ptr;
2457
- TimelockRangeFinalization.register(obj, obj.__wbg_ptr, obj);
2458
- return obj;
2459
- }
2460
-
2461
- __destroy_into_raw() {
2462
- const ptr = this.__wbg_ptr;
2463
- this.__wbg_ptr = 0;
2464
- TimelockRangeFinalization.unregister(this);
2465
- return ptr;
2466
- }
2467
-
2468
- free() {
2469
- const ptr = this.__destroy_into_raw();
2470
- wasm.__wbg_timelockrange_free(ptr, 0);
2471
- }
2472
- /**
2473
- * @returns {bigint | undefined}
2474
- */
2475
- get max() {
2476
- const ret = wasm.timelockrange_max(this.__wbg_ptr);
2477
- return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
2478
- }
2479
- /**
2480
- * @returns {bigint | undefined}
2481
- */
2482
- get min() {
2483
- const ret = wasm.timelockrange_min(this.__wbg_ptr);
2484
- return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
2485
- }
2486
- /**
2487
- * @param {bigint | null} [min]
2488
- * @param {bigint | null} [max]
2489
- */
2490
- constructor(min, max) {
2491
- const ret = wasm.timelockrange_new(!isLikeNone(min), isLikeNone(min) ? BigInt(0) : min, !isLikeNone(max), isLikeNone(max) ? BigInt(0) : max);
2492
- this.__wbg_ptr = ret >>> 0;
2493
- TimelockRangeFinalization.register(this, this.__wbg_ptr, this);
2494
- return this;
2495
- }
2496
- }
2497
- if (Symbol.dispose) TimelockRange.prototype[Symbol.dispose] = TimelockRange.prototype.free;
2498
-
2499
949
  const TxBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
2500
950
  ? { register: () => {}, unregister: () => {} }
2501
951
  : new FinalizationRegistry(ptr => wasm.__wbg_txbuilder_free(ptr >>> 0, 1));
@@ -2531,7 +981,6 @@ export class TxBuilder {
2531
981
  return v1;
2532
982
  }
2533
983
  /**
2534
- * Appends `preimage_jam` to all spend conditions that expect this preimage.
2535
984
  * @param {Uint8Array} preimage_jam
2536
985
  * @returns {Digest | undefined}
2537
986
  */
@@ -2542,47 +991,14 @@ export class TxBuilder {
2542
991
  if (ret[2]) {
2543
992
  throw takeFromExternrefTable0(ret[1]);
2544
993
  }
2545
- return ret[0] === 0 ? undefined : Digest.__wrap(ret[0]);
994
+ return takeFromExternrefTable0(ret[0]);
2546
995
  }
2547
996
  /**
2548
- * Perform a simple-spend on this builder.
2549
- *
2550
- * It is HIGHLY recommended to not mix `simpleSpend` with other types of spends.
2551
- *
2552
- * This performs a fairly complex set of operations, in order to mimic behavior of nockchain
2553
- * CLI wallet's create-tx option. Note that we do not do 1-1 mapping of that functionality,
2554
- * most notably - if `recipient` is the same as `refund_pkh`, we will create 1 seed, while the
2555
- * CLI wallet will create 2.
2556
- *
2557
- * Another difference is that you should call `sign` and `validate` after calling this method.
2558
- *
2559
- * Internally, the transaction builder takes ALL of the `notes` provided, and stores them for
2560
- * fee adjustments. If there are multiple notes being used, our fee setup also differs from
2561
- * the CLI, because we first greedily spend the notes out, and then take fees from any
2562
- * remaining refunds.
2563
- *
2564
- * This function prioritizes using the least number of notes possible, because that lowers the
2565
- * fee used.
2566
- *
2567
- * You may choose to override the fee with `fee_override`, but do note that `validate` will
2568
- * fail, in case this fee is too small.
2569
- *
2570
- * `include_lock_data` can be used to include `%lock` key in note-data, with the
2571
- * `SpendCondition` used. However, note-data costs 1 << 15 nicks, which means, it can get
2572
- * expensive.
2573
- *
2574
- * Optional parameter `remove_unused_notes`, if set to false, will keep the notes in the
2575
- * transaction builder. This is meant to be used whenever additional operations are performed
2576
- * on the builder, such as additional spends, or `addPreimage` calls. All of these increase
2577
- * the required fee (which can be checked with `calcFee`), and unused notes can then be used
2578
- * to adjust fees with `setFeeAndBalanceRefund` or `recalcAndSetFee`. Once all operations are
2579
- * done, one should call `removeUnusedNotes` to ensure these notes are not used within the
2580
- * transaction.
2581
997
  * @param {Note[]} notes
2582
998
  * @param {SpendCondition[]} spend_conditions
2583
999
  * @param {Digest} recipient
2584
- * @param {bigint} gift
2585
- * @param {bigint | null | undefined} fee_override
1000
+ * @param {Nicks} gift
1001
+ * @param {Nicks | null | undefined} fee_override
2586
1002
  * @param {Digest} refund_pkh
2587
1003
  * @param {boolean} include_lock_data
2588
1004
  */
@@ -2591,17 +1007,12 @@ export class TxBuilder {
2591
1007
  const len0 = WASM_VECTOR_LEN;
2592
1008
  const ptr1 = passArrayJsValueToWasm0(spend_conditions, wasm.__wbindgen_malloc);
2593
1009
  const len1 = WASM_VECTOR_LEN;
2594
- _assertClass(recipient, Digest);
2595
- var ptr2 = recipient.__destroy_into_raw();
2596
- _assertClass(refund_pkh, Digest);
2597
- var ptr3 = refund_pkh.__destroy_into_raw();
2598
- const ret = wasm.txbuilder_simpleSpend(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, gift, !isLikeNone(fee_override), isLikeNone(fee_override) ? BigInt(0) : fee_override, ptr3, include_lock_data);
1010
+ const ret = wasm.txbuilder_simpleSpend(this.__wbg_ptr, ptr0, len0, ptr1, len1, recipient, gift, isLikeNone(fee_override) ? 0 : addToExternrefTable0(fee_override), refund_pkh, include_lock_data);
2599
1011
  if (ret[1]) {
2600
1012
  throw takeFromExternrefTable0(ret[0]);
2601
1013
  }
2602
1014
  }
2603
1015
  /**
2604
- * Recalculate fee and set it, balancing things out with refunds
2605
1016
  * @param {boolean} include_lock_data
2606
1017
  */
2607
1018
  recalcAndSetFee(include_lock_data) {
@@ -2611,14 +1022,7 @@ export class TxBuilder {
2611
1022
  }
2612
1023
  }
2613
1024
  /**
2614
- * Distributes `fee` across builder's spends, and balances refunds out
2615
- *
2616
- * `adjust_fee` parameter allows the fee to be slightly tweaked, whenever notes are added or
2617
- * removed to/from the builder's fee note pool. This is because using more or less notes
2618
- * impacts the exact fee being required. If the caller estimates fee and sets it, adding more
2619
- * notes will change the exact fee needed, and setting this parameter to true will allow one
2620
- * to not have to call this function multiple times.
2621
- * @param {bigint} fee
1025
+ * @param {Nicks} fee
2622
1026
  * @param {boolean} adjust_fee
2623
1027
  * @param {boolean} include_lock_data
2624
1028
  */
@@ -2630,7 +1034,7 @@ export class TxBuilder {
2630
1034
  }
2631
1035
  /**
2632
1036
  * Create an empty transaction builder
2633
- * @param {bigint} fee_per_word
1037
+ * @param {Nicks} fee_per_word
2634
1038
  */
2635
1039
  constructor(fee_per_word) {
2636
1040
  const ret = wasm.txbuilder_new(fee_per_word);
@@ -2639,9 +1043,6 @@ export class TxBuilder {
2639
1043
  return this;
2640
1044
  }
2641
1045
  /**
2642
- * Sign the transaction with a private key.
2643
- *
2644
- * This will sign all spends that are still missing signature from
2645
1046
  * @param {Uint8Array} signing_key_bytes
2646
1047
  */
2647
1048
  sign(signing_key_bytes) {
@@ -2660,7 +1061,7 @@ export class TxBuilder {
2660
1061
  if (ret[2]) {
2661
1062
  throw takeFromExternrefTable0(ret[1]);
2662
1063
  }
2663
- return NockchainTx.__wrap(ret[0]);
1064
+ return takeFromExternrefTable0(ret[0]);
2664
1065
  }
2665
1066
  /**
2666
1067
  * Append a `SpendBuilder` to this transaction
@@ -2674,54 +1075,37 @@ export class TxBuilder {
2674
1075
  return ret === 0 ? undefined : SpendBuilder.__wrap(ret);
2675
1076
  }
2676
1077
  /**
2677
- * Gets the current fee set on all spends.
2678
- * @returns {bigint}
1078
+ * @returns {Nicks}
2679
1079
  */
2680
1080
  curFee() {
2681
1081
  const ret = wasm.txbuilder_curFee(this.__wbg_ptr);
2682
- return BigInt.asUintN(64, ret);
1082
+ return ret;
2683
1083
  }
2684
1084
  /**
2685
1085
  * Reconstruct a builder from raw transaction and its input notes.
2686
- *
2687
- * To get the builder back, you must pass the notes and their corresponding spend conditions.
2688
- * If serializing the builder, call `WasmTxBuilder::all_notes`.
2689
1086
  * @param {RawTx} tx
2690
1087
  * @param {Note[]} notes
2691
1088
  * @param {SpendCondition[]} spend_conditions
2692
1089
  * @returns {TxBuilder}
2693
1090
  */
2694
1091
  static fromTx(tx, notes, spend_conditions) {
2695
- _assertClass(tx, RawTx);
2696
- var ptr0 = tx.__destroy_into_raw();
2697
- const ptr1 = passArrayJsValueToWasm0(notes, wasm.__wbindgen_malloc);
1092
+ const ptr0 = passArrayJsValueToWasm0(notes, wasm.__wbindgen_malloc);
1093
+ const len0 = WASM_VECTOR_LEN;
1094
+ const ptr1 = passArrayJsValueToWasm0(spend_conditions, wasm.__wbindgen_malloc);
2698
1095
  const len1 = WASM_VECTOR_LEN;
2699
- const ptr2 = passArrayJsValueToWasm0(spend_conditions, wasm.__wbindgen_malloc);
2700
- const len2 = WASM_VECTOR_LEN;
2701
- const ret = wasm.txbuilder_fromTx(ptr0, ptr1, len1, ptr2, len2);
1096
+ const ret = wasm.txbuilder_fromTx(tx, ptr0, len0, ptr1, len1);
2702
1097
  if (ret[2]) {
2703
1098
  throw takeFromExternrefTable0(ret[1]);
2704
1099
  }
2705
1100
  return TxBuilder.__wrap(ret[0]);
2706
1101
  }
2707
1102
  /**
2708
- * Calculates the fee needed for the transaction.
2709
- *
2710
- * NOTE: if the transaction is unsigned, this function will estimate the fee needed, supposing
2711
- * all signatures are added. However, this heuristic is only accurate for one signature. In
2712
- * addition, this fee calculation does not estimate the size of missing preimages.
2713
- *
2714
- * So, first, add missing preimages, and only then calc the fee. If you're building a multisig
2715
- * transaction, this value might be incorrect.
2716
- * @returns {bigint}
1103
+ * @returns {Nicks}
2717
1104
  */
2718
1105
  calcFee() {
2719
1106
  const ret = wasm.txbuilder_calcFee(this.__wbg_ptr);
2720
- return BigInt.asUintN(64, ret);
1107
+ return ret;
2721
1108
  }
2722
- /**
2723
- * Validate the transaction.
2724
- */
2725
1109
  validate() {
2726
1110
  const ret = wasm.txbuilder_validate(this.__wbg_ptr);
2727
1111
  if (ret[1]) {
@@ -2736,155 +1120,10 @@ export class TxBuilder {
2736
1120
  if (ret[2]) {
2737
1121
  throw takeFromExternrefTable0(ret[1]);
2738
1122
  }
2739
- return TxNotes.__wrap(ret[0]);
2740
- }
2741
- }
2742
- if (Symbol.dispose) TxBuilder.prototype[Symbol.dispose] = TxBuilder.prototype.free;
2743
-
2744
- const TxNotesFinalization = (typeof FinalizationRegistry === 'undefined')
2745
- ? { register: () => {}, unregister: () => {} }
2746
- : new FinalizationRegistry(ptr => wasm.__wbg_txnotes_free(ptr >>> 0, 1));
2747
-
2748
- export class TxNotes {
2749
-
2750
- static __wrap(ptr) {
2751
- ptr = ptr >>> 0;
2752
- const obj = Object.create(TxNotes.prototype);
2753
- obj.__wbg_ptr = ptr;
2754
- TxNotesFinalization.register(obj, obj.__wbg_ptr, obj);
2755
- return obj;
2756
- }
2757
-
2758
- __destroy_into_raw() {
2759
- const ptr = this.__wbg_ptr;
2760
- this.__wbg_ptr = 0;
2761
- TxNotesFinalization.unregister(this);
2762
- return ptr;
2763
- }
2764
-
2765
- free() {
2766
- const ptr = this.__destroy_into_raw();
2767
- wasm.__wbg_txnotes_free(ptr, 0);
2768
- }
2769
- /**
2770
- * @returns {SpendCondition[]}
2771
- */
2772
- get spendConditions() {
2773
- const ret = wasm.txnotes_spendConditions(this.__wbg_ptr);
2774
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2775
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2776
- return v1;
2777
- }
2778
- /**
2779
- * @returns {Note[]}
2780
- */
2781
- get notes() {
2782
- const ret = wasm.txnotes_notes(this.__wbg_ptr);
2783
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2784
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2785
- return v1;
2786
- }
2787
- }
2788
- if (Symbol.dispose) TxNotes.prototype[Symbol.dispose] = TxNotes.prototype.free;
2789
-
2790
- const VersionFinalization = (typeof FinalizationRegistry === 'undefined')
2791
- ? { register: () => {}, unregister: () => {} }
2792
- : new FinalizationRegistry(ptr => wasm.__wbg_version_free(ptr >>> 0, 1));
2793
-
2794
- export class Version {
2795
-
2796
- static __wrap(ptr) {
2797
- ptr = ptr >>> 0;
2798
- const obj = Object.create(Version.prototype);
2799
- obj.__wbg_ptr = ptr;
2800
- VersionFinalization.register(obj, obj.__wbg_ptr, obj);
2801
- return obj;
2802
- }
2803
-
2804
- __destroy_into_raw() {
2805
- const ptr = this.__wbg_ptr;
2806
- this.__wbg_ptr = 0;
2807
- VersionFinalization.unregister(this);
2808
- return ptr;
2809
- }
2810
-
2811
- free() {
2812
- const ptr = this.__destroy_into_raw();
2813
- wasm.__wbg_version_free(ptr, 0);
2814
- }
2815
- /**
2816
- * @returns {Version}
2817
- */
2818
- static V0() {
2819
- const ret = wasm.version_V0();
2820
- return Version.__wrap(ret);
2821
- }
2822
- /**
2823
- * @returns {Version}
2824
- */
2825
- static V1() {
2826
- const ret = wasm.version_V1();
2827
- return Version.__wrap(ret);
2828
- }
2829
- /**
2830
- * @returns {Version}
2831
- */
2832
- static V2() {
2833
- const ret = wasm.version_V2();
2834
- return Version.__wrap(ret);
2835
- }
2836
- /**
2837
- * @param {number} version
2838
- */
2839
- constructor(version) {
2840
- const ret = wasm.version_new(version);
2841
- this.__wbg_ptr = ret >>> 0;
2842
- VersionFinalization.register(this, this.__wbg_ptr, this);
2843
- return this;
2844
- }
2845
- }
2846
- if (Symbol.dispose) Version.prototype[Symbol.dispose] = Version.prototype.free;
2847
-
2848
- const WasmSeedFinalization = (typeof FinalizationRegistry === 'undefined')
2849
- ? { register: () => {}, unregister: () => {} }
2850
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmseed_free(ptr >>> 0, 1));
2851
-
2852
- export class WasmSeed {
2853
-
2854
- __destroy_into_raw() {
2855
- const ptr = this.__wbg_ptr;
2856
- this.__wbg_ptr = 0;
2857
- WasmSeedFinalization.unregister(this);
2858
- return ptr;
2859
- }
2860
-
2861
- free() {
2862
- const ptr = this.__destroy_into_raw();
2863
- wasm.__wbg_wasmseed_free(ptr, 0);
2864
- }
2865
- /**
2866
- * @returns {any}
2867
- */
2868
- toProtobuf() {
2869
- const ret = wasm.wasmseed_toProtobuf(this.__wbg_ptr);
2870
- if (ret[2]) {
2871
- throw takeFromExternrefTable0(ret[1]);
2872
- }
2873
1123
  return takeFromExternrefTable0(ret[0]);
2874
1124
  }
2875
- /**
2876
- * @param {any} value
2877
- * @returns {Seed}
2878
- */
2879
- static fromProtobuf(value) {
2880
- const ret = wasm.wasmseed_fromProtobuf(value);
2881
- if (ret[2]) {
2882
- throw takeFromExternrefTable0(ret[1]);
2883
- }
2884
- return Seed.__wrap(ret[0]);
2885
- }
2886
1125
  }
2887
- if (Symbol.dispose) WasmSeed.prototype[Symbol.dispose] = WasmSeed.prototype.free;
1126
+ if (Symbol.dispose) TxBuilder.prototype[Symbol.dispose] = TxBuilder.prototype.free;
2888
1127
 
2889
1128
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
2890
1129
 
@@ -3055,14 +1294,6 @@ function __wbg_get_imports() {
3055
1294
  imports.wbg.__wbg_close_6956df845478561a = function() { return handleError(function (arg0) {
3056
1295
  arg0.close();
3057
1296
  }, arguments) };
3058
- imports.wbg.__wbg_digest_new = function(arg0) {
3059
- const ret = Digest.__wrap(arg0);
3060
- return ret;
3061
- };
3062
- imports.wbg.__wbg_digest_unwrap = function(arg0) {
3063
- const ret = Digest.__unwrap(arg0);
3064
- return ret;
3065
- };
3066
1297
  imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
3067
1298
  const ret = arg0.done;
3068
1299
  return ret;
@@ -3164,10 +1395,6 @@ function __wbg_get_imports() {
3164
1395
  const ret = arg0.length;
3165
1396
  return ret;
3166
1397
  };
3167
- imports.wbg.__wbg_lockprimitive_unwrap = function(arg0) {
3168
- const ret = LockPrimitive.__unwrap(arg0);
3169
- return ret;
3170
- };
3171
1398
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
3172
1399
  const ret = new Object();
3173
1400
  return ret;
@@ -3230,22 +1457,6 @@ function __wbg_get_imports() {
3230
1457
  const ret = arg0.next;
3231
1458
  return ret;
3232
1459
  };
3233
- imports.wbg.__wbg_note_new = function(arg0) {
3234
- const ret = Note.__wrap(arg0);
3235
- return ret;
3236
- };
3237
- imports.wbg.__wbg_note_unwrap = function(arg0) {
3238
- const ret = Note.__unwrap(arg0);
3239
- return ret;
3240
- };
3241
- imports.wbg.__wbg_notedataentry_new = function(arg0) {
3242
- const ret = NoteDataEntry.__wrap(arg0);
3243
- return ret;
3244
- };
3245
- imports.wbg.__wbg_notedataentry_unwrap = function(arg0) {
3246
- const ret = NoteDataEntry.__unwrap(arg0);
3247
- return ret;
3248
- };
3249
1460
  imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
3250
1461
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
3251
1462
  };
@@ -3313,14 +1524,6 @@ function __wbg_get_imports() {
3313
1524
  const ret = SpendBuilder.__wrap(arg0);
3314
1525
  return ret;
3315
1526
  };
3316
- imports.wbg.__wbg_spendcondition_new = function(arg0) {
3317
- const ret = SpendCondition.__wrap(arg0);
3318
- return ret;
3319
- };
3320
- imports.wbg.__wbg_spendcondition_unwrap = function(arg0) {
3321
- const ret = SpendCondition.__unwrap(arg0);
3322
- return ret;
3323
- };
3324
1527
  imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
3325
1528
  const ret = typeof global === 'undefined' ? null : global;
3326
1529
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -3361,6 +1564,11 @@ function __wbg_get_imports() {
3361
1564
  const ret = arg0.view;
3362
1565
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3363
1566
  };
1567
+ imports.wbg.__wbindgen_cast_08298b8ed11def05 = function(arg0, arg1) {
1568
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 335, function: Function { arguments: [Externref], shim_idx: 336, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1569
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h20e54f17b0de8c43, wasm_bindgen__convert__closures_____invoke__hbf186e27576c509b);
1570
+ return ret;
1571
+ };
3364
1572
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3365
1573
  // Cast intrinsic for `Ref(String) -> Externref`.
3366
1574
  const ret = getStringFromWasm0(arg0, arg1);
@@ -3371,11 +1579,6 @@ function __wbg_get_imports() {
3371
1579
  const ret = BigInt.asUintN(64, arg0);
3372
1580
  return ret;
3373
1581
  };
3374
- imports.wbg.__wbindgen_cast_8b855ba391b91225 = function(arg0, arg1) {
3375
- // Cast intrinsic for `Closure(Closure { dtor_idx: 285, function: Function { arguments: [Externref], shim_idx: 286, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3376
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h20e54f17b0de8c43, wasm_bindgen__convert__closures_____invoke__hbf186e27576c509b);
3377
- return ret;
3378
- };
3379
1582
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
3380
1583
  // Cast intrinsic for `I64 -> Externref`.
3381
1584
  const ret = arg0;