@dvmkit/sdk 0.1.3-rc.7 → 0.1.5-rc.7

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.
Files changed (38) hide show
  1. package/README.md +116 -9
  2. package/dist/{chunk-ANFX5HEG.js → chunk-2UUXIIOC.js} +43 -13
  3. package/dist/{chunk-C6JHBLMW.js → chunk-BIP6G74V.js} +1 -1
  4. package/dist/{chunk-EPNDZ5DH.js → chunk-CEOAHV2I.js} +0 -30
  5. package/dist/{chunk-TSWKITGR.js → chunk-CGKZDODG.js} +8 -1
  6. package/dist/{chunk-YDIYXGYL.js → chunk-E4EVGPDX.js} +16 -9
  7. package/dist/{chunk-NFRM5QYP.js → chunk-EVBK675R.js} +5 -0
  8. package/dist/{chunk-DBCLBYHP.js → chunk-KVEHHC7W.js} +11 -1
  9. package/dist/{chunk-2K7E3N2D.js → chunk-KXCKFIJI.js} +77 -14
  10. package/dist/{chunk-3ZHMQCYP.js → chunk-NJFOV36R.js} +663 -235
  11. package/dist/{chunk-5GFED3GJ.js → chunk-NPIW5VR5.js} +40 -6
  12. package/dist/{chunk-LLXV32HA.js → chunk-SSSZUVWM.js} +96 -3
  13. package/dist/{chunk-7AKBC4PW.js → chunk-TQWGQCNV.js} +1 -1
  14. package/dist/{chunk-4B56DEEV.js → chunk-U6M3ATSG.js} +7 -1
  15. package/dist/{credit-menu-C7zAJElJ.d.ts → credit-menu-B-e3vZGo.d.ts} +136 -21
  16. package/dist/{fx-BF_SG2i0.d.ts → fx-CGRJE8rm.d.ts} +1 -1
  17. package/dist/index.d.ts +5 -5
  18. package/dist/internal/caller.d.ts +54 -22
  19. package/dist/internal/caller.js +171 -38
  20. package/dist/internal/index.js +1 -1
  21. package/dist/internal/server.d.ts +8 -8
  22. package/dist/internal/server.js +7 -7
  23. package/dist/{job-store-Bn23V3QU.d.ts → job-store-Cnlv9pOx.d.ts} +16 -1
  24. package/dist/{lightning-backend-C04nH94l.d.ts → lightning-backend-KvQM0YHi.d.ts} +1 -1
  25. package/dist/{memory-credit-ledger-OP24Z2KO.js → memory-credit-ledger-MNUOTQO5.js} +1 -1
  26. package/dist/{mpp-setup-MOBWGTWJ.js → mpp-setup-SPBOF5AM.js} +11 -1
  27. package/dist/{postgres-job-store-TAONYLIF.js → postgres-job-store-3RAXMNSY.js} +1 -1
  28. package/dist/{revenue-reporter-XXSU5KVB.js → revenue-reporter-ASZ7SHHH.js} +1 -1
  29. package/dist/server/index.d.ts +26 -13
  30. package/dist/server/index.js +219 -55
  31. package/dist/{step-cache-3cT4Shk0.d.ts → step-cache-CwM_Q8rK.d.ts} +149 -3
  32. package/dist/{tempo-lifecycle-SQL3KLEZ.js → tempo-lifecycle-DFIXQ54Q.js} +3 -3
  33. package/dist/{tempo-wallet-QOLEIPCV.js → tempo-wallet-4QKSV65O.js} +10 -2
  34. package/dist/testing/index.d.ts +13 -3
  35. package/dist/testing/index.js +31 -2
  36. package/dist/{usd-BnuXoFl5.d.ts → usd-nYZSb7KQ.d.ts} +1 -1
  37. package/dist/{x402-T2C5MX3T.js → x402-5H27DCBE.js} +2 -2
  38. package/package.json +6 -4
@@ -55,19 +55,23 @@ import {
55
55
  withIdentitiesLock,
56
56
  withTempoChannelLock,
57
57
  withholdsTempoCreditSession
58
- } from "../chunk-7AKBC4PW.js";
58
+ } from "../chunk-TQWGQCNV.js";
59
59
  import {
60
60
  TEMPO_CHAIN_ID,
61
+ TEMPO_MODERATO_CHAIN_ID,
62
+ TEMPO_MODERATO_RPC,
63
+ TEMPO_PATH_USD_MODERATO,
61
64
  connectedTempoAccount,
62
65
  deriveTempoAddress,
63
66
  generateTempoKey,
64
67
  getTempoUsdcBalance,
65
68
  resolveTempoAsset,
69
+ resolveTempoNetwork,
66
70
  tempoBalanceCheckHint,
67
71
  tempoTokenReference,
68
72
  tempoWrongAssetHint,
69
73
  tryResolveTempoAsset
70
- } from "../chunk-ANFX5HEG.js";
74
+ } from "../chunk-2UUXIIOC.js";
71
75
  import {
72
76
  DvmX402ChannelStorage,
73
77
  X402_EXACT_AUTHORIZATION_TTL_SECONDS,
@@ -112,7 +116,7 @@ import {
112
116
  x402PendingStale,
113
117
  x402PendingUnsettled,
114
118
  x402WrongAssetHint
115
- } from "../chunk-C6JHBLMW.js";
119
+ } from "../chunk-BIP6G74V.js";
116
120
  import {
117
121
  RAIL_FLAGS,
118
122
  SUPPORTED_PROTOCOL_VERSION,
@@ -177,7 +181,7 @@ import {
177
181
  retireConfigBackup,
178
182
  rollbackConfig,
179
183
  updateConfig
180
- } from "../chunk-TSWKITGR.js";
184
+ } from "../chunk-CGKZDODG.js";
181
185
  import {
182
186
  CAPABILITY_NAME_RE
183
187
  } from "../chunk-BTZY7VPH.js";
