@arkade-os/sdk 0.4.67 → 0.5.0-rc.0
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 +40 -5
- 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/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-Za-e_zMk.d.ts → asyncStorageTaskQueue-BCzN3Y45.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-LTpeXYaD.d.cts → asyncStorageTaskQueue-CdF_ELX8.d.cts} +2 -2
- package/dist/{chunk-MJUTO3PY.cjs → chunk-5MJHZHG7.cjs} +771 -477
- package/dist/chunk-5MJHZHG7.cjs.map +1 -0
- package/dist/{chunk-2JV4VQ7C.cjs → chunk-6AFUNKK7.cjs} +33 -7
- package/dist/chunk-6AFUNKK7.cjs.map +1 -0
- package/dist/{chunk-AEWJU6NZ.js → chunk-6F2Q32KA.js} +352 -59
- package/dist/chunk-6F2Q32KA.js.map +1 -0
- package/dist/{chunk-EALWOVHK.js → chunk-ABJPM4JF.js} +4 -4
- package/dist/{chunk-EALWOVHK.js.map → chunk-ABJPM4JF.js.map} +1 -1
- package/dist/{chunk-CO3KKSWM.cjs → chunk-CZ32XADN.cjs} +17 -17
- package/dist/{chunk-CO3KKSWM.cjs.map → chunk-CZ32XADN.cjs.map} +1 -1
- package/dist/{chunk-X3VEMUVV.js → chunk-FVTJJQNM.js} +3 -3
- package/dist/{chunk-X3VEMUVV.js.map → chunk-FVTJJQNM.js.map} +1 -1
- package/dist/{chunk-OIZ2V2VD.cjs → chunk-HL7EC2Z5.cjs} +121 -170
- package/dist/chunk-HL7EC2Z5.cjs.map +1 -0
- package/dist/{chunk-MZFUZUTQ.js → chunk-JYP7YXT2.js} +4 -4
- package/dist/{chunk-MZFUZUTQ.js.map → chunk-JYP7YXT2.js.map} +1 -1
- package/dist/{chunk-6TAQF6EV.js → chunk-KTU44AEH.js} +75 -124
- package/dist/chunk-KTU44AEH.js.map +1 -0
- package/dist/{chunk-YDRZDZPP.cjs → chunk-PB5KJI4U.cjs} +10 -10
- package/dist/{chunk-YDRZDZPP.cjs.map → chunk-PB5KJI4U.cjs.map} +1 -1
- package/dist/{chunk-3WIWNE4P.js → chunk-PPG6W34P.js} +30 -8
- package/dist/chunk-PPG6W34P.js.map +1 -0
- package/dist/{chunk-R2YAMONM.cjs → chunk-RXWKCEZP.cjs} +17 -17
- package/dist/{chunk-R2YAMONM.cjs.map → chunk-RXWKCEZP.cjs.map} +1 -1
- 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-Bz2e2zXY.d.cts → delegate-DLIOBQ5x.d.cts} +1 -1
- package/dist/{delegate-cdmzb2f9.d.ts → delegate-Dyn5L80J.d.ts} +1 -1
- package/dist/{hdWalletCapable-BSjuUYOO.d.cts → hdWalletCapable-D9tooZ6F.d.ts} +102 -27
- package/dist/{hdWalletCapable-Hi12xjCJ.d.ts → hdWalletCapable-Dt3MUiGE.d.cts} +102 -27
- package/dist/{index-BiACuWaf.d.ts → index-D3hmsuKs.d.cts} +100 -123
- package/dist/{index-D2GjZxBr.d.cts → index-D9tXd-tN.d.ts} +100 -123
- package/dist/{index-DU5o_hz7.d.ts → index-Udm5V2xW.d.cts} +184 -19
- package/dist/{index-DU5o_hz7.d.cts → index-Udm5V2xW.d.ts} +184 -19
- package/dist/index.cjs +309 -289
- package/dist/index.d.cts +125 -29
- package/dist/index.d.ts +125 -29
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- 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 +18 -18
- 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-BZJMLQ6g.d.cts → taskRunner-DxZciNaa.d.cts} +2 -2
- package/dist/{taskRunner-DATaRQus.d.ts → taskRunner-ZdS16Ypm.d.ts} +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 +23 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -4
- package/dist/wallet/expo/index.d.ts +7 -4
- package/dist/wallet/expo/index.js +14 -5
- package/dist/wallet/expo/index.js.map +1 -1
- 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 +3 -2
- package/dist/chunk-2JV4VQ7C.cjs.map +0 -1
- package/dist/chunk-3WIWNE4P.js.map +0 -1
- package/dist/chunk-6TAQF6EV.js.map +0 -1
- package/dist/chunk-AEWJU6NZ.js.map +0 -1
- package/dist/chunk-MJUTO3PY.cjs.map +0 -1
- package/dist/chunk-OIZ2V2VD.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkCZ32XADN_cjs = require('./chunk-CZ32XADN.cjs');
|
|
4
|
+
var chunk6AFUNKK7_cjs = require('./chunk-6AFUNKK7.cjs');
|
|
5
5
|
|
|
6
6
|
// src/providers/expoUtils.ts
|
|
7
7
|
async function getExpoFetch(options) {
|
|
@@ -10,8 +10,8 @@ async function getExpoFetch(options) {
|
|
|
10
10
|
console.debug("Using expo/fetch for streaming");
|
|
11
11
|
const expoFetchWithHeader = (input, init) => {
|
|
12
12
|
const headers = new Headers(init?.headers);
|
|
13
|
-
headers.set("X-Build-Version",
|
|
14
|
-
headers.set("X-SDK-VERSION",
|
|
13
|
+
headers.set("X-Build-Version", chunk6AFUNKK7_cjs.buildVersion);
|
|
14
|
+
headers.set("X-SDK-VERSION", chunk6AFUNKK7_cjs.sdkVersion);
|
|
15
15
|
return expoFetchModule.fetch(input, { ...init, headers });
|
|
16
16
|
};
|
|
17
17
|
return expoFetchWithHeader;
|
|
@@ -20,7 +20,7 @@ async function getExpoFetch(options) {
|
|
|
20
20
|
"Using standard fetch instead of expo/fetch. Streaming may not be fully supported in some environments.",
|
|
21
21
|
error
|
|
22
22
|
);
|
|
23
|
-
return
|
|
23
|
+
return chunk6AFUNKK7_cjs.fetch;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
|
|
@@ -77,8 +77,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// src/providers/expoArk.ts
|
|
80
|
-
var ExpoArkProvider = class extends
|
|
81
|
-
constructor(serverUrl =
|
|
80
|
+
var ExpoArkProvider = class extends chunk6AFUNKK7_cjs.RestArkProvider {
|
|
81
|
+
constructor(serverUrl = chunk6AFUNKK7_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
82
82
|
super(serverUrl);
|
|
83
83
|
}
|
|
84
84
|
async *getEventStream(signal, topics) {
|
|
@@ -98,7 +98,7 @@ var ExpoArkProvider = class extends chunk2JV4VQ7C_cjs.RestArkProvider {
|
|
|
98
98
|
if (error instanceof Error && error.name === "AbortError") {
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
101
|
+
if (chunk6AFUNKK7_cjs.isFetchTimeoutError(error)) {
|
|
102
102
|
console.debug("Timeout error ignored");
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
@@ -119,7 +119,7 @@ var ExpoArkProvider = class extends chunk2JV4VQ7C_cjs.RestArkProvider {
|
|
|
119
119
|
if (error instanceof Error && error.name === "AbortError") {
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
|
-
if (
|
|
122
|
+
if (chunk6AFUNKK7_cjs.isFetchTimeoutError(error)) {
|
|
123
123
|
console.debug("Timeout error ignored");
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
@@ -131,8 +131,8 @@ var ExpoArkProvider = class extends chunk2JV4VQ7C_cjs.RestArkProvider {
|
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
// src/providers/expoIndexer.ts
|
|
134
|
-
var ExpoIndexerProvider = class extends
|
|
135
|
-
constructor(serverUrl =
|
|
134
|
+
var ExpoIndexerProvider = class extends chunkCZ32XADN_cjs.RestIndexerProvider {
|
|
135
|
+
constructor(serverUrl = chunk6AFUNKK7_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
136
136
|
super(serverUrl);
|
|
137
137
|
}
|
|
138
138
|
async *getSubscription(subscriptionId, abortSignal) {
|
|
@@ -161,9 +161,9 @@ var ExpoIndexerProvider = class extends chunkCO3KKSWM_cjs.RestIndexerProvider {
|
|
|
161
161
|
return {
|
|
162
162
|
txid: data.event.txid,
|
|
163
163
|
scripts: data.event.scripts || [],
|
|
164
|
-
newVtxos: (data.event.newVtxos || []).map(
|
|
165
|
-
spentVtxos: (data.event.spentVtxos || []).map(
|
|
166
|
-
sweptVtxos: (data.event.sweptVtxos || []).map(
|
|
164
|
+
newVtxos: (data.event.newVtxos || []).map(chunk6AFUNKK7_cjs.convertVtxo),
|
|
165
|
+
spentVtxos: (data.event.spentVtxos || []).map(chunk6AFUNKK7_cjs.convertVtxo),
|
|
166
|
+
sweptVtxos: (data.event.sweptVtxos || []).map(chunk6AFUNKK7_cjs.convertVtxo),
|
|
167
167
|
tx: data.event.tx,
|
|
168
168
|
checkpointTxs: data.event.checkpointTxs
|
|
169
169
|
};
|
|
@@ -175,7 +175,7 @@ var ExpoIndexerProvider = class extends chunkCO3KKSWM_cjs.RestIndexerProvider {
|
|
|
175
175
|
if (error instanceof Error && error.name === "AbortError") {
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (chunk6AFUNKK7_cjs.isFetchTimeoutError(error)) {
|
|
179
179
|
console.debug("Timeout error ignored");
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
@@ -188,5 +188,5 @@ var ExpoIndexerProvider = class extends chunkCO3KKSWM_cjs.RestIndexerProvider {
|
|
|
188
188
|
|
|
189
189
|
exports.ExpoArkProvider = ExpoArkProvider;
|
|
190
190
|
exports.ExpoIndexerProvider = ExpoIndexerProvider;
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-RXWKCEZP.cjs.map
|
|
192
|
+
//# sourceMappingURL=chunk-RXWKCEZP.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["buildVersion","sdkVersion","fetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,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,mBAAmBA,8BAAY,CAAA;AAC3C,MAAA,OAAA,CAAQ,GAAA,CAAI,iBAAiBC,4BAAU,CA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,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-R2YAMONM.cjs","sourcesContent":["import { fetch, buildVersion, sdkVersion } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch with fallback to standard fetch.\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n const expoFetchWithHeader = (input: RequestInfo, init?: RequestInit) => {\n const headers = new Headers(init?.headers);\n headers.set(\"X-Build-Version\", buildVersion);\n headers.set(\"X-SDK-VERSION\", sdkVersion);\n return expoFetchModule.fetch(input, { ...init, headers });\n };\n return expoFetchWithHeader as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return fetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n 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":["buildVersion","sdkVersion","fetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,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,mBAAmBA,8BAAY,CAAA;AAC3C,MAAA,OAAA,CAAQ,GAAA,CAAI,iBAAiBC,4BAAU,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,OAAOC,uBAAA;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;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K,KAAA,CAAM,IAAA;AAAA,gBACjB,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,OAAA,IAAW,EAAC;AAAA,gBAChC,WAAW,IAAA,CAAK,KAAA,CAAM,YAAY,EAAC,EAAG,IAAIG,6BAAW,CAAA;AAAA,gBACrD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAIA,6BAAW,CAAA;AAAA,gBACzD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAIA,6BAAW,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,IAAIF,qCAAA,CAAoB,KAAK,CAAA,EAAG;AAC5B,UAAA,OAAA,CAAQ,MAAM,uBAAuB,CAAA;AACrC,UAAA;AAAA,QACJ;AAEA,QAAA,OAAA,CAAQ,KAAA,CAAM,uBAAuB,KAAK,CAAA;AAC1C,QAAA,MAAM,KAAA;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ","file":"chunk-RXWKCEZP.cjs","sourcesContent":["import { fetch, buildVersion, sdkVersion } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch with fallback to standard fetch.\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n const expoFetchWithHeader = (input: RequestInfo, init?: RequestInit) => {\n const headers = new Headers(init?.headers);\n headers.set(\"X-Build-Version\", buildVersion);\n headers.set(\"X-SDK-VERSION\", sdkVersion);\n return expoFetchModule.fetch(input, { ...init, headers });\n };\n return expoFetchWithHeader as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return fetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotificationEvent, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkHL7EC2Z5_cjs = require('../../chunk-HL7EC2Z5.cjs');
|
|
4
|
+
require('../../chunk-6AFUNKK7.cjs');
|
|
5
5
|
require('../../chunk-5BLDMQED.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "ArkadeContractHandler", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkHL7EC2Z5_cjs.ArkadeContractHandler; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "BoardingContractHandler", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkHL7EC2Z5_cjs.BoardingContractHandler; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "DefaultContractHandler", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkHL7EC2Z5_cjs.DefaultContractHandler; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "DelegateContractHandler", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkHL7EC2Z5_cjs.DelegateContractHandler; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "VHTLCContractHandler", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkHL7EC2Z5_cjs.VHTLCContractHandler; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "VHTLCV2ContractHandler", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkHL7EC2Z5_cjs.VHTLCV2ContractHandler; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "contractHandlers", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkHL7EC2Z5_cjs.contractHandlers; }
|
|
36
36
|
});
|
|
37
37
|
//# sourceMappingURL=index.cjs.map
|
|
38
38
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-
|
|
2
|
-
import '../../index-
|
|
1
|
+
export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-D3hmsuKs.cjs';
|
|
2
|
+
import '../../index-Udm5V2xW.cjs';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer';
|
|
6
6
|
import '@scure/btc-signer/psbt.js';
|
|
7
|
-
import '../../delegate-
|
|
7
|
+
import '../../delegate-DLIOBQ5x.cjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-
|
|
2
|
-
import '../../index-
|
|
1
|
+
export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-D9tXd-tN.js';
|
|
2
|
+
import '../../index-Udm5V2xW.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer';
|
|
6
6
|
import '@scure/btc-signer/psbt.js';
|
|
7
|
-
import '../../delegate-
|
|
7
|
+
import '../../delegate-Dyn5L80J.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-KTU44AEH.js';
|
|
2
|
+
import '../../chunk-PPG6W34P.js';
|
|
3
3
|
import '../../chunk-NSBPE2FW.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-Udm5V2xW.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DefaultVtxo is the default implementation of a VtxoScript.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-Udm5V2xW.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DefaultVtxo is the default implementation of a VtxoScript.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-Udm5V2xW.js';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
5
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
5
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Dyn5L80J.js';
|
|
6
6
|
|
|
7
7
|
/** Wall-clock floor for `batchExpiry` outside regtest. */
|
|
8
8
|
declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
|
|
@@ -48,10 +48,11 @@ declare const DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 86400n;
|
|
|
48
48
|
/**
|
|
49
49
|
* Wall-clock floor for the checkpoint exit delay on regtest (~2 blocks nominal).
|
|
50
50
|
*
|
|
51
|
-
* Deliberately lower than {@link REGTEST_MIN_BATCH_EXPIRY_SECONDS "../wallet/batchExpiry"} —
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* Deliberately lower than {@link REGTEST_MIN_BATCH_EXPIRY_SECONDS "../wallet/batchExpiry"} — it
|
|
52
|
+
* was sized to clear an `ARKD_CHECKPOINT_EXIT_DELAY` of 5 blocks while still rejecting a 1-block
|
|
53
|
+
* attack. No env in this repo goes below 20 any more (the 5-block one shipped with the removed
|
|
54
|
+
* boltz-swap package), so there is room to tighten this; left as-is until someone confirms no
|
|
55
|
+
* external regtest deployment relies on the lower bound.
|
|
55
56
|
*/
|
|
56
57
|
declare const REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 1200n;
|
|
57
58
|
/**
|
|
@@ -75,7 +76,7 @@ declare const MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 4096n;
|
|
|
75
76
|
* mutinynet does.
|
|
76
77
|
*/
|
|
77
78
|
declare const SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 86016n;
|
|
78
|
-
/** Bounds applied to a server-supplied `
|
|
79
|
+
/** Bounds applied to a server-supplied `ArkadeInfo.checkpointTapscript`. */
|
|
79
80
|
type CheckpointExitDelayPolicy = {
|
|
80
81
|
/** Minimum wall-clock delay in seconds, after normalization. */
|
|
81
82
|
minSeconds: bigint;
|
|
@@ -90,7 +91,7 @@ type CheckpointExitDelayPolicy = {
|
|
|
90
91
|
* arkd always builds the checkpoint tapscript from its own `forfeitPubkey`
|
|
91
92
|
* (`internal/core/application/service.go`), so this should be the
|
|
92
93
|
* `forfeitPubkey` the caller already trusts — pinned wallet state where one
|
|
93
|
-
* exists, otherwise the same `
|
|
94
|
+
* exists, otherwise the same `ArkadeInfo` response's own `forfeitPubkey` field
|
|
94
95
|
* as a self-consistency check.
|
|
95
96
|
*/
|
|
96
97
|
advertisedForfeitPubkey?: Bytes;
|
|
@@ -211,7 +212,7 @@ declare class ServerResponseMismatchError extends Error {
|
|
|
211
212
|
*/
|
|
212
213
|
declare function maybeArkError(error: any): ArkError | undefined;
|
|
213
214
|
|
|
214
|
-
/** Where the {@link
|
|
215
|
+
/** Where the {@link ArkadeInfo} used to construct a wallet came from. */
|
|
215
216
|
type ServerInfoSource = "live" | "cache";
|
|
216
217
|
|
|
217
218
|
/**
|
|
@@ -729,6 +730,13 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
729
730
|
readonly identity: ReadonlyIdentity;
|
|
730
731
|
readonly network: Network;
|
|
731
732
|
readonly onchainProvider: OnchainProvider;
|
|
733
|
+
/**
|
|
734
|
+
* Narrowed to what a readonly wallet legitimately needs — the only use
|
|
735
|
+
* here is {@link getArkadeInfo}. `protected` stops an outside caller
|
|
736
|
+
* reaching it; the `Pick` stops this class growing a use for
|
|
737
|
+
* `submitTx`. `Wallet` re-widens both below.
|
|
738
|
+
*/
|
|
739
|
+
protected readonly arkProvider: Pick<ArkProvider, "getInfo">;
|
|
732
740
|
readonly indexerProvider: IndexerProvider;
|
|
733
741
|
readonly dustAmount: bigint;
|
|
734
742
|
readonly walletRepository: WalletRepository;
|
|
@@ -793,26 +801,33 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
793
801
|
*/
|
|
794
802
|
protected _arkServerPublicKey: Bytes;
|
|
795
803
|
/**
|
|
796
|
-
* Whether
|
|
797
|
-
*
|
|
798
|
-
* (`"cache"`).
|
|
804
|
+
* Whether the LATEST server-info resolution answered live (`"live"`) or
|
|
805
|
+
* from the cached snapshot because the operator was unreachable
|
|
806
|
+
* (`"cache"`). Seeded at construction and updated by every
|
|
807
|
+
* {@link getArkadeInfo} read, so a wallet that booted offline and
|
|
808
|
+
* recovered stops reporting degraded — and one that just fell back stops
|
|
809
|
+
* claiming online. Freshness signal for
|
|
810
|
+
* {@link getProviderConnectionState}.
|
|
799
811
|
*/
|
|
800
812
|
protected _serverInfoSource: ServerInfoSource;
|
|
801
813
|
/**
|
|
802
|
-
* Epoch-ms of the last known live operator contact:
|
|
803
|
-
*
|
|
814
|
+
* Epoch-ms of the last known live operator contact: the most recent live
|
|
815
|
+
* resolution (construction or a later {@link getArkadeInfo}), or the
|
|
816
|
+
* cached snapshot's `savedAt` when the latest resolution fell back.
|
|
804
817
|
*/
|
|
805
818
|
protected _serverInfoLastOnlineAt?: number;
|
|
806
819
|
/** @see {@link _serverInfoSource} */
|
|
807
820
|
get serverInfoSource(): ServerInfoSource;
|
|
808
821
|
/**
|
|
809
|
-
* Composed provider-connection freshness: the
|
|
810
|
-
* (
|
|
811
|
-
* manager
|
|
812
|
-
*
|
|
813
|
-
*
|
|
822
|
+
* Composed provider-connection freshness: the LATEST server-info
|
|
823
|
+
* resolution (boot, or any later {@link getArkadeInfo} read) combined with
|
|
824
|
+
* the contract-manager's indexer-sync health, if the manager has been
|
|
825
|
+
* initialized. Reads no live provider state — it never forces a
|
|
826
|
+
* `ContractManager` to construct — so it is safe for readonly callers
|
|
827
|
+
* that only use address/balance APIs.
|
|
814
828
|
*
|
|
815
|
-
* -
|
|
829
|
+
* - Latest resolution fell back to the cached snapshot → degraded on
|
|
830
|
+
* `arkade` (`cache`).
|
|
816
831
|
* - Otherwise, if the contract manager has degraded to repository data →
|
|
817
832
|
* degraded on `indexer` (`repository`).
|
|
818
833
|
* - Otherwise online.
|
|
@@ -829,10 +844,17 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
829
844
|
* (e.g. the service-worker sync-state message).
|
|
830
845
|
*/
|
|
831
846
|
getContractSyncState(): ContractSyncState;
|
|
832
|
-
protected constructor(identity: ReadonlyIdentity, network: Network, onchainProvider: OnchainProvider,
|
|
847
|
+
protected constructor(identity: ReadonlyIdentity, network: Network, onchainProvider: OnchainProvider,
|
|
848
|
+
/**
|
|
849
|
+
* Narrowed to what a readonly wallet legitimately needs — the only use
|
|
850
|
+
* here is {@link getArkadeInfo}. `protected` stops an outside caller
|
|
851
|
+
* reaching it; the `Pick` stops this class growing a use for
|
|
852
|
+
* `submitTx`. `Wallet` re-widens both below.
|
|
853
|
+
*/
|
|
854
|
+
arkProvider: Pick<ArkProvider, "getInfo">, indexerProvider: IndexerProvider, arkServerPublicKey: Bytes, offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script, boardingTapscript: DefaultVtxo.Script, dustAmount: bigint, walletRepository: WalletRepository, contractRepository: ContractRepository, delegateProvider?: DelegateProvider | undefined, watcherConfig?: ReadonlyWalletConfig["watcherConfig"], walletContractTimelocks?: RelativeTimelock[]);
|
|
833
855
|
/**
|
|
834
856
|
* x-only hex of the operator's deprecated signer keys (from
|
|
835
|
-
* `
|
|
857
|
+
* `ArkadeInfo.deprecatedSigners`), cached for the OFFLINE read/watch paths.
|
|
836
858
|
* The boarding watch/history surfaces ({@link getBoardingAddresses},
|
|
837
859
|
* {@link getBoardingTxs}) fan out over {current} ∪ this set so a deposit at
|
|
838
860
|
* a boarding address minted under a now-rotated operator signer keeps being
|
|
@@ -869,7 +891,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
869
891
|
* against mid-flight rotation pass their snapshot, so the check reads from
|
|
870
892
|
* one rotation epoch.
|
|
871
893
|
*/
|
|
872
|
-
protected recipientAddressContext(serverPubKey?: Bytes):
|
|
894
|
+
protected recipientAddressContext(serverPubKey?: Bytes): RecipientArkadeAddressContext;
|
|
873
895
|
/**
|
|
874
896
|
* Currently-active receive tapscript. Read-only from the outside;
|
|
875
897
|
* mutated only via {@link Wallet.setOffchainTapscriptForRotation}
|
|
@@ -884,6 +906,45 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
884
906
|
* span a rotation.
|
|
885
907
|
*/
|
|
886
908
|
get arkServerPublicKey(): Bytes;
|
|
909
|
+
/**
|
|
910
|
+
* Server info for the Arkade server this wallet is connected to, resolved
|
|
911
|
+
* exactly as construction resolves it: live wins, a retryable failure
|
|
912
|
+
* falls back to the snapshot persisted at boot, a terminal one propagates.
|
|
913
|
+
*
|
|
914
|
+
* Live rather than the pinned boot snapshot because the fields callers
|
|
915
|
+
* come here for — `signerPubkey`, `checkpointTapscript`, `fees` — are the
|
|
916
|
+
* ones a mid-session rotation moves, and a covenant built against a
|
|
917
|
+
* superseded signer is unspendable.
|
|
918
|
+
*
|
|
919
|
+
* One rotation caveat: reading does NOT re-pin the wallet —
|
|
920
|
+
* {@link arkServerPublicKey}, {@link dustAmount} and the tapscripts move
|
|
921
|
+
* only through `handleServerInfoChanged`/`rotateServerSigner` — so inside
|
|
922
|
+
* a rotation window this can report epoch N+1 while the wallet still
|
|
923
|
+
* spends on N. The window closes on its own: a read that observes a moved
|
|
924
|
+
* digest makes the provider emit `onServerInfoChanged`, which is what
|
|
925
|
+
* drives that rotation. A caller about to bind the answer into a covenant
|
|
926
|
+
* passes `{ requireLive: true }` and fails closed instead of receiving
|
|
927
|
+
* the boot snapshot.
|
|
928
|
+
*
|
|
929
|
+
* @returns The Arkade server's info
|
|
930
|
+
* @see ArkadeInfo
|
|
931
|
+
*/
|
|
932
|
+
getArkadeInfo(opts?: GetArkadeInfoOptions): Promise<ArkadeInfo>;
|
|
933
|
+
/**
|
|
934
|
+
* Chain reads against this wallet's server for scripts it does not own.
|
|
935
|
+
*
|
|
936
|
+
* Binds the wallet's own `indexerProvider` — which may be an Expo or
|
|
937
|
+
* injected one that a caller's hand-built `RestIndexerProvider` would
|
|
938
|
+
* silently bypass. `getVtxos` goes through
|
|
939
|
+
* {@link getNormalizedVtxos}, which is what makes every VTXO leaving the
|
|
940
|
+
* seam carry its canonical facts.
|
|
941
|
+
*
|
|
942
|
+
* A bound object rather than the provider itself, so an `IReadonlyWallet`
|
|
943
|
+
* holder gets `getVtxos`/`getVirtualTxs` and nothing else at runtime.
|
|
944
|
+
* (`indexerProvider` is still public on the concrete classes, unlike
|
|
945
|
+
* `arkProvider`, so this narrows the interface rather than the field.)
|
|
946
|
+
*/
|
|
947
|
+
getArkadeReader(): Promise<ArkadeReader>;
|
|
887
948
|
/**
|
|
888
949
|
* The wallet's current boarding tapscript (the on-chain onboarding
|
|
889
950
|
* target). Read-only from the outside; mutated only via
|
|
@@ -931,7 +992,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
931
992
|
dustAmount: bigint;
|
|
932
993
|
walletRepository: WalletRepository;
|
|
933
994
|
contractRepository: ContractRepository;
|
|
934
|
-
info:
|
|
995
|
+
info: ArkadeInfo;
|
|
935
996
|
serverInfoSource: ServerInfoSource;
|
|
936
997
|
serverInfoLastOnlineAt: number | undefined;
|
|
937
998
|
delegateProvider: DelegateProvider | undefined;
|
|
@@ -1224,7 +1285,6 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
1224
1285
|
* ```
|
|
1225
1286
|
*/
|
|
1226
1287
|
declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable, AddressAllocationCapable {
|
|
1227
|
-
readonly arkProvider: ArkProvider;
|
|
1228
1288
|
readonly forfeitOutputScript: Bytes;
|
|
1229
1289
|
readonly forfeitPubkey: Bytes;
|
|
1230
1290
|
/** Overrides for the `batchExpiry` bounds; defaults derive from `network`. */
|
|
@@ -1346,7 +1406,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1346
1406
|
/**
|
|
1347
1407
|
* Output script for checkpoint transactions, decoded from the server's
|
|
1348
1408
|
* `checkpointTapscript`. Server-controlled state: pinned at construction
|
|
1349
|
-
* and re-sourced from a fresh `
|
|
1409
|
+
* and re-sourced from a fresh `ArkadeInfo` on server-signer rotation. Read it
|
|
1350
1410
|
* through {@link serverUnrollScript}; write it only through
|
|
1351
1411
|
* {@link setServerUnrollScriptForRotation}.
|
|
1352
1412
|
*/
|
|
@@ -1355,7 +1415,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1355
1415
|
/**
|
|
1356
1416
|
* @internal Sole write path for `serverUnrollScript` after construction.
|
|
1357
1417
|
* Called by {@link Wallet._doRotateServerSigner} with the checkpoint script
|
|
1358
|
-
* sourced from the fresh `
|
|
1418
|
+
* sourced from the fresh `ArkadeInfo` that triggered the rotation, so the send
|
|
1359
1419
|
* path builds checkpoints against the new server epoch. External code must
|
|
1360
1420
|
* treat `serverUnrollScript` as read-only.
|
|
1361
1421
|
*/
|
|
@@ -1638,6 +1698,21 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1638
1698
|
thresholdMs: number;
|
|
1639
1699
|
};
|
|
1640
1700
|
readonly settlementConfig: SettlementConfig | false;
|
|
1701
|
+
/**
|
|
1702
|
+
* Re-widened to public: a full wallet's provider is part of its API
|
|
1703
|
+
* (`ExpoWallet` and the delegate manager read it), while `ReadonlyWallet`
|
|
1704
|
+
* keeps it protected so a readonly view cannot hand out `submitTx`.
|
|
1705
|
+
*/
|
|
1706
|
+
readonly arkProvider: ArkProvider;
|
|
1707
|
+
/**
|
|
1708
|
+
* Broadcast access bound to this wallet's server, so a plugin needs only
|
|
1709
|
+
* the wallet.
|
|
1710
|
+
*
|
|
1711
|
+
* Defined here and not on {@link ReadonlyWallet} for the same reason
|
|
1712
|
+
* `arkProvider` is protected there: a readonly wallet, and every
|
|
1713
|
+
* `toReadonly()` view, must not be able to submit.
|
|
1714
|
+
*/
|
|
1715
|
+
getArkadeBroadcaster(): Promise<ArkadeBroadcaster>;
|
|
1641
1716
|
protected constructor(identity: Identity, network: Network, onchainProvider: OnchainProvider, arkProvider: ArkProvider, indexerProvider: IndexerProvider, arkServerPublicKey: Bytes, offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script, boardingTapscript: DefaultVtxo.Script, serverUnrollScript: CSVMultisigTapscript.Type, forfeitOutputScript: Bytes, forfeitPubkey: Bytes, dustAmount: bigint, walletRepository: WalletRepository, contractRepository: ContractRepository,
|
|
1642
1717
|
/** @deprecated Use settlementConfig */
|
|
1643
1718
|
renewalConfig?: WalletConfig["renewalConfig"], delegateProvider?: DelegateProvider, watcherConfig?: WalletConfig["watcherConfig"], settlementConfig?: WalletConfig["settlementConfig"], walletContractTimelocks?: RelativeTimelock[], receiveRotator?: WalletReceiveRotator, descriptorProvider?: DescriptorProvider, lookAheadWindow?: number,
|