@arkade-os/sdk 0.4.71 → 0.4.73

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 (80) hide show
  1. package/README.md +29 -0
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/adapters/indexedDB.cjs +5 -5
  7. package/dist/adapters/indexedDB.js +4 -4
  8. package/dist/{asyncStorageTaskQueue-CjKAUiuj.d.ts → asyncStorageTaskQueue-C5IwA_Hs.d.ts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-DgXf4iuU.d.cts → asyncStorageTaskQueue-DA2OdpJ0.d.cts} +1 -1
  10. package/dist/{chunk-P6EXRY5L.cjs → chunk-2D7F5IU3.cjs} +49 -49
  11. package/dist/{chunk-P6EXRY5L.cjs.map → chunk-2D7F5IU3.cjs.map} +1 -1
  12. package/dist/{chunk-NOWVA5CM.js → chunk-5YCAC6XE.js} +4 -4
  13. package/dist/{chunk-NOWVA5CM.js.map → chunk-5YCAC6XE.js.map} +1 -1
  14. package/dist/{chunk-MK5EPTTB.cjs → chunk-C4RKZY7D.cjs} +798 -513
  15. package/dist/chunk-C4RKZY7D.cjs.map +1 -0
  16. package/dist/{chunk-FM263GKH.cjs → chunk-D5DLGVN4.cjs} +51 -25
  17. package/dist/chunk-D5DLGVN4.cjs.map +1 -0
  18. package/dist/{chunk-ALZ2CZ3T.js → chunk-G5RPUZJE.js} +3 -3
  19. package/dist/{chunk-ALZ2CZ3T.js.map → chunk-G5RPUZJE.js.map} +1 -1
  20. package/dist/{chunk-5J5PDZRR.cjs → chunk-KJ5E646Y.cjs} +30 -4
  21. package/dist/chunk-KJ5E646Y.cjs.map +1 -0
  22. package/dist/{chunk-7PHMT3T4.cjs → chunk-L7IEXVXI.cjs} +10 -10
  23. package/dist/{chunk-7PHMT3T4.cjs.map → chunk-L7IEXVXI.cjs.map} +1 -1
  24. package/dist/{chunk-ZT3EM4CE.js → chunk-M6HIWM5N.js} +37 -11
  25. package/dist/chunk-M6HIWM5N.js.map +1 -0
  26. package/dist/{chunk-2ZX4Z2IP.js → chunk-OV4GLPZI.js} +30 -5
  27. package/dist/chunk-OV4GLPZI.js.map +1 -0
  28. package/dist/{chunk-SCSLCU66.js → chunk-QX2M67YI.js} +8 -4
  29. package/dist/chunk-QX2M67YI.js.map +1 -0
  30. package/dist/{chunk-E5JNYFOF.js → chunk-YHJJSLE5.js} +367 -83
  31. package/dist/chunk-YHJJSLE5.js.map +1 -0
  32. package/dist/{chunk-I7ZNWBBU.cjs → chunk-ZLDO4QDR.cjs} +21 -17
  33. package/dist/chunk-ZLDO4QDR.cjs.map +1 -0
  34. package/dist/contracts/handlers/index.cjs +9 -9
  35. package/dist/contracts/handlers/index.d.cts +3 -3
  36. package/dist/contracts/handlers/index.d.ts +3 -3
  37. package/dist/contracts/handlers/index.js +2 -2
  38. package/dist/{delegate-D-gEEqrP.d.cts → delegate-BJp8f6LT.d.cts} +1 -1
  39. package/dist/{delegate-CKJdsC99.d.ts → delegate-Ckz_TWzM.d.ts} +1 -1
  40. package/dist/{hdWalletCapable-CwLPmWct.d.cts → hdWalletCapable-DA9bJ5eB.d.cts} +2 -2
  41. package/dist/{hdWalletCapable-BJ4pvkai.d.ts → hdWalletCapable-DABgAD-T.d.ts} +2 -2
  42. package/dist/{index-Boppyqav.d.ts → index-B8xrELXY.d.ts} +2 -2
  43. package/dist/{index-BE1uFXrV.d.cts → index-DSbDm0Io.d.cts} +2 -2
  44. package/dist/{index-CyGnhCSS.d.ts → index-Dg0-TvBQ.d.cts} +51 -3
  45. package/dist/{index-CyGnhCSS.d.cts → index-Dg0-TvBQ.d.ts} +51 -3
  46. package/dist/index.cjs +306 -298
  47. package/dist/index.d.cts +57 -10
  48. package/dist/index.d.ts +57 -10
  49. package/dist/index.js +4 -4
  50. package/dist/repositories/realm/index.cjs +19 -19
  51. package/dist/repositories/realm/index.d.cts +2 -2
  52. package/dist/repositories/realm/index.d.ts +2 -2
  53. package/dist/repositories/realm/index.js +5 -5
  54. package/dist/repositories/sqlite/index.cjs +18 -18
  55. package/dist/repositories/sqlite/index.d.cts +2 -2
  56. package/dist/repositories/sqlite/index.d.ts +2 -2
  57. package/dist/repositories/sqlite/index.js +5 -5
  58. package/dist/{taskRunner-CjmMH_rW.d.cts → taskRunner-C_uAJDsn.d.cts} +1 -1
  59. package/dist/{taskRunner-l3zyfW_Q.d.ts → taskRunner-DARTFnZN.d.ts} +1 -1
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.d.cts +3 -3
  62. package/dist/wallet/expo/background.d.ts +3 -3
  63. package/dist/wallet/expo/background.js +6 -6
  64. package/dist/wallet/expo/index.cjs +14 -14
  65. package/dist/wallet/expo/index.d.cts +4 -4
  66. package/dist/wallet/expo/index.d.ts +4 -4
  67. package/dist/wallet/expo/index.js +5 -5
  68. package/dist/worker/expo/index.cjs +9 -9
  69. package/dist/worker/expo/index.d.cts +4 -4
  70. package/dist/worker/expo/index.d.ts +4 -4
  71. package/dist/worker/expo/index.js +5 -5
  72. package/package.json +1 -1
  73. package/dist/chunk-2ZX4Z2IP.js.map +0 -1
  74. package/dist/chunk-5J5PDZRR.cjs.map +0 -1
  75. package/dist/chunk-E5JNYFOF.js.map +0 -1
  76. package/dist/chunk-FM263GKH.cjs.map +0 -1
  77. package/dist/chunk-I7ZNWBBU.cjs.map +0 -1
  78. package/dist/chunk-MK5EPTTB.cjs.map +0 -1
  79. package/dist/chunk-SCSLCU66.js.map +0 -1
  80. package/dist/chunk-ZT3EM4CE.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkFM263GKH_cjs = require('./chunk-FM263GKH.cjs');
