@totemsdk/omnia-vtxo 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Virtual UTXO (vTXO) / payment-pool claim layer for the Totem Edge ecosystem.
4
4
 
5
+ > **Role:** the **spendable balances**. A VTXO is a cash-like off-chain bearer
6
+ > claim on a pool's on-chain capacity. This package owns the pool output script,
7
+ > the VTXO lifecycle (mint / transfer / split / merge / refresh / exit), the
8
+ > operator co-signature, and the per-share exit. It is **not** the LP accounting
9
+ > layer — that is `@totemsdk/liquidity-bond` + `@totemsdk/omnia-pool`, which
10
+ > allocate capital *into* a VTXO pool. They compose; they don't overlap.
11
+ > See [`docs/examples/meridian-vtxo-payments.md`](../../docs/examples/meridian-vtxo-payments.md).
12
+
5
13
  ## What is Omnia VTXO?
6
14
 
7
15
  `@totemsdk/omnia-vtxo` is a **cash-like off-chain balance primitive** that gives Totem Edge applications a way to hold, transfer, split, merge, and exit token balances without requiring a live Minima node for every operation. Each VTXO (Virtual Transaction Output) is a claim on a pool of on-chain capacity, backed by a deterministic Merkle commitment tree.
@@ -4,13 +4,14 @@
4
4
  * The pool is an on-chain state output holding `totalCapacity`. An epoch's batch
5
5
  * root is committed as STATE(100), the epoch number in STATE(101), the absolute
6
6
  * exit-eligibility block in STATE(102), and each holder's committed share in
7
- * STATE(300+k).
7
+ * STATE(200+k).
8
8
  *
9
9
  * Custody (RFC-039 / CUSTODY-POLICY §2):
