@arkade-os/sdk 0.4.73 → 0.4.75
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/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-DA2OdpJ0.d.cts → asyncStorageTaskQueue-5k0H_cDM.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-C5IwA_Hs.d.ts → asyncStorageTaskQueue-DjwCbb07.d.ts} +2 -2
- package/dist/{chunk-L7IEXVXI.cjs → chunk-2Q2PYU3Y.cjs} +10 -10
- package/dist/{chunk-L7IEXVXI.cjs.map → chunk-2Q2PYU3Y.cjs.map} +1 -1
- package/dist/{chunk-QX2M67YI.js → chunk-2ULUCL6A.js} +21 -22
- package/dist/chunk-2ULUCL6A.js.map +1 -0
- package/dist/{chunk-G5RPUZJE.js → chunk-4GLSOP6L.js} +12 -5
- package/dist/chunk-4GLSOP6L.js.map +1 -0
- package/dist/{chunk-C4RKZY7D.cjs → chunk-EHJYR4E5.cjs} +827 -580
- package/dist/chunk-EHJYR4E5.cjs.map +1 -0
- package/dist/{chunk-YHJJSLE5.js → chunk-FTLPTF3R.js} +391 -147
- package/dist/chunk-FTLPTF3R.js.map +1 -0
- package/dist/{chunk-KJ5E646Y.cjs → chunk-J5EX3OMM.cjs} +8 -4
- package/dist/chunk-J5EX3OMM.cjs.map +1 -0
- package/dist/{chunk-M6HIWM5N.js → chunk-PS564TAU.js} +3 -3
- package/dist/{chunk-M6HIWM5N.js.map → chunk-PS564TAU.js.map} +1 -1
- package/dist/{chunk-D5DLGVN4.cjs → chunk-SH23SRZE.cjs} +17 -17
- package/dist/{chunk-D5DLGVN4.cjs.map → chunk-SH23SRZE.cjs.map} +1 -1
- package/dist/{chunk-5YCAC6XE.js → chunk-SKAL4MCW.js} +4 -4
- package/dist/{chunk-5YCAC6XE.js.map → chunk-SKAL4MCW.js.map} +1 -1
- package/dist/{chunk-OV4GLPZI.js → chunk-UKFA7NVE.js} +8 -4
- package/dist/chunk-UKFA7NVE.js.map +1 -0
- package/dist/{chunk-ZLDO4QDR.cjs → chunk-YA3L3WL4.cjs} +31 -32
- package/dist/chunk-YA3L3WL4.cjs.map +1 -0
- package/dist/{chunk-2D7F5IU3.cjs → chunk-YYWEBYFJ.cjs} +58 -51
- package/dist/chunk-YYWEBYFJ.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-BJp8f6LT.d.cts → delegate-D0v8yT-a.d.cts} +1 -1
- package/dist/{delegate-Ckz_TWzM.d.ts → delegate-D_sW61rj.d.ts} +1 -1
- package/dist/{hdWalletCapable-DABgAD-T.d.ts → hdWalletCapable-66hG5KQP.d.cts} +3 -11
- package/dist/{hdWalletCapable-DA9bJ5eB.d.cts → hdWalletCapable-DHCNbAgl.d.ts} +3 -11
- package/dist/{index-DSbDm0Io.d.cts → index-B2JSxDi1.d.cts} +2 -2
- package/dist/{index-Dg0-TvBQ.d.cts → index-TZBbMNqA.d.cts} +22 -7
- package/dist/{index-Dg0-TvBQ.d.ts → index-TZBbMNqA.d.ts} +22 -7
- package/dist/{index-B8xrELXY.d.ts → index-vUeTpifq.d.ts} +2 -2
- package/dist/index.cjs +312 -300
- package/dist/index.d.cts +89 -29
- package/dist/index.d.ts +89 -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-C_uAJDsn.d.cts → taskRunner-CAAPpdyi.d.cts} +2 -2
- package/dist/{taskRunner-DARTFnZN.d.ts → taskRunner-CairkunF.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 +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-2D7F5IU3.cjs.map +0 -1
- package/dist/chunk-C4RKZY7D.cjs.map +0 -1
- package/dist/chunk-G5RPUZJE.js.map +0 -1
- package/dist/chunk-KJ5E646Y.cjs.map +0 -1
- package/dist/chunk-OV4GLPZI.js.map +0 -1
- package/dist/chunk-QX2M67YI.js.map +0 -1
- package/dist/chunk-YHJJSLE5.js.map +0 -1
- package/dist/chunk-ZLDO4QDR.cjs.map +0 -1
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkSH23SRZE_cjs = require('./chunk-SH23SRZE.cjs');
|
|
4
|
+
var chunkJ5EX3OMM_cjs = require('./chunk-J5EX3OMM.cjs');
|
|
5
5
|
|
|
6
6
|
// src/providers/expoUtils.ts
|
|
7
7
|
async function getExpoFetch(options) {
|
|
8
8
|
try {
|
|
9
9
|
const expoFetchModule = await import('expo/fetch');
|
|
10
10
|
console.debug("Using expo/fetch for streaming");
|
|
11
|
-
|
|
12
|
-
const headers = new Headers(init?.headers);
|
|
13
|
-
headers.set("X-Build-Version", chunkKJ5E646Y_cjs.buildVersion);
|
|
14
|
-
headers.set("X-SDK-VERSION", chunkKJ5E646Y_cjs.sdkVersion);
|
|
15
|
-
return expoFetchModule.fetch(input, { ...init, headers });
|
|
16
|
-
};
|
|
17
|
-
return expoFetchWithHeader;
|
|
11
|
+
return expoFetchModule.fetch;
|
|
18
12
|
} catch (error) {
|
|
19
13
|
console.warn(
|
|
20
14
|
"Using standard fetch instead of expo/fetch. Streaming may not be fully supported in some environments.",
|
|
21
15
|
error
|
|
22
16
|
);
|
|
23
|
-
return
|
|
17
|
+
return chunkJ5EX3OMM_cjs.baseFetch;
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
|
|
@@ -34,9 +28,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
|
|
|
34
28
|
...headers
|
|
35
29
|
},
|
|
36
30
|
// Required, not just for cancellation: `getExpoFetch` falls back to
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
// the stream is truncated at READ_TIMEOUT_MS.
|
|
31
|
+
// `baseFetch`, which bounds any read that brings no signal of its
|
|
32
|
+
// own. Drop this and the stream is truncated at READ_TIMEOUT_MS.
|
|
40
33
|
signal: fetchController.signal
|
|
41
34
|
});
|
|
42
35
|
if (!response.ok) {
|
|
@@ -81,8 +74,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
|
|
|
81
74
|
}
|
|
82
75
|
|
|
83
76
|
// src/providers/expoArk.ts
|
|
84
|
-
var ExpoArkProvider = class extends
|
|
85
|
-
constructor(serverUrl =
|
|
77
|
+
var ExpoArkProvider = class extends chunkJ5EX3OMM_cjs.RestArkProvider {
|
|
78
|
+
constructor(serverUrl = chunkJ5EX3OMM_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
86
79
|
super(serverUrl);
|
|
87
80
|
}
|
|
88
81
|
async *getEventStream(signal, topics) {
|
|
@@ -91,18 +84,24 @@ var ExpoArkProvider = class extends chunkKJ5E646Y_cjs.RestArkProvider {
|
|
|
91
84
|
const queryParams = topics.length > 0 ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join("&")}` : "";
|
|
92
85
|
while (!signal?.aborted) {
|
|
93
86
|
try {
|
|
94
|
-
yield* sseStreamIterator(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
yield* sseStreamIterator(
|
|
88
|
+
url + queryParams,
|
|
89
|
+
signal,
|
|
90
|
+
expoFetch,
|
|
91
|
+
chunkJ5EX3OMM_cjs.ARKADE_VERSION_HEADERS,
|
|
92
|
+
(data) => {
|
|
93
|
+
const eventData = data.result || data;
|
|
94
|
+
if (eventData.heartbeat !== void 0) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return this.parseSettlementEvent(eventData);
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
});
|
|
99
|
+
);
|
|
101
100
|
} catch (error) {
|
|
102
101
|
if (error instanceof Error && error.name === "AbortError") {
|
|
103
102
|
break;
|
|
104
103
|
}
|
|
105
|
-
if (
|
|
104
|
+
if (chunkJ5EX3OMM_cjs.isFetchTimeoutError(error)) {
|
|
106
105
|
console.debug("Timeout error ignored");
|
|
107
106
|
continue;
|
|
108
107
|
}
|
|
@@ -116,14 +115,14 @@ var ExpoArkProvider = class extends chunkKJ5E646Y_cjs.RestArkProvider {
|
|
|
116
115
|
const url = `${this.serverUrl}/v1/txs`;
|
|
117
116
|
while (!signal?.aborted) {
|
|
118
117
|
try {
|
|
119
|
-
yield* sseStreamIterator(url, signal, expoFetch,
|
|
118
|
+
yield* sseStreamIterator(url, signal, expoFetch, chunkJ5EX3OMM_cjs.ARKADE_VERSION_HEADERS, (data) => {
|
|
120
119
|
return this.parseTransactionNotification(data.result);
|
|
121
120
|
});
|
|
122
121
|
} catch (error) {
|
|
123
122
|
if (error instanceof Error && error.name === "AbortError") {
|
|
124
123
|
break;
|
|
125
124
|
}
|
|
126
|
-
if (
|
|
125
|
+
if (chunkJ5EX3OMM_cjs.isFetchTimeoutError(error)) {
|
|
127
126
|
console.debug("Timeout error ignored");
|
|
128
127
|
continue;
|
|
129
128
|
}
|
|
@@ -135,8 +134,8 @@ var ExpoArkProvider = class extends chunkKJ5E646Y_cjs.RestArkProvider {
|
|
|
135
134
|
};
|
|
136
135
|
|
|
137
136
|
// src/providers/expoIndexer.ts
|
|
138
|
-
var ExpoIndexerProvider = class extends
|
|
139
|
-
constructor(serverUrl =
|
|
137
|
+
var ExpoIndexerProvider = class extends chunkSH23SRZE_cjs.RestIndexerProvider {
|
|
138
|
+
constructor(serverUrl = chunkJ5EX3OMM_cjs.DEFAULT_ARKADE_SERVER_URL) {
|
|
140
139
|
super(serverUrl);
|
|
141
140
|
}
|
|
142
141
|
async *getSubscription(subscriptionId, abortSignal) {
|
|
@@ -165,9 +164,9 @@ var ExpoIndexerProvider = class extends chunkD5DLGVN4_cjs.RestIndexerProvider {
|
|
|
165
164
|
return {
|
|
166
165
|
txid: data.event.txid,
|
|
167
166
|
scripts: data.event.scripts || [],
|
|
168
|
-
newVtxos: (data.event.newVtxos || []).map(
|
|
169
|
-
spentVtxos: (data.event.spentVtxos || []).map(
|
|
170
|
-
sweptVtxos: (data.event.sweptVtxos || []).map(
|
|
167
|
+
newVtxos: (data.event.newVtxos || []).map(chunkJ5EX3OMM_cjs.convertVtxo),
|
|
168
|
+
spentVtxos: (data.event.spentVtxos || []).map(chunkJ5EX3OMM_cjs.convertVtxo),
|
|
169
|
+
sweptVtxos: (data.event.sweptVtxos || []).map(chunkJ5EX3OMM_cjs.convertVtxo),
|
|
171
170
|
tx: data.event.tx,
|
|
172
171
|
checkpointTxs: data.event.checkpointTxs
|
|
173
172
|
};
|
|
@@ -179,7 +178,7 @@ var ExpoIndexerProvider = class extends chunkD5DLGVN4_cjs.RestIndexerProvider {
|
|
|
179
178
|
if (error instanceof Error && error.name === "AbortError") {
|
|
180
179
|
break;
|
|
181
180
|
}
|
|
182
|
-
if (
|
|
181
|
+
if (chunkJ5EX3OMM_cjs.isFetchTimeoutError(error)) {
|
|
183
182
|
console.debug("Timeout error ignored");
|
|
184
183
|
continue;
|
|
185
184
|
}
|
|
@@ -192,5 +191,5 @@ var ExpoIndexerProvider = class extends chunkD5DLGVN4_cjs.RestIndexerProvider {
|
|
|
192
191
|
|
|
193
192
|
exports.ExpoArkProvider = ExpoArkProvider;
|
|
194
193
|
exports.ExpoIndexerProvider = ExpoIndexerProvider;
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-YA3L3WL4.cjs.map
|
|
195
|
+
//# sourceMappingURL=chunk-YA3L3WL4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["baseFetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","ARKADE_VERSION_HEADERS","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAUA,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,OAAO,eAAA,CAAgB,KAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AAQZ,IAAA,OAAA,CAAQ,IAAA;AAAA,MACJ,wGAAA;AAAA,MAEA;AAAA,KACJ;AACA,IAAA,OAAOA,2BAAA;AAAA,EACX;AACJ;AAYA,gBAAuB,iBAAA,CACnB,GAAA,EACA,WAAA,EACA,OAAA,EACA,SACA,SAAA,EACgC;AAChC,EAAA,MAAM,eAAA,GAAkB,IAAI,eAAA,EAAgB;AAC5C,EAAA,MAAM,OAAA,GAAU,MAAM,eAAA,CAAgB,KAAA,EAAM;AAC5C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AAK,cAAc,KAAA,CAAA,EAAW;AAE9B,cAAA,OAAO,IAAA;AAAA,YACX;AAEA,YAAA,IAAI,KAAK,KAAA,EAAO;AACZ,cAAA,OAAO;AAAA,gBACH,IAAA,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,IAAII,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-YA3L3WL4.cjs","sourcesContent":["import { baseFetch, fetch } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch, falling back to {@link baseFetch}.\n *\n * Adds no headers of its own: both Expo providers share this function but reach\n * different origins, so each passes its own per request.\n *\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n return expoFetchModule.fetch as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return baseFetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n // Required, not just for cancellation: `getExpoFetch` falls back to\n // `baseFetch`, which bounds any read that brings no signal of its\n // own. Drop this and the stream is truncated at READ_TIMEOUT_MS.\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotificationEvent, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { ARKADE_VERSION_HEADERS } from \"../utils/fetch\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(\n url + queryParams,\n signal,\n expoFetch,\n ARKADE_VERSION_HEADERS,\n (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(\n signal: AbortSignal,\n ): AsyncIterableIterator<TxNotificationEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, ARKADE_VERSION_HEADERS, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse } 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 chunkJ5EX3OMM_cjs = require('./chunk-J5EX3OMM.cjs');
|
|
4
4
|
var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
|
|
5
5
|
var base = require('@scure/base');
|
|
6
6
|
var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
|
|
@@ -76,14 +76,14 @@ var ContractHandlerRegistry = class {
|
|
|
76
76
|
var contractHandlers = new ContractHandlerRegistry();
|
|
77
77
|
exports.DefaultVtxo = void 0;
|
|
78
78
|
((DefaultVtxo2) => {
|
|
79
|
-
class Script3 extends
|
|
79
|
+
class Script3 extends chunkJ5EX3OMM_cjs.VtxoScript {
|
|
80
80
|
/** Create the default virtual output script with one forfeit path and one exit path. */
|
|
81
81
|
constructor(options) {
|
|
82
82
|
const { pubKey, serverPubKey, csvTimelock } = options;
|
|
83
|
-
const forfeitScript =
|
|
83
|
+
const forfeitScript = chunkJ5EX3OMM_cjs.MultisigTapscript.encode({
|
|
84
84
|
pubkeys: [pubKey, serverPubKey]
|
|
85
85
|
}).script;
|
|
86
|
-
const exitScript =
|
|
86
|
+
const exitScript = chunkJ5EX3OMM_cjs.CSVMultisigTapscript.encode({
|
|
87
87
|
timelock: csvTimelock,
|
|
88
88
|
pubkeys: [pubKey]
|
|
89
89
|
}).script;
|
|
@@ -288,7 +288,7 @@ function extractPubKeyBytes(value) {
|
|
|
288
288
|
return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
|
|
289
289
|
}
|
|
290
290
|
function deserializeCsvTimelock(value) {
|
|
291
|
-
return value !== void 0 && value !== "" ?
|
|
291
|
+
return value !== void 0 && value !== "" ? chunkJ5EX3OMM_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
292
292
|
}
|
|
293
293
|
var CLTV_HEIGHT_THRESHOLD = 500000000n;
|
|
294
294
|
function isCltvSatisfied(context, locktime) {
|
|
@@ -330,7 +330,7 @@ function assertVhtlcSpendableNow(contract, context) {
|
|
|
330
330
|
function isCsvSpendable(context, sequence) {
|
|
331
331
|
if (sequence === void 0) return true;
|
|
332
332
|
if (!context.vtxo) return false;
|
|
333
|
-
const timelock =
|
|
333
|
+
const timelock = chunkJ5EX3OMM_cjs.sequenceToTimelock(sequence);
|
|
334
334
|
if (timelock.type === "blocks") {
|
|
335
335
|
if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
|
|
336
336
|
return false;
|
|
@@ -388,21 +388,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
|
|
|
388
388
|
async function detectUsedScripts(indexerProvider, scriptHexes) {
|
|
389
389
|
const used = /* @__PURE__ */ new Set();
|
|
390
390
|
const unique = [...new Set(scriptHexes)];
|
|
391
|
-
for (let offset = 0; offset < unique.length; offset +=
|
|
392
|
-
const scripts = unique.slice(offset, offset +
|
|
391
|
+
for (let offset = 0; offset < unique.length; offset += chunkJ5EX3OMM_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
392
|
+
const scripts = unique.slice(offset, offset + chunkJ5EX3OMM_cjs.SCRIPT_QUERY_CHUNK_SIZE);
|
|
393
393
|
const remaining = new Set(scripts);
|
|
394
394
|
let pageIndex = 0;
|
|
395
395
|
let hasMore = true;
|
|
396
396
|
while (hasMore && remaining.size > 0) {
|
|
397
|
-
const { vtxos, page } = await
|
|
397
|
+
const { vtxos, page } = await chunkJ5EX3OMM_cjs.getNormalizedVtxos(indexerProvider, {
|
|
398
398
|
scripts,
|
|
399
399
|
pageIndex,
|
|
400
|
-
pageSize:
|
|
400
|
+
pageSize: chunkJ5EX3OMM_cjs.DEFAULT_PAGE_SIZE
|
|
401
401
|
});
|
|
402
402
|
for (const vtxo of vtxos) {
|
|
403
403
|
if (remaining.delete(vtxo.script)) used.add(vtxo.script);
|
|
404
404
|
}
|
|
405
|
-
hasMore = page ? vtxos.length ===
|
|
405
|
+
hasMore = page ? vtxos.length === chunkJ5EX3OMM_cjs.DEFAULT_PAGE_SIZE : false;
|
|
406
406
|
pageIndex++;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
@@ -463,7 +463,7 @@ var DefaultContractHandler = {
|
|
|
463
463
|
return {
|
|
464
464
|
pubKey: base.hex.encode(params.pubKey),
|
|
465
465
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
466
|
-
csvTimelock:
|
|
466
|
+
csvTimelock: chunkJ5EX3OMM_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
467
467
|
};
|
|
468
468
|
},
|
|
469
469
|
deserializeParams(params) {
|
|
@@ -498,7 +498,7 @@ function defaultCandidatesAt(_index, descriptor, deps) {
|
|
|
498
498
|
params: {
|
|
499
499
|
pubKey: base.hex.encode(c.pubKey),
|
|
500
500
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
501
|
-
csvTimelock:
|
|
501
|
+
csvTimelock: chunkJ5EX3OMM_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
502
502
|
},
|
|
503
503
|
script: c.scriptHex,
|
|
504
504
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -514,12 +514,12 @@ function discoverDefaultRange(entries, deps) {
|
|
|
514
514
|
}
|
|
515
515
|
exports.DelegateVtxo = void 0;
|
|
516
516
|
((DelegateVtxo2) => {
|
|
517
|
-
class Script3 extends
|
|
517
|
+
class Script3 extends chunkJ5EX3OMM_cjs.VtxoScript {
|
|
518
518
|
/** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
|
|
519
519
|
constructor(options) {
|
|
520
520
|
const defaultVtxo = new exports.DefaultVtxo.Script(options);
|
|
521
521
|
const { delegatePubKey, pubKey, serverPubKey } = options;
|
|
522
|
-
const delegateScript =
|
|
522
|
+
const delegateScript = chunkJ5EX3OMM_cjs.MultisigTapscript.encode({
|
|
523
523
|
pubkeys: [pubKey, delegatePubKey, serverPubKey]
|
|
524
524
|
}).script;
|
|
525
525
|
super([...defaultVtxo.scripts, delegateScript]);
|
|
@@ -558,7 +558,7 @@ var DelegateContractHandler = {
|
|
|
558
558
|
pubKey: base.hex.encode(params.pubKey),
|
|
559
559
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
560
560
|
delegatePubKey: base.hex.encode(params.delegatePubKey),
|
|
561
|
-
csvTimelock:
|
|
561
|
+
csvTimelock: chunkJ5EX3OMM_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
562
562
|
};
|
|
563
563
|
},
|
|
564
564
|
deserializeParams(params) {
|
|
@@ -602,7 +602,7 @@ function delegateCandidatesAt(_index, descriptor, deps) {
|
|
|
602
602
|
pubKey: base.hex.encode(c.pubKey),
|
|
603
603
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
604
604
|
delegatePubKey: base.hex.encode(delegatePubKey),
|
|
605
|
-
csvTimelock:
|
|
605
|
+
csvTimelock: chunkJ5EX3OMM_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
606
606
|
},
|
|
607
607
|
script: c.scriptHex,
|
|
608
608
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -1159,7 +1159,11 @@ var ARKADE_OP = {
|
|
|
1159
1159
|
BIN2NUM: 216,
|
|
1160
1160
|
REVERSEBYTES: 217,
|
|
1161
1161
|
MODEXP: 218,
|
|
1162
|
-
//
|
|
1162
|
+
// VTXO Expiry & Emulator Clock (0xdb-0xdc)
|
|
1163
|
+
PUSHEXPIRY: 219,
|
|
1164
|
+
// compiler artifacts use OP_CHECKTIME.
|
|
1165
|
+
CHECKTIME: 220,
|
|
1166
|
+
// 0xdd-0xdf are unassigned (OP_UNKNOWN221-223)
|
|
1163
1167
|
// EC Operations (0xe0-0xe2)
|
|
1164
1168
|
ECADD: 224,
|
|
1165
1169
|
ECMUL: 225,
|
|
@@ -1188,7 +1192,10 @@ var ARKADE_OP = {
|
|
|
1188
1192
|
INSPECTPACKET: 244,
|
|
1189
1193
|
INSPECTINPUTPACKET: 245,
|
|
1190
1194
|
// Signature Hash (0xf6)
|
|
1191
|
-
SIGHASH: 246
|
|
1195
|
+
SIGHASH: 246,
|
|
1196
|
+
// Continuation & Intent Introspection (0xf7-0xf8)
|
|
1197
|
+
TUNNEL: 247,
|
|
1198
|
+
INSPECTINTENTMESSAGE: 248
|
|
1192
1199
|
};
|
|
1193
1200
|
var ARKADE_OPCODES = Object.values(ARKADE_OP);
|
|
1194
1201
|
var ARKADE_OPCODE_NAMES = Object.fromEntries(
|
|
@@ -1445,7 +1452,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1445
1452
|
// src/script/vhtlc.ts
|
|
1446
1453
|
exports.VHTLC = void 0;
|
|
1447
1454
|
((VHTLC2) => {
|
|
1448
|
-
class BaseScript extends
|
|
1455
|
+
class BaseScript extends chunkJ5EX3OMM_cjs.VtxoScript {
|
|
1449
1456
|
options;
|
|
1450
1457
|
claimScript;
|
|
1451
1458
|
refundScript;
|
|
@@ -1472,27 +1479,27 @@ exports.VHTLC = void 0;
|
|
|
1472
1479
|
unilateralRefundWithoutReceiverDelay
|
|
1473
1480
|
} = options;
|
|
1474
1481
|
const conditionScript = preimageCondition(preimageHash);
|
|
1475
|
-
const claimScript =
|
|
1482
|
+
const claimScript = chunkJ5EX3OMM_cjs.ConditionMultisigTapscript.encode({
|
|
1476
1483
|
conditionScript,
|
|
1477
1484
|
pubkeys: [receiver, server]
|
|
1478
1485
|
}).script;
|
|
1479
|
-
const refundScript =
|
|
1486
|
+
const refundScript = chunkJ5EX3OMM_cjs.MultisigTapscript.encode({
|
|
1480
1487
|
pubkeys: [sender, receiver, server]
|
|
1481
1488
|
}).script;
|
|
1482
|
-
const refundWithoutReceiverScript =
|
|
1489
|
+
const refundWithoutReceiverScript = chunkJ5EX3OMM_cjs.CLTVMultisigTapscript.encode({
|
|
1483
1490
|
absoluteTimelock: refundLocktime,
|
|
1484
1491
|
pubkeys: [sender, server]
|
|
1485
1492
|
}).script;
|
|
1486
|
-
const unilateralClaimScript =
|
|
1493
|
+
const unilateralClaimScript = chunkJ5EX3OMM_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1487
1494
|
conditionScript,
|
|
1488
1495
|
timelock: unilateralClaimDelay,
|
|
1489
1496
|
pubkeys: [receiver]
|
|
1490
1497
|
}).script;
|
|
1491
|
-
const unilateralRefundScript =
|
|
1498
|
+
const unilateralRefundScript = chunkJ5EX3OMM_cjs.CSVMultisigTapscript.encode({
|
|
1492
1499
|
timelock: unilateralRefundDelay,
|
|
1493
1500
|
pubkeys: [sender, receiver]
|
|
1494
1501
|
}).script;
|
|
1495
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1502
|
+
const unilateralRefundWithoutReceiverScript = chunkJ5EX3OMM_cjs.CSVMultisigTapscript.encode({
|
|
1496
1503
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1497
1504
|
pubkeys: [sender]
|
|
1498
1505
|
}).script;
|
|
@@ -1512,7 +1519,7 @@ exports.VHTLC = void 0;
|
|
|
1512
1519
|
const covenants = options.nonInteractiveParameters;
|
|
1513
1520
|
if (covenants) {
|
|
1514
1521
|
arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
|
|
1515
|
-
nonInteractiveClaimScript =
|
|
1522
|
+
nonInteractiveClaimScript = chunkJ5EX3OMM_cjs.ConditionMultisigTapscript.encode({
|
|
1516
1523
|
conditionScript,
|
|
1517
1524
|
pubkeys: [
|
|
1518
1525
|
server,
|
|
@@ -1525,12 +1532,12 @@ exports.VHTLC = void 0;
|
|
|
1525
1532
|
covenants.emulatorPubkey,
|
|
1526
1533
|
arkadeScriptNir
|
|
1527
1534
|
);
|
|
1528
|
-
nonInteractiveRefundScript =
|
|
1535
|
+
nonInteractiveRefundScript = chunkJ5EX3OMM_cjs.MultisigTapscript.encode({
|
|
1529
1536
|
pubkeys: [server, receiver, nirCosigner]
|
|
1530
1537
|
}).script;
|
|
1531
1538
|
scripts.push(nonInteractiveRefundScript);
|
|
1532
1539
|
if (covenants.legacy !== "preTimelockedRefund") {
|
|
1533
|
-
nonInteractiveRefundWithoutReceiverScript =
|
|
1540
|
+
nonInteractiveRefundWithoutReceiverScript = chunkJ5EX3OMM_cjs.CLTVMultisigTapscript.encode({
|
|
1534
1541
|
absoluteTimelock: refundLocktime,
|
|
1535
1542
|
pubkeys: [server, nirCosigner]
|
|
1536
1543
|
}).script;
|
|
@@ -1844,9 +1851,9 @@ var VHTLCContractHandler = {
|
|
|
1844
1851
|
server: base.hex.encode(params.server),
|
|
1845
1852
|
hash: base.hex.encode(params.preimageHash),
|
|
1846
1853
|
refundLocktime: params.refundLocktime.toString(),
|
|
1847
|
-
claimDelay:
|
|
1848
|
-
refundDelay:
|
|
1849
|
-
refundNoReceiverDelay:
|
|
1854
|
+
claimDelay: chunkJ5EX3OMM_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1855
|
+
refundDelay: chunkJ5EX3OMM_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1856
|
+
refundNoReceiverDelay: chunkJ5EX3OMM_cjs.timelockToSequence(
|
|
1850
1857
|
params.unilateralRefundWithoutReceiverDelay
|
|
1851
1858
|
).toString()
|
|
1852
1859
|
};
|
|
@@ -1858,9 +1865,9 @@ var VHTLCContractHandler = {
|
|
|
1858
1865
|
server: base.hex.decode(params.server),
|
|
1859
1866
|
preimageHash: base.hex.decode(params.hash),
|
|
1860
1867
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1861
|
-
unilateralClaimDelay:
|
|
1862
|
-
unilateralRefundDelay:
|
|
1863
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1868
|
+
unilateralClaimDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1869
|
+
unilateralRefundDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1870
|
+
unilateralRefundWithoutReceiverDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(
|
|
1864
1871
|
Number(params.refundNoReceiverDelay)
|
|
1865
1872
|
)
|
|
1866
1873
|
};
|
|
@@ -2106,9 +2113,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2106
2113
|
server: base.hex.encode(params.server),
|
|
2107
2114
|
hash: base.hex.encode(params.preimageHash),
|
|
2108
2115
|
refundLocktime: params.refundLocktime.toString(),
|
|
2109
|
-
claimDelay:
|
|
2110
|
-
refundDelay:
|
|
2111
|
-
refundNoReceiverDelay:
|
|
2116
|
+
claimDelay: chunkJ5EX3OMM_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
2117
|
+
refundDelay: chunkJ5EX3OMM_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
2118
|
+
refundNoReceiverDelay: chunkJ5EX3OMM_cjs.timelockToSequence(
|
|
2112
2119
|
params.unilateralRefundWithoutReceiverDelay
|
|
2113
2120
|
).toString(),
|
|
2114
2121
|
// The on-disk keys keep their per-leaf names even though the typed
|
|
@@ -2208,9 +2215,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2208
2215
|
preimageHash: base.hex.decode(params.hash),
|
|
2209
2216
|
refundLocktime: BigInt(params.refundLocktime),
|
|
2210
2217
|
...asset && { asset },
|
|
2211
|
-
unilateralClaimDelay:
|
|
2212
|
-
unilateralRefundDelay:
|
|
2213
|
-
unilateralRefundWithoutReceiverDelay:
|
|
2218
|
+
unilateralClaimDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
2219
|
+
unilateralRefundDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
2220
|
+
unilateralRefundWithoutReceiverDelay: chunkJ5EX3OMM_cjs.sequenceToTimelock(
|
|
2214
2221
|
Number(params.refundNoReceiverDelay)
|
|
2215
2222
|
),
|
|
2216
2223
|
...claim && refund && {
|
|
@@ -2483,7 +2490,7 @@ var BoardingContractHandler = {
|
|
|
2483
2490
|
const coins = await deps.onchainProvider.getCoins(onchainAddress);
|
|
2484
2491
|
if (coins.length === 0) return [];
|
|
2485
2492
|
const scriptHex = base.hex.encode(script.pkScript);
|
|
2486
|
-
const boardingSeq =
|
|
2493
|
+
const boardingSeq = chunkJ5EX3OMM_cjs.timelockToSequence(deps.boardingTimelock);
|
|
2487
2494
|
return [
|
|
2488
2495
|
{
|
|
2489
2496
|
type: "boarding",
|
|
@@ -2644,27 +2651,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
2644
2651
|
if (seg.csv) {
|
|
2645
2652
|
const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
|
|
2646
2653
|
if (seg.asm) {
|
|
2647
|
-
return
|
|
2654
|
+
return chunkJ5EX3OMM_cjs.ConditionCSVMultisigTapscript.encode({
|
|
2648
2655
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2649
2656
|
timelock,
|
|
2650
2657
|
pubkeys
|
|
2651
2658
|
});
|
|
2652
2659
|
}
|
|
2653
|
-
return
|
|
2660
|
+
return chunkJ5EX3OMM_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
2654
2661
|
}
|
|
2655
2662
|
if (seg.cltv !== void 0) {
|
|
2656
|
-
return
|
|
2663
|
+
return chunkJ5EX3OMM_cjs.CLTVMultisigTapscript.encode({
|
|
2657
2664
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
2658
2665
|
pubkeys
|
|
2659
2666
|
});
|
|
2660
2667
|
}
|
|
2661
2668
|
if (seg.asm) {
|
|
2662
|
-
return
|
|
2669
|
+
return chunkJ5EX3OMM_cjs.ConditionMultisigTapscript.encode({
|
|
2663
2670
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2664
2671
|
pubkeys
|
|
2665
2672
|
});
|
|
2666
2673
|
}
|
|
2667
|
-
return
|
|
2674
|
+
return chunkJ5EX3OMM_cjs.MultisigTapscript.encode({ pubkeys });
|
|
2668
2675
|
}
|
|
2669
2676
|
function compileFunctions(program, args, keys) {
|
|
2670
2677
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2694,7 +2701,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2694
2701
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2695
2702
|
});
|
|
2696
2703
|
}
|
|
2697
|
-
var ArkadeProgramScript = class extends
|
|
2704
|
+
var ArkadeProgramScript = class extends chunkJ5EX3OMM_cjs.VtxoScript {
|
|
2698
2705
|
constructor(program, args, keys) {
|
|
2699
2706
|
const partial = compileFunctions(program, args, keys);
|
|
2700
2707
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2907,7 +2914,7 @@ function pathsFor(script, context, opts) {
|
|
|
2907
2914
|
continue;
|
|
2908
2915
|
}
|
|
2909
2916
|
if (requiresServer) continue;
|
|
2910
|
-
const sequence = csv ? Number(
|
|
2917
|
+
const sequence = csv ? Number(chunkJ5EX3OMM_cjs.timelockToSequence(csv)) : void 0;
|
|
2911
2918
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2912
2919
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2913
2920
|
continue;
|
|
@@ -3036,5 +3043,5 @@ exports.toASM = toASM;
|
|
|
3036
3043
|
exports.toXOnly = toXOnly;
|
|
3037
3044
|
exports.validateProgram = validateProgram;
|
|
3038
3045
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
3039
|
-
//# sourceMappingURL=chunk-
|
|
3040
|
-
//# sourceMappingURL=chunk-
|
|
3046
|
+
//# sourceMappingURL=chunk-YYWEBYFJ.cjs.map
|
|
3047
|
+
//# sourceMappingURL=chunk-YYWEBYFJ.cjs.map
|