4
- var chunk5J5PDZRR_cjs = require('./chunk-5J5PDZRR.cjs');
3
+ var chunkD5DLGVN4_cjs = require('./chunk-D5DLGVN4.cjs');
4
+ var chunkKJ5E646Y_cjs = require('./chunk-KJ5E646Y.cjs');
5
5
 
6
6
  // src/providers/expoUtils.ts
7
7
  async function getExpoFetch(options) {
@@ -10,8 +10,8 @@ async function getExpoFetch(options) {
10
10
  console.debug("Using expo/fetch for streaming");
11
11
  const expoFetchWithHeader = (input, init) => {
12
12
  const headers = new Headers(init?.headers);
13
- headers.set("X-Build-Version", chunk5J5PDZRR_cjs.buildVersion);
14
- headers.set("X-SDK-VERSION", chunk5J5PDZRR_cjs.sdkVersion);
13
+ headers.set("X-Build-Version", chunkKJ5E646Y_cjs.buildVersion);
14
+ headers.set("X-SDK-VERSION", chunkKJ5E646Y_cjs.sdkVersion);
15
15
  return expoFetchModule.fetch(input, { ...init, headers });
16
16
  };
17
17
  return expoFetchWithHeader;
@@ -20,7 +20,7 @@ async function getExpoFetch(options) {
20
20
  "Using standard fetch instead of expo/fetch. Streaming may not be fully supported in some environments.",
21
21
  error
22
22
  );
23
- return chunk5J5PDZRR_cjs.fetch;
23
+ return chunkKJ5E646Y_cjs.fetch;
24
24
  }
25
25
  }
26
26
  async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
@@ -33,6 +33,10 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
33
33
  Accept: "text/event-stream",
34
34
  ...headers
35
35
  },
36
+ // Required, not just for cancellation: `getExpoFetch` falls back to
37
+ // the Ark `fetch` wrapper, which routes through `baseFetch` and so
38
+ // bounds any read that brings no signal of its own. Drop this and
39
+ // the stream is truncated at READ_TIMEOUT_MS.
36
40
  signal: fetchController.signal
