@arkade-os/sdk 0.4.70 → 0.4.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-BgUJN-3X.d.ts → asyncStorageTaskQueue-DhhNZc4v.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-Cstx6hS7.d.cts → asyncStorageTaskQueue-s5lUGWxu.d.cts} +1 -1
- package/dist/{chunk-JJ7AXR4O.cjs → chunk-4BWZ437E.cjs} +21 -17
- package/dist/chunk-4BWZ437E.cjs.map +1 -0
- package/dist/{chunk-3KW4TWP2.cjs → chunk-4C5PMGBB.cjs} +51 -25
- package/dist/chunk-4C5PMGBB.cjs.map +1 -0
- package/dist/{chunk-TXSF2DKX.js → chunk-5GQFYVWP.js} +30 -5
- package/dist/chunk-5GQFYVWP.js.map +1 -0
- package/dist/{chunk-57636V35.cjs → chunk-6FTHFJAN.cjs} +30 -4
- package/dist/chunk-6FTHFJAN.cjs.map +1 -0
- package/dist/{chunk-JVHO6XHG.js → chunk-BHLYB44A.js} +476 -78
- package/dist/chunk-BHLYB44A.js.map +1 -0
- package/dist/{chunk-6UM55KPZ.js → chunk-CB6QPAO5.js} +3 -3
- package/dist/{chunk-6UM55KPZ.js.map → chunk-CB6QPAO5.js.map} +1 -1
- package/dist/{chunk-IUFTICRY.js → chunk-CZPBPMO2.js} +4 -4
- package/dist/{chunk-IUFTICRY.js.map → chunk-CZPBPMO2.js.map} +1 -1
- package/dist/{chunk-F5E7LI6G.js → chunk-IGER5FPC.js} +37 -11
- package/dist/chunk-IGER5FPC.js.map +1 -0
- package/dist/{chunk-B73Q75IL.cjs → chunk-KDMHEWTD.cjs} +10 -10
- package/dist/{chunk-B73Q75IL.cjs.map → chunk-KDMHEWTD.cjs.map} +1 -1
- package/dist/{chunk-3OKEUDHU.cjs → chunk-NPM5YZBC.cjs} +49 -49
- package/dist/{chunk-3OKEUDHU.cjs.map → chunk-NPM5YZBC.cjs.map} +1 -1
- package/dist/{chunk-UG3EZDLF.js → chunk-S5PUFSXC.js} +8 -4
- package/dist/chunk-S5PUFSXC.js.map +1 -0
- package/dist/{chunk-XTCOSZ34.cjs → chunk-U5I3ITV7.cjs} +907 -507
- package/dist/chunk-U5I3ITV7.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-DrwIar11.d.cts → delegate-BJp8f6LT.d.cts} +1 -1
- package/dist/{delegate-BPdzTbwN.d.ts → delegate-Ckz_TWzM.d.ts} +1 -1
- package/dist/{hdWalletCapable-D4WH35z0.d.cts → hdWalletCapable-DA9bJ5eB.d.cts} +2 -2
- package/dist/{hdWalletCapable-DyxCiNVE.d.ts → hdWalletCapable-DABgAD-T.d.ts} +2 -2
- package/dist/{index-TZJvbIaA.d.ts → index-B8xrELXY.d.ts} +2 -2
- package/dist/{index-BqhpAqqj.d.cts → index-DSbDm0Io.d.cts} +2 -2
- package/dist/{index-dWRqYSdS.d.ts → index-Dg0-TvBQ.d.cts} +149 -5
- package/dist/{index-dWRqYSdS.d.cts → index-Dg0-TvBQ.d.ts} +149 -5
- package/dist/index.cjs +309 -297
- package/dist/index.d.cts +91 -12
- package/dist/index.d.ts +91 -12
- 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-CzYKyJ9c.d.cts → taskRunner-BH_FxaNI.d.cts} +1 -1
- package/dist/{taskRunner-D2fnbqYw.d.ts → taskRunner-DrVz2QZs.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 +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-3KW4TWP2.cjs.map +0 -1
- package/dist/chunk-57636V35.cjs.map +0 -1
- package/dist/chunk-F5E7LI6G.js.map +0 -1
- package/dist/chunk-JJ7AXR4O.cjs.map +0 -1
- package/dist/chunk-JVHO6XHG.js.map +0 -1
- package/dist/chunk-TXSF2DKX.js.map +0 -1
- package/dist/chunk-UG3EZDLF.js.map +0 -1
- package/dist/chunk-XTCOSZ34.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":["getRandomId","extendVirtualCoinForContract","isWatchedContract","getNormalizedVtxos","warnAndFilterVtxosForScript","saveVtxosForContract"],"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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A,MAAA,MAAMC,sCAAA,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-B73Q75IL.cjs","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 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\";\nimport { isWatchedContract } from \"../../../contracts/types\";\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 contractRepository.getContracts()).filter(isWatchedContract);\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":["getRandomId","extendVirtualCoinForContract","isWatchedContract","getNormalizedVtxos","warnAndFilterVtxosForScript","saveVtxosForContract"],"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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A,EAAW;AAE9B,MAAA,MAAM,QAAA,GAAW,GAAA;AACjB,MAAA,IAAI,SAAA,GAAY,CAAA;AAChB,MAAA,IAAI,OAAA,GAAU,IAAA;AACd,MAAA,MAAM,WAAkC,EAAC;AAEzC,MAAA,OAAO,OAAA,EAAS;AACZ,QAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAK,GAAI,MAAMC,qCAAmB,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,GAAWC,6CAAA;AAAA,QACb,QAAA;AAAA,QACA,QAAA,CAAS,MAAA;AAAA,QACT;AAAA,OACJ;AACA,MAAA,MAAMC,sCAAA,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-KDMHEWTD.cjs","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 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\";\nimport { isWatchedContract } from \"../../../contracts/types\";\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 contractRepository.getContracts()).filter(isWatchedContract);\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 chunk6FTHFJAN_cjs = require('./chunk-6FTHFJAN.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 chunk6FTHFJAN_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 = chunk6FTHFJAN_cjs.MultisigTapscript.encode({
|
|
84
84
|
pubkeys: [pubKey, serverPubKey]
|
|
85
85
|
}).script;
|
|
86
|
-
const exitScript =
|
|
86
|
+
const exitScript = chunk6FTHFJAN_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 !== "" ? chunk6FTHFJAN_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 = chunk6FTHFJAN_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 += chunk6FTHFJAN_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
392
|
+
const scripts = unique.slice(offset, offset + chunk6FTHFJAN_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 chunk6FTHFJAN_cjs.getNormalizedVtxos(indexerProvider, {
|
|
398
398
|
scripts,
|
|
399
399
|
pageIndex,
|
|
400
|
-
pageSize:
|
|
400
|
+
pageSize: chunk6FTHFJAN_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 === chunk6FTHFJAN_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: chunk6FTHFJAN_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: chunk6FTHFJAN_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 chunk6FTHFJAN_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 = chunk6FTHFJAN_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: chunk6FTHFJAN_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: chunk6FTHFJAN_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
606
606
|
},
|
|
607
607
|
script: c.scriptHex,
|
|
608
608
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -1445,7 +1445,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1445
1445
|
// src/script/vhtlc.ts
|
|
1446
1446
|
exports.VHTLC = void 0;
|
|
1447
1447
|
((VHTLC2) => {
|
|
1448
|
-
class BaseScript extends
|
|
1448
|
+
class BaseScript extends chunk6FTHFJAN_cjs.VtxoScript {
|
|
1449
1449
|
options;
|
|
1450
1450
|
claimScript;
|
|
1451
1451
|
refundScript;
|
|
@@ -1472,27 +1472,27 @@ exports.VHTLC = void 0;
|
|
|
1472
1472
|
unilateralRefundWithoutReceiverDelay
|
|
1473
1473
|
} = options;
|
|
1474
1474
|
const conditionScript = preimageCondition(preimageHash);
|
|
1475
|
-
const claimScript =
|
|
1475
|
+
const claimScript = chunk6FTHFJAN_cjs.ConditionMultisigTapscript.encode({
|
|
1476
1476
|
conditionScript,
|
|
1477
1477
|
pubkeys: [receiver, server]
|
|
1478
1478
|
}).script;
|
|
1479
|
-
const refundScript =
|
|
1479
|
+
const refundScript = chunk6FTHFJAN_cjs.MultisigTapscript.encode({
|
|
1480
1480
|
pubkeys: [sender, receiver, server]
|
|
1481
1481
|
}).script;
|
|
1482
|
-
const refundWithoutReceiverScript =
|
|
1482
|
+
const refundWithoutReceiverScript = chunk6FTHFJAN_cjs.CLTVMultisigTapscript.encode({
|
|
1483
1483
|
absoluteTimelock: refundLocktime,
|
|
1484
1484
|
pubkeys: [sender, server]
|
|
1485
1485
|
}).script;
|
|
1486
|
-
const unilateralClaimScript =
|
|
1486
|
+
const unilateralClaimScript = chunk6FTHFJAN_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1487
1487
|
conditionScript,
|
|
1488
1488
|
timelock: unilateralClaimDelay,
|
|
1489
1489
|
pubkeys: [receiver]
|
|
1490
1490
|
}).script;
|
|
1491
|
-
const unilateralRefundScript =
|
|
1491
|
+
const unilateralRefundScript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({
|
|
1492
1492
|
timelock: unilateralRefundDelay,
|
|
1493
1493
|
pubkeys: [sender, receiver]
|
|
1494
1494
|
}).script;
|
|
1495
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1495
|
+
const unilateralRefundWithoutReceiverScript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({
|
|
1496
1496
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1497
1497
|
pubkeys: [sender]
|
|
1498
1498
|
}).script;
|
|
@@ -1512,7 +1512,7 @@ exports.VHTLC = void 0;
|
|
|
1512
1512
|
const covenants = options.nonInteractiveParameters;
|
|
1513
1513
|
if (covenants) {
|
|
1514
1514
|
arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
|
|
1515
|
-
nonInteractiveClaimScript =
|
|
1515
|
+
nonInteractiveClaimScript = chunk6FTHFJAN_cjs.ConditionMultisigTapscript.encode({
|
|
1516
1516
|
conditionScript,
|
|
1517
1517
|
pubkeys: [
|
|
1518
1518
|
server,
|
|
@@ -1525,12 +1525,12 @@ exports.VHTLC = void 0;
|
|
|
1525
1525
|
covenants.emulatorPubkey,
|
|
1526
1526
|
arkadeScriptNir
|
|
1527
1527
|
);
|
|
1528
|
-
nonInteractiveRefundScript =
|
|
1528
|
+
nonInteractiveRefundScript = chunk6FTHFJAN_cjs.MultisigTapscript.encode({
|
|
1529
1529
|
pubkeys: [server, receiver, nirCosigner]
|
|
1530
1530
|
}).script;
|
|
1531
1531
|
scripts.push(nonInteractiveRefundScript);
|
|
1532
1532
|
if (covenants.legacy !== "preTimelockedRefund") {
|
|
1533
|
-
nonInteractiveRefundWithoutReceiverScript =
|
|
1533
|
+
nonInteractiveRefundWithoutReceiverScript = chunk6FTHFJAN_cjs.CLTVMultisigTapscript.encode({
|
|
1534
1534
|
absoluteTimelock: refundLocktime,
|
|
1535
1535
|
pubkeys: [server, nirCosigner]
|
|
1536
1536
|
}).script;
|
|
@@ -1844,9 +1844,9 @@ var VHTLCContractHandler = {
|
|
|
1844
1844
|
server: base.hex.encode(params.server),
|
|
1845
1845
|
hash: base.hex.encode(params.preimageHash),
|
|
1846
1846
|
refundLocktime: params.refundLocktime.toString(),
|
|
1847
|
-
claimDelay:
|
|
1848
|
-
refundDelay:
|
|
1849
|
-
refundNoReceiverDelay:
|
|
1847
|
+
claimDelay: chunk6FTHFJAN_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1848
|
+
refundDelay: chunk6FTHFJAN_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1849
|
+
refundNoReceiverDelay: chunk6FTHFJAN_cjs.timelockToSequence(
|
|
1850
1850
|
params.unilateralRefundWithoutReceiverDelay
|
|
1851
1851
|
).toString()
|
|
1852
1852
|
};
|
|
@@ -1858,9 +1858,9 @@ var VHTLCContractHandler = {
|
|
|
1858
1858
|
server: base.hex.decode(params.server),
|
|
1859
1859
|
preimageHash: base.hex.decode(params.hash),
|
|
1860
1860
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1861
|
-
unilateralClaimDelay:
|
|
1862
|
-
unilateralRefundDelay:
|
|
1863
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1861
|
+
unilateralClaimDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1862
|
+
unilateralRefundDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1863
|
+
unilateralRefundWithoutReceiverDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(
|
|
1864
1864
|
Number(params.refundNoReceiverDelay)
|
|
1865
1865
|
)
|
|
1866
1866
|
};
|
|
@@ -2106,9 +2106,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2106
2106
|
server: base.hex.encode(params.server),
|
|
2107
2107
|
hash: base.hex.encode(params.preimageHash),
|
|
2108
2108
|
refundLocktime: params.refundLocktime.toString(),
|
|
2109
|
-
claimDelay:
|
|
2110
|
-
refundDelay:
|
|
2111
|
-
refundNoReceiverDelay:
|
|
2109
|
+
claimDelay: chunk6FTHFJAN_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
2110
|
+
refundDelay: chunk6FTHFJAN_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
2111
|
+
refundNoReceiverDelay: chunk6FTHFJAN_cjs.timelockToSequence(
|
|
2112
2112
|
params.unilateralRefundWithoutReceiverDelay
|
|
2113
2113
|
).toString(),
|
|
2114
2114
|
// The on-disk keys keep their per-leaf names even though the typed
|
|
@@ -2208,9 +2208,9 @@ var VHTLCV2ContractHandler = {
|
|
|
2208
2208
|
preimageHash: base.hex.decode(params.hash),
|
|
2209
2209
|
refundLocktime: BigInt(params.refundLocktime),
|
|
2210
2210
|
...asset && { asset },
|
|
2211
|
-
unilateralClaimDelay:
|
|
2212
|
-
unilateralRefundDelay:
|
|
2213
|
-
unilateralRefundWithoutReceiverDelay:
|
|
2211
|
+
unilateralClaimDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
2212
|
+
unilateralRefundDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
2213
|
+
unilateralRefundWithoutReceiverDelay: chunk6FTHFJAN_cjs.sequenceToTimelock(
|
|
2214
2214
|
Number(params.refundNoReceiverDelay)
|
|
2215
2215
|
),
|
|
2216
2216
|
...claim && refund && {
|
|
@@ -2483,7 +2483,7 @@ var BoardingContractHandler = {
|
|
|
2483
2483
|
const coins = await deps.onchainProvider.getCoins(onchainAddress);
|
|
2484
2484
|
if (coins.length === 0) return [];
|
|
2485
2485
|
const scriptHex = base.hex.encode(script.pkScript);
|
|
2486
|
-
const boardingSeq =
|
|
2486
|
+
const boardingSeq = chunk6FTHFJAN_cjs.timelockToSequence(deps.boardingTimelock);
|
|
2487
2487
|
return [
|
|
2488
2488
|
{
|
|
2489
2489
|
type: "boarding",
|
|
@@ -2644,27 +2644,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
2644
2644
|
if (seg.csv) {
|
|
2645
2645
|
const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
|
|
2646
2646
|
if (seg.asm) {
|
|
2647
|
-
return
|
|
2647
|
+
return chunk6FTHFJAN_cjs.ConditionCSVMultisigTapscript.encode({
|
|
2648
2648
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2649
2649
|
timelock,
|
|
2650
2650
|
pubkeys
|
|
2651
2651
|
});
|
|
2652
2652
|
}
|
|
2653
|
-
return
|
|
2653
|
+
return chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
2654
2654
|
}
|
|
2655
2655
|
if (seg.cltv !== void 0) {
|
|
2656
|
-
return
|
|
2656
|
+
return chunk6FTHFJAN_cjs.CLTVMultisigTapscript.encode({
|
|
2657
2657
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
2658
2658
|
pubkeys
|
|
2659
2659
|
});
|
|
2660
2660
|
}
|
|
2661
2661
|
if (seg.asm) {
|
|
2662
|
-
return
|
|
2662
|
+
return chunk6FTHFJAN_cjs.ConditionMultisigTapscript.encode({
|
|
2663
2663
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2664
2664
|
pubkeys
|
|
2665
2665
|
});
|
|
2666
2666
|
}
|
|
2667
|
-
return
|
|
2667
|
+
return chunk6FTHFJAN_cjs.MultisigTapscript.encode({ pubkeys });
|
|
2668
2668
|
}
|
|
2669
2669
|
function compileFunctions(program, args, keys) {
|
|
2670
2670
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2694,7 +2694,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2694
2694
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2695
2695
|
});
|
|
2696
2696
|
}
|
|
2697
|
-
var ArkadeProgramScript = class extends
|
|
2697
|
+
var ArkadeProgramScript = class extends chunk6FTHFJAN_cjs.VtxoScript {
|
|
2698
2698
|
constructor(program, args, keys) {
|
|
2699
2699
|
const partial = compileFunctions(program, args, keys);
|
|
2700
2700
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2907,7 +2907,7 @@ function pathsFor(script, context, opts) {
|
|
|
2907
2907
|
continue;
|
|
2908
2908
|
}
|
|
2909
2909
|
if (requiresServer) continue;
|
|
2910
|
-
const sequence = csv ? Number(
|
|
2910
|
+
const sequence = csv ? Number(chunk6FTHFJAN_cjs.timelockToSequence(csv)) : void 0;
|
|
2911
2911
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2912
2912
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2913
2913
|
continue;
|
|
@@ -3036,5 +3036,5 @@ exports.toASM = toASM;
|
|
|
3036
3036
|
exports.toXOnly = toXOnly;
|
|
3037
3037
|
exports.validateProgram = validateProgram;
|
|
3038
3038
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
3039
|
-
//# sourceMappingURL=chunk-
|
|
3040
|
-
//# sourceMappingURL=chunk-
|
|
3039
|
+
//# sourceMappingURL=chunk-NPM5YZBC.cjs.map
|
|
3040
|
+
//# sourceMappingURL=chunk-NPM5YZBC.cjs.map
|