@arkade-os/sdk 0.5.1 → 0.5.2
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 +9 -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/{asyncStorageTaskQueue-DFt5LgW5.d.cts → asyncStorageTaskQueue-BtEc3Qca.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-CdWheMqT.d.ts → asyncStorageTaskQueue-DIn7bTqN.d.ts} +1 -1
- package/dist/{chunk-QKNSMVBW.cjs → chunk-2OCYL6BJ.cjs} +1142 -843
- package/dist/chunk-2OCYL6BJ.cjs.map +1 -0
- package/dist/{chunk-FXVEOEYB.js → chunk-2QRUQXLS.js} +4 -4
- package/dist/{chunk-FXVEOEYB.js.map → chunk-2QRUQXLS.js.map} +1 -1
- package/dist/{chunk-HQNQ3CLQ.cjs → chunk-64R7CRKN.cjs} +18 -18
- package/dist/{chunk-HQNQ3CLQ.cjs.map → chunk-64R7CRKN.cjs.map} +1 -1
- package/dist/{chunk-NKKJEA3Z.js → chunk-AJWXVQYG.js} +657 -358
- package/dist/chunk-AJWXVQYG.js.map +1 -0
- package/dist/{chunk-XLHUGP3G.cjs → chunk-GGKR4O5X.cjs} +3 -3
- package/dist/{chunk-XLHUGP3G.cjs.map → chunk-GGKR4O5X.cjs.map} +1 -1
- package/dist/{chunk-QFB55EOZ.js → chunk-HKG26NUT.js} +3 -3
- package/dist/{chunk-QFB55EOZ.js.map → chunk-HKG26NUT.js.map} +1 -1
- package/dist/{chunk-3M22PJVB.js → chunk-LWRMSC4M.js} +3 -3
- package/dist/{chunk-3M22PJVB.js.map → chunk-LWRMSC4M.js.map} +1 -1
- package/dist/{chunk-XQRIY5K5.js → chunk-MOBDJ7U2.js} +4 -4
- package/dist/{chunk-XQRIY5K5.js.map → chunk-MOBDJ7U2.js.map} +1 -1
- package/dist/{chunk-GW42FS2X.cjs → chunk-OM6FJ76H.cjs} +48 -48
- package/dist/{chunk-GW42FS2X.cjs.map → chunk-OM6FJ76H.cjs.map} +1 -1
- package/dist/{chunk-JJ6QKTFZ.cjs → chunk-PVFQFQBY.cjs} +10 -10
- package/dist/{chunk-JJ6QKTFZ.cjs.map → chunk-PVFQFQBY.cjs.map} +1 -1
- package/dist/{chunk-GQUFPTN7.cjs → chunk-TAIWH3HG.cjs} +16 -16
- package/dist/{chunk-GQUFPTN7.cjs.map → chunk-TAIWH3HG.cjs.map} +1 -1
- package/dist/{chunk-6MIGYYWB.js → chunk-U5XG7SWA.js} +3 -3
- package/dist/{chunk-6MIGYYWB.js.map → chunk-U5XG7SWA.js.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-CFCfrReG.d.cts → delegate-CaL8EN4Q.d.cts} +1 -1
- package/dist/{delegate-BSbGQabI.d.ts → delegate-Jd4zs88Q.d.ts} +1 -1
- package/dist/{index-Fpf4mQZr.d.cts → index-BwdGzNSn.d.cts} +2 -2
- package/dist/{index-CzUVvIxA.d.ts → index-D-xqVzf8.d.ts} +2 -2
- package/dist/{index-B3fRWO5i.d.cts → index-DdKxfC29.d.cts} +26 -16
- package/dist/{index-B3fRWO5i.d.ts → index-DdKxfC29.d.ts} +26 -16
- package/dist/index.cjs +313 -313
- package/dist/index.d.cts +93 -26
- package/dist/index.d.ts +93 -26
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +35 -35
- 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 +33 -33
- 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-Dk6oDAtd.d.cts → taskRunner-67YSEpsz.d.cts} +1 -1
- package/dist/{taskRunner-CdfoCMaw.d.ts → taskRunner-ZyGGjtIq.d.ts} +1 -1
- 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 +15 -15
- 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/{wallet-D9dvXu-K.d.cts → wallet-B8LW7cV1.d.cts} +6 -5
- package/dist/{wallet-BQHNgc_v.d.ts → wallet-bFS7VybL.d.ts} +6 -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-NKKJEA3Z.js.map +0 -1
- package/dist/chunk-QKNSMVBW.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getRandomId, extendVirtualCoinForContract, collectContracts, warnAndFilterVtxosForScript, saveVtxosForContract } from './chunk-
|
|
2
|
-
import { getNormalizedVtxos } from './chunk-
|
|
1
|
+
import { getRandomId, extendVirtualCoinForContract, collectContracts, warnAndFilterVtxosForScript, saveVtxosForContract } from './chunk-AJWXVQYG.js';
|
|
2
|
+
import { getNormalizedVtxos } from './chunk-HKG26NUT.js';
|
|
3
3
|
|
|
4
4
|
// src/worker/expo/taskRunner.ts
|
|
5
5
|
async function runTasks(queue, processors, deps) {
|
|
@@ -94,5 +94,5 @@ var contractPollProcessor = {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks };
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-MOBDJ7U2.js.map
|
|
98
|
+
//# sourceMappingURL=chunk-MOBDJ7U2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":[],"mappings":";;;;AAkDA,eAAsB,QAAA,CAClB,KAAA,EACA,UAAA,EACA,IAAA,EACqB;AACrB,EAAA,MAAM,KAAA,GAAQ,MAAM,KAAA,CAAM,QAAA,EAAS;AACnC,EAAA,MAAM,YAAA,GAAe,IAAI,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,CAAC,CAAA,CAAE,QAAA,EAAU,CAAC,CAAC,CAAC,CAAA;AACnE,EAAA,MAAM,UAAwB,EAAC;AAE/B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACtB,IAAA,MAAM,SAAA,GAAY,YAAA,CAAa,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA;AAE5C,IAAA,IAAI,OAAA;AAEJ,IAAA,IAAI,CAAC,SAAA,EAAW;AACZ,MAAA,OAAA,GAAU;AAAA,QACN,YAAY,IAAA,CAAK,EAAA;AAAA,QACjB,MAAM,IAAA,CAAK,IAAA;AAAA,QACX,MAAA,EAAQ;AAAA,OACZ;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,IAAI;AACA,QAAA,OAAA,GAAU,MAAM,SAAA,CAAU,OAAA,CAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,MAChD,SAAS,KAAA,EAAO;AACZ,QAAA,OAAA,GAAU;AAAA,UACN,YAAY,IAAA,CAAK,EAAA;AAAA,UACjB,MAAM,IAAA,CAAK,IAAA;AAAA,UACX,MAAA,EAAQ,QAAA;AAAA,UACR,IAAA,EAAM;AAAA,YACF,OAAO,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK;AAAA;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,EAAK,GAAI,MAAM,mBAAmB,eAAA,EAAiB;AAAA,UAC9D,OAAA,EAAS,CAAC,QAAA,CAAS,MAAM,CAAA;AAAA,UACzB,SAAA;AAAA,UACA;AAAA,SACH,CAAA;AAED,QAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACtB,UAAA,QAAA,CAAS,IAAA,CAAK,UAAA,CAAW,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,QAC5C;AAEA,QAAA,OAAA,GAAU,IAAA,GAAO,KAAA,CAAM,MAAA,KAAW,QAAA,GAAW,KAAA;AAC7C,QAAA,SAAA,EAAA;AAAA,MACJ;AAKA,MAAA,MAAM,QAAA,GAAW,2BAAA;AAAA,QACb,QAAA;AAAA,QACA,QAAA,CAAS,MAAA;AAAA,QACT;AAAA,OACJ;AACA,MAAA,MAAM,oBAAA,CAAqB,gBAAA,EAAkB,QAAA,EAAU,QAAQ,CAAA;AAC/D,MAAA,UAAA,IAAc,QAAA,CAAS,MAAA;AACvB,MAAA,kBAAA,EAAA;AAAA,IACJ;AAEA,IAAA,OAAO;AAAA,MACH,YAAY,IAAA,CAAK,EAAA;AAAA,MACjB,IAAA,EAAM,uBAAA;AAAA,MACN,MAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAM,EAAE,kBAAA,EAAoB,UAAA;AAAW,KAC3C;AAAA,EACJ;AACJ","file":"chunk-XQRIY5K5.js","sourcesContent":["import type { TaskItem, TaskResult, TaskQueue } from \"./taskQueue\";\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { IndexerProvider } from \"../../providers/indexer\";\nimport type { ArkProvider } from \"../../providers/ark\";\nimport type { ExtendedVirtualCoin, VirtualCoin } from \"../../wallet\";\nimport type { Contract } from \"../../contracts/types\";\nimport { getRandomId, extendVirtualCoinForContract } from \"../../wallet/utils\";\n\n/**\n * Shared dependencies injected into every processor at runtime.\n *\n * `extendVtxo` requires the owning contract — processors must resolve each\n * vtxo's `script` to a known contract (via the contract repository) before\n * calling this. The strict signature prevents the footgun where a missing\n * contract silently falls back to the wallet's default tapscript.\n */\nexport interface TaskDependencies {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) => ExtendedVirtualCoin;\n}\n\n/**\n * A stateless unit that handles one type of task item.\n *\n * Processors must not keep in-memory state across invocations —\n * all coordination lives in the @see TaskQueue and repositories.\n *\n * The `TDeps` parameter defaults to @see TaskDependencies but\n * can be overridden for domain-specific processors (e.g. swap processing).\n */\nexport interface TaskProcessor<TDeps = TaskDependencies> {\n readonly taskType: string;\n execute(item: TaskItem, deps: TDeps): Promise<Omit<TaskResult, \"id\" | \"executedAt\">>;\n}\n\n/**\n * Run all pending tasks from the queue through matching processors.\n *\n * For each task in the inbox:\n * 1. Find the processor whose `taskType` matches `task.type`.\n * 2. Execute it, producing a @see TaskResult.\n * 3. Push the result to the outbox and remove the task from the inbox.\n *\n * Tasks with no matching processor produce a `\"noop\"` result.\n * Processor errors produce a `\"failed\"` result with the error message.\n */\nexport async function runTasks<TDeps = TaskDependencies>(\n queue: TaskQueue,\n processors: TaskProcessor<TDeps>[],\n deps: TDeps,\n): Promise<TaskResult[]> {\n const tasks = await queue.getTasks();\n const processorMap = new Map(processors.map((p) => [p.taskType, p]));\n const results: TaskResult[] = [];\n\n for (const task of tasks) {\n const processor = processorMap.get(task.type);\n\n let partial: Omit<TaskResult, \"id\" | \"executedAt\">;\n\n if (!processor) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"noop\",\n };\n } else {\n try {\n partial = await processor.execute(task, deps);\n } catch (error) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"failed\",\n data: {\n error: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n const result: TaskResult = {\n ...partial,\n id: getRandomId(),\n executedAt: Date.now(),\n };\n\n await queue.pushResult(result);\n await queue.removeTask(task.id);\n results.push(result);\n }\n\n return results;\n}\n\n/**\n * Options for @see createTaskDependencies.\n */\nexport interface CreateTaskDependenciesOptions {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n}\n\n/**\n * Build the @see TaskDependencies needed by task processors\n * (e.g. `src/worker/expo/processors/contractPollProcessor.ts`)\n *\n * This is the same construction that `defineExpoBackgroundTask` does\n * internally, extracted so that consumers with custom schedulers\n * (e.g. bare React Native with `react-native-background-fetch`)\n * can build deps without depending on Expo.\n */\nexport function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies {\n return {\n ...options,\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) =>\n extendVirtualCoinForContract(vtxo, contract),\n };\n}\n","import { collectContracts } from \"../../../repositories/contractRepository\";\nimport type { TaskItem, TaskResult } from \"../taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../taskRunner\";\nimport type { ExtendedVirtualCoin } from \"../../../wallet\";\nimport { getNormalizedVtxos } from \"../../../wallet/vtxo\";\nimport {\n warnAndFilterVtxosForScript,\n saveVtxosForContract,\n} from \"../../../contracts/vtxoOwnership\";\n\nexport const CONTRACT_POLL_TASK_TYPE = \"contract-poll\";\n\n/**\n * Polls the indexer for the latest VTXO state of every contract and\n * persists the results to the wallet repository.\n *\n * Replicates the polling subset of @see ContractManager.initialize:\n * 1. Load every watched contract from the contract repository.\n * 2. Paginated fetch of every VTXO (including spent) from the indexer.\n * 3. Extend each VTXO with tapscript data.\n * 4. Save to the wallet repository.\n *\n * NOTE: the indexer query deliberately omits `spendableOnly`. Every\n * repository implements `saveVtxos` as an upsert with no batch delete,\n * so filtering to spendable-only would leave VTXOs that became spent\n * between polls marked as spendable forever. Fetching the full set lets\n * the upsert overwrite stale records with their latest state.\n */\nexport const contractPollProcessor: TaskProcessor = {\n taskType: CONTRACT_POLL_TASK_TYPE,\n\n async execute(\n item: TaskItem,\n deps: TaskDependencies,\n ): Promise<Omit<TaskResult, \"id\" | \"executedAt\">> {\n const { contractRepository, walletRepository, indexerProvider, extendVtxo } = deps;\n\n // Background channel, so it covers exactly what the watcher's\n // subscription covers: `retained` rows are kept for reads only.\n const contracts = await collectContracts(contractRepository, {\n watch: [\"watched\", \"awaiting-funds\"],\n });\n let contractsProcessed = 0;\n let vtxosSaved = 0;\n\n for (const contract of contracts) {\n // Paginated fetch of spendable virtual outputs\n const pageSize = 100;\n let pageIndex = 0;\n let hasMore = true;\n const allVtxos: ExtendedVirtualCoin[] = [];\n\n while (hasMore) {\n const { vtxos, page } = await getNormalizedVtxos(indexerProvider, {\n scripts: [contract.script],\n pageIndex,\n pageSize,\n });\n\n for (const vtxo of vtxos) {\n allVtxos.push(extendVtxo(vtxo, contract));\n }\n\n hasMore = page ? vtxos.length === pageSize : false;\n pageIndex++;\n }\n\n // Skip wrong-script rows (legacy duplicates or indexer drift)\n // before persisting; the loop must keep going for the remaining\n // contracts even when one row is rejected.\n const filtered = warnAndFilterVtxosForScript(\n allVtxos,\n contract.script,\n \"contractPollProcessor\",\n );\n await saveVtxosForContract(walletRepository, contract, filtered);\n vtxosSaved += filtered.length;\n contractsProcessed++;\n }\n\n return {\n taskItemId: item.id,\n type: CONTRACT_POLL_TASK_TYPE,\n status: \"success\",\n data: { contractsProcessed, vtxosSaved },\n };\n },\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":[],"mappings":";;;;AAkDA,eAAsB,QAAA,CAClB,KAAA,EACA,UAAA,EACA,IAAA,EACqB;AACrB,EAAA,MAAM,KAAA,GAAQ,MAAM,KAAA,CAAM,QAAA,EAAS;AACnC,EAAA,MAAM,YAAA,GAAe,IAAI,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,CAAC,CAAA,CAAE,QAAA,EAAU,CAAC,CAAC,CAAC,CAAA;AACnE,EAAA,MAAM,UAAwB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qB,gBAAA,EAAkB,QAAA,EAAU,QAAQ,CAAA;AAC/D,MAAA,UAAA,IAAc,QAAA,CAAS,MAAA;AACvB,MAAA,kBAAA,EAAA;AAAA,IACJ;AAEA,IAAA,OAAO;AAAA,MACH,YAAY,IAAA,CAAK,EAAA;AAAA,MACjB,IAAA,EAAM,uBAAA;AAAA,MACN,MAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAM,EAAE,kBAAA,EAAoB,UAAA;AAAW,KAC3C;AAAA,EACJ;AACJ","file":"chunk-MOBDJ7U2.js","sourcesContent":["import type { TaskItem, TaskResult, TaskQueue } from \"./taskQueue\";\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { IndexerProvider } from \"../../providers/indexer\";\nimport type { ArkProvider } from \"../../providers/ark\";\nimport type { ExtendedVirtualCoin, VirtualCoin } from \"../../wallet\";\nimport type { Contract } from \"../../contracts/types\";\nimport { getRandomId, extendVirtualCoinForContract } from \"../../wallet/utils\";\n\n/**\n * Shared dependencies injected into every processor at runtime.\n *\n * `extendVtxo` requires the owning contract — processors must resolve each\n * vtxo's `script` to a known contract (via the contract repository) before\n * calling this. The strict signature prevents the footgun where a missing\n * contract silently falls back to the wallet's default tapscript.\n */\nexport interface TaskDependencies {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) => ExtendedVirtualCoin;\n}\n\n/**\n * A stateless unit that handles one type of task item.\n *\n * Processors must not keep in-memory state across invocations —\n * all coordination lives in the @see TaskQueue and repositories.\n *\n * The `TDeps` parameter defaults to @see TaskDependencies but\n * can be overridden for domain-specific processors (e.g. swap processing).\n */\nexport interface TaskProcessor<TDeps = TaskDependencies> {\n readonly taskType: string;\n execute(item: TaskItem, deps: TDeps): Promise<Omit<TaskResult, \"id\" | \"executedAt\">>;\n}\n\n/**\n * Run all pending tasks from the queue through matching processors.\n *\n * For each task in the inbox:\n * 1. Find the processor whose `taskType` matches `task.type`.\n * 2. Execute it, producing a @see TaskResult.\n * 3. Push the result to the outbox and remove the task from the inbox.\n *\n * Tasks with no matching processor produce a `\"noop\"` result.\n * Processor errors produce a `\"failed\"` result with the error message.\n */\nexport async function runTasks<TDeps = TaskDependencies>(\n queue: TaskQueue,\n processors: TaskProcessor<TDeps>[],\n deps: TDeps,\n): Promise<TaskResult[]> {\n const tasks = await queue.getTasks();\n const processorMap = new Map(processors.map((p) => [p.taskType, p]));\n const results: TaskResult[] = [];\n\n for (const task of tasks) {\n const processor = processorMap.get(task.type);\n\n let partial: Omit<TaskResult, \"id\" | \"executedAt\">;\n\n if (!processor) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"noop\",\n };\n } else {\n try {\n partial = await processor.execute(task, deps);\n } catch (error) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"failed\",\n data: {\n error: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n const result: TaskResult = {\n ...partial,\n id: getRandomId(),\n executedAt: Date.now(),\n };\n\n await queue.pushResult(result);\n await queue.removeTask(task.id);\n results.push(result);\n }\n\n return results;\n}\n\n/**\n * Options for @see createTaskDependencies.\n */\nexport interface CreateTaskDependenciesOptions {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n}\n\n/**\n * Build the @see TaskDependencies needed by task processors\n * (e.g. `src/worker/expo/processors/contractPollProcessor.ts`)\n *\n * This is the same construction that `defineExpoBackgroundTask` does\n * internally, extracted so that consumers with custom schedulers\n * (e.g. bare React Native with `react-native-background-fetch`)\n * can build deps without depending on Expo.\n */\nexport function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies {\n return {\n ...options,\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) =>\n extendVirtualCoinForContract(vtxo, contract),\n };\n}\n","import { collectContracts } from \"../../../repositories/contractRepository\";\nimport type { TaskItem, TaskResult } from \"../taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../taskRunner\";\nimport type { ExtendedVirtualCoin } from \"../../../wallet\";\nimport { getNormalizedVtxos } from \"../../../wallet/vtxo\";\nimport {\n warnAndFilterVtxosForScript,\n saveVtxosForContract,\n} from \"../../../contracts/vtxoOwnership\";\n\nexport const CONTRACT_POLL_TASK_TYPE = \"contract-poll\";\n\n/**\n * Polls the indexer for the latest VTXO state of every contract and\n * persists the results to the wallet repository.\n *\n * Replicates the polling subset of @see ContractManager.initialize:\n * 1. Load every watched contract from the contract repository.\n * 2. Paginated fetch of every VTXO (including spent) from the indexer.\n * 3. Extend each VTXO with tapscript data.\n * 4. Save to the wallet repository.\n *\n * NOTE: the indexer query deliberately omits `spendableOnly`. Every\n * repository implements `saveVtxos` as an upsert with no batch delete,\n * so filtering to spendable-only would leave VTXOs that became spent\n * between polls marked as spendable forever. Fetching the full set lets\n * the upsert overwrite stale records with their latest state.\n */\nexport const contractPollProcessor: TaskProcessor = {\n taskType: CONTRACT_POLL_TASK_TYPE,\n\n async execute(\n item: TaskItem,\n deps: TaskDependencies,\n ): Promise<Omit<TaskResult, \"id\" | \"executedAt\">> {\n const { contractRepository, walletRepository, indexerProvider, extendVtxo } = deps;\n\n // Background channel, so it covers exactly what the watcher's\n // subscription covers: `retained` rows are kept for reads only.\n const contracts = await collectContracts(contractRepository, {\n watch: [\"watched\", \"awaiting-funds\"],\n });\n let contractsProcessed = 0;\n let vtxosSaved = 0;\n\n for (const contract of contracts) {\n // Paginated fetch of spendable virtual outputs\n const pageSize = 100;\n let pageIndex = 0;\n let hasMore = true;\n const allVtxos: ExtendedVirtualCoin[] = [];\n\n while (hasMore) {\n const { vtxos, page } = await getNormalizedVtxos(indexerProvider, {\n scripts: [contract.script],\n pageIndex,\n pageSize,\n });\n\n for (const vtxo of vtxos) {\n allVtxos.push(extendVtxo(vtxo, contract));\n }\n\n hasMore = page ? vtxos.length === pageSize : false;\n pageIndex++;\n }\n\n // Skip wrong-script rows (legacy duplicates or indexer drift)\n // before persisting; the loop must keep going for the remaining\n // contracts even when one row is rejected.\n const filtered = warnAndFilterVtxosForScript(\n allVtxos,\n contract.script,\n \"contractPollProcessor\",\n );\n await saveVtxosForContract(walletRepository, contract, filtered);\n vtxosSaved += filtered.length;\n contractsProcessed++;\n }\n\n return {\n taskItemId: item.id,\n type: CONTRACT_POLL_TASK_TYPE,\n status: \"success\",\n data: { contractsProcessed, vtxosSaved },\n };\n },\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkGGKR4O5X_cjs = require('./chunk-GGKR4O5X.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 chunkGGKR4O5X_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 = chunkGGKR4O5X_cjs.MultisigTapscript.encode({
|
|
76
76
|
pubkeys: [pubKey, serverPubKey]
|
|
77
77
|
}).script;
|
|
78
|
-
const exitScript =
|
|
78
|
+
const exitScript = chunkGGKR4O5X_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 !== "" ? chunkGGKR4O5X_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 = chunkGGKR4O5X_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 += chunkGGKR4O5X_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
500
|
+
const scripts = unique.slice(offset, offset + chunkGGKR4O5X_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 chunkGGKR4O5X_cjs.getNormalizedVtxos(indexerProvider, {
|
|
506
506
|
scripts,
|
|
507
507
|
pageIndex,
|
|
508
|
-
pageSize:
|
|
508
|
+
pageSize: chunkGGKR4O5X_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 === chunkGGKR4O5X_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: chunkGGKR4O5X_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 chunkGGKR4O5X_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 = chunkGGKR4O5X_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: chunkGGKR4O5X_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
|
+
chunkGGKR4O5X_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 chunkGGKR4O5X_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 = chunkGGKR4O5X_cjs.ConditionMultisigTapscript.encode({
|
|
1076
1076
|
conditionScript,
|
|
1077
1077
|
pubkeys: [receiver, server]
|
|
1078
1078
|
}).script;
|
|
1079
|
-
const refundScript =
|
|
1079
|
+
const refundScript = chunkGGKR4O5X_cjs.MultisigTapscript.encode({
|
|
1080
1080
|
pubkeys: [sender, receiver, server]
|
|
1081
1081
|
}).script;
|
|
1082
|
-
const refundWithoutReceiverScript =
|
|
1082
|
+
const refundWithoutReceiverScript = chunkGGKR4O5X_cjs.CLTVMultisigTapscript.encode({
|
|
1083
1083
|
absoluteTimelock: refundLocktime,
|
|
1084
1084
|
pubkeys: [sender, server]
|
|
1085
1085
|
}).script;
|
|
1086
|
-
const unilateralClaimScript =
|
|
1086
|
+
const unilateralClaimScript = chunkGGKR4O5X_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1087
1087
|
conditionScript,
|
|
1088
1088
|
timelock: unilateralClaimDelay,
|
|
1089
1089
|
pubkeys: [receiver]
|
|
1090
1090
|
}).script;
|
|
1091
|
-
const unilateralRefundScript =
|
|
1091
|
+
const unilateralRefundScript = chunkGGKR4O5X_cjs.CSVMultisigTapscript.encode({
|
|
1092
1092
|
timelock: unilateralRefundDelay,
|
|
1093
1093
|
pubkeys: [sender, receiver]
|
|
1094
1094
|
}).script;
|
|
1095
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1095
|
+
const unilateralRefundWithoutReceiverScript = chunkGGKR4O5X_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 = chunkGGKR4O5X_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 = chunkGGKR4O5X_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 = chunkGGKR4O5X_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: chunkGGKR4O5X_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1410
|
+
refundDelay: chunkGGKR4O5X_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1411
|
+
refundNoReceiverDelay: chunkGGKR4O5X_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: chunkGGKR4O5X_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1424
|
+
unilateralRefundDelay: chunkGGKR4O5X_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1425
|
+
unilateralRefundWithoutReceiverDelay: chunkGGKR4O5X_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: chunkGGKR4O5X_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1519
|
+
refundDelay: chunkGGKR4O5X_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1520
|
+
refundNoReceiverDelay: chunkGGKR4O5X_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;
|
|
@@ -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: chunkGGKR4O5X_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1599
|
+
unilateralRefundDelay: chunkGGKR4O5X_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1600
|
+
unilateralRefundWithoutReceiverDelay: chunkGGKR4O5X_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 = chunkGGKR4O5X_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 chunkGGKR4O5X_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1910
1910
|
conditionScript: resolveAsm(seg.asm, args),
|
|
1911
1911
|
timelock,
|
|
1912
1912
|
pubkeys
|
|
1913
1913
|
});
|
|
1914
1914
|
}
|
|
1915
|
-
return
|
|
1915
|
+
return chunkGGKR4O5X_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
1916
1916
|
}
|
|
1917
1917
|
if (seg.cltv !== void 0) {
|
|
1918
|
-
return
|
|
1918
|
+
return chunkGGKR4O5X_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 chunkGGKR4O5X_cjs.ConditionMultisigTapscript.encode({
|
|
1925
1925
|
conditionScript: resolveAsm(seg.asm, args),
|
|
1926
1926
|
pubkeys
|
|
1927
1927
|
});
|
|
1928
1928
|
}
|
|
1929
|
-
return
|
|
1929
|
+
return chunkGGKR4O5X_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 chunkGGKR4O5X_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(chunkGGKR4O5X_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-OM6FJ76H.cjs.map
|
|
2387
|
+
//# sourceMappingURL=chunk-OM6FJ76H.cjs.map
|