@arkade-os/sdk 0.5.0-rc.21 → 0.5.0-rc.23

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 (72) hide show
  1. package/README.md +31 -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/{asyncStorageTaskQueue-x8ok3tJy.d.cts → asyncStorageTaskQueue-DUu3VwBE.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-aL7K14e4.d.ts → asyncStorageTaskQueue-Dm71_6ID.d.ts} +2 -2
  8. package/dist/{chunk-LNJPVLIC.js → chunk-B4CZLBE6.js} +4 -4
  9. package/dist/{chunk-LNJPVLIC.js.map → chunk-B4CZLBE6.js.map} +1 -1
  10. package/dist/{chunk-EXFU6MTA.js → chunk-ENGV6VZF.js} +511 -89
  11. package/dist/chunk-ENGV6VZF.js.map +1 -0
  12. package/dist/{chunk-R5OFJ23O.cjs → chunk-H7W2KLN2.cjs} +990 -565
  13. package/dist/chunk-H7W2KLN2.cjs.map +1 -0
  14. package/dist/{chunk-VZMLADXQ.cjs → chunk-JETDFDWV.cjs} +10 -10
  15. package/dist/{chunk-VZMLADXQ.cjs.map → chunk-JETDFDWV.cjs.map} +1 -1
  16. package/dist/{chunk-5XBH5SAL.cjs → chunk-KR6FLFIH.cjs} +3 -3
  17. package/dist/{chunk-5XBH5SAL.cjs.map → chunk-KR6FLFIH.cjs.map} +1 -1
  18. package/dist/{chunk-GVF4OCTL.cjs → chunk-QLJXXVRO.cjs} +48 -48
  19. package/dist/{chunk-GVF4OCTL.cjs.map → chunk-QLJXXVRO.cjs.map} +1 -1
  20. package/dist/{chunk-JZAEFOE4.js → chunk-SPJA7XMU.js} +3 -3
  21. package/dist/{chunk-JZAEFOE4.js.map → chunk-SPJA7XMU.js.map} +1 -1
  22. package/dist/{chunk-CXHJGED6.js → chunk-UDQ3QE4C.js} +3 -3
  23. package/dist/{chunk-CXHJGED6.js.map → chunk-UDQ3QE4C.js.map} +1 -1
  24. package/dist/{chunk-S2WWOVFC.js → chunk-W2VYRZLB.js} +4 -4
  25. package/dist/{chunk-S2WWOVFC.js.map → chunk-W2VYRZLB.js.map} +1 -1
  26. package/dist/{chunk-4FDNOLBO.js → chunk-XZEQV5FE.js} +3 -3
  27. package/dist/{chunk-4FDNOLBO.js.map → chunk-XZEQV5FE.js.map} +1 -1
  28. package/dist/{chunk-Q7PC3NHX.cjs → chunk-YFHGGSII.cjs} +18 -18
  29. package/dist/{chunk-Q7PC3NHX.cjs.map → chunk-YFHGGSII.cjs.map} +1 -1
  30. package/dist/{chunk-HIZNPHB2.cjs → chunk-ZDLFQ7ZH.cjs} +15 -15
  31. package/dist/{chunk-HIZNPHB2.cjs.map → chunk-ZDLFQ7ZH.cjs.map} +1 -1
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-BT5iON1T.d.ts → delegate-DATx5c2o.d.ts} +1 -1
  37. package/dist/{delegate-u6kXTtWY.d.cts → delegate-DRoyCz4n.d.cts} +1 -1
  38. package/dist/{index-CK5QbTmZ.d.ts → index-BKBoBSKX.d.cts} +83 -9
  39. package/dist/{index-CK5QbTmZ.d.cts → index-BKBoBSKX.d.ts} +83 -9
  40. package/dist/{index-D1D4cR-G.d.ts → index-BjDUwnH-.d.ts} +2 -2
  41. package/dist/{index-BCnhItOQ.d.cts → index-CLgF0km0.d.cts} +2 -2
  42. package/dist/index.cjs +321 -309
  43. package/dist/index.d.cts +78 -16
  44. package/dist/index.d.ts +78 -16
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +35 -35
  47. package/dist/repositories/realm/index.d.cts +2 -2
  48. package/dist/repositories/realm/index.d.ts +2 -2
  49. package/dist/repositories/realm/index.js +5 -5
  50. package/dist/repositories/sqlite/index.cjs +33 -33
  51. package/dist/repositories/sqlite/index.d.cts +2 -2
  52. package/dist/repositories/sqlite/index.d.ts +2 -2
  53. package/dist/repositories/sqlite/index.js +5 -5
  54. package/dist/{taskRunner-BeYR6NpQ.d.ts → taskRunner-B78rNRXB.d.ts} +2 -2
  55. package/dist/{taskRunner-Csey3EYJ.d.cts → taskRunner-CoGRmz1U.d.cts} +2 -2
  56. package/dist/wallet/expo/background.cjs +14 -14
  57. package/dist/wallet/expo/background.d.cts +3 -3
  58. package/dist/wallet/expo/background.d.ts +3 -3
  59. package/dist/wallet/expo/background.js +6 -6
  60. package/dist/wallet/expo/index.cjs +15 -15
  61. package/dist/wallet/expo/index.d.cts +4 -4
  62. package/dist/wallet/expo/index.d.ts +4 -4
  63. package/dist/wallet/expo/index.js +5 -5
  64. package/dist/{wallet-DzSLMxBZ.d.ts → wallet-CdUjdg15.d.cts} +23 -5
  65. package/dist/{wallet-DG3Qmbmt.d.cts → wallet-yKzfCUfY.d.ts} +23 -5
  66. package/dist/worker/expo/index.cjs +9 -9
  67. package/dist/worker/expo/index.d.cts +4 -4
  68. package/dist/worker/expo/index.d.ts +4 -4
  69. package/dist/worker/expo/index.js +5 -5
  70. package/package.json +1 -1
  71. package/dist/chunk-EXFU6MTA.js.map +0 -1
  72. package/dist/chunk-R5OFJ23O.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQ7PC3NHX_cjs = require('./chunk-Q7PC3NHX.cjs');
4
- var chunk5XBH5SAL_cjs = require('./chunk-5XBH5SAL.cjs');
3
+ var chunkYFHGGSII_cjs = require('./chunk-YFHGGSII.cjs');
4
+ var chunkKR6FLFIH_cjs = require('./chunk-KR6FLFIH.cjs');
5
5
 
