@toon-protocol/client 0.27.0 → 0.28.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.
- package/dist/index.d.ts +2056 -2016
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1532,8 +1532,10 @@ function parseConnectorRouteTerms(body) {
|
|
|
1532
1532
|
);
|
|
1533
1533
|
}
|
|
1534
1534
|
const destination = typeof greeting.resource?.url === "string" ? greeting.resource.url : "";
|
|
1535
|
-
const
|
|
1536
|
-
const
|
|
1535
|
+
const rawExtra = option["extra"];
|
|
1536
|
+
const extra = typeof rawExtra === "object" && rawExtra !== null ? rawExtra : void 0;
|
|
1537
|
+
const extraForReads = extra ?? {};
|
|
1538
|
+
const rawSettlements = extraForReads["settlements"];
|
|
1537
1539
|
let settlements;
|
|
1538
1540
|
if (rawSettlements !== void 0) {
|
|
1539
1541
|
if (!Array.isArray(rawSettlements)) {
|
|
@@ -1544,12 +1546,13 @@ function parseConnectorRouteTerms(body) {
|
|
|
1544
1546
|
}
|
|
1545
1547
|
settlements = rawSettlements.map(parseChainSettlementEntry);
|
|
1546
1548
|
}
|
|
1547
|
-
const rawSettlement =
|
|
1549
|
+
const rawSettlement = extraForReads["settlement"];
|
|
1548
1550
|
if (rawSettlement === void 0) {
|
|
1549
1551
|
return {
|
|
1550
1552
|
destination,
|
|
1551
1553
|
price: option["amount"],
|
|
1552
|
-
...settlements ? { settlements } : {}
|
|
1554
|
+
...settlements ? { settlements } : {},
|
|
1555
|
+
...extra !== void 0 ? { extra } : {}
|
|
1553
1556
|
};
|
|
1554
1557
|
}
|
|
1555
1558
|
if (typeof rawSettlement !== "object" || rawSettlement === null) {
|
|
@@ -1564,7 +1567,8 @@ function parseConnectorRouteTerms(body) {
|
|
|
1564
1567
|
settlement: parseEvmSettlementTerms(
|
|
1565
1568
|
rawSettlement
|
|
1566
1569
|
),
|
|
1567
|
-
...settlements ? { settlements } : {}
|
|
1570
|
+
...settlements ? { settlements } : {},
|
|
1571
|
+
...extra !== void 0 ? { extra } : {}
|
|
1568
1572
|
};
|
|
1569
1573
|
}
|
|
1570
1574
|
|
|
@@ -7750,6 +7754,17 @@ var ToonClient = class {
|
|
|
7750
7754
|
* {@link getLastX402Terms} without re-issuing the probe by hand.
|
|
7751
7755
|
*/
|
|
7752
7756
|
lastX402Terms;
|
|
7757
|
+
/**
|
|
7758
|
+
* The most recently parsed `ConnectorRouteTerms`, from the last
|
|
7759
|
+
* `negotiateFromGreeting` call — the greeting parse that ordinary channel
|
|
7760
|
+
* bootstrap (`publishEvent`/`openChannel`/`adoptChannel`) already goes
|
|
7761
|
+
* through, with no separate `h402Fetch` probe needed (issue #509).
|
|
7762
|
+
* Captured whether or not the greeting carried settlement facts to
|
|
7763
|
+
* bootstrap from, so its `extra` bag (e.g. `session_lease_ttl_ms`) is
|
|
7764
|
+
* readable via {@link getLastConnectorRouteTerms} even when the bootstrap
|
|
7765
|
+
* declined to open a channel from that greeting.
|
|
7766
|
+
*/
|
|
7767
|
+
lastConnectorRouteTerms;
|
|
7753
7768
|
evmSigner;
|
|
7754
7769
|
solanaSigner;
|
|
7755
7770
|
/**
|
|
@@ -8324,6 +8339,21 @@ var ToonClient = class {
|
|
|
8324
8339
|
getLastX402Terms() {
|
|
8325
8340
|
return this.lastX402Terms;
|
|
8326
8341
|
}
|
|
8342
|
+
/**
|
|
8343
|
+
* The `ConnectorRouteTerms` from the most recent ordinary channel
|
|
8344
|
+
* bootstrap (`publishEvent`/`openChannel`/`adoptChannel`, via
|
|
8345
|
+
* `negotiateFromGreeting`) — including its `extra` bag (issue #509, e.g.
|
|
8346
|
+
* `extra.session_lease_ttl_ms`, connector#722) — or `undefined` if no
|
|
8347
|
+
* greeting has been parsed on this path yet. Unlike
|
|
8348
|
+
* {@link getLastX402Terms}, this populates from a client that only ever
|
|
8349
|
+
* calls `start()`/`publishEvent()`: `ConnectorEdgeClient.getRouteTerms` is
|
|
8350
|
+
* the parser the live path actually negotiates through, so a caller does
|
|
8351
|
+
* not need to issue a separate `h402Fetch` probe purely to read the lease
|
|
8352
|
+
* TTL.
|
|
8353
|
+
*/
|
|
8354
|
+
getLastConnectorRouteTerms() {
|
|
8355
|
+
return this.lastConnectorRouteTerms;
|
|
8356
|
+
}
|
|
8327
8357
|
/**
|
|
8328
8358
|
* Sends a raw swap ILP packet (Story 12.5) to a swap peer with an attached
|
|
8329
8359
|
* balance-proof claim. This is a lower-level surface than `publishEvent`:
|
|
@@ -9128,6 +9158,7 @@ var ToonClient = class {
|
|
|
9128
9158
|
}
|
|
9129
9159
|
try {
|
|
9130
9160
|
const terms = await this.connectorEdge.getRouteTerms(edge, destination);
|
|
9161
|
+
this.lastConnectorRouteTerms = terms ?? void 0;
|
|
9131
9162
|
const evmSettlement = terms?.settlement;
|
|
9132
9163
|
const solanaSettlement = terms?.settlements?.find(
|
|
9133
9164
|
(entry) => entry.kind === "solana"
|
|
@@ -11544,6 +11575,7 @@ export {
|
|
|
11544
11575
|
parseClaimStateResponse,
|
|
11545
11576
|
parseConnectorIdentity,
|
|
11546
11577
|
parseConnectorRoutePrice,
|
|
11578
|
+
parseConnectorRouteTerms,
|
|
11547
11579
|
parseEvmChainId2 as parseEvmChainId,
|
|
11548
11580
|
parseUiCoordinate,
|
|
11549
11581
|
parseX402Body,
|