@totemsdk/omnia-factory 0.1.8 → 0.1.9
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/factory.d.ts +4 -1
- package/dist/factory.js +9 -4
- package/dist/settlement.js +2 -2
- package/dist/types.d.ts +8 -0
- package/dist/virtual.d.ts +1 -1
- package/dist/virtual.js +4 -1
- package/package.json +18 -17
- package/rust/pkg/omnia_factory_wasm.d.ts +12 -0
- package/rust/pkg/omnia_factory_wasm.js +9 -0
- package/rust/pkg/omnia_factory_wasm_bg.js +456 -0
- package/rust/pkg/omnia_factory_wasm_bg.wasm +0 -0
- package/rust/pkg/omnia_factory_wasm_bg.wasm.d.ts +16 -0
- package/rust/pkg/package.json +27 -0
- package/rust/pkg-node/omnia_factory_wasm.d.ts +12 -0
- package/rust/pkg-node/omnia_factory_wasm.js +466 -0
- package/rust/pkg-node/omnia_factory_wasm_bg.wasm +0 -0
- package/rust/pkg-node/omnia_factory_wasm_bg.wasm.d.ts +16 -0
- package/rust/pkg-node/package.json +21 -0
package/dist/factory.d.ts
CHANGED
|
@@ -34,8 +34,11 @@ export declare function enforceConservation(factory: ChannelFactory): void;
|
|
|
34
34
|
* @param signer - Proposer's channel signer (`signer.publicKeyDigest` must match
|
|
35
35
|
* one of the registered participants).
|
|
36
36
|
* @param chainProvider - Optional: build + mine + broadcast the factory funding TX.
|
|
37
|
+
* @param tokenScale - Token scale exponent (Minima `Token.mTokenScale`). Native Minima
|
|
38
|
+
* is 0; coloured coins use `tokenAmount = minimaRawAmount × 10^scale`.
|
|
39
|
+
* Defaults to 0.
|
|
37
40
|
*/
|
|
38
|
-
export declare function createFactory(participants: FactoryParticipant[], tokenId: string, bundle: WotsLeaseBundle, chainProvider?: ChainStateProvider): Promise<ChannelFactory>;
|
|
41
|
+
export declare function createFactory(participants: FactoryParticipant[], tokenId: string, bundle: WotsLeaseBundle, chainProvider?: ChainStateProvider, tokenScale?: number): Promise<ChannelFactory>;
|
|
39
42
|
/**
|
|
40
43
|
* Counterparty co-signs the factory proposal.
|
|
41
44
|
*
|
package/dist/factory.js
CHANGED
|
@@ -73,12 +73,13 @@ async function collectNofN(factoryId, commitment, purpose, participants, leasePr
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
// ─── Factory ID ───────────────────────────────────────────────────────────────
|
|
76
|
-
function generateFactoryId(participants, tokenId) {
|
|
76
|
+
function generateFactoryId(participants, tokenId, tokenScale) {
|
|
77
77
|
const sorted = [...participants].sort((a, b) => a.partyId.localeCompare(b.partyId));
|
|
78
78
|
const nonce = Array.from(globalThis.crypto?.getRandomValues?.(new Uint8Array(8)) ?? new Uint8Array(8)).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
79
79
|
const input = JSON.stringify({
|
|
80
80
|
participants: sorted.map(p => ({ partyId: p.partyId, pkd: p.publicKeyDigest })),
|
|
81
81
|
tokenId,
|
|
82
|
+
tokenScale,
|
|
82
83
|
nonce,
|
|
83
84
|
});
|
|
84
85
|
return Buffer.from((0, core_1.sha3_256)(new TextEncoder().encode(input))).toString('hex');
|
|
@@ -111,8 +112,11 @@ function generateFactoryId(participants, tokenId) {
|
|
|
111
112
|
* @param signer - Proposer's channel signer (`signer.publicKeyDigest` must match
|
|
112
113
|
* one of the registered participants).
|
|
113
114
|
* @param chainProvider - Optional: build + mine + broadcast the factory funding TX.
|
|
115
|
+
* @param tokenScale - Token scale exponent (Minima `Token.mTokenScale`). Native Minima
|
|
116
|
+
* is 0; coloured coins use `tokenAmount = minimaRawAmount × 10^scale`.
|
|
117
|
+
* Defaults to 0.
|
|
114
118
|
*/
|
|
115
|
-
async function createFactory(participants, tokenId, bundle, chainProvider) {
|
|
119
|
+
async function createFactory(participants, tokenId, bundle, chainProvider, tokenScale = 0) {
|
|
116
120
|
if (participants.length < 2) {
|
|
117
121
|
throw new Error(`Factory requires at least 2 participants, got ${participants.length}`);
|
|
118
122
|
}
|
|
@@ -127,14 +131,14 @@ async function createFactory(participants, tokenId, bundle, chainProvider) {
|
|
|
127
131
|
allocations[p.partyId] = p.contributionAmount;
|
|
128
132
|
}
|
|
129
133
|
const { script, address } = (0, script_js_1.buildAndHashFactoryScript)(participants);
|
|
130
|
-
const factoryId = generateFactoryId(participants, tokenId);
|
|
134
|
+
const factoryId = generateFactoryId(participants, tokenId, tokenScale);
|
|
131
135
|
// ── Build + mine + broadcast funding TX (when participants provide UTXOs) ──
|
|
132
136
|
let fundingTxId;
|
|
133
137
|
let fundingCoinId;
|
|
134
138
|
let pendingCommitment;
|
|
135
139
|
const allHaveCoinId = participants.every(p => p.fundingCoinId);
|
|
136
140
|
if (allHaveCoinId && chainProvider) {
|
|
137
|
-
const fundingDraft = (0, omnia_1.buildFundingTx)(script, address, totalValue, tokenId,
|
|
141
|
+
const fundingDraft = (0, omnia_1.buildFundingTx)(script, address, totalValue, tokenId, tokenScale, participants.map(p => p.fundingCoinId), participants.map(p => p.contributionAmount), participants.map(p => p.settlementAddress ?? p.publicKeyDigest));
|
|
138
142
|
// All parties co-sign the TX digest — the exact on-chain TX structure.
|
|
139
143
|
pendingCommitment = (0, omnia_1.computeTxDraftDigest)(fundingDraft);
|
|
140
144
|
const draftBytes = (0, omnia_1.omniaDraftToMinimaBytes)(fundingDraft);
|
|
@@ -163,6 +167,7 @@ async function createFactory(participants, tokenId, bundle, chainProvider) {
|
|
|
163
167
|
participants,
|
|
164
168
|
totalValue,
|
|
165
169
|
tokenId,
|
|
170
|
+
tokenScale,
|
|
166
171
|
allocations: { ...allocations },
|
|
167
172
|
virtualChannels: [],
|
|
168
173
|
currentSequence: 0,
|
package/dist/settlement.js
CHANGED
|
@@ -51,7 +51,7 @@ async function closeFactory(factory, leaseProviders, chainProvider) {
|
|
|
51
51
|
continue;
|
|
52
52
|
outputs.push({
|
|
53
53
|
address: participant.settlementAddress ?? participant.publicKeyDigest,
|
|
54
|
-
amount,
|
|
54
|
+
amount: (0, omnia_1.toRawMinima)(amount, factory.tokenScale),
|
|
55
55
|
tokenId: factory.tokenId,
|
|
56
56
|
storeState: false,
|
|
57
57
|
stateVariables: [],
|
|
@@ -62,7 +62,7 @@ async function closeFactory(factory, leaseProviders, chainProvider) {
|
|
|
62
62
|
inputs: [{
|
|
63
63
|
coinId: factory.fundingCoinId,
|
|
64
64
|
address: factory.fundingAddress,
|
|
65
|
-
amount: factory.totalValue,
|
|
65
|
+
amount: (0, omnia_1.toRawMinima)(factory.totalValue, factory.tokenScale),
|
|
66
66
|
tokenId: factory.tokenId,
|
|
67
67
|
scriptHex: factory.fundingScript,
|
|
68
68
|
}],
|
package/dist/types.d.ts
CHANGED
|
@@ -75,6 +75,14 @@ export interface ChannelFactory {
|
|
|
75
75
|
participants: FactoryParticipant[];
|
|
76
76
|
totalValue: bigint;
|
|
77
77
|
tokenId: string;
|
|
78
|
+
/**
|
|
79
|
+
* Token scale exponent, matching Minima's `Token.mTokenScale`:
|
|
80
|
+
* `tokenAmount = minimaRawAmount × 10^scale`. Native Minima (tokenId `0x00`)
|
|
81
|
+
* has scale 0. Coloured coins use `MINIMA_MAX_DECIMAL_PLACES − scale`
|
|
82
|
+
* (44 − scale) decimal places. All factory amounts are held in scaled token
|
|
83
|
+
* units; TX builders convert to raw Minima via `toRawMinima()`.
|
|
84
|
+
*/
|
|
85
|
+
tokenScale: number;
|
|
78
86
|
/** Current committed allocations: sum must equal `totalValue − sum(vc.totalValue)`. */
|
|
79
87
|
allocations: Record<string, bigint>;
|
|
80
88
|
/** Currently open virtual channels backed by this factory's shared UTXO. */
|
package/dist/virtual.d.ts
CHANGED
package/dist/virtual.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.openVirtualChannel = openVirtualChannel;
|
|
4
4
|
exports.closeVirtualChannel = closeVirtualChannel;
|
|
5
|
+
const omnia_1 = require("@totemsdk/omnia");
|
|
5
6
|
const core_1 = require("@totemsdk/core");
|
|
6
7
|
const factory_js_1 = require("./factory.js");
|
|
7
8
|
const commitment_js_1 = require("./commitment.js");
|
|
@@ -126,9 +127,11 @@ async function openVirtualChannel(factory, parties, amounts, leaseProviders, cha
|
|
|
126
127
|
fundingTxId: factory.fundingTxId ?? '',
|
|
127
128
|
fundingCoinId: factory.fundingCoinId ?? '',
|
|
128
129
|
fundingScript: factory.fundingScript,
|
|
130
|
+
programId: omnia_1.DefaultEltooPaymentProgram.id,
|
|
131
|
+
programVersion: omnia_1.DefaultEltooPaymentProgram.version,
|
|
129
132
|
fundingAddress: factory.fundingAddress,
|
|
130
133
|
tokenId: factory.tokenId,
|
|
131
|
-
tokenScale:
|
|
134
|
+
tokenScale: factory.tokenScale,
|
|
132
135
|
totalValue: amountA + amountB,
|
|
133
136
|
parties: [partyA, partyB],
|
|
134
137
|
balances: { [partyAId]: amountA, [partyBId]: amountB },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totemsdk/omnia-factory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Channel factory layer for Omnia — N-of-N MULTISIG funding, virtual channel management, and factory settlement",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,24 +11,20 @@
|
|
|
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/core": "^1.
|
|
27
|
-
"@totemsdk/
|
|
28
|
-
"@totemsdk/
|
|
29
|
-
"@totemsdk/tx-builder": "^0.1.
|
|
30
|
-
"@totemsdk/txpow": "^0.1.
|
|
31
|
-
"@totemsdk/chain-provider": "^0.1.
|
|
22
|
+
"@totemsdk/core": "^1.2.8",
|
|
23
|
+
"@totemsdk/wots-lease": "^0.1.5",
|
|
24
|
+
"@totemsdk/omnia": "^0.1.10",
|
|
25
|
+
"@totemsdk/tx-builder": "^0.1.8",
|
|
26
|
+
"@totemsdk/txpow": "^0.1.7",
|
|
27
|
+
"@totemsdk/chain-provider": "^0.1.6"
|
|
32
28
|
},
|
|
33
29
|
"devDependencies": {
|
|
34
30
|
"@types/jest": "^30.0.0",
|
|
@@ -52,7 +48,7 @@
|
|
|
52
48
|
"repository": {
|
|
53
49
|
"type": "git",
|
|
54
50
|
"url": "git+https://github.com/totem-sdk/totem-sdk.git",
|
|
55
|
-
"directory": "packages/
|
|
51
|
+
"directory": "packages/omnia-factory"
|
|
56
52
|
},
|
|
57
53
|
"keywords": [
|
|
58
54
|
"totem",
|
|
@@ -61,7 +57,6 @@
|
|
|
61
57
|
"blockchain",
|
|
62
58
|
"quantum-resistant",
|
|
63
59
|
"wots",
|
|
64
|
-
"kissvm",
|
|
65
60
|
"utxo",
|
|
66
61
|
"omnia",
|
|
67
62
|
"payment-channel",
|
|
@@ -70,5 +65,11 @@
|
|
|
70
65
|
"channel-factory",
|
|
71
66
|
"virtual-channel",
|
|
72
67
|
"multisig"
|
|
73
|
-
]
|
|
74
|
-
|
|
68
|
+
],
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "npm run build:wasm && tsc && node ../../scripts/clean-wasm-output-ignores.mjs",
|
|
71
|
+
"clean": "rm -rf dist rust/pkg rust/pkg-node rust/target",
|
|
72
|
+
"test": "jest",
|
|
73
|
+
"build:wasm": "cd rust && wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function build_factory_script_wasm(participants_js: any): string;
|
|
5
|
+
|
|
6
|
+
export function compute_factory_state_commitment_wasm(factory_id: string, sequence: number, allocations_js: any, virtual_channel_ids_js: any): Uint8Array;
|
|
7
|
+
|
|
8
|
+
export function enforce_conservation_wasm(total_value: string, allocations_js: any, virtual_channel_total: string): any;
|
|
9
|
+
|
|
10
|
+
export function init(): void;
|
|
11
|
+
|
|
12
|
+
export function normalize_script_wasm(script_str: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./omnia_factory_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./omnia_factory_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./omnia_factory_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
build_factory_script_wasm, compute_factory_state_commitment_wasm, enforce_conservation_wasm, init, normalize_script_wasm
|
|
9
|
+
} from "./omnia_factory_wasm_bg.js";
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {any} participants_js
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function build_factory_script_wasm(participants_js) {
|
|
6
|
+
let deferred2_0;
|
|
7
|
+
let deferred2_1;
|
|
8
|
+
try {
|
|
9
|
+
const ret = wasm.build_factory_script_wasm(participants_js);
|
|
10
|
+
var ptr1 = ret[0];
|
|
11
|
+
var len1 = ret[1];
|
|
12
|
+
if (ret[3]) {
|
|
13
|
+
ptr1 = 0; len1 = 0;
|
|
14
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
15
|
+
}
|
|
16
|
+
deferred2_0 = ptr1;
|
|
17
|
+
deferred2_1 = len1;
|
|
18
|
+
return getStringFromWasm0(ptr1, len1);
|
|
19
|
+
} finally {
|
|
20
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} factory_id
|
|
26
|
+
* @param {number} sequence
|
|
27
|
+
* @param {any} allocations_js
|
|
28
|
+
* @param {any} virtual_channel_ids_js
|
|
29
|
+
* @returns {Uint8Array}
|
|
30
|
+
*/
|
|
31
|
+
export function compute_factory_state_commitment_wasm(factory_id, sequence, allocations_js, virtual_channel_ids_js) {
|
|
32
|
+
const ptr0 = passStringToWasm0(factory_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
const ret = wasm.compute_factory_state_commitment_wasm(ptr0, len0, sequence, allocations_js, virtual_channel_ids_js);
|
|
35
|
+
if (ret[3]) {
|
|
36
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
37
|
+
}
|
|
38
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
39
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
40
|
+
return v2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} total_value
|
|
45
|
+
* @param {any} allocations_js
|
|
46
|
+
* @param {string} virtual_channel_total
|
|
47
|
+
* @returns {any}
|
|
48
|
+
*/
|
|
49
|
+
export function enforce_conservation_wasm(total_value, allocations_js, virtual_channel_total) {
|
|
50
|
+
const ptr0 = passStringToWasm0(total_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
51
|
+
const len0 = WASM_VECTOR_LEN;
|
|
52
|
+
const ptr1 = passStringToWasm0(virtual_channel_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
53
|
+
const len1 = WASM_VECTOR_LEN;
|
|
54
|
+
const ret = wasm.enforce_conservation_wasm(ptr0, len0, allocations_js, ptr1, len1);
|
|
55
|
+
if (ret[2]) {
|
|
56
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
57
|
+
}
|
|
58
|
+
return takeFromExternrefTable0(ret[0]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function init() {
|
|
62
|
+
wasm.init();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {string} script_str
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
export function normalize_script_wasm(script_str) {
|
|
70
|
+
let deferred2_0;
|
|
71
|
+
let deferred2_1;
|
|
72
|
+
try {
|
|
73
|
+
const ptr0 = passStringToWasm0(script_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
74
|
+
const len0 = WASM_VECTOR_LEN;
|
|
75
|
+
const ret = wasm.normalize_script_wasm(ptr0, len0);
|
|
76
|
+
deferred2_0 = ret[0];
|
|
77
|
+
deferred2_1 = ret[1];
|
|
78
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
79
|
+
} finally {
|
|
80
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
|
|
84
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
85
|
+
return ret;
|
|
86
|
+
}
|
|
87
|
+
export function __wbg_Number_9a4e0ecb0fa16705(arg0) {
|
|
88
|
+
const ret = Number(arg0);
|
|
89
|
+
return ret;
|
|
90
|
+
}
|
|
91
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
92
|
+
const ret = String(arg1);
|
|
93
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
94
|
+
const len1 = WASM_VECTOR_LEN;
|
|
95
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
96
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
97
|
+
}
|
|
98
|
+
export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
|
|
99
|
+
const v = arg0;
|
|
100
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
101
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
102
|
+
}
|
|
103
|
+
export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
|
|
104
|
+
const ret = debugString(arg1);
|
|
105
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
|
+
const len1 = WASM_VECTOR_LEN;
|
|
107
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
108
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
109
|
+
}
|
|
110
|
+
export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
|
|
111
|
+
const ret = arg0 in arg1;
|
|
112
|
+
return ret;
|
|
113
|
+
}
|
|
114
|
+
export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
|
|
115
|
+
const ret = typeof(arg0) === 'function';
|
|
116
|
+
return ret;
|
|
117
|
+
}
|
|
118
|
+
export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
|
|
119
|
+
const val = arg0;
|
|
120
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
121
|
+
return ret;
|
|
122
|
+
}
|
|
123
|
+
export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
|
|
124
|
+
const ret = arg0 === undefined;
|
|
125
|
+
return ret;
|
|
126
|
+
}
|
|
127
|
+
export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
|
|
128
|
+
const ret = arg0 == arg1;
|
|
129
|
+
return ret;
|
|
130
|
+
}
|
|
131
|
+
export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
|
|
132
|
+
const obj = arg1;
|
|
133
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
134
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
135
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
136
|
+
}
|
|
137
|
+
export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
|
|
138
|
+
const obj = arg1;
|
|
139
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
140
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
var len1 = WASM_VECTOR_LEN;
|
|
142
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
143
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
144
|
+
}
|
|
145
|
+
export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
|
|
146
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
147
|
+
}
|
|
148
|
+
export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
|
|
149
|
+
const ret = arg0.call(arg1);
|
|
150
|
+
return ret;
|
|
151
|
+
}, arguments); }
|
|
152
|
+
export function __wbg_done_89b2b13e91a60321(arg0) {
|
|
153
|
+
const ret = arg0.done;
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
export function __wbg_entries_015dc610cd81ede0(arg0) {
|
|
157
|
+
const ret = Object.entries(arg0);
|
|
158
|
+
return ret;
|
|
159
|
+
}
|
|
160
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
161
|
+
let deferred0_0;
|
|
162
|
+
let deferred0_1;
|
|
163
|
+
try {
|
|
164
|
+
deferred0_0 = arg0;
|
|
165
|
+
deferred0_1 = arg1;
|
|
166
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
167
|
+
} finally {
|
|
168
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function __wbg_get_507a50627bffa49b(arg0, arg1) {
|
|
172
|
+
const ret = arg0[arg1 >>> 0];
|
|
173
|
+
return ret;
|
|
174
|
+
}
|
|
175
|
+
export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
|
|
176
|
+
const ret = Reflect.get(arg0, arg1);
|
|
177
|
+
return ret;
|
|
178
|
+
}, arguments); }
|
|
179
|
+
export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
|
|
180
|
+
const ret = arg0[arg1 >>> 0];
|
|
181
|
+
return ret;
|
|
182
|
+
}
|
|
183
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
184
|
+
const ret = arg0[arg1];
|
|
185
|
+
return ret;
|
|
186
|
+
}
|
|
187
|
+
export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
|
|
188
|
+
let result;
|
|
189
|
+
try {
|
|
190
|
+
result = arg0 instanceof ArrayBuffer;
|
|
191
|
+
} catch (_) {
|
|
192
|
+
result = false;
|
|
193
|
+
}
|
|
194
|
+
const ret = result;
|
|
195
|
+
return ret;
|
|
196
|
+
}
|
|
197
|
+
export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
|
|
198
|
+
let result;
|
|
199
|
+
try {
|
|
200
|
+
result = arg0 instanceof Uint8Array;
|
|
201
|
+
} catch (_) {
|
|
202
|
+
result = false;
|
|
203
|
+
}
|
|
204
|
+
const ret = result;
|
|
205
|
+
return ret;
|
|
206
|
+
}
|
|
207
|
+
export function __wbg_isArray_0677c962b281d01a(arg0) {
|
|
208
|
+
const ret = Array.isArray(arg0);
|
|
209
|
+
return ret;
|
|
210
|
+
}
|
|
211
|
+
export function __wbg_isSafeInteger_04f36e4056f1b851(arg0) {
|
|
212
|
+
const ret = Number.isSafeInteger(arg0);
|
|
213
|
+
return ret;
|
|
214
|
+
}
|
|
215
|
+
export function __wbg_iterator_6f722e4a93058b71() {
|
|
216
|
+
const ret = Symbol.iterator;
|
|
217
|
+
return ret;
|
|
218
|
+
}
|
|
219
|
+
export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
|
|
220
|
+
const ret = arg0.length;
|
|
221
|
+
return ret;
|
|
222
|
+
}
|
|
223
|
+
export function __wbg_length_370319915dc99107(arg0) {
|
|
224
|
+
const ret = arg0.length;
|
|
225
|
+
return ret;
|
|
226
|
+
}
|
|
227
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
228
|
+
const ret = new Error();
|
|
229
|
+
return ret;
|
|
230
|
+
}
|
|
231
|
+
export function __wbg_new_cd45aabdf6073e84(arg0) {
|
|
232
|
+
const ret = new Uint8Array(arg0);
|
|
233
|
+
return ret;
|
|
234
|
+
}
|
|
235
|
+
export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
|
|
236
|
+
const ret = arg0.next;
|
|
237
|
+
return ret;
|
|
238
|
+
}
|
|
239
|
+
export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
|
|
240
|
+
const ret = arg0.next();
|
|
241
|
+
return ret;
|
|
242
|
+
}, arguments); }
|
|
243
|
+
export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
|
|
244
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
245
|
+
}
|
|
246
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
247
|
+
const ret = arg1.stack;
|
|
248
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
249
|
+
const len1 = WASM_VECTOR_LEN;
|
|
250
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
251
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
252
|
+
}
|
|
253
|
+
export function __wbg_value_a5d5488a9589444a(arg0) {
|
|
254
|
+
const ret = arg0.value;
|
|
255
|
+
return ret;
|
|
256
|
+
}
|
|
257
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
258
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
259
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
260
|
+
return ret;
|
|
261
|
+
}
|
|
262
|
+
export function __wbindgen_init_externref_table() {
|
|
263
|
+
const table = wasm.__wbindgen_externrefs;
|
|
264
|
+
const offset = table.grow(4);
|
|
265
|
+
table.set(0, undefined);
|
|
266
|
+
table.set(offset + 0, undefined);
|
|
267
|
+
table.set(offset + 1, null);
|
|
268
|
+
table.set(offset + 2, true);
|
|
269
|
+
table.set(offset + 3, false);
|
|
270
|
+
}
|
|
271
|
+
function addToExternrefTable0(obj) {
|
|
272
|
+
const idx = wasm.__externref_table_alloc();
|
|
273
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
274
|
+
return idx;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function debugString(val) {
|
|
278
|
+
// primitive types
|
|
279
|
+
const type = typeof val;
|
|
280
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
281
|
+
return `${val}`;
|
|
282
|
+
}
|
|
283
|
+
if (type == 'string') {
|
|
284
|
+
return `"${val}"`;
|
|
285
|
+
}
|
|
286
|
+
if (type == 'symbol') {
|
|
287
|
+
const description = val.description;
|
|
288
|
+
if (description == null) {
|
|
289
|
+
return 'Symbol';
|
|
290
|
+
} else {
|
|
291
|
+
return `Symbol(${description})`;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (type == 'function') {
|
|
295
|
+
const name = val.name;
|
|
296
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
297
|
+
return `Function(${name})`;
|
|
298
|
+
} else {
|
|
299
|
+
return 'Function';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// objects
|
|
303
|
+
if (Array.isArray(val)) {
|
|
304
|
+
const length = val.length;
|
|
305
|
+
let debug = '[';
|
|
306
|
+
if (length > 0) {
|
|
307
|
+
debug += debugString(val[0]);
|
|
308
|
+
}
|
|
309
|
+
for(let i = 1; i < length; i++) {
|
|
310
|
+
debug += ', ' + debugString(val[i]);
|
|
311
|
+
}
|
|
312
|
+
debug += ']';
|
|
313
|
+
return debug;
|
|
314
|
+
}
|
|
315
|
+
// Test for built-in
|
|
316
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
317
|
+
let className;
|
|
318
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
319
|
+
className = builtInMatches[1];
|
|
320
|
+
} else {
|
|
321
|
+
// Failed to match the standard '[object ClassName]'
|
|
322
|
+
return toString.call(val);
|
|
323
|
+
}
|
|
324
|
+
if (className == 'Object') {
|
|
325
|
+
// we're a user defined class or Object
|
|
326
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
327
|
+
// easier than looping through ownProperties of `val`.
|
|
328
|
+
try {
|
|
329
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
330
|
+
} catch (_) {
|
|
331
|
+
return 'Object';
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
// errors
|
|
335
|
+
if (val instanceof Error) {
|
|
336
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
337
|
+
}
|
|
338
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
339
|
+
return className;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
343
|
+
ptr = ptr >>> 0;
|
|
344
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
let cachedDataViewMemory0 = null;
|
|
348
|
+
function getDataViewMemory0() {
|
|
349
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
350
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
351
|
+
}
|
|
352
|
+
return cachedDataViewMemory0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function getStringFromWasm0(ptr, len) {
|
|
356
|
+
return decodeText(ptr >>> 0, len);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
let cachedUint8ArrayMemory0 = null;
|
|
360
|
+
function getUint8ArrayMemory0() {
|
|
361
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
362
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
363
|
+
}
|
|
364
|
+
return cachedUint8ArrayMemory0;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function handleError(f, args) {
|
|
368
|
+
try {
|
|
369
|
+
return f.apply(this, args);
|
|
370
|
+
} catch (e) {
|
|
371
|
+
const idx = addToExternrefTable0(e);
|
|
372
|
+
wasm.__wbindgen_exn_store(idx);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function isLikeNone(x) {
|
|
377
|
+
return x === undefined || x === null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
381
|
+
if (realloc === undefined) {
|
|
382
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
383
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
384
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
385
|
+
WASM_VECTOR_LEN = buf.length;
|
|
386
|
+
return ptr;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
let len = arg.length;
|
|
390
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
391
|
+
|
|
392
|
+
const mem = getUint8ArrayMemory0();
|
|
393
|
+
|
|
394
|
+
let offset = 0;
|
|
395
|
+
|
|
396
|
+
for (; offset < len; offset++) {
|
|
397
|
+
const code = arg.charCodeAt(offset);
|
|
398
|
+
if (code > 0x7F) break;
|
|
399
|
+
mem[ptr + offset] = code;
|
|
400
|
+
}
|
|
401
|
+
if (offset !== len) {
|
|
402
|
+
if (offset !== 0) {
|
|
403
|
+
arg = arg.slice(offset);
|
|
404
|
+
}
|
|
405
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
406
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
407
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
408
|
+
|
|
409
|
+
offset += ret.written;
|
|
410
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
WASM_VECTOR_LEN = offset;
|
|
414
|
+
return ptr;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function takeFromExternrefTable0(idx) {
|
|
418
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
419
|
+
wasm.__externref_table_dealloc(idx);
|
|
420
|
+
return value;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
424
|
+
cachedTextDecoder.decode();
|
|
425
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
426
|
+
let numBytesDecoded = 0;
|
|
427
|
+
function decodeText(ptr, len) {
|
|
428
|
+
numBytesDecoded += len;
|
|
429
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
430
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
431
|
+
cachedTextDecoder.decode();
|
|
432
|
+
numBytesDecoded = len;
|
|
433
|
+
}
|
|
434
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const cachedTextEncoder = new TextEncoder();
|
|
438
|
+
|
|
439
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
440
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
441
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
442
|
+
view.set(buf);
|
|
443
|
+
return {
|
|
444
|
+
read: arg.length,
|
|
445
|
+
written: buf.length
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
let WASM_VECTOR_LEN = 0;
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
let wasm;
|
|
454
|
+
export function __wbg_set_wasm(val) {
|
|
455
|
+
wasm = val;
|
|
456
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const build_factory_script_wasm: (a: any) => [number, number, number, number];
|
|
5
|
+
export const compute_factory_state_commitment_wasm: (a: number, b: number, c: number, d: any, e: any) => [number, number, number, number];
|
|
6
|
+
export const enforce_conservation_wasm: (a: number, b: number, c: any, d: number, e: number) => [number, number, number];
|
|
7
|
+
export const init: () => void;
|
|
8
|
+
export const normalize_script_wasm: (a: number, b: number) => [number, number];
|
|
9
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
10
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
11
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
12
|
+
export const __externref_table_alloc: () => number;
|
|
13
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
14
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
15
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
16
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "omnia-factory-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Totem SDK Contributors"
|
|
6
|
+
],
|
|
7
|
+
"description": "Channel factory commitment layer — N-of-N MULTISIG script building, state commitment hashing, balance conservation enforcement (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_factory_wasm_bg.wasm",
|
|
16
|
+
"omnia_factory_wasm.js",
|
|
17
|
+
"omnia_factory_wasm_bg.js",
|
|
18
|
+
"omnia_factory_wasm.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "omnia_factory_wasm.js",
|
|
21
|
+
"homepage": "https://totem.ing",
|
|
22
|
+
"types": "omnia_factory_wasm.d.ts",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"./omnia_factory_wasm.js",
|
|
25
|
+
"./snippets/*"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function build_factory_script_wasm(participants_js: any): string;
|
|
5
|
+
|
|
6
|
+
export function compute_factory_state_commitment_wasm(factory_id: string, sequence: number, allocations_js: any, virtual_channel_ids_js: any): Uint8Array;
|
|
7
|
+
|
|
8
|
+
export function enforce_conservation_wasm(total_value: string, allocations_js: any, virtual_channel_total: string): any;
|
|
9
|
+
|
|
10
|
+
export function init(): void;
|
|
11
|
+
|
|
12
|
+
export function normalize_script_wasm(script_str: string): string;
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/* @ts-self-types="./omnia_factory_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {any} participants_js
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
function build_factory_script_wasm(participants_js) {
|
|
8
|
+
let deferred2_0;
|
|
9
|
+
let deferred2_1;
|
|
10
|
+
try {
|
|
11
|
+
const ret = wasm.build_factory_script_wasm(participants_js);
|
|
12
|
+
var ptr1 = ret[0];
|
|
13
|
+
var len1 = ret[1];
|
|
14
|
+
if (ret[3]) {
|
|
15
|
+
ptr1 = 0; len1 = 0;
|
|
16
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
17
|
+
}
|
|
18
|
+
deferred2_0 = ptr1;
|
|
19
|
+
deferred2_1 = len1;
|
|
20
|
+
return getStringFromWasm0(ptr1, len1);
|
|
21
|
+
} finally {
|
|
22
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.build_factory_script_wasm = build_factory_script_wasm;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {string} factory_id
|
|
29
|
+
* @param {number} sequence
|
|
30
|
+
* @param {any} allocations_js
|
|
31
|
+
* @param {any} virtual_channel_ids_js
|
|
32
|
+
* @returns {Uint8Array}
|
|
33
|
+
*/
|
|
34
|
+
function compute_factory_state_commitment_wasm(factory_id, sequence, allocations_js, virtual_channel_ids_js) {
|
|
35
|
+
const ptr0 = passStringToWasm0(factory_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
36
|
+
const len0 = WASM_VECTOR_LEN;
|
|
37
|
+
const ret = wasm.compute_factory_state_commitment_wasm(ptr0, len0, sequence, allocations_js, virtual_channel_ids_js);
|
|
38
|
+
if (ret[3]) {
|
|
39
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
40
|
+
}
|
|
41
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
42
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
43
|
+
return v2;
|
|
44
|
+
}
|
|
45
|
+
exports.compute_factory_state_commitment_wasm = compute_factory_state_commitment_wasm;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} total_value
|
|
49
|
+
* @param {any} allocations_js
|
|
50
|
+
* @param {string} virtual_channel_total
|
|
51
|
+
* @returns {any}
|
|
52
|
+
*/
|
|
53
|
+
function enforce_conservation_wasm(total_value, allocations_js, virtual_channel_total) {
|
|
54
|
+
const ptr0 = passStringToWasm0(total_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
const ptr1 = passStringToWasm0(virtual_channel_total, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
57
|
+
const len1 = WASM_VECTOR_LEN;
|
|
58
|
+
const ret = wasm.enforce_conservation_wasm(ptr0, len0, allocations_js, ptr1, len1);
|
|
59
|
+
if (ret[2]) {
|
|
60
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
61
|
+
}
|
|
62
|
+
return takeFromExternrefTable0(ret[0]);
|
|
63
|
+
}
|
|
64
|
+
exports.enforce_conservation_wasm = enforce_conservation_wasm;
|
|
65
|
+
|
|
66
|
+
function init() {
|
|
67
|
+
wasm.init();
|
|
68
|
+
}
|
|
69
|
+
exports.init = init;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {string} script_str
|
|
73
|
+
* @returns {string}
|
|
74
|
+
*/
|
|
75
|
+
function normalize_script_wasm(script_str) {
|
|
76
|
+
let deferred2_0;
|
|
77
|
+
let deferred2_1;
|
|
78
|
+
try {
|
|
79
|
+
const ptr0 = passStringToWasm0(script_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
80
|
+
const len0 = WASM_VECTOR_LEN;
|
|
81
|
+
const ret = wasm.normalize_script_wasm(ptr0, len0);
|
|
82
|
+
deferred2_0 = ret[0];
|
|
83
|
+
deferred2_1 = ret[1];
|
|
84
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
85
|
+
} finally {
|
|
86
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.normalize_script_wasm = normalize_script_wasm;
|
|
90
|
+
function __wbg_get_imports() {
|
|
91
|
+
const import0 = {
|
|
92
|
+
__proto__: null,
|
|
93
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
94
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
95
|
+
return ret;
|
|
96
|
+
},
|
|
97
|
+
__wbg_Number_9a4e0ecb0fa16705: function(arg0) {
|
|
98
|
+
const ret = Number(arg0);
|
|
99
|
+
return ret;
|
|
100
|
+
},
|
|
101
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
102
|
+
const ret = String(arg1);
|
|
103
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
+
const len1 = WASM_VECTOR_LEN;
|
|
105
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
106
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
107
|
+
},
|
|
108
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
109
|
+
const v = arg0;
|
|
110
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
111
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
112
|
+
},
|
|
113
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
114
|
+
const ret = debugString(arg1);
|
|
115
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
116
|
+
const len1 = WASM_VECTOR_LEN;
|
|
117
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
118
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
119
|
+
},
|
|
120
|
+
__wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
121
|
+
const ret = arg0 in arg1;
|
|
122
|
+
return ret;
|
|
123
|
+
},
|
|
124
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
125
|
+
const ret = typeof(arg0) === 'function';
|
|
126
|
+
return ret;
|
|
127
|
+
},
|
|
128
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
129
|
+
const val = arg0;
|
|
130
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
134
|
+
const ret = arg0 === undefined;
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
138
|
+
const ret = arg0 == arg1;
|
|
139
|
+
return ret;
|
|
140
|
+
},
|
|
141
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
142
|
+
const obj = arg1;
|
|
143
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
144
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
145
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
146
|
+
},
|
|
147
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
148
|
+
const obj = arg1;
|
|
149
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
150
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
151
|
+
var len1 = WASM_VECTOR_LEN;
|
|
152
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
153
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
154
|
+
},
|
|
155
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
156
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
157
|
+
},
|
|
158
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
159
|
+
const ret = arg0.call(arg1);
|
|
160
|
+
return ret;
|
|
161
|
+
}, arguments); },
|
|
162
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
163
|
+
const ret = arg0.done;
|
|
164
|
+
return ret;
|
|
165
|
+
},
|
|
166
|
+
__wbg_entries_015dc610cd81ede0: function(arg0) {
|
|
167
|
+
const ret = Object.entries(arg0);
|
|
168
|
+
return ret;
|
|
169
|
+
},
|
|
170
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
171
|
+
let deferred0_0;
|
|
172
|
+
let deferred0_1;
|
|
173
|
+
try {
|
|
174
|
+
deferred0_0 = arg0;
|
|
175
|
+
deferred0_1 = arg1;
|
|
176
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
177
|
+
} finally {
|
|
178
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
182
|
+
const ret = arg0[arg1 >>> 0];
|
|
183
|
+
return ret;
|
|
184
|
+
},
|
|
185
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
186
|
+
const ret = Reflect.get(arg0, arg1);
|
|
187
|
+
return ret;
|
|
188
|
+
}, arguments); },
|
|
189
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
190
|
+
const ret = arg0[arg1 >>> 0];
|
|
191
|
+
return ret;
|
|
192
|
+
},
|
|
193
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
194
|
+
const ret = arg0[arg1];
|
|
195
|
+
return ret;
|
|
196
|
+
},
|
|
197
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
198
|
+
let result;
|
|
199
|
+
try {
|
|
200
|
+
result = arg0 instanceof ArrayBuffer;
|
|
201
|
+
} catch (_) {
|
|
202
|
+
result = false;
|
|
203
|
+
}
|
|
204
|
+
const ret = result;
|
|
205
|
+
return ret;
|
|
206
|
+
},
|
|
207
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
208
|
+
let result;
|
|
209
|
+
try {
|
|
210
|
+
result = arg0 instanceof Uint8Array;
|
|
211
|
+
} catch (_) {
|
|
212
|
+
result = false;
|
|
213
|
+
}
|
|
214
|
+
const ret = result;
|
|
215
|
+
return ret;
|
|
216
|
+
},
|
|
217
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
218
|
+
const ret = Array.isArray(arg0);
|
|
219
|
+
return ret;
|
|
220
|
+
},
|
|
221
|
+
__wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
|
|
222
|
+
const ret = Number.isSafeInteger(arg0);
|
|
223
|
+
return ret;
|
|
224
|
+
},
|
|
225
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
226
|
+
const ret = Symbol.iterator;
|
|
227
|
+
return ret;
|
|
228
|
+
},
|
|
229
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
230
|
+
const ret = arg0.length;
|
|
231
|
+
return ret;
|
|
232
|
+
},
|
|
233
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
234
|
+
const ret = arg0.length;
|
|
235
|
+
return ret;
|
|
236
|
+
},
|
|
237
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
238
|
+
const ret = new Error();
|
|
239
|
+
return ret;
|
|
240
|
+
},
|
|
241
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
242
|
+
const ret = new Uint8Array(arg0);
|
|
243
|
+
return ret;
|
|
244
|
+
},
|
|
245
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
246
|
+
const ret = arg0.next;
|
|
247
|
+
return ret;
|
|
248
|
+
},
|
|
249
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
250
|
+
const ret = arg0.next();
|
|
251
|
+
return ret;
|
|
252
|
+
}, arguments); },
|
|
253
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
254
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
255
|
+
},
|
|
256
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
257
|
+
const ret = arg1.stack;
|
|
258
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
259
|
+
const len1 = WASM_VECTOR_LEN;
|
|
260
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
261
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
262
|
+
},
|
|
263
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
264
|
+
const ret = arg0.value;
|
|
265
|
+
return ret;
|
|
266
|
+
},
|
|
267
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
268
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
269
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
270
|
+
return ret;
|
|
271
|
+
},
|
|
272
|
+
__wbindgen_init_externref_table: function() {
|
|
273
|
+
const table = wasm.__wbindgen_externrefs;
|
|
274
|
+
const offset = table.grow(4);
|
|
275
|
+
table.set(0, undefined);
|
|
276
|
+
table.set(offset + 0, undefined);
|
|
277
|
+
table.set(offset + 1, null);
|
|
278
|
+
table.set(offset + 2, true);
|
|
279
|
+
table.set(offset + 3, false);
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
return {
|
|
283
|
+
__proto__: null,
|
|
284
|
+
"./omnia_factory_wasm_bg.js": import0,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function addToExternrefTable0(obj) {
|
|
289
|
+
const idx = wasm.__externref_table_alloc();
|
|
290
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
291
|
+
return idx;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function debugString(val) {
|
|
295
|
+
// primitive types
|
|
296
|
+
const type = typeof val;
|
|
297
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
298
|
+
return `${val}`;
|
|
299
|
+
}
|
|
300
|
+
if (type == 'string') {
|
|
301
|
+
return `"${val}"`;
|
|
302
|
+
}
|
|
303
|
+
if (type == 'symbol') {
|
|
304
|
+
const description = val.description;
|
|
305
|
+
if (description == null) {
|
|
306
|
+
return 'Symbol';
|
|
307
|
+
} else {
|
|
308
|
+
return `Symbol(${description})`;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (type == 'function') {
|
|
312
|
+
const name = val.name;
|
|
313
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
314
|
+
return `Function(${name})`;
|
|
315
|
+
} else {
|
|
316
|
+
return 'Function';
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// objects
|
|
320
|
+
if (Array.isArray(val)) {
|
|
321
|
+
const length = val.length;
|
|
322
|
+
let debug = '[';
|
|
323
|
+
if (length > 0) {
|
|
324
|
+
debug += debugString(val[0]);
|
|
325
|
+
}
|
|
326
|
+
for(let i = 1; i < length; i++) {
|
|
327
|
+
debug += ', ' + debugString(val[i]);
|
|
328
|
+
}
|
|
329
|
+
debug += ']';
|
|
330
|
+
return debug;
|
|
331
|
+
}
|
|
332
|
+
// Test for built-in
|
|
333
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
334
|
+
let className;
|
|
335
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
336
|
+
className = builtInMatches[1];
|
|
337
|
+
} else {
|
|
338
|
+
// Failed to match the standard '[object ClassName]'
|
|
339
|
+
return toString.call(val);
|
|
340
|
+
}
|
|
341
|
+
if (className == 'Object') {
|
|
342
|
+
// we're a user defined class or Object
|
|
343
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
344
|
+
// easier than looping through ownProperties of `val`.
|
|
345
|
+
try {
|
|
346
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
347
|
+
} catch (_) {
|
|
348
|
+
return 'Object';
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// errors
|
|
352
|
+
if (val instanceof Error) {
|
|
353
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
354
|
+
}
|
|
355
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
356
|
+
return className;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
360
|
+
ptr = ptr >>> 0;
|
|
361
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
let cachedDataViewMemory0 = null;
|
|
365
|
+
function getDataViewMemory0() {
|
|
366
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
367
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
368
|
+
}
|
|
369
|
+
return cachedDataViewMemory0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function getStringFromWasm0(ptr, len) {
|
|
373
|
+
return decodeText(ptr >>> 0, len);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let cachedUint8ArrayMemory0 = null;
|
|
377
|
+
function getUint8ArrayMemory0() {
|
|
378
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
379
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
380
|
+
}
|
|
381
|
+
return cachedUint8ArrayMemory0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function handleError(f, args) {
|
|
385
|
+
try {
|
|
386
|
+
return f.apply(this, args);
|
|
387
|
+
} catch (e) {
|
|
388
|
+
const idx = addToExternrefTable0(e);
|
|
389
|
+
wasm.__wbindgen_exn_store(idx);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function isLikeNone(x) {
|
|
394
|
+
return x === undefined || x === null;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
398
|
+
if (realloc === undefined) {
|
|
399
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
400
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
401
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
402
|
+
WASM_VECTOR_LEN = buf.length;
|
|
403
|
+
return ptr;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let len = arg.length;
|
|
407
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
408
|
+
|
|
409
|
+
const mem = getUint8ArrayMemory0();
|
|
410
|
+
|
|
411
|
+
let offset = 0;
|
|
412
|
+
|
|
413
|
+
for (; offset < len; offset++) {
|
|
414
|
+
const code = arg.charCodeAt(offset);
|
|
415
|
+
if (code > 0x7F) break;
|
|
416
|
+
mem[ptr + offset] = code;
|
|
417
|
+
}
|
|
418
|
+
if (offset !== len) {
|
|
419
|
+
if (offset !== 0) {
|
|
420
|
+
arg = arg.slice(offset);
|
|
421
|
+
}
|
|
422
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
423
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
424
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
425
|
+
|
|
426
|
+
offset += ret.written;
|
|
427
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
WASM_VECTOR_LEN = offset;
|
|
431
|
+
return ptr;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function takeFromExternrefTable0(idx) {
|
|
435
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
436
|
+
wasm.__externref_table_dealloc(idx);
|
|
437
|
+
return value;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
441
|
+
cachedTextDecoder.decode();
|
|
442
|
+
function decodeText(ptr, len) {
|
|
443
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const cachedTextEncoder = new TextEncoder();
|
|
447
|
+
|
|
448
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
449
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
450
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
451
|
+
view.set(buf);
|
|
452
|
+
return {
|
|
453
|
+
read: arg.length,
|
|
454
|
+
written: buf.length
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
let WASM_VECTOR_LEN = 0;
|
|
460
|
+
|
|
461
|
+
const wasmPath = `${__dirname}/omnia_factory_wasm_bg.wasm`;
|
|
462
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
463
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
464
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
465
|
+
let wasm = wasmInstance.exports;
|
|
466
|
+
wasm.__wbindgen_start();
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const build_factory_script_wasm: (a: any) => [number, number, number, number];
|
|
5
|
+
export const compute_factory_state_commitment_wasm: (a: number, b: number, c: number, d: any, e: any) => [number, number, number, number];
|
|
6
|
+
export const enforce_conservation_wasm: (a: number, b: number, c: any, d: number, e: number) => [number, number, number];
|
|
7
|
+
export const init: () => void;
|
|
8
|
+
export const normalize_script_wasm: (a: number, b: number) => [number, number];
|
|
9
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
10
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
11
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
12
|
+
export const __externref_table_alloc: () => number;
|
|
13
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
14
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
15
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
16
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "omnia-factory-wasm",
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"Totem SDK Contributors"
|
|
5
|
+
],
|
|
6
|
+
"description": "Channel factory commitment layer — N-of-N MULTISIG script building, state commitment hashing, balance conservation enforcement (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_factory_wasm_bg.wasm",
|
|
15
|
+
"omnia_factory_wasm.js",
|
|
16
|
+
"omnia_factory_wasm.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"main": "omnia_factory_wasm.js",
|
|
19
|
+
"homepage": "https://totem.ing",
|
|
20
|
+
"types": "omnia_factory_wasm.d.ts"
|
|
21
|
+
}
|