6
6
  // src/providers/expoUtils.ts
7
7
  async function getExpoFetch(options) {
@@ -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 chunk5XBH5SAL_cjs.baseFetch;
23
+ return chunkKR6FLFIH_cjs.baseFetch;
24
24
  }
25
25
  }
26
26
  async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
@@ -80,8 +80,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
80
80
  }
81
81
 
82
82
  // src/providers/expoArk.ts
83
- var ExpoArkProvider = class extends chunk5XBH5SAL_cjs.RestArkProvider {
84
- constructor(serverUrl = chunk5XBH5SAL_cjs.DEFAULT_ARKADE_SERVER_URL) {
83
+ var ExpoArkProvider = class extends chunkKR6FLFIH_cjs.RestArkProvider {
84
+ constructor(serverUrl = chunkKR6FLFIH_cjs.DEFAULT_ARKADE_SERVER_URL) {
85
85
  super(serverUrl);
86
86
  }
87
87
  async *getEventStream(signal, topics) {
@@ -94,7 +94,7 @@ var ExpoArkProvider = class extends chunk5XBH5SAL_cjs.RestArkProvider {
94
94
  url + queryParams,
95
95
  signal,
96
96
  expoFetch,
97
- chunk5XBH5SAL_cjs.ARKADE_VERSION_HEADERS,
97
+ chunkKR6FLFIH_cjs.ARKADE_VERSION_HEADERS,
98
98
  (data) => {
99
99
  const eventData = data.result || data;
100
100
  if (eventData.heartbeat !== void 0) {
@@ -107,7 +107,7 @@ var ExpoArkProvider = class extends chunk5XBH5SAL_cjs.RestArkProvider {
107
107
  if (error instanceof Error && error.name === "AbortError") {
108
108
  break;
109
109
  }
110
- if (chunk5XBH5SAL_cjs.isFetchTimeoutError(error)) {
110
+ if (chunkKR6FLFIH_cjs.isFetchTimeoutError(error)) {
111
111
  console.debug("Timeout error ignored");
112
112
  continue;
113
113
  }
@@ -121,14 +121,14 @@ var ExpoArkProvider = class extends chunk5XBH5SAL_cjs.RestArkProvider {
121
121
  const url = `${this.serverUrl}/v1/txs`;
122
122
  while (!signal?.aborted) {
123
123
  try {
124
- yield* sseStreamIterator(url, signal, expoFetch, chunk5XBH5SAL_cjs.ARKADE_VERSION_HEADERS, (data) => {
124
+ yield* sseStreamIterator(url, signal, expoFetch, chunkKR6FLFIH_cjs.ARKADE_VERSION_HEADERS, (data) => {
125
125
  return this.parseTransactionNotification(data.result);
126
126
  });
127
127
  } catch (error) {
128
128
  if (error instanceof Error && error.name === "AbortError") {
129
129
  break;
130
130
  }
131
- if (chunk5XBH5SAL_cjs.isFetchTimeoutError(error)) {
131
+ if (chunkKR6FLFIH_cjs.isFetchTimeoutError(error)) {
132
132
  console.debug("Timeout error ignored");
133
133
  continue;
134
134
  }
@@ -140,8 +140,8 @@ var ExpoArkProvider = class extends chunk5XBH5SAL_cjs.RestArkProvider {
140
140
  };
141
141
 
142
142
  // src/providers/expoIndexer.ts
143
- var ExpoIndexerProvider = class extends chunkQ7PC3NHX_cjs.RestIndexerProvider {
144
- constructor(serverUrl = chunk5XBH5SAL_cjs.DEFAULT_ARKADE_SERVER_URL) {
143
+ var ExpoIndexerProvider = class extends chunkYFHGGSII_cjs.RestIndexerProvider {
144
+ constructor(serverUrl = chunkKR6FLFIH_cjs.DEFAULT_ARKADE_SERVER_URL) {
145
145
  super(serverUrl);
146
146
  }
147
147
  async *getSubscription(subscriptionId, abortSignal) {
@@ -167,7 +167,7 @@ var ExpoIndexerProvider = class extends chunkQ7PC3NHX_cjs.RestIndexerProvider {
167
167
  return null;
168
168
  }
169
169
  if (data.event) {
170
- return chunkQ7PC3NHX_cjs.toSubscriptionResponse(data.event);
170
+ return chunkYFHGGSII_cjs.toSubscriptionResponse(data.event);
171
171
  }
172
172
  return null;
173
173
  }
@@ -176,7 +176,7 @@ var ExpoIndexerProvider = class extends chunkQ7PC3NHX_cjs.RestIndexerProvider {
176
176
  if (error instanceof Error && error.name === "AbortError") {
177
177
  break;
178
178
  }
179
- if (chunk5XBH5SAL_cjs.isFetchTimeoutError(error)) {
179
+ if (chunkKR6FLFIH_cjs.isFetchTimeoutError(error)) {
180
180
  console.debug("Timeout error ignored");
181
181
  continue;
182
182
  }
@@ -189,5 +189,5 @@ var ExpoIndexerProvider = class extends chunkQ7PC3NHX_cjs.RestIndexerProvider {
189
189
 
190
190
  exports.ExpoArkProvider = ExpoArkProvider;
191
191
  exports.ExpoIndexerProvider = ExpoIndexerProvider;
192
- //# sourceMappingURL=chunk-HIZNPHB2.cjs.map
193
- //# sourceMappingURL=chunk-HIZNPHB2.cjs.map
192
+ //# sourceMappingURL=chunk-ZDLFQ7ZH.cjs.map
193
+ //# sourceMappingURL=chunk-ZDLFQ7ZH.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["baseFetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","ARKADE_VERSION_HEADERS","isFetchTimeoutError","RestIndexerProvider","toSubscriptionResponse"],"mappings":";;;;;;AAUA,eAAsB,aAAa,OAAA,EAA4D;AAC3F,EAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,KAAA;AAE5C,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAAA,OAAA,CAAQ,MAAM,gCAAgC,CAAA;AAC9C,IAAA,OAAO,eAAA,CAAgB,KAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AACZ,IAAA,IAAI,WAAA,EAAa;AACb,MAAA,MAAM,IAAI,KAAA;AAAA,QACN;AAAA,OAEJ;AAAA,IACJ;AAEA,IAAA,OAAA,CAAQ,IAAA;AAAA,MACJ,wGAAA;AAAA,MAEA;AAAA,KACJ;AACA,IAAA,OAAOA,2BAAA;AAAA,EACX;AACJ;AAYA,gBAAuB,iBAAA,CACnB,GAAA,EACA,WAAA,EACA,OAAA,EACA,SACA,SAAA,EACgC;AAChC,EAAA,MAAM,eAAA,GAAkB,IAAI,eAAA,EAAgB;AAC5C,EAAA,MAAM,OAAA,GAAU,MAAM,eAAA,CAAgB,KAAA,EAAM;AAC5C,E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AsC;AAEnC,YAAA,IAAI,IAAA,CAAK,cAAc,KAAA,CAAA,EAAW;AAE9B,cAAA,OAAO,IAAA;AAAA,YACX;AAEA,YAAA,IAAI,KAAK,KAAA,EAAO;AACZ,cAAA,OAAOI,wCAAA,CAAuB,KAAK,KAAK,CAAA;AAAA,YAC5C;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-HIZNPHB2.cjs","sourcesContent":["import { baseFetch, fetch } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch, falling back to {@link baseFetch}.\n *\n * Adds no headers of its own: both Expo providers share this function but reach\n * different origins, so each passes its own per request.\n *\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 return expoFetchModule.fetch 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 baseFetch;\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 // `baseFetch`, which bounds any read that brings no signal of its\n // own. Drop this and 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\";\nimport { ARKADE_VERSION_HEADERS } from \"../utils/fetch\";\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(\n url + queryParams,\n signal,\n expoFetch,\n ARKADE_VERSION_HEADERS,\n (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 );\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, ARKADE_VERSION_HEADERS, (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, toSubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\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({ requireExpo: isReactNative }).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 toSubscriptionResponse(data.event);\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
+ {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["baseFetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","ARKADE_VERSION_HEADERS","isFetchTimeoutError","RestIndexerProvider","toSubscriptionResponse"],"mappings":";;;;;;AAUA,eAAsB,aAAa,OAAA,EAA4D;AAC3F,EAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,KAAA;AAE5C,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAAA,OAAA,CAAQ,MAAM,gCAAgC,CAAA;AAC9C,IAAA,OAAO,eAAA,CAAgB,KAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AACZ,IAAA,IAAI,WAAA,EAAa;AACb,MAAA,MAAM,IAAI,KAAA;AAAA,QACN;AAAA,OAEJ;AAAA,IACJ;AAEA,IAAA,OAAA,CAAQ,IAAA;AAAA,MACJ,wGAAA;AAAA,MAEA;AAAA,KACJ;AACA,IAAA,OAAOA,2BAAA;AAAA,EACX;AACJ;AAYA,gBAAuB,iBAAA,CACnB,GAAA,EACA,WAAA,EACA,OAAA,EACA,SACA,SAAA,EACgC;AAChC,EAAA,MAAM,eAAA,GAAkB,IAAI,eAAA,EAAgB;AAC5C,EAAA,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A,EAAE,gBAAgB,kBAAA,EAAmB;AAAA,UACrC,CAAC,IAAA,KAAsC;AAEnC,YAAA,IAAI,IAAA,CAAK,cAAc,KAAA,CAAA,EAAW;AAE9B,cAAA,OAAO,IAAA;AAAA,YACX;AAEA,YAAA,IAAI,KAAK,KAAA,EAAO;AACZ,cAAA,OAAOI,wCAAA,CAAuB,KAAK,KAAK,CAAA;AAAA,YAC5C;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-ZDLFQ7ZH.cjs","sourcesContent":["import { baseFetch, fetch } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch, falling back to {@link baseFetch}.\n *\n * Adds no headers of its own: both Expo providers share this function but reach\n * different origins, so each passes its own per request.\n *\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 return expoFetchModule.fetch 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 baseFetch;\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 // `baseFetch`, which bounds any read that brings no signal of its\n // own. Drop this and 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\";\nimport { ARKADE_VERSION_HEADERS } from \"../utils/fetch\";\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(\n url + queryParams,\n signal,\n expoFetch,\n ARKADE_VERSION_HEADERS,\n (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 );\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, ARKADE_VERSION_HEADERS, (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, toSubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\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({ requireExpo: isReactNative }).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 toSubscriptionResponse(data.event);\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,37 +1,37 @@
1
1
  'use strict';
2
2
 
3
- var chunkGVF4OCTL_cjs = require('../../chunk-GVF4OCTL.cjs');
4
- require('../../chunk-5XBH5SAL.cjs');
3
+ var chunkQLJXXVRO_cjs = require('../../chunk-QLJXXVRO.cjs');
4
+ require('../../chunk-KR6FLFIH.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "ArkadeContractHandler", {
9
9
  enumerable: true,
10
- get: function () { return chunkGVF4OCTL_cjs.ArkadeContractHandler; }
10
+ get: function () { return chunkQLJXXVRO_cjs.ArkadeContractHandler; }
11
11
  });
12
12
  Object.defineProperty(exports, "BoardingContractHandler", {
13
13
  enumerable: true,
14
- get: function () { return chunkGVF4OCTL_cjs.BoardingContractHandler; }
14
+ get: function () { return chunkQLJXXVRO_cjs.BoardingContractHandler; }
15
15
  });
16
16
  Object.defineProperty(exports, "DefaultContractHandler", {
17
17
  enumerable: true,
18
- get: function () { return chunkGVF4OCTL_cjs.DefaultContractHandler; }
18
+ get: function () { return chunkQLJXXVRO_cjs.DefaultContractHandler; }
19
19
  });
20
20
  Object.defineProperty(exports, "DelegateContractHandler", {
21
21
  enumerable: true,
22
- get: function () { return chunkGVF4OCTL_cjs.DelegateContractHandler; }
22
+ get: function () { return chunkQLJXXVRO_cjs.DelegateContractHandler; }
23
23
  });
24
24
  Object.defineProperty(exports, "VHTLCContractHandler", {
25
25
  enumerable: true,
26
- get: function () { return chunkGVF4OCTL_cjs.VHTLCContractHandler; }
26
+ get: function () { return chunkQLJXXVRO_cjs.VHTLCContractHandler; }
27
27
  });
28
28
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
29
29
  enumerable: true,
30
- get: function () { return chunkGVF4OCTL_cjs.VHTLCV2ContractHandler; }
30
+ get: function () { return chunkQLJXXVRO_cjs.VHTLCV2ContractHandler; }
31
31
  });
32
32
  Object.defineProperty(exports, "contractHandlers", {
33
33
  enumerable: true,
34
- get: function () { return chunkGVF4OCTL_cjs.contractHandlers; }
34
+ get: function () { return chunkQLJXXVRO_cjs.contractHandlers; }
35
35
  });
36
36
  //# sourceMappingURL=index.cjs.map
37
37
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-BCnhItOQ.cjs';
2
- import '../../index-CK5QbTmZ.cjs';
1
+ export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-CLgF0km0.cjs';
2
+ import '../../index-BKBoBSKX.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/psbt.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/transaction.js';
7
- import '../../delegate-u6kXTtWY.cjs';
7
+ import '../../delegate-DRoyCz4n.cjs';
@@ -1,7 +1,7 @@
1
- export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-D1D4cR-G.js';
2
- import '../../index-CK5QbTmZ.js';
1
+ export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-BjDUwnH-.js';
2
+ import '../../index-BKBoBSKX.js';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/psbt.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/transaction.js';
7
- import '../../delegate-BT5iON1T.js';
7
+ import '../../delegate-DATx5c2o.js';
@@ -1,4 +1,4 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-CXHJGED6.js';
2
- import '../../chunk-4FDNOLBO.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-UDQ3QE4C.js';
2
+ import '../../chunk-XZEQV5FE.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-CK5QbTmZ.js';
2
+ import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-BKBoBSKX.js';
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 { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-CK5QbTmZ.cjs';
2
+ import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-BKBoBSKX.cjs';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -2918,12 +2918,18 @@ interface ScanContractsOptions {
2918
2918
  * Freshness of the ContractManager's provider-backed sync. `degraded` means the most recent sync
2919
2919
  * hit a retryable indexer/operator failure and repository state is being served; it returns to
2920
2920
  * `online` on the next successful sync.
2921
+ *
2922
+ * `syncing` says a provider sync is in flight right now, so a read can be served from the
2923
+ * repository while the work that refreshes it runs on. Optional so adding it breaks no
2924
+ * implementer of this public interface; {@link ContractManager} always sets it.
2921
2925
  */
2922
2926
  type ContractSyncState = {
2923
2927
  mode: "online";
2928
+ syncing?: boolean;
2924
2929
  lastSyncedAt?: number;
2925
2930
  } | {
2926
2931
  mode: "degraded";
2932
+ syncing?: boolean;
2927
2933
  reason: string;
2928
2934
  lastSyncedAt?: number;
2929
2935
  };
@@ -2957,6 +2963,19 @@ interface IContractManager extends Disposable {
2957
2963
  }): Promise<ContractWithVtxos[]>;
2958
2964
  /** Latest provider-sync health. See {@link ContractSyncState}. */
2959
2965
  getSyncState(): ContractSyncState;
2966
+ /**
2967
+ * Contracts with their repository VTXOs, answered without waiting on the indexer. A sync
2968
+ * older than `vtxoSyncMaxAgeMs` is requested in the background (skipped while the lazy boot
2969
+ * runs); check {@link getSyncState} before trusting the result. For display, never coin
2970
+ * selection.
2971
+ */
2972
+ getStoredContractsWithVtxos?(filter?: GetContractsFilter): Promise<ContractWithVtxos[]>;
2973
+ /**
2974
+ * Settles when the `lazyInitialization` boot (look-ahead drain, reconcile, watcher start)
2975
+ * finishes; immediately when there is none. Never rejects: a failed boot is reported through
2976
+ * {@link getSyncState}.
2977
+ */
2978
+ whenBooted?(): Promise<void>;
2960
2979
  /**
2961
2980
  * Stamp raw virtual outputs with their contract's tapscripts (forfeit, intent, tap tree).
2962
2981
  * Throws when a vtxo's script has no registered contract, so the wallet never silently stamps
@@ -3097,8 +3116,10 @@ interface IContractManager extends Disposable {
3097
3116
  getWatchedScripts?(): Promise<WatchedScript[]>;
3098
3117
  /** Whether the underlying watcher is currently active. */
3099
3118
  isWatching(): Promise<boolean>;
3100
- /** Release resources (stop watching, clear listeners). */
3101
- dispose(): void;
3119
+ /**
3120
+ * Release resources (stop watching, clear listeners) and wait for in-flight repository writes.
3121
+ */
3122
+ dispose(): Promise<void>;
3102
3123
  }
3103
3124
  /** Options for getting spendable paths. */
3104
3125
  type GetSpendablePathsOptions = {
@@ -3120,6 +3141,8 @@ type GetAllSpendingPathsOptions = {
3120
3141
  };
3121
3142
  /** Configuration for the ContractManager. */
3122
3143
  interface ContractManagerConfig {
3144
+ /** Opt in to background boot; inspect getSyncState() before using cached data. */
3145
+ lazyInitialization?: boolean;
3123
3146
  indexerProvider: IndexerProvider;
3124
3147
  contractRepository: ContractRepository;
3125
3148
  /** Virtual output storage (single source of truth). */
@@ -3243,11 +3266,18 @@ declare class ContractManager implements IContractManager {
3243
3266
  private initialized;
3244
3267
  private eventCallbacks;
3245
3268
  private stopWatcherFn?;
3269
+ /** Watcher events still being handled. They write VTXO rows, so {@link dispose} waits for them. */
3270
+ private readonly inFlightEvents;
3246
3271
  /** `undefined` while online; the failure reason once a sync degrades. */
3247
3272
  private syncDegradedReason?;
3248
3273
  /** Epoch-ms of the last successful provider sync, if any. */
3249
3274
  private lastSyncedAt?;
3250
3275
  private syncedAtByScript;
3276
+ private syncsInFlight;
3277
+ /** The off-critical-path boot sequence, if one is running. @see runBootSequence */
3278
+ private bootTask?;
3279
+ /** A catch-up sync requested behind a stored read. @see requestCatchUpSync */
3280
+ private catchUpSync?;
3251
3281
  /** Last chain tip read, with the epoch-ms it was read at. @see currentChainTip */
3252
3282
  private chainTipCache?;
3253
3283
  /** In-flight chain tip read, so concurrent cache misses share one. */
@@ -3275,6 +3305,8 @@ declare class ContractManager implements IContractManager {
3275
3305
  * {@link initialize}, {@link getContractsWithVtxos} and {@link createContract}.
3276
3306
  */
3277
3307
  getSyncState(): ContractSyncState;
3308
+ /** @inheritdoc */
3309
+ whenBooted(): Promise<void>;
3278
3310
  /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
3279
3311
  setVtxoSyncMaxAge(maxAgeMs: number): void;
3280
3312
  /** @see ContractManagerConfig.vtxoSyncOverlapMs — for factory-built managers. */
@@ -3286,6 +3318,8 @@ declare class ContractManager implements IContractManager {
3286
3318
  * would claim coverage the wallet never had.
3287
3319
  */
3288
3320
  private syncGapReason;
3321
+ /** Why the lazy boot's watcher start failed; nothing retries it, so no sync may clear it. */
3322
+ private watcherStartFailure?;
3289
3323
  /** Contracts a sync could not annotate, as `script → reason`. */
3290
3324
  private annotationFailures;
3291
3325
  private annotationDegradedReason;
@@ -3299,6 +3333,11 @@ declare class ContractManager implements IContractManager {
3299
3333
  private trySync;
3300
3334
  private markSyncDegraded;
3301
3335
  private initialize;
3336
+ private runBootSequence;
3337
+ /** Tracked so {@link dispose} can wait for handlers still writing. */
3338
+ private onWatcherEvent;
3339
+ /** No throw: construction returned long ago, so the state is the channel. */
3340
+ private reportBackgroundFailure;
3302
3341
  /**
3303
3342
  * Delta-sync the watched set (boot and reconnect), then reconcile the pending frontier, which
3304
3343
  * catches not-yet-finalized virtual outputs that can sit outside any delta window.
@@ -3409,6 +3448,8 @@ declare class ContractManager implements IContractManager {
3409
3448
  unspentOnly?: boolean;
3410
3449
  requireSynced?: boolean;
3411
3450
  }): Promise<ContractWithVtxos[]>;
3451
+ getStoredContractsWithVtxos(filter?: GetContractsFilter): Promise<ContractWithVtxos[]>;
3452
+ private requestCatchUpSync;
3412
3453
  annotateVtxos(vtxos: VirtualCoin[], tapscripts?: ContractTapscriptCache): Promise<NormalizedExtendedVirtualCoin[]>;
3413
3454
  /** @inheritdoc */
3414
3455
  assertAnnotatable(vtxos: readonly {
@@ -3488,6 +3529,7 @@ declare class ContractManager implements IContractManager {
3488
3529
  private getVtxosForContracts;
3489
3530
  /** Sync virtual outputs for the given contracts (default: the watched set). */
3490
3531
  private syncContracts;
3532
+ private performContractSync;
3491
3533
  private syncedWithin;
3492
3534
  /**
3493
3535
  * Demote every funded `awaiting-funds` contract to `retained` (see {@link ContractWatchState}).
@@ -3505,19 +3547,30 @@ declare class ContractManager implements IContractManager {
3505
3547
  private persistContractVtxos;
3506
3548
  private fetchContractVxosFromIndexer;
3507
3549
  private fetchContractVtxosBulk;
3508
- /** Stop the watcher, clear callbacks, and mark the manager uninitialized. */
3509
- dispose(): void;
3510
3550
  /**
3511
- * Symbol.dispose implementation for the `using` keyword.
3551
+ * Stop the watcher, clear callbacks, and mark the manager uninitialized.
3552
+ *
3553
+ * Teardown is synchronous. The returned promise settles once watcher events already being
3554
+ * handled, any look-ahead drain, and any lazy boot sequence finish; after that nothing more is written to the
3555
+ * repositories.
3556
+ */
3557
+ dispose(): Promise<void>;
3558
+ /**
3559
+ * Symbol.dispose implementation for the `using` keyword. Teardown is immediate, but it does
3560
+ * not wait for in-flight work; use `await using` for that.
3561
+ */
3562
+ [Symbol.dispose](): void;
3563
+ /**
3564
+ * Symbol.asyncDispose implementation for the `await using` keyword; waits like {@link dispose}.
3512
3565
  * @example
3513
3566
  * ```typescript
3514
3567
  * {
3515
- * using manager = await wallet.getContractManager();
3568
+ * await using manager = await wallet.getContractManager();
3516
3569
  * // ... use manager
3517
- * } // automatically disposed
3570
+ * } // disposed, with in-flight events finished
3518
3571
  * ```
3519
3572
  */
3520
- [Symbol.dispose](): void;
3573
+ [Symbol.asyncDispose](): Promise<void>;
3521
3574
  }
3522
3575
 
3523
3576
  /**
@@ -4425,6 +4478,8 @@ interface BaseWalletConfig {
4425
4478
  * ```
4426
4479
  */
4427
4480
  interface ReadonlyWalletConfig extends BaseWalletConfig {
4481
+ /** Opt in to background contract initialization for explicit stored reads. */
4482
+ lazyInitialization?: boolean;
4428
4483
  /** Readonly identity used to derive wallet addresses. */
4429
4484
  identity: ReadonlyIdentity;
4430
4485
  /**
@@ -4556,6 +4611,7 @@ interface WalletBalance {
4556
4611
  unconfirmed: number;
4557
4612
  /** Combined boarding balance (`confirmed` + `unconfirmed`) */
4558
4613
  total: number;
4614
+ loaded?: boolean;
4559
4615
  };
4560
4616
  /** Settled (finalized) balance the wallet owns, including gated and intent-locked funds. */
4561
4617
  settled: number;
@@ -4676,6 +4732,10 @@ interface Recipient {
4676
4732
  */
4677
4733
  tapTree?: Bytes;
4678
4734
  }
4735
+ type InputExpiryFloor = {
4736
+ readonly kind: "time" | "height";
4737
+ readonly value: bigint;
4738
+ };
4679
4739
  /** Object form of `IWallet.send`'s arguments; the variadic form has no slot for options. */
4680
4740
  interface SendParams {
4681
4741
  /** One or more recipients — the variadic arguments of the other form. */
@@ -4688,6 +4748,10 @@ interface SendParams {
4688
4748
  * @see IReadonlyWallet.getVtxos
4689
4749
  */
4690
4750
  selectedVtxos?: ExtendedVirtualCoin[];
4751
+ /** Refuse before provider submission at or after this UNIX timestamp in seconds. */
4752
+ validUntil?: number;
4753
+ /** Require every input's known expiry to be at least this UNIX-seconds or block-height floor. */
4754
+ inputExpiryFloor?: InputExpiryFloor;
4691
4755
  /** Maximum sats of unavoidable change this send may pay as an offchain fee. Defaults to any change below the operator's VTXO minimum; 0 disables it. */
4692
4756
  maxChangeFee?: number;
4693
4757
  }
@@ -5177,6 +5241,8 @@ interface IReadonlyWallet {
5177
5241
  getArkadeReader(): Promise<ArkadeReader>;
5178
5242
  /** @returns The wallet's combined onchain and offchain balance. */
5179
5243
  getBalance(): Promise<WalletBalance>;
5244
+ /** Cached display balance; check provider state and boarding.loaded. */
5245
+ getStoredBalance?(): Promise<WalletBalance>;
5180
5246
  /**
5181
5247
  * Get virtual outputs tracked by the wallet.
5182
5248
  *
@@ -5185,6 +5251,8 @@ interface IReadonlyWallet {
5185
5251
  * @see GetVtxosFilter
5186
5252
  */
5187
5253
  getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
5254
+ /** Cached display coins; may be incomplete until synchronization finishes. */
5255
+ getStoredVtxos?(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
5188
5256
  /**
5189
5257
  * The subset of {@link getVtxos} generic spending may select: minus gated contracts,
5190
5258
  * pending-recovery funds and intent-locked outpoints (all from one contract snapshot). Every
@@ -5196,6 +5264,12 @@ interface IReadonlyWallet {
5196
5264
  getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
5197
5265
  /** @returns Onchain boarding inputs tracked by the wallet. */
5198
5266
  getBoardingUtxos(): Promise<ExtendedCoin[]>;
5267
+ /**
5268
+ * Boarding inputs as last cached, with no onchain call: stale or empty until this wallet
5269
+ * instance has fetched them (see `WalletBalance.boarding.loaded`). For display, never coin
5270
+ * selection.
5271
+ */
5272
+ getStoredBoardingUtxos?(): Promise<ExtendedCoin[]>;
5199
5273
  /** @returns Wallet transaction history derived from boarding and Arkade activity. */
5200
5274
  getTransactionHistory(): Promise<ArkTransaction[]>;
5201
5275
  /** Resolvers that group/label {@link getActivityHistory} rows. */
@@ -5359,4 +5433,4 @@ declare function isBatchSignable(identity: Identity): identity is BatchSignableI
5359
5433
  */
5360
5434
  declare function isSigningIdentity(value: unknown): value is Identity;
5361
5435
 
5362
- export { type VirtualTx as $, type ArkadeInfo as A, type ExtendedVirtualCoin as B, type ContractRepository as C, type PageResult as D, type ExtendedCoin as E, type ScriptVtxoCursor as F, type GetArkadeInfoOptions as G, type ScriptVtxoPageOptions as H, type IWallet as I, type StoredVtxo as J, type VtxoRepositoryKey as K, type TransactionHistoryPageFilter as L, type TransactionHistoryPageCursor as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, type PageRequest as P, type WalletState as Q, type Recipient as R, type SettleParams as S, type TxNotificationEvent as T, type ContractFilter as U, VtxoScript as V, type WalletRepository as W, type IntentRepository as X, type ArkIntent as Y, type IntentPageFilter as Z, type VirtualTxRepository as _, type Identity as a, type DelegateInfo as a$, type VtxoBranch as a0, ChainedTxType as a1, type DescriptorProvider as a2, type DescriptorSigningRequest as a3, Transaction as a4, type Network as a5, CSVMultisigTapscript as a6, type BatchStartedEvent as a7, type TreeSigningStartedEvent as a8, TxTree as a9, type SignedIntent as aA, Intent as aB, type TimeHeight as aC, type IntentFeeConfig as aD, type OffchainInput as aE, FeeAmount as aF, type OnchainInput as aG, type FeeOutput as aH, type ContractWatcherConfig as aI, type Asset as aJ, type FeeInfo as aK, type GetVtxosOptions as aL, type PaginationOptions as aM, type CreateContractParams as aN, type GetContractsFilter as aO, type GetSpendablePathsOptions as aP, type GetAllSpendingPathsOptions as aQ, type IssuanceParams as aR, type ReissuanceParams as aS, type BurnParams as aT, type RenewVtxosOptions as aU, type NormalizedVtxoPage as aV, type WatchedScript as aW, type PathSelection as aX, type ContractEvent as aY, type AssetDetails as aZ, type IssuanceResult as a_, type TreeNoncesEvent as aa, type BatchFinalizationEvent as ab, type BatchFinalizedEvent as ac, type BatchFailedEvent as ad, type TreeTxEvent as ae, type TreeSignatureEvent as af, type IReadonlyWallet as ag, type ReadonlyIdentity as ah, type OnchainProvider as ai, type DelegateProvider as aj, type ReadonlyWalletConfig as ak, type ExitCaptureMode as al, type ExitDataSource as am, type IReadonlyAssetManager as an, type ContractSyncState as ao, type RecipientArkadeAddressContext as ap, type NetworkName as aq, ArkAddress as ar, type ContractWithVtxos as as, selectPendingRecoveryOutpoints as at, type Coin as au, ContractManager as av, type ContractManagerConfig as aw, type SettlementConfig as ax, VtxoManager as ay, type SignerSession as az, type WalletConfig as b, type MigrationLegReport as b$, type MigrationGlobalSkipReason as b0, type MigrationLegSkipReason as b1, type SignerStatus as b2, type StorageConfig as b3, type IVtxoManager as b4, type SendBitcoinParams as b5, type ExplorerTransaction as b6, type TreeNonces as b7, type TreePartialSigs as b8, type PendingTx as b9, DEFAULT_VTXO_PAGE_SIZE as bA, DelegateManagerImpl as bB, type DelegateOptions as bC, type DeprecatedSignerMigrationReport as bD, type DeprecatedSignerReport as bE, DigestMismatchError as bF, type Discoverable as bG, type DiscoveredContract as bH, type DiscoveryDeps as bI, ESPLORA_URL as bJ, EsploraProvider as bK, type EventSourceCapable as bL, type EventSourceFactory as bM, type EventSourceLike as bN, EventSourceUnavailableError as bO, type ExitChainResolver as bP, type ExtendedContractVtxo as bQ, type GroupMembership as bR, type HandlerError as bS, INTENT_TERMINAL_STATES as bT, IndexerTxType as bU, type IntentCoin as bV, type IntentFilter as bW, type KnownMetadata as bX, MAX_PAGE_SIZE as bY, MUTINYNET_EMULATOR_PUBKEY as bZ, type MigrateDeprecatedSignerOptions as b_, type EncodedVtxoScript as ba, type Status as bb, type ChainTx as bc, type PathContext as bd, type ActivityIntent as be, type ActivityResolver as bf, type ArkIntentState as bg, type ArkTapscript as bh, type AssetMetadata as bi, BITCOIN_EMULATOR_PUBKEY as bj, type BaseWalletConfig as bk, type BatchInfo as bl, type BatchSignableIdentity as bm, CLTVMultisigTapscript as bn, type CandidateDeps as bo, ChainTxType as bp, type CommitmentTx as bq, ConditionCSVMultisigTapscript as br, ConditionMultisigTapscript as bs, type ContractBalance as bt, type ContractEventCallback as bu, type ContractHandler as bv, type ContractState as bw, type ContractVtxo as bx, type ContractVtxoEvent as by, ContractWatcher as bz, type ArkadeReader as c, decodeTapscript as c$, type MigrationVtxoRef as c0, MultisigTapscript as c1, type NewAddressType as c2, type Nonces as c3, type Output as c4, type PageResponse as c5, PartialSig as c6, type PrevTxSource as c7, PrevTxUnavailableError as c8, type ProviderClass as c9, type VtxoChain as cA, type VtxoType as cB, type WalletMode as cC, type WithPrevTx as cD, assertAllowedSighashTypes as cE, assertPageRequest as cF, assertRecipientArkadeAddress as cG, assetMintResolver as cH, attachPrevArkTxs as cI, attachPrevoutTxs as cJ, boardingResolver as cK, canRecoverOnchain as cL, canSpendOffchain as cM, canSweepOnchain as cN, classifyAgainstSignerSet as cO, classifyContractSigner as cP, collabExitResolver as cQ, collectContracts as cR, collectIntents as cS, collectPages as cT, collectScriptVtxos as cU, collectTransactionHistory as cV, collectUtxos as cW, collectVtxos as cX, configureEventSource as cY, createDefaultActivityRegistry as cZ, createExitChainResolver as c_, REGTEST_EMULATOR_PUBKEY as ca, type RawTxSource as cb, type RenewalSplit as cc, type RenewalSplitContext as cd, RestDelegateProvider as ce, type ScanContractsOptions as cf, type ScanResult as cg, type ScheduledSession as ch, SettlementEventType as ci, type SignRequest as cj, type SignerClassification as ck, type SignerSet as cl, type SubscriptionEvent as cm, type SubscriptionHeartbeat as cn, type SweepTxNotification as co, type TapLeaves as cp, TapTreeCoder as cq, TapscriptType as cr, type Tx as cs, type TxHistoryRecord as ct, type TxKey as cu, type TxNotification as cv, type TxTag as cw, type TxTreeNode as cx, TxType as cy, type Vtxo as cz, type ArkadeBroadcaster as d, defaultEmulatorPubkey as d0, getAllNormalizedVtxos as d1, getConfiguredEventSource as d2, getNetwork as d3, getNormalizedVtxos as d4, getRandomId as d5, getSequence as d6, hasCandidates as d7, isBatchSignable as d8, isContractVtxoEvent as d9, isCooperativelyMigratable as da, isDiscoverable as db, isEventSourceUnavailableError as dc, isPastExpiry as dd, isSigningIdentity as de, isSubdust as df, isTerminalIntentState as dg, isVirtualCoin as dh, isVtxoExpiringSoon as di, isVtxoSpent as dj, iteratePages as dk, networkFromArkadeInfo as dl, networks as dm, pageResult as dn, resolveEmulatorPubkey as dp, resolveEventSource as dq, resolvePrevTxs as dr, scriptFromTapLeafScript as ds, signerSetFromInfo as dt, toXOnlySignerHex as du, withPrevTxs as dv, type TapscriptDeriving as dw, type WalletBalance as e, type GetVtxosFilter as f, type GetSpendableVtxosFilter as g, type ArkTransaction as h, ActivityRegistry as i, type Activity as j, type IContractManager as k, type GetNewAddressesOptions as l, type NewAddress as m, type IDelegateManager as n, type SettlementEvent as o, type SendParams as p, type IAssetManager as q, RestArkProvider as r, RestIndexerProvider as s, type SubscriptionResponse as t, type ArkProvider as u, type IndexerProvider as v, type RelativeTimelock as w, type TapLeafScript as x, type VirtualCoin as y, type Contract as z };
5436
+ export { type VirtualTx as $, type ArkadeInfo as A, type ExtendedVirtualCoin as B, type ContractRepository as C, type PageResult as D, type ExtendedCoin as E, type ScriptVtxoCursor as F, type GetArkadeInfoOptions as G, type ScriptVtxoPageOptions as H, type IWallet as I, type StoredVtxo as J, type VtxoRepositoryKey as K, type TransactionHistoryPageFilter as L, type TransactionHistoryPageCursor as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, type PageRequest as P, type WalletState as Q, type Recipient as R, type SettleParams as S, type TxNotificationEvent as T, type ContractFilter as U, VtxoScript as V, type WalletRepository as W, type IntentRepository as X, type ArkIntent as Y, type IntentPageFilter as Z, type VirtualTxRepository as _, type Identity as a, type IssuanceResult as a$, type VtxoBranch as a0, ChainedTxType as a1, type DescriptorProvider as a2, type DescriptorSigningRequest as a3, Transaction as a4, type Network as a5, CSVMultisigTapscript as a6, type BatchStartedEvent as a7, type TreeSigningStartedEvent as a8, TxTree as a9, type SignedIntent as aA, Intent as aB, type TimeHeight as aC, type IntentFeeConfig as aD, type OffchainInput as aE, FeeAmount as aF, type OnchainInput as aG, type FeeOutput as aH, type ContractWatcherConfig as aI, type Asset as aJ, type FeeInfo as aK, type GetVtxosOptions as aL, type PaginationOptions as aM, type CreateContractParams as aN, type GetContractsFilter as aO, type GetSpendablePathsOptions as aP, type GetAllSpendingPathsOptions as aQ, type InputExpiryFloor as aR, type IssuanceParams as aS, type ReissuanceParams as aT, type BurnParams as aU, type RenewVtxosOptions as aV, type NormalizedVtxoPage as aW, type WatchedScript as aX, type PathSelection as aY, type ContractEvent as aZ, type AssetDetails as a_, type TreeNoncesEvent as aa, type BatchFinalizationEvent as ab, type BatchFinalizedEvent as ac, type BatchFailedEvent as ad, type TreeTxEvent as ae, type TreeSignatureEvent as af, type IReadonlyWallet as ag, type ReadonlyIdentity as ah, type OnchainProvider as ai, type DelegateProvider as aj, type ReadonlyWalletConfig as ak, type ExitCaptureMode as al, type ExitDataSource as am, type IReadonlyAssetManager as an, type ContractSyncState as ao, type RecipientArkadeAddressContext as ap, type NetworkName as aq, ArkAddress as ar, type ContractWithVtxos as as, selectPendingRecoveryOutpoints as at, type Coin as au, ContractManager as av, type ContractManagerConfig as aw, type SettlementConfig as ax, VtxoManager as ay, type SignerSession as az, type WalletConfig as b, type MigrateDeprecatedSignerOptions as b$, type DelegateInfo as b0, type MigrationGlobalSkipReason as b1, type MigrationLegSkipReason as b2, type SignerStatus as b3, type StorageConfig as b4, type IVtxoManager as b5, type SendBitcoinParams as b6, type ExplorerTransaction as b7, type TreeNonces as b8, type TreePartialSigs as b9, ContractWatcher as bA, DEFAULT_VTXO_PAGE_SIZE as bB, DelegateManagerImpl as bC, type DelegateOptions as bD, type DeprecatedSignerMigrationReport as bE, type DeprecatedSignerReport as bF, DigestMismatchError as bG, type Discoverable as bH, type DiscoveredContract as bI, type DiscoveryDeps as bJ, ESPLORA_URL as bK, EsploraProvider as bL, type EventSourceCapable as bM, type EventSourceFactory as bN, type EventSourceLike as bO, EventSourceUnavailableError as bP, type ExitChainResolver as bQ, type ExtendedContractVtxo as bR, type GroupMembership as bS, type HandlerError as bT, INTENT_TERMINAL_STATES as bU, IndexerTxType as bV, type IntentCoin as bW, type IntentFilter as bX, type KnownMetadata as bY, MAX_PAGE_SIZE as bZ, MUTINYNET_EMULATOR_PUBKEY as b_, type PendingTx as ba, type EncodedVtxoScript as bb, type Status as bc, type ChainTx as bd, type PathContext as be, type ActivityIntent as bf, type ActivityResolver as bg, type ArkIntentState as bh, type ArkTapscript as bi, type AssetMetadata as bj, BITCOIN_EMULATOR_PUBKEY as bk, type BaseWalletConfig as bl, type BatchInfo as bm, type BatchSignableIdentity as bn, CLTVMultisigTapscript as bo, type CandidateDeps as bp, ChainTxType as bq, type CommitmentTx as br, ConditionCSVMultisigTapscript as bs, ConditionMultisigTapscript as bt, type ContractBalance as bu, type ContractEventCallback as bv, type ContractHandler as bw, type ContractState as bx, type ContractVtxo as by, type ContractVtxoEvent as bz, type ArkadeReader as c, createExitChainResolver as c$, type MigrationLegReport as c0, type MigrationVtxoRef as c1, MultisigTapscript as c2, type NewAddressType as c3, type Nonces as c4, type Output as c5, type PageResponse as c6, PartialSig as c7, type PrevTxSource as c8, PrevTxUnavailableError as c9, type Vtxo as cA, type VtxoChain as cB, type VtxoType as cC, type WalletMode as cD, type WithPrevTx as cE, assertAllowedSighashTypes as cF, assertPageRequest as cG, assertRecipientArkadeAddress as cH, assetMintResolver as cI, attachPrevArkTxs as cJ, attachPrevoutTxs as cK, boardingResolver as cL, canRecoverOnchain as cM, canSpendOffchain as cN, canSweepOnchain as cO, classifyAgainstSignerSet as cP, classifyContractSigner as cQ, collabExitResolver as cR, collectContracts as cS, collectIntents as cT, collectPages as cU, collectScriptVtxos as cV, collectTransactionHistory as cW, collectUtxos as cX, collectVtxos as cY, configureEventSource as cZ, createDefaultActivityRegistry as c_, type ProviderClass as ca, REGTEST_EMULATOR_PUBKEY as cb, type RawTxSource as cc, type RenewalSplit as cd, type RenewalSplitContext as ce, RestDelegateProvider as cf, type ScanContractsOptions as cg, type ScanResult as ch, type ScheduledSession as ci, SettlementEventType as cj, type SignRequest as ck, type SignerClassification as cl, type SignerSet as cm, type SubscriptionEvent as cn, type SubscriptionHeartbeat as co, type SweepTxNotification as cp, type TapLeaves as cq, TapTreeCoder as cr, TapscriptType as cs, type Tx as ct, type TxHistoryRecord as cu, type TxKey as cv, type TxNotification as cw, type TxTag as cx, type TxTreeNode as cy, TxType as cz, type ArkadeBroadcaster as d, decodeTapscript as d0, defaultEmulatorPubkey as d1, getAllNormalizedVtxos as d2, getConfiguredEventSource as d3, getNetwork as d4, getNormalizedVtxos as d5, getRandomId as d6, getSequence as d7, hasCandidates as d8, isBatchSignable as d9, isContractVtxoEvent as da, isCooperativelyMigratable as db, isDiscoverable as dc, isEventSourceUnavailableError as dd, isPastExpiry as de, isSigningIdentity as df, isSubdust as dg, isTerminalIntentState as dh, isVirtualCoin as di, isVtxoExpiringSoon as dj, isVtxoSpent as dk, iteratePages as dl, networkFromArkadeInfo as dm, networks as dn, pageResult as dp, resolveEmulatorPubkey as dq, resolveEventSource as dr, resolvePrevTxs as ds, scriptFromTapLeafScript as dt, signerSetFromInfo as du, toXOnlySignerHex as dv, withPrevTxs as dw, type TapscriptDeriving as dx, type WalletBalance as e, type GetVtxosFilter as f, type GetSpendableVtxosFilter as g, type ArkTransaction as h, ActivityRegistry as i, type Activity as j, type IContractManager as k, type GetNewAddressesOptions as l, type NewAddress as m, type IDelegateManager as n, type SettlementEvent as o, type SendParams as p, type IAssetManager as q, RestArkProvider as r, RestIndexerProvider as s, type SubscriptionResponse as t, type ArkProvider as u, type IndexerProvider as v, type RelativeTimelock as w, type TapLeafScript as x, type VirtualCoin as y, type Contract as z };