@@ -185,7 +189,6 @@ import {
185
189
  DbTransport,
186
190
  NwcBackend,
187
191
  NwcError,
188
- RECOMMENDED_MINTS,
189
192
  SPANS_INSERTED_CHANNEL,
190
193
  SpanWriter,
191
194
  X402EnvValidationError,
@@ -206,7 +209,7 @@ import {
206
209
  sha256hex,
207
210
  validateX402Env,
208
211
  withNwcPool
209
- } from "../chunk-EPNDZ5DH.js";
212
+ } from "../chunk-CEOAHV2I.js";
210
213
  import {
211
214
  MemoryKVStore
212
215
  } from "../chunk-RW5LP57K.js";
@@ -216,6 +219,7 @@ import {
216
219
  PRIVKEY_HEX_RE,
217
220
  PersistentCounterSource,
218
221
  RECENT_SPENDS_CAP,
222
+ RECOMMENDED_MINTS,
219
223
  TEMPO_SESSION_UPDATED_REASON,
220
224
  WALLET_VERSION,
221
225
  X402_BATCH_CHANNEL_ABI,
@@ -285,7 +289,7 @@ import {
285
289
  withWalletLock,
286
290
  writeAgentMnemonic,
287
291
  writeIdentity
288
- } from "../chunk-2K7E3N2D.js";
292
+ } from "../chunk-KXCKFIJI.js";
289
293
  import {
290
294
  X402_BATCH_SETTLEMENT_SCHEME,
291
295
  X402_DEFAULT_FACILITATOR,
@@ -394,7 +398,7 @@ import {
394
398
  randomTraceId,
395
399
  setEmitter,
396
400
  withTraceContext
397
- } from "../chunk-YDIYXGYL.js";
401
+ } from "../chunk-E4EVGPDX.js";
398
402
  import "../chunk-66HGCPBU.js";
