@totemsdk/omnia-factory 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,13 @@ function buildFactoryScript(participants, _options = {}) {
82
82
  lines.push(` ASSERT STATE(${exports.FACTORY_BALANCE_PORT_BASE + j}) EQ PREVSTATE(${exports.FACTORY_BALANCE_PORT_BASE + j})`);
83
83
  }
84
84
  lines.push(` ASSERT STATE(${port}) EQ 0`);
85
- lines.push(` RETURN VERIFYOUT(@INPUT @ADDRESS @AMOUNT SUB SHARE${k} @TOKENID TRUE)`);
85
+ // Whole-share guard (mirrors the VTXO script): when the withdrawing party's
86
+ // share is the entire output there is no remainder, so a 0-amount output is
87
+ // never required.
88
+ lines.push(` IF @AMOUNT GT SHARE${k} THEN`);
89
+ lines.push(` RETURN VERIFYOUT(@INPUT @ADDRESS @AMOUNT SUB SHARE${k} @TOKENID TRUE)`);
90
+ lines.push(' ENDIF');
91
+ lines.push(' RETURN TRUE');
86
92
  lines.push(' ENDIF');
87
93
  lines.push(' ENDIF');
88
94
  });
package/dist/script.js CHANGED
@@ -73,7 +73,13 @@ export function buildFactoryScript(participants, _options = {}) {
73
73
  lines.push(` ASSERT STATE(${FACTORY_BALANCE_PORT_BASE + j}) EQ PREVSTATE(${FACTORY_BALANCE_PORT_BASE + j})`);
74
74
  }
75
75
  lines.push(` ASSERT STATE(${port}) EQ 0`);
76
- lines.push(` RETURN VERIFYOUT(@INPUT @ADDRESS @AMOUNT SUB SHARE${k} @TOKENID TRUE)`);
76
+ // Whole-share guard (mirrors the VTXO script): when the withdrawing party's
77
+ // share is the entire output there is no remainder, so a 0-amount output is
78
+ // never required.
79
+ lines.push(` IF @AMOUNT GT SHARE${k} THEN`);
80
+ lines.push(` RETURN VERIFYOUT(@INPUT @ADDRESS @AMOUNT SUB SHARE${k} @TOKENID TRUE)`);
81
+ lines.push(' ENDIF');
82
+ lines.push(' RETURN TRUE');
77
83
  lines.push(' ENDIF');
78
84
  lines.push(' ENDIF');
79
85
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-factory",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Channel factory layer for Omnia — N-of-N MULTISIG funding, virtual channel management, and factory settlement",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -25,9 +25,9 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@totemsdk/omnia": "^2.0.1",
28
+ "@totemsdk/tx-builder": "^0.2.1",
28
29
  "@totemsdk/core": "^1.2.11",
29
30
  "@totemsdk/wots-lease": "^1.0.1",
30
- "@totemsdk/tx-builder": "^0.2.1",
31
31
  "@totemsdk/txpow": "^1.0.2",
32
32
  "@totemsdk/chain-provider": "^0.2.1",
33
33
  "@totemsdk/storage": "^0.1.0"