@arkade-os/sdk 0.5.0-rc.7 → 0.5.0-rc.8
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.
- package/README.md +29 -0
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-BHOhjFiF.d.cts → asyncStorageTaskQueue-Bn3FoNkc.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BedBOEpT.d.ts → asyncStorageTaskQueue-CeYTmuGU.d.ts} +2 -2
- package/dist/{chunk-XOT73T36.cjs → chunk-2AWDPVZI.cjs} +18 -18
- package/dist/{chunk-XOT73T36.cjs.map → chunk-2AWDPVZI.cjs.map} +1 -1
- package/dist/{chunk-XIPWLWPU.cjs → chunk-56RCBKNF.cjs} +17 -17
- package/dist/{chunk-XIPWLWPU.cjs.map → chunk-56RCBKNF.cjs.map} +1 -1
- package/dist/{chunk-LFIORZO3.js → chunk-BIRUBLP3.js} +4 -4
- package/dist/{chunk-LFIORZO3.js.map → chunk-BIRUBLP3.js.map} +1 -1
- package/dist/{chunk-VUR6RP73.cjs → chunk-BMPGUGYZ.cjs} +10 -10
- package/dist/{chunk-VUR6RP73.cjs.map → chunk-BMPGUGYZ.cjs.map} +1 -1
- package/dist/{chunk-2JU54RGB.js → chunk-G6S4XSFI.js} +3 -3
- package/dist/{chunk-2JU54RGB.js.map → chunk-G6S4XSFI.js.map} +1 -1
- package/dist/{chunk-4MB3Z33G.js → chunk-INTEA7D3.js} +4 -4
- package/dist/{chunk-4MB3Z33G.js.map → chunk-INTEA7D3.js.map} +1 -1
- package/dist/{chunk-A2T3GGAK.cjs → chunk-K5RED5VE.cjs} +50 -50
- package/dist/{chunk-A2T3GGAK.cjs.map → chunk-K5RED5VE.cjs.map} +1 -1
- package/dist/{chunk-7B2QAHQU.js → chunk-LN4ZJZK4.js} +94 -11
- package/dist/chunk-LN4ZJZK4.js.map +1 -0
- package/dist/{chunk-H7KLBU6G.js → chunk-MTYQXZ2T.js} +4 -4
- package/dist/{chunk-H7KLBU6G.js.map → chunk-MTYQXZ2T.js.map} +1 -1
- package/dist/{chunk-GLLBSULU.cjs → chunk-NY5FN4VV.cjs} +3 -3
- package/dist/{chunk-GLLBSULU.cjs.map → chunk-NY5FN4VV.cjs.map} +1 -1
- package/dist/{chunk-L6MGV7ZA.js → chunk-XCNAGBFR.js} +3 -3
- package/dist/{chunk-L6MGV7ZA.js.map → chunk-XCNAGBFR.js.map} +1 -1
- package/dist/{chunk-EIMOVGBV.cjs → chunk-ZTCDT7KB.cjs} +523 -439
- package/dist/chunk-ZTCDT7KB.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-Hl92NVgS.d.ts → delegate-CyBnNY9v.d.ts} +1 -1
- package/dist/{delegate-Dv8aEvSp.d.cts → delegate-Cyv2suFd.d.cts} +1 -1
- package/dist/{hdWalletCapable-QiCK1B9d.d.cts → hdWalletCapable-D1ImQqlu.d.cts} +3 -3
- package/dist/{hdWalletCapable-Bqcb-XtC.d.ts → hdWalletCapable-DvumVrKW.d.ts} +3 -3
- package/dist/{index-F-X4BWxi.d.cts → index-BIL9boGL.d.cts} +14 -1
- package/dist/{index-F-X4BWxi.d.ts → index-BIL9boGL.d.ts} +14 -1
- package/dist/{index-CeC9FiJt.d.cts → index-DleNQcz5.d.cts} +3 -3
- package/dist/{index-BwEO0Yb-.d.ts → index-QVhQgYvU.d.ts} +3 -3
- package/dist/index.cjs +294 -290
- package/dist/index.d.cts +17 -9
- package/dist/index.d.ts +17 -9
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +20 -20
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +19 -19
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-BdU_d__J.d.ts → taskRunner-CRbuzUXR.d.ts} +2 -2
- package/dist/{taskRunner-CDCz7MTW.d.cts → taskRunner-z_BGID85.d.cts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-7B2QAHQU.js.map +0 -1
- package/dist/chunk-EIMOVGBV.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RestIndexerProvider } from './chunk-
|
|
2
|
-
import { RestArkProvider, DEFAULT_ARKADE_SERVER_URL, isFetchTimeoutError, convertVtxo, buildVersion, sdkVersion, fetch } from './chunk-
|
|
1
|
+
import { RestIndexerProvider } from './chunk-G6S4XSFI.js';
|
|
2
|
+
import { RestArkProvider, DEFAULT_ARKADE_SERVER_URL, isFetchTimeoutError, convertVtxo, buildVersion, sdkVersion, fetch } from './chunk-MTYQXZ2T.js';
|
|
3
3
|
|
|
4
4
|
// src/providers/expoUtils.ts
|
|
5
5
|
async function getExpoFetch(options) {
|
|
@@ -189,5 +189,5 @@ var ExpoIndexerProvider = class extends RestIndexerProvider {
|
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
export { ExpoArkProvider, ExpoIndexerProvider };
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
193
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-INTEA7D3.js.map
|
|
193
|
+
//# sourceMappingURL=chunk-INTEA7D3.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;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,EAAA,WAAA,EAAa,iBAAiB,OAAA,EAAS,OAAA,EAAS,EAAE,IAAA,EAAM,MAAM,CAAA;AAE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AAA,EAAM,KAAK,KAAA,CAAM,IAAA;AAAA,gBACjB,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,OAAA,IAAW,EAAC;AAAA,gBAChC,WAAW,IAAA,CAAK,KAAA,CAAM,YAAY,EAAC,EAAG,IAAI,WAAW,CAAA;AAAA,gBACrD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAI,WAAW,CAAA;AAAA,gBACzD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAI,WAAW,CAAA;AAAA,gBACzD,EAAA,EAAI,KAAK,KAAA,CAAM,EAAA;AAAA,gBACf,aAAA,EAAe,KAAK,KAAA,CAAM;AAAA,eAC9B;AAAA,YACJ;AACA,YAAA,OAAO,IAAA;AAAA,UACX;AAAA,SACJ;AAAA,MACJ,SAAS,KAAA,EAAO;AACZ,QAAA,IAAI,KAAA,YAAiB,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,YAAA,EAAc;AACvD,UAAA;AAAA,QACJ;AAIA,QAAA,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-4MB3Z33G.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 // Required, not just for cancellation: `getExpoFetch` falls back to\n // the Ark `fetch` wrapper, which routes through `baseFetch` and so\n // bounds any read that brings no signal of its own. Drop this and\n // the stream is truncated at READ_TIMEOUT_MS.\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotificationEvent, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"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,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AAA,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-INTEA7D3.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 // Required, not just for cancellation: `getExpoFetch` falls back to\n // the Ark `fetch` wrapper, which routes through `baseFetch` and so\n // bounds any read that brings no signal of its own. Drop this and\n // the stream is truncated at READ_TIMEOUT_MS.\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotificationEvent, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNY5FN4VV_cjs = require('./chunk-NY5FN4VV.cjs');
|
|
4
4
|
var base = require('@scure/base');
|
|
5
5
|
var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
|
|
6
6
|
var btcSigner = require('@scure/btc-signer');
|
|
@@ -75,14 +75,14 @@ var ContractHandlerRegistry = class {
|
|
|
75
75
|
var contractHandlers = new ContractHandlerRegistry();
|
|
76
76
|
exports.DefaultVtxo = void 0;
|
|
77
77
|
((DefaultVtxo2) => {
|
|
78
|
-
class Script3 extends
|
|
78
|
+
class Script3 extends chunkNY5FN4VV_cjs.VtxoScript {
|
|
79
79
|
/** Create the default virtual output script with one forfeit path and one exit path. */
|
|
80
80
|
constructor(options) {
|
|
81
81
|
const { pubKey, serverPubKey, csvTimelock } = options;
|
|
82
|
-
const forfeitScript =
|
|
82
|
+
const forfeitScript = chunkNY5FN4VV_cjs.MultisigTapscript.encode({
|
|
83
83
|
pubkeys: [pubKey, serverPubKey]
|
|
84
84
|
}).script;
|
|
85
|
-
const exitScript =
|
|
85
|
+
const exitScript = chunkNY5FN4VV_cjs.CSVMultisigTapscript.encode({
|
|
86
86
|
timelock: csvTimelock,
|
|
87
87
|
pubkeys: [pubKey]
|
|
88
88
|
}).script;
|
|
@@ -274,7 +274,7 @@ function extractPubKeyBytes(value) {
|
|
|
274
274
|
return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
|
|
275
275
|
}
|
|
276
276
|
function deserializeCsvTimelock(value) {
|
|
277
|
-
return value !== void 0 && value !== "" ?
|
|
277
|
+
return value !== void 0 && value !== "" ? chunkNY5FN4VV_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
278
278
|
}
|
|
279
279
|
var CLTV_HEIGHT_THRESHOLD = 500000000n;
|
|
280
280
|
function isCltvSatisfied(context, locktime) {
|
|
@@ -316,7 +316,7 @@ function assertVhtlcSpendableNow(contract, context) {
|
|
|
316
316
|
function isCsvSpendable(context, sequence) {
|
|
317
317
|
if (sequence === void 0) return true;
|
|
318
318
|
if (!context.vtxo) return false;
|
|
319
|
-
const timelock =
|
|
319
|
+
const timelock = chunkNY5FN4VV_cjs.sequenceToTimelock(sequence);
|
|
320
320
|
if (timelock.type === "blocks") {
|
|
321
321
|
if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
|
|
322
322
|
return false;
|
|
@@ -374,21 +374,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
|
|
|
374
374
|
async function detectUsedScripts(indexerProvider, scriptHexes) {
|
|
375
375
|
const used = /* @__PURE__ */ new Set();
|
|
376
376
|
const unique = [...new Set(scriptHexes)];
|
|
377
|
-
for (let offset = 0; offset < unique.length; offset +=
|
|
378
|
-
const scripts = unique.slice(offset, offset +
|
|
377
|
+
for (let offset = 0; offset < unique.length; offset += chunkNY5FN4VV_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
378
|
+
const scripts = unique.slice(offset, offset + chunkNY5FN4VV_cjs.SCRIPT_QUERY_CHUNK_SIZE);
|
|
379
379
|
const remaining = new Set(scripts);
|
|
380
380
|
let pageIndex = 0;
|
|
381
381
|
let hasMore = true;
|
|
382
382
|
while (hasMore && remaining.size > 0) {
|
|
383
|
-
const { vtxos, page } = await
|
|
383
|
+
const { vtxos, page } = await chunkNY5FN4VV_cjs.getNormalizedVtxos(indexerProvider, {
|
|
384
384
|
scripts,
|
|
385
385
|
pageIndex,
|
|
386
|
-
pageSize:
|
|
386
|
+
pageSize: chunkNY5FN4VV_cjs.DEFAULT_PAGE_SIZE
|
|
387
387
|
});
|
|
388
388
|
for (const vtxo of vtxos) {
|
|
389
389
|
if (remaining.delete(vtxo.script)) used.add(vtxo.script);
|
|
390
390
|
}
|
|
391
|
-
hasMore = page ? vtxos.length ===
|
|
391
|
+
hasMore = page ? vtxos.length === chunkNY5FN4VV_cjs.DEFAULT_PAGE_SIZE : false;
|
|
392
392
|
pageIndex++;
|
|
393
393
|
}
|
|
394
394
|
}
|
|
@@ -449,7 +449,7 @@ var DefaultContractHandler = {
|
|
|
449
449
|
return {
|
|
450
450
|
pubKey: base.hex.encode(params.pubKey),
|
|
451
451
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
452
|
-
csvTimelock:
|
|
452
|
+
csvTimelock: chunkNY5FN4VV_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
453
453
|
};
|
|
454
454
|
},
|
|
455
455
|
deserializeParams(params) {
|
|
@@ -484,7 +484,7 @@ function defaultCandidatesAt(_index, descriptor, deps) {
|
|
|
484
484
|
params: {
|
|
485
485
|
pubKey: base.hex.encode(c.pubKey),
|
|
486
486
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
487
|
-
csvTimelock:
|
|
487
|
+
csvTimelock: chunkNY5FN4VV_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
488
488
|
},
|
|
489
489
|
script: c.scriptHex,
|
|
490
490
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -500,12 +500,12 @@ function discoverDefaultRange(entries, deps) {
|
|
|
500
500
|
}
|
|
501
501
|
exports.DelegateVtxo = void 0;
|
|
502
502
|
((DelegateVtxo2) => {
|
|
503
|
-
class Script3 extends
|
|
503
|
+
class Script3 extends chunkNY5FN4VV_cjs.VtxoScript {
|
|
504
504
|
/** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
|
|
505
505
|
constructor(options) {
|
|
506
506
|
const defaultVtxo = new exports.DefaultVtxo.Script(options);
|
|
507
507
|
const { delegatePubKey, pubKey, serverPubKey } = options;
|
|
508
|
-
const delegateScript =
|
|
508
|
+
const delegateScript = chunkNY5FN4VV_cjs.MultisigTapscript.encode({
|
|
509
509
|
pubkeys: [pubKey, delegatePubKey, serverPubKey]
|
|
510
510
|
}).script;
|
|
511
511
|
super([...defaultVtxo.scripts, delegateScript]);
|
|
@@ -544,7 +544,7 @@ var DelegateContractHandler = {
|
|
|
544
544
|
pubKey: base.hex.encode(params.pubKey),
|
|
545
545
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
546
546
|
delegatePubKey: base.hex.encode(params.delegatePubKey),
|
|
547
|
-
csvTimelock:
|
|
547
|
+
csvTimelock: chunkNY5FN4VV_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
548
548
|
};
|
|
549
549
|
},
|
|
550
550
|
deserializeParams(params) {
|
|
@@ -588,7 +588,7 @@ function delegateCandidatesAt(_index, descriptor, deps) {
|
|
|
588
588
|
pubKey: base.hex.encode(c.pubKey),
|
|
589
589
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
590
590
|
delegatePubKey: base.hex.encode(delegatePubKey),
|
|
591
|
-
csvTimelock:
|
|
591
|
+
csvTimelock: chunkNY5FN4VV_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
592
592
|
},
|
|
593
593
|
script: c.scriptHex,
|
|
594
594
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -1242,7 +1242,7 @@ function getOpcodeValue(name) {
|
|
|
1242
1242
|
|
|
1243
1243
|
// src/arkade/bignum.ts
|
|
1244
1244
|
var bignum_exports = {};
|
|
1245
|
-
|
|
1245
|
+
chunkNY5FN4VV_cjs.__export(bignum_exports, {
|
|
1246
1246
|
BIGNUM_MAX_BYTES: () => BIGNUM_MAX_BYTES,
|
|
1247
1247
|
decode: () => decode,
|
|
1248
1248
|
encode: () => encode
|
|
@@ -1431,7 +1431,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1431
1431
|
// src/script/vhtlc.ts
|
|
1432
1432
|
exports.VHTLC = void 0;
|
|
1433
1433
|
((VHTLC2) => {
|
|
1434
|
-
class BaseScript extends
|
|
1434
|
+
class BaseScript extends chunkNY5FN4VV_cjs.VtxoScript {
|
|
1435
1435
|
options;
|
|
1436
1436
|
claimScript;
|
|
1437
1437
|
refundScript;
|
|
@@ -1458,27 +1458,27 @@ exports.VHTLC = void 0;
|
|
|
1458
1458
|
unilateralRefundWithoutReceiverDelay
|
|
1459
1459
|
} = options;
|
|
1460
1460
|
const conditionScript = preimageCondition(preimageHash);
|
|
1461
|
-
const claimScript =
|
|
1461
|
+
const claimScript = chunkNY5FN4VV_cjs.ConditionMultisigTapscript.encode({
|
|
1462
1462
|
conditionScript,
|
|
1463
1463
|
pubkeys: [receiver, server]
|
|
1464
1464
|
}).script;
|
|
1465
|
-
const refundScript =
|
|
1465
|
+
const refundScript = chunkNY5FN4VV_cjs.MultisigTapscript.encode({
|
|
1466
1466
|
pubkeys: [sender, receiver, server]
|
|
1467
1467
|
}).script;
|
|
1468
|
-
const refundWithoutReceiverScript =
|
|
1468
|
+
const refundWithoutReceiverScript = chunkNY5FN4VV_cjs.CLTVMultisigTapscript.encode({
|
|
1469
1469
|
absoluteTimelock: refundLocktime,
|
|
1470
1470
|
pubkeys: [sender, server]
|
|
1471
1471
|
}).script;
|
|
1472
|
-
const unilateralClaimScript =
|
|
1472
|
+
const unilateralClaimScript = chunkNY5FN4VV_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1473
1473
|
conditionScript,
|
|
1474
1474
|
timelock: unilateralClaimDelay,
|
|
1475
1475
|
pubkeys: [receiver]
|
|
1476
1476
|
}).script;
|
|
1477
|
-
const unilateralRefundScript =
|
|
1477
|
+
const unilateralRefundScript = chunkNY5FN4VV_cjs.CSVMultisigTapscript.encode({
|
|
1478
1478
|
timelock: unilateralRefundDelay,
|
|
1479
1479
|
pubkeys: [sender, receiver]
|
|
1480
1480
|
}).script;
|
|
1481
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1481
|
+
const unilateralRefundWithoutReceiverScript = chunkNY5FN4VV_cjs.CSVMultisigTapscript.encode({
|
|
1482
1482
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1483
1483
|
pubkeys: [sender]
|
|
1484
1484
|
}).script;
|
|
@@ -1498,7 +1498,7 @@ exports.VHTLC = void 0;
|
|
|
1498
1498
|
const covenants = options.nonInteractiveParameters;
|
|
1499
1499
|
if (covenants) {
|
|
1500
1500
|
arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
|
|
1501
|
-
nonInteractiveClaimScript =
|
|
1501
|
+
nonInteractiveClaimScript = chunkNY5FN4VV_cjs.ConditionMultisigTapscript.encode({
|
|
1502
1502
|
conditionScript,
|
|
1503
1503
|
pubkeys: [
|
|
1504
1504
|
server,
|
|
@@ -1511,12 +1511,12 @@ exports.VHTLC = void 0;
|
|
|
1511
1511
|
covenants.emulatorPubkey,
|
|
1512
1512
|
arkadeScriptNir
|
|
1513
1513
|
);
|
|
1514
|
-
nonInteractiveRefundScript =
|
|
1514
|
+
nonInteractiveRefundScript = chunkNY5FN4VV_cjs.MultisigTapscript.encode({
|
|
1515
1515
|
pubkeys: [server, receiver, nirCosigner]
|
|
1516
1516
|
}).script;
|
|
1517
1517
|
scripts.push(nonInteractiveRefundScript);
|
|
1518
1518
|
if (covenants.legacy !== "preTimelockedRefund") {
|
|
1519
|
-
nonInteractiveRefundWithoutReceiverScript =
|
|
1519
|
+
nonInteractiveRefundWithoutReceiverScript = chunkNY5FN4VV_cjs.CLTVMultisigTapscript.encode({
|
|
1520
1520
|
absoluteTimelock: refundLocktime,
|
|
1521
1521
|
pubkeys: [server, nirCosigner]
|
|
1522
1522
|
}).script;
|
|
@@ -1830,9 +1830,9 @@ var VHTLCContractHandler = {
|
|
|
1830
1830
|
server: base.hex.encode(params.server),
|
|
1831
1831
|
hash: base.hex.encode(params.preimageHash),
|
|
1832
1832
|
refundLocktime: params.refundLocktime.toString(),
|
|
1833
|
-
claimDelay:
|
|
1834
|
-
refundDelay:
|
|
1835
|
-
refundNoReceiverDelay:
|
|
1833
|
+
claimDelay: chunkNY5FN4VV_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1834
|
+
refundDelay: chunkNY5FN4VV_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1835
|
+
refundNoReceiverDelay: chunkNY5FN4VV_cjs.timelockToSequence(
|
|
1836
1836
|
params.unilateralRefundWithoutReceiverDelay
|
|
1837
1837
|
).toString()
|
|
1838
1838
|
};
|
|
@@ -1844,9 +1844,9 @@ var VHTLCContractHandler = {
|
|
|
1844
1844
|
server: base.hex.decode(params.server),
|
|
1845
1845
|
preimageHash: base.hex.decode(params.hash),
|
|
1846
1846
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1847
|
-
unilateralClaimDelay:
|
|
1848
|
-
unilateralRefundDelay:
|
|
1849
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1847
|
+
unilateralClaimDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1848
|
+
unilateralRefundDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1849
|
+
unilateralRefundWithoutReceiverDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(
|
|
1850
1850
|
Number(params.refundNoReceiverDelay)
|
|
1851
1851
|
)
|
|
1852
1852
|
};
|
|
@@ -2092,9 +2092,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2092
2092
|
server: base.hex.encode(params.server),
|
|
2093
2093
|
hash: base.hex.encode(params.preimageHash),
|
|
2094
2094
|
refundLocktime: params.refundLocktime.toString(),
|
|
2095
|
-
claimDelay:
|
|
2096
|
-
refundDelay:
|
|
2097
|
-
refundNoReceiverDelay:
|
|
2095
|
+
claimDelay: chunkNY5FN4VV_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
2096
|
+
refundDelay: chunkNY5FN4VV_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
2097
|
+
refundNoReceiverDelay: chunkNY5FN4VV_cjs.timelockToSequence(
|
|
2098
2098
|
params.unilateralRefundWithoutReceiverDelay
|
|
2099
2099
|
).toString(),
|
|
2100
2100
|
// The on-disk keys keep their per-leaf names even though the typed
|
|
@@ -2194,9 +2194,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2194
2194
|
preimageHash: base.hex.decode(params.hash),
|
|
2195
2195
|
refundLocktime: BigInt(params.refundLocktime),
|
|
2196
2196
|
...asset && { asset },
|
|
2197
|
-
unilateralClaimDelay:
|
|
2198
|
-
unilateralRefundDelay:
|
|
2199
|
-
unilateralRefundWithoutReceiverDelay:
|
|
2197
|
+
unilateralClaimDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
2198
|
+
unilateralRefundDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
2199
|
+
unilateralRefundWithoutReceiverDelay: chunkNY5FN4VV_cjs.sequenceToTimelock(
|
|
2200
2200
|
Number(params.refundNoReceiverDelay)
|
|
2201
2201
|
),
|
|
2202
2202
|
...claim && refund && {
|
|
@@ -2468,7 +2468,7 @@ var BoardingContractHandler = {
|
|
|
2468
2468
|
const coins = await deps.onchainProvider.getCoins(onchainAddress);
|
|
2469
2469
|
if (coins.length === 0) return [];
|
|
2470
2470
|
const scriptHex = base.hex.encode(script.pkScript);
|
|
2471
|
-
const boardingSeq =
|
|
2471
|
+
const boardingSeq = chunkNY5FN4VV_cjs.timelockToSequence(deps.boardingTimelock);
|
|
2472
2472
|
return [
|
|
2473
2473
|
{
|
|
2474
2474
|
type: "boarding",
|
|
@@ -2629,27 +2629,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
2629
2629
|
if (seg.csv) {
|
|
2630
2630
|
const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
|
|
2631
2631
|
if (seg.asm) {
|
|
2632
|
-
return
|
|
2632
|
+
return chunkNY5FN4VV_cjs.ConditionCSVMultisigTapscript.encode({
|
|
2633
2633
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2634
2634
|
timelock,
|
|
2635
2635
|
pubkeys
|
|
2636
2636
|
});
|
|
2637
2637
|
}
|
|
2638
|
-
return
|
|
2638
|
+
return chunkNY5FN4VV_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
2639
2639
|
}
|
|
2640
2640
|
if (seg.cltv !== void 0) {
|
|
2641
|
-
return
|
|
2641
|
+
return chunkNY5FN4VV_cjs.CLTVMultisigTapscript.encode({
|
|
2642
2642
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
2643
2643
|
pubkeys
|
|
2644
2644
|
});
|
|
2645
2645
|
}
|
|
2646
2646
|
if (seg.asm) {
|
|
2647
|
-
return
|
|
2647
|
+
return chunkNY5FN4VV_cjs.ConditionMultisigTapscript.encode({
|
|
2648
2648
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2649
2649
|
pubkeys
|
|
2650
2650
|
});
|
|
2651
2651
|
}
|
|
2652
|
-
return
|
|
2652
|
+
return chunkNY5FN4VV_cjs.MultisigTapscript.encode({ pubkeys });
|
|
2653
2653
|
}
|
|
2654
2654
|
function compileFunctions(program, args, keys) {
|
|
2655
2655
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2679,7 +2679,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2679
2679
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2680
2680
|
});
|
|
2681
2681
|
}
|
|
2682
|
-
var ArkadeProgramScript = class extends
|
|
2682
|
+
var ArkadeProgramScript = class extends chunkNY5FN4VV_cjs.VtxoScript {
|
|
2683
2683
|
constructor(program, args, keys) {
|
|
2684
2684
|
const partial = compileFunctions(program, args, keys);
|
|
2685
2685
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2882,7 +2882,7 @@ function pathsFor(script, context, opts) {
|
|
|
2882
2882
|
continue;
|
|
2883
2883
|
}
|
|
2884
2884
|
if (requiresServer) continue;
|
|
2885
|
-
const sequence = csv ? Number(
|
|
2885
|
+
const sequence = csv ? Number(chunkNY5FN4VV_cjs.timelockToSequence(csv)) : void 0;
|
|
2886
2886
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2887
2887
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2888
2888
|
continue;
|
|
@@ -3011,5 +3011,5 @@ exports.toASM = toASM;
|
|
|
3011
3011
|
exports.toXOnly = toXOnly;
|
|
3012
3012
|
exports.validateProgram = validateProgram;
|
|
3013
3013
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
3014
|
-
//# sourceMappingURL=chunk-
|
|
3015
|
-
//# sourceMappingURL=chunk-
|
|
3014
|
+
//# sourceMappingURL=chunk-K5RED5VE.cjs.map
|
|
3015
|
+
//# sourceMappingURL=chunk-K5RED5VE.cjs.map
|