@totemsdk/omnia-router 0.4.3 → 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.
@@ -34,6 +34,12 @@ export type PeelResult =
34
34
  onward?: string;
35
35
  };
36
36
  export interface RoutingEnvelopeCodec {
37
+ /**
38
+ * What a forwarder can learn from the envelope. `cleartext` means the path is
39
+ * visible to every hop it passes through, so a capability manifest must not
40
+ * claim path privacy while this codec is in use (RFC-035 §6.7).
41
+ */
42
+ readonly pathPrivacy: 'cleartext' | 'onion';
37
43
  /** Sender: build the envelope from the onward hops (already excludes the first hop). */
38
44
  build(hops: (RoutingHop | SwapHop)[]): string;
39
45
  /** Forwarder: peel one hop for `self`. */
@@ -21,12 +21,16 @@ exports.createCleartextRoutingCodec = createCleartextRoutingCodec;
21
21
  */
22
22
  function createCleartextRoutingCodec() {
23
23
  return {
24
+ pathPrivacy: 'cleartext',
24
25
  build(hops) {
25
26
  const wire = hops.map((h) => ({
26
27
  channelId: h.channelId,
27
28
  to: h.to,
28
29
  amount: h.amount.toString(),
29
30
  tokenId: h.tokenId,
31
+ // Without this the forwarder has no bound to apply and would have to
32
+ // reuse the incoming timeout, which can never be strictly earlier.
33
+ ...(h.timeoutBlock !== undefined ? { timeoutBlock: h.timeoutBlock.toString() } : {}),
30
34
  }));
31
35
  return JSON.stringify(wire);
32
36
  },
@@ -123,6 +123,12 @@ export interface RoutingHop {
123
123
  to: string;
124
124
  amount: bigint;
125
125
  tokenId: string;
126
+ /**
127
+ * Absolute timeout (block) for an outgoing HTLC on this hop (RFC-035). Each
128
+ * hop must be strictly earlier than its incoming HTLC so a failed route can
129
+ * unwind in order; the routing envelope carries it to the forwarder.
130
+ */
131
+ timeoutBlock?: bigint;
126
132
  /** Edge fee rate (per SCALE); populated by the routing engine. */
127
133
  feeRate?: bigint;
128
134
  /** Populated during payment execution */
package/dist/forward.d.ts CHANGED
@@ -34,6 +34,12 @@ export type PeelResult =
34
34
  onward?: string;
35
35
  };
36
36
  export interface RoutingEnvelopeCodec {
37
+ /**
38
+ * What a forwarder can learn from the envelope. `cleartext` means the path is
39
+ * visible to every hop it passes through, so a capability manifest must not
40
+ * claim path privacy while this codec is in use (RFC-035 §6.7).
41
+ */
42
+ readonly pathPrivacy: 'cleartext' | 'onion';
37
43
  /** Sender: build the envelope from the onward hops (already excludes the first hop). */
38
44
  build(hops: (RoutingHop | SwapHop)[]): string;
39
45
  /** Forwarder: peel one hop for `self`. */
package/dist/forward.js CHANGED
@@ -18,12 +18,16 @@
18
18
  */
19
19
  export function createCleartextRoutingCodec() {
20
20
  return {
21
+ pathPrivacy: 'cleartext',
21
22
  build(hops) {
22
23
  const wire = hops.map((h) => ({
23
24
  channelId: h.channelId,
24
25
  to: h.to,
25
26
  amount: h.amount.toString(),
26
27
  tokenId: h.tokenId,
28
+ // Without this the forwarder has no bound to apply and would have to
29
+ // reuse the incoming timeout, which can never be strictly earlier.
30
+ ...(h.timeoutBlock !== undefined ? { timeoutBlock: h.timeoutBlock.toString() } : {}),
27
31
  }));
28
32
  return JSON.stringify(wire);
29
33
  },
package/dist/types.d.ts CHANGED
@@ -123,6 +123,12 @@ export interface RoutingHop {
123
123
  to: string;
124
124
  amount: bigint;
125
125
  tokenId: string;
126
+ /**
127
+ * Absolute timeout (block) for an outgoing HTLC on this hop (RFC-035). Each
128
+ * hop must be strictly earlier than its incoming HTLC so a failed route can
129
+ * unwind in order; the routing envelope carries it to the forwarder.
130
+ */
131
+ timeoutBlock?: bigint;
126
132
  /** Edge fee rate (per SCALE); populated by the routing engine. */
127
133
  feeRate?: bigint;
128
134
  /** Populated during payment execution */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-router",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Multi-hop payment routing over Omnia channels — single-token and cross-token paths",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@totemsdk/core": "^1.6.1",
27
- "@totemsdk/storage": "^0.2.2"
27
+ "@totemsdk/storage": "^0.2.3"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@totemsdk/omnia": "^3.0.0"