37
41
  });
38
42
  if (!response.ok) {
@@ -77,8 +81,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
77
81
  }
78
82
 
79
83
  // src/providers/expoArk.ts
80
- var ExpoArkProvider = class extends chunk5J5PDZRR_cjs.RestArkProvider {
81
- constructor(serverUrl = chunk5J5PDZRR_cjs.DEFAULT_ARKADE_SERVER_URL) {
84
+ var ExpoArkProvider = class extends chunkKJ5E646Y_cjs.RestArkProvider {
85
+ constructor(serverUrl = chunkKJ5E646Y_cjs.DEFAULT_ARKADE_SERVER_URL) {
82
86
  super(serverUrl);
83
87
  }
84
88
  async *getEventStream(signal, topics) {
@@ -98,7 +102,7 @@ var ExpoArkProvider = class extends chunk5J5PDZRR_cjs.RestArkProvider {
98
102
  if (error instanceof Error && error.name === "AbortError") {
99
103
  break;
100
104
  }
101
- if (chunk5J5PDZRR_cjs.isFetchTimeoutError(error)) {
105
+ if (chunkKJ5E646Y_cjs.isFetchTimeoutError(error)) {
102
106
  console.debug("Timeout error ignored");
103
107
  continue;
104
108
  }
@@ -119,7 +123,7 @@ var ExpoArkProvider = class extends chunk5J5PDZRR_cjs.RestArkProvider {
119
123
  if (error instanceof Error && error.name === "AbortError") {
120
124
  break;
121
125
  }
122
- if (chunk5J5PDZRR_cjs.isFetchTimeoutError(error)) {
126
+ if (chunkKJ5E646Y_cjs.isFetchTimeoutError(error)) {
123
127
  console.debug("Timeout error ignored");
124
128
  continue;
125
129
  }
@@ -131,8 +135,8 @@ var ExpoArkProvider = class extends chunk5J5PDZRR_cjs.RestArkProvider {
131
135
  };
132
136
 
133
137
  // src/providers/expoIndexer.ts
134
- var ExpoIndexerProvider = class extends chunkFM263GKH_cjs.RestIndexerProvider {
135
- constructor(serverUrl = chunk5J5PDZRR_cjs.DEFAULT_ARKADE_SERVER_URL) {
138
+ var ExpoIndexerProvider = class extends chunkD5DLGVN4_cjs.RestIndexerProvider {
139
+ constructor(serverUrl = chunkKJ5E646Y_cjs.DEFAULT_ARKADE_SERVER_URL) {
136
140
  super(serverUrl);
137
141
  }
138
142
  async *getSubscription(subscriptionId, abortSignal) {
@@ -161,9 +165,9 @@ var ExpoIndexerProvider = class extends chunkFM263GKH_cjs.RestIndexerProvider {
161
165
  return {
162
166
  txid: data.event.txid,
163
167
  scripts: data.event.scripts || [],
164
- newVtxos: (data.event.newVtxos || []).map(chunk5J5PDZRR_cjs.convertVtxo),
165
- spentVtxos: (data.event.spentVtxos || []).map(chunk5J5PDZRR_cjs.convertVtxo),
166
- sweptVtxos: (data.event.sweptVtxos || []).map(chunk5J5PDZRR_cjs.convertVtxo),
168
+ newVtxos: (data.event.newVtxos || []).map(chunkKJ5E646Y_cjs.convertVtxo),
169
+ spentVtxos: (data.event.spentVtxos || []).map(chunkKJ5E646Y_cjs.convertVtxo),
170
+ sweptVtxos: (data.event.sweptVtxos || []).map(chunkKJ5E646Y_cjs.convertVtxo),
167
171
  tx: data.event.tx,
168
172
  checkpointTxs: data.event.checkpointTxs
169
173
  };
@@ -175,7 +179,7 @@ var ExpoIndexerProvider = class extends chunkFM263GKH_cjs.RestIndexerProvider {
175
179
  if (error instanceof Error && error.name === "AbortError") {
176
180
  break;
177
181
  }
178
- if (chunk5J5PDZRR_cjs.isFetchTimeoutError(error)) {
182
+ if (chunkKJ5E646Y_cjs.isFetchTimeoutError(error)) {
179
183
  console.debug("Timeout error ignored");
180
184
  continue;
181
185
  }
@@ -188,5 +192,5 @@ var ExpoIndexerProvider = class extends chunkFM263GKH_cjs.RestIndexerProvider {
188
192
 
189
193
  exports.ExpoArkProvider = ExpoArkProvider;
190
194
  exports.ExpoIndexerProvider = ExpoIndexerProvider;
191
- //# sourceMappingURL=chunk-I7ZNWBBU.cjs.map
192
- //# sourceMappingURL=chunk-I7ZNWBBU.cjs.map
195
+ //# sourceMappingURL=chunk-ZLDO4QDR.cjs.map
196
+ //# sourceMappingURL=chunk-ZLDO4QDR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["buildVersion","sdkVersion","fetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,Y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AAAA,gBACzD,EAAA,EAAI,KAAK,KAAA,CAAM,EAAA;AAAA,gBACf,aAAA,EAAe,KAAK,KAAA,CAAM;AAAA,eAC9B;AAAA,YACJ;AACA,YAAA,OAAO,IAAA;AAAA,UACX;AAAA,SACJ;AAAA,MACJ,SAAS,KAAA,EAAO;AACZ,QAAA,IAAI,KAAA,YAAiB,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,YAAA,EAAc;AACvD,UAAA;AAAA,QACJ;AAIA,QAAA,IAAIF,qCAAA,CAAoB,KAAK,CAAA,EAAG;AAC5B,UAAA,OAAA,CAAQ,MAAM,uBAAuB,CAAA;AACrC,UAAA;AAAA,QACJ;AAEA,QAAA,OAAA,CAAQ,KAAA,CAAM,uBAAuB,KAAK,CAAA;AAC1C,QAAA,MAAM,KAAA;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ","file":"chunk-ZLDO4QDR.cjs","sourcesContent":["import { fetch, buildVersion, sdkVersion } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch with fallback to standard fetch.\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n const expoFetchWithHeader = (input: RequestInfo, init?: RequestInit) => {\n const headers = new Headers(init?.headers);\n headers.set(\"X-Build-Version\", buildVersion);\n headers.set(\"X-SDK-VERSION\", sdkVersion);\n return expoFetchModule.fetch(input, { ...init, headers });\n };\n return expoFetchWithHeader as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return fetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n // Required, not just for cancellation: `getExpoFetch` falls back to\n // the Ark `fetch` wrapper, which routes through `baseFetch` and so\n // bounds any read that brings no signal of its own. Drop this and\n // the stream is truncated at READ_TIMEOUT_MS.\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotificationEvent, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
@@ -1,38 +1,38 @@
1
1
  'use strict';
2
2
 
3
- var chunkP6EXRY5L_cjs = require('../../chunk-P6EXRY5L.cjs');
4
- require('../../chunk-5J5PDZRR.cjs');
3
+ var chunk2D7F5IU3_cjs = require('../../chunk-2D7F5IU3.cjs');
4
+ require('../../chunk-KJ5E646Y.cjs');
5
5
  require('../../chunk-5BLDMQED.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "ArkadeContractHandler", {
10
10
  enumerable: true,
11
- get: function () { return chunkP6EXRY5L_cjs.ArkadeContractHandler; }
11
+ get: function () { return chunk2D7F5IU3_cjs.ArkadeContractHandler; }
12
12
  });
13
13
  Object.defineProperty(exports, "BoardingContractHandler", {
14
14
  enumerable: true,
15
- get: function () { return chunkP6EXRY5L_cjs.BoardingContractHandler; }
15
+ get: function () { return chunk2D7F5IU3_cjs.BoardingContractHandler; }
16
16
  });
17
17
  Object.defineProperty(exports, "DefaultContractHandler", {
18
18
  enumerable: true,
19
- get: function () { return chunkP6EXRY5L_cjs.DefaultContractHandler; }
19
+ get: function () { return chunk2D7F5IU3_cjs.DefaultContractHandler; }
20
20
  });
21
21
  Object.defineProperty(exports, "DelegateContractHandler", {
22
22
  enumerable: true,
23
- get: function () { return chunkP6EXRY5L_cjs.DelegateContractHandler; }
23
+ get: function () { return chunk2D7F5IU3_cjs.DelegateContractHandler; }
24
24
  });
25
25
  Object.defineProperty(exports, "VHTLCContractHandler", {
26
26
  enumerable: true,
27
- get: function () { return chunkP6EXRY5L_cjs.VHTLCContractHandler; }
27
+ get: function () { return chunk2D7F5IU3_cjs.VHTLCContractHandler; }
28
28
  });
29
29
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
30
30
  enumerable: true,
31
- get: function () { return chunkP6EXRY5L_cjs.VHTLCV2ContractHandler; }
31
+ get: function () { return chunk2D7F5IU3_cjs.VHTLCV2ContractHandler; }
32
32
  });
33
33
  Object.defineProperty(exports, "contractHandlers", {
34
34
  enumerable: true,
35
- get: function () { return chunkP6EXRY5L_cjs.contractHandlers; }
35
+ get: function () { return chunk2D7F5IU3_cjs.contractHandlers; }
36
36
  });
37
37
  //# sourceMappingURL=index.cjs.map
38
38
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-BE1uFXrV.cjs';
2
- import '../../index-CyGnhCSS.cjs';
1
+ export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-DSbDm0Io.cjs';
2
+ import '../../index-Dg0-TvBQ.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/psbt.js';
7
- import '../../delegate-D-gEEqrP.cjs';
7
+ import '../../delegate-BJp8f6LT.cjs';
@@ -1,7 +1,7 @@
1
- export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-Boppyqav.js';
2
- import '../../index-CyGnhCSS.js';
1
+ export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-B8xrELXY.js';
2
+ import '../../index-Dg0-TvBQ.js';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/psbt.js';
7
- import '../../delegate-CKJdsC99.js';
7
+ import '../../delegate-Ckz_TWzM.js';
@@ -1,5 +1,5 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-ALZ2CZ3T.js';
2
- import '../../chunk-2ZX4Z2IP.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-G5RPUZJE.js';
2
+ import '../../chunk-OV4GLPZI.js';
3
3
  import '../../chunk-NSBPE2FW.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-CyGnhCSS.cjs';
2
+ import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-Dg0-TvBQ.cjs';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-CyGnhCSS.js';
2
+ import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-Dg0-TvBQ.js';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,8 +1,8 @@
1
- import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-CyGnhCSS.cjs';
1
+ import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-Dg0-TvBQ.cjs';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
  import { Bytes } from '@scure/btc-signer/utils.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-D-gEEqrP.cjs';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BJp8f6LT.cjs';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -1,8 +1,8 @@
1
- import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-CyGnhCSS.js';
1
+ import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-Dg0-TvBQ.js';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
  import { Bytes } from '@scure/btc-signer/utils.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-CKJdsC99.js';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Ckz_TWzM.js';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -1,5 +1,5 @@
1
- import { bh as ContractHandler, s as RelativeTimelock, bu as Discoverable, V as VtxoScript, t as TapLeafScript, d8 as TapscriptDeriving } from './index-CyGnhCSS.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-CKJdsC99.js';
1
+ import { bh as ContractHandler, s as RelativeTimelock, bu as Discoverable, V as VtxoScript, t as TapLeafScript, d8 as TapscriptDeriving } from './index-Dg0-TvBQ.js';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Ckz_TWzM.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { bh as ContractHandler, s as RelativeTimelock, bu as Discoverable, V as VtxoScript, t as TapLeafScript, d8 as TapscriptDeriving } from './index-CyGnhCSS.cjs';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-D-gEEqrP.cjs';
1
+ import { bh as ContractHandler, s as RelativeTimelock, bu as Discoverable, V as VtxoScript, t as TapLeafScript, d8 as TapscriptDeriving } from './index-Dg0-TvBQ.cjs';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BJp8f6LT.cjs';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**
@@ -566,6 +566,8 @@ declare class RestIndexerProvider implements IndexerProvider {
566
566
  serverUrl: string;
567
567
  /** Overrides {@link configureEventSource} for this provider's subscription. */
568
568
  protected readonly eventSource?: EventSourceFactory;
569
+ /** @see fetchVtxosJson */
570
+ private readonly inFlightVtxoReads;
569
571
  constructor(serverUrl?: string, options?: EventSourceCapable);
570
572
  getVtxoTree(batchOutpoint: Outpoint, opts?: PaginationOptions): Promise<{
571
573
  vtxoTree: Tx[];
@@ -603,6 +605,17 @@ declare class RestIndexerProvider implements IndexerProvider {
603
605
  * politeness through the rate gate, so don't add a redundant sleep.
604
606
  */
605
607
  private fetchVtxosPage;
608
+ /**
609
+ * The wire read behind {@link fetchVtxosPage}, with an identical read
610
+ * already in flight served from that one request instead of repeated.
611
+ *
612
+ * Two callers can want the same page at the same instant without either
613
+ * being redundant, so there is no single call site to remove: a send that
614
+ * leaves change makes the indexer emit `vtxo_spent` and `vtxo_received` for
615
+ * the wallet's own contract milliseconds apart, and `handleContractEvent`
616
+ * delta-syncs that contract on both arms.
617
+ */
618
+ private fetchVtxosJson;
606
619
  getAssetDetails(assetId: string): Promise<AssetDetails>;
607
620
  subscribeForScripts(scripts: string[], subscriptionId?: string): Promise<string>;
608
621
  unsubscribeForScripts(subscriptionId: string, scripts?: string[]): Promise<void>;
@@ -3611,6 +3624,12 @@ interface IContractManager extends Disposable {
3611
3624
  * The contract script is used as the unique identifier.
3612
3625
  */
3613
3626
  createContract(params: CreateContractParams): Promise<Contract>;
3627
+ /**
3628
+ * {@link createContract} for a set, one indexer round trip instead of N.
3629
+ * Optional so adding it breaks no implementer of this public interface
3630
+ * (`serviceWorker/wallet.ts` proxies each method over wire): fall back.
3631
+ */
3632
+ createContracts?(paramsList: CreateContractParams[]): Promise<Contract[]>;
3614
3633
  /**
3615
3634
  * List contracts with optional filters.
3616
3635
  *
@@ -3941,6 +3960,14 @@ interface ContractManagerConfig {
3941
3960
  height: number;
3942
3961
  time: number;
3943
3962
  } | undefined>;
3963
+ /**
3964
+ * How stale {@link ContractManager.getContractsWithVtxos} may let its
3965
+ * opportunistic sync be before repeating it. `0` (default) repeats it every
3966
+ * call. A send syncs, selects, then submits, so its coins are already one
3967
+ * submit latency stale; this widens that bound by this value, and is
3968
+ * therefore a budget rather than a free saving.
3969
+ */
3970
+ vtxoSyncMaxAgeMs?: number;
3944
3971
  }
3945
3972
  /**
3946
3973
  * Wallet-injected surface backing the HD look-ahead window. Kept as a
@@ -4034,6 +4061,7 @@ declare class ContractManager implements IContractManager {
4034
4061
  private syncDegradedReason?;
4035
4062
  /** Epoch-ms of the last successful provider sync, if any. */
4036
4063
  private lastSyncedAt?;
4064
+ private syncedAtByScript;
4037
4065
  /** Last chain tip read, with the epoch-ms it was read at. @see currentChainTip */
4038
4066
  private chainTipCache?;
4039
4067
  /** In-flight chain tip read, so concurrent cache misses share one. */
@@ -4070,6 +4098,8 @@ declare class ContractManager implements IContractManager {
4070
4098
  * sync. Purely a freshness signal — not a source of truth for wallet data.
4071
4099
  */
4072
4100
  getSyncState(): ContractSyncState;
4101
+ /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
4102
+ setVtxoSyncMaxAge(maxAgeMs: number): void;
4073
4103
  private markSyncOnline;
4074
4104
  /** Contracts a sync could not annotate, as `script → reason`. */
4075
4105
  private annotationFailures;
@@ -4179,6 +4209,13 @@ declare class ContractManager implements IContractManager {
4179
4209
  * @returns The created contract
4180
4210
  */
4181
4211
  createContract(params: CreateContractParams): Promise<Contract>;
4212
+ /**
4213
+ * `createContract`'s step order, fetch batched: persist all, hydrate once,
4214
+ * then watch. Hydrating first keeps it equivalent — the watcher seeds from
4215
+ * the repository, so an unhydrated row reads as all-new. A part-way failure
4216
+ * still watches what it wrote; a retry reports those rows as existing.
4217
+ */
4218
+ createContracts(paramsList: CreateContractParams[]): Promise<Contract[]>;
4182
4219
  /**
4183
4220
  * Lightweight variant of {@link createContract} for batch discovery
4184
4221
  * paths (currently: {@link scanContracts}). Validates, dedupes, persists,
@@ -4406,6 +4443,7 @@ declare class ContractManager implements IContractManager {
4406
4443
  * other contracts still need to pick up.
4407
4444
  */
4408
4445
  private syncContracts;
4446
+ private syncedWithin;
4409
4447
  /**
4410
4448
  * Demote every `awaiting-funds` contract in `contracts` that has been
4411
4449
  * funded — the automatic half of {@link ContractWatchState}.
@@ -6047,13 +6085,23 @@ interface TxKey {
6047
6085
  /** Arkade transaction id, when applicable. */
6048
6086
  arkTxid: string;
6049
6087
  }
6050
- /** The categories the history builder itself assigns. */
6051
- type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch";
6088
+ /**
6089
+ * The categories the history builder itself assigns.
6090
+ *
6091
+ * Four of them name the mechanism that moved the coin. `"gated"` names the
6092
+ * counterparty instead: an offchain row facing a contract row of this wallet's
6093
+ * that generic spending is closed on — a swap covenant, a lockup — which is the
6094
+ * same money {@link WalletBalance.gated} reports. History reads such a contract
6095
+ * as an external party, so the movement is a real send or receive rather than
6096
+ * change, and the tag is what lets a consumer tell "into my own escrow" from
6097
+ * "to a stranger" instead of the movement arriving unattributed.
6098
+ */
6099
+ type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch" | "gated";
6052
6100
  /**
6053
6101
  * The category the history builder assigns to a transaction. The `(string & {})`
6054
6102
  * arm keeps the union open — apps and resolvers can introduce their own
6055
6103
  * categories without a breaking change — while preserving editor autocomplete
6056
- * for the built-in four.
6104
+ * for the built-in ones.
6057
6105
  */
6058
6106
  type TxTag = BuiltinTxTag | (string & {});
6059
6107
  /**
@@ -566,6 +566,8 @@ declare class RestIndexerProvider implements IndexerProvider {
566
566
  serverUrl: string;
567
567
  /** Overrides {@link configureEventSource} for this provider's subscription. */
568
568
  protected readonly eventSource?: EventSourceFactory;
569
+ /** @see fetchVtxosJson */
570
+ private readonly inFlightVtxoReads;
569
571
  constructor(serverUrl?: string, options?: EventSourceCapable);
570
572
  getVtxoTree(batchOutpoint: Outpoint, opts?: PaginationOptions): Promise<{
571
573
  vtxoTree: Tx[];
@@ -603,6 +605,17 @@ declare class RestIndexerProvider implements IndexerProvider {
603
605
  * politeness through the rate gate, so don't add a redundant sleep.
604
606
  */
605
607
  private fetchVtxosPage;
608
+ /**
609
+ * The wire read behind {@link fetchVtxosPage}, with an identical read
610
+ * already in flight served from that one request instead of repeated.
611
+ *
612
+ * Two callers can want the same page at the same instant without either
613
+ * being redundant, so there is no single call site to remove: a send that
614
+ * leaves change makes the indexer emit `vtxo_spent` and `vtxo_received` for
615
+ * the wallet's own contract milliseconds apart, and `handleContractEvent`
616
+ * delta-syncs that contract on both arms.
617
+ */
618
+ private fetchVtxosJson;
606
619
  getAssetDetails(assetId: string): Promise<AssetDetails>;
607
620
  subscribeForScripts(scripts: string[], subscriptionId?: string): Promise<string>;
608
621
  unsubscribeForScripts(subscriptionId: string, scripts?: string[]): Promise<void>;
@@ -3611,6 +3624,12 @@ interface IContractManager extends Disposable {
3611
3624
  * The contract script is used as the unique identifier.
3612
3625
  */
3613
3626
  createContract(params: CreateContractParams): Promise<Contract>;
3627
+ /**
3628
+ * {@link createContract} for a set, one indexer round trip instead of N.
3629
+ * Optional so adding it breaks no implementer of this public interface
3630
+ * (`serviceWorker/wallet.ts` proxies each method over wire): fall back.
3631
+ */
3632
+ createContracts?(paramsList: CreateContractParams[]): Promise<Contract[]>;
3614
3633
  /**
3615
3634
  * List contracts with optional filters.
3616
3635
  *
@@ -3941,6 +3960,14 @@ interface ContractManagerConfig {
3941
3960
  height: number;
3942
3961
  time: number;
3943
3962
  } | undefined>;
3963
+ /**
3964
+ * How stale {@link ContractManager.getContractsWithVtxos} may let its
3965
+ * opportunistic sync be before repeating it. `0` (default) repeats it every
3966
+ * call. A send syncs, selects, then submits, so its coins are already one
3967
+ * submit latency stale; this widens that bound by this value, and is
3968
+ * therefore a budget rather than a free saving.
3969
+ */
3970
+ vtxoSyncMaxAgeMs?: number;
3944
3971
  }
3945
3972
  /**
3946
3973
  * Wallet-injected surface backing the HD look-ahead window. Kept as a
@@ -4034,6 +4061,7 @@ declare class ContractManager implements IContractManager {
4034
4061
  private syncDegradedReason?;
4035
4062
  /** Epoch-ms of the last successful provider sync, if any. */
4036
4063
  private lastSyncedAt?;
4064
+ private syncedAtByScript;
4037
4065
  /** Last chain tip read, with the epoch-ms it was read at. @see currentChainTip */
4038
4066
  private chainTipCache?;
4039
4067
  /** In-flight chain tip read, so concurrent cache misses share one. */
@@ -4070,6 +4098,8 @@ declare class ContractManager implements IContractManager {
4070
4098
  * sync. Purely a freshness signal — not a source of truth for wallet data.
4071
4099
  */
4072
4100
  getSyncState(): ContractSyncState;
4101
+ /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
4102
+ setVtxoSyncMaxAge(maxAgeMs: number): void;
4073
4103
  private markSyncOnline;
4074
4104
  /** Contracts a sync could not annotate, as `script → reason`. */
4075
4105
  private annotationFailures;
@@ -4179,6 +4209,13 @@ declare class ContractManager implements IContractManager {
4179
4209
  * @returns The created contract
4180
4210
  */
4181
4211
  createContract(params: CreateContractParams): Promise<Contract>;
4212
+ /**
4213
+ * `createContract`'s step order, fetch batched: persist all, hydrate once,
4214
+ * then watch. Hydrating first keeps it equivalent — the watcher seeds from
4215
+ * the repository, so an unhydrated row reads as all-new. A part-way failure
4216
+ * still watches what it wrote; a retry reports those rows as existing.
4217
+ */
4218
+ createContracts(paramsList: CreateContractParams[]): Promise<Contract[]>;
4182
4219
  /**
4183
4220
  * Lightweight variant of {@link createContract} for batch discovery
4184
4221
  * paths (currently: {@link scanContracts}). Validates, dedupes, persists,
@@ -4406,6 +4443,7 @@ declare class ContractManager implements IContractManager {
4406
4443
  * other contracts still need to pick up.
4407
4444
  */
4408
4445
  private syncContracts;
4446
+ private syncedWithin;
4409
4447
  /**
4410
4448
  * Demote every `awaiting-funds` contract in `contracts` that has been
4411
4449
  * funded — the automatic half of {@link ContractWatchState}.
@@ -6047,13 +6085,23 @@ interface TxKey {
6047
6085
  /** Arkade transaction id, when applicable. */
6048
6086
  arkTxid: string;
6049
6087
  }
6050
- /** The categories the history builder itself assigns. */
6051
- type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch";
6088
+ /**
6089
+ * The categories the history builder itself assigns.
6090
+ *
6091
+ * Four of them name the mechanism that moved the coin. `"gated"` names the
6092
+ * counterparty instead: an offchain row facing a contract row of this wallet's
6093
+ * that generic spending is closed on — a swap covenant, a lockup — which is the
6094
+ * same money {@link WalletBalance.gated} reports. History reads such a contract
6095
+ * as an external party, so the movement is a real send or receive rather than
6096
+ * change, and the tag is what lets a consumer tell "into my own escrow" from
6097
+ * "to a stranger" instead of the movement arriving unattributed.
6098
+ */
6099
+ type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch" | "gated";
6052
6100
  /**
6053
6101
  * The category the history builder assigns to a transaction. The `(string & {})`
6054
6102
  * arm keeps the union open — apps and resolvers can introduce their own
6055
6103
  * categories without a breaking change — while preserving editor autocomplete
6056
- * for the built-in four.
6104
+ * for the built-in ones.
6057
6105
  */
6058
6106
  type TxTag = BuiltinTxTag | (string & {});
6059
6107
  /**