@dignetwork/chip35-dl-coin-wasm 0.3.0 → 0.4.0

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.
@@ -3,6 +3,22 @@
3
3
 
4
4
  export function addFee(spender_synthetic_key: Uint8Array, selected_coins: any, assert_coin_ids: any, fee: bigint): any;
5
5
 
6
+ /**
7
+ * Build the (UNSIGNED) DIG CAT coin spends paying `amount` base units of DIG to the treasury
8
+ * (100 DIG = 100000n to mint, 10 DIG = 10000n per update), returning change to the owner. The
9
+ * app concatenates these with the singleton mint/update spends and has the wallet sign the WHOLE
10
+ * bundle in ONE call — the single aggregated signature makes the store creation and the DIG
11
+ * payment atomic (all-or-nothing in the mempool).
12
+ *
13
+ * `owner_synthetic_key` (48 bytes) is the wallet's synthetic public key — the SAME key used for
14
+ * mintStore (the CAT inner puzzle is its standard puzzle). `owner_puzzle_hash` (32) is that key's
15
+ * standard puzzle hash. `parent_spends` are the spends that created the candidate DIG coins (wasm
16
+ * CoinSpend shape), and `child_coin_ids` (Uint8Array[] of 32 bytes) are those coins' ids in the
17
+ * SAME order — each parent spend is parsed to reconstruct its DIG child's lineage proof.
18
+ * `store_id` (32) is the launcher id, carried as a memo. Returns CoinSpend[] (UNSIGNED).
19
+ */
20
+ export function buildDigPayment(owner_synthetic_key: Uint8Array, owner_puzzle_hash: Uint8Array, parent_spends: any, child_coin_ids: any, amount: bigint, store_id: Uint8Array): any;
21
+
6
22
  /**
7
23
  * Reconstruct a DataStore from the coin spend that created its current coin (the launcher
8
24
  * spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
@@ -12,6 +28,18 @@ export function addFee(spender_synthetic_key: Uint8Array, selected_coins: any, a
12
28
  */
13
29
  export function dataStoreFromSpend(coin_spend: any, prev_delegated_puzzles: any): any;
14
30
 
