@dignetwork/chip35-dl-coin-wasm 0.2.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.
package/chip35_dl_coin_wasm.d.ts
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
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
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Reconstruct a DataStore from the coin spend that created its current coin (the launcher
|
|
24
|
+
* spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
|
|
25
|
+
* creating spend from a full node, rebuild the DataStore here, then meltStore() it.
|
|
26
|
+
* `coin_spend` is the wasm CoinSpend shape (Uint8Array fields); `prev_delegated_puzzles` is
|
|
27
|
+
* the parent's delegated-puzzle list ([] for an owner-only store).
|
|
28
|
+
*/
|
|
29
|
+
export function dataStoreFromSpend(coin_spend: any, prev_delegated_puzzles: any): any;
|
|
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
|
+
|
|
6
43
|
/**
|
|
7
44
|
* Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
|
|
8
45
|
* computes the SAME hint to enumerate the wallet's stores via coinset
|
package/chip35_dl_coin_wasm.js
CHANGED
|
@@ -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, 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,121 @@ 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
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Reconstruct a DataStore from the coin spend that created its current coin (the launcher
|
|
71
|
+
* spend for an eve store). Lets the app MELT a store it did not mint in-session: fetch the
|
|
72
|
+
* creating spend from a full node, rebuild the DataStore here, then meltStore() it.
|
|
73
|
+
* `coin_spend` is the wasm CoinSpend shape (Uint8Array fields); `prev_delegated_puzzles` is
|
|
74
|
+
* the parent's delegated-puzzle list ([] for an owner-only store).
|
|
75
|
+
* @param {any} coin_spend
|
|
76
|
+
* @param {any} prev_delegated_puzzles
|
|
77
|
+
* @returns {any}
|
|
78
|
+
*/
|
|
79
|
+
export function dataStoreFromSpend(coin_spend, prev_delegated_puzzles) {
|
|
80
|
+
try {
|
|
81
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
82
|
+
wasm.dataStoreFromSpend(retptr, addHeapObject(coin_spend), addHeapObject(prev_delegated_puzzles));
|
|
83
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
84
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
85
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
86
|
+
if (r2) {
|
|
87
|
+
throw takeObject(r1);
|
|
88
|
+
}
|
|
89
|
+
return takeObject(r0);
|
|
90
|
+
} finally {
|
|
91
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
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
|
+
|
|
26
141
|
/**
|
|
27
142
|
* Derive the digstore-scoped owner discovery hint for a 32-byte owner puzzle hash. The app
|
|
28
143
|
* computes the SAME hint to enumerate the wallet's stores via coinset
|
|
@@ -320,6 +435,10 @@ export function __wbg___wbindgen_is_object_56732c2bc353f41d(arg0) {
|
|
|
320
435
|
const ret = typeof(val) === 'object' && val !== null;
|
|
321
436
|
return ret;
|
|
322
437
|
}
|
|
438
|
+
export function __wbg___wbindgen_is_string_c236cabd84a4d769(arg0) {
|
|
439
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
440
|
+
return ret;
|
|
441
|
+
}
|
|
323
442
|
export function __wbg___wbindgen_is_undefined_67b456be8673d3d7(arg0) {
|
|
324
443
|
const ret = getObject(arg0) === undefined;
|
|
325
444
|
return ret;
|
|
@@ -353,6 +472,14 @@ export function __wbg_call_8a89609d89f6608a() { return handleError(function (arg
|
|
|
353
472
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
354
473
|
return addHeapObject(ret);
|
|
355
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
|
+
}
|
|
356
483
|
export function __wbg_done_60cf307fcc680536(arg0) {
|
|
357
484
|
const ret = getObject(arg0).done;
|
|
358
485
|
return ret;
|
|
@@ -372,6 +499,9 @@ export function __wbg_from_d300fe49deab18f5(arg0) {
|
|
|
372
499
|
const ret = Array.from(getObject(arg0));
|
|
373
500
|
return addHeapObject(ret);
|
|
374
501
|
}
|
|
502
|
+
export function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {
|
|
503
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
504
|
+
}, arguments); }
|
|
375
505
|
export function __wbg_get_1f8f054ddbaa7db2() { return handleError(function (arg0, arg1) {
|
|
376
506
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
377
507
|
return addHeapObject(ret);
|
|
@@ -424,6 +554,10 @@ export function __wbg_length_66f1a4b2e9026940(arg0) {
|
|
|
424
554
|
const ret = getObject(arg0).length;
|
|
425
555
|
return ret;
|
|
426
556
|
}
|
|
557
|
+
export function __wbg_msCrypto_bd5a034af96bcba6(arg0) {
|
|
558
|
+
const ret = getObject(arg0).msCrypto;
|
|
559
|
+
return addHeapObject(ret);
|
|
560
|
+
}
|
|
427
561
|
export function __wbg_new_227d7c05414eb861() {
|
|
428
562
|
const ret = new Error();
|
|
429
563
|
return addHeapObject(ret);
|
|
@@ -440,6 +574,10 @@ export function __wbg_new_d90091b82fdf5b91() {
|
|
|
440
574
|
const ret = new Array();
|
|
441
575
|
return addHeapObject(ret);
|
|
442
576
|
}
|
|
577
|
+
export function __wbg_new_with_length_36a4998e27b014c5(arg0) {
|
|
578
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
579
|
+
return addHeapObject(ret);
|
|
580
|
+
}
|
|
443
581
|
export function __wbg_next_9e03acdf51c4960d(arg0) {
|
|
444
582
|
const ret = getObject(arg0).next;
|
|
445
583
|
return addHeapObject(ret);
|
|
@@ -448,9 +586,24 @@ export function __wbg_next_eb8ca7351fa27906() { return handleError(function (arg
|
|
|
448
586
|
const ret = getObject(arg0).next();
|
|
449
587
|
return addHeapObject(ret);
|
|
450
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
|
+
}
|
|
451
597
|
export function __wbg_prototypesetcall_3249fc62a0fafa30(arg0, arg1, arg2) {
|
|
452
598
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
453
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); }
|
|
454
607
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
455
608
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
456
609
|
}
|
|
@@ -464,10 +617,34 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
|
464
617
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
465
618
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
466
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
|
+
}
|
|
467
640
|
export function __wbg_value_f3625092ee4b37f4(arg0) {
|
|
468
641
|
const ret = getObject(arg0).value;
|
|
469
642
|
return addHeapObject(ret);
|
|
470
643
|
}
|
|
644
|
+
export function __wbg_versions_276b2795b1c6a219(arg0) {
|
|
645
|
+
const ret = getObject(arg0).versions;
|
|
646
|
+
return addHeapObject(ret);
|
|
647
|
+
}
|
|
471
648
|
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
472
649
|
// Cast intrinsic for `F64 -> Externref`.
|
|
473
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.
|
|
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
|
}
|