@zeroxyz/sdk 0.11.0 → 0.12.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.
@@ -591,6 +591,7 @@ var pickSessionCloseAmount = (receipt, openTimeCumulative) => {
591
591
  if (receipt.metered === true) return fromReceipt;
592
592
  return fromReceipt > openTimeCumulative ? fromReceipt : openTimeCumulative;
593
593
  };
594
+ var isMeteredZeroReceipt = (receipt) => receipt?.metered === true && BigInt(receipt.acceptedCumulative) === 0n && BigInt(receipt.spent) === 0n;
594
595
  var raceWithSignal = (p, signal, client) => {
595
596
  if (!signal) return p;
596
597
  if (signal.aborted) {
@@ -1164,7 +1165,7 @@ var Payments = class {
1164
1165
  }
1165
1166
  const receipt = readSessionReceipt(response);
1166
1167
  let closeAmount = pickSessionCloseAmount(receipt, openTimeCumulative);
1167
- if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n) {
1168
+ if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n && !isMeteredZeroReceipt(receipt)) {
1168
1169
  closeAmount = channelEntry.cumulativeAmount;
1169
1170
  }
1170
1171
  const reconcileAmount = receipt && isUintString(receipt.acceptedCumulative) ? receipt.acceptedCumulative : closeAmount.toString();
@@ -1181,7 +1182,7 @@ var Payments = class {
1181
1182
  capturedAmount,
1182
1183
  cause
1183
1184
  });
1184
- if (closeAmount === 0n) {
1185
+ if (closeAmount === 0n && !isMeteredZeroReceipt(receipt)) {
1185
1186
  throw closeFailed(
1186
1187
  `Refusing to sign zero close credential for channel ${channelId} \u2014 neither receipt nor channelEntry produced a nonzero cumulativeAmount. Query escrow directly to recover; check logger for an earlier 'non-bigint cumulativeAmount' warning.`
1187
1188
  );
@@ -1952,7 +1953,7 @@ var clientFetch = async (client, url, opts = {}) => {
1952
1953
 
1953
1954
  // package.json
1954
1955
  var package_default = {
1955
- version: "0.11.0"};
1956
+ version: "0.12.0"};
1956
1957
 
1957
1958
  // src/version.ts
1958
1959
  var SDK_VERSION = package_default.version;
@@ -2842,6 +2843,12 @@ var capabilityResponseSchema = zod.z.object({
2842
2843
  bodySchema: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
2843
2844
  responseSchema: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
2844
2845
  example: zod.z.object({ request: zod.z.unknown(), response: zod.z.unknown() }).nullable(),
2846
+ // The bare, schema-validated request body to send — `.request` unwrapped
2847
+ // from the transcript envelope and checked against the current bodySchema.
2848
+ // Null when there's no usable example or it's stale vs the schema; `example`
2849
+ // is retained for the response sample. Optional for back-compat with older
2850
+ // servers that don't emit it.
2851
+ exampleRequest: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
2845
2852
  tags: zod.z.array(zod.z.string()).nullable(),
2846
2853
  exampleAgentPrompt: zod.z.string().nullable().optional(),
2847
2854
  whatItDoes: zod.z.string().nullable().optional(),
@@ -3828,5 +3835,5 @@ exports.normalizeTransportEnvelopeRequest = normalizeTransportEnvelopeRequest;
3828
3835
  exports.paymentHasAnchor = paymentHasAnchor;
3829
3836
  exports.tempoChainLabelFromId = tempoChainLabelFromId;
3830
3837
  exports.unwrapTransportEnvelope = unwrapTransportEnvelope;
3831
- //# sourceMappingURL=chunk-HKF4TRC6.cjs.map
3832
- //# sourceMappingURL=chunk-HKF4TRC6.cjs.map
3838
+ //# sourceMappingURL=chunk-O7424YAR.cjs.map
3839
+ //# sourceMappingURL=chunk-O7424YAR.cjs.map