399
403
  import {
400
404
  redactUrl,
@@ -2469,6 +2473,80 @@ function normalizeCap(raw2) {
2469
2473
 
2470
2474
  // src/lib/wallet-agent/fund.ts
2471
2475
  import { MintQuoteState } from "@cashu/cashu-ts";
2476
+
2477
+ // src/lib/wallet-agent/mint-quote-retry.ts
2478
+ var MINT_QUOTE_RETRY_BASE_DELAY_MS = 2e3;
2479
+ var MINT_QUOTE_RETRY_MAX_DELAY_MS = 6e4;
2480
+ var MINT_QUOTE_RETRY_DECAY_FACTOR = 4;
2481
+ function createMintQuoteRetryState() {
2482
+ return { backoffMs: 0 };
2483
+ }
2484
+ async function retryMintQuoteOperation(operation, opts) {
2485
+ const now = opts.now ?? (() => Date.now());
2486
+ const sleep2 = opts.sleep ?? defaultSleep;
2487
+ const state = opts.state ?? createMintQuoteRetryState();
2488
+ for (; ; ) {
2489
+ try {
2490
+ return await operation();
2491
+ } catch (err) {
2492
+ const cause = classifyMintQuoteError(err);
2493
+ if (cause === void 0) throw err;
2494
+ const failedAt = now();
2495
+ if (state.lastRetryAt !== void 0 && failedAt - state.lastRetryAt >= state.backoffMs * MINT_QUOTE_RETRY_DECAY_FACTOR) {
2496
+ state.backoffMs = 0;
2497
+ }
2498
+ const grownDelay = Math.min(
2499
+ Math.max(state.backoffMs * 2, MINT_QUOTE_RETRY_BASE_DELAY_MS),
2500
+ MINT_QUOTE_RETRY_MAX_DELAY_MS
2501
+ );
2502
+ const retryAfterMs = mintRetryAfterMs(err);
2503
+ const delayMs = Math.min(
2504
+ Math.max(retryAfterMs ?? grownDelay, MINT_QUOTE_RETRY_BASE_DELAY_MS),
2505
+ MINT_QUOTE_RETRY_MAX_DELAY_MS
2506
+ );
2507
+ const remainingMs = Math.max(0, opts.deadlineMs - failedAt);
2508
+ state.backoffMs = delayMs;
2509
+ if (remainingMs > 0) {
2510
+ await sleep2(Math.min(delayMs, remainingMs));
2511
+ state.lastRetryAt = now();
2512
+ }
2513
+ if (now() >= opts.deadlineMs) {
2514
+ throw mintQuoteUnavailableError(opts.quoteId, cause, delayMs);
2515
+ }
2516
+ }
2517
+ }
2518
+ }
2519
+ function classifyMintQuoteError(err) {
2520
+ if (typeof err !== "object" || err === null) return void 0;
2521
+ const { name, status, code } = err;
2522
+ if (name === "RateLimitError" || status === 429) return "rate_limited";
2523
+ if (typeof status === "number" && status >= 500) return "mint_server_error";
2524
+ if (name === "NetworkError" || code === "cashu_mint_unreachable") return "mint_unreachable";
2525
+ return void 0;
2526
+ }
2527
+ function mintRetryAfterMs(err) {
2528
+ if (typeof err !== "object" || err === null) return void 0;
2529
+ const value = err.retryAfterMs;
2530
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
2531
+ }
2532
+ function mintQuoteUnavailableError(quoteId, cause, retryAfterMs) {
2533
+ return new DvmError(
2534
+ "mint_quote_poll_unavailable",
2535
+ `The mint did not answer status checks for quote ${quoteId} before the wait ended.`,
2536
+ "The quote may still settle. Reconcile the existing quote later instead of starting another payment.",
2537
+ {
2538
+ quote_id: quoteId,
2539
+ cause,
2540
+ retryable: true,
2541
+ retry_after_ms: retryAfterMs
2542
+ }
2543
+ );
2544
+ }
2545
+ function defaultSleep(ms) {
2546
+ return new Promise((resolve) => setTimeout(resolve, ms));
2547
+ }
2548
+
2549
+ // src/lib/wallet-agent/fund.ts
2472
2550
  var DEFAULT_POLL_INTERVAL_MS = 2e3;
2473
2551
  var DEFAULT_TIMEOUT_SEC = 600;
2474
2552
  async function fundAgentWallet(amountSats, opts) {
@@ -2494,7 +2572,8 @@ async function fundAgentWallet(amountSats, opts) {
2494
2572
  mint: opts.mintUrl,
2495
2573
  quote_id: quote.quote,
2496
2574
  amount_sats: sats,
2497
- requested_at: (/* @__PURE__ */ new Date()).toISOString()
2575
+ requested_at: (/* @__PURE__ */ new Date()).toISOString(),
2576
+ ...quote.expiry === null ? {} : { expires_at: quote.expiry }
2498
2577
  };
2499
2578
  await withWalletLock(() => {
2500
2579
  const fresh = loadAgentWallet() ?? initial;
@@ -2605,23 +2684,35 @@ function maxKeysetDenomination(cashuWallet) {
2605
2684
  }
2606
2685
  async function pollUntilPaidOrTimeout(cashuWallet, quoteId, opts) {
2607
2686
  const now = opts.now ?? (() => Date.now());
2608
- const sleep2 = opts.sleep ?? defaultSleep;
2687
+ const sleep2 = opts.sleep ?? defaultSleep2;
2609
2688
  const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
2610
2689
  const timeoutMs = opts.timeoutMs ?? fundTimeoutMs();
2611
2690
  const start = now();
2691
+ const deadline = start + timeoutMs;
2692
+ const retryState = createMintQuoteRetryState();
2612
2693
  let lastState = MintQuoteState.UNPAID;
2613
- while (now() - start < timeoutMs) {
2614
- const checked = await cashuWallet.checkMintQuoteBolt11(quoteId);
2694
+ while (now() < deadline) {
2695
+ const checked = await retryMintQuoteOperation(
2696
+ () => cashuWallet.checkMintQuoteBolt11(quoteId),
2697
+ {
2698
+ deadlineMs: deadline,
2699
+ quoteId,
2700
+ state: retryState,
2701
+ now,
2702
+ sleep: sleep2
2703
+ }
2704
+ );
2615
2705
  lastState = checked.state;
2616
2706
  if (opts.onPoll) opts.onPoll(lastState, now() - start);
2617
2707
  if (lastState === MintQuoteState.PAID || lastState === MintQuoteState.ISSUED) {
2618
2708
  return lastState;
2619
2709
  }
2620
- await sleep2(intervalMs);
2710
+ const remainingMs = deadline - now();
2711
+ if (remainingMs > 0) await sleep2(Math.min(intervalMs, remainingMs));
2621
2712
  }
2622
2713
  return lastState;
2623
2714
  }
2624
- function defaultSleep(ms) {
2715
+ function defaultSleep2(ms) {
2625
2716
  return new Promise((resolve) => setTimeout(resolve, ms));
2626
2717
  }
2627
2718
 
@@ -2908,6 +2999,7 @@ async function receiveToAgentWallet(token, opts = {}) {
2908
2999
 
2909
3000
  // src/lib/wallet-agent/recovery.ts
2910
3001
  import { MintQuoteState as MintQuoteState2 } from "@cashu/cashu-ts";
3002
+ var DEFAULT_SWEEP_QUOTE_RETRY_TIMEOUT_MS = 1e4;
2911
3003
  async function sweepPendingMints(opts = {}) {
2912
3004
  const wallet = loadAgentWallet();
2913
3005
  if (!wallet || wallet.pending_mints.length === 0) {
@@ -2916,9 +3008,14 @@ async function sweepPendingMints(opts = {}) {
2916
3008
  const now = opts.now ?? (() => Date.now());
2917
3009
  const expirationMs = opts.expirationMs ?? fundTimeoutMs();
2918
3010
  const getWalletForMint = opts.getWalletForMint ?? getWallet;
3011
+ const quoteRetryTimeoutMs = opts.quoteRetryTimeoutMs ?? DEFAULT_SWEEP_QUOTE_RETRY_TIMEOUT_MS;
2919
3012
  const outcomes = [];
2920
3013
  for (const entry of wallet.pending_mints) {
2921
- const outcome = await processEntry(wallet, entry, now(), expirationMs, getWalletForMint);
3014
+ const outcome = await processEntry(wallet, entry, now(), expirationMs, getWalletForMint, {
3015
+ now,
3016
+ sleep: opts.sleep,
3017
+ timeoutMs: quoteRetryTimeoutMs
3018
+ });
2922
3019
  outcomes.push(outcome);
2923
3020
  }
2924
3021
  if (outcomes.some(
@@ -2941,21 +3038,27 @@ async function sweepPendingMints(opts = {}) {
2941
3038
  errors: outcomes.filter((o) => o.kind === "error").map((o) => ({ quote_id: o.entry.quote_id, error: o.error }))
2942
3039
  };
2943
3040
  }
2944
- async function processEntry(wallet, entry, nowMs, expirationMs, getWalletForMint) {
3041
+ async function processEntry(wallet, entry, nowMs, expirationMs, getWalletForMint, retry) {
2945
3042
  let cashuWallet;
2946
- try {
2947
- cashuWallet = await getWalletForMint(entry.mint);
2948
- } catch (err) {
2949
- return { kind: "error", entry, error: errorMessage2(err) };
2950
- }
2951
- let state;
2952
3043
  let quoteResponse;
2953
3044
  try {
2954
- quoteResponse = await cashuWallet.checkMintQuoteBolt11(entry.quote_id);
2955
- state = quoteResponse.state;
3045
+ ({ cashuWallet, quoteResponse } = await retryMintQuoteOperation(
3046
+ async () => {
3047
+ const candidate = await getWalletForMint(entry.mint);
3048
+ const quote = await candidate.checkMintQuoteBolt11(entry.quote_id);
3049
+ return { cashuWallet: candidate, quoteResponse: quote };
3050
+ },
3051
+ {
3052
+ deadlineMs: retry.now() + retry.timeoutMs,
3053
+ quoteId: entry.quote_id,
3054
+ now: retry.now,
3055
+ sleep: retry.sleep
3056
+ }
3057
+ ));
2956
3058
  } catch (err) {
2957
3059
  return { kind: "error", entry, error: errorMessage2(err) };
2958
3060
  }
3061
+ const state = quoteResponse.state;
2959
3062
  if (state === MintQuoteState2.ISSUED) {
2960
3063
  if (!entry.minting) {
2961
3064
  return { kind: "already_issued", entry };
@@ -3009,6 +3112,13 @@ async function processEntry(wallet, entry, nowMs, expirationMs, getWalletForMint
3009
3112
  return { kind: "error", entry, error: errorMessage2(err) };
3010
3113
  }
3011
3114
  }
3115
+ const quoteExpiry = entry.expires_at;
3116
+ if (quoteExpiry !== void 0 && Number.isFinite(quoteExpiry)) {
3117
+ if (nowMs > quoteExpiry * 1e3) {
3118
+ return { kind: "expired", entry };
3119
+ }
3120
+ return { kind: "still_pending", entry };
3121
+ }
3012
3122
  const requestedAtMs = Date.parse(entry.requested_at);
3013
3123
  const ageMs2 = Number.isFinite(requestedAtMs) ? nowMs - requestedAtMs : Infinity;
3014
3124
  if (ageMs2 > expirationMs) {
@@ -3038,6 +3148,7 @@ function errorMessage2(err) {
3038
3148
  }
3039
3149
 
3040
3150
  // src/lib/wallet-agent/recovery-melt.ts
3151
+ var DEFAULT_SWEEP_QUOTE_RETRY_TIMEOUT_MS2 = 1e4;
3041
3152
  async function sweepPendingMelts(opts = {}) {
3042
3153
  const wallet = loadAgentWallet();
3043
3154
  if (!wallet || wallet.pending_melts.length === 0) {
@@ -3046,9 +3157,16 @@ async function sweepPendingMelts(opts = {}) {
3046
3157
  const now = opts.now ?? (() => Date.now());
3047
3158
  const abandonAfterMs = opts.abandonAfterMs ?? meltInFlightTimeoutSeconds() * 1e3;
3048
3159
  const getWalletForMint = opts.getWalletForMint ?? getWallet;
3160
+ const quoteRetryTimeoutMs = opts.quoteRetryTimeoutMs ?? DEFAULT_SWEEP_QUOTE_RETRY_TIMEOUT_MS2;
3049
3161
  const outcomes = [];
3050
3162
  for (const entry of wallet.pending_melts) {
3051
- outcomes.push(await processEntry2(wallet, entry, now(), abandonAfterMs, getWalletForMint));
3163
+ outcomes.push(
3164
+ await processEntry2(wallet, entry, now(), abandonAfterMs, getWalletForMint, {
3165
+ now,
3166
+ sleep: opts.sleep,
3167
+ timeoutMs: quoteRetryTimeoutMs
3168
+ })
3169
+ );
3052
3170
  }
3053
3171
  if (outcomes.some((o) => o.kind === "settled" || o.kind === "reverted")) {
3054
3172
  await withWalletLock(() => {
@@ -3066,17 +3184,23 @@ async function sweepPendingMelts(opts = {}) {
3066
3184
  errors: outcomes.filter((o) => o.kind === "error").map((o) => ({ quote_id: o.entry.quote_id, error: o.error }))
3067
3185
  };
3068
3186
  }
3069
- async function processEntry2(wallet, entry, nowMs, abandonAfterMs, getWalletForMint) {
3187
+ async function processEntry2(wallet, entry, nowMs, abandonAfterMs, getWalletForMint, retry) {
3070
3188
  let cashuWallet;
3071
- try {
3072
- cashuWallet = await getWalletForMint(entry.mint);
3073
- } catch (err) {
3074
- return { kind: "error", entry, error: errorMessage3(err) };
3075
- }
3076
3189
  let state;
3077
3190
  try {
3078
- const quote = await cashuWallet.checkMeltQuoteBolt11(entry.quote_id);
3079
- state = quote.state;
3191
+ ({ cashuWallet, state } = await retryMintQuoteOperation(
3192
+ async () => {
3193
+ const candidate = await getWalletForMint(entry.mint);
3194
+ const quote = await candidate.checkMeltQuoteBolt11(entry.quote_id);
3195
+ return { cashuWallet: candidate, state: quote.state };
3196
+ },
3197
+ {
3198
+ deadlineMs: retry.now() + retry.timeoutMs,
3199
+ quoteId: entry.quote_id,
3200
+ now: retry.now,
3201
+ sleep: retry.sleep
3202
+ }
3203
+ ));
3080
3204
  } catch (err) {
3081
3205
  return { kind: "error", entry, error: errorMessage3(err) };
3082
3206
  }
@@ -5415,7 +5539,8 @@ async function reserveAgentWallet(amountSats, opts) {
5415
5539
  mint: opts.mintUrl,
5416
5540
  quote_id: quote.quote,
5417
5541
  amount_sats: sats,
5418
- requested_at: (/* @__PURE__ */ new Date()).toISOString()
5542
+ requested_at: (/* @__PURE__ */ new Date()).toISOString(),
5543
+ ...quote.expiry === null ? {} : { expires_at: quote.expiry }
5419
5544
  };
5420
5545
  await withWalletLock(() => {
5421
5546
  const fresh = loadAgentWallet() ?? initial;
@@ -9295,7 +9420,7 @@ async function probeX402(x402, timeoutMs) {
9295
9420
  let network;
9296
9421
  let address;
9297
9422
  try {
9298
- const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-T2C5MX3T.js");
9423
+ const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-5H27DCBE.js");
9299
9424
  const wallet = loadX402Wallet2();
9300
9425
  if (!wallet) {
9301
9426
  const storedKey = x402.privateKey;
@@ -9353,7 +9478,7 @@ async function probeMpp(mpp, timeoutMs) {
9353
9478
  if (!mpp) return null;
9354
9479
  if (mpp.method === "tempo") {
9355
9480
  try {
9356
- const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, TEMPO_CHAIN_ID: TEMPO_CHAIN_ID2 } = await import("../tempo-wallet-QOLEIPCV.js");
9481
+ const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, resolveTempoNetwork: resolveTempoNetwork2 } = await import("../tempo-wallet-4QKSV65O.js");
9357
9482
  const account = await connectedTempoAccount2();
9358
9483
  if (!account) {
9359
9484
  return {
@@ -9378,7 +9503,7 @@ async function probeMpp(mpp, timeoutMs) {
9378
9503
  // against — a zero here only means "none of *this* token".
9379
9504
  details: {
9380
9505
  address: account.address,
9381
- chain_id: TEMPO_CHAIN_ID2,
9506
+ chain_id: balance.chainId,
9382
9507
  token: balance.tokenAddress,
9383
9508
  // internal-review: as on x402 above — which endpoint the number came from.
9384
9509
  ...rpcDetails(balance.rpcUrlRedacted, balance.rpcSource)
@@ -9390,7 +9515,11 @@ async function probeMpp(mpp, timeoutMs) {
9390
9515
  configured: true,
9391
9516
  reachable: false,
9392
9517
  balanceUsdc: void 0,
9393
- details: { address: account.address, chain_id: TEMPO_CHAIN_ID2, balance_unknown: true },
9518
+ details: {
9519
+ address: account.address,
9520
+ chain_id: resolveTempoNetwork2(account.network ?? "mainnet").chainId,
9521
+ balance_unknown: true
9522
+ },
9394
9523
  error: classifyError("tempo_unreachable", err)
9395
9524
  };
9396
9525
  }
@@ -9497,6 +9626,9 @@ export {
9497
9626
  TEMPO_CHAIN_ID,
9498
9627
  TEMPO_CHANNELS_FILE,
9499
9628
  TEMPO_EXIT_KEY_MISSING_HINT,
9629
+ TEMPO_MODERATO_CHAIN_ID,
9630
+ TEMPO_MODERATO_RPC,
9631
+ TEMPO_PATH_USD_MODERATO,
9500
9632
  WALLET_FILE,
9501
9633
  WALLET_VERSION,
9502
9634
  X402EnvValidationError,
@@ -9840,6 +9972,7 @@ export {
9840
9972
  resolveRpcOverride,
9841
9973
  resolveSigningIdentity,
9842
9974
  resolveTempoAsset,
9975
+ resolveTempoNetwork,
9843
9976
  resolveX402Asset,
9844
9977
  resolveX402ChannelRpc,
9845
9978
  restoreProofsFromOutputs,
@@ -1,2 +1,2 @@
1
- export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, BTC_RATE_FILE, BUDGET_FILE, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, CREDIT_POSTURES, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, DvmError, DvmX402ChannelStorage, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, FX_CACHE_TTL_MS, FX_RETRY_COUNT, IDENTITIES_FILE, IDENTITIES_VERSION, InvalidUsdPriceError, JOBS_FILE, MESSAGES_DIR, MemoryKVStore, NWC_FUNDING_FLOAT_ROLE, NwcBackend, NwcError, PAIRINGS_DIR, PRIVKEY_HEX_RE, PersistentCounterSource, RAIL_FLAGS, RAIL_REFUNDABLE, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, SpanWriter, StepCache, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_EXIT_KEY_MISSING_HINT, WALLET_FILE, WALLET_VERSION, X402EnvValidationError, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_DEFAULT_NETWORK, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, X402_V1_VERSION, X402_VERSION, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, addPayment, advanceTempoChannelExit, amountBoundsVerdict, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertNutSupport, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildAttestation, buildCompletionHintFields, buildDisplayMintInventory, buildPaymentRequiredV2, buildPaymentRequirements, buildPolicy, buildTempoCredential, builderLockPath, caip2ToX402Network, canReplaceExpiredX402Deposit, canSwap, canonicalRequestPath, canonicaliseForSigning, canonicalize, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, chainIdFromCaip2, checkMeltQuoteState, checkMintHealth, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeResultHash, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, decodePayment, decodePaymentRequiredHeader, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, encodePayment, encodePaymentRequiredHeader, encodeSettleResponseHeader, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, exactEvmAuthorization, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateIdentity, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getWallet, getX402Balance, hashCapabilities, hashedCanonicalDvmId, identitiesFileExists, info, initLoggers, insertSpanBatch, isAbortError, isArtifactMessage, isCancelMessage, isCompleteMessage, isCreditFundRail, isCreditFundingMode, isCreditPosture, isDrainReceipt, isFeedbackPosture, isFundingReceipt, isPaymentRailKey, isPaymentRequestMessage, isPromptMessage, isPublicRequestId, isResumable, isSignedJobReceipt, isStablecoinFundRail, isTerminalJobStatus, isTextMessage, isValidEvmPrivateKey, isWorkingMessage, issueRouterFeedbackClaim, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadIdentitySecret, loadImplicitCredits, loadJob, loadLedger, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, parseUsdPrice, payInvoiceReconciling, payViaFloat, paymentRailLabel, paymentRequiredV2FromV1, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, railLabelAtSentenceStart, randomTraceId, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signAttestation, signDrainReceipt, signDvmRequestData, signFundingReceipt, signReceipt, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, toLockPubkey, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcContractByCaip2, usdcContractFor, usdcDomainNameFor, usdcDomainVersionFor, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyAttestation, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceipt, verifyDrainReceiptChain, verifyFundingReceipt, verifyFundingReceiptChain, verifyJobReceipt, verifyReceipt, verifyRouterFeedbackClaim, walletExists, warmFxSnapshot, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, writeIdentity, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402NetworkToCaip2, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint } from "./caller.js";
1
+ export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, BTC_RATE_FILE, BUDGET_FILE, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, CREDIT_POSTURES, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, DvmError, DvmX402ChannelStorage, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, FX_CACHE_TTL_MS, FX_RETRY_COUNT, IDENTITIES_FILE, IDENTITIES_VERSION, InvalidUsdPriceError, JOBS_FILE, MESSAGES_DIR, MemoryKVStore, NWC_FUNDING_FLOAT_ROLE, NwcBackend, NwcError, PAIRINGS_DIR, PRIVKEY_HEX_RE, PersistentCounterSource, RAIL_FLAGS, RAIL_REFUNDABLE, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, SpanWriter, StepCache, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_EXIT_KEY_MISSING_HINT, TEMPO_MODERATO_CHAIN_ID, TEMPO_MODERATO_RPC, TEMPO_PATH_USD_MODERATO, WALLET_FILE, WALLET_VERSION, X402EnvValidationError, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_DEFAULT_NETWORK, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, X402_V1_VERSION, X402_VERSION, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, addPayment, advanceTempoChannelExit, amountBoundsVerdict, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertNutSupport, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildAttestation, buildCompletionHintFields, buildDisplayMintInventory, buildPaymentRequiredV2, buildPaymentRequirements, buildPolicy, buildTempoCredential, builderLockPath, caip2ToX402Network, canReplaceExpiredX402Deposit, canSwap, canonicalRequestPath, canonicaliseForSigning, canonicalize, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, chainIdFromCaip2, checkMeltQuoteState, checkMintHealth, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeResultHash, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, decodePayment, decodePaymentRequiredHeader, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, encodePayment, encodePaymentRequiredHeader, encodeSettleResponseHeader, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, exactEvmAuthorization, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateIdentity, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getWallet, getX402Balance, hashCapabilities, hashedCanonicalDvmId, identitiesFileExists, info, initLoggers, insertSpanBatch, isAbortError, isArtifactMessage, isCancelMessage, isCompleteMessage, isCreditFundRail, isCreditFundingMode, isCreditPosture, isDrainReceipt, isFeedbackPosture, isFundingReceipt, isPaymentRailKey, isPaymentRequestMessage, isPromptMessage, isPublicRequestId, isResumable, isSignedJobReceipt, isStablecoinFundRail, isTerminalJobStatus, isTextMessage, isValidEvmPrivateKey, isWorkingMessage, issueRouterFeedbackClaim, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadIdentitySecret, loadImplicitCredits, loadJob, loadLedger, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, parseUsdPrice, payInvoiceReconciling, payViaFloat, paymentRailLabel, paymentRequiredV2FromV1, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, railLabelAtSentenceStart, randomTraceId, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveTempoNetwork, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signAttestation, signDrainReceipt, signDvmRequestData, signFundingReceipt, signReceipt, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, toLockPubkey, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcContractByCaip2, usdcContractFor, usdcDomainNameFor, usdcDomainVersionFor, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyAttestation, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceipt, verifyDrainReceiptChain, verifyFundingReceipt, verifyFundingReceiptChain, verifyJobReceipt, verifyReceipt, verifyRouterFeedbackClaim, walletExists, warmFxSnapshot, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, writeIdentity, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402NetworkToCaip2, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint } from "./caller.js";
2
2
  export { DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, JobCancelledError, MintHealthTracker, NON_CHANNEL_BITCOIN_RAILS, PAYMENT_PROOF_KEYS, PayoutReporter, PostgresTempoChargeStore, PostgresTempoSessionStore, RevenueReporter, SIGNED_ENVELOPE_FIELDS, SIGNED_ENVELOPE_TYPES, TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS, TEMPO_CLOSE_REQUESTED_TOPIC, TempoSessionChannelMismatchError, X402FacilitatorHealth, X402_BATCH_SETTLEMENT_MAINNET_NETWORK, _testing, abortJob, activePubkeySet, applyPaymentInfoToJob, assertRevenueReporterReady, buildPaymentErrorResponse, clearAccumulatorForDvm, createAdminCashuNonceStore, createDVMServer, createDefaultReplayStore, createInstrumentedFetch, creditDepositPayload, depleteLots, derivedFundCreditId, devModeSkipsPaymentVerification, fifoOrder, fromJobRecord, fundedMicroFor, hasPaymentProof, hashLockKey, humanizeZodError, implicitCreditId, inKindDrawMsats, initLockPubkeyTable, initWalletAccumulatorTable, insertAccumulatorRows, installAdminCashuRoutes, isDerivedCreditId, isInKindDepletion, isNonChannelBitcoinRail, isStaleJobReapable, isTerminal, isYieldMessage, issueUpfrontChallenges, jobCredentialGate, loadLockPubkeyState, lockPubkeyStoreToLockPubkey, lotOwedSats, msatsToFiatMicro, netOwedSats, paymentErrorBody, pinAskFiat, priceFiatMicro, processIncomingPayment, providerMessage, pruneRetired, rateUnavailablePaymentError, repairX402ExactSettlementEffect, resolveFxSnapshot, resolvePriceFiat, revenueReporterBannerState, rotateLockPubkey, seedLockPubkeyState, settleWithFacilitator, toCreditTerms, toJobRecord, unknownRouteNotFound, verifyIncomingPayment, verifyTempoSessionManagementCredential, verifyUpfrontPayment, verifyWithFacilitator, verifyX402Payment, wrapMppx, x402RequiredUsdcMicro, x402SettledShare } from "./server.js";
@@ -1,23 +1,23 @@
1
1
  import { FacilitatorConfig } from '@x402/core/server';
2
- import { ai as PaymentPayload, ao as PaymentRequirementsV1, ap as PaymentRequirementsV2, aD as X402Config, au as SettleResponse, aB as VerifyResponse, bh as X402ExactVersionSupport, bi as X402Receipt, bj as TransactionalPayoutHook, bk as CashuMeltCompleted } from '../step-cache-3cT4Shk0.js';
3
- export { bl as CreditDepositPayload, bm as CreditDrainPayload, bn as FundingLot, bo as LotDebit, bp as LotDepletion, bq as MppxServer, br as NON_CHANNEL_BITCOIN_RAILS, bs as NonChannelBitcoinRail, bt as PayoutReporter, bu as PostgresTempoSessionStore, bv as RevenueReporter, bw as SIGNED_ENVELOPE_FIELDS, bx as SIGNED_ENVELOPE_TYPES, by as X402TrackedChannel, bz as _testing, bA as createDefaultReplayStore, bB as depleteLots, bC as fifoOrder, bD as inKindDrawMsats, bE as isInKindDepletion, bF as isNonChannelBitcoinRail, bG as lotOwedSats, bH as netOwedSats, bI as wrapMppx } from '../step-cache-3cT4Shk0.js';
2
+ import { aj as PaymentPayload, ap as PaymentRequirementsV1, aq as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-CwM_Q8rK.js';
3
+ export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-CwM_Q8rK.js';
4
4
  import { Hono } from 'hono';
5
5
  import { Env, BlankSchema } from 'hono/types';
6
6
  import { Pool } from 'pg';
7
7
  export { Pool } from 'pg';
8
8
  import { g as getWallet } from '../wallet-CJC8lwxx.js';
9
- import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-C7zAJElJ.js';
10
- export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-C7zAJElJ.js';
11
- import { g as LockPubkey } from '../lightning-backend-C04nH94l.js';
12
- export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-C04nH94l.js';
13
- export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-Bn23V3QU.js';
9
+ import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-B-e3vZGo.js';
10
+ export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-B-e3vZGo.js';
11
+ import { g as LockPubkey } from '../lightning-backend-KvQM0YHi.js';
12
+ export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-KvQM0YHi.js';
13
+ export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-Cnlv9pOx.js';
14
14
  import { Store } from 'mppx';
15
15
  import { z } from 'zod';
16
16
  import '@x402/evm/batch-settlement/server';
17
17
  import 'viem';
18
18
  import '@x402/core/types';
19
19
  import '@cashu/cashu-ts';
20
- import '../fx-BF_SG2i0.js';
20
+ import '../fx-CGRJE8rm.js';
21
21
 
22
22
  /** POST a verify request to the configured facilitator. */
23
23
  declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-BIFLRKMO.js";
7
7
  import {
8
8
  RevenueReporter
9
- } from "../chunk-NFRM5QYP.js";
9
+ } from "../chunk-EVBK675R.js";
10
10
  import {
11
11
  PayoutReporter
12
12
  } from "../chunk-6BQM7TOW.js";
@@ -65,13 +65,13 @@ import {
65
65
  verifyUpfrontPayment,
66
66
  x402RequiredUsdcMicro,
67
67
  x402SettledShare
68
- } from "../chunk-3ZHMQCYP.js";
68
+ } from "../chunk-NJFOV36R.js";
69
69
  import "../chunk-DMNLFNTW.js";
70
70
  import {
71
71
  settleWithFacilitator,
72
72
  verifyWithFacilitator
73
73
  } from "../chunk-BQ2NMWKE.js";
74
- import "../chunk-DBCLBYHP.js";
74
+ import "../chunk-KVEHHC7W.js";
75
75
  import {
76
76
  SIGNED_ENVELOPE_FIELDS,
77
77
  SIGNED_ENVELOPE_TYPES,
@@ -88,15 +88,15 @@ import {
88
88
  isYieldMessage,
89
89
  providerMessage,
90
90
  toJobRecord
91
- } from "../chunk-4B56DEEV.js";
91
+ } from "../chunk-U6M3ATSG.js";
92
92
  import {
93
93
  toLockPubkey
94
- } from "../chunk-2K7E3N2D.js";
94
+ } from "../chunk-KXCKFIJI.js";
95
95
  import "../chunk-Z4BNLUZF.js";
96
96
  import "../chunk-5URG56JJ.js";
97
97
  import "../chunk-MKI6OVW4.js";
98
98
  import "../chunk-KXZUCCEY.js";
99
- import "../chunk-YDIYXGYL.js";
99
+ import "../chunk-E4EVGPDX.js";
100
100
  import "../chunk-66HGCPBU.js";
101
101
  import "../chunk-FUJ36YDV.js";
102
102
  import "../chunk-27V2ILSR.js";
@@ -116,7 +116,7 @@ import "../chunk-C3MTFLC6.js";
116
116
  import {
117
117
  _testing,
118
118
  wrapMppx
119
- } from "../chunk-5GFED3GJ.js";
119
+ } from "../chunk-NPIW5VR5.js";
120
120
  export {
121
121
  DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
122
122
  JobCancelledError,
@@ -1,5 +1,5 @@
1
1
  import { ProofLike } from '@cashu/cashu-ts';
2
- import { a0 as Message, ag as FundingMethod, W as FundingReceipt, bN as CreditSnapshot, X as JobReceipt, aw as StepRecord, a1 as MessageType } from './step-cache-3cT4Shk0.js';
2
+ import { a1 as Message, ah as FundingMethod, X as FundingReceipt, bO as CreditSnapshot, Y as JobReceipt, ax as StepRecord, a2 as MessageType } from './step-cache-CwM_Q8rK.js';
3
3
 
4
4
  /** Job status values that can be persisted. */
5
5
  type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
@@ -81,6 +81,21 @@ interface JobRecord {
81
81
  nativeAsset?: "sats" | "usdc" | "usdc.e" | "usd-cents";
82
82
  /** Cashu flow discriminator written into `revenue_events.metadata.cashu_flow` (internal-review). */
83
83
  cashuFlow?: "p2pk_accumulator";
84
+ /**
85
+ * What this job cost the **builder** to serve, in 1e-6 of
86
+ * {@link JobRecord.costCurrency} (internal-review). Mirror of
87
+ * `ServerJob.costAmountMicro`; see that field. Absent means unreported,
88
+ * which the platform treats differently from a declared zero.
89
+ */
90
+ costAmountMicro?: number;
91
+ /** Currency {@link JobRecord.costAmountMicro} is 1e-6 of (lowercase ISO-4217). */
92
+ costCurrency?: string;
93
+ /**
94
+ * Number of `ctx.cost()` declarations incorporated into the current cost
95
+ * state. Lets the platform deterministically replace a stale persisted
96
+ * prefix with the handler owner's later cumulative value.
97
+ */
98
+ costRevision?: number;
84
99
  /**
85
100
  * Credit the upfront payment funded/drew (internal-review). The terminal funnel
86
101
  * settles the draw on success and releases it on failure/cancel, and the
@@ -1,4 +1,4 @@
1
- import { V as JsonValue } from './step-cache-3cT4Shk0.js';
1
+ import { W as JsonValue } from './step-cache-CwM_Q8rK.js';
2
2
 
3
3
  declare const lockPubkeyBrand: unique symbol;
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MemoryCreditLedger
3
- } from "./chunk-DBCLBYHP.js";
3
+ } from "./chunk-KVEHHC7W.js";
4
4
  import "./chunk-MLRCSJYX.js";
5
5
  import "./chunk-S3XAHZQY.js";
6
6
  import "./chunk-C3MTFLC6.js";
@@ -1,5 +1,9 @@
1
1
  import {
2
2
  MPPX_HMAC_MISMATCH_REASON,
3
+ TEMPO_MAINNET_CHAIN_ID,
4
+ TEMPO_MODERATO_CHAIN_ID,
5
+ TEMPO_MODERATO_RPC,
6
+ TEMPO_PATH_USD_MODERATO,
3
7
  TEMPO_SETTLEMENT_IN_FLIGHT,
4
8
  TEMPO_SETTLEMENT_LEASE_FIELD,
5
9
  TEMPO_SETTLEMENT_LEASE_MS,
@@ -11,10 +15,15 @@ import {
11
15
  createDualKeyMppxFromOpts,
12
16
  createMppFromOpts,
13
17
  parseMppMethodsAllowlist,
18
+ resolveTempoNetwork,
14
19
  wrapMppx
15
- } from "./chunk-5GFED3GJ.js";
20
+ } from "./chunk-NPIW5VR5.js";
16
21
  export {
17
22
  MPPX_HMAC_MISMATCH_REASON,
23
+ TEMPO_MAINNET_CHAIN_ID,
24
+ TEMPO_MODERATO_CHAIN_ID,
25
+ TEMPO_MODERATO_RPC,
26
+ TEMPO_PATH_USD_MODERATO,
18
27
  TEMPO_SETTLEMENT_IN_FLIGHT,
19
28
  TEMPO_SETTLEMENT_LEASE_FIELD,
20
29
  TEMPO_SETTLEMENT_LEASE_MS,
@@ -26,5 +35,6 @@ export {
26
35
  createDualKeyMppxFromOpts,
27
36
  createMppFromOpts,
28
37
  parseMppMethodsAllowlist,
38
+ resolveTempoNetwork,
29
39
  wrapMppx
30
40
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PostgresJobStore
3
- } from "./chunk-LLXV32HA.js";
3
+ } from "./chunk-SSSZUVWM.js";
4
4
  import "./chunk-S3XAHZQY.js";
5
5
  export {
6
6
  PostgresJobStore
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RevenueReporter
3
- } from "./chunk-NFRM5QYP.js";
3
+ } from "./chunk-EVBK675R.js";
4
4
  import "./chunk-S3XAHZQY.js";
5
5
  export {
6
6
  RevenueReporter