@arkade-os/sdk 0.5.3 → 0.5.4
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 +36 -34
- package/dist/adapters/expo.cjs +9 -5
- package/dist/adapters/expo.d.cts +11 -7
- package/dist/adapters/expo.d.ts +11 -7
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-B3U5gQ-i.d.ts → asyncStorageTaskQueue-DHMIxY04.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-C9PkPcW_.d.cts → asyncStorageTaskQueue-DTBa8EH7.d.cts} +2 -2
- package/dist/{chunk-P7B4LQ3H.js → chunk-6CUP6ZIF.js} +4 -4
- package/dist/{chunk-P7B4LQ3H.js.map → chunk-6CUP6ZIF.js.map} +1 -1
- package/dist/{chunk-OPX2HRWM.js → chunk-AG4TFD6F.js} +137 -59
- package/dist/chunk-AG4TFD6F.js.map +1 -0
- package/dist/{chunk-5WRA66RV.cjs → chunk-B6VNKGIH.cjs} +10 -10
- package/dist/chunk-B6VNKGIH.cjs.map +1 -0
- package/dist/{chunk-6FL4N4S2.js → chunk-BTRCN4JJ.js} +22 -19
- package/dist/chunk-BTRCN4JJ.js.map +1 -0
- package/dist/{chunk-ZPF4I3K2.cjs → chunk-DNITZVNG.cjs} +28 -47
- package/dist/chunk-DNITZVNG.cjs.map +1 -0
- package/dist/{chunk-BYPBVHVA.cjs → chunk-E6OOJEHL.cjs} +49 -49
- package/dist/{chunk-BYPBVHVA.cjs.map → chunk-E6OOJEHL.cjs.map} +1 -1
- package/dist/{chunk-OUTWUYJ4.cjs → chunk-F3FAE7VJ.cjs} +769 -619
- package/dist/chunk-F3FAE7VJ.cjs.map +1 -0
- package/dist/{chunk-KW7ZEWYS.cjs → chunk-GHUUT54D.cjs} +140 -58
- package/dist/chunk-GHUUT54D.cjs.map +1 -0
- package/dist/{chunk-Y4BL3YYX.js → chunk-MWVAWFX6.js} +4 -4
- package/dist/chunk-MWVAWFX6.js.map +1 -0
- package/dist/{chunk-T7C3E2HL.js → chunk-TUOLZBNC.js} +19 -39
- package/dist/chunk-TUOLZBNC.js.map +1 -0
- package/dist/{chunk-ZMSM3NOH.cjs → chunk-WXNSISXK.cjs} +37 -34
- package/dist/chunk-WXNSISXK.cjs.map +1 -0
- package/dist/{chunk-HAQAWBYG.js → chunk-ZJHLLDBP.js} +283 -136
- package/dist/chunk-ZJHLLDBP.js.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-ByfKszb6.d.cts → delegate-f4_t864Z.d.cts} +1 -1
- package/dist/{delegate-Cd28gxpM.d.ts → delegate-xrSBNybC.d.ts} +1 -1
- package/dist/{index-DgH_0j14.d.cts → index-BJDz15ms.d.ts} +5 -5
- package/dist/{index-B6X2E7W_.d.ts → index-BjiVGtp8.d.cts} +5 -5
- package/dist/{index-BURzbRup.d.ts → index-DRwe0UDN.d.cts} +182 -114
- package/dist/{index-BURzbRup.d.cts → index-DRwe0UDN.d.ts} +182 -114
- package/dist/index.cjs +333 -313
- package/dist/index.d.cts +66 -44
- package/dist/index.d.ts +66 -44
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +65 -36
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +7 -3
- package/dist/repositories/realm/index.d.ts +7 -3
- package/dist/repositories/realm/index.js +35 -6
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +176 -110
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +23 -13
- package/dist/repositories/sqlite/index.d.ts +23 -13
- package/dist/repositories/sqlite/index.js +148 -83
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-i56-drQV.d.cts → taskRunner-BPPU-YHG.d.cts} +4 -4
- package/dist/{taskRunner-BaNCSxqK.d.ts → taskRunner-CDlNeth0.d.ts} +4 -4
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +15 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +6 -6
- package/dist/wallet/expo/index.d.ts +6 -6
- package/dist/wallet/expo/index.js +6 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-BjQugVUt.d.cts → wallet-Oc3Wd5gv.d.ts} +22 -18
- package/dist/{wallet-BnmhohgZ.d.ts → wallet-jVBDQl6R.d.cts} +22 -18
- 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-5WRA66RV.cjs.map +0 -1
- package/dist/chunk-6FL4N4S2.js.map +0 -1
- package/dist/chunk-HAQAWBYG.js.map +0 -1
- package/dist/chunk-KW7ZEWYS.cjs.map +0 -1
- package/dist/chunk-OPX2HRWM.js.map +0 -1
- package/dist/chunk-OUTWUYJ4.cjs.map +0 -1
- package/dist/chunk-T7C3E2HL.js.map +0 -1
- package/dist/chunk-Y4BL3YYX.js.map +0 -1
- package/dist/chunk-ZMSM3NOH.cjs.map +0 -1
- package/dist/chunk-ZPF4I3K2.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWXNSISXK_cjs = require('./chunk-WXNSISXK.cjs');
|
|
4
|
+
var chunkGHUUT54D_cjs = require('./chunk-GHUUT54D.cjs');
|
|
5
5
|
|
|
6
6
|
// src/providers/expoUtils.ts
|
|
7
7
|
async function getExpoFetch(options) {
|
|
@@ -20,7 +20,7 @@ async function getExpoFetch(options) {
|
|
|
20
20
|
"Using standard fetch instead of expo/fetch. Streaming may not be fully supported in some environments.",
|
|
21
21
|
error
|
|
22
22
|
);
|
|
23
|
-
return
|
|
23
|
+
return chunkGHUUT54D_cjs.baseFetch;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
|
|
@@ -44,35 +44,19 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
|
|
|
44
44
|
if (!response.body) {
|
|
45
45
|
throw new Error("Response body is null");
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
buffer += decoder.decode(value, { stream: true });
|
|
56
|
-
const lines = buffer.split("\n");
|
|
57
|
-
for (let i = 0; i < lines.length - 1; i++) {
|
|
58
|
-
const line = lines[i].trim();
|
|
59
|
-
if (!line) continue;
|
|
60
|
-
if (line.startsWith("data:")) {
|
|
61
|
-
const jsonStr = line.substring(5).trim();
|
|
62
|
-
if (!jsonStr) continue;
|
|
63
|
-
try {
|
|
64
|
-
const data = JSON.parse(jsonStr);
|
|
65
|
-
const parsed = parseData(data);
|
|
66
|
-
if (parsed !== null) {
|
|
67
|
-
yield parsed;
|
|
68
|
-
}
|
|
69
|
-
} catch (parseError) {
|
|
70
|
-
console.error("Failed to parse SSE data:", parseError);
|
|
71
|
-
throw parseError;
|
|
72
|
-
}
|
|
47
|
+
for await (const { event, data } of chunkGHUUT54D_cjs.readSseFrames(response.body)) {
|
|
48
|
+
if (abortSignal?.aborted) break;
|
|
49
|
+
if (event === "failure") throw chunkGHUUT54D_cjs.streamFailureError(data);
|
|
50
|
+
if (event !== "message" || !data.trim()) continue;
|
|
51
|
+
try {
|
|
52
|
+
const parsed = parseData(JSON.parse(data));
|
|
53
|
+
if (parsed !== null) {
|
|
54
|
+
yield parsed;
|
|
73
55
|
}
|
|
56
|
+
} catch (parseError) {
|
|
57
|
+
console.error("Failed to parse SSE data:", parseError);
|
|
58
|
+
throw parseError;
|
|
74
59
|
}
|
|
75
|
-
buffer = lines[lines.length - 1];
|
|
76
60
|
}
|
|
77
61
|
} finally {
|
|
78
62
|
abortSignal?.removeEventListener("abort", cleanup);
|
|
@@ -80,8 +64,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
|
|
|
80
64
|
}
|
|
81
65
|
|
|
82
66
|
// src/providers/expoArk.ts
|
|
83
|
-
var
|
|
84
|
-
constructor(serverUrl =
|
|
67
|
+
var ExpoOperatorProvider = class extends chunkGHUUT54D_cjs.RestOperatorProvider {
|
|
68
|
+
constructor(serverUrl = chunkGHUUT54D_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
85
69
|
super(serverUrl);
|
|
86
70
|
}
|
|
87
71
|
async *getEventStream(signal, topics) {
|
|
@@ -94,7 +78,7 @@ var ExpoArkProvider = class extends chunkKW7ZEWYS_cjs.RestArkProvider {
|
|
|
94
78
|
url + queryParams,
|
|
95
79
|
signal,
|
|
96
80
|
expoFetch,
|
|
97
|
-
|
|
81
|
+
chunkGHUUT54D_cjs.ARKADE_VERSION_HEADERS,
|
|
98
82
|
(data) => {
|
|
99
83
|
const eventData = data.result || data;
|
|
100
84
|
if (eventData.heartbeat !== void 0) {
|
|
@@ -107,7 +91,7 @@ var ExpoArkProvider = class extends chunkKW7ZEWYS_cjs.RestArkProvider {
|
|
|
107
91
|
if (error instanceof Error && error.name === "AbortError") {
|
|
108
92
|
break;
|
|
109
93
|
}
|
|
110
|
-
if (
|
|
94
|
+
if (chunkGHUUT54D_cjs.isFetchTimeoutError(error)) {
|
|
111
95
|
console.debug("Timeout error ignored");
|
|
112
96
|
continue;
|
|
113
97
|
}
|
|
@@ -121,14 +105,14 @@ var ExpoArkProvider = class extends chunkKW7ZEWYS_cjs.RestArkProvider {
|
|
|
121
105
|
const url = `${this.serverUrl}/v1/txs`;
|
|
122
106
|
while (!signal?.aborted) {
|
|
123
107
|
try {
|
|
124
|
-
yield* sseStreamIterator(url, signal, expoFetch,
|
|
108
|
+
yield* sseStreamIterator(url, signal, expoFetch, chunkGHUUT54D_cjs.ARKADE_VERSION_HEADERS, (data) => {
|
|
125
109
|
return this.parseTransactionNotification(data.result);
|
|
126
110
|
});
|
|
127
111
|
} catch (error) {
|
|
128
112
|
if (error instanceof Error && error.name === "AbortError") {
|
|
129
113
|
break;
|
|
130
114
|
}
|
|
131
|
-
if (
|
|
115
|
+
if (chunkGHUUT54D_cjs.isFetchTimeoutError(error)) {
|
|
132
116
|
console.debug("Timeout error ignored");
|
|
133
117
|
continue;
|
|
134
118
|
}
|
|
@@ -138,10 +122,11 @@ var ExpoArkProvider = class extends chunkKW7ZEWYS_cjs.RestArkProvider {
|
|
|
138
122
|
}
|
|
139
123
|
}
|
|
140
124
|
};
|
|
125
|
+
var ExpoArkProvider = ExpoOperatorProvider;
|
|
141
126
|
|
|
142
127
|
// src/providers/expoIndexer.ts
|
|
143
|
-
var ExpoIndexerProvider = class extends
|
|
144
|
-
constructor(serverUrl =
|
|
128
|
+
var ExpoIndexerProvider = class extends chunkWXNSISXK_cjs.RestIndexerProvider {
|
|
129
|
+
constructor(serverUrl = chunkGHUUT54D_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
145
130
|
super(serverUrl);
|
|
146
131
|
}
|
|
147
132
|
async *subscriptionStream(url, abortSignal) {
|
|
@@ -161,18 +146,13 @@ var ExpoIndexerProvider = class extends chunkZMSM3NOH_cjs.RestIndexerProvider {
|
|
|
161
146
|
abortSignal,
|
|
162
147
|
expoFetch,
|
|
163
148
|
{ "Content-Type": "application/json" },
|
|
164
|
-
|
|
165
|
-
const message = chunkZMSM3NOH_cjs.toSubscriptionMessage(data);
|
|
166
|
-
if (message) return message;
|
|
167
|
-
if (data.code !== void 0) throw chunkKW7ZEWYS_cjs.streamFailureError(data);
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
149
|
+
chunkWXNSISXK_cjs.toSubscriptionMessage
|
|
170
150
|
);
|
|
171
151
|
} catch (error) {
|
|
172
152
|
if (error instanceof Error && error.name === "AbortError") {
|
|
173
153
|
break;
|
|
174
154
|
}
|
|
175
|
-
if (
|
|
155
|
+
if (chunkGHUUT54D_cjs.isFetchTimeoutError(error)) {
|
|
176
156
|
console.debug("Timeout error ignored");
|
|
177
157
|
continue;
|
|
178
158
|
}
|
|
@@ -185,5 +165,6 @@ var ExpoIndexerProvider = class extends chunkZMSM3NOH_cjs.RestIndexerProvider {
|
|
|
185
165
|
|
|
186
166
|
exports.ExpoArkProvider = ExpoArkProvider;
|
|
187
167
|
exports.ExpoIndexerProvider = ExpoIndexerProvider;
|
|
188
|
-
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
168
|
+
exports.ExpoOperatorProvider = ExpoOperatorProvider;
|
|
169
|
+
//# sourceMappingURL=chunk-DNITZVNG.cjs.map
|
|
170
|
+
//# sourceMappingURL=chunk-DNITZVNG.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["baseFetch","readSseFrames","streamFailureError","RestOperatorProvider","DEFAULT_ARKADE_SERVER_URL","ARKADE_VERSION_HEADERS","isFetchTimeoutError","RestIndexerProvider","toSubscriptionMessage"],"mappings":";;;;;;AAYA,eAAsB,aAAa,OAAA,EAA4D;AAC3F,EAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,KAAA;AAE5C,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAAA,OAAA,CAAQ,MAAM,gCAAgC,CAAA;AAC9C,IAAA,OAAO,eAAA,CAAgB,KAAA;AAAA,EAC3B,SAAS,KAAA,EA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A,IACJ;AAAA,EACJ;AACJ","file":"chunk-DNITZVNG.cjs","sourcesContent":["import { baseFetch, fetch } from \"../utils/fetch\";\nimport { readSseFrames } from \"./sseFrames\";\nimport { streamFailureError } from \"./utils\";\n\n/**\n * Dynamically imports expo/fetch, falling back to {@link baseFetch}.\n *\n * Adds no headers of its own: both Expo providers share this function but reach\n * different origins, so each passes its own per request.\n *\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n return expoFetchModule.fetch as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return baseFetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n // Required, not just for cancellation: `getExpoFetch` falls back to\n // `baseFetch`, which bounds any read that brings no signal of its\n // own. Drop this and the stream is truncated at READ_TIMEOUT_MS.\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n for await (const { event, data } of readSseFrames(response.body)) {\n if (abortSignal?.aborted) break;\n if (event === \"failure\") throw streamFailureError(data);\n if (event !== \"message\" || !data.trim()) continue;\n\n try {\n const parsed = parseData(JSON.parse(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 } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport {\n RestOperatorProvider,\n SettlementEvent,\n TxNotificationEvent,\n isFetchTimeoutError,\n} from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { ARKADE_VERSION_HEADERS } from \"../utils/fetch\";\n\n/**\n * Expo-compatible operator 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 { ExpoOperatorProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoOperatorProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoOperatorProvider extends RestOperatorProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(\n url + queryParams,\n signal,\n expoFetch,\n ARKADE_VERSION_HEADERS,\n (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, ARKADE_VERSION_HEADERS, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n\n/** @deprecated Use {@link ExpoOperatorProvider}. */\nexport const ExpoArkProvider = ExpoOperatorProvider;\n/** @deprecated Use {@link ExpoOperatorProvider}. */\nexport type ExpoArkProvider = ExpoOperatorProvider;\n","import {\n RestIndexerProvider,\n SubscriptionEvent,\n SubscriptionHeartbeat,\n toSubscriptionMessage,\n} from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n protected override async *subscriptionStream(\n url: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionEvent | SubscriptionHeartbeat> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch({ requireExpo: isReactNative }).catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n toSubscriptionMessage,\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 chunkGHUUT54D_cjs = require('./chunk-GHUUT54D.cjs');
|
|
4
4
|
var base = require('@scure/base');
|
|
5
5
|
var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
|
|
6
6
|
var btcSigner = require('@scure/btc-signer');
|
|
@@ -68,14 +68,14 @@ var ContractHandlerRegistry = class {
|
|
|
68
68
|
var contractHandlers = new ContractHandlerRegistry();
|
|
69
69
|
exports.DefaultVtxo = void 0;
|
|
70
70
|
((DefaultVtxo2) => {
|
|
71
|
-
class Script3 extends
|
|
71
|
+
class Script3 extends chunkGHUUT54D_cjs.VtxoScript {
|
|
72
72
|
/** Create the default virtual output script with one forfeit path and one exit path. */
|
|
73
73
|
constructor(options) {
|
|
74
74
|
const { pubKey, serverPubKey, csvTimelock } = options;
|
|
75
|
-
const forfeitScript =
|
|
75
|
+
const forfeitScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
|
|
76
76
|
pubkeys: [pubKey, serverPubKey]
|
|
77
77
|
}).script;
|
|
78
|
-
const exitScript =
|
|
78
|
+
const exitScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
|
|
79
79
|
timelock: csvTimelock,
|
|
80
80
|
pubkeys: [pubKey]
|
|
81
81
|
}).script;
|
|
@@ -267,7 +267,7 @@ function extractPubKeyBytes(value) {
|
|
|
267
267
|
return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
|
|
268
268
|
}
|
|
269
269
|
function deserializeCsvTimelock(value) {
|
|
270
|
-
return value !== void 0 && value !== "" ?
|
|
270
|
+
return value !== void 0 && value !== "" ? chunkGHUUT54D_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
271
271
|
}
|
|
272
272
|
var CLTV_HEIGHT_THRESHOLD = 500000000n;
|
|
273
273
|
function isCltvSatisfied(context, locktime) {
|
|
@@ -438,7 +438,7 @@ function deriveVhtlcTapscripts(script) {
|
|
|
438
438
|
function isCsvSpendable(context, sequence) {
|
|
439
439
|
if (sequence === void 0) return true;
|
|
440
440
|
if (!context.vtxo) return false;
|
|
441
|
-
const timelock =
|
|
441
|
+
const timelock = chunkGHUUT54D_cjs.sequenceToTimelock(sequence);
|
|
442
442
|
if (timelock.type === "blocks") {
|
|
443
443
|
if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
|
|
444
444
|
return false;
|
|
@@ -496,21 +496,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
|
|
|
496
496
|
async function detectUsedScripts(indexerProvider, scriptHexes) {
|
|
497
497
|
const used = /* @__PURE__ */ new Set();
|
|
498
498
|
const unique = [...new Set(scriptHexes)];
|
|
499
|
-
for (let offset = 0; offset < unique.length; offset +=
|
|
500
|
-
const scripts = unique.slice(offset, offset +
|
|
499
|
+
for (let offset = 0; offset < unique.length; offset += chunkGHUUT54D_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
500
|
+
const scripts = unique.slice(offset, offset + chunkGHUUT54D_cjs.SCRIPT_QUERY_CHUNK_SIZE);
|
|
501
501
|
const remaining = new Set(scripts);
|
|
502
502
|
let pageIndex = 0;
|
|
503
503
|
let hasMore = true;
|
|
504
504
|
while (hasMore && remaining.size > 0) {
|
|
505
|
-
const { vtxos, page } = await
|
|
505
|
+
const { vtxos, page } = await chunkGHUUT54D_cjs.getNormalizedVtxos(indexerProvider, {
|
|
506
506
|
scripts,
|
|
507
507
|
pageIndex,
|
|
508
|
-
pageSize:
|
|
508
|
+
pageSize: chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE
|
|
509
509
|
});
|
|
510
510
|
for (const vtxo of vtxos) {
|
|
511
511
|
if (remaining.delete(vtxo.script)) used.add(vtxo.script);
|
|
512
512
|
}
|
|
513
|
-
hasMore = page ? vtxos.length ===
|
|
513
|
+
hasMore = page ? vtxos.length === chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE : false;
|
|
514
514
|
pageIndex++;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
@@ -571,7 +571,7 @@ var DefaultContractHandler = {
|
|
|
571
571
|
return {
|
|
572
572
|
pubKey: base.hex.encode(params.pubKey),
|
|
573
573
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
574
|
-
csvTimelock:
|
|
574
|
+
csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
575
575
|
};
|
|
576
576
|
},
|
|
577
577
|
deserializeParams(params) {
|
|
@@ -618,12 +618,12 @@ function discoverDefaultRange(entries, deps) {
|
|
|
618
618
|
}
|
|
619
619
|
exports.DelegateVtxo = void 0;
|
|
620
620
|
((DelegateVtxo2) => {
|
|
621
|
-
class Script3 extends
|
|
621
|
+
class Script3 extends chunkGHUUT54D_cjs.VtxoScript {
|
|
622
622
|
/** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
|
|
623
623
|
constructor(options) {
|
|
624
624
|
const defaultVtxo = new exports.DefaultVtxo.Script(options);
|
|
625
625
|
const { delegatePubKey, pubKey, serverPubKey } = options;
|
|
626
|
-
const delegateScript =
|
|
626
|
+
const delegateScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
|
|
627
627
|
pubkeys: [pubKey, delegatePubKey, serverPubKey]
|
|
628
628
|
}).script;
|
|
629
629
|
super([...defaultVtxo.scripts, delegateScript]);
|
|
@@ -662,7 +662,7 @@ var DelegateContractHandler = {
|
|
|
662
662
|
pubKey: base.hex.encode(params.pubKey),
|
|
663
663
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
664
664
|
delegatePubKey: base.hex.encode(params.delegatePubKey),
|
|
665
|
-
csvTimelock:
|
|
665
|
+
csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
666
666
|
};
|
|
667
667
|
},
|
|
668
668
|
deserializeParams(params) {
|
|
@@ -856,7 +856,7 @@ function getOpcodeValue(name) {
|
|
|
856
856
|
|
|
857
857
|
// src/arkade/bignum.ts
|
|
858
858
|
var bignum_exports = {};
|
|
859
|
-
|
|
859
|
+
chunkGHUUT54D_cjs.__export(bignum_exports, {
|
|
860
860
|
BIGNUM_MAX_BYTES: () => BIGNUM_MAX_BYTES,
|
|
861
861
|
decode: () => decode,
|
|
862
862
|
encode: () => encode
|
|
@@ -1045,7 +1045,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1045
1045
|
// src/script/vhtlc.ts
|
|
1046
1046
|
exports.VHTLC = void 0;
|
|
1047
1047
|
((VHTLC2) => {
|
|
1048
|
-
class BaseScript extends
|
|
1048
|
+
class BaseScript extends chunkGHUUT54D_cjs.VtxoScript {
|
|
1049
1049
|
options;
|
|
1050
1050
|
claimScript;
|
|
1051
1051
|
refundScript;
|
|
@@ -1072,27 +1072,27 @@ exports.VHTLC = void 0;
|
|
|
1072
1072
|
unilateralRefundWithoutReceiverDelay
|
|
1073
1073
|
} = options;
|
|
1074
1074
|
const conditionScript = preimageCondition(preimageHash);
|
|
1075
|
-
const claimScript =
|
|
1075
|
+
const claimScript = chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
|
|
1076
1076
|
conditionScript,
|
|
1077
1077
|
pubkeys: [receiver, server]
|
|
1078
1078
|
}).script;
|
|
1079
|
-
const refundScript =
|
|
1079
|
+
const refundScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
|
|
1080
1080
|
pubkeys: [sender, receiver, server]
|
|
1081
1081
|
}).script;
|
|
1082
|
-
const refundWithoutReceiverScript =
|
|
1082
|
+
const refundWithoutReceiverScript = chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
|
|
1083
1083
|
absoluteTimelock: refundLocktime,
|
|
1084
1084
|
pubkeys: [sender, server]
|
|
1085
1085
|
}).script;
|
|
1086
|
-
const unilateralClaimScript =
|
|
1086
|
+
const unilateralClaimScript = chunkGHUUT54D_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1087
1087
|
conditionScript,
|
|
1088
1088
|
timelock: unilateralClaimDelay,
|
|
1089
1089
|
pubkeys: [receiver]
|
|
1090
1090
|
}).script;
|
|
1091
|
-
const unilateralRefundScript =
|
|
1091
|
+
const unilateralRefundScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
|
|
1092
1092
|
timelock: unilateralRefundDelay,
|
|
1093
1093
|
pubkeys: [sender, receiver]
|
|
1094
1094
|
}).script;
|
|
1095
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1095
|
+
const unilateralRefundWithoutReceiverScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
|
|
1096
1096
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1097
1097
|
pubkeys: [sender]
|
|
1098
1098
|
}).script;
|
|
@@ -1112,7 +1112,7 @@ exports.VHTLC = void 0;
|
|
|
1112
1112
|
const covenants = options.nonInteractiveParameters;
|
|
1113
1113
|
if (covenants) {
|
|
1114
1114
|
arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
|
|
1115
|
-
nonInteractiveClaimScript =
|
|
1115
|
+
nonInteractiveClaimScript = chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
|
|
1116
1116
|
conditionScript,
|
|
1117
1117
|
pubkeys: [
|
|
1118
1118
|
server,
|
|
@@ -1125,12 +1125,12 @@ exports.VHTLC = void 0;
|
|
|
1125
1125
|
covenants.emulatorPubkey,
|
|
1126
1126
|
arkadeScriptNir
|
|
1127
1127
|
);
|
|
1128
|
-
nonInteractiveRefundScript =
|
|
1128
|
+
nonInteractiveRefundScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
|
|
1129
1129
|
pubkeys: [server, receiver, nirCosigner]
|
|
1130
1130
|
}).script;
|
|
1131
1131
|
scripts.push(nonInteractiveRefundScript);
|
|
1132
1132
|
if (covenants.legacy !== "preTimelockedRefund") {
|
|
1133
|
-
nonInteractiveRefundWithoutReceiverScript =
|
|
1133
|
+
nonInteractiveRefundWithoutReceiverScript = chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
|
|
1134
1134
|
absoluteTimelock: refundLocktime,
|
|
1135
1135
|
pubkeys: [server, nirCosigner]
|
|
1136
1136
|
}).script;
|
|
@@ -1406,9 +1406,9 @@ var VHTLCContractHandler = {
|
|
|
1406
1406
|
server: base.hex.encode(params.server),
|
|
1407
1407
|
hash: base.hex.encode(params.preimageHash),
|
|
1408
1408
|
refundLocktime: params.refundLocktime.toString(),
|
|
1409
|
-
claimDelay:
|
|
1410
|
-
refundDelay:
|
|
1411
|
-
refundNoReceiverDelay:
|
|
1409
|
+
claimDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1410
|
+
refundDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1411
|
+
refundNoReceiverDelay: chunkGHUUT54D_cjs.timelockToSequence(
|
|
1412
1412
|
params.unilateralRefundWithoutReceiverDelay
|
|
1413
1413
|
).toString()
|
|
1414
1414
|
};
|
|
@@ -1420,9 +1420,9 @@ var VHTLCContractHandler = {
|
|
|
1420
1420
|
server: base.hex.decode(params.server),
|
|
1421
1421
|
preimageHash: base.hex.decode(params.hash),
|
|
1422
1422
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1423
|
-
unilateralClaimDelay:
|
|
1424
|
-
unilateralRefundDelay:
|
|
1425
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1423
|
+
unilateralClaimDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1424
|
+
unilateralRefundDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1425
|
+
unilateralRefundWithoutReceiverDelay: chunkGHUUT54D_cjs.sequenceToTimelock(
|
|
1426
1426
|
Number(params.refundNoReceiverDelay)
|
|
1427
1427
|
)
|
|
1428
1428
|
};
|
|
@@ -1515,9 +1515,9 @@ var VHTLCV2ContractHandler = {
|
|
|
1515
1515
|
server: base.hex.encode(params.server),
|
|
1516
1516
|
hash: base.hex.encode(params.preimageHash),
|
|
1517
1517
|
refundLocktime: params.refundLocktime.toString(),
|
|
1518
|
-
claimDelay:
|
|
1519
|
-
refundDelay:
|
|
1520
|
-
refundNoReceiverDelay:
|
|
1518
|
+
claimDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1519
|
+
refundDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1520
|
+
refundNoReceiverDelay: chunkGHUUT54D_cjs.timelockToSequence(
|
|
1521
1521
|
params.unilateralRefundWithoutReceiverDelay
|
|
1522
1522
|
).toString(),
|
|
1523
1523
|
// Per-leaf on-disk keys predate the grouped param and older rows carry exactly these;
|
|
@@ -1561,7 +1561,7 @@ var VHTLCV2ContractHandler = {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
if (claim && refund && base.hex.encode(claim.emulatorPubkey) !== base.hex.encode(refund.emulatorPubkey)) {
|
|
1563
1563
|
throw new Error(
|
|
1564
|
-
"emulator covenant params name two different emulator pubkeys: the suite derives both
|
|
1564
|
+
"emulator covenant params name two different emulator pubkeys: the suite derives both covenants from ONE key, so this row cannot be rebuilt as a group"
|
|
1565
1565
|
);
|
|
1566
1566
|
}
|
|
1567
1567
|
if (params.assetTxid === void 0 !== (params.assetGroupIndex === void 0)) {
|
|
@@ -1595,9 +1595,9 @@ var VHTLCV2ContractHandler = {
|
|
|
1595
1595
|
preimageHash: base.hex.decode(params.hash),
|
|
1596
1596
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1597
1597
|
...asset && { asset },
|
|
1598
|
-
unilateralClaimDelay:
|
|
1599
|
-
unilateralRefundDelay:
|
|
1600
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1598
|
+
unilateralClaimDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1599
|
+
unilateralRefundDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1600
|
+
unilateralRefundWithoutReceiverDelay: chunkGHUUT54D_cjs.sequenceToTimelock(
|
|
1601
1601
|
Number(params.refundNoReceiverDelay)
|
|
1602
1602
|
),
|
|
1603
1603
|
...claim && refund && {
|
|
@@ -1758,7 +1758,7 @@ function resolveTimelockValue(value, args) {
|
|
|
1758
1758
|
function resolveCsvTimelock(csv, args) {
|
|
1759
1759
|
const value = resolveTimelockValue(csv.value, args);
|
|
1760
1760
|
if (csv.type !== "sequence") return { type: csv.type, value };
|
|
1761
|
-
const timelock =
|
|
1761
|
+
const timelock = chunkGHUUT54D_cjs.sequenceToCanonicalTimelock(value);
|
|
1762
1762
|
if (!timelock) {
|
|
1763
1763
|
throw new Error(
|
|
1764
1764
|
`csv '${csv.value}' resolved to ${value}, which is not a canonical BIP68 sequence`
|
|
@@ -1906,27 +1906,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
1906
1906
|
if (seg.csv) {
|
|
1907
1907
|
const timelock = resolveCsvTimelock(seg.csv, args);
|
|
1908
1908
|
if (seg.asm) {
|
|
1909
|
-
return
|
|
1909
|
+
return chunkGHUUT54D_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1910
1910
|
conditionScript: resolveAsm(seg.asm, args),
|
|
1911
1911
|
timelock,
|
|
1912
1912
|
pubkeys
|
|
1913
1913
|
});
|
|
1914
1914
|
}
|
|
1915
|
-
return
|
|
1915
|
+
return chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
1916
1916
|
}
|
|
1917
1917
|
if (seg.cltv !== void 0) {
|
|
1918
|
-
return
|
|
1918
|
+
return chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
|
|
1919
1919
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
1920
1920
|
pubkeys
|
|
1921
1921
|
});
|
|
1922
1922
|
}
|
|
1923
1923
|
if (seg.asm) {
|
|
1924
|
-
return
|
|
1924
|
+
return chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
|
|
1925
1925
|
conditionScript: resolveAsm(seg.asm, args),
|
|
1926
1926
|
pubkeys
|
|
1927
1927
|
});
|
|
1928
1928
|
}
|
|
1929
|
-
return
|
|
1929
|
+
return chunkGHUUT54D_cjs.MultisigTapscript.encode({ pubkeys });
|
|
1930
1930
|
}
|
|
1931
1931
|
function compileFunctions(program, args, keys) {
|
|
1932
1932
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2005,7 +2005,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2005
2005
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2006
2006
|
});
|
|
2007
2007
|
}
|
|
2008
|
-
var ArkadeProgramScript = class extends
|
|
2008
|
+
var ArkadeProgramScript = class extends chunkGHUUT54D_cjs.VtxoScript {
|
|
2009
2009
|
constructor(program, args, keys) {
|
|
2010
2010
|
const partial = compileFunctions(program, args, keys);
|
|
2011
2011
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2251,7 +2251,7 @@ function pathsFor(script, context, opts) {
|
|
|
2251
2251
|
continue;
|
|
2252
2252
|
}
|
|
2253
2253
|
if (requiresServer) continue;
|
|
2254
|
-
const sequence = csv ? Number(
|
|
2254
|
+
const sequence = csv ? Number(chunkGHUUT54D_cjs.timelockToSequence(csv)) : void 0;
|
|
2255
2255
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2256
2256
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2257
2257
|
continue;
|
|
@@ -2383,5 +2383,5 @@ exports.toXOnly = toXOnly;
|
|
|
2383
2383
|
exports.validateParamValue = validateParamValue;
|
|
2384
2384
|
exports.validateProgram = validateProgram;
|
|
2385
2385
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
2386
|
-
//# sourceMappingURL=chunk-
|
|
2387
|
-
//# sourceMappingURL=chunk-
|
|
2386
|
+
//# sourceMappingURL=chunk-E6OOJEHL.cjs.map
|
|
2387
|
+
//# sourceMappingURL=chunk-E6OOJEHL.cjs.map
|