10
- * - **Per-share unilateral exit.** After `@BLOCK GT EXITBLOCK` each holder may
11
- * withdraw **only its own committed share** (`STATE(300+k)`), to its own key,
12
- * zeroing that share and returning the remainder to the pool. A holder cannot
13
- * pay itself more than its share, so one holder can never rug the others.
10
+ * - **Per-share unilateral exit.** After `@BLOCK GT PREVSTATE(102)` each holder
11
+ * may withdraw **only its own committed share** (`PREVSTATE(200+k)`, the spent
12
+ * coin's share), to its own key, zeroing that share in the successor
13
+ * (`STATE(200+k) EQ 0`) and returning the remainder to the pool. A holder
14
+ * cannot pay itself more than its share, so one holder can never rug the others.
14
15
  * - **Cooperative update.** Before the exit window the pool may only move by
15
16
  * `MULTISIG(operator + all holders)`, epoch-monotone (`ASSERT EPOCH GT
16
17
  * PREVSTATE(101)`), with the exit block immutable (`ASSERT SAMESTATE(102
@@ -5,13 +5,14 @@
5
5
  * The pool is an on-chain state output holding `totalCapacity`. An epoch's batch
6
6
  * root is committed as STATE(100), the epoch number in STATE(101), the absolute
7
7
  * exit-eligibility block in STATE(102), and each holder's committed share in
8
- * STATE(300+k).
8
+ * STATE(200+k).
9
9
  *
10
10
  * Custody (RFC-039 / CUSTODY-POLICY §2):
11
- * - **Per-share unilateral exit.** After `@BLOCK GT EXITBLOCK` each holder may
12
- * withdraw **only its own committed share** (`STATE(300+k)`), to its own key,
13
- * zeroing that share and returning the remainder to the pool. A holder cannot
14
- * pay itself more than its share, so one holder can never rug the others.
11
+ * - **Per-share unilateral exit.** After `@BLOCK GT PREVSTATE(102)` each holder
12
+ * may withdraw **only its own committed share** (`PREVSTATE(200+k)`, the spent
13
+ * coin's share), to its own key, zeroing that share in the successor
14
+ * (`STATE(200+k) EQ 0`) and returning the remainder to the pool. A holder
15
+ * cannot pay itself more than its share, so one holder can never rug the others.
15
16
  * - **Cooperative update.** Before the exit window the pool may only move by
16
17
  * `MULTISIG(operator + all holders)`, epoch-monotone (`ASSERT EPOCH GT
17
18
  * PREVSTATE(101)`), with the exit block immutable (`ASSERT SAMESTATE(102
@@ -49,12 +50,12 @@ function buildPoolScript(params) {
49
50
  }
50
51
  const lines = [
51
52
  'LET EPOCH=STATE(101)',
52
- 'LET EXITBLOCK=STATE(102)',
53
+ 'LET EXITBLOCK=PREVSTATE(102)',
53
54
  'IF @BLOCK GT EXITBLOCK THEN',
54
55
  ];
55
56
  holders.forEach((holder, k) => {
56
57
  const port = exports.POOL_SHARE_PORT_BASE + k;
57
- lines.push(` LET SHARE${k}=STATE(${port})`);
58
+ lines.push(` LET SHARE${k}=PREVSTATE(${port})`);
58
59
  lines.push(` IF SIGNEDBY(${holder}) THEN`);
59
60
  lines.push(` IF SHARE${k} GT 0 THEN`);
60
61
  lines.push(` ASSERT VERIFYOUT(0 ${holder} SHARE${k} @TOKENID FALSE)`);
@@ -4,13 +4,14 @@
4
4
  * The pool is an on-chain state output holding `totalCapacity`. An epoch's batch
5
5
  * root is committed as STATE(100), the epoch number in STATE(101), the absolute
6
6
  * exit-eligibility block in STATE(102), and each holder's committed share in
7
- * STATE(300+k).
7
+ * STATE(200+k).
8
8
  *
9
9
  * Custody (RFC-039 / CUSTODY-POLICY §2):
10
- * - **Per-share unilateral exit.** After `@BLOCK GT EXITBLOCK` each holder may
11
- * withdraw **only its own committed share** (`STATE(300+k)`), to its own key,
12
- * zeroing that share and returning the remainder to the pool. A holder cannot
13
- * pay itself more than its share, so one holder can never rug the others.
10
+ * - **Per-share unilateral exit.** After `@BLOCK GT PREVSTATE(102)` each holder
11
+ * may withdraw **only its own committed share** (`PREVSTATE(200+k)`, the spent
12
+ * coin's share), to its own key, zeroing that share in the successor
13
+ * (`STATE(200+k) EQ 0`) and returning the remainder to the pool. A holder
14
+ * cannot pay itself more than its share, so one holder can never rug the others.
14
15
  * - **Cooperative update.** Before the exit window the pool may only move by
15
16
  * `MULTISIG(operator + all holders)`, epoch-monotone (`ASSERT EPOCH GT
16
17
  * PREVSTATE(101)`), with the exit block immutable (`ASSERT SAMESTATE(102
@@ -4,13 +4,14 @@
4
4
  * The pool is an on-chain state output holding `totalCapacity`. An epoch's batch
5
5
  * root is committed as STATE(100), the epoch number in STATE(101), the absolute
6
6
  * exit-eligibility block in STATE(102), and each holder's committed share in
7
- * STATE(300+k).
7
+ * STATE(200+k).
8
8
  *
9
9
  * Custody (RFC-039 / CUSTODY-POLICY §2):
10
- * - **Per-share unilateral exit.** After `@BLOCK GT EXITBLOCK` each holder may
11
- * withdraw **only its own committed share** (`STATE(300+k)`), to its own key,
12
- * zeroing that share and returning the remainder to the pool. A holder cannot
13
- * pay itself more than its share, so one holder can never rug the others.
10
+ * - **Per-share unilateral exit.** After `@BLOCK GT PREVSTATE(102)` each holder
11
+ * may withdraw **only its own committed share** (`PREVSTATE(200+k)`, the spent
12
+ * coin's share), to its own key, zeroing that share in the successor
13
+ * (`STATE(200+k) EQ 0`) and returning the remainder to the pool. A holder
14
+ * cannot pay itself more than its share, so one holder can never rug the others.
14
15
  * - **Cooperative update.** Before the exit window the pool may only move by
15
16
  * `MULTISIG(operator + all holders)`, epoch-monotone (`ASSERT EPOCH GT
16
17
  * PREVSTATE(101)`), with the exit block immutable (`ASSERT SAMESTATE(102
@@ -43,12 +44,12 @@ export function buildPoolScript(params) {
43
44
  }
44
45
  const lines = [
45
46
  'LET EPOCH=STATE(101)',
46
- 'LET EXITBLOCK=STATE(102)',
47
+ 'LET EXITBLOCK=PREVSTATE(102)',
47
48
  'IF @BLOCK GT EXITBLOCK THEN',
48
49
  ];
49
50
  holders.forEach((holder, k) => {
50
51
  const port = POOL_SHARE_PORT_BASE + k;
51
- lines.push(` LET SHARE${k}=STATE(${port})`);
52
+ lines.push(` LET SHARE${k}=PREVSTATE(${port})`);
52
53
  lines.push(` IF SIGNEDBY(${holder}) THEN`);
53
54
  lines.push(` IF SHARE${k} GT 0 THEN`);
54
55
  lines.push(` ASSERT VERIFYOUT(0 ${holder} SHARE${k} @TOKENID FALSE)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-vtxo",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Virtual UTXO / payment-pool claim layer for Omnia — cash-like off-chain balance primitive for Totem Edge",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -25,10 +25,10 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@totemsdk/chain-provider": "^0.2.1",
28
+ "@totemsdk/core": "^1.3.0",
28
29
  "@totemsdk/omnia": "^2.0.1",
29
- "@totemsdk/txpow": "^1.0.2",
30
30
  "@totemsdk/storage": "^0.1.0",
31
- "@totemsdk/core": "^1.2.11",
31
+ "@totemsdk/txpow": "^1.0.2",
32
32
  "@totemsdk/wots-lease": "^1.0.1"
33
33
  },
34
34
  "devDependencies": {