@totemsdk/omnia-factory 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +70 -0
  2. package/package.json +22 -14
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @totemsdk/omnia-factory
2
+
3
+ **Scale payment channels — N-of-N funded factory channels with virtual sub-channels.**
4
+
5
+ Enables a Lightning-like channel factory pattern: a single on-chain UTXO funds a factory, and virtual channels between factory participants open and close off-chain. Dramatically reduces on-chain footprint for active participants.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @totemsdk/omnia-factory
11
+ ```
12
+
13
+ ## What's inside
14
+
15
+ - **N-of-N MULTISIG funding** — one on-chain UTXO funds the factory; all participants co-sign the funding transaction
16
+ - **Virtual channel management** — open sub-channels between any factory participants without any on-chain transactions
17
+ - **Factory settlement** — settle multiple virtual channels in a single on-chain transaction when participants exit
18
+ - **Reduced footprint** — 10 participants with 45 active channels = still just 1 on-chain UTXO
19
+
20
+ ## Usage
21
+
22
+ ### Create a factory
23
+
24
+ ```typescript
25
+ import { createChannelFactory } from '@totemsdk/omnia-factory';
26
+
27
+ const factory = await createChannelFactory({
28
+ participants: [
29
+ { address: 'MxAAA...', publicKey: '0x...' },
30
+ { address: 'MxBBB...', publicKey: '0x...' },
31
+ { address: 'MxCCC...', publicKey: '0x...' },
32
+ ],
33
+ fundingAmount: '1000',
34
+ tokenid: '0x00',
35
+ signer,
36
+ provider,
37
+ leaseProvider,
38
+ });
39
+
40
+ console.log('Factory ID:', factory.id);
41
+ console.log('Funding TxPoW ID:', factory.fundingTxpowId);
42
+ ```
43
+
44
+ ### Open a virtual channel inside the factory
45
+
46
+ ```typescript
47
+ const virtualChannel = await factory.openVirtualChannel({
48
+ from: 'MxAAA...',
49
+ to: 'MxBBB...',
50
+ amount: '50',
51
+ });
52
+
53
+ // Use like a regular OmniaChannel
54
+ await virtualChannel.pay({ amount: '5', tokenid: '0x00', recipient: 'MxBBB...' });
55
+ ```
56
+
57
+ ### Settle and exit
58
+
59
+ ```typescript
60
+ // Settle all virtual channels involving a participant in one on-chain tx
61
+ const settlementHex = await factory.settle({ exitParticipant: 'MxAAA...' });
62
+ await provider.broadcastTxPoW(settlementHex);
63
+ ```
64
+
65
+ ## See also
66
+
67
+ - [`@totemsdk/omnia`](../omnia) — core channel state machine used by virtual channels
68
+ - [`@totemsdk/omnia-router`](../omnia-router) — route payments across factory and direct channels
69
+ - [`@totemsdk/wots-lease`](../wots-lease) — WOTS key safety for factory signing
70
+ - [`@totemsdk/tx-builder`](../tx-builder) — builds the N-of-N funding transaction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-factory",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Channel factory layer for Omnia — N-of-N MULTISIG funding, virtual channel management, and factory settlement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,22 +11,25 @@
11
11
  "import": "./dist/index.js"
12
12
  }
13
13
  },
14
- "scripts": {
15
- "build": "tsc",
16
- "clean": "rm -rf dist",
17
- "test": "node ../../node_modules/jest/bin/jest.js --config jest.config.cjs --passWithNoTests"
18
- },
19
14
  "files": [
20
15
  "dist",
21
16
  "src"
22
17
  ],
23
18
  "dependencies": {
24
- "@totemsdk/core": "workspace:*",
25
- "@totemsdk/omnia": "workspace:*",
26
- "@totemsdk/wots-lease": "workspace:*",
27
- "@totemsdk/tx-builder": "workspace:*",
28
- "@totemsdk/txpow": "workspace:*",
29
- "@totemsdk/chain-provider": "workspace:*"
19
+ "@totemsdk/core": "1.0.8",
20
+ "@totemsdk/omnia": "0.1.2",
21
+ "@totemsdk/wots-lease": "0.1.2",
22
+ "@totemsdk/tx-builder": "0.1.3",
23
+ "@totemsdk/txpow": "0.1.2",
24
+ "@totemsdk/chain-provider": "0.1.2"
25
+ },
26
+ "peerDependencies": {
27
+ "@noble/hashes": ">=1.3.0 <2.0.0"
28
+ },
29
+ "peerDependenciesMeta": {
30
+ "@noble/hashes": {
31
+ "optional": false
32
+ }
30
33
  },
31
34
  "devDependencies": {
32
35
  "@noble/hashes": "^1.3.0",
@@ -42,5 +45,10 @@
42
45
  "publishConfig": {
43
46
  "access": "public"
44
47
  },
45
- "license": "MIT"
46
- }
48
+ "license": "MIT",
49
+ "scripts": {
50
+ "build": "tsc",
51
+ "clean": "rm -rf dist",
52
+ "test": "node ../../node_modules/jest/bin/jest.js --config jest.config.cjs --passWithNoTests"
53
+ }
54
+ }