31
+ /**
32
+ * The DIG CAT outer puzzle hash for a 32-byte owner puzzle hash — where the wallet's DIG
33
+ * coins live on-chain. The app uses it to read DIG balance + select DIG coins. 32 bytes.
34
+ */
35
+ export function digCatPuzzleHash(owner_puzzle_hash: Uint8Array): Uint8Array;
36
+
37
+ /**
38
+ * The DIG treasury inner (standard) puzzle hash — the fixed recipient of every DIG payment.
39
+ * Returned so the app can pin it as a golden constant. 32 bytes.
40
+ */
41
+ export function digTreasuryInnerPuzzleHash(): Uint8Array;
42
+
15
43
  /**
16
44
  * Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
17
45
  * computes the SAME hint to enumerate the wallet's stores via coinset
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./chip35_dl_coin_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- addFee, dataStoreFromSpend, digstoreOwnerHint, hexSpendBundleToCoinSpends, init, meltStore, mintStore, oracleSpend, spendBundleToHex, updateStoreMetadata, updateStoreOwnership
8
+ addFee, buildDigPayment, dataStoreFromSpend, digCatPuzzleHash, digTreasuryInnerPuzzleHash, digstoreOwnerHint, hexSpendBundleToCoinSpends, init, meltStore, mintStore, oracleSpend, spendBundleToHex, updateStoreMetadata, updateStoreOwnership
9
9
  } from "./chip35_dl_coin_wasm_bg.js";
@@ -23,6 +23,49 @@ export function addFee(spender_synthetic_key, selected_coins, assert_coin_ids, f
23
23
  }
24
24
  }
25
25
 
26
+ /**
27
+ * Build the (UNSIGNED) DIG CAT coin spends paying `amount` base units of DIG to the treasury
28
+ * (100 DIG = 100000n to mint, 10 DIG = 10000n per update), returning change to the owner. The
29
+ * app concatenates these with the singleton mint/update spends and has the wallet sign the WHOLE
30
+ * bundle in ONE call — the single aggregated signature makes the store creation and the DIG
31
+ * payment atomic (all-or-nothing in the mempool).
32
+ *
33
+ * `owner_synthetic_key` (48 bytes) is the wallet's synthetic public key — the SAME key used for
34
+ * mintStore (the CAT inner puzzle is its standard puzzle). `owner_puzzle_hash` (32) is that key's
35
+ * standard puzzle hash. `parent_spends` are the spends that created the candidate DIG coins (wasm
36
+ * CoinSpend shape), and `child_coin_ids` (Uint8Array[] of 32 bytes) are those coins' ids in the
37
+ * SAME order — each parent spend is parsed to reconstruct its DIG child's lineage proof.
38
+ * `store_id` (32) is the launcher id, carried as a memo. Returns CoinSpend[] (UNSIGNED).
39
+ * @param {Uint8Array} owner_synthetic_key
40
+ * @param {Uint8Array} owner_puzzle_hash
41
+ * @param {any} parent_spends
42
+ * @param {any} child_coin_ids
43
+ * @param {bigint} amount
44
+ * @param {Uint8Array} store_id
45
+ * @returns {any}
46
+ */
47
+ export function buildDigPayment(owner_synthetic_key, owner_puzzle_hash, parent_spends, child_coin_ids, amount, store_id) {
48
+ try {
49
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
50
+ const ptr0 = passArray8ToWasm0(owner_synthetic_key, wasm.__wbindgen_export);
51
+ const len0 = WASM_VECTOR_LEN;
52
+ const ptr1 = passArray8ToWasm0(owner_puzzle_hash, wasm.__wbindgen_export);
53
+ const len1 = WASM_VECTOR_LEN;
54
+ const ptr2 = passArray8ToWasm0(store_id, wasm.__wbindgen_export);
55
+ const len2 = WASM_VECTOR_LEN;
56
+ wasm.buildDigPayment(retptr, ptr0, len0, ptr1, len1, addHeapObject(parent_spends), addHeapObject(child_coin_ids), amount, ptr2, len2);
57
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
58
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
59
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
60
+ if (r2) {
61
+ throw takeObject(r1);
62
+ }
63
+ return takeObject(r0);
64
+ } finally {
65
+ wasm.__wbindgen_add_to_stack_pointer(16);
66
+ }
67
+ }
68
+
26
69
  /**
27
70
  * Reconstruct a DataStore from the coin spend that created its current coin (the launcher
28
71
  * spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
@@ -49,6 +92,52 @@ export function dataStoreFromSpend(coin_spend, prev_delegated_puzzles) {
49
92
  }
50
93
  }
51
94
 
95
+ /**
96
+ * The DIG CAT outer puzzle hash for a 32-byte owner puzzle hash — where the wallet's DIG
97
+ * coins live on-chain. The app uses it to read DIG balance + select DIG coins. 32 bytes.
98
+ * @param {Uint8Array} owner_puzzle_hash
99
+ * @returns {Uint8Array}
100
+ */
101
+ export function digCatPuzzleHash(owner_puzzle_hash) {
102
+ try {
103
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
104
+ const ptr0 = passArray8ToWasm0(owner_puzzle_hash, wasm.__wbindgen_export);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ wasm.digCatPuzzleHash(retptr, ptr0, len0);
107
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
108
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
109
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
110
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
111
+ if (r3) {
112
+ throw takeObject(r2);
113
+ }
114
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
115
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
116
+ return v2;
117
+ } finally {
118
+ wasm.__wbindgen_add_to_stack_pointer(16);
119
+ }
120
+ }
121
+
122
+ /**
123
+ * The DIG treasury inner (standard) puzzle hash — the fixed recipient of every DIG payment.
124
+ * Returned so the app can pin it as a golden constant. 32 bytes.
125
+ * @returns {Uint8Array}
126
+ */
127
+ export function digTreasuryInnerPuzzleHash() {
128
+ try {
129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
130
+ wasm.digTreasuryInnerPuzzleHash(retptr);
131
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
132
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
133
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
134
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
135
+ return v1;
136
+ } finally {
137
+ wasm.__wbindgen_add_to_stack_pointer(16);
138
+ }
139
+ }
140
+
52
141
  /**
53
142
  * Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
54
143
  * computes the SAME hint to enumerate the wallet's stores via coinset
@@ -346,6 +435,10 @@ export function __wbg___wbindgen_is_object_56732c2bc353f41d(arg0) {
346
435
  const ret = typeof(val) === 'object' && val !== null;
347
436
  return ret;
348
437
  }
438
+ export function __wbg___wbindgen_is_string_c236cabd84a4d769(arg0) {
439
+ const ret = typeof(getObject(arg0)) === 'string';
440
+ return ret;
441
+ }
349
442
  export function __wbg___wbindgen_is_undefined_67b456be8673d3d7(arg0) {
350
443
  const ret = getObject(arg0) === undefined;
351
444
  return ret;
@@ -379,6 +472,14 @@ export function __wbg_call_8a89609d89f6608a() { return handleError(function (arg
379
472
  const ret = getObject(arg0).call(getObject(arg1));
380
473
  return addHeapObject(ret);
381
474
  }, arguments); }
475
+ export function __wbg_call_9c758de292015997() { return handleError(function (arg0, arg1, arg2) {
476
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
477
+ return addHeapObject(ret);
478
+ }, arguments); }
479
+ export function __wbg_crypto_38df2bab126b63dc(arg0) {
480
+ const ret = getObject(arg0).crypto;
481
+ return addHeapObject(ret);
482
+ }
382
483
  export function __wbg_done_60cf307fcc680536(arg0) {
383
484
  const ret = getObject(arg0).done;
384
485
  return ret;
@@ -398,6 +499,9 @@ export function __wbg_from_d300fe49deab18f5(arg0) {
398
499
  const ret = Array.from(getObject(arg0));
399
500
  return addHeapObject(ret);
400
501
  }
502
+ export function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {
503
+ getObject(arg0).getRandomValues(getObject(arg1));
504
+ }, arguments); }
401
505
  export function __wbg_get_1f8f054ddbaa7db2() { return handleError(function (arg0, arg1) {
402
506
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
403
507
  return addHeapObject(ret);
@@ -450,6 +554,10 @@ export function __wbg_length_66f1a4b2e9026940(arg0) {
450
554
  const ret = getObject(arg0).length;
451
555
  return ret;
452
556
  }
557
+ export function __wbg_msCrypto_bd5a034af96bcba6(arg0) {
558
+ const ret = getObject(arg0).msCrypto;
559
+ return addHeapObject(ret);
560
+ }
453
561
  export function __wbg_new_227d7c05414eb861() {
454
562
  const ret = new Error();
455
563
  return addHeapObject(ret);
@@ -466,6 +574,10 @@ export function __wbg_new_d90091b82fdf5b91() {
466
574
  const ret = new Array();
467
575
  return addHeapObject(ret);
468
576
  }
577
+ export function __wbg_new_with_length_36a4998e27b014c5(arg0) {
578
+ const ret = new Uint8Array(arg0 >>> 0);
579
+ return addHeapObject(ret);
580
+ }
469
581
  export function __wbg_next_9e03acdf51c4960d(arg0) {
470
582
  const ret = getObject(arg0).next;
471
583
  return addHeapObject(ret);
@@ -474,9 +586,24 @@ export function __wbg_next_eb8ca7351fa27906() { return handleError(function (arg
474
586
  const ret = getObject(arg0).next();
475
587
  return addHeapObject(ret);
476
588
  }, arguments); }
589
+ export function __wbg_node_84ea875411254db1(arg0) {
590
+ const ret = getObject(arg0).node;
591
+ return addHeapObject(ret);
592
+ }
593
+ export function __wbg_process_44c7a14e11e9f69e(arg0) {
594
+ const ret = getObject(arg0).process;
595
+ return addHeapObject(ret);
596
+ }
477
597
  export function __wbg_prototypesetcall_3249fc62a0fafa30(arg0, arg1, arg2) {
478
598
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
479
599
  }
600
+ export function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {
601
+ getObject(arg0).randomFillSync(takeObject(arg1));
602
+ }, arguments); }
603
+ export function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {
604
+ const ret = module.require;
605
+ return addHeapObject(ret);
606
+ }, arguments); }
480
607
  export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
481
608
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
482
609
  }
@@ -490,10 +617,34 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
490
617
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
491
618
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
492
619
  }
620
+ export function __wbg_static_accessor_GLOBAL_9d53f2689e622ca1() {
621
+ const ret = typeof global === 'undefined' ? null : global;
622
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
623
+ }
624
+ export function __wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a() {
625
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
626
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
627
+ }
628
+ export function __wbg_static_accessor_SELF_4c59f6c7ea29a144() {
629
+ const ret = typeof self === 'undefined' ? null : self;
630
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
631
+ }
632
+ export function __wbg_static_accessor_WINDOW_e70ae9f2eb052253() {
633
+ const ret = typeof window === 'undefined' ? null : window;
634
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
635
+ }
636
+ export function __wbg_subarray_4aa221f6a4f5ab22(arg0, arg1, arg2) {
637
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
638
+ return addHeapObject(ret);
639
+ }
493
640
  export function __wbg_value_f3625092ee4b37f4(arg0) {
494
641
  const ret = getObject(arg0).value;
495
642
  return addHeapObject(ret);
496
643
  }
644
+ export function __wbg_versions_276b2795b1c6a219(arg0) {
645
+ const ret = getObject(arg0).versions;
646
+ return addHeapObject(ret);
647
+ }
497
648
  export function __wbindgen_cast_0000000000000001(arg0) {
498
649
  // Cast intrinsic for `F64 -> Externref`.
499
650
  const ret = arg0;
Binary file
package/package.json CHANGED
@@ -2,11 +2,8 @@
2
2
  "name": "@dignetwork/chip35-dl-coin-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for the isolated CHIP-0035 DataLayer store coin driver.",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "license": "MIT",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
7
  "repository": {
11
8
  "type": "git",
12
9
  "url": "https://github.com/DIG-Network/chip35_dl_coin"
@@ -22,5 +19,8 @@
22
19
  "sideEffects": [
23
20
  "./chip35_dl_coin_wasm.js",
24
21
  "./snippets/*"
25
- ]
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
26
  }