@proof-labs/trading-sdk 4.0.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/LICENSE +201 -0
- package/README.md +391 -0
- package/dist/client.d.ts +640 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1730 -0
- package/dist/client.js.map +1 -0
- package/dist/codec-adapter.d.ts +33 -0
- package/dist/codec-adapter.d.ts.map +1 -0
- package/dist/codec-adapter.js +419 -0
- package/dist/codec-adapter.js.map +1 -0
- package/dist/codec.d.ts +137 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +229 -0
- package/dist/codec.js.map +1 -0
- package/dist/crypto.d.ts +78 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +145 -0
- package/dist/crypto.js.map +1 -0
- package/dist/errors.d.ts +122 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +397 -0
- package/dist/errors.js.map +1 -0
- package/dist/governance-query.d.ts +47 -0
- package/dist/governance-query.d.ts.map +1 -0
- package/dist/governance-query.js +525 -0
- package/dist/governance-query.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/testing.d.ts +25 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +22 -0
- package/dist/testing.js.map +1 -0
- package/dist/trigger-history.d.ts +9 -0
- package/dist/trigger-history.d.ts.map +1 -0
- package/dist/trigger-history.js +442 -0
- package/dist/trigger-history.js.map +1 -0
- package/dist/triggers.d.ts +15 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +399 -0
- package/dist/triggers.js.map +1 -0
- package/dist/tx-result.d.ts +53 -0
- package/dist/tx-result.d.ts.map +1 -0
- package/dist/tx-result.js +58 -0
- package/dist/tx-result.js.map +1 -0
- package/dist/types.d.ts +2085 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +121 -0
- package/dist/types.js.map +1 -0
- package/dist/wasm/proof_trading_sdk_wasm.d.ts +98 -0
- package/dist/wasm/proof_trading_sdk_wasm.js +698 -0
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm.d.ts +19 -0
- package/dist/wasm-loader.d.ts +42 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.js +95 -0
- package/dist/wasm-loader.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
/* @ts-self-types="./proof_trading_sdk_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Recompute the engine's §2.4 domain-separated admin-proposal content hash
|
|
5
|
+
* (`PROOF_ADMIN_PROPOSAL_V1` preimage) in the authoritative core, so an
|
|
6
|
+
* approving client can verify a proposal's `content_hash` locally instead of
|
|
7
|
+
* trusting a server-supplied value. `action` is the serde map form
|
|
8
|
+
* (`{ Variant: { snake_case_fields } }`), the same shape [`encode_payload`]
|
|
9
|
+
* takes for the governance actions' `action` field.
|
|
10
|
+
* @param {Uint8Array} chain_id
|
|
11
|
+
* @param {bigint} proposal_id
|
|
12
|
+
* @param {bigint} registry_version
|
|
13
|
+
* @param {number} threshold
|
|
14
|
+
* @param {Uint8Array} proposer
|
|
15
|
+
* @param {bigint} created_height
|
|
16
|
+
* @param {bigint} created_ms
|
|
17
|
+
* @param {bigint} expiry_ms
|
|
18
|
+
* @param {any} action
|
|
19
|
+
* @returns {Uint8Array}
|
|
20
|
+
*/
|
|
21
|
+
export function admin_proposal_content_hash(chain_id, proposal_id, registry_version, threshold, proposer, created_height, created_ms, expiry_ms, action) {
|
|
22
|
+
const ptr0 = passArray8ToWasm0(chain_id, wasm.__wbindgen_malloc);
|
|
23
|
+
const len0 = WASM_VECTOR_LEN;
|
|
24
|
+
const ptr1 = passArray8ToWasm0(proposer, wasm.__wbindgen_malloc);
|
|
25
|
+
const len1 = WASM_VECTOR_LEN;
|
|
26
|
+
const ret = wasm.admin_proposal_content_hash(ptr0, len0, proposal_id, registry_version, threshold, ptr1, len1, created_height, created_ms, expiry_ms, action);
|
|
27
|
+
if (ret[3]) {
|
|
28
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
29
|
+
}
|
|
30
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
31
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
32
|
+
return v3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Hash a CometBFT chain-id string into the 32-byte signing binding.
|
|
37
|
+
* @param {string} chain_id
|
|
38
|
+
* @returns {Uint8Array}
|
|
39
|
+
*/
|
|
40
|
+
export function chain_id_from_string(chain_id) {
|
|
41
|
+
const ptr0 = passStringToWasm0(chain_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
42
|
+
const len0 = WASM_VECTOR_LEN;
|
|
43
|
+
const ret = wasm.chain_id_from_string(ptr0, len0);
|
|
44
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
45
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
46
|
+
return v2;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Decode MessagePack payload bytes for `action_type` back into a JS object,
|
|
51
|
+
* via the core's `decode_payload_dyn`. Inverse of [`encode_payload`].
|
|
52
|
+
* @param {number} action_type
|
|
53
|
+
* @param {Uint8Array} payload
|
|
54
|
+
* @returns {any}
|
|
55
|
+
*/
|
|
56
|
+
export function decode_payload(action_type, payload) {
|
|
57
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
58
|
+
const len0 = WASM_VECTOR_LEN;
|
|
59
|
+
const ret = wasm.decode_payload(action_type, ptr0, len0);
|
|
60
|
+
if (ret[2]) {
|
|
61
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
62
|
+
}
|
|
63
|
+
return takeFromExternrefTable0(ret[0]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Encode a structured action payload (a JS object with the core's snake_case
|
|
68
|
+
* field names) into authoritative MessagePack wire bytes, via the core's
|
|
69
|
+
* `encode_payload_dyn`. The returned bytes match `rmp-serde` — and therefore
|
|
70
|
+
* the exchange engine — byte-for-byte.
|
|
71
|
+
* @param {number} action_type
|
|
72
|
+
* @param {any} fields
|
|
73
|
+
* @returns {Uint8Array}
|
|
74
|
+
*/
|
|
75
|
+
export function encode_payload(action_type, fields) {
|
|
76
|
+
const ret = wasm.encode_payload(action_type, fields);
|
|
77
|
+
if (ret[3]) {
|
|
78
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
79
|
+
}
|
|
80
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
81
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
82
|
+
return v1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Assemble a signed wire envelope from a pre-computed pubkey + signature.
|
|
87
|
+
* @param {number} action_type
|
|
88
|
+
* @param {Uint8Array} payload
|
|
89
|
+
* @param {bigint} seq
|
|
90
|
+
* @param {Uint8Array} pubkey
|
|
91
|
+
* @param {Uint8Array} signature
|
|
92
|
+
* @returns {Uint8Array}
|
|
93
|
+
*/
|
|
94
|
+
export function encode_signed_tx(action_type, payload, seq, pubkey, signature) {
|
|
95
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ptr1 = passArray8ToWasm0(pubkey, wasm.__wbindgen_malloc);
|
|
98
|
+
const len1 = WASM_VECTOR_LEN;
|
|
99
|
+
const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
100
|
+
const len2 = WASM_VECTOR_LEN;
|
|
101
|
+
const ret = wasm.encode_signed_tx(action_type, ptr0, len0, seq, ptr1, len1, ptr2, len2);
|
|
102
|
+
if (ret[3]) {
|
|
103
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
104
|
+
}
|
|
105
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
106
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
107
|
+
return v4;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Derive the 20-byte owner address from a 32-byte Ed25519 public key.
|
|
112
|
+
* @param {Uint8Array} pubkey
|
|
113
|
+
* @returns {Uint8Array}
|
|
114
|
+
*/
|
|
115
|
+
export function pubkey_to_owner(pubkey) {
|
|
116
|
+
const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_malloc);
|
|
117
|
+
const len0 = WASM_VECTOR_LEN;
|
|
118
|
+
const ret = wasm.pubkey_to_owner(ptr0, len0);
|
|
119
|
+
if (ret[3]) {
|
|
120
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
121
|
+
}
|
|
122
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
123
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
124
|
+
return v2;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Sign a pre-encoded payload with `secret_key` and assemble the signed wire
|
|
129
|
+
* envelope — the whole value-bearing path in the authoritative core. The key
|
|
130
|
+
* is used to build a deterministic Ed25519 signature and is not retained.
|
|
131
|
+
* @param {Uint8Array} chain_id
|
|
132
|
+
* @param {number} action_type
|
|
133
|
+
* @param {Uint8Array} payload
|
|
134
|
+
* @param {bigint} seq
|
|
135
|
+
* @param {Uint8Array} secret_key
|
|
136
|
+
* @returns {Uint8Array}
|
|
137
|
+
*/
|
|
138
|
+
export function sign_and_encode(chain_id, action_type, payload, seq, secret_key) {
|
|
139
|
+
const ptr0 = passArray8ToWasm0(chain_id, wasm.__wbindgen_malloc);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
142
|
+
const len1 = WASM_VECTOR_LEN;
|
|
143
|
+
const ptr2 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
144
|
+
const len2 = WASM_VECTOR_LEN;
|
|
145
|
+
const ret = wasm.sign_and_encode(ptr0, len0, action_type, ptr1, len1, seq, ptr2, len2);
|
|
146
|
+
if (ret[3]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
148
|
+
}
|
|
149
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
150
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
151
|
+
return v4;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Build the deterministic signing message
|
|
156
|
+
* (`DOMAIN_PREFIX || chain_id || action_type || seq_be || payload`).
|
|
157
|
+
* @param {Uint8Array} chain_id
|
|
158
|
+
* @param {number} action_type
|
|
159
|
+
* @param {bigint} seq
|
|
160
|
+
* @param {Uint8Array} payload
|
|
161
|
+
* @returns {Uint8Array}
|
|
162
|
+
*/
|
|
163
|
+
export function signing_message(chain_id, action_type, seq, payload) {
|
|
164
|
+
const ptr0 = passArray8ToWasm0(chain_id, wasm.__wbindgen_malloc);
|
|
165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
166
|
+
const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
167
|
+
const len1 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.signing_message(ptr0, len0, action_type, seq, ptr1, len1);
|
|
169
|
+
if (ret[3]) {
|
|
170
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
171
|
+
}
|
|
172
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
173
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
174
|
+
return v3;
|
|
175
|
+
}
|
|
176
|
+
function __wbg_get_imports() {
|
|
177
|
+
const import0 = {
|
|
178
|
+
__proto__: null,
|
|
179
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
180
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
181
|
+
return ret;
|
|
182
|
+
},
|
|
183
|
+
__wbg_Number_9a4e0ecb0fa16705: function(arg0) {
|
|
184
|
+
const ret = Number(arg0);
|
|
185
|
+
return ret;
|
|
186
|
+
},
|
|
187
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
188
|
+
const ret = String(arg1);
|
|
189
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
190
|
+
const len1 = WASM_VECTOR_LEN;
|
|
191
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
192
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
193
|
+
},
|
|
194
|
+
__wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
|
|
195
|
+
const v = arg1;
|
|
196
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
197
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
198
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
199
|
+
},
|
|
200
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
201
|
+
const v = arg0;
|
|
202
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
203
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
204
|
+
},
|
|
205
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
206
|
+
const ret = debugString(arg1);
|
|
207
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
208
|
+
const len1 = WASM_VECTOR_LEN;
|
|
209
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
210
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
211
|
+
},
|
|
212
|
+
__wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
213
|
+
const ret = arg0 in arg1;
|
|
214
|
+
return ret;
|
|
215
|
+
},
|
|
216
|
+
__wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
|
|
217
|
+
const ret = typeof(arg0) === 'bigint';
|
|
218
|
+
return ret;
|
|
219
|
+
},
|
|
220
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
221
|
+
const ret = typeof(arg0) === 'function';
|
|
222
|
+
return ret;
|
|
223
|
+
},
|
|
224
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
225
|
+
const val = arg0;
|
|
226
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
227
|
+
return ret;
|
|
228
|
+
},
|
|
229
|
+
__wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
|
|
230
|
+
const ret = typeof(arg0) === 'string';
|
|
231
|
+
return ret;
|
|
232
|
+
},
|
|
233
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
234
|
+
const ret = arg0 === undefined;
|
|
235
|
+
return ret;
|
|
236
|
+
},
|
|
237
|
+
__wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
|
|
238
|
+
const ret = arg0 === arg1;
|
|
239
|
+
return ret;
|
|
240
|
+
},
|
|
241
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
242
|
+
const ret = arg0 == arg1;
|
|
243
|
+
return ret;
|
|
244
|
+
},
|
|
245
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
246
|
+
const obj = arg1;
|
|
247
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
248
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
249
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
250
|
+
},
|
|
251
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
252
|
+
const obj = arg1;
|
|
253
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
254
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
255
|
+
var len1 = WASM_VECTOR_LEN;
|
|
256
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
257
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
258
|
+
},
|
|
259
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
260
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
261
|
+
},
|
|
262
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
263
|
+
const ret = arg0.call(arg1);
|
|
264
|
+
return ret;
|
|
265
|
+
}, arguments); },
|
|
266
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
267
|
+
const ret = arg0.done;
|
|
268
|
+
return ret;
|
|
269
|
+
},
|
|
270
|
+
__wbg_entries_015dc610cd81ede0: function(arg0) {
|
|
271
|
+
const ret = Object.entries(arg0);
|
|
272
|
+
return ret;
|
|
273
|
+
},
|
|
274
|
+
__wbg_from_13e323c65fc8f464: function(arg0) {
|
|
275
|
+
const ret = Array.from(arg0);
|
|
276
|
+
return ret;
|
|
277
|
+
},
|
|
278
|
+
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
279
|
+
const ret = arg0[arg1 >>> 0];
|
|
280
|
+
return ret;
|
|
281
|
+
},
|
|
282
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
283
|
+
const ret = Reflect.get(arg0, arg1);
|
|
284
|
+
return ret;
|
|
285
|
+
}, arguments); },
|
|
286
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
287
|
+
const ret = arg0[arg1 >>> 0];
|
|
288
|
+
return ret;
|
|
289
|
+
},
|
|
290
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
291
|
+
const ret = arg0[arg1];
|
|
292
|
+
return ret;
|
|
293
|
+
},
|
|
294
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
295
|
+
let result;
|
|
296
|
+
try {
|
|
297
|
+
result = arg0 instanceof ArrayBuffer;
|
|
298
|
+
} catch (_) {
|
|
299
|
+
result = false;
|
|
300
|
+
}
|
|
301
|
+
const ret = result;
|
|
302
|
+
return ret;
|
|
303
|
+
},
|
|
304
|
+
__wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
|
|
305
|
+
let result;
|
|
306
|
+
try {
|
|
307
|
+
result = arg0 instanceof Map;
|
|
308
|
+
} catch (_) {
|
|
309
|
+
result = false;
|
|
310
|
+
}
|
|
311
|
+
const ret = result;
|
|
312
|
+
return ret;
|
|
313
|
+
},
|
|
314
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
315
|
+
let result;
|
|
316
|
+
try {
|
|
317
|
+
result = arg0 instanceof Uint8Array;
|
|
318
|
+
} catch (_) {
|
|
319
|
+
result = false;
|
|
320
|
+
}
|
|
321
|
+
const ret = result;
|
|
322
|
+
return ret;
|
|
323
|
+
},
|
|
324
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
325
|
+
const ret = Array.isArray(arg0);
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
|
|
329
|
+
const ret = Number.isSafeInteger(arg0);
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
333
|
+
const ret = Symbol.iterator;
|
|
334
|
+
return ret;
|
|
335
|
+
},
|
|
336
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
337
|
+
const ret = arg0.length;
|
|
338
|
+
return ret;
|
|
339
|
+
},
|
|
340
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
341
|
+
const ret = arg0.length;
|
|
342
|
+
return ret;
|
|
343
|
+
},
|
|
344
|
+
__wbg_new_32b398fb48b6d94a: function() {
|
|
345
|
+
const ret = new Array();
|
|
346
|
+
return ret;
|
|
347
|
+
},
|
|
348
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
349
|
+
const ret = new Uint8Array(arg0);
|
|
350
|
+
return ret;
|
|
351
|
+
},
|
|
352
|
+
__wbg_new_da52cf8fe3429cb2: function() {
|
|
353
|
+
const ret = new Object();
|
|
354
|
+
return ret;
|
|
355
|
+
},
|
|
356
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
357
|
+
const ret = arg0.next;
|
|
358
|
+
return ret;
|
|
359
|
+
},
|
|
360
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
361
|
+
const ret = arg0.next();
|
|
362
|
+
return ret;
|
|
363
|
+
}, arguments); },
|
|
364
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
365
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
366
|
+
},
|
|
367
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
368
|
+
arg0[arg1] = arg2;
|
|
369
|
+
},
|
|
370
|
+
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
371
|
+
arg0[arg1 >>> 0] = arg2;
|
|
372
|
+
},
|
|
373
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
374
|
+
const ret = arg0.value;
|
|
375
|
+
return ret;
|
|
376
|
+
},
|
|
377
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
378
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
379
|
+
const ret = arg0;
|
|
380
|
+
return ret;
|
|
381
|
+
},
|
|
382
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
383
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
384
|
+
const ret = arg0;
|
|
385
|
+
return ret;
|
|
386
|
+
},
|
|
387
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
388
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
389
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
390
|
+
return ret;
|
|
391
|
+
},
|
|
392
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
393
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
394
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
395
|
+
return ret;
|
|
396
|
+
},
|
|
397
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
398
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
399
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
400
|
+
return ret;
|
|
401
|
+
},
|
|
402
|
+
__wbindgen_init_externref_table: function() {
|
|
403
|
+
const table = wasm.__wbindgen_externrefs;
|
|
404
|
+
const offset = table.grow(4);
|
|
405
|
+
table.set(0, undefined);
|
|
406
|
+
table.set(offset + 0, undefined);
|
|
407
|
+
table.set(offset + 1, null);
|
|
408
|
+
table.set(offset + 2, true);
|
|
409
|
+
table.set(offset + 3, false);
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
return {
|
|
413
|
+
__proto__: null,
|
|
414
|
+
"./proof_trading_sdk_wasm_bg.js": import0,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function addToExternrefTable0(obj) {
|
|
419
|
+
const idx = wasm.__externref_table_alloc();
|
|
420
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
421
|
+
return idx;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function debugString(val) {
|
|
425
|
+
// primitive types
|
|
426
|
+
const type = typeof val;
|
|
427
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
428
|
+
return `${val}`;
|
|
429
|
+
}
|
|
430
|
+
if (type == 'string') {
|
|
431
|
+
return `"${val}"`;
|
|
432
|
+
}
|
|
433
|
+
if (type == 'symbol') {
|
|
434
|
+
const description = val.description;
|
|
435
|
+
if (description == null) {
|
|
436
|
+
return 'Symbol';
|
|
437
|
+
} else {
|
|
438
|
+
return `Symbol(${description})`;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (type == 'function') {
|
|
442
|
+
const name = val.name;
|
|
443
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
444
|
+
return `Function(${name})`;
|
|
445
|
+
} else {
|
|
446
|
+
return 'Function';
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
// objects
|
|
450
|
+
if (Array.isArray(val)) {
|
|
451
|
+
const length = val.length;
|
|
452
|
+
let debug = '[';
|
|
453
|
+
if (length > 0) {
|
|
454
|
+
debug += debugString(val[0]);
|
|
455
|
+
}
|
|
456
|
+
for(let i = 1; i < length; i++) {
|
|
457
|
+
debug += ', ' + debugString(val[i]);
|
|
458
|
+
}
|
|
459
|
+
debug += ']';
|
|
460
|
+
return debug;
|
|
461
|
+
}
|
|
462
|
+
// Test for built-in
|
|
463
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
464
|
+
let className;
|
|
465
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
466
|
+
className = builtInMatches[1];
|
|
467
|
+
} else {
|
|
468
|
+
// Failed to match the standard '[object ClassName]'
|
|
469
|
+
return toString.call(val);
|
|
470
|
+
}
|
|
471
|
+
if (className == 'Object') {
|
|
472
|
+
// we're a user defined class or Object
|
|
473
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
474
|
+
// easier than looping through ownProperties of `val`.
|
|
475
|
+
try {
|
|
476
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
477
|
+
} catch (_) {
|
|
478
|
+
return 'Object';
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
// errors
|
|
482
|
+
if (val instanceof Error) {
|
|
483
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
484
|
+
}
|
|
485
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
486
|
+
return className;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
490
|
+
ptr = ptr >>> 0;
|
|
491
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
let cachedDataViewMemory0 = null;
|
|
495
|
+
function getDataViewMemory0() {
|
|
496
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
497
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
498
|
+
}
|
|
499
|
+
return cachedDataViewMemory0;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function getStringFromWasm0(ptr, len) {
|
|
503
|
+
return decodeText(ptr >>> 0, len);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
let cachedUint8ArrayMemory0 = null;
|
|
507
|
+
function getUint8ArrayMemory0() {
|
|
508
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
509
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
510
|
+
}
|
|
511
|
+
return cachedUint8ArrayMemory0;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function handleError(f, args) {
|
|
515
|
+
try {
|
|
516
|
+
return f.apply(this, args);
|
|
517
|
+
} catch (e) {
|
|
518
|
+
const idx = addToExternrefTable0(e);
|
|
519
|
+
wasm.__wbindgen_exn_store(idx);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function isLikeNone(x) {
|
|
524
|
+
return x === undefined || x === null;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
528
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
529
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
530
|
+
WASM_VECTOR_LEN = arg.length;
|
|
531
|
+
return ptr;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
535
|
+
if (realloc === undefined) {
|
|
536
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
537
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
538
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
539
|
+
WASM_VECTOR_LEN = buf.length;
|
|
540
|
+
return ptr;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
let len = arg.length;
|
|
544
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
545
|
+
|
|
546
|
+
const mem = getUint8ArrayMemory0();
|
|
547
|
+
|
|
548
|
+
let offset = 0;
|
|
549
|
+
|
|
550
|
+
for (; offset < len; offset++) {
|
|
551
|
+
const code = arg.charCodeAt(offset);
|
|
552
|
+
if (code > 0x7F) break;
|
|
553
|
+
mem[ptr + offset] = code;
|
|
554
|
+
}
|
|
555
|
+
if (offset !== len) {
|
|
556
|
+
if (offset !== 0) {
|
|
557
|
+
arg = arg.slice(offset);
|
|
558
|
+
}
|
|
559
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
560
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
561
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
562
|
+
|
|
563
|
+
offset += ret.written;
|
|
564
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
WASM_VECTOR_LEN = offset;
|
|
568
|
+
return ptr;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function takeFromExternrefTable0(idx) {
|
|
572
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
573
|
+
wasm.__externref_table_dealloc(idx);
|
|
574
|
+
return value;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
578
|
+
cachedTextDecoder.decode();
|
|
579
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
580
|
+
let numBytesDecoded = 0;
|
|
581
|
+
function decodeText(ptr, len) {
|
|
582
|
+
numBytesDecoded += len;
|
|
583
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
584
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
585
|
+
cachedTextDecoder.decode();
|
|
586
|
+
numBytesDecoded = len;
|
|
587
|
+
}
|
|
588
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
const cachedTextEncoder = new TextEncoder();
|
|
592
|
+
|
|
593
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
594
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
595
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
596
|
+
view.set(buf);
|
|
597
|
+
return {
|
|
598
|
+
read: arg.length,
|
|
599
|
+
written: buf.length
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
let WASM_VECTOR_LEN = 0;
|
|
605
|
+
|
|
606
|
+
let wasmModule, wasmInstance, wasm;
|
|
607
|
+
function __wbg_finalize_init(instance, module) {
|
|
608
|
+
wasmInstance = instance;
|
|
609
|
+
wasm = instance.exports;
|
|
610
|
+
wasmModule = module;
|
|
611
|
+
cachedDataViewMemory0 = null;
|
|
612
|
+
cachedUint8ArrayMemory0 = null;
|
|
613
|
+
wasm.__wbindgen_start();
|
|
614
|
+
return wasm;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
async function __wbg_load(module, imports) {
|
|
618
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
619
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
620
|
+
try {
|
|
621
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
622
|
+
} catch (e) {
|
|
623
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
624
|
+
|
|
625
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
626
|
+
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);
|
|
627
|
+
|
|
628
|
+
} else { throw e; }
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const bytes = await module.arrayBuffer();
|
|
633
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
634
|
+
} else {
|
|
635
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
636
|
+
|
|
637
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
638
|
+
return { instance, module };
|
|
639
|
+
} else {
|
|
640
|
+
return instance;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function expectedResponseType(type) {
|
|
645
|
+
switch (type) {
|
|
646
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
647
|
+
}
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function initSync(module) {
|
|
653
|
+
if (wasm !== undefined) return wasm;
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
if (module !== undefined) {
|
|
657
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
658
|
+
({module} = module)
|
|
659
|
+
} else {
|
|
660
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
const imports = __wbg_get_imports();
|
|
665
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
666
|
+
module = new WebAssembly.Module(module);
|
|
667
|
+
}
|
|
668
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
669
|
+
return __wbg_finalize_init(instance, module);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
async function __wbg_init(module_or_path) {
|
|
673
|
+
if (wasm !== undefined) return wasm;
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
if (module_or_path !== undefined) {
|
|
677
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
678
|
+
({module_or_path} = module_or_path)
|
|
679
|
+
} else {
|
|
680
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
if (module_or_path === undefined) {
|
|
685
|
+
module_or_path = new URL('proof_trading_sdk_wasm_bg.wasm', import.meta.url);
|
|
686
|
+
}
|
|
687
|
+
const imports = __wbg_get_imports();
|
|
688
|
+
|
|
689
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
690
|
+
module_or_path = fetch(module_or_path);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
694
|
+
|
|
695
|
+
return __wbg_finalize_init(instance, module);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|