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