@dignetwork/chip35-dl-coin-wasm 0.1.0 → 0.3.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
+ * Reconstruct a DataStore from the coin spend that created its current coin (the launcher
8
+ * spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
9
+ * creating spend from a full node, rebuild the DataStore here, then meltStore() it.
10
+ * `coin_spend` is the wasm CoinSpend shape (Uint8Array fields); `prev_delegated_puzzles` is
11
+ * the parent's delegated-puzzle list ([] for an owner-only store).
12
+ */
13
+ export function dataStoreFromSpend(coin_spend: any, prev_delegated_puzzles: any): any;
14
+
15
+ /**
16
+ * Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
17
+ * computes the SAME hint to enumerate the wallet's stores via coinset
18
+ * get_coin_records_by_hint — it MUST match the hint mint_store emits. Returns 32 bytes.
19
+ */
20
+ export function digstoreOwnerHint(owner_puzzle_hash: Uint8Array): Uint8Array;
21
+
6
22
  export function hexSpendBundleToCoinSpends(hex: string): any;
7
23
 
8
24
  /**
@@ -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, hexSpendBundleToCoinSpends, init, meltStore, mintStore, oracleSpend, spendBundleToHex, updateStoreMetadata, updateStoreOwnership
8
+ addFee, dataStoreFromSpend, digstoreOwnerHint, hexSpendBundleToCoinSpends, init, meltStore, mintStore, oracleSpend, spendBundleToHex, updateStoreMetadata, updateStoreOwnership
9
9
  } from "./chip35_dl_coin_wasm_bg.js";
@@ -23,6 +23,60 @@ export function addFee(spender_synthetic_key, selected_coins, assert_coin_ids, f
23
23
  }
24
24
  }
25
25
 
26
+ /**
27
+ * Reconstruct a DataStore from the coin spend that created its current coin (the launcher
28
+ * spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
29
+ * creating spend from a full node, rebuild the DataStore here, then meltStore() it.
30
+ * `coin_spend` is the wasm CoinSpend shape (Uint8Array fields); `prev_delegated_puzzles` is
31
+ * the parent's delegated-puzzle list ([] for an owner-only store).
32
+ * @param {any} coin_spend
33
+ * @param {any} prev_delegated_puzzles
34
+ * @returns {any}
35
+ */
36
+ export function dataStoreFromSpend(coin_spend, prev_delegated_puzzles) {
37
+ try {
38
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
39
+ wasm.dataStoreFromSpend(retptr, addHeapObject(coin_spend), addHeapObject(prev_delegated_puzzles));
40
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
41
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
42
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
43
+ if (r2) {
44
+ throw takeObject(r1);
45
+ }
46
+ return takeObject(r0);
47
+ } finally {
48
+ wasm.__wbindgen_add_to_stack_pointer(16);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
54
+ * computes the SAME hint to enumerate the wallet's stores via coinset
55
+ * get_coin_records_by_hint — it MUST match the hint mint_store emits. Returns 32 bytes.
56
+ * @param {Uint8Array} owner_puzzle_hash
57
+ * @returns {Uint8Array}
58
+ */
59
+ export function digstoreOwnerHint(owner_puzzle_hash) {
60
+ try {
61
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
62
+ const ptr0 = passArray8ToWasm0(owner_puzzle_hash, wasm.__wbindgen_export);
63
+ const len0 = WASM_VECTOR_LEN;
64
+ wasm.digstoreOwnerHint(retptr, ptr0, len0);
65
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
66
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
67
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
68
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
69
+ if (r3) {
70
+ throw takeObject(r2);
71
+ }
72
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
73
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
74
+ return v2;
75
+ } finally {
76
+ wasm.__wbindgen_add_to_stack_pointer(16);
77
+ }
78
+ }
79
+
26
80
  /**
27
81
  * @param {string} hex
28
82
  * @returns {any}
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
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.1.0",
5
+ "version": "0.3.0",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"