@fairblock/stabletrust 1.0.7 → 1.0.8
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/README.md +65 -63
- package/examples/complete-flow.js +63 -94
- package/examples/simple-snippets.js +13 -11
- package/package.json +1 -1
- package/pkg/confidential_transfer_proof_generation.js +579 -483
- package/src/client.js +164 -77
- package/src/index.d.ts +14 -63
|
@@ -4,154 +4,189 @@ const heap = new Array(128).fill(undefined);
|
|
|
4
4
|
|
|
5
5
|
heap.push(undefined, null, true, false);
|
|
6
6
|
|
|
7
|
-
function getObject(idx) {
|
|
7
|
+
function getObject(idx) {
|
|
8
|
+
return heap[idx];
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
let heap_next = heap.length;
|
|
10
12
|
|
|
11
13
|
function addHeapObject(obj) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
15
|
+
const idx = heap_next;
|
|
16
|
+
heap_next = heap[idx];
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
heap[idx] = obj;
|
|
19
|
+
return idx;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
function handleError(f, args) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
try {
|
|
24
|
+
return f.apply(this, args);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
wasm.__wbindgen_export_0(addHeapObject(e));
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
const cachedTextDecoder =
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
const cachedTextDecoder =
|
|
31
|
+
typeof TextDecoder !== "undefined"
|
|
32
|
+
? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true })
|
|
33
|
+
: {
|
|
34
|
+
decode: () => {
|
|
35
|
+
throw Error("TextDecoder not available");
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (typeof TextDecoder !== "undefined") {
|
|
40
|
+
cachedTextDecoder.decode();
|
|
41
|
+
}
|
|
31
42
|
|
|
32
43
|
let cachedUint8ArrayMemory0 = null;
|
|
33
44
|
|
|
34
45
|
function getUint8ArrayMemory0() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
if (
|
|
47
|
+
cachedUint8ArrayMemory0 === null ||
|
|
48
|
+
cachedUint8ArrayMemory0.byteLength === 0
|
|
49
|
+
) {
|
|
50
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
51
|
+
}
|
|
52
|
+
return cachedUint8ArrayMemory0;
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
function getStringFromWasm0(ptr, len) {
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
ptr = ptr >>> 0;
|
|
57
|
+
return cachedTextDecoder.decode(
|
|
58
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + len),
|
|
59
|
+
);
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
function dropObject(idx) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
if (idx < 132) return;
|
|
64
|
+
heap[idx] = heap_next;
|
|
65
|
+
heap_next = idx;
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
function takeObject(idx) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
const ret = getObject(idx);
|
|
70
|
+
dropObject(idx);
|
|
71
|
+
return ret;
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
function isLikeNone(x) {
|
|
59
|
-
|
|
75
|
+
return x === undefined || x === null;
|
|
60
76
|
}
|
|
61
77
|
|
|
62
78
|
let WASM_VECTOR_LEN = 0;
|
|
63
79
|
|
|
64
|
-
const cachedTextEncoder =
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
const cachedTextEncoder =
|
|
81
|
+
typeof TextEncoder !== "undefined"
|
|
82
|
+
? new TextEncoder("utf-8")
|
|
83
|
+
: {
|
|
84
|
+
encode: () => {
|
|
85
|
+
throw Error("TextEncoder not available");
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const encodeString =
|
|
90
|
+
typeof cachedTextEncoder.encodeInto === "function"
|
|
67
91
|
? function (arg, view) {
|
|
68
|
-
|
|
69
|
-
}
|
|
92
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
93
|
+
}
|
|
70
94
|
: function (arg, view) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
95
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
96
|
+
view.set(buf);
|
|
97
|
+
return {
|
|
98
|
+
read: arg.length,
|
|
99
|
+
written: buf.length,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
78
102
|
|
|
79
103
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
104
|
+
if (realloc === undefined) {
|
|
105
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
106
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
107
|
+
getUint8ArrayMemory0()
|
|
108
|
+
.subarray(ptr, ptr + buf.length)
|
|
109
|
+
.set(buf);
|
|
110
|
+
WASM_VECTOR_LEN = buf.length;
|
|
111
|
+
return ptr;
|
|
112
|
+
}
|
|
80
113
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
84
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
85
|
-
WASM_VECTOR_LEN = buf.length;
|
|
86
|
-
return ptr;
|
|
87
|
-
}
|
|
114
|
+
let len = arg.length;
|
|
115
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
88
116
|
|
|
89
|
-
|
|
90
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
117
|
+
const mem = getUint8ArrayMemory0();
|
|
91
118
|
|
|
92
|
-
|
|
119
|
+
let offset = 0;
|
|
93
120
|
|
|
94
|
-
|
|
121
|
+
for (; offset < len; offset++) {
|
|
122
|
+
const code = arg.charCodeAt(offset);
|
|
123
|
+
if (code > 0x7f) break;
|
|
124
|
+
mem[ptr + offset] = code;
|
|
125
|
+
}
|
|
95
126
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
mem[ptr + offset] = code;
|
|
127
|
+
if (offset !== len) {
|
|
128
|
+
if (offset !== 0) {
|
|
129
|
+
arg = arg.slice(offset);
|
|
100
130
|
}
|
|
131
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
132
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
133
|
+
const ret = encodeString(arg, view);
|
|
101
134
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
107
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
108
|
-
const ret = encodeString(arg, view);
|
|
109
|
-
|
|
110
|
-
offset += ret.written;
|
|
111
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
112
|
-
}
|
|
135
|
+
offset += ret.written;
|
|
136
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
137
|
+
}
|
|
113
138
|
|
|
114
|
-
|
|
115
|
-
|
|
139
|
+
WASM_VECTOR_LEN = offset;
|
|
140
|
+
return ptr;
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
let cachedDataViewMemory0 = null;
|
|
119
144
|
|
|
120
145
|
function getDataViewMemory0() {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
146
|
+
if (
|
|
147
|
+
cachedDataViewMemory0 === null ||
|
|
148
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
149
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
150
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
151
|
+
) {
|
|
152
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
153
|
+
}
|
|
154
|
+
return cachedDataViewMemory0;
|
|
125
155
|
}
|
|
126
156
|
/**
|
|
127
157
|
* @param {string} input
|
|
128
158
|
* @returns {string}
|
|
129
159
|
*/
|
|
130
160
|
export function generate_withdraw_proof(input) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
153
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
161
|
+
let deferred3_0;
|
|
162
|
+
let deferred3_1;
|
|
163
|
+
try {
|
|
164
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
165
|
+
const ptr0 = passStringToWasm0(
|
|
166
|
+
input,
|
|
167
|
+
wasm.__wbindgen_export_1,
|
|
168
|
+
wasm.__wbindgen_export_2,
|
|
169
|
+
);
|
|
170
|
+
const len0 = WASM_VECTOR_LEN;
|
|
171
|
+
wasm.generate_withdraw_proof(retptr, ptr0, len0);
|
|
172
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
173
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
174
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
175
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
176
|
+
var ptr2 = r0;
|
|
177
|
+
var len2 = r1;
|
|
178
|
+
if (r3) {
|
|
179
|
+
ptr2 = 0;
|
|
180
|
+
len2 = 0;
|
|
181
|
+
throw takeObject(r2);
|
|
154
182
|
}
|
|
183
|
+
deferred3_0 = ptr2;
|
|
184
|
+
deferred3_1 = len2;
|
|
185
|
+
return getStringFromWasm0(ptr2, len2);
|
|
186
|
+
} finally {
|
|
187
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
188
|
+
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
189
|
+
}
|
|
155
190
|
}
|
|
156
191
|
|
|
157
192
|
/**
|
|
@@ -160,32 +195,41 @@ export function generate_withdraw_proof(input) {
|
|
|
160
195
|
* @returns {string}
|
|
161
196
|
*/
|
|
162
197
|
export function decrypt_ciphertext(ciphertext_base64, keypair_base64) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
let deferred4_0;
|
|
199
|
+
let deferred4_1;
|
|
200
|
+
try {
|
|
201
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
202
|
+
const ptr0 = passStringToWasm0(
|
|
203
|
+
ciphertext_base64,
|
|
204
|
+
wasm.__wbindgen_export_1,
|
|
205
|
+
wasm.__wbindgen_export_2,
|
|
206
|
+
);
|
|
207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
208
|
+
const ptr1 = passStringToWasm0(
|
|
209
|
+
keypair_base64,
|
|
210
|
+
wasm.__wbindgen_export_1,
|
|
211
|
+
wasm.__wbindgen_export_2,
|
|
212
|
+
);
|
|
213
|
+
const len1 = WASM_VECTOR_LEN;
|
|
214
|
+
wasm.decrypt_ciphertext(retptr, ptr0, len0, ptr1, len1);
|
|
215
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
216
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
217
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
218
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
219
|
+
var ptr3 = r0;
|
|
220
|
+
var len3 = r1;
|
|
221
|
+
if (r3) {
|
|
222
|
+
ptr3 = 0;
|
|
223
|
+
len3 = 0;
|
|
224
|
+
throw takeObject(r2);
|
|
188
225
|
}
|
|
226
|
+
deferred4_0 = ptr3;
|
|
227
|
+
deferred4_1 = len3;
|
|
228
|
+
return getStringFromWasm0(ptr3, len3);
|
|
229
|
+
} finally {
|
|
230
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
231
|
+
wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
|
|
232
|
+
}
|
|
189
233
|
}
|
|
190
234
|
|
|
191
235
|
/**
|
|
@@ -195,60 +239,70 @@ export function decrypt_ciphertext(ciphertext_base64, keypair_base64) {
|
|
|
195
239
|
* @returns {string}
|
|
196
240
|
*/
|
|
197
241
|
export function generate_deterministic_keypair(signature_hex, domain_context) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
242
|
+
let deferred4_0;
|
|
243
|
+
let deferred4_1;
|
|
244
|
+
try {
|
|
245
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
246
|
+
const ptr0 = passStringToWasm0(
|
|
247
|
+
signature_hex,
|
|
248
|
+
wasm.__wbindgen_export_1,
|
|
249
|
+
wasm.__wbindgen_export_2,
|
|
250
|
+
);
|
|
251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
252
|
+
const ptr1 = passStringToWasm0(
|
|
253
|
+
domain_context,
|
|
254
|
+
wasm.__wbindgen_export_1,
|
|
255
|
+
wasm.__wbindgen_export_2,
|
|
256
|
+
);
|
|
257
|
+
const len1 = WASM_VECTOR_LEN;
|
|
258
|
+
wasm.generate_deterministic_keypair(retptr, ptr0, len0, ptr1, len1);
|
|
259
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
260
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
261
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
262
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
263
|
+
var ptr3 = r0;
|
|
264
|
+
var len3 = r1;
|
|
265
|
+
if (r3) {
|
|
266
|
+
ptr3 = 0;
|
|
267
|
+
len3 = 0;
|
|
268
|
+
throw takeObject(r2);
|
|
223
269
|
}
|
|
270
|
+
deferred4_0 = ptr3;
|
|
271
|
+
deferred4_1 = len3;
|
|
272
|
+
return getStringFromWasm0(ptr3, len3);
|
|
273
|
+
} finally {
|
|
274
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
275
|
+
wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
|
|
276
|
+
}
|
|
224
277
|
}
|
|
225
278
|
|
|
226
279
|
/**
|
|
227
280
|
* @returns {string}
|
|
228
281
|
*/
|
|
229
282
|
export function test_wasm() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
deferred2_0 = ptr1;
|
|
246
|
-
deferred2_1 = len1;
|
|
247
|
-
return getStringFromWasm0(ptr1, len1);
|
|
248
|
-
} finally {
|
|
249
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
250
|
-
wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
|
|
283
|
+
let deferred2_0;
|
|
284
|
+
let deferred2_1;
|
|
285
|
+
try {
|
|
286
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
287
|
+
wasm.test_wasm(retptr);
|
|
288
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
289
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
290
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
291
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
292
|
+
var ptr1 = r0;
|
|
293
|
+
var len1 = r1;
|
|
294
|
+
if (r3) {
|
|
295
|
+
ptr1 = 0;
|
|
296
|
+
len1 = 0;
|
|
297
|
+
throw takeObject(r2);
|
|
251
298
|
}
|
|
299
|
+
deferred2_0 = ptr1;
|
|
300
|
+
deferred2_1 = len1;
|
|
301
|
+
return getStringFromWasm0(ptr1, len1);
|
|
302
|
+
} finally {
|
|
303
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
304
|
+
wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
|
|
305
|
+
}
|
|
252
306
|
}
|
|
253
307
|
|
|
254
308
|
/**
|
|
@@ -256,30 +310,35 @@ export function test_wasm() {
|
|
|
256
310
|
* @returns {string}
|
|
257
311
|
*/
|
|
258
312
|
export function generate_transfer_proof(input) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
313
|
+
let deferred3_0;
|
|
314
|
+
let deferred3_1;
|
|
315
|
+
try {
|
|
316
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
317
|
+
const ptr0 = passStringToWasm0(
|
|
318
|
+
input,
|
|
319
|
+
wasm.__wbindgen_export_1,
|
|
320
|
+
wasm.__wbindgen_export_2,
|
|
321
|
+
);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
wasm.generate_transfer_proof(retptr, ptr0, len0);
|
|
324
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
325
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
326
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
327
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
328
|
+
var ptr2 = r0;
|
|
329
|
+
var len2 = r1;
|
|
330
|
+
if (r3) {
|
|
331
|
+
ptr2 = 0;
|
|
332
|
+
len2 = 0;
|
|
333
|
+
throw takeObject(r2);
|
|
282
334
|
}
|
|
335
|
+
deferred3_0 = ptr2;
|
|
336
|
+
deferred3_1 = len2;
|
|
337
|
+
return getStringFromWasm0(ptr2, len2);
|
|
338
|
+
} finally {
|
|
339
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
340
|
+
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
341
|
+
}
|
|
283
342
|
}
|
|
284
343
|
|
|
285
344
|
/**
|
|
@@ -290,30 +349,35 @@ export function generate_transfer_proof(input) {
|
|
|
290
349
|
* @returns {string}
|
|
291
350
|
*/
|
|
292
351
|
export function decode_transfer_proof(validity_proof_base64, handle_index) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
315
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
352
|
+
let deferred3_0;
|
|
353
|
+
let deferred3_1;
|
|
354
|
+
try {
|
|
355
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
356
|
+
const ptr0 = passStringToWasm0(
|
|
357
|
+
validity_proof_base64,
|
|
358
|
+
wasm.__wbindgen_export_1,
|
|
359
|
+
wasm.__wbindgen_export_2,
|
|
360
|
+
);
|
|
361
|
+
const len0 = WASM_VECTOR_LEN;
|
|
362
|
+
wasm.decode_transfer_proof(retptr, ptr0, len0, handle_index);
|
|
363
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
364
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
365
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
366
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
367
|
+
var ptr2 = r0;
|
|
368
|
+
var len2 = r1;
|
|
369
|
+
if (r3) {
|
|
370
|
+
ptr2 = 0;
|
|
371
|
+
len2 = 0;
|
|
372
|
+
throw takeObject(r2);
|
|
316
373
|
}
|
|
374
|
+
deferred3_0 = ptr2;
|
|
375
|
+
deferred3_1 = len2;
|
|
376
|
+
return getStringFromWasm0(ptr2, len2);
|
|
377
|
+
} finally {
|
|
378
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
379
|
+
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
380
|
+
}
|
|
317
381
|
}
|
|
318
382
|
|
|
319
383
|
/**
|
|
@@ -321,28 +385,29 @@ export function decode_transfer_proof(validity_proof_base64, handle_index) {
|
|
|
321
385
|
* @returns {string}
|
|
322
386
|
*/
|
|
323
387
|
export function generate_keypair() {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
deferred2_0 = ptr1;
|
|
340
|
-
deferred2_1 = len1;
|
|
341
|
-
return getStringFromWasm0(ptr1, len1);
|
|
342
|
-
} finally {
|
|
343
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
344
|
-
wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
|
|
388
|
+
let deferred2_0;
|
|
389
|
+
let deferred2_1;
|
|
390
|
+
try {
|
|
391
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
392
|
+
wasm.generate_keypair(retptr);
|
|
393
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
394
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
395
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
396
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
397
|
+
var ptr1 = r0;
|
|
398
|
+
var len1 = r1;
|
|
399
|
+
if (r3) {
|
|
400
|
+
ptr1 = 0;
|
|
401
|
+
len1 = 0;
|
|
402
|
+
throw takeObject(r2);
|
|
345
403
|
}
|
|
404
|
+
deferred2_0 = ptr1;
|
|
405
|
+
deferred2_1 = len1;
|
|
406
|
+
return getStringFromWasm0(ptr1, len1);
|
|
407
|
+
} finally {
|
|
408
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
409
|
+
wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
|
|
410
|
+
}
|
|
346
411
|
}
|
|
347
412
|
|
|
348
413
|
/**
|
|
@@ -351,30 +416,35 @@ export function generate_keypair() {
|
|
|
351
416
|
* @returns {string}
|
|
352
417
|
*/
|
|
353
418
|
export function encrypt_amount(amount, pubkey_base64) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
376
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
419
|
+
let deferred3_0;
|
|
420
|
+
let deferred3_1;
|
|
421
|
+
try {
|
|
422
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
423
|
+
const ptr0 = passStringToWasm0(
|
|
424
|
+
pubkey_base64,
|
|
425
|
+
wasm.__wbindgen_export_1,
|
|
426
|
+
wasm.__wbindgen_export_2,
|
|
427
|
+
);
|
|
428
|
+
const len0 = WASM_VECTOR_LEN;
|
|
429
|
+
wasm.encrypt_amount(retptr, amount, ptr0, len0);
|
|
430
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
431
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
432
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
433
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
434
|
+
var ptr2 = r0;
|
|
435
|
+
var len2 = r1;
|
|
436
|
+
if (r3) {
|
|
437
|
+
ptr2 = 0;
|
|
438
|
+
len2 = 0;
|
|
439
|
+
throw takeObject(r2);
|
|
377
440
|
}
|
|
441
|
+
deferred3_0 = ptr2;
|
|
442
|
+
deferred3_1 = len2;
|
|
443
|
+
return getStringFromWasm0(ptr2, len2);
|
|
444
|
+
} finally {
|
|
445
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
446
|
+
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
447
|
+
}
|
|
378
448
|
}
|
|
379
449
|
|
|
380
450
|
/**
|
|
@@ -383,271 +453,297 @@ export function encrypt_amount(amount, pubkey_base64) {
|
|
|
383
453
|
* @returns {string}
|
|
384
454
|
*/
|
|
385
455
|
export function generate_deterministic_keypair_legacy(signature_hex) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
408
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
456
|
+
let deferred3_0;
|
|
457
|
+
let deferred3_1;
|
|
458
|
+
try {
|
|
459
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
460
|
+
const ptr0 = passStringToWasm0(
|
|
461
|
+
signature_hex,
|
|
462
|
+
wasm.__wbindgen_export_1,
|
|
463
|
+
wasm.__wbindgen_export_2,
|
|
464
|
+
);
|
|
465
|
+
const len0 = WASM_VECTOR_LEN;
|
|
466
|
+
wasm.generate_deterministic_keypair_legacy(retptr, ptr0, len0);
|
|
467
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
468
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
469
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
470
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
471
|
+
var ptr2 = r0;
|
|
472
|
+
var len2 = r1;
|
|
473
|
+
if (r3) {
|
|
474
|
+
ptr2 = 0;
|
|
475
|
+
len2 = 0;
|
|
476
|
+
throw takeObject(r2);
|
|
409
477
|
}
|
|
478
|
+
deferred3_0 = ptr2;
|
|
479
|
+
deferred3_1 = len2;
|
|
480
|
+
return getStringFromWasm0(ptr2, len2);
|
|
481
|
+
} finally {
|
|
482
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
483
|
+
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
484
|
+
}
|
|
410
485
|
}
|
|
411
486
|
|
|
412
487
|
async function __wbg_load(module, imports) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
488
|
+
if (typeof Response === "function" && module instanceof Response) {
|
|
489
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
490
|
+
try {
|
|
491
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
492
|
+
} catch (e) {
|
|
493
|
+
if (module.headers.get("Content-Type") != "application/wasm") {
|
|
494
|
+
console.warn(
|
|
495
|
+
"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",
|
|
496
|
+
e,
|
|
497
|
+
);
|
|
498
|
+
} else {
|
|
499
|
+
throw e;
|
|
426
500
|
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
427
503
|
|
|
428
|
-
|
|
429
|
-
|
|
504
|
+
const bytes = await module.arrayBuffer();
|
|
505
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
506
|
+
} else {
|
|
507
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
430
508
|
|
|
509
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
510
|
+
return { instance, module };
|
|
431
511
|
} else {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
435
|
-
return { instance, module };
|
|
436
|
-
|
|
437
|
-
} else {
|
|
438
|
-
return instance;
|
|
439
|
-
}
|
|
512
|
+
return instance;
|
|
440
513
|
}
|
|
514
|
+
}
|
|
441
515
|
}
|
|
442
516
|
|
|
443
517
|
function __wbg_get_imports() {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
518
|
+
const imports = {};
|
|
519
|
+
imports.wbg = {};
|
|
520
|
+
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function (arg0) {
|
|
521
|
+
const ret = getObject(arg0).buffer;
|
|
522
|
+
return addHeapObject(ret);
|
|
523
|
+
};
|
|
524
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function () {
|
|
525
|
+
return handleError(function (arg0, arg1) {
|
|
526
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
527
|
+
return addHeapObject(ret);
|
|
528
|
+
}, arguments);
|
|
529
|
+
};
|
|
530
|
+
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function () {
|
|
531
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
532
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
533
|
+
return addHeapObject(ret);
|
|
534
|
+
}, arguments);
|
|
535
|
+
};
|
|
536
|
+
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function (arg0) {
|
|
537
|
+
const ret = getObject(arg0).crypto;
|
|
538
|
+
return addHeapObject(ret);
|
|
539
|
+
};
|
|
540
|
+
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function () {
|
|
541
|
+
return handleError(function (arg0, arg1) {
|
|
542
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
543
|
+
}, arguments);
|
|
544
|
+
};
|
|
545
|
+
imports.wbg.__wbg_getTime_46267b1c24877e30 = function (arg0) {
|
|
546
|
+
const ret = getObject(arg0).getTime();
|
|
547
|
+
return ret;
|
|
548
|
+
};
|
|
549
|
+
imports.wbg.__wbg_log_03eafded1f977497 = function (arg0, arg1) {
|
|
550
|
+
console.log(getStringFromWasm0(arg0, arg1));
|
|
551
|
+
};
|
|
552
|
+
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function (arg0) {
|
|
553
|
+
const ret = getObject(arg0).msCrypto;
|
|
554
|
+
return addHeapObject(ret);
|
|
555
|
+
};
|
|
556
|
+
imports.wbg.__wbg_new0_f788a2397c7ca929 = function () {
|
|
557
|
+
const ret = new Date();
|
|
558
|
+
return addHeapObject(ret);
|
|
559
|
+
};
|
|
560
|
+
imports.wbg.__wbg_new_a12002a7f91c75be = function (arg0) {
|
|
561
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
562
|
+
return addHeapObject(ret);
|
|
563
|
+
};
|
|
564
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function (arg0, arg1) {
|
|
565
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
566
|
+
return addHeapObject(ret);
|
|
567
|
+
};
|
|
568
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function (
|
|
569
|
+
arg0,
|
|
570
|
+
arg1,
|
|
571
|
+
arg2,
|
|
572
|
+
) {
|
|
573
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
574
|
+
return addHeapObject(ret);
|
|
575
|
+
};
|
|
576
|
+
imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function (arg0) {
|
|
577
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
578
|
+
return addHeapObject(ret);
|
|
579
|
+
};
|
|
580
|
+
imports.wbg.__wbg_node_905d3e251edff8a2 = function (arg0) {
|
|
581
|
+
const ret = getObject(arg0).node;
|
|
582
|
+
return addHeapObject(ret);
|
|
583
|
+
};
|
|
584
|
+
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function (arg0) {
|
|
585
|
+
const ret = getObject(arg0).process;
|
|
586
|
+
return addHeapObject(ret);
|
|
587
|
+
};
|
|
588
|
+
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function () {
|
|
589
|
+
return handleError(function (arg0, arg1) {
|
|
590
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
591
|
+
}, arguments);
|
|
592
|
+
};
|
|
593
|
+
imports.wbg.__wbg_require_60cc747a6bc5215a = function () {
|
|
594
|
+
return handleError(function () {
|
|
595
|
+
const ret = module.require;
|
|
596
|
+
return addHeapObject(ret);
|
|
597
|
+
}, arguments);
|
|
598
|
+
};
|
|
599
|
+
imports.wbg.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
|
|
600
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
601
|
+
};
|
|
602
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function () {
|
|
603
|
+
const ret = typeof global === "undefined" ? null : global;
|
|
604
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
605
|
+
};
|
|
606
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function () {
|
|
607
|
+
const ret = typeof globalThis === "undefined" ? null : globalThis;
|
|
608
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
609
|
+
};
|
|
610
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function () {
|
|
611
|
+
const ret = typeof self === "undefined" ? null : self;
|
|
612
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
613
|
+
};
|
|
614
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function () {
|
|
615
|
+
const ret = typeof window === "undefined" ? null : window;
|
|
616
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
617
|
+
};
|
|
618
|
+
imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function (arg0, arg1, arg2) {
|
|
619
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
620
|
+
return addHeapObject(ret);
|
|
621
|
+
};
|
|
622
|
+
imports.wbg.__wbg_versions_c01dfd4722a88165 = function (arg0) {
|
|
623
|
+
const ret = getObject(arg0).versions;
|
|
624
|
+
return addHeapObject(ret);
|
|
625
|
+
};
|
|
626
|
+
imports.wbg.__wbindgen_is_function = function (arg0) {
|
|
627
|
+
const ret = typeof getObject(arg0) === "function";
|
|
628
|
+
return ret;
|
|
629
|
+
};
|
|
630
|
+
imports.wbg.__wbindgen_is_object = function (arg0) {
|
|
631
|
+
const val = getObject(arg0);
|
|
632
|
+
const ret = typeof val === "object" && val !== null;
|
|
633
|
+
return ret;
|
|
634
|
+
};
|
|
635
|
+
imports.wbg.__wbindgen_is_string = function (arg0) {
|
|
636
|
+
const ret = typeof getObject(arg0) === "string";
|
|
637
|
+
return ret;
|
|
638
|
+
};
|
|
639
|
+
imports.wbg.__wbindgen_is_undefined = function (arg0) {
|
|
640
|
+
const ret = getObject(arg0) === undefined;
|
|
641
|
+
return ret;
|
|
642
|
+
};
|
|
643
|
+
imports.wbg.__wbindgen_memory = function () {
|
|
644
|
+
const ret = wasm.memory;
|
|
645
|
+
return addHeapObject(ret);
|
|
646
|
+
};
|
|
647
|
+
imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
|
|
648
|
+
const ret = getObject(arg0);
|
|
649
|
+
return addHeapObject(ret);
|
|
650
|
+
};
|
|
651
|
+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
|
|
652
|
+
takeObject(arg0);
|
|
653
|
+
};
|
|
654
|
+
imports.wbg.__wbindgen_string_get = function (arg0, arg1) {
|
|
655
|
+
const obj = getObject(arg1);
|
|
656
|
+
const ret = typeof obj === "string" ? obj : undefined;
|
|
657
|
+
var ptr1 = isLikeNone(ret)
|
|
658
|
+
? 0
|
|
659
|
+
: passStringToWasm0(
|
|
660
|
+
ret,
|
|
661
|
+
wasm.__wbindgen_export_1,
|
|
662
|
+
wasm.__wbindgen_export_2,
|
|
663
|
+
);
|
|
664
|
+
var len1 = WASM_VECTOR_LEN;
|
|
665
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
666
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
667
|
+
};
|
|
668
|
+
imports.wbg.__wbindgen_string_new = function (arg0, arg1) {
|
|
669
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
670
|
+
return addHeapObject(ret);
|
|
671
|
+
};
|
|
672
|
+
imports.wbg.__wbindgen_throw = function (arg0, arg1) {
|
|
673
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
return imports;
|
|
583
677
|
}
|
|
584
678
|
|
|
585
|
-
function __wbg_init_memory(imports, memory) {
|
|
586
|
-
|
|
587
|
-
}
|
|
679
|
+
function __wbg_init_memory(imports, memory) {}
|
|
588
680
|
|
|
589
681
|
function __wbg_finalize_init(instance, module) {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
682
|
+
wasm = instance.exports;
|
|
683
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
684
|
+
cachedDataViewMemory0 = null;
|
|
685
|
+
cachedUint8ArrayMemory0 = null;
|
|
594
686
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
return wasm;
|
|
687
|
+
return wasm;
|
|
598
688
|
}
|
|
599
689
|
|
|
600
690
|
function initSync(module) {
|
|
601
|
-
|
|
691
|
+
if (wasm !== undefined) return wasm;
|
|
602
692
|
|
|
603
|
-
|
|
604
|
-
if (
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
693
|
+
if (typeof module !== "undefined") {
|
|
694
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
695
|
+
({ module } = module);
|
|
696
|
+
} else {
|
|
697
|
+
console.warn(
|
|
698
|
+
"using deprecated parameters for `initSync()`; pass a single object instead",
|
|
699
|
+
);
|
|
610
700
|
}
|
|
701
|
+
}
|
|
611
702
|
|
|
612
|
-
|
|
703
|
+
const imports = __wbg_get_imports();
|
|
613
704
|
|
|
614
|
-
|
|
705
|
+
__wbg_init_memory(imports);
|
|
615
706
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
707
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
708
|
+
module = new WebAssembly.Module(module);
|
|
709
|
+
}
|
|
619
710
|
|
|
620
|
-
|
|
711
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
621
712
|
|
|
622
|
-
|
|
713
|
+
return __wbg_finalize_init(instance, module);
|
|
623
714
|
}
|
|
624
715
|
|
|
625
716
|
async function __wbg_init(module_or_path) {
|
|
626
|
-
|
|
717
|
+
if (wasm !== undefined) return wasm;
|
|
627
718
|
|
|
628
|
-
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
} else {
|
|
633
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
634
|
-
}
|
|
719
|
+
if (typeof module_or_path !== "undefined") {
|
|
720
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
721
|
+
({ module_or_path } = module_or_path);
|
|
722
|
+
} else {
|
|
635
723
|
}
|
|
724
|
+
}
|
|
636
725
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
726
|
+
if (typeof module_or_path === "undefined") {
|
|
727
|
+
module_or_path = new URL(
|
|
728
|
+
"confidential_transfer_proof_generation_bg.wasm",
|
|
729
|
+
import.meta.url,
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
const imports = __wbg_get_imports();
|
|
641
733
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
734
|
+
if (
|
|
735
|
+
typeof module_or_path === "string" ||
|
|
736
|
+
(typeof Request === "function" && module_or_path instanceof Request) ||
|
|
737
|
+
(typeof URL === "function" && module_or_path instanceof URL)
|
|
738
|
+
) {
|
|
739
|
+
module_or_path = fetch(module_or_path);
|
|
740
|
+
}
|
|
645
741
|
|
|
646
|
-
|
|
742
|
+
__wbg_init_memory(imports);
|
|
647
743
|
|
|
648
|
-
|
|
744
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
649
745
|
|
|
650
|
-
|
|
746
|
+
return __wbg_finalize_init(instance, module);
|
|
651
747
|
}
|
|
652
748
|
|
|
653
749
|
export { initSync };
|