@arkade-os/sdk 0.4.66 → 0.4.67

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 +66 -15
  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-BZcIN7sA.d.cts → asyncStorageTaskQueue-LTpeXYaD.d.cts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
  10. package/dist/{chunk-ZIRFXBKL.cjs → chunk-2JV4VQ7C.cjs} +33 -13
  11. package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
  12. package/dist/{chunk-J33ZEM3A.js → chunk-3WIWNE4P.js} +33 -14
  13. package/dist/chunk-3WIWNE4P.js.map +1 -0
  14. package/dist/{chunk-CYOI4PEA.js → chunk-6TAQF6EV.js} +107 -13
  15. package/dist/chunk-6TAQF6EV.js.map +1 -0
  16. package/dist/{chunk-DSC3G6QZ.js → chunk-AEWJU6NZ.js} +1006 -167
  17. package/dist/chunk-AEWJU6NZ.js.map +1 -0
  18. package/dist/{chunk-3S3JZUEN.cjs → chunk-CO3KKSWM.cjs} +17 -17
  19. package/dist/{chunk-3S3JZUEN.cjs.map → chunk-CO3KKSWM.cjs.map} +1 -1
  20. package/dist/{chunk-55ZZ6RBL.js → chunk-EALWOVHK.js} +4 -4
  21. package/dist/{chunk-55ZZ6RBL.js.map → chunk-EALWOVHK.js.map} +1 -1
  22. package/dist/{chunk-5E6IZNRG.cjs → chunk-MJUTO3PY.cjs} +1413 -563
  23. package/dist/chunk-MJUTO3PY.cjs.map +1 -0
  24. package/dist/{chunk-R5POS3RS.js → chunk-MZFUZUTQ.js} +4 -4
  25. package/dist/{chunk-R5POS3RS.js.map → chunk-MZFUZUTQ.js.map} +1 -1
  26. package/dist/{chunk-PXPPZF5K.cjs → chunk-OIZ2V2VD.cjs} +152 -58
  27. package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
  28. package/dist/{chunk-IM6IKNSL.cjs → chunk-R2YAMONM.cjs} +17 -17
  29. package/dist/{chunk-IM6IKNSL.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
  30. package/dist/{chunk-2JZGPXU4.js → chunk-X3VEMUVV.js} +3 -3
  31. package/dist/{chunk-2JZGPXU4.js.map → chunk-X3VEMUVV.js.map} +1 -1
  32. package/dist/{chunk-LL47QIHD.cjs → chunk-YDRZDZPP.cjs} +10 -10
  33. package/dist/{chunk-LL47QIHD.cjs.map → chunk-YDRZDZPP.cjs.map} +1 -1
  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-YXupcWWJ.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
  39. package/dist/{delegate-T-vgxMYZ.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
  40. package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +318 -127
  41. package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +318 -127
  42. package/dist/{index-e7LYXk1d.d.cts → index-BiACuWaf.d.ts} +109 -13
  43. package/dist/{index-D_FgwLH9.d.ts → index-D2GjZxBr.d.cts} +109 -13
  44. package/dist/{index-uUE_uQPn.d.ts → index-DU5o_hz7.d.cts} +206 -19
  45. package/dist/{index-uUE_uQPn.d.cts → index-DU5o_hz7.d.ts} +206 -19
  46. package/dist/index.cjs +322 -278
  47. package/dist/index.d.cts +291 -41
  48. package/dist/index.d.ts +291 -41
  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-BOVcIH1N.d.cts → taskRunner-BZJMLQ6g.d.cts} +2 -2
  59. package/dist/{taskRunner-DNyD1kXG.d.ts → taskRunner-DATaRQus.d.ts} +2 -2
  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 +18 -14
  65. package/dist/wallet/expo/index.cjs.map +1 -1
  66. package/dist/wallet/expo/index.d.cts +7 -5
  67. package/dist/wallet/expo/index.d.ts +7 -5
  68. package/dist/wallet/expo/index.js +10 -6
  69. package/dist/wallet/expo/index.js.map +1 -1
  70. package/dist/worker/expo/index.cjs +9 -9
  71. package/dist/worker/expo/index.d.cts +4 -4
  72. package/dist/worker/expo/index.d.ts +4 -4
  73. package/dist/worker/expo/index.js +5 -5
  74. package/package.json +3 -3
  75. package/dist/chunk-5E6IZNRG.cjs.map +0 -1
  76. package/dist/chunk-CYOI4PEA.js.map +0 -1
  77. package/dist/chunk-DSC3G6QZ.js.map +0 -1
  78. package/dist/chunk-J33ZEM3A.js.map +0 -1
  79. package/dist/chunk-PXPPZF5K.cjs.map +0 -1
  80. package/dist/chunk-ZIRFXBKL.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { RestIndexerProvider } from './chunk-2JZGPXU4.js';
2
- import { RestArkProvider, DEFAULT_ARKADE_SERVER_URL, isFetchTimeoutError, convertVtxo, buildVersion, sdkVersion, fetch } from './chunk-J33ZEM3A.js';
1
+ import { RestIndexerProvider } from './chunk-X3VEMUVV.js';
2
+ import { RestArkProvider, DEFAULT_ARKADE_SERVER_URL, isFetchTimeoutError, convertVtxo, buildVersion, sdkVersion, fetch } from './chunk-3WIWNE4P.js';
3
3
 
4
4
  // src/providers/expoUtils.ts
5
5
  async function getExpoFetch(options) {
@@ -185,5 +185,5 @@ var ExpoIndexerProvider = class extends RestIndexerProvider {
185
185
  };
186
186
 
187
187
  export { ExpoArkProvider, ExpoIndexerProvider };
188
- //# sourceMappingURL=chunk-R5POS3RS.js.map
189
- //# sourceMappingURL=chunk-R5POS3RS.js.map
188
+ //# sourceMappingURL=chunk-MZFUZUTQ.js.map
189
+ //# sourceMappingURL=chunk-MZFUZUTQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":[],"mappings":";;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAAA,OAAA,CAAQ,MAAM,gCAAgC,CAAA;AAC9C,IAAA,MAAM,mBAAA,GAAsB,CAAC,KAAA,EAAoB,IAAA,KAAuB;AACpE,MAAA,MAAM,OAAA,GAAU,IAAI,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA;AACzC,MAAA,OAAA,CAAQ,GAAA,CAAI,mBAAmB,YAAY,CAAA;AAC3C,MAAA,OAAA,CAAQ,GAAA,CAAI,iBAAiB,UAAU,CAAA;AACvC,MAAA,OAAO,gBAAgB,KAAA,CAAM,KAAA,EAAO,EAAE,GAAG,IAAA,EAAM,SAAS,CAAA;AAAA,IAC5D,CAAA;AACA,IAAA,OAAO,mBAAA;AAAA,EACX,SAAS,KAAA,EAAO;AAQZ,IAAA,OAAA,CAAQ,IAAA;AAAA,MACJ,wGAAA;AAAA,MAEA;AAAA,KACJ;AACA,IAAA,OAAO,KAAA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* 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 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
+ {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":[],"mappings":";;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAA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Ae,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,IAAI,mBAAA,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-MZFUZUTQ.js","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 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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkZIRFXBKL_cjs = require('./chunk-ZIRFXBKL.cjs');
3
+ var chunk2JV4VQ7C_cjs = require('./chunk-2JV4VQ7C.cjs');
4
4
  var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
5
5
  var base = require('@scure/base');
6
6
  var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
@@ -76,14 +76,14 @@ var ContractHandlerRegistry = class {
76
76
  var contractHandlers = new ContractHandlerRegistry();
77
77
  exports.DefaultVtxo = void 0;
78
78
  ((DefaultVtxo2) => {
79
- class Script3 extends chunkZIRFXBKL_cjs.VtxoScript {
79
+ class Script3 extends chunk2JV4VQ7C_cjs.VtxoScript {
80
80
  /** Create the default virtual output script with one forfeit path and one exit path. */
81
81
  constructor(options) {
82
82
  const { pubKey, serverPubKey, csvTimelock } = options;
83
- const forfeitScript = chunkZIRFXBKL_cjs.MultisigTapscript.encode({
83
+ const forfeitScript = chunk2JV4VQ7C_cjs.MultisigTapscript.encode({
84
84
  pubkeys: [pubKey, serverPubKey]
85
85
  }).script;
86
- const exitScript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
86
+ const exitScript = chunk2JV4VQ7C_cjs.CSVMultisigTapscript.encode({
87
87
  timelock: csvTimelock,
88
88
  pubkeys: [pubKey]
89
89
  }).script;
@@ -288,7 +288,7 @@ function extractPubKeyBytes(value) {
288
288
  return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
289
289
  }
290
290
  function deserializeCsvTimelock(value) {
291
- return value !== void 0 && value !== "" ? chunkZIRFXBKL_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
291
+ return value !== void 0 && value !== "" ? chunk2JV4VQ7C_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
292
292
  }
293
293
  var CLTV_HEIGHT_THRESHOLD = 500000000n;
294
294
  function isCltvSatisfied(context, locktime) {
@@ -330,7 +330,7 @@ function assertVhtlcSpendableNow(contract, context) {
330
330
  function isCsvSpendable(context, sequence) {
331
331
  if (sequence === void 0) return true;
332
332
  if (!context.vtxo) return false;
333
- const timelock = chunkZIRFXBKL_cjs.sequenceToTimelock(sequence);
333
+ const timelock = chunk2JV4VQ7C_cjs.sequenceToTimelock(sequence);
334
334
  if (timelock.type === "blocks") {
335
335
  if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
336
336
  return false;
@@ -388,21 +388,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
388
388
  async function detectUsedScripts(indexerProvider, scriptHexes) {
389
389
  const used = /* @__PURE__ */ new Set();
390
390
  const unique = [...new Set(scriptHexes)];
391
- for (let offset = 0; offset < unique.length; offset += chunkZIRFXBKL_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
392
- const scripts = unique.slice(offset, offset + chunkZIRFXBKL_cjs.SCRIPT_QUERY_CHUNK_SIZE);
391
+ for (let offset = 0; offset < unique.length; offset += chunk2JV4VQ7C_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
392
+ const scripts = unique.slice(offset, offset + chunk2JV4VQ7C_cjs.SCRIPT_QUERY_CHUNK_SIZE);
393
393
  const remaining = new Set(scripts);
394
394
  let pageIndex = 0;
395
395
  let hasMore = true;
396
396
  while (hasMore && remaining.size > 0) {
397
- const { vtxos, page } = await chunkZIRFXBKL_cjs.getNormalizedVtxos(indexerProvider, {
397
+ const { vtxos, page } = await chunk2JV4VQ7C_cjs.getNormalizedVtxos(indexerProvider, {
398
398
  scripts,
399
399
  pageIndex,
400
- pageSize: chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE
400
+ pageSize: chunk2JV4VQ7C_cjs.DEFAULT_PAGE_SIZE
401
401
  });
402
402
  for (const vtxo of vtxos) {
403
403
  if (remaining.delete(vtxo.script)) used.add(vtxo.script);
404
404
  }
405
- hasMore = page ? vtxos.length === chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE : false;
405
+ hasMore = page ? vtxos.length === chunk2JV4VQ7C_cjs.DEFAULT_PAGE_SIZE : false;
406
406
  pageIndex++;
407
407
  }
408
408
  }
@@ -463,7 +463,7 @@ var DefaultContractHandler = {
463
463
  return {
464
464
  pubKey: base.hex.encode(params.pubKey),
465
465
  serverPubKey: base.hex.encode(params.serverPubKey),
466
- csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(params.csvTimelock).toString()
466
+ csvTimelock: chunk2JV4VQ7C_cjs.timelockToSequence(params.csvTimelock).toString()
467
467
  };
468
468
  },
469
469
  deserializeParams(params) {
@@ -498,7 +498,7 @@ function defaultCandidatesAt(_index, descriptor, deps) {
498
498
  params: {
499
499
  pubKey: base.hex.encode(c.pubKey),
500
500
  serverPubKey: base.hex.encode(c.serverPubKey),
501
- csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(c.csvTimelock).toString()
501
+ csvTimelock: chunk2JV4VQ7C_cjs.timelockToSequence(c.csvTimelock).toString()
502
502
  },
503
503
  script: c.scriptHex,
504
504
  address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
@@ -514,12 +514,12 @@ function discoverDefaultRange(entries, deps) {
514
514
  }
515
515
  exports.DelegateVtxo = void 0;
516
516
  ((DelegateVtxo2) => {
517
- class Script3 extends chunkZIRFXBKL_cjs.VtxoScript {
517
+ class Script3 extends chunk2JV4VQ7C_cjs.VtxoScript {
518
518
  /** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
519
519
  constructor(options) {
520
520
  const defaultVtxo = new exports.DefaultVtxo.Script(options);
521
521
  const { delegatePubKey, pubKey, serverPubKey } = options;
522
- const delegateScript = chunkZIRFXBKL_cjs.MultisigTapscript.encode({
522
+ const delegateScript = chunk2JV4VQ7C_cjs.MultisigTapscript.encode({
523
523
  pubkeys: [pubKey, delegatePubKey, serverPubKey]
524
524
  }).script;
525
525
  super([...defaultVtxo.scripts, delegateScript]);
@@ -558,7 +558,7 @@ var DelegateContractHandler = {
558
558
  pubKey: base.hex.encode(params.pubKey),
559
559
  serverPubKey: base.hex.encode(params.serverPubKey),
560
560
  delegatePubKey: base.hex.encode(params.delegatePubKey),
561
- csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(params.csvTimelock).toString()
561
+ csvTimelock: chunk2JV4VQ7C_cjs.timelockToSequence(params.csvTimelock).toString()
562
562
  };
563
563
  },
564
564
  deserializeParams(params) {
@@ -602,7 +602,7 @@ function delegateCandidatesAt(_index, descriptor, deps) {
602
602
  pubKey: base.hex.encode(c.pubKey),
603
603
  serverPubKey: base.hex.encode(c.serverPubKey),
604
604
  delegatePubKey: base.hex.encode(delegatePubKey),
605
- csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(c.csvTimelock).toString()
605
+ csvTimelock: chunk2JV4VQ7C_cjs.timelockToSequence(c.csvTimelock).toString()
606
606
  },
607
607
  script: c.scriptHex,
608
608
  address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
@@ -1445,7 +1445,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
1445
1445
  // src/script/vhtlc.ts
1446
1446
  exports.VHTLC = void 0;
1447
1447
  ((VHTLC2) => {
1448
- class BaseScript extends chunkZIRFXBKL_cjs.VtxoScript {
1448
+ class BaseScript extends chunk2JV4VQ7C_cjs.VtxoScript {
1449
1449
  options;
1450
1450
  claimScript;
1451
1451
  refundScript;
@@ -1457,6 +1457,8 @@ exports.VHTLC = void 0;
1457
1457
  nonInteractiveClaimArkadeScript;
1458
1458
  nonInteractiveRefundScript;
1459
1459
  nonInteractiveRefundArkadeScript;
1460
+ nonInteractiveRefundWithoutReceiverScript;
1461
+ nonInteractiveRefundWithoutReceiverArkadeScript;
1460
1462
  constructor(options, preimageCondition) {
1461
1463
  validateOptions(options);
1462
1464
  const {
@@ -1470,27 +1472,27 @@ exports.VHTLC = void 0;
1470
1472
  unilateralRefundWithoutReceiverDelay
1471
1473
  } = options;
1472
1474
  const conditionScript = preimageCondition(preimageHash);
1473
- const claimScript = chunkZIRFXBKL_cjs.ConditionMultisigTapscript.encode({
1475
+ const claimScript = chunk2JV4VQ7C_cjs.ConditionMultisigTapscript.encode({
1474
1476
  conditionScript,
1475
1477
  pubkeys: [receiver, server]
1476
1478
  }).script;
1477
- const refundScript = chunkZIRFXBKL_cjs.MultisigTapscript.encode({
1479
+ const refundScript = chunk2JV4VQ7C_cjs.MultisigTapscript.encode({
1478
1480
  pubkeys: [sender, receiver, server]
1479
1481
  }).script;
1480
- const refundWithoutReceiverScript = chunkZIRFXBKL_cjs.CLTVMultisigTapscript.encode({
1482
+ const refundWithoutReceiverScript = chunk2JV4VQ7C_cjs.CLTVMultisigTapscript.encode({
1481
1483
  absoluteTimelock: refundLocktime,
1482
1484
  pubkeys: [sender, server]
1483
1485
  }).script;
1484
- const unilateralClaimScript = chunkZIRFXBKL_cjs.ConditionCSVMultisigTapscript.encode({
1486
+ const unilateralClaimScript = chunk2JV4VQ7C_cjs.ConditionCSVMultisigTapscript.encode({
1485
1487
  conditionScript,
1486
1488
  timelock: unilateralClaimDelay,
1487
1489
  pubkeys: [receiver]
1488
1490
  }).script;
1489
- const unilateralRefundScript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
1491
+ const unilateralRefundScript = chunk2JV4VQ7C_cjs.CSVMultisigTapscript.encode({
1490
1492
  timelock: unilateralRefundDelay,
1491
1493
  pubkeys: [sender, receiver]
1492
1494
  }).script;
1493
- const unilateralRefundWithoutReceiverScript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
1495
+ const unilateralRefundWithoutReceiverScript = chunk2JV4VQ7C_cjs.CSVMultisigTapscript.encode({
1494
1496
  timelock: unilateralRefundWithoutReceiverDelay,
1495
1497
  pubkeys: [sender]
1496
1498
  }).script;
@@ -1510,7 +1512,7 @@ exports.VHTLC = void 0;
1510
1512
  options.asset,
1511
1513
  options.nonInteractiveClaim.strict
1512
1514
  );
1513
- nonInteractiveClaimScript = chunkZIRFXBKL_cjs.ConditionMultisigTapscript.encode({
1515
+ nonInteractiveClaimScript = chunk2JV4VQ7C_cjs.ConditionMultisigTapscript.encode({
1514
1516
  conditionScript,
1515
1517
  pubkeys: [
1516
1518
  server,
@@ -1524,22 +1526,27 @@ exports.VHTLC = void 0;
1524
1526
  }
1525
1527
  let arkadeScriptNir;
1526
1528
  let nonInteractiveRefundScript;
1529
+ let nonInteractiveRefundWithoutReceiverScript;
1527
1530
  if (options.nonInteractiveRefund) {
1528
1531
  arkadeScriptNir = enforcePayToMaybeAsset(
1529
1532
  options.nonInteractiveRefund.senderPkScript,
1530
1533
  options.asset
1531
1534
  );
1532
- nonInteractiveRefundScript = chunkZIRFXBKL_cjs.MultisigTapscript.encode({
1533
- pubkeys: [
1534
- server,
1535
- receiver,
1536
- computeArkadeScriptPublicKey(
1537
- options.nonInteractiveRefund.emulatorPubkey,
1538
- arkadeScriptNir
1539
- )
1540
- ]
1535
+ const nirCosigner = computeArkadeScriptPublicKey(
1536
+ options.nonInteractiveRefund.emulatorPubkey,
1537
+ arkadeScriptNir
1538
+ );
1539
+ nonInteractiveRefundScript = chunk2JV4VQ7C_cjs.MultisigTapscript.encode({
1540
+ pubkeys: [server, receiver, nirCosigner]
1541
1541
  }).script;
1542
1542
  scripts.push(nonInteractiveRefundScript);
1543
+ if (options.nonInteractiveRefund.withoutReceiver) {
1544
+ nonInteractiveRefundWithoutReceiverScript = chunk2JV4VQ7C_cjs.CLTVMultisigTapscript.encode({
1545
+ absoluteTimelock: refundLocktime,
1546
+ pubkeys: [server, nirCosigner]
1547
+ }).script;
1548
+ scripts.push(nonInteractiveRefundWithoutReceiverScript);
1549
+ }
1543
1550
  }
1544
1551
  super(scripts);
1545
1552
  this.options = options;
@@ -1559,6 +1566,12 @@ exports.VHTLC = void 0;
1559
1566
  this.nonInteractiveRefundScript = base.hex.encode(nonInteractiveRefundScript);
1560
1567
  this.nonInteractiveRefundArkadeScript = arkadeScriptNir;
1561
1568
  }
1569
+ if (nonInteractiveRefundWithoutReceiverScript) {
1570
+ this.nonInteractiveRefundWithoutReceiverScript = base.hex.encode(
1571
+ nonInteractiveRefundWithoutReceiverScript
1572
+ );
1573
+ this.nonInteractiveRefundWithoutReceiverArkadeScript = arkadeScriptNir;
1574
+ }
1562
1575
  }
1563
1576
  /** Return the collaborative claim tapleaf script. */
1564
1577
  claim() {
@@ -1604,6 +1617,67 @@ exports.VHTLC = void 0;
1604
1617
  this.nonInteractiveRefundArkadeScript
1605
1618
  ];
1606
1619
  }
1620
+ /**
1621
+ * Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
1622
+ *
1623
+ * SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
1624
+ * emulator client and covenant-spend builder ({@link
1625
+ * EmulatorProvider} in `src/providers/emulator.ts`, and {@link
1626
+ * ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
1627
+ * the general machinery every covenant leaf in this file goes
1628
+ * through:
1629
+ *
1630
+ * 1. Build the ark tx spending this leaf (this method's {@link
1631
+ * TapLeafScript} as `tapLeafScript`, this script's {@link
1632
+ * VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
1633
+ * 2. Attach the ArkadeScript this method returns to the spent
1634
+ * input via an `EmulatorPacket` (type 1) — `{ vin, script:
1635
+ * <this ArkadeScript>, witness: <empty> }`, empty because the
1636
+ * script pushes its own input/output index with
1637
+ * `PUSHCURRENTINPUTINDEX` rather than reading one from the
1638
+ * witness — wrapped in an `Extension` OP_RETURN output on the
1639
+ * ark tx.
1640
+ * 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
1641
+ * input 0 — required so the emulator can resolve that input's
1642
+ * prevout pkScript/value; it does not otherwise have them.
1643
+ * 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
1644
+ * checkpointTxs }` to the emulator's `POST /v1/tx`.
1645
+ *
1646
+ * THE COVENANT CHECK the emulator runs against that ArkadeScript —
1647
+ * `enforcePayTo(senderPkScript)`, see that function above — is: the
1648
+ * output at this SAME input's index is a v1 P2TR output paying
1649
+ * `senderPkScript`, with a value at least the input's. Only on that
1650
+ * check passing does the emulator sign for `nirCosigner` (the
1651
+ * `emulatorPubkey` tweaked by this ArkadeScript's hash); the
1652
+ * response carries the fully co-signed `signedArkTx` and
1653
+ * `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
1654
+ * comment on this path: "the emulator executes the arkade script
1655
+ * and finalizes with arkd" — no separate call to arkd is made by
1656
+ * this SDK for a covenant spend.
1657
+ * Neither `server` nor `receiver` play any part in that check: this
1658
+ * leaf's tapscript still requires `server`'s own signature
1659
+ * alongside `nirCosigner`'s (see the class doc above), but that is
1660
+ * consensus-level multisig, not something the covenant enforces.
1661
+ *
1662
+ * NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
1663
+ * `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
1664
+ * the emulator will happily co-sign an immature spend and arkd will
1665
+ * then refuse it. A block-height-typed `refundLocktime` (below the
1666
+ * standard height/timestamp boundary this SDK names
1667
+ * `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
1668
+ * `src/contracts/handlers/helpers.ts`) is refused by arkd for a
1669
+ * forfeit-eligible leaf independent of maturity — use a
1670
+ * seconds-typed (absolute Unix timestamp) value.
1671
+ */
1672
+ nonInteractiveRefundWithoutReceiver() {
1673
+ if (!this.nonInteractiveRefundWithoutReceiverScript || !this.nonInteractiveRefundWithoutReceiverArkadeScript) {
1674
+ throw new Error("VHTLC has no non-interactive refund-without-receiver leaf");
1675
+ }
1676
+ return [
1677
+ this.findLeaf(this.nonInteractiveRefundWithoutReceiverScript),
1678
+ this.nonInteractiveRefundWithoutReceiverArkadeScript
1679
+ ];
1680
+ }
1607
1681
  }
1608
1682
  class Script3 extends BaseScript {
1609
1683
  constructor(options) {
@@ -1810,9 +1884,9 @@ var VHTLCContractHandler = {
1810
1884
  server: base.hex.encode(params.server),
1811
1885
  hash: base.hex.encode(params.preimageHash),
1812
1886
  refundLocktime: params.refundLocktime.toString(),
1813
- claimDelay: chunkZIRFXBKL_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1814
- refundDelay: chunkZIRFXBKL_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1815
- refundNoReceiverDelay: chunkZIRFXBKL_cjs.timelockToSequence(
1887
+ claimDelay: chunk2JV4VQ7C_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1888
+ refundDelay: chunk2JV4VQ7C_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1889
+ refundNoReceiverDelay: chunk2JV4VQ7C_cjs.timelockToSequence(
1816
1890
  params.unilateralRefundWithoutReceiverDelay
1817
1891
  ).toString()
1818
1892
  };
@@ -1824,9 +1898,9 @@ var VHTLCContractHandler = {
1824
1898
  server: base.hex.decode(params.server),
1825
1899
  preimageHash: base.hex.decode(params.hash),
1826
1900
  refundLocktime: BigInt(params.refundLocktime),
1827
- unilateralClaimDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(Number(params.claimDelay)),
1828
- unilateralRefundDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(Number(params.refundDelay)),
1829
- unilateralRefundWithoutReceiverDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(
1901
+ unilateralClaimDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(Number(params.claimDelay)),
1902
+ unilateralRefundDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(Number(params.refundDelay)),
1903
+ unilateralRefundWithoutReceiverDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(
1830
1904
  Number(params.refundNoReceiverDelay)
1831
1905
  )
1832
1906
  };
@@ -2071,9 +2145,9 @@ var VHTLCV2ContractHandler = {
2071
2145
  server: base.hex.encode(params.server),
2072
2146
  hash: base.hex.encode(params.preimageHash),
2073
2147
  refundLocktime: params.refundLocktime.toString(),
2074
- claimDelay: chunkZIRFXBKL_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
2075
- refundDelay: chunkZIRFXBKL_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
2076
- refundNoReceiverDelay: chunkZIRFXBKL_cjs.timelockToSequence(
2148
+ claimDelay: chunk2JV4VQ7C_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
2149
+ refundDelay: chunk2JV4VQ7C_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
2150
+ refundNoReceiverDelay: chunk2JV4VQ7C_cjs.timelockToSequence(
2077
2151
  params.unilateralRefundWithoutReceiverDelay
2078
2152
  ).toString(),
2079
2153
  // Spread rather than written as `undefined`: a `Record<string,
@@ -2103,7 +2177,14 @@ var VHTLCV2ContractHandler = {
2103
2177
  ),
2104
2178
  nonInteractiveRefundEmulatorPubkey: base.hex.encode(
2105
2179
  params.nonInteractiveRefund.emulatorPubkey
2106
- )
2180
+ ),
2181
+ // Spread rather than a "false"/"undefined" string: a dropped
2182
+ // flag re-derives the EIGHT-leaf script, a different pkScript,
2183
+ // and registration dies at `upsertContractRow` with an opaque
2184
+ // `Script mismatch`. Same silent-drop class as the asset keys.
2185
+ ...params.nonInteractiveRefund.withoutReceiver && {
2186
+ nonInteractiveRefundWithoutReceiver: "1"
2187
+ }
2107
2188
  },
2108
2189
  // The asset must round-trip, and its absence here used to be silent
2109
2190
  // in the worst way. `ContractManager` re-derives a contract from
@@ -2143,6 +2224,16 @@ var VHTLCV2ContractHandler = {
2143
2224
  "strictClaimAssetAmount without strictClaimAmount: reading this as 'not strict' would re-derive the default claim covenant, which is weaker than the row asked for"
2144
2225
  );
2145
2226
  }
2227
+ if (params.nonInteractiveRefundWithoutReceiver !== void 0 && !refund) {
2228
+ throw new Error(
2229
+ "nonInteractiveRefundWithoutReceiver without the nonInteractiveRefund keys it extends: reading this as 'not set' would re-derive a script without the leaf"
2230
+ );
2231
+ }
2232
+ if (params.nonInteractiveRefundWithoutReceiver !== void 0 && params.nonInteractiveRefundWithoutReceiver !== "1") {
2233
+ throw new Error(
2234
+ `nonInteractiveRefundWithoutReceiver must be "1" when present, got ` + JSON.stringify(params.nonInteractiveRefundWithoutReceiver)
2235
+ );
2236
+ }
2146
2237
  const asset = params.assetTxid !== void 0 && params.assetGroupIndex !== void 0 ? {
2147
2238
  txid: base.hex.decode(params.assetTxid),
2148
2239
  groupIndex: parseGroupIndex(params.assetGroupIndex)
@@ -2154,9 +2245,9 @@ var VHTLCV2ContractHandler = {
2154
2245
  preimageHash: base.hex.decode(params.hash),
2155
2246
  refundLocktime: BigInt(params.refundLocktime),
2156
2247
  ...asset && { asset },
2157
- unilateralClaimDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(Number(params.claimDelay)),
2158
- unilateralRefundDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(Number(params.refundDelay)),
2159
- unilateralRefundWithoutReceiverDelay: chunkZIRFXBKL_cjs.sequenceToTimelock(
2248
+ unilateralClaimDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(Number(params.claimDelay)),
2249
+ unilateralRefundDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(Number(params.refundDelay)),
2250
+ unilateralRefundWithoutReceiverDelay: chunk2JV4VQ7C_cjs.sequenceToTimelock(
2160
2251
  Number(params.refundNoReceiverDelay)
2161
2252
  ),
2162
2253
  ...claim && {
@@ -2176,7 +2267,10 @@ var VHTLCV2ContractHandler = {
2176
2267
  ...refund && {
2177
2268
  nonInteractiveRefund: {
2178
2269
  senderPkScript: refund.destination,
2179
- emulatorPubkey: refund.emulatorPubkey
2270
+ emulatorPubkey: refund.emulatorPubkey,
2271
+ ...params.nonInteractiveRefundWithoutReceiver === "1" && {
2272
+ withoutReceiver: true
2273
+ }
2180
2274
  }
2181
2275
  }
2182
2276
  };
@@ -2437,7 +2531,7 @@ var BoardingContractHandler = {
2437
2531
  const coins = await deps.onchainProvider.getCoins(onchainAddress);
2438
2532
  if (coins.length === 0) return [];
2439
2533
  const scriptHex = base.hex.encode(script.pkScript);
2440
- const boardingSeq = chunkZIRFXBKL_cjs.timelockToSequence(deps.boardingTimelock);
2534
+ const boardingSeq = chunk2JV4VQ7C_cjs.timelockToSequence(deps.boardingTimelock);
2441
2535
  return [
2442
2536
  {
2443
2537
  type: "boarding",
@@ -2598,27 +2692,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
2598
2692
  if (seg.csv) {
2599
2693
  const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
2600
2694
  if (seg.asm) {
2601
- return chunkZIRFXBKL_cjs.ConditionCSVMultisigTapscript.encode({
2695
+ return chunk2JV4VQ7C_cjs.ConditionCSVMultisigTapscript.encode({
2602
2696
  conditionScript: resolveAsm(seg.asm, args),
2603
2697
  timelock,
2604
2698
  pubkeys
2605
2699
  });
2606
2700
  }
2607
- return chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
2701
+ return chunk2JV4VQ7C_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
2608
2702
  }
2609
2703
  if (seg.cltv !== void 0) {
2610
- return chunkZIRFXBKL_cjs.CLTVMultisigTapscript.encode({
2704
+ return chunk2JV4VQ7C_cjs.CLTVMultisigTapscript.encode({
2611
2705
  absoluteTimelock: resolveTimelockValue(seg.cltv, args),
2612
2706
  pubkeys
2613
2707
  });
2614
2708
  }
2615
2709
  if (seg.asm) {
2616
- return chunkZIRFXBKL_cjs.ConditionMultisigTapscript.encode({
2710
+ return chunk2JV4VQ7C_cjs.ConditionMultisigTapscript.encode({
2617
2711
  conditionScript: resolveAsm(seg.asm, args),
2618
2712
  pubkeys
2619
2713
  });
2620
2714
  }
2621
- return chunkZIRFXBKL_cjs.MultisigTapscript.encode({ pubkeys });
2715
+ return chunk2JV4VQ7C_cjs.MultisigTapscript.encode({ pubkeys });
2622
2716
  }
2623
2717
  function compileFunctions(program, args, keys) {
2624
2718
  if (program.version !== SUPPORTED_PROGRAM_VERSION) {
@@ -2648,7 +2742,7 @@ function compileFunctions(program, args, keys) {
2648
2742
  return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
2649
2743
  });
2650
2744
  }
2651
- var ArkadeProgramScript = class extends chunkZIRFXBKL_cjs.VtxoScript {
2745
+ var ArkadeProgramScript = class extends chunk2JV4VQ7C_cjs.VtxoScript {
2652
2746
  constructor(program, args, keys) {
2653
2747
  const partial = compileFunctions(program, args, keys);
2654
2748
  super(partial.map((p) => p.leafScript));
@@ -2861,7 +2955,7 @@ function pathsFor(script, context, opts) {
2861
2955
  continue;
2862
2956
  }
2863
2957
  if (requiresServer) continue;
2864
- const sequence = csv ? Number(chunkZIRFXBKL_cjs.timelockToSequence(csv)) : void 0;
2958
+ const sequence = csv ? Number(chunk2JV4VQ7C_cjs.timelockToSequence(csv)) : void 0;
2865
2959
  if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
2866
2960
  if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
2867
2961
  continue;
@@ -2990,5 +3084,5 @@ exports.toASM = toASM;
2990
3084
  exports.toXOnly = toXOnly;
2991
3085
  exports.validateProgram = validateProgram;
2992
3086
  exports.witnessRefToBytes = witnessRefToBytes;
2993
- //# sourceMappingURL=chunk-PXPPZF5K.cjs.map
2994
- //# sourceMappingURL=chunk-PXPPZF5K.cjs.map
3087
+ //# sourceMappingURL=chunk-OIZ2V2VD.cjs.map
3088
+ //# sourceMappingURL=chunk-OIZ2V2VD.cjs.map