@rustledger/wasm 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -338
- package/package.json +1 -1
- package/rustledger_wasm.d.ts +238 -121
- package/rustledger_wasm.js +381 -284
- package/rustledger_wasm_bg.wasm +0 -0
package/rustledger_wasm.js
CHANGED
|
@@ -1,123 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function addHeapObject(obj) {
|
|
4
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
5
|
-
const idx = heap_next;
|
|
6
|
-
heap_next = heap[idx];
|
|
7
|
-
|
|
8
|
-
heap[idx] = obj;
|
|
9
|
-
return idx;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function dropObject(idx) {
|
|
13
|
-
if (idx < 132) return;
|
|
14
|
-
heap[idx] = heap_next;
|
|
15
|
-
heap_next = idx;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let cachedDataViewMemory0 = null;
|
|
19
|
-
function getDataViewMemory0() {
|
|
20
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
21
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
22
|
-
}
|
|
23
|
-
return cachedDataViewMemory0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getStringFromWasm0(ptr, len) {
|
|
27
|
-
ptr = ptr >>> 0;
|
|
28
|
-
return decodeText(ptr, len);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let cachedUint8ArrayMemory0 = null;
|
|
32
|
-
function getUint8ArrayMemory0() {
|
|
33
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
34
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
35
|
-
}
|
|
36
|
-
return cachedUint8ArrayMemory0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getObject(idx) { return heap[idx]; }
|
|
40
|
-
|
|
41
|
-
let heap = new Array(128).fill(undefined);
|
|
42
|
-
heap.push(undefined, null, true, false);
|
|
43
|
-
|
|
44
|
-
let heap_next = heap.length;
|
|
45
|
-
|
|
46
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
47
|
-
if (realloc === undefined) {
|
|
48
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
49
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
50
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
51
|
-
WASM_VECTOR_LEN = buf.length;
|
|
52
|
-
return ptr;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let len = arg.length;
|
|
56
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
57
|
-
|
|
58
|
-
const mem = getUint8ArrayMemory0();
|
|
59
|
-
|
|
60
|
-
let offset = 0;
|
|
61
|
-
|
|
62
|
-
for (; offset < len; offset++) {
|
|
63
|
-
const code = arg.charCodeAt(offset);
|
|
64
|
-
if (code > 0x7F) break;
|
|
65
|
-
mem[ptr + offset] = code;
|
|
66
|
-
}
|
|
67
|
-
if (offset !== len) {
|
|
68
|
-
if (offset !== 0) {
|
|
69
|
-
arg = arg.slice(offset);
|
|
70
|
-
}
|
|
71
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
72
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
73
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
74
|
-
|
|
75
|
-
offset += ret.written;
|
|
76
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
WASM_VECTOR_LEN = offset;
|
|
80
|
-
return ptr;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function takeObject(idx) {
|
|
84
|
-
const ret = getObject(idx);
|
|
85
|
-
dropObject(idx);
|
|
86
|
-
return ret;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
90
|
-
cachedTextDecoder.decode();
|
|
91
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
92
|
-
let numBytesDecoded = 0;
|
|
93
|
-
function decodeText(ptr, len) {
|
|
94
|
-
numBytesDecoded += len;
|
|
95
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
96
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
97
|
-
cachedTextDecoder.decode();
|
|
98
|
-
numBytesDecoded = len;
|
|
99
|
-
}
|
|
100
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const cachedTextEncoder = new TextEncoder();
|
|
104
|
-
|
|
105
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
106
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
107
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
108
|
-
view.set(buf);
|
|
109
|
-
return {
|
|
110
|
-
read: arg.length,
|
|
111
|
-
written: buf.length
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let WASM_VECTOR_LEN = 0;
|
|
117
|
-
|
|
118
|
-
const ParsedLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
119
|
-
? { register: () => {}, unregister: () => {} }
|
|
120
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_parsedledger_free(ptr >>> 0, 1));
|
|
1
|
+
/* @ts-self-types="./rustledger_wasm.d.ts" */
|
|
121
2
|
|
|
122
3
|
/**
|
|
123
4
|
* A parsed and validated ledger that caches the parse result.
|
|
@@ -147,13 +28,13 @@ export class ParsedLedger {
|
|
|
147
28
|
wasm.__wbg_parsedledger_free(ptr, 0);
|
|
148
29
|
}
|
|
149
30
|
/**
|
|
150
|
-
* Get
|
|
31
|
+
* Get account balances (shorthand for query("BALANCES")).
|
|
151
32
|
* @returns {any}
|
|
152
33
|
*/
|
|
153
|
-
|
|
34
|
+
balances() {
|
|
154
35
|
try {
|
|
155
36
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
156
|
-
wasm.
|
|
37
|
+
wasm.parsedledger_balances(retptr, this.__wbg_ptr);
|
|
157
38
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
158
39
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
159
40
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -166,16 +47,21 @@ export class ParsedLedger {
|
|
|
166
47
|
}
|
|
167
48
|
}
|
|
168
49
|
/**
|
|
169
|
-
*
|
|
170
|
-
* @
|
|
50
|
+
* Get the number of directives.
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
directiveCount() {
|
|
54
|
+
const ret = wasm.parsedledger_directiveCount(this.__wbg_ptr);
|
|
55
|
+
return ret >>> 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Expand pad directives.
|
|
171
59
|
* @returns {any}
|
|
172
60
|
*/
|
|
173
|
-
|
|
61
|
+
expandPads() {
|
|
174
62
|
try {
|
|
175
63
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
176
|
-
|
|
177
|
-
const len0 = WASM_VECTOR_LEN;
|
|
178
|
-
wasm.parsedledger_runPlugin(retptr, this.__wbg_ptr, ptr0, len0);
|
|
64
|
+
wasm.parsedledger_expandPads(retptr, this.__wbg_ptr);
|
|
179
65
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
66
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
67
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -188,13 +74,13 @@ export class ParsedLedger {
|
|
|
188
74
|
}
|
|
189
75
|
}
|
|
190
76
|
/**
|
|
191
|
-
*
|
|
77
|
+
* Format the ledger source.
|
|
192
78
|
* @returns {any}
|
|
193
79
|
*/
|
|
194
|
-
|
|
80
|
+
format() {
|
|
195
81
|
try {
|
|
196
82
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
197
|
-
wasm.
|
|
83
|
+
wasm.parsedledger_format(retptr, this.__wbg_ptr);
|
|
198
84
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
199
85
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
200
86
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -207,13 +93,42 @@ export class ParsedLedger {
|
|
|
207
93
|
}
|
|
208
94
|
}
|
|
209
95
|
/**
|
|
210
|
-
* Get the
|
|
96
|
+
* Get completions at the given position.
|
|
97
|
+
*
|
|
98
|
+
* Returns context-aware completions for accounts, currencies, directives, etc.
|
|
99
|
+
* Uses cached account/currency/payee data for efficiency.
|
|
100
|
+
* @param {number} line
|
|
101
|
+
* @param {number} character
|
|
211
102
|
* @returns {any}
|
|
212
103
|
*/
|
|
213
|
-
|
|
104
|
+
getCompletions(line, character) {
|
|
214
105
|
try {
|
|
215
106
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
216
|
-
wasm.
|
|
107
|
+
wasm.parsedledger_getCompletions(retptr, this.__wbg_ptr, line, character);
|
|
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
|
+
* Get the definition location for the symbol at the given position.
|
|
121
|
+
*
|
|
122
|
+
* Returns the location of the `open` or `commodity` directive for accounts/currencies.
|
|
123
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
124
|
+
* @param {number} line
|
|
125
|
+
* @param {number} character
|
|
126
|
+
* @returns {any}
|
|
127
|
+
*/
|
|
128
|
+
getDefinition(line, character) {
|
|
129
|
+
try {
|
|
130
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
131
|
+
wasm.parsedledger_getDefinition(retptr, this.__wbg_ptr, line, character);
|
|
217
132
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
218
133
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
219
134
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -245,12 +160,87 @@ export class ParsedLedger {
|
|
|
245
160
|
}
|
|
246
161
|
}
|
|
247
162
|
/**
|
|
248
|
-
* Get the
|
|
249
|
-
*
|
|
163
|
+
* Get all document symbols for the outline view.
|
|
164
|
+
*
|
|
165
|
+
* Returns a hierarchical list of all directives with their positions.
|
|
166
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
167
|
+
* @returns {any}
|
|
250
168
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
169
|
+
getDocumentSymbols() {
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
wasm.parsedledger_getDocumentSymbols(retptr, this.__wbg_ptr);
|
|
173
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
174
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
175
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
176
|
+
if (r2) {
|
|
177
|
+
throw takeObject(r1);
|
|
178
|
+
}
|
|
179
|
+
return takeObject(r0);
|
|
180
|
+
} finally {
|
|
181
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get all errors (parse + validation).
|
|
186
|
+
* @returns {any}
|
|
187
|
+
*/
|
|
188
|
+
getErrors() {
|
|
189
|
+
try {
|
|
190
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
191
|
+
wasm.parsedledger_getErrors(retptr, this.__wbg_ptr);
|
|
192
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
193
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
194
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
195
|
+
if (r2) {
|
|
196
|
+
throw takeObject(r1);
|
|
197
|
+
}
|
|
198
|
+
return takeObject(r0);
|
|
199
|
+
} finally {
|
|
200
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get hover information at the given position.
|
|
205
|
+
*
|
|
206
|
+
* Returns documentation for accounts, currencies, and directive keywords.
|
|
207
|
+
* @param {number} line
|
|
208
|
+
* @param {number} character
|
|
209
|
+
* @returns {any}
|
|
210
|
+
*/
|
|
211
|
+
getHoverInfo(line, character) {
|
|
212
|
+
try {
|
|
213
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
214
|
+
wasm.parsedledger_getHoverInfo(retptr, this.__wbg_ptr, line, character);
|
|
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
|
+
if (r2) {
|
|
219
|
+
throw takeObject(r1);
|
|
220
|
+
}
|
|
221
|
+
return takeObject(r0);
|
|
222
|
+
} finally {
|
|
223
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get the ledger options.
|
|
228
|
+
* @returns {any}
|
|
229
|
+
*/
|
|
230
|
+
getOptions() {
|
|
231
|
+
try {
|
|
232
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
233
|
+
wasm.parsedledger_getOptions(retptr, this.__wbg_ptr);
|
|
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
|
+
}
|
|
254
244
|
}
|
|
255
245
|
/**
|
|
256
246
|
* Get parse errors only.
|
|
@@ -290,6 +280,14 @@ export class ParsedLedger {
|
|
|
290
280
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
291
281
|
}
|
|
292
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if the ledger is valid (no parse or validation errors).
|
|
285
|
+
* @returns {boolean}
|
|
286
|
+
*/
|
|
287
|
+
isValid() {
|
|
288
|
+
const ret = wasm.parsedledger_isValid(this.__wbg_ptr);
|
|
289
|
+
return ret !== 0;
|
|
290
|
+
}
|
|
293
291
|
/**
|
|
294
292
|
* Create a new `ParsedLedger` from source text.
|
|
295
293
|
*
|
|
@@ -327,32 +325,16 @@ export class ParsedLedger {
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
/**
|
|
330
|
-
*
|
|
331
|
-
* @
|
|
332
|
-
*/
|
|
333
|
-
format() {
|
|
334
|
-
try {
|
|
335
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
336
|
-
wasm.parsedledger_format(retptr, this.__wbg_ptr);
|
|
337
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
340
|
-
if (r2) {
|
|
341
|
-
throw takeObject(r1);
|
|
342
|
-
}
|
|
343
|
-
return takeObject(r0);
|
|
344
|
-
} finally {
|
|
345
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Get account balances (shorthand for query("BALANCES")).
|
|
328
|
+
* Run a native plugin on this ledger.
|
|
329
|
+
* @param {string} plugin_name
|
|
350
330
|
* @returns {any}
|
|
351
331
|
*/
|
|
352
|
-
|
|
332
|
+
runPlugin(plugin_name) {
|
|
353
333
|
try {
|
|
354
334
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
355
|
-
wasm.
|
|
335
|
+
const ptr0 = passStringToWasm0(plugin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
wasm.parsedledger_runPlugin(retptr, this.__wbg_ptr, ptr0, len0);
|
|
356
338
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
357
339
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
358
340
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -364,14 +346,6 @@ export class ParsedLedger {
|
|
|
364
346
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
365
347
|
}
|
|
366
348
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Check if the ledger is valid (no parse or validation errors).
|
|
369
|
-
* @returns {boolean}
|
|
370
|
-
*/
|
|
371
|
-
isValid() {
|
|
372
|
-
const ret = wasm.parsedledger_isValid(this.__wbg_ptr);
|
|
373
|
-
return ret !== 0;
|
|
374
|
-
}
|
|
375
349
|
}
|
|
376
350
|
if (Symbol.dispose) ParsedLedger.prototype[Symbol.dispose] = ParsedLedger.prototype.free;
|
|
377
351
|
|
|
@@ -640,7 +614,232 @@ export function version() {
|
|
|
640
614
|
}
|
|
641
615
|
}
|
|
642
616
|
|
|
643
|
-
|
|
617
|
+
function __wbg_get_imports() {
|
|
618
|
+
const import0 = {
|
|
619
|
+
__proto__: null,
|
|
620
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
621
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
},
|
|
624
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
625
|
+
const ret = String(getObject(arg1));
|
|
626
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
627
|
+
const len1 = WASM_VECTOR_LEN;
|
|
628
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
629
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
630
|
+
},
|
|
631
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
632
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
633
|
+
},
|
|
634
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
635
|
+
let deferred0_0;
|
|
636
|
+
let deferred0_1;
|
|
637
|
+
try {
|
|
638
|
+
deferred0_0 = arg0;
|
|
639
|
+
deferred0_1 = arg1;
|
|
640
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
641
|
+
} finally {
|
|
642
|
+
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
__wbg_getTime_1e3cd1391c5c3995: function(arg0) {
|
|
646
|
+
const ret = getObject(arg0).getTime();
|
|
647
|
+
return ret;
|
|
648
|
+
},
|
|
649
|
+
__wbg_getTimezoneOffset_81776d10a4ec18a8: function(arg0) {
|
|
650
|
+
const ret = getObject(arg0).getTimezoneOffset();
|
|
651
|
+
return ret;
|
|
652
|
+
},
|
|
653
|
+
__wbg_new_0_73afc35eb544e539: function() {
|
|
654
|
+
const ret = new Date();
|
|
655
|
+
return addHeapObject(ret);
|
|
656
|
+
},
|
|
657
|
+
__wbg_new_245cd5c49157e602: function(arg0) {
|
|
658
|
+
const ret = new Date(getObject(arg0));
|
|
659
|
+
return addHeapObject(ret);
|
|
660
|
+
},
|
|
661
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
662
|
+
const ret = new Object();
|
|
663
|
+
return addHeapObject(ret);
|
|
664
|
+
},
|
|
665
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
666
|
+
const ret = new Array();
|
|
667
|
+
return addHeapObject(ret);
|
|
668
|
+
},
|
|
669
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
670
|
+
const ret = new Error();
|
|
671
|
+
return addHeapObject(ret);
|
|
672
|
+
},
|
|
673
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
674
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
675
|
+
},
|
|
676
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
677
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
678
|
+
},
|
|
679
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
680
|
+
const ret = getObject(arg1).stack;
|
|
681
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
682
|
+
const len1 = WASM_VECTOR_LEN;
|
|
683
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
684
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
685
|
+
},
|
|
686
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
687
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
688
|
+
const ret = arg0;
|
|
689
|
+
return addHeapObject(ret);
|
|
690
|
+
},
|
|
691
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
692
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
693
|
+
const ret = arg0;
|
|
694
|
+
return addHeapObject(ret);
|
|
695
|
+
},
|
|
696
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
697
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
698
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
699
|
+
return addHeapObject(ret);
|
|
700
|
+
},
|
|
701
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
702
|
+
const ret = getObject(arg0);
|
|
703
|
+
return addHeapObject(ret);
|
|
704
|
+
},
|
|
705
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
706
|
+
takeObject(arg0);
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
return {
|
|
710
|
+
__proto__: null,
|
|
711
|
+
"./rustledger_wasm_bg.js": import0,
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
const ParsedLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
716
|
+
? { register: () => {}, unregister: () => {} }
|
|
717
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parsedledger_free(ptr >>> 0, 1));
|
|
718
|
+
|
|
719
|
+
function addHeapObject(obj) {
|
|
720
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
721
|
+
const idx = heap_next;
|
|
722
|
+
heap_next = heap[idx];
|
|
723
|
+
|
|
724
|
+
heap[idx] = obj;
|
|
725
|
+
return idx;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function dropObject(idx) {
|
|
729
|
+
if (idx < 132) return;
|
|
730
|
+
heap[idx] = heap_next;
|
|
731
|
+
heap_next = idx;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
let cachedDataViewMemory0 = null;
|
|
735
|
+
function getDataViewMemory0() {
|
|
736
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
737
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
738
|
+
}
|
|
739
|
+
return cachedDataViewMemory0;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function getStringFromWasm0(ptr, len) {
|
|
743
|
+
ptr = ptr >>> 0;
|
|
744
|
+
return decodeText(ptr, len);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
let cachedUint8ArrayMemory0 = null;
|
|
748
|
+
function getUint8ArrayMemory0() {
|
|
749
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
750
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
751
|
+
}
|
|
752
|
+
return cachedUint8ArrayMemory0;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function getObject(idx) { return heap[idx]; }
|
|
756
|
+
|
|
757
|
+
let heap = new Array(128).fill(undefined);
|
|
758
|
+
heap.push(undefined, null, true, false);
|
|
759
|
+
|
|
760
|
+
let heap_next = heap.length;
|
|
761
|
+
|
|
762
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
763
|
+
if (realloc === undefined) {
|
|
764
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
765
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
766
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
767
|
+
WASM_VECTOR_LEN = buf.length;
|
|
768
|
+
return ptr;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
let len = arg.length;
|
|
772
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
773
|
+
|
|
774
|
+
const mem = getUint8ArrayMemory0();
|
|
775
|
+
|
|
776
|
+
let offset = 0;
|
|
777
|
+
|
|
778
|
+
for (; offset < len; offset++) {
|
|
779
|
+
const code = arg.charCodeAt(offset);
|
|
780
|
+
if (code > 0x7F) break;
|
|
781
|
+
mem[ptr + offset] = code;
|
|
782
|
+
}
|
|
783
|
+
if (offset !== len) {
|
|
784
|
+
if (offset !== 0) {
|
|
785
|
+
arg = arg.slice(offset);
|
|
786
|
+
}
|
|
787
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
788
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
789
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
790
|
+
|
|
791
|
+
offset += ret.written;
|
|
792
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
WASM_VECTOR_LEN = offset;
|
|
796
|
+
return ptr;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function takeObject(idx) {
|
|
800
|
+
const ret = getObject(idx);
|
|
801
|
+
dropObject(idx);
|
|
802
|
+
return ret;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
806
|
+
cachedTextDecoder.decode();
|
|
807
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
808
|
+
let numBytesDecoded = 0;
|
|
809
|
+
function decodeText(ptr, len) {
|
|
810
|
+
numBytesDecoded += len;
|
|
811
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
812
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
813
|
+
cachedTextDecoder.decode();
|
|
814
|
+
numBytesDecoded = len;
|
|
815
|
+
}
|
|
816
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const cachedTextEncoder = new TextEncoder();
|
|
820
|
+
|
|
821
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
822
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
823
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
824
|
+
view.set(buf);
|
|
825
|
+
return {
|
|
826
|
+
read: arg.length,
|
|
827
|
+
written: buf.length
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
let WASM_VECTOR_LEN = 0;
|
|
833
|
+
|
|
834
|
+
let wasmModule, wasm;
|
|
835
|
+
function __wbg_finalize_init(instance, module) {
|
|
836
|
+
wasm = instance.exports;
|
|
837
|
+
wasmModule = module;
|
|
838
|
+
cachedDataViewMemory0 = null;
|
|
839
|
+
cachedUint8ArrayMemory0 = null;
|
|
840
|
+
wasm.__wbindgen_start();
|
|
841
|
+
return wasm;
|
|
842
|
+
}
|
|
644
843
|
|
|
645
844
|
async function __wbg_load(module, imports) {
|
|
646
845
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -648,14 +847,12 @@ async function __wbg_load(module, imports) {
|
|
|
648
847
|
try {
|
|
649
848
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
650
849
|
} catch (e) {
|
|
651
|
-
const validResponse = module.ok &&
|
|
850
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
652
851
|
|
|
653
852
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
654
853
|
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);
|
|
655
854
|
|
|
656
|
-
} else {
|
|
657
|
-
throw e;
|
|
658
|
-
}
|
|
855
|
+
} else { throw e; }
|
|
659
856
|
}
|
|
660
857
|
}
|
|
661
858
|
|
|
@@ -670,119 +867,20 @@ async function __wbg_load(module, imports) {
|
|
|
670
867
|
return instance;
|
|
671
868
|
}
|
|
672
869
|
}
|
|
673
|
-
}
|
|
674
870
|
|
|
675
|
-
function
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
679
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
680
|
-
return addHeapObject(ret);
|
|
681
|
-
};
|
|
682
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
683
|
-
const ret = String(getObject(arg1));
|
|
684
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
685
|
-
const len1 = WASM_VECTOR_LEN;
|
|
686
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
687
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
688
|
-
};
|
|
689
|
-
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
690
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
691
|
-
};
|
|
692
|
-
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
693
|
-
let deferred0_0;
|
|
694
|
-
let deferred0_1;
|
|
695
|
-
try {
|
|
696
|
-
deferred0_0 = arg0;
|
|
697
|
-
deferred0_1 = arg1;
|
|
698
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
699
|
-
} finally {
|
|
700
|
-
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
871
|
+
function expectedResponseType(type) {
|
|
872
|
+
switch (type) {
|
|
873
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
701
874
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
const ret = getObject(arg0).getTime();
|
|
705
|
-
return ret;
|
|
706
|
-
};
|
|
707
|
-
imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
|
|
708
|
-
const ret = getObject(arg0).getTimezoneOffset();
|
|
709
|
-
return ret;
|
|
710
|
-
};
|
|
711
|
-
imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
|
|
712
|
-
const ret = new Date();
|
|
713
|
-
return addHeapObject(ret);
|
|
714
|
-
};
|
|
715
|
-
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
716
|
-
const ret = new Object();
|
|
717
|
-
return addHeapObject(ret);
|
|
718
|
-
};
|
|
719
|
-
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
720
|
-
const ret = new Array();
|
|
721
|
-
return addHeapObject(ret);
|
|
722
|
-
};
|
|
723
|
-
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
724
|
-
const ret = new Error();
|
|
725
|
-
return addHeapObject(ret);
|
|
726
|
-
};
|
|
727
|
-
imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
|
|
728
|
-
const ret = new Date(getObject(arg0));
|
|
729
|
-
return addHeapObject(ret);
|
|
730
|
-
};
|
|
731
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
732
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
733
|
-
};
|
|
734
|
-
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
735
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
736
|
-
};
|
|
737
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
738
|
-
const ret = getObject(arg1).stack;
|
|
739
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
740
|
-
const len1 = WASM_VECTOR_LEN;
|
|
741
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
742
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
743
|
-
};
|
|
744
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
745
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
746
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
747
|
-
return addHeapObject(ret);
|
|
748
|
-
};
|
|
749
|
-
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
750
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
751
|
-
const ret = arg0;
|
|
752
|
-
return addHeapObject(ret);
|
|
753
|
-
};
|
|
754
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
755
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
756
|
-
const ret = arg0;
|
|
757
|
-
return addHeapObject(ret);
|
|
758
|
-
};
|
|
759
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
760
|
-
const ret = getObject(arg0);
|
|
761
|
-
return addHeapObject(ret);
|
|
762
|
-
};
|
|
763
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
764
|
-
takeObject(arg0);
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
return imports;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
function __wbg_finalize_init(instance, module) {
|
|
771
|
-
wasm = instance.exports;
|
|
772
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
773
|
-
cachedDataViewMemory0 = null;
|
|
774
|
-
cachedUint8ArrayMemory0 = null;
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
wasm.__wbindgen_start();
|
|
778
|
-
return wasm;
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
779
877
|
}
|
|
780
878
|
|
|
781
879
|
function initSync(module) {
|
|
782
880
|
if (wasm !== undefined) return wasm;
|
|
783
881
|
|
|
784
882
|
|
|
785
|
-
if (
|
|
883
|
+
if (module !== undefined) {
|
|
786
884
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
787
885
|
({module} = module)
|
|
788
886
|
} else {
|
|
@@ -802,7 +900,7 @@ async function __wbg_init(module_or_path) {
|
|
|
802
900
|
if (wasm !== undefined) return wasm;
|
|
803
901
|
|
|
804
902
|
|
|
805
|
-
if (
|
|
903
|
+
if (module_or_path !== undefined) {
|
|
806
904
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
807
905
|
({module_or_path} = module_or_path)
|
|
808
906
|
} else {
|
|
@@ -810,7 +908,7 @@ async function __wbg_init(module_or_path) {
|
|
|
810
908
|
}
|
|
811
909
|
}
|
|
812
910
|
|
|
813
|
-
if (
|
|
911
|
+
if (module_or_path === undefined) {
|
|
814
912
|
module_or_path = new URL('rustledger_wasm_bg.wasm', import.meta.url);
|
|
815
913
|
}
|
|
816
914
|
const imports = __wbg_get_imports();
|
|
@@ -824,5 +922,4 @@ async function __wbg_init(module_or_path) {
|
|
|
824
922
|
return __wbg_finalize_init(instance, module);
|
|
825
923
|
}
|
|
826
924
|
|
|
827
|
-
export { initSync };
|
|
828
|
-
export default __wbg_init;
|
|
925
|
+
export { initSync, __wbg_init as default };
|