@dignetwork/chip35-dl-coin-wasm 0.1.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 +24 -0
- package/chip35_dl_coin_wasm.js +9 -0
- package/chip35_dl_coin_wasm_bg.js +677 -0
- package/chip35_dl_coin_wasm_bg.wasm +0 -0
- package/package.json +26 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function addFee(spender_synthetic_key: Uint8Array, selected_coins: any, assert_coin_ids: any, fee: bigint): any;
|
|
5
|
+
|
|
6
|
+
export function hexSpendBundleToCoinSpends(hex: string): any;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Initialise the module. Call once at startup. Installs a panic hook (when the
|
|
10
|
+
* `console-panic-hook` feature is on) so Rust panics surface in the JS console.
|
|
11
|
+
*/
|
|
12
|
+
export function init(): void;
|
|
13
|
+
|
|
14
|
+
export function meltStore(store: any, owner_public_key: Uint8Array): any;
|
|
15
|
+
|
|
16
|
+
export function mintStore(minter_synthetic_key: Uint8Array, selected_coins: any, root_hash: Uint8Array, label: string | null | undefined, description: string | null | undefined, bytes: bigint | null | undefined, program_hash: Uint8Array | null | undefined, owner_puzzle_hash: Uint8Array, delegated_puzzles: any, fee: bigint): any;
|
|
17
|
+
|
|
18
|
+
export function oracleSpend(spender_synthetic_key: Uint8Array, selected_coins: any, store: any, fee: bigint): any;
|
|
19
|
+
|
|
20
|
+
export function spendBundleToHex(spend_bundle: any): string;
|
|
21
|
+
|
|
22
|
+
export function updateStoreMetadata(store: any, new_root_hash: Uint8Array, new_label?: string | null, new_description?: string | null, new_bytes?: bigint | null, new_program_hash?: Uint8Array | null, owner_public_key?: Uint8Array | null, admin_public_key?: Uint8Array | null, writer_public_key?: Uint8Array | null): any;
|
|
23
|
+
|
|
24
|
+
export function updateStoreOwnership(store: any, new_owner_puzzle_hash: Uint8Array | null | undefined, new_delegated_puzzles: any, owner_public_key?: Uint8Array | null, admin_public_key?: Uint8Array | null): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./chip35_dl_coin_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./chip35_dl_coin_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./chip35_dl_coin_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
addFee, hexSpendBundleToCoinSpends, init, meltStore, mintStore, oracleSpend, spendBundleToHex, updateStoreMetadata, updateStoreOwnership
|
|
9
|
+
} from "./chip35_dl_coin_wasm_bg.js";
|
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Uint8Array} spender_synthetic_key
|
|
3
|
+
* @param {any} selected_coins
|
|
4
|
+
* @param {any} assert_coin_ids
|
|
5
|
+
* @param {bigint} fee
|
|
6
|
+
* @returns {any}
|
|
7
|
+
*/
|
|
8
|
+
export function addFee(spender_synthetic_key, selected_coins, assert_coin_ids, fee) {
|
|
9
|
+
try {
|
|
10
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
11
|
+
const ptr0 = passArray8ToWasm0(spender_synthetic_key, wasm.__wbindgen_export);
|
|
12
|
+
const len0 = WASM_VECTOR_LEN;
|
|
13
|
+
wasm.addFee(retptr, ptr0, len0, addHeapObject(selected_coins), addHeapObject(assert_coin_ids), fee);
|
|
14
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
15
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
16
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
17
|
+
if (r2) {
|
|
18
|
+
throw takeObject(r1);
|
|
19
|
+
}
|
|
20
|
+
return takeObject(r0);
|
|
21
|
+
} finally {
|
|
22
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} hex
|
|
28
|
+
* @returns {any}
|
|
29
|
+
*/
|
|
30
|
+
export function hexSpendBundleToCoinSpends(hex) {
|
|
31
|
+
try {
|
|
32
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33
|
+
const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
34
|
+
const len0 = WASM_VECTOR_LEN;
|
|
35
|
+
wasm.hexSpendBundleToCoinSpends(retptr, ptr0, len0);
|
|
36
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
37
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
38
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
39
|
+
if (r2) {
|
|
40
|
+
throw takeObject(r1);
|
|
41
|
+
}
|
|
42
|
+
return takeObject(r0);
|
|
43
|
+
} finally {
|
|
44
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initialise the module. Call once at startup. Installs a panic hook (when the
|
|
50
|
+
* `console-panic-hook` feature is on) so Rust panics surface in the JS console.
|
|
51
|
+
*/
|
|
52
|
+
export function init() {
|
|
53
|
+
wasm.init();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {any} store
|
|
58
|
+
* @param {Uint8Array} owner_public_key
|
|
59
|
+
* @returns {any}
|
|
60
|
+
*/
|
|
61
|
+
export function meltStore(store, owner_public_key) {
|
|
62
|
+
try {
|
|
63
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
64
|
+
const ptr0 = passArray8ToWasm0(owner_public_key, wasm.__wbindgen_export);
|
|
65
|
+
const len0 = WASM_VECTOR_LEN;
|
|
66
|
+
wasm.meltStore(retptr, addHeapObject(store), ptr0, len0);
|
|
67
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
68
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
69
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
70
|
+
if (r2) {
|
|
71
|
+
throw takeObject(r1);
|
|
72
|
+
}
|
|
73
|
+
return takeObject(r0);
|
|
74
|
+
} finally {
|
|
75
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Uint8Array} minter_synthetic_key
|
|
81
|
+
* @param {any} selected_coins
|
|
82
|
+
* @param {Uint8Array} root_hash
|
|
83
|
+
* @param {string | null | undefined} label
|
|
84
|
+
* @param {string | null | undefined} description
|
|
85
|
+
* @param {bigint | null | undefined} bytes
|
|
86
|
+
* @param {Uint8Array | null | undefined} program_hash
|
|
87
|
+
* @param {Uint8Array} owner_puzzle_hash
|
|
88
|
+
* @param {any} delegated_puzzles
|
|
89
|
+
* @param {bigint} fee
|
|
90
|
+
* @returns {any}
|
|
91
|
+
*/
|
|
92
|
+
export function mintStore(minter_synthetic_key, selected_coins, root_hash, label, description, bytes, program_hash, owner_puzzle_hash, delegated_puzzles, fee) {
|
|
93
|
+
try {
|
|
94
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
95
|
+
const ptr0 = passArray8ToWasm0(minter_synthetic_key, wasm.__wbindgen_export);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ptr1 = passArray8ToWasm0(root_hash, wasm.__wbindgen_export);
|
|
98
|
+
const len1 = WASM_VECTOR_LEN;
|
|
99
|
+
var ptr2 = isLikeNone(label) ? 0 : passStringToWasm0(label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
100
|
+
var len2 = WASM_VECTOR_LEN;
|
|
101
|
+
var ptr3 = isLikeNone(description) ? 0 : passStringToWasm0(description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
102
|
+
var len3 = WASM_VECTOR_LEN;
|
|
103
|
+
var ptr4 = isLikeNone(program_hash) ? 0 : passArray8ToWasm0(program_hash, wasm.__wbindgen_export);
|
|
104
|
+
var len4 = WASM_VECTOR_LEN;
|
|
105
|
+
const ptr5 = passArray8ToWasm0(owner_puzzle_hash, wasm.__wbindgen_export);
|
|
106
|
+
const len5 = WASM_VECTOR_LEN;
|
|
107
|
+
wasm.mintStore(retptr, ptr0, len0, addHeapObject(selected_coins), ptr1, len1, ptr2, len2, ptr3, len3, !isLikeNone(bytes), isLikeNone(bytes) ? BigInt(0) : bytes, ptr4, len4, ptr5, len5, addHeapObject(delegated_puzzles), fee);
|
|
108
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
109
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
110
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
111
|
+
if (r2) {
|
|
112
|
+
throw takeObject(r1);
|
|
113
|
+
}
|
|
114
|
+
return takeObject(r0);
|
|
115
|
+
} finally {
|
|
116
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {Uint8Array} spender_synthetic_key
|
|
122
|
+
* @param {any} selected_coins
|
|
123
|
+
* @param {any} store
|
|
124
|
+
* @param {bigint} fee
|
|
125
|
+
* @returns {any}
|
|
126
|
+
*/
|
|
127
|
+
export function oracleSpend(spender_synthetic_key, selected_coins, store, fee) {
|
|
128
|
+
try {
|
|
129
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
130
|
+
const ptr0 = passArray8ToWasm0(spender_synthetic_key, wasm.__wbindgen_export);
|
|
131
|
+
const len0 = WASM_VECTOR_LEN;
|
|
132
|
+
wasm.oracleSpend(retptr, ptr0, len0, addHeapObject(selected_coins), addHeapObject(store), fee);
|
|
133
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
134
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
135
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
136
|
+
if (r2) {
|
|
137
|
+
throw takeObject(r1);
|
|
138
|
+
}
|
|
139
|
+
return takeObject(r0);
|
|
140
|
+
} finally {
|
|
141
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {any} spend_bundle
|
|
147
|
+
* @returns {string}
|
|
148
|
+
*/
|
|
149
|
+
export function spendBundleToHex(spend_bundle) {
|
|
150
|
+
let deferred2_0;
|
|
151
|
+
let deferred2_1;
|
|
152
|
+
try {
|
|
153
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
+
wasm.spendBundleToHex(retptr, addHeapObject(spend_bundle));
|
|
155
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
156
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
157
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
158
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
159
|
+
var ptr1 = r0;
|
|
160
|
+
var len1 = r1;
|
|
161
|
+
if (r3) {
|
|
162
|
+
ptr1 = 0; len1 = 0;
|
|
163
|
+
throw takeObject(r2);
|
|
164
|
+
}
|
|
165
|
+
deferred2_0 = ptr1;
|
|
166
|
+
deferred2_1 = len1;
|
|
167
|
+
return getStringFromWasm0(ptr1, len1);
|
|
168
|
+
} finally {
|
|
169
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
170
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param {any} store
|
|
176
|
+
* @param {Uint8Array} new_root_hash
|
|
177
|
+
* @param {string | null} [new_label]
|
|
178
|
+
* @param {string | null} [new_description]
|
|
179
|
+
* @param {bigint | null} [new_bytes]
|
|
180
|
+
* @param {Uint8Array | null} [new_program_hash]
|
|
181
|
+
* @param {Uint8Array | null} [owner_public_key]
|
|
182
|
+
* @param {Uint8Array | null} [admin_public_key]
|
|
183
|
+
* @param {Uint8Array | null} [writer_public_key]
|
|
184
|
+
* @returns {any}
|
|
185
|
+
*/
|
|
186
|
+
export function updateStoreMetadata(store, new_root_hash, new_label, new_description, new_bytes, new_program_hash, owner_public_key, admin_public_key, writer_public_key) {
|
|
187
|
+
try {
|
|
188
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
189
|
+
const ptr0 = passArray8ToWasm0(new_root_hash, wasm.__wbindgen_export);
|
|
190
|
+
const len0 = WASM_VECTOR_LEN;
|
|
191
|
+
var ptr1 = isLikeNone(new_label) ? 0 : passStringToWasm0(new_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
192
|
+
var len1 = WASM_VECTOR_LEN;
|
|
193
|
+
var ptr2 = isLikeNone(new_description) ? 0 : passStringToWasm0(new_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
194
|
+
var len2 = WASM_VECTOR_LEN;
|
|
195
|
+
var ptr3 = isLikeNone(new_program_hash) ? 0 : passArray8ToWasm0(new_program_hash, wasm.__wbindgen_export);
|
|
196
|
+
var len3 = WASM_VECTOR_LEN;
|
|
197
|
+
var ptr4 = isLikeNone(owner_public_key) ? 0 : passArray8ToWasm0(owner_public_key, wasm.__wbindgen_export);
|
|
198
|
+
var len4 = WASM_VECTOR_LEN;
|
|
199
|
+
var ptr5 = isLikeNone(admin_public_key) ? 0 : passArray8ToWasm0(admin_public_key, wasm.__wbindgen_export);
|
|
200
|
+
var len5 = WASM_VECTOR_LEN;
|
|
201
|
+
var ptr6 = isLikeNone(writer_public_key) ? 0 : passArray8ToWasm0(writer_public_key, wasm.__wbindgen_export);
|
|
202
|
+
var len6 = WASM_VECTOR_LEN;
|
|
203
|
+
wasm.updateStoreMetadata(retptr, addHeapObject(store), ptr0, len0, ptr1, len1, ptr2, len2, !isLikeNone(new_bytes), isLikeNone(new_bytes) ? BigInt(0) : new_bytes, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
204
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
205
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
206
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
207
|
+
if (r2) {
|
|
208
|
+
throw takeObject(r1);
|
|
209
|
+
}
|
|
210
|
+
return takeObject(r0);
|
|
211
|
+
} finally {
|
|
212
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {any} store
|
|
218
|
+
* @param {Uint8Array | null | undefined} new_owner_puzzle_hash
|
|
219
|
+
* @param {any} new_delegated_puzzles
|
|
220
|
+
* @param {Uint8Array | null} [owner_public_key]
|
|
221
|
+
* @param {Uint8Array | null} [admin_public_key]
|
|
222
|
+
* @returns {any}
|
|
223
|
+
*/
|
|
224
|
+
export function updateStoreOwnership(store, new_owner_puzzle_hash, new_delegated_puzzles, owner_public_key, admin_public_key) {
|
|
225
|
+
try {
|
|
226
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
227
|
+
var ptr0 = isLikeNone(new_owner_puzzle_hash) ? 0 : passArray8ToWasm0(new_owner_puzzle_hash, wasm.__wbindgen_export);
|
|
228
|
+
var len0 = WASM_VECTOR_LEN;
|
|
229
|
+
var ptr1 = isLikeNone(owner_public_key) ? 0 : passArray8ToWasm0(owner_public_key, wasm.__wbindgen_export);
|
|
230
|
+
var len1 = WASM_VECTOR_LEN;
|
|
231
|
+
var ptr2 = isLikeNone(admin_public_key) ? 0 : passArray8ToWasm0(admin_public_key, wasm.__wbindgen_export);
|
|
232
|
+
var len2 = WASM_VECTOR_LEN;
|
|
233
|
+
wasm.updateStoreOwnership(retptr, addHeapObject(store), ptr0, len0, addHeapObject(new_delegated_puzzles), ptr1, len1, ptr2, len2);
|
|
234
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
235
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
236
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
237
|
+
if (r2) {
|
|
238
|
+
throw takeObject(r1);
|
|
239
|
+
}
|
|
240
|
+
return takeObject(r0);
|
|
241
|
+
} finally {
|
|
242
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export function __wbg_Error_ef53bc310eb298a0(arg0, arg1) {
|
|
246
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
247
|
+
return addHeapObject(ret);
|
|
248
|
+
}
|
|
249
|
+
export function __wbg_Number_6b506e6536831eaa(arg0) {
|
|
250
|
+
const ret = Number(getObject(arg0));
|
|
251
|
+
return ret;
|
|
252
|
+
}
|
|
253
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
254
|
+
const ret = String(getObject(arg1));
|
|
255
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
257
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
258
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
259
|
+
}
|
|
260
|
+
export function __wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d(arg0, arg1) {
|
|
261
|
+
const v = getObject(arg1);
|
|
262
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
263
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
264
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
265
|
+
}
|
|
266
|
+
export function __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9(arg0) {
|
|
267
|
+
const v = getObject(arg0);
|
|
268
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
269
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
270
|
+
}
|
|
271
|
+
export function __wbg___wbindgen_debug_string_0accd80f45e5faa2(arg0, arg1) {
|
|
272
|
+
const ret = debugString(getObject(arg1));
|
|
273
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
274
|
+
const len1 = WASM_VECTOR_LEN;
|
|
275
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
276
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
277
|
+
}
|
|
278
|
+
export function __wbg___wbindgen_in_70a403a56e771704(arg0, arg1) {
|
|
279
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
280
|
+
return ret;
|
|
281
|
+
}
|
|
282
|
+
export function __wbg___wbindgen_is_bigint_6ffd6468a9bc44b9(arg0) {
|
|
283
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
284
|
+
return ret;
|
|
285
|
+
}
|
|
286
|
+
export function __wbg___wbindgen_is_function_754e9f305ff6029e(arg0) {
|
|
287
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
288
|
+
return ret;
|
|
289
|
+
}
|
|
290
|
+
export function __wbg___wbindgen_is_object_56732c2bc353f41d(arg0) {
|
|
291
|
+
const val = getObject(arg0);
|
|
292
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
293
|
+
return ret;
|
|
294
|
+
}
|
|
295
|
+
export function __wbg___wbindgen_is_undefined_67b456be8673d3d7(arg0) {
|
|
296
|
+
const ret = getObject(arg0) === undefined;
|
|
297
|
+
return ret;
|
|
298
|
+
}
|
|
299
|
+
export function __wbg___wbindgen_jsval_eq_1068e624fa87f6ab(arg0, arg1) {
|
|
300
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
301
|
+
return ret;
|
|
302
|
+
}
|
|
303
|
+
export function __wbg___wbindgen_jsval_loose_eq_2c56564c75129511(arg0, arg1) {
|
|
304
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
305
|
+
return ret;
|
|
306
|
+
}
|
|
307
|
+
export function __wbg___wbindgen_number_get_9bb1761122181af2(arg0, arg1) {
|
|
308
|
+
const obj = getObject(arg1);
|
|
309
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
310
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
311
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
312
|
+
}
|
|
313
|
+
export function __wbg___wbindgen_string_get_72bdf95d3ae505b1(arg0, arg1) {
|
|
314
|
+
const obj = getObject(arg1);
|
|
315
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
316
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
317
|
+
var len1 = WASM_VECTOR_LEN;
|
|
318
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
319
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
320
|
+
}
|
|
321
|
+
export function __wbg___wbindgen_throw_1506f2235d1bdba0(arg0, arg1) {
|
|
322
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
323
|
+
}
|
|
324
|
+
export function __wbg_call_8a89609d89f6608a() { return handleError(function (arg0, arg1) {
|
|
325
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
326
|
+
return addHeapObject(ret);
|
|
327
|
+
}, arguments); }
|
|
328
|
+
export function __wbg_done_60cf307fcc680536(arg0) {
|
|
329
|
+
const ret = getObject(arg0).done;
|
|
330
|
+
return ret;
|
|
331
|
+
}
|
|
332
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
333
|
+
let deferred0_0;
|
|
334
|
+
let deferred0_1;
|
|
335
|
+
try {
|
|
336
|
+
deferred0_0 = arg0;
|
|
337
|
+
deferred0_1 = arg1;
|
|
338
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
339
|
+
} finally {
|
|
340
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
export function __wbg_from_d300fe49deab18f5(arg0) {
|
|
344
|
+
const ret = Array.from(getObject(arg0));
|
|
345
|
+
return addHeapObject(ret);
|
|
346
|
+
}
|
|
347
|
+
export function __wbg_get_1f8f054ddbaa7db2() { return handleError(function (arg0, arg1) {
|
|
348
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
349
|
+
return addHeapObject(ret);
|
|
350
|
+
}, arguments); }
|
|
351
|
+
export function __wbg_get_unchecked_33f6e5c9e2f2d6b2(arg0, arg1) {
|
|
352
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
353
|
+
return addHeapObject(ret);
|
|
354
|
+
}
|
|
355
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
356
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
357
|
+
return addHeapObject(ret);
|
|
358
|
+
}
|
|
359
|
+
export function __wbg_instanceof_ArrayBuffer_8f49811467741499(arg0) {
|
|
360
|
+
let result;
|
|
361
|
+
try {
|
|
362
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
363
|
+
} catch (_) {
|
|
364
|
+
result = false;
|
|
365
|
+
}
|
|
366
|
+
const ret = result;
|
|
367
|
+
return ret;
|
|
368
|
+
}
|
|
369
|
+
export function __wbg_instanceof_Uint8Array_86f30649f63ef9c2(arg0) {
|
|
370
|
+
let result;
|
|
371
|
+
try {
|
|
372
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
373
|
+
} catch (_) {
|
|
374
|
+
result = false;
|
|
375
|
+
}
|
|
376
|
+
const ret = result;
|
|
377
|
+
return ret;
|
|
378
|
+
}
|
|
379
|
+
export function __wbg_isArray_67c2c9c4313f4448(arg0) {
|
|
380
|
+
const ret = Array.isArray(getObject(arg0));
|
|
381
|
+
return ret;
|
|
382
|
+
}
|
|
383
|
+
export function __wbg_isSafeInteger_66acec27e09e99a7(arg0) {
|
|
384
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
385
|
+
return ret;
|
|
386
|
+
}
|
|
387
|
+
export function __wbg_iterator_8732428d309e270e() {
|
|
388
|
+
const ret = Symbol.iterator;
|
|
389
|
+
return addHeapObject(ret);
|
|
390
|
+
}
|
|
391
|
+
export function __wbg_length_4a591ecaa01354d9(arg0) {
|
|
392
|
+
const ret = getObject(arg0).length;
|
|
393
|
+
return ret;
|
|
394
|
+
}
|
|
395
|
+
export function __wbg_length_66f1a4b2e9026940(arg0) {
|
|
396
|
+
const ret = getObject(arg0).length;
|
|
397
|
+
return ret;
|
|
398
|
+
}
|
|
399
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
400
|
+
const ret = new Error();
|
|
401
|
+
return addHeapObject(ret);
|
|
402
|
+
}
|
|
403
|
+
export function __wbg_new_578aeef4b6b94378(arg0) {
|
|
404
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
405
|
+
return addHeapObject(ret);
|
|
406
|
+
}
|
|
407
|
+
export function __wbg_new_ce1ab61c1c2b300d() {
|
|
408
|
+
const ret = new Object();
|
|
409
|
+
return addHeapObject(ret);
|
|
410
|
+
}
|
|
411
|
+
export function __wbg_new_d90091b82fdf5b91() {
|
|
412
|
+
const ret = new Array();
|
|
413
|
+
return addHeapObject(ret);
|
|
414
|
+
}
|
|
415
|
+
export function __wbg_next_9e03acdf51c4960d(arg0) {
|
|
416
|
+
const ret = getObject(arg0).next;
|
|
417
|
+
return addHeapObject(ret);
|
|
418
|
+
}
|
|
419
|
+
export function __wbg_next_eb8ca7351fa27906() { return handleError(function (arg0) {
|
|
420
|
+
const ret = getObject(arg0).next();
|
|
421
|
+
return addHeapObject(ret);
|
|
422
|
+
}, arguments); }
|
|
423
|
+
export function __wbg_prototypesetcall_3249fc62a0fafa30(arg0, arg1, arg2) {
|
|
424
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
425
|
+
}
|
|
426
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
427
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
428
|
+
}
|
|
429
|
+
export function __wbg_set_dca99999bba88a9a(arg0, arg1, arg2) {
|
|
430
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
431
|
+
}
|
|
432
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
433
|
+
const ret = getObject(arg1).stack;
|
|
434
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
435
|
+
const len1 = WASM_VECTOR_LEN;
|
|
436
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
437
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
438
|
+
}
|
|
439
|
+
export function __wbg_value_f3625092ee4b37f4(arg0) {
|
|
440
|
+
const ret = getObject(arg0).value;
|
|
441
|
+
return addHeapObject(ret);
|
|
442
|
+
}
|
|
443
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
444
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
445
|
+
const ret = arg0;
|
|
446
|
+
return addHeapObject(ret);
|
|
447
|
+
}
|
|
448
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
449
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
450
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
451
|
+
return addHeapObject(ret);
|
|
452
|
+
}
|
|
453
|
+
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
454
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
455
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
456
|
+
return addHeapObject(ret);
|
|
457
|
+
}
|
|
458
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
459
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
460
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
461
|
+
return addHeapObject(ret);
|
|
462
|
+
}
|
|
463
|
+
export function __wbindgen_object_clone_ref(arg0) {
|
|
464
|
+
const ret = getObject(arg0);
|
|
465
|
+
return addHeapObject(ret);
|
|
466
|
+
}
|
|
467
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
468
|
+
takeObject(arg0);
|
|
469
|
+
}
|
|
470
|
+
function addHeapObject(obj) {
|
|
471
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
472
|
+
const idx = heap_next;
|
|
473
|
+
heap_next = heap[idx];
|
|
474
|
+
|
|
475
|
+
heap[idx] = obj;
|
|
476
|
+
return idx;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function debugString(val) {
|
|
480
|
+
// primitive types
|
|
481
|
+
const type = typeof val;
|
|
482
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
483
|
+
return `${val}`;
|
|
484
|
+
}
|
|
485
|
+
if (type == 'string') {
|
|
486
|
+
return `"${val}"`;
|
|
487
|
+
}
|
|
488
|
+
if (type == 'symbol') {
|
|
489
|
+
const description = val.description;
|
|
490
|
+
if (description == null) {
|
|
491
|
+
return 'Symbol';
|
|
492
|
+
} else {
|
|
493
|
+
return `Symbol(${description})`;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (type == 'function') {
|
|
497
|
+
const name = val.name;
|
|
498
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
499
|
+
return `Function(${name})`;
|
|
500
|
+
} else {
|
|
501
|
+
return 'Function';
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
// objects
|
|
505
|
+
if (Array.isArray(val)) {
|
|
506
|
+
const length = val.length;
|
|
507
|
+
let debug = '[';
|
|
508
|
+
if (length > 0) {
|
|
509
|
+
debug += debugString(val[0]);
|
|
510
|
+
}
|
|
511
|
+
for(let i = 1; i < length; i++) {
|
|
512
|
+
debug += ', ' + debugString(val[i]);
|
|
513
|
+
}
|
|
514
|
+
debug += ']';
|
|
515
|
+
return debug;
|
|
516
|
+
}
|
|
517
|
+
// Test for built-in
|
|
518
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
519
|
+
let className;
|
|
520
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
521
|
+
className = builtInMatches[1];
|
|
522
|
+
} else {
|
|
523
|
+
// Failed to match the standard '[object ClassName]'
|
|
524
|
+
return toString.call(val);
|
|
525
|
+
}
|
|
526
|
+
if (className == 'Object') {
|
|
527
|
+
// we're a user defined class or Object
|
|
528
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
529
|
+
// easier than looping through ownProperties of `val`.
|
|
530
|
+
try {
|
|
531
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
532
|
+
} catch (_) {
|
|
533
|
+
return 'Object';
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
// errors
|
|
537
|
+
if (val instanceof Error) {
|
|
538
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
539
|
+
}
|
|
540
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
541
|
+
return className;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function dropObject(idx) {
|
|
545
|
+
if (idx < 1028) return;
|
|
546
|
+
heap[idx] = heap_next;
|
|
547
|
+
heap_next = idx;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
551
|
+
ptr = ptr >>> 0;
|
|
552
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
let cachedDataViewMemory0 = null;
|
|
556
|
+
function getDataViewMemory0() {
|
|
557
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
558
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
559
|
+
}
|
|
560
|
+
return cachedDataViewMemory0;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function getStringFromWasm0(ptr, len) {
|
|
564
|
+
return decodeText(ptr >>> 0, len);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
let cachedUint8ArrayMemory0 = null;
|
|
568
|
+
function getUint8ArrayMemory0() {
|
|
569
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
570
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
571
|
+
}
|
|
572
|
+
return cachedUint8ArrayMemory0;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function getObject(idx) { return heap[idx]; }
|
|
576
|
+
|
|
577
|
+
function handleError(f, args) {
|
|
578
|
+
try {
|
|
579
|
+
return f.apply(this, args);
|
|
580
|
+
} catch (e) {
|
|
581
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
let heap = new Array(1024).fill(undefined);
|
|
586
|
+
heap.push(undefined, null, true, false);
|
|
587
|
+
|
|
588
|
+
let heap_next = heap.length;
|
|
589
|
+
|
|
590
|
+
function isLikeNone(x) {
|
|
591
|
+
return x === undefined || x === null;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
595
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
596
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
597
|
+
WASM_VECTOR_LEN = arg.length;
|
|
598
|
+
return ptr;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
602
|
+
if (realloc === undefined) {
|
|
603
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
604
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
605
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
606
|
+
WASM_VECTOR_LEN = buf.length;
|
|
607
|
+
return ptr;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
let len = arg.length;
|
|
611
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
612
|
+
|
|
613
|
+
const mem = getUint8ArrayMemory0();
|
|
614
|
+
|
|
615
|
+
let offset = 0;
|
|
616
|
+
|
|
617
|
+
for (; offset < len; offset++) {
|
|
618
|
+
const code = arg.charCodeAt(offset);
|
|
619
|
+
if (code > 0x7F) break;
|
|
620
|
+
mem[ptr + offset] = code;
|
|
621
|
+
}
|
|
622
|
+
if (offset !== len) {
|
|
623
|
+
if (offset !== 0) {
|
|
624
|
+
arg = arg.slice(offset);
|
|
625
|
+
}
|
|
626
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
627
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
628
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
629
|
+
|
|
630
|
+
offset += ret.written;
|
|
631
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
WASM_VECTOR_LEN = offset;
|
|
635
|
+
return ptr;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function takeObject(idx) {
|
|
639
|
+
const ret = getObject(idx);
|
|
640
|
+
dropObject(idx);
|
|
641
|
+
return ret;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
645
|
+
cachedTextDecoder.decode();
|
|
646
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
647
|
+
let numBytesDecoded = 0;
|
|
648
|
+
function decodeText(ptr, len) {
|
|
649
|
+
numBytesDecoded += len;
|
|
650
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
651
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
652
|
+
cachedTextDecoder.decode();
|
|
653
|
+
numBytesDecoded = len;
|
|
654
|
+
}
|
|
655
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const cachedTextEncoder = new TextEncoder();
|
|
659
|
+
|
|
660
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
661
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
662
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
663
|
+
view.set(buf);
|
|
664
|
+
return {
|
|
665
|
+
read: arg.length,
|
|
666
|
+
written: buf.length
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
let WASM_VECTOR_LEN = 0;
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
let wasm;
|
|
675
|
+
export function __wbg_set_wasm(val) {
|
|
676
|
+
wasm = val;
|
|
677
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dignetwork/chip35-dl-coin-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WebAssembly bindings for the isolated CHIP-0035 DataLayer store coin driver.",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/DIG-Network/chip35_dl_coin"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"chip35_dl_coin_wasm_bg.wasm",
|
|
16
|
+
"chip35_dl_coin_wasm.js",
|
|
17
|
+
"chip35_dl_coin_wasm_bg.js",
|
|
18
|
+
"chip35_dl_coin_wasm.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "chip35_dl_coin_wasm.js",
|
|
21
|
+
"types": "chip35_dl_coin_wasm.d.ts",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./chip35_dl_coin_wasm.js",
|
|
24
|
+
"./snippets/*"
|
|
25
|
+
]
|
|
26
|
+
}
|