@totemsdk/omnia-splice 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/splice-tx.js CHANGED
@@ -113,35 +113,63 @@ function buildSpliceTx(channel, params) {
113
113
  * the final splice TX assembles both signatures into the witness.
114
114
  */
115
115
  function spliceDraftToMinimaBytes(draft) {
116
- const tx = (0, core_2.createDefaultTransaction)();
117
- for (const inp of draft.inputs) {
118
- tx.inputs.push((0, core_2.buildMinimaCoin)({
119
- coinId: (0, core_2.hexToBytes)(inp.coinId),
120
- address: (0, core_2.hexToBytes)(inp.address),
121
- amount: inp.amount.toString(),
122
- tokenId: (0, core_2.hexToBytes)(inp.tokenId),
123
- }));
124
- }
125
- for (const out of draft.outputs) {
126
- const state = out.storeState
116
+ const toHex = (b) => Buffer.from(b).toString('hex');
117
+ const svToJson = (port, value, type) => {
118
+ let data;
119
+ let svtype;
120
+ if (typeof value === 'bigint') {
121
+ data = value.toString();
122
+ svtype = 'number';
123
+ }
124
+ else if (typeof value === 'boolean') {
125
+ data = value ? 'true' : 'false';
126
+ svtype = 'bool';
127
+ }
128
+ else if (value instanceof Uint8Array) {
129
+ data = '0x' + toHex(value);
130
+ svtype = 'hex';
131
+ }
132
+ else if (typeof value === 'number') {
133
+ data = value.toString();
134
+ svtype = 'number';
135
+ }
136
+ else {
137
+ data = String(value);
138
+ svtype = type;
139
+ }
140
+ return { port, svtype, data };
141
+ };
142
+ const inputs = draft.inputs.map(inp => ({
143
+ coinid: inp.coinId,
144
+ amount: inp.amount.toString(),
145
+ address: inp.address,
146
+ tokenid: inp.tokenId,
147
+ storestate: false,
148
+ mmrentry: '0',
149
+ spent: false,
150
+ created: '0',
151
+ state: [],
152
+ }));
153
+ const outputs = draft.outputs.map(out => ({
154
+ amount: out.amount.toString(),
155
+ address: out.address,
156
+ tokenid: out.tokenId,
157
+ storestate: out.storeState ?? false,
158
+ mmrentry: '0',
159
+ spent: false,
160
+ created: '0',
161
+ state: out.storeState
127
162
  ? [
128
- { port: STATE_SETTLEMENT_PORT, value: out.stateVarSettlement, type: 'bool' },
129
- { port: STATE_SEQUENCE_PORT, value: BigInt(out.stateVarSequence), type: 'number' },
163
+ svToJson(STATE_SETTLEMENT_PORT, out.stateVarSettlement, 'bool'),
164
+ svToJson(STATE_SEQUENCE_PORT, out.stateVarSequence, 'number'),
130
165
  ]
131
- : [];
132
- tx.outputs.push((0, core_2.buildMinimaCoin)({
133
- address: (0, core_2.hexToBytes)(out.address),
134
- amount: out.amount.toString(),
135
- tokenId: (0, core_2.hexToBytes)(out.tokenId),
136
- storeState: out.storeState,
137
- state,
138
- }));
139
- }
140
- tx.state = [
141
- { port: STATE_SETTLEMENT_PORT, value: false, type: 'bool' },
142
- { port: STATE_SEQUENCE_PORT, value: 0n, type: 'number' },
166
+ : [],
167
+ }));
168
+ const state = [
169
+ svToJson(STATE_SETTLEMENT_PORT, false, 'bool'),
170
+ svToJson(STATE_SEQUENCE_PORT, 0n, 'number'),
143
171
  ];
144
- return (0, core_2.serializeTransaction)(JSON.stringify(tx));
172
+ return (0, core_2.serializeTransaction)(JSON.stringify({ inputs, outputs, state, linkhash: '0x00' }));
145
173
  }
146
174
  /**
147
175
  * Compute a 32-byte digest over the splice TX draft for WOTS signing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-splice",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Channel splicing for @totemsdk/omnia — resize Minima eltoo channels without a close+reopen cycle",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,23 +11,19 @@
11
11
  "import": "./dist/index.js"
12
12
  }
13
13
  },
14
- "scripts": {
15
- "build": "tsc",
16
- "prepare": "tsc",
17
- "clean": "rm -rf dist",
18
- "test": "node ../../node_modules/jest/bin/jest.js --config jest.config.cjs --passWithNoTests"
19
- },
20
14
  "files": [
21
15
  "dist",
16
+ "rust/pkg/",
17
+ "rust/pkg-node/",
22
18
  "README.md",
23
19
  "LICENSE"
24
20
  ],
25
21
  "dependencies": {
26
- "@totemsdk/omnia": "^0.1.5",
27
- "@totemsdk/core": "^1.1.0",
28
- "@totemsdk/tx-builder": "^0.1.6",
29
- "@totemsdk/txpow": "^0.1.5",
30
- "@totemsdk/wots-lease": "^0.1.3"
22
+ "@totemsdk/omnia": "^0.1.10",
23
+ "@totemsdk/tx-builder": "^0.1.8",
24
+ "@totemsdk/txpow": "^0.1.7",
25
+ "@totemsdk/core": "^1.2.8",
26
+ "@totemsdk/wots-lease": "^0.1.5"
31
27
  },
32
28
  "devDependencies": {
33
29
  "@types/jest": "^30.0.0",
@@ -51,7 +47,7 @@
51
47
  "repository": {
52
48
  "type": "git",
53
49
  "url": "git+https://github.com/totem-sdk/totem-sdk.git",
54
- "directory": "packages/totem-sdk/packages/omnia-splice"
50
+ "directory": "packages/omnia-splice"
55
51
  },
56
52
  "keywords": [
57
53
  "totem",
@@ -60,7 +56,6 @@
60
56
  "blockchain",
61
57
  "quantum-resistant",
62
58
  "wots",
63
- "kissvm",
64
59
  "utxo",
65
60
  "omnia",
66
61
  "payment-channel",
@@ -69,5 +64,11 @@
69
64
  "splice",
70
65
  "channel-resize",
71
66
  "htlc"
72
- ]
73
- }
67
+ ],
68
+ "scripts": {
69
+ "build": "npm run build:wasm && tsc && node ../../scripts/clean-wasm-output-ignores.mjs",
70
+ "clean": "rm -rf dist rust/pkg rust/pkg-node rust/target",
71
+ "test": "jest",
72
+ "build:wasm": "cd rust && wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node"
73
+ }
74
+ }
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function compute_splice_tx_digest_wasm(draft_js: any): Uint8Array;
5
+
6
+ export function init(): void;
7
+
8
+ export function scale_balances_wasm(balances_js: any, old_total: string, new_total: string): any;
9
+
10
+ export function validate_splice_params_wasm(total_value: string, params_js: any): any;
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./omnia_splice_wasm.d.ts" */
2
+ import * as wasm from "./omnia_splice_wasm_bg.wasm";
3
+ import { __wbg_set_wasm } from "./omnia_splice_wasm_bg.js";
4
+
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ compute_splice_tx_digest_wasm, init, scale_balances_wasm, validate_splice_params_wasm
9
+ } from "./omnia_splice_wasm_bg.js";
@@ -0,0 +1,443 @@
1
+ /**
2
+ * @param {any} draft_js
3
+ * @returns {Uint8Array}
4
+ */
5
+ export function compute_splice_tx_digest_wasm(draft_js) {
6
+ const ret = wasm.compute_splice_tx_digest_wasm(draft_js);
7
+ if (ret[3]) {
8
+ throw takeFromExternrefTable0(ret[2]);
9
+ }
10
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
11
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
12
+ return v1;
13
+ }
14
+
15
+ export function init() {
16
+ wasm.init();
17
+ }
18
+
19
+ /**
20
+ * @param {any} balances_js
21
+ * @param {string} old_total
22
+ * @param {string} new_total
23
+ * @returns {any}
24
+ */
25
+ export function scale_balances_wasm(balances_js, old_total, new_total) {
26
+ const ptr0 = passStringToWasm0(old_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
27
+ const len0 = WASM_VECTOR_LEN;
28
+ const ptr1 = passStringToWasm0(new_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29
+ const len1 = WASM_VECTOR_LEN;
30
+ const ret = wasm.scale_balances_wasm(balances_js, ptr0, len0, ptr1, len1);
31
+ if (ret[2]) {
32
+ throw takeFromExternrefTable0(ret[1]);
33
+ }
34
+ return takeFromExternrefTable0(ret[0]);
35
+ }
36
+
37
+ /**
38
+ * @param {string} total_value
39
+ * @param {any} params_js
40
+ * @returns {any}
41
+ */
42
+ export function validate_splice_params_wasm(total_value, params_js) {
43
+ const ptr0 = passStringToWasm0(total_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
44
+ const len0 = WASM_VECTOR_LEN;
45
+ const ret = wasm.validate_splice_params_wasm(ptr0, len0, params_js);
46
+ if (ret[2]) {
47
+ throw takeFromExternrefTable0(ret[1]);
48
+ }
49
+ return takeFromExternrefTable0(ret[0]);
50
+ }
51
+ export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
52
+ const ret = Error(getStringFromWasm0(arg0, arg1));
53
+ return ret;
54
+ }
55
+ export function __wbg_Number_9a4e0ecb0fa16705(arg0) {
56
+ const ret = Number(arg0);
57
+ return ret;
58
+ }
59
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
60
+ const ret = String(arg1);
61
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
62
+ const len1 = WASM_VECTOR_LEN;
63
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
64
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
65
+ }
66
+ export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
67
+ const v = arg0;
68
+ const ret = typeof(v) === 'boolean' ? v : undefined;
69
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
70
+ }
71
+ export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
72
+ const ret = debugString(arg1);
73
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
74
+ const len1 = WASM_VECTOR_LEN;
75
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
76
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
77
+ }
78
+ export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
79
+ const ret = arg0 in arg1;
80
+ return ret;
81
+ }
82
+ export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
83
+ const ret = typeof(arg0) === 'function';
84
+ return ret;
85
+ }
86
+ export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
87
+ const val = arg0;
88
+ const ret = typeof(val) === 'object' && val !== null;
89
+ return ret;
90
+ }
91
+ export function __wbg___wbindgen_is_string_ea5e6cc2e4141dfe(arg0) {
92
+ const ret = typeof(arg0) === 'string';
93
+ return ret;
94
+ }
95
+ export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
96
+ const ret = arg0 === undefined;
97
+ return ret;
98
+ }
99
+ export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
100
+ const ret = arg0 == arg1;
101
+ return ret;
102
+ }
103
+ export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
104
+ const obj = arg1;
105
+ const ret = typeof(obj) === 'number' ? obj : undefined;
106
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
107
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
108
+ }
109
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
110
+ const obj = arg1;
111
+ const ret = typeof(obj) === 'string' ? obj : undefined;
112
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
113
+ var len1 = WASM_VECTOR_LEN;
114
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
115
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
116
+ }
117
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
118
+ throw new Error(getStringFromWasm0(arg0, arg1));
119
+ }
120
+ export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
121
+ const ret = arg0.call(arg1);
122
+ return ret;
123
+ }, arguments); }
124
+ export function __wbg_done_89b2b13e91a60321(arg0) {
125
+ const ret = arg0.done;
126
+ return ret;
127
+ }
128
+ export function __wbg_entries_015dc610cd81ede0(arg0) {
129
+ const ret = Object.entries(arg0);
130
+ return ret;
131
+ }
132
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
133
+ let deferred0_0;
134
+ let deferred0_1;
135
+ try {
136
+ deferred0_0 = arg0;
137
+ deferred0_1 = arg1;
138
+ console.error(getStringFromWasm0(arg0, arg1));
139
+ } finally {
140
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
141
+ }
142
+ }
143
+ export function __wbg_get_507a50627bffa49b(arg0, arg1) {
144
+ const ret = arg0[arg1 >>> 0];
145
+ return ret;
146
+ }
147
+ export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
148
+ const ret = Reflect.get(arg0, arg1);
149
+ return ret;
150
+ }, arguments); }
151
+ export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
152
+ const ret = arg0[arg1 >>> 0];
153
+ return ret;
154
+ }
155
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
156
+ const ret = arg0[arg1];
157
+ return ret;
158
+ }
159
+ export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
160
+ let result;
161
+ try {
162
+ result = arg0 instanceof ArrayBuffer;
163
+ } catch (_) {
164
+ result = false;
165
+ }
166
+ const ret = result;
167
+ return ret;
168
+ }
169
+ export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
170
+ let result;
171
+ try {
172
+ result = arg0 instanceof Uint8Array;
173
+ } catch (_) {
174
+ result = false;
175
+ }
176
+ const ret = result;
177
+ return ret;
178
+ }
179
+ export function __wbg_isArray_0677c962b281d01a(arg0) {
180
+ const ret = Array.isArray(arg0);
181
+ return ret;
182
+ }
183
+ export function __wbg_isSafeInteger_04f36e4056f1b851(arg0) {
184
+ const ret = Number.isSafeInteger(arg0);
185
+ return ret;
186
+ }
187
+ export function __wbg_iterator_6f722e4a93058b71() {
188
+ const ret = Symbol.iterator;
189
+ return ret;
190
+ }
191
+ export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
192
+ const ret = arg0.length;
193
+ return ret;
194
+ }
195
+ export function __wbg_length_370319915dc99107(arg0) {
196
+ const ret = arg0.length;
197
+ return ret;
198
+ }
199
+ export function __wbg_new_227d7c05414eb861() {
200
+ const ret = new Error();
201
+ return ret;
202
+ }
203
+ export function __wbg_new_7796ffc7ed656783() {
204
+ const ret = new Map();
205
+ return ret;
206
+ }
207
+ export function __wbg_new_cd45aabdf6073e84(arg0) {
208
+ const ret = new Uint8Array(arg0);
209
+ return ret;
210
+ }
211
+ export function __wbg_new_da52cf8fe3429cb2() {
212
+ const ret = new Object();
213
+ return ret;
214
+ }
215
+ export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
216
+ const ret = arg0.next;
217
+ return ret;
218
+ }
219
+ export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
220
+ const ret = arg0.next();
221
+ return ret;
222
+ }, arguments); }
223
+ export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
224
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
225
+ }
226
+ export function __wbg_set_575dd786d51585f8(arg0, arg1, arg2) {
227
+ const ret = arg0.set(arg1, arg2);
228
+ return ret;
229
+ }
230
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
231
+ arg0[arg1] = arg2;
232
+ }
233
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
234
+ const ret = arg1.stack;
235
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const len1 = WASM_VECTOR_LEN;
237
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
238
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
239
+ }
240
+ export function __wbg_value_a5d5488a9589444a(arg0) {
241
+ const ret = arg0.value;
242
+ return ret;
243
+ }
244
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
245
+ // Cast intrinsic for `Ref(String) -> Externref`.
246
+ const ret = getStringFromWasm0(arg0, arg1);
247
+ return ret;
248
+ }
249
+ export function __wbindgen_init_externref_table() {
250
+ const table = wasm.__wbindgen_externrefs;
251
+ const offset = table.grow(4);
252
+ table.set(0, undefined);
253
+ table.set(offset + 0, undefined);
254
+ table.set(offset + 1, null);
255
+ table.set(offset + 2, true);
256
+ table.set(offset + 3, false);
257
+ }
258
+ function addToExternrefTable0(obj) {
259
+ const idx = wasm.__externref_table_alloc();
260
+ wasm.__wbindgen_externrefs.set(idx, obj);
261
+ return idx;
262
+ }
263
+
264
+ function debugString(val) {
265
+ // primitive types
266
+ const type = typeof val;
267
+ if (type == 'number' || type == 'boolean' || val == null) {
268
+ return `${val}`;
269
+ }
270
+ if (type == 'string') {
271
+ return `"${val}"`;
272
+ }
273
+ if (type == 'symbol') {
274
+ const description = val.description;
275
+ if (description == null) {
276
+ return 'Symbol';
277
+ } else {
278
+ return `Symbol(${description})`;
279
+ }
280
+ }
281
+ if (type == 'function') {
282
+ const name = val.name;
283
+ if (typeof name == 'string' && name.length > 0) {
284
+ return `Function(${name})`;
285
+ } else {
286
+ return 'Function';
287
+ }
288
+ }
289
+ // objects
290
+ if (Array.isArray(val)) {
291
+ const length = val.length;
292
+ let debug = '[';
293
+ if (length > 0) {
294
+ debug += debugString(val[0]);
295
+ }
296
+ for(let i = 1; i < length; i++) {
297
+ debug += ', ' + debugString(val[i]);
298
+ }
299
+ debug += ']';
300
+ return debug;
301
+ }
302
+ // Test for built-in
303
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
304
+ let className;
305
+ if (builtInMatches && builtInMatches.length > 1) {
306
+ className = builtInMatches[1];
307
+ } else {
308
+ // Failed to match the standard '[object ClassName]'
309
+ return toString.call(val);
310
+ }
311
+ if (className == 'Object') {
312
+ // we're a user defined class or Object
313
+ // JSON.stringify avoids problems with cycles, and is generally much
314
+ // easier than looping through ownProperties of `val`.
315
+ try {
316
+ return 'Object(' + JSON.stringify(val) + ')';
317
+ } catch (_) {
318
+ return 'Object';
319
+ }
320
+ }
321
+ // errors
322
+ if (val instanceof Error) {
323
+ return `${val.name}: ${val.message}\n${val.stack}`;
324
+ }
325
+ // TODO we could test for more things here, like `Set`s and `Map`s.
326
+ return className;
327
+ }
328
+
329
+ function getArrayU8FromWasm0(ptr, len) {
330
+ ptr = ptr >>> 0;
331
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
332
+ }
333
+
334
+ let cachedDataViewMemory0 = null;
335
+ function getDataViewMemory0() {
336
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
337
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
338
+ }
339
+ return cachedDataViewMemory0;
340
+ }
341
+
342
+ function getStringFromWasm0(ptr, len) {
343
+ return decodeText(ptr >>> 0, len);
344
+ }
345
+
346
+ let cachedUint8ArrayMemory0 = null;
347
+ function getUint8ArrayMemory0() {
348
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
349
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
350
+ }
351
+ return cachedUint8ArrayMemory0;
352
+ }
353
+
354
+ function handleError(f, args) {
355
+ try {
356
+ return f.apply(this, args);
357
+ } catch (e) {
358
+ const idx = addToExternrefTable0(e);
359
+ wasm.__wbindgen_exn_store(idx);
360
+ }
361
+ }
362
+
363
+ function isLikeNone(x) {
364
+ return x === undefined || x === null;
365
+ }
366
+
367
+ function passStringToWasm0(arg, malloc, realloc) {
368
+ if (realloc === undefined) {
369
+ const buf = cachedTextEncoder.encode(arg);
370
+ const ptr = malloc(buf.length, 1) >>> 0;
371
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
372
+ WASM_VECTOR_LEN = buf.length;
373
+ return ptr;
374
+ }
375
+
376
+ let len = arg.length;
377
+ let ptr = malloc(len, 1) >>> 0;
378
+
379
+ const mem = getUint8ArrayMemory0();
380
+
381
+ let offset = 0;
382
+
383
+ for (; offset < len; offset++) {
384
+ const code = arg.charCodeAt(offset);
385
+ if (code > 0x7F) break;
386
+ mem[ptr + offset] = code;
387
+ }
388
+ if (offset !== len) {
389
+ if (offset !== 0) {
390
+ arg = arg.slice(offset);
391
+ }
392
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
393
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
394
+ const ret = cachedTextEncoder.encodeInto(arg, view);
395
+
396
+ offset += ret.written;
397
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
398
+ }
399
+
400
+ WASM_VECTOR_LEN = offset;
401
+ return ptr;
402
+ }
403
+
404
+ function takeFromExternrefTable0(idx) {
405
+ const value = wasm.__wbindgen_externrefs.get(idx);
406
+ wasm.__externref_table_dealloc(idx);
407
+ return value;
408
+ }
409
+
410
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
411
+ cachedTextDecoder.decode();
412
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
413
+ let numBytesDecoded = 0;
414
+ function decodeText(ptr, len) {
415
+ numBytesDecoded += len;
416
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
417
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
418
+ cachedTextDecoder.decode();
419
+ numBytesDecoded = len;
420
+ }
421
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
422
+ }
423
+
424
+ const cachedTextEncoder = new TextEncoder();
425
+
426
+ if (!('encodeInto' in cachedTextEncoder)) {
427
+ cachedTextEncoder.encodeInto = function (arg, view) {
428
+ const buf = cachedTextEncoder.encode(arg);
429
+ view.set(buf);
430
+ return {
431
+ read: arg.length,
432
+ written: buf.length
433
+ };
434
+ };
435
+ }
436
+
437
+ let WASM_VECTOR_LEN = 0;
438
+
439
+
440
+ let wasm;
441
+ export function __wbg_set_wasm(val) {
442
+ wasm = val;
443
+ }
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const compute_splice_tx_digest_wasm: (a: any) => [number, number, number, number];
5
+ export const init: () => void;
6
+ export const scale_balances_wasm: (a: any, b: number, c: number, d: number, e: number) => [number, number, number];
7
+ export const validate_splice_params_wasm: (a: number, b: number, c: any) => [number, number, number];
8
+ export const __wbindgen_malloc: (a: number, b: number) => number;
9
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
+ export const __wbindgen_exn_store: (a: number) => void;
11
+ export const __externref_table_alloc: () => number;
12
+ export const __wbindgen_externrefs: WebAssembly.Table;
13
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
14
+ export const __externref_table_dealloc: (a: number) => void;
15
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "omnia-splice-wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Totem SDK Contributors"
6
+ ],
7
+ "description": "Channel splice commitment layer — splice TX digest computation, balance scaling, proposal validation (Rust/WASM)",
8
+ "version": "0.1.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/totem-sdk/totem-sdk"
13
+ },
14
+ "files": [
15
+ "omnia_splice_wasm_bg.wasm",
16
+ "omnia_splice_wasm.js",
17
+ "omnia_splice_wasm_bg.js",
18
+ "omnia_splice_wasm.d.ts"
19
+ ],
20
+ "main": "omnia_splice_wasm.js",
21
+ "homepage": "https://totem.ing",
22
+ "types": "omnia_splice_wasm.d.ts",
23
+ "sideEffects": [
24
+ "./omnia_splice_wasm.js",
25
+ "./snippets/*"
26
+ ]
27
+ }
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function compute_splice_tx_digest_wasm(draft_js: any): Uint8Array;
5
+
6
+ export function init(): void;
7
+
8
+ export function scale_balances_wasm(balances_js: any, old_total: string, new_total: string): any;
9
+
10
+ export function validate_splice_params_wasm(total_value: string, params_js: any): any;
@@ -0,0 +1,452 @@
1
+ /* @ts-self-types="./omnia_splice_wasm.d.ts" */
2
+
3
+ /**
4
+ * @param {any} draft_js
5
+ * @returns {Uint8Array}
6
+ */
7
+ function compute_splice_tx_digest_wasm(draft_js) {
8
+ const ret = wasm.compute_splice_tx_digest_wasm(draft_js);
9
+ if (ret[3]) {
10
+ throw takeFromExternrefTable0(ret[2]);
11
+ }
12
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
13
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
14
+ return v1;
15
+ }
16
+ exports.compute_splice_tx_digest_wasm = compute_splice_tx_digest_wasm;
17
+
18
+ function init() {
19
+ wasm.init();
20
+ }
21
+ exports.init = init;
22
+
23
+ /**
24
+ * @param {any} balances_js
25
+ * @param {string} old_total
26
+ * @param {string} new_total
27
+ * @returns {any}
28
+ */
29
+ function scale_balances_wasm(balances_js, old_total, new_total) {
30
+ const ptr0 = passStringToWasm0(old_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ptr1 = passStringToWasm0(new_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
33
+ const len1 = WASM_VECTOR_LEN;
34
+ const ret = wasm.scale_balances_wasm(balances_js, ptr0, len0, ptr1, len1);
35
+ if (ret[2]) {
36
+ throw takeFromExternrefTable0(ret[1]);
37
+ }
38
+ return takeFromExternrefTable0(ret[0]);
39
+ }
40
+ exports.scale_balances_wasm = scale_balances_wasm;
41
+
42
+ /**
43
+ * @param {string} total_value
44
+ * @param {any} params_js
45
+ * @returns {any}
46
+ */
47
+ function validate_splice_params_wasm(total_value, params_js) {
48
+ const ptr0 = passStringToWasm0(total_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
49
+ const len0 = WASM_VECTOR_LEN;
50
+ const ret = wasm.validate_splice_params_wasm(ptr0, len0, params_js);
51
+ if (ret[2]) {
52
+ throw takeFromExternrefTable0(ret[1]);
53
+ }
54
+ return takeFromExternrefTable0(ret[0]);
55
+ }
56
+ exports.validate_splice_params_wasm = validate_splice_params_wasm;
57
+ function __wbg_get_imports() {
58
+ const import0 = {
59
+ __proto__: null,
60
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
61
+ const ret = Error(getStringFromWasm0(arg0, arg1));
62
+ return ret;
63
+ },
64
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
65
+ const ret = Number(arg0);
66
+ return ret;
67
+ },
68
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
69
+ const ret = String(arg1);
70
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
71
+ const len1 = WASM_VECTOR_LEN;
72
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
73
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
74
+ },
75
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
76
+ const v = arg0;
77
+ const ret = typeof(v) === 'boolean' ? v : undefined;
78
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
79
+ },
80
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
81
+ const ret = debugString(arg1);
82
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
83
+ const len1 = WASM_VECTOR_LEN;
84
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
85
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
86
+ },
87
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
88
+ const ret = arg0 in arg1;
89
+ return ret;
90
+ },
91
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
92
+ const ret = typeof(arg0) === 'function';
93
+ return ret;
94
+ },
95
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
96
+ const val = arg0;
97
+ const ret = typeof(val) === 'object' && val !== null;
98
+ return ret;
99
+ },
100
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
101
+ const ret = typeof(arg0) === 'string';
102
+ return ret;
103
+ },
104
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
105
+ const ret = arg0 === undefined;
106
+ return ret;
107
+ },
108
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
109
+ const ret = arg0 == arg1;
110
+ return ret;
111
+ },
112
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
113
+ const obj = arg1;
114
+ const ret = typeof(obj) === 'number' ? obj : undefined;
115
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
116
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
117
+ },
118
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
119
+ const obj = arg1;
120
+ const ret = typeof(obj) === 'string' ? obj : undefined;
121
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
122
+ var len1 = WASM_VECTOR_LEN;
123
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
124
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
125
+ },
126
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
127
+ throw new Error(getStringFromWasm0(arg0, arg1));
128
+ },
129
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
130
+ const ret = arg0.call(arg1);
131
+ return ret;
132
+ }, arguments); },
133
+ __wbg_done_89b2b13e91a60321: function(arg0) {
134
+ const ret = arg0.done;
135
+ return ret;
136
+ },
137
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
138
+ const ret = Object.entries(arg0);
139
+ return ret;
140
+ },
141
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
142
+ let deferred0_0;
143
+ let deferred0_1;
144
+ try {
145
+ deferred0_0 = arg0;
146
+ deferred0_1 = arg1;
147
+ console.error(getStringFromWasm0(arg0, arg1));
148
+ } finally {
149
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
150
+ }
151
+ },
152
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
153
+ const ret = arg0[arg1 >>> 0];
154
+ return ret;
155
+ },
156
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
157
+ const ret = Reflect.get(arg0, arg1);
158
+ return ret;
159
+ }, arguments); },
160
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
161
+ const ret = arg0[arg1 >>> 0];
162
+ return ret;
163
+ },
164
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
165
+ const ret = arg0[arg1];
166
+ return ret;
167
+ },
168
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
169
+ let result;
170
+ try {
171
+ result = arg0 instanceof ArrayBuffer;
172
+ } catch (_) {
173
+ result = false;
174
+ }
175
+ const ret = result;
176
+ return ret;
177
+ },
178
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
179
+ let result;
180
+ try {
181
+ result = arg0 instanceof Uint8Array;
182
+ } catch (_) {
183
+ result = false;
184
+ }
185
+ const ret = result;
186
+ return ret;
187
+ },
188
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
189
+ const ret = Array.isArray(arg0);
190
+ return ret;
191
+ },
192
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
193
+ const ret = Number.isSafeInteger(arg0);
194
+ return ret;
195
+ },
196
+ __wbg_iterator_6f722e4a93058b71: function() {
197
+ const ret = Symbol.iterator;
198
+ return ret;
199
+ },
200
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
201
+ const ret = arg0.length;
202
+ return ret;
203
+ },
204
+ __wbg_length_370319915dc99107: function(arg0) {
205
+ const ret = arg0.length;
206
+ return ret;
207
+ },
208
+ __wbg_new_227d7c05414eb861: function() {
209
+ const ret = new Error();
210
+ return ret;
211
+ },
212
+ __wbg_new_7796ffc7ed656783: function() {
213
+ const ret = new Map();
214
+ return ret;
215
+ },
216
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
217
+ const ret = new Uint8Array(arg0);
218
+ return ret;
219
+ },
220
+ __wbg_new_da52cf8fe3429cb2: function() {
221
+ const ret = new Object();
222
+ return ret;
223
+ },
224
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
225
+ const ret = arg0.next;
226
+ return ret;
227
+ },
228
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
229
+ const ret = arg0.next();
230
+ return ret;
231
+ }, arguments); },
232
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
233
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
234
+ },
235
+ __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
236
+ const ret = arg0.set(arg1, arg2);
237
+ return ret;
238
+ },
239
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
240
+ arg0[arg1] = arg2;
241
+ },
242
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
243
+ const ret = arg1.stack;
244
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
+ const len1 = WASM_VECTOR_LEN;
246
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
247
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
248
+ },
249
+ __wbg_value_a5d5488a9589444a: function(arg0) {
250
+ const ret = arg0.value;
251
+ return ret;
252
+ },
253
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
254
+ // Cast intrinsic for `Ref(String) -> Externref`.
255
+ const ret = getStringFromWasm0(arg0, arg1);
256
+ return ret;
257
+ },
258
+ __wbindgen_init_externref_table: function() {
259
+ const table = wasm.__wbindgen_externrefs;
260
+ const offset = table.grow(4);
261
+ table.set(0, undefined);
262
+ table.set(offset + 0, undefined);
263
+ table.set(offset + 1, null);
264
+ table.set(offset + 2, true);
265
+ table.set(offset + 3, false);
266
+ },
267
+ };
268
+ return {
269
+ __proto__: null,
270
+ "./omnia_splice_wasm_bg.js": import0,
271
+ };
272
+ }
273
+
274
+ function addToExternrefTable0(obj) {
275
+ const idx = wasm.__externref_table_alloc();
276
+ wasm.__wbindgen_externrefs.set(idx, obj);
277
+ return idx;
278
+ }
279
+
280
+ function debugString(val) {
281
+ // primitive types
282
+ const type = typeof val;
283
+ if (type == 'number' || type == 'boolean' || val == null) {
284
+ return `${val}`;
285
+ }
286
+ if (type == 'string') {
287
+ return `"${val}"`;
288
+ }
289
+ if (type == 'symbol') {
290
+ const description = val.description;
291
+ if (description == null) {
292
+ return 'Symbol';
293
+ } else {
294
+ return `Symbol(${description})`;
295
+ }
296
+ }
297
+ if (type == 'function') {
298
+ const name = val.name;
299
+ if (typeof name == 'string' && name.length > 0) {
300
+ return `Function(${name})`;
301
+ } else {
302
+ return 'Function';
303
+ }
304
+ }
305
+ // objects
306
+ if (Array.isArray(val)) {
307
+ const length = val.length;
308
+ let debug = '[';
309
+ if (length > 0) {
310
+ debug += debugString(val[0]);
311
+ }
312
+ for(let i = 1; i < length; i++) {
313
+ debug += ', ' + debugString(val[i]);
314
+ }
315
+ debug += ']';
316
+ return debug;
317
+ }
318
+ // Test for built-in
319
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
320
+ let className;
321
+ if (builtInMatches && builtInMatches.length > 1) {
322
+ className = builtInMatches[1];
323
+ } else {
324
+ // Failed to match the standard '[object ClassName]'
325
+ return toString.call(val);
326
+ }
327
+ if (className == 'Object') {
328
+ // we're a user defined class or Object
329
+ // JSON.stringify avoids problems with cycles, and is generally much
330
+ // easier than looping through ownProperties of `val`.
331
+ try {
332
+ return 'Object(' + JSON.stringify(val) + ')';
333
+ } catch (_) {
334
+ return 'Object';
335
+ }
336
+ }
337
+ // errors
338
+ if (val instanceof Error) {
339
+ return `${val.name}: ${val.message}\n${val.stack}`;
340
+ }
341
+ // TODO we could test for more things here, like `Set`s and `Map`s.
342
+ return className;
343
+ }
344
+
345
+ function getArrayU8FromWasm0(ptr, len) {
346
+ ptr = ptr >>> 0;
347
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
348
+ }
349
+
350
+ let cachedDataViewMemory0 = null;
351
+ function getDataViewMemory0() {
352
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
353
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
354
+ }
355
+ return cachedDataViewMemory0;
356
+ }
357
+
358
+ function getStringFromWasm0(ptr, len) {
359
+ return decodeText(ptr >>> 0, len);
360
+ }
361
+
362
+ let cachedUint8ArrayMemory0 = null;
363
+ function getUint8ArrayMemory0() {
364
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
365
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
366
+ }
367
+ return cachedUint8ArrayMemory0;
368
+ }
369
+
370
+ function handleError(f, args) {
371
+ try {
372
+ return f.apply(this, args);
373
+ } catch (e) {
374
+ const idx = addToExternrefTable0(e);
375
+ wasm.__wbindgen_exn_store(idx);
376
+ }
377
+ }
378
+
379
+ function isLikeNone(x) {
380
+ return x === undefined || x === null;
381
+ }
382
+
383
+ function passStringToWasm0(arg, malloc, realloc) {
384
+ if (realloc === undefined) {
385
+ const buf = cachedTextEncoder.encode(arg);
386
+ const ptr = malloc(buf.length, 1) >>> 0;
387
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
388
+ WASM_VECTOR_LEN = buf.length;
389
+ return ptr;
390
+ }
391
+
392
+ let len = arg.length;
393
+ let ptr = malloc(len, 1) >>> 0;
394
+
395
+ const mem = getUint8ArrayMemory0();
396
+
397
+ let offset = 0;
398
+
399
+ for (; offset < len; offset++) {
400
+ const code = arg.charCodeAt(offset);
401
+ if (code > 0x7F) break;
402
+ mem[ptr + offset] = code;
403
+ }
404
+ if (offset !== len) {
405
+ if (offset !== 0) {
406
+ arg = arg.slice(offset);
407
+ }
408
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
409
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
410
+ const ret = cachedTextEncoder.encodeInto(arg, view);
411
+
412
+ offset += ret.written;
413
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
414
+ }
415
+
416
+ WASM_VECTOR_LEN = offset;
417
+ return ptr;
418
+ }
419
+
420
+ function takeFromExternrefTable0(idx) {
421
+ const value = wasm.__wbindgen_externrefs.get(idx);
422
+ wasm.__externref_table_dealloc(idx);
423
+ return value;
424
+ }
425
+
426
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
427
+ cachedTextDecoder.decode();
428
+ function decodeText(ptr, len) {
429
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
430
+ }
431
+
432
+ const cachedTextEncoder = new TextEncoder();
433
+
434
+ if (!('encodeInto' in cachedTextEncoder)) {
435
+ cachedTextEncoder.encodeInto = function (arg, view) {
436
+ const buf = cachedTextEncoder.encode(arg);
437
+ view.set(buf);
438
+ return {
439
+ read: arg.length,
440
+ written: buf.length
441
+ };
442
+ };
443
+ }
444
+
445
+ let WASM_VECTOR_LEN = 0;
446
+
447
+ const wasmPath = `${__dirname}/omnia_splice_wasm_bg.wasm`;
448
+ const wasmBytes = require('fs').readFileSync(wasmPath);
449
+ const wasmModule = new WebAssembly.Module(wasmBytes);
450
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
451
+ let wasm = wasmInstance.exports;
452
+ wasm.__wbindgen_start();
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const compute_splice_tx_digest_wasm: (a: any) => [number, number, number, number];
5
+ export const init: () => void;
6
+ export const scale_balances_wasm: (a: any, b: number, c: number, d: number, e: number) => [number, number, number];
7
+ export const validate_splice_params_wasm: (a: number, b: number, c: any) => [number, number, number];
8
+ export const __wbindgen_malloc: (a: number, b: number) => number;
9
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
10
+ export const __wbindgen_exn_store: (a: number) => void;
11
+ export const __externref_table_alloc: () => number;
12
+ export const __wbindgen_externrefs: WebAssembly.Table;
13
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
14
+ export const __externref_table_dealloc: (a: number) => void;
15
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "omnia-splice-wasm",
3
+ "collaborators": [
4
+ "Totem SDK Contributors"
5
+ ],
6
+ "description": "Channel splice commitment layer — splice TX digest computation, balance scaling, proposal validation (Rust/WASM)",
7
+ "version": "0.1.0",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/totem-sdk/totem-sdk"
12
+ },
13
+ "files": [
14
+ "omnia_splice_wasm_bg.wasm",
15
+ "omnia_splice_wasm.js",
16
+ "omnia_splice_wasm.d.ts"
17
+ ],
18
+ "main": "omnia_splice_wasm.js",
19
+ "homepage": "https://totem.ing",
20
+ "types": "omnia_splice_wasm.d.ts"
21
+ }