@arkade-os/sdk 0.4.32 → 0.4.34

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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/adapters/indexedDB.cjs +5 -5
  7. package/dist/adapters/indexedDB.js +4 -4
  8. package/dist/{ark-ibLW4Hte.d.cts → ark-Dsv5Jq4E.d.cts} +81 -10
  9. package/dist/{ark-ibLW4Hte.d.ts → ark-Dsv5Jq4E.d.ts} +81 -10
  10. package/dist/{asyncStorageTaskQueue-BEOFPNc0.d.ts → asyncStorageTaskQueue-BH-zuth5.d.ts} +1 -1
  11. package/dist/{asyncStorageTaskQueue-VGHXWR9F.d.cts → asyncStorageTaskQueue-D92ch8yI.d.cts} +1 -1
  12. package/dist/{chunk-ABWRLTX5.js → chunk-5WDBHWX3.js} +4 -4
  13. package/dist/{chunk-ABWRLTX5.js.map → chunk-5WDBHWX3.js.map} +1 -1
  14. package/dist/{chunk-GIGILVVP.cjs → chunk-CCLNFHJ5.cjs} +11 -11
  15. package/dist/{chunk-GIGILVVP.cjs.map → chunk-CCLNFHJ5.cjs.map} +1 -1
  16. package/dist/{chunk-WMIPYZSB.cjs → chunk-CMPJR3HS.cjs} +42 -9
  17. package/dist/chunk-CMPJR3HS.cjs.map +1 -0
  18. package/dist/{chunk-YA4G7RFB.js → chunk-CUSABEUQ.js} +166 -38
  19. package/dist/chunk-CUSABEUQ.js.map +1 -0
  20. package/dist/{chunk-6FLL2Q36.cjs → chunk-FSAXPBGP.cjs} +9 -9
  21. package/dist/chunk-FSAXPBGP.cjs.map +1 -0
  22. package/dist/{chunk-6NWNOLL3.js → chunk-FXFBPXV3.js} +4 -4
  23. package/dist/chunk-FXFBPXV3.js.map +1 -0
  24. package/dist/{chunk-IEO3XDKI.cjs → chunk-GUTKJMSF.cjs} +190 -58
  25. package/dist/chunk-GUTKJMSF.cjs.map +1 -0
  26. package/dist/{chunk-XROGFOPX.js → chunk-HFXEUW55.js} +740 -175
  27. package/dist/chunk-HFXEUW55.js.map +1 -0
  28. package/dist/{chunk-TU3LVAPX.js → chunk-OUVTG72A.js} +43 -11
  29. package/dist/chunk-OUVTG72A.js.map +1 -0
  30. package/dist/{chunk-SHEBNWOQ.js → chunk-VVGD3JIP.js} +3 -3
  31. package/dist/{chunk-SHEBNWOQ.js.map → chunk-VVGD3JIP.js.map} +1 -1
  32. package/dist/{chunk-KQK4PP6L.cjs → chunk-XCHBQVMK.cjs} +879 -314
  33. package/dist/chunk-XCHBQVMK.cjs.map +1 -0
  34. package/dist/{chunk-I2UIKZM5.cjs → chunk-ZS3OZHC7.cjs} +7 -7
  35. package/dist/{chunk-I2UIKZM5.cjs.map → chunk-ZS3OZHC7.cjs.map} +1 -1
  36. package/dist/contracts/handlers/index.cjs +10 -6
  37. package/dist/contracts/handlers/index.d.cts +3 -3
  38. package/dist/contracts/handlers/index.d.ts +3 -3
  39. package/dist/contracts/handlers/index.js +2 -2
  40. package/dist/{delegate-BvNTw44a.d.cts → delegate-BaS5SCIW.d.cts} +10 -2
  41. package/dist/{delegate-BXaR1RNG.d.ts → delegate-Baz_hb83.d.ts} +10 -2
  42. package/dist/{index-BusKawmy.d.ts → index-FwXZveaX.d.ts} +63 -3
  43. package/dist/{index-C-5Tw7VA.d.cts → index-lNZ6qaO3.d.cts} +63 -3
  44. package/dist/index.cjs +143 -127
  45. package/dist/index.d.cts +89 -16
  46. package/dist/index.d.ts +89 -16
  47. package/dist/index.js +4 -4
  48. package/dist/repositories/realm/index.cjs +13 -13
  49. package/dist/repositories/realm/index.d.cts +1 -1
  50. package/dist/repositories/realm/index.d.ts +1 -1
  51. package/dist/repositories/realm/index.js +4 -4
  52. package/dist/repositories/sqlite/index.cjs +13 -13
  53. package/dist/repositories/sqlite/index.d.cts +1 -1
  54. package/dist/repositories/sqlite/index.d.ts +1 -1
  55. package/dist/repositories/sqlite/index.js +4 -4
  56. package/dist/{taskRunner-B1igKGAo.d.ts → taskRunner-B1NUWyWR.d.ts} +1 -1
  57. package/dist/{taskRunner-By92TQ1m.d.cts → taskRunner-vFRA3F9b.d.cts} +1 -1
  58. package/dist/wallet/expo/background.cjs +14 -14
  59. package/dist/wallet/expo/background.d.cts +3 -3
  60. package/dist/wallet/expo/background.d.ts +3 -3
  61. package/dist/wallet/expo/background.js +6 -6
  62. package/dist/wallet/expo/index.cjs +14 -14
  63. package/dist/wallet/expo/index.cjs.map +1 -1
  64. package/dist/wallet/expo/index.d.cts +5 -5
  65. package/dist/wallet/expo/index.d.ts +5 -5
  66. package/dist/wallet/expo/index.js +6 -6
  67. package/dist/wallet/expo/index.js.map +1 -1
  68. package/dist/{wallet-B_rxgQTu.d.cts → wallet-By9HIo0Q.d.cts} +160 -5
  69. package/dist/{wallet-CyM4F7Bs.d.ts → wallet-D6uoBLmS.d.ts} +160 -5
  70. package/dist/worker/expo/index.cjs +9 -9
  71. package/dist/worker/expo/index.d.cts +4 -4
  72. package/dist/worker/expo/index.d.ts +4 -4
  73. package/dist/worker/expo/index.js +5 -5
  74. package/package.json +4 -4
  75. package/dist/chunk-6FLL2Q36.cjs.map +0 -1
  76. package/dist/chunk-6NWNOLL3.js.map +0 -1
  77. package/dist/chunk-IEO3XDKI.cjs.map +0 -1
  78. package/dist/chunk-KQK4PP6L.cjs.map +0 -1
  79. package/dist/chunk-TU3LVAPX.js.map +0 -1
  80. package/dist/chunk-WMIPYZSB.cjs.map +0 -1
  81. package/dist/chunk-XROGFOPX.js.map +0 -1
  82. package/dist/chunk-YA4G7RFB.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkKQK4PP6L_cjs = require('./chunk-KQK4PP6L.cjs');
3
+ var chunkXCHBQVMK_cjs = require('./chunk-XCHBQVMK.cjs');
4
4
 
5
5
  // src/worker/expo/taskRunner.ts
6
6
  async function runTasks(queue, processors, deps) {
@@ -32,7 +32,7 @@ async function runTasks(queue, processors, deps) {
32
32
  }
33
33
  const result = {
34
34
  ...partial,
35
- id: chunkKQK4PP6L_cjs.getRandomId(),
35
+ id: chunkXCHBQVMK_cjs.getRandomId(),
36
36
  executedAt: Date.now()
37
37
  };
38
38
  await queue.pushResult(result);
@@ -44,7 +44,7 @@ async function runTasks(queue, processors, deps) {
44
44
  function createTaskDependencies(options) {
45
45
  return {
46
46
  ...options,
47
- extendVtxo: (vtxo, contract) => chunkKQK4PP6L_cjs.extendVirtualCoinForContract(vtxo, contract)
47
+ extendVtxo: (vtxo, contract) => chunkXCHBQVMK_cjs.extendVirtualCoinForContract(vtxo, contract)
48
48
  };
49
49
  }
50
50
 
@@ -74,12 +74,12 @@ var contractPollProcessor = {
74
74
  hasMore = page ? vtxos.length === pageSize : false;
75
75
  pageIndex++;
76
76
  }
77
- const filtered = chunkKQK4PP6L_cjs.warnAndFilterVtxosForScript(
77
+ const filtered = chunkXCHBQVMK_cjs.warnAndFilterVtxosForScript(
78
78
  allVtxos,
79
79
  contract.script,
80
80
  "contractPollProcessor"
81
81
  );
82
- await chunkKQK4PP6L_cjs.saveVtxosForContract(walletRepository, contract, filtered);
82
+ await chunkXCHBQVMK_cjs.saveVtxosForContract(walletRepository, contract, filtered);
83
83
  vtxosSaved += filtered.length;
84
84
  contractsProcessed++;
85
85
  }
@@ -96,5 +96,5 @@ exports.CONTRACT_POLL_TASK_TYPE = CONTRACT_POLL_TASK_TYPE;
96
96
  exports.contractPollProcessor = contractPollProcessor;
97
97
  exports.createTaskDependencies = createTaskDependencies;
98
98
  exports.runTasks = runTasks;
99
- //# sourceMappingURL=chunk-I2UIKZM5.cjs.map
100
- //# sourceMappingURL=chunk-I2UIKZM5.cjs.map
99
+ //# sourceMappingURL=chunk-ZS3OZHC7.cjs.map
100
+ //# sourceMappingURL=chunk-ZS3OZHC7.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":["getRandomId","extendVirtualCoinForContract","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;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;AAChE,SACJ;AAAA,MACJ;AAAA,IACJ;AAEA,IAAA,MAAM,MAAA,GAAqB;AAAA,MACvB,GAAG,OAAA;A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AAW,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-I2UIKZM5.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 {\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 all contracts 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 const contracts = await contractRepository.getContracts();\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 indexerProvider.getVtxos({\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","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,C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s","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 {\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 all contracts 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 const contracts = await contractRepository.getContracts();\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 indexerProvider.getVtxos({\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,26 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkIEO3XDKI_cjs = require('../../chunk-IEO3XDKI.cjs');
4
- require('../../chunk-WMIPYZSB.cjs');
3
+ var chunkGUTKJMSF_cjs = require('../../chunk-GUTKJMSF.cjs');
4
+ require('../../chunk-CMPJR3HS.cjs');
5
5
  require('../../chunk-5BLDMQED.cjs');
6
6
 
7
7
 
8
8
 
9
+ Object.defineProperty(exports, "BoardingContractHandler", {
10
+ enumerable: true,
11
+ get: function () { return chunkGUTKJMSF_cjs.BoardingContractHandler; }
12
+ });
9
13
  Object.defineProperty(exports, "DefaultContractHandler", {
10
14
  enumerable: true,
11
- get: function () { return chunkIEO3XDKI_cjs.DefaultContractHandler; }
15
+ get: function () { return chunkGUTKJMSF_cjs.DefaultContractHandler; }
12
16
  });
13
17
  Object.defineProperty(exports, "DelegateContractHandler", {
14
18
  enumerable: true,
15
- get: function () { return chunkIEO3XDKI_cjs.DelegateContractHandler; }
19
+ get: function () { return chunkGUTKJMSF_cjs.DelegateContractHandler; }
16
20
  });
17
21
  Object.defineProperty(exports, "VHTLCContractHandler", {
18
22
  enumerable: true,
19
- get: function () { return chunkIEO3XDKI_cjs.VHTLCContractHandler; }
23
+ get: function () { return chunkGUTKJMSF_cjs.VHTLCContractHandler; }
20
24
  });
21
25
  Object.defineProperty(exports, "contractHandlers", {
22
26
  enumerable: true,
23
- get: function () { return chunkIEO3XDKI_cjs.contractHandlers; }
27
+ get: function () { return chunkGUTKJMSF_cjs.contractHandlers; }
24
28
  });
25
29
  //# sourceMappingURL=index.cjs.map
26
30
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { D as DefaultContractHandler, a as DefaultContractParams, b as DelegateContractHandler, c as DelegateContractParams, d as VHTLCContractHandler, e as VHTLCContractParams, f as contractHandlers } from '../../index-C-5Tw7VA.cjs';
2
- import '../../ark-ibLW4Hte.cjs';
1
+ export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from '../../index-lNZ6qaO3.cjs';
2
+ import '../../ark-Dsv5Jq4E.cjs';
3
3
  import '@scure/btc-signer/transaction.js';
4
4
  import '@scure/btc-signer/utils.js';
5
5
  import '@scure/btc-signer/psbt.js';
6
6
  import '@scure/btc-signer';
7
- import '../../delegate-BvNTw44a.cjs';
7
+ import '../../delegate-BaS5SCIW.cjs';
@@ -1,7 +1,7 @@
1
- export { D as DefaultContractHandler, a as DefaultContractParams, b as DelegateContractHandler, c as DelegateContractParams, d as VHTLCContractHandler, e as VHTLCContractParams, f as contractHandlers } from '../../index-BusKawmy.js';
2
- import '../../ark-ibLW4Hte.js';
1
+ export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from '../../index-FwXZveaX.js';
2
+ import '../../ark-Dsv5Jq4E.js';
3
3
  import '@scure/btc-signer/transaction.js';
4
4
  import '@scure/btc-signer/utils.js';
5
5
  import '@scure/btc-signer/psbt.js';
6
6
  import '@scure/btc-signer';
7
- import '../../delegate-BXaR1RNG.js';
7
+ import '../../delegate-Baz_hb83.js';
@@ -1,5 +1,5 @@
1
- export { DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, contractHandlers } from '../../chunk-YA4G7RFB.js';
2
- import '../../chunk-TU3LVAPX.js';
1
+ export { BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, contractHandlers } from '../../chunk-CUSABEUQ.js';
2
+ import '../../chunk-OUVTG72A.js';
3
3
  import '../../chunk-NSBPE2FW.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript } from './ark-ibLW4Hte.cjs';
2
+ import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript } from './ark-Dsv5Jq4E.cjs';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -15,7 +15,7 @@ declare namespace DefaultVtxo {
15
15
  interface Options {
16
16
  pubKey: Bytes;
17
17
  serverPubKey: Bytes;
18
- csvTimelock?: RelativeTimelock;
18
+ csvTimelock: RelativeTimelock;
19
19
  }
20
20
  /**
21
21
  * DefaultVtxo.Script is the class letting to create the vtxo script.
@@ -24,6 +24,10 @@ declare namespace DefaultVtxo {
24
24
  * const vtxoScript = new DefaultVtxo.Script({
25
25
  * pubKey: new Uint8Array(32),
26
26
  * serverPubKey: new Uint8Array(32),
27
+ * csvTimelock: {
28
+ * value: 605184n,
29
+ * type: "seconds"
30
+ * }
27
31
  * });
28
32
  *
29
33
  * console.log("script pub key:", vtxoScript.pkScript)
@@ -61,6 +65,10 @@ declare namespace DelegateVtxo {
61
65
  * pubKey: new Uint8Array(32),
62
66
  * serverPubKey: new Uint8Array(32),
63
67
  * delegatePubKey: new Uint8Array(32),
68
+ * csvTimelock: {
69
+ * value: 605184n,
70
+ * type: "seconds"
71
+ * }
64
72
  * });
65
73
  *
66
74
  * console.log("script pub key:", vtxoScript.pkScript)
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript } from './ark-ibLW4Hte.js';
2
+ import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript } from './ark-Dsv5Jq4E.js';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -15,7 +15,7 @@ declare namespace DefaultVtxo {
15
15
  interface Options {
16
16
  pubKey: Bytes;
17
17
  serverPubKey: Bytes;
18
- csvTimelock?: RelativeTimelock;
18
+ csvTimelock: RelativeTimelock;
19
19
  }
20
20
  /**
21
21
  * DefaultVtxo.Script is the class letting to create the vtxo script.
@@ -24,6 +24,10 @@ declare namespace DefaultVtxo {
24
24
  * const vtxoScript = new DefaultVtxo.Script({
25
25
  * pubKey: new Uint8Array(32),
26
26
  * serverPubKey: new Uint8Array(32),
27
+ * csvTimelock: {
28
+ * value: 605184n,
29
+ * type: "seconds"
30
+ * }
27
31
  * });
28
32
  *
29
33
  * console.log("script pub key:", vtxoScript.pkScript)
@@ -61,6 +65,10 @@ declare namespace DelegateVtxo {
61
65
  * pubKey: new Uint8Array(32),
62
66
  * serverPubKey: new Uint8Array(32),
63
67
  * delegatePubKey: new Uint8Array(32),
68
+ * csvTimelock: {
69
+ * value: 605184n,
70
+ * type: "seconds"
71
+ * }
64
72
  * });
65
73
  *
66
74
  * console.log("script pub key:", vtxoScript.pkScript)
@@ -1,5 +1,5 @@
1
- import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript, aM as ContractHandler, aV as Discoverable } from './ark-ibLW4Hte.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BXaR1RNG.js';
1
+ import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript, aN as ContractHandler, aW as Discoverable } from './ark-Dsv5Jq4E.js';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Baz_hb83.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /** Virtual Hash Time Lock Contract (VHTLC) namespace. */
@@ -196,4 +196,64 @@ interface VHTLCContractParams {
196
196
  */
197
197
  declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.Script>;
198
198
 
199
- export { DefaultContractHandler as D, VHTLC as V, type DefaultContractParams as a, DelegateContractHandler as b, type DelegateContractParams as c, VHTLCContractHandler as d, type VHTLCContractParams as e, contractHandlers as f };
199
+ /**
200
+ * Typed parameters for boarding contracts.
201
+ *
202
+ * Boarding reuses the exact `default` contract parameter shape
203
+ * (`pubKey` / `serverPubKey` / `csvTimelock`) rather than inventing
204
+ * boarding-specific names — the boarding semantics come from the
205
+ * contract type and from populating `csvTimelock` with the server's
206
+ * boarding-exit delay (`ArkInfo.boardingExitDelay`) instead of the
207
+ * offchain unilateral-exit delay.
208
+ */
209
+ type BoardingContractParams = DefaultContractParams;
210
+ /**
211
+ * Handler for the boarding contract (registered type `boarding`).
212
+ *
213
+ * The boarding contract derives the on-chain Bitcoin address used to
214
+ * board funds onto Arkade. It shares the exact `DefaultVtxo.Script`
215
+ * shape with the `default` contract — a Taproot output co-owned by the
216
+ * wallet and the Ark server, with a CSV exit path back to the wallet —
217
+ * and therefore reuses the `default` handler's path logic (forfeit via
218
+ * server cooperation, exit after the boarding CSV).
219
+ *
220
+ * Boarding semantics come entirely from the contract type and from
221
+ * sourcing the CSV timelock from the server's boarding-exit delay
222
+ * (`ArkInfo.boardingExitDelay`), not from renamed parameters. The
223
+ * offchain `default` contract is built from `ArkInfo.unilateralExitDelay`
224
+ * instead, so the two share a script shape but differ in their CSV
225
+ * timelock value. Parameters round-trip through the same
226
+ * `timelockToSequence` / `sequenceToTimelock` helpers and BIP68 sequence
227
+ * encoding as `default` / `delegate`.
228
+ *
229
+ * Like `default` / `delegate`, the boarding handler implements
230
+ * {@link Discoverable.discoverAt} so `wallet.restore()` can rediscover
231
+ * used boarding indices from authoritative on-chain data. It differs from
232
+ * the L2 handlers in its source of truth: boarding probes the **on-chain**
233
+ * UTXO set at its P2TR address (`OnchainProvider.getCoins`) rather than the
234
+ * Ark indexer, and builds its candidate from the boarding-exit CSV
235
+ * (`deps.boardingTimelock`). When boarding discovery is not plumbed (no
236
+ * `deps.boardingTimelock` / `deps.onchainNetwork`) `discoverAt` no-ops.
237
+ *
238
+ * Identity & the default/boarding collision: a contract's `script` (pkScript)
239
+ * is its unique identity — a script owns exactly one repository row. `boarding`
240
+ * is a first-class type with its own row **when its script is distinct** from
241
+ * the wallet's `default` baseline — the real-world case, since a sound Ark
242
+ * server keeps boardingExitDelay strictly longer than unilateralExitDelay (equal
243
+ * delays would expose the provider to a double-spend). Should those delays ever
244
+ * coincide (a misconfigured/malicious server), the boarding script is
245
+ * byte-identical to the default script. `discoverAt` does NOT pre-coalesce that
246
+ * collision: it always emits `type: "boarding"`, and the single shared row is
247
+ * resolved FIRST-WINS at the persistence layer
248
+ * ({@link ContractManager.upsertContract}) — whichever purpose is persisted
249
+ * first keeps the row, and the scan deliberately probes boarding first
250
+ * (see docs/hd-wallets_onchain_rotation_collision_fix.md §5.1–5.2). Either way
251
+ * the funds are equally spendable through the shared `DefaultVtxo.Script` paths.
252
+ * Consumers must NOT rely on `contract.type === "boarding"` to identify the
253
+ * boarding purpose — resolve the boarding script via
254
+ * `wallet.getBoardingAddress()` / `wallet.boardingTapscript` (which never depend
255
+ * on the persisted contract's type) and match by script when needed.
256
+ */
257
+ declare const BoardingContractHandler: ContractHandler<BoardingContractParams, DefaultVtxo.Script> & Discoverable;
258
+
259
+ export { BoardingContractHandler as B, DefaultContractHandler as D, VHTLC as V, type BoardingContractParams as a, type DefaultContractParams as b, DelegateContractHandler as c, type DelegateContractParams as d, VHTLCContractHandler as e, type VHTLCContractParams as f, contractHandlers as g };
@@ -1,5 +1,5 @@
1
- import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript, aM as ContractHandler, aV as Discoverable } from './ark-ibLW4Hte.cjs';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BvNTw44a.cjs';
1
+ import { o as RelativeTimelock, V as VtxoScript, p as TapLeafScript, aN as ContractHandler, aW as Discoverable } from './ark-Dsv5Jq4E.cjs';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BaS5SCIW.cjs';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /** Virtual Hash Time Lock Contract (VHTLC) namespace. */
@@ -196,4 +196,64 @@ interface VHTLCContractParams {
196
196
  */
197
197
  declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.Script>;
198
198
 
199
- export { DefaultContractHandler as D, VHTLC as V, type DefaultContractParams as a, DelegateContractHandler as b, type DelegateContractParams as c, VHTLCContractHandler as d, type VHTLCContractParams as e, contractHandlers as f };
199
+ /**
200
+ * Typed parameters for boarding contracts.
201
+ *
202
+ * Boarding reuses the exact `default` contract parameter shape
203
+ * (`pubKey` / `serverPubKey` / `csvTimelock`) rather than inventing
204
+ * boarding-specific names — the boarding semantics come from the
205
+ * contract type and from populating `csvTimelock` with the server's
206
+ * boarding-exit delay (`ArkInfo.boardingExitDelay`) instead of the
207
+ * offchain unilateral-exit delay.
208
+ */
209
+ type BoardingContractParams = DefaultContractParams;
210
+ /**
211
+ * Handler for the boarding contract (registered type `boarding`).
212
+ *
213
+ * The boarding contract derives the on-chain Bitcoin address used to
214
+ * board funds onto Arkade. It shares the exact `DefaultVtxo.Script`
215
+ * shape with the `default` contract — a Taproot output co-owned by the
216
+ * wallet and the Ark server, with a CSV exit path back to the wallet —
217
+ * and therefore reuses the `default` handler's path logic (forfeit via
218
+ * server cooperation, exit after the boarding CSV).
219
+ *
220
+ * Boarding semantics come entirely from the contract type and from
221
+ * sourcing the CSV timelock from the server's boarding-exit delay
222
+ * (`ArkInfo.boardingExitDelay`), not from renamed parameters. The
223
+ * offchain `default` contract is built from `ArkInfo.unilateralExitDelay`
224
+ * instead, so the two share a script shape but differ in their CSV
225
+ * timelock value. Parameters round-trip through the same
226
+ * `timelockToSequence` / `sequenceToTimelock` helpers and BIP68 sequence
227
+ * encoding as `default` / `delegate`.
228
+ *
229
+ * Like `default` / `delegate`, the boarding handler implements
230
+ * {@link Discoverable.discoverAt} so `wallet.restore()` can rediscover
231
+ * used boarding indices from authoritative on-chain data. It differs from
232
+ * the L2 handlers in its source of truth: boarding probes the **on-chain**
233
+ * UTXO set at its P2TR address (`OnchainProvider.getCoins`) rather than the
234
+ * Ark indexer, and builds its candidate from the boarding-exit CSV
235
+ * (`deps.boardingTimelock`). When boarding discovery is not plumbed (no
236
+ * `deps.boardingTimelock` / `deps.onchainNetwork`) `discoverAt` no-ops.
237
+ *
238
+ * Identity & the default/boarding collision: a contract's `script` (pkScript)
239
+ * is its unique identity — a script owns exactly one repository row. `boarding`
240
+ * is a first-class type with its own row **when its script is distinct** from
241
+ * the wallet's `default` baseline — the real-world case, since a sound Ark
242
+ * server keeps boardingExitDelay strictly longer than unilateralExitDelay (equal
243
+ * delays would expose the provider to a double-spend). Should those delays ever
244
+ * coincide (a misconfigured/malicious server), the boarding script is
245
+ * byte-identical to the default script. `discoverAt` does NOT pre-coalesce that
246
+ * collision: it always emits `type: "boarding"`, and the single shared row is
247
+ * resolved FIRST-WINS at the persistence layer
248
+ * ({@link ContractManager.upsertContract}) — whichever purpose is persisted
249
+ * first keeps the row, and the scan deliberately probes boarding first
250
+ * (see docs/hd-wallets_onchain_rotation_collision_fix.md §5.1–5.2). Either way
251
+ * the funds are equally spendable through the shared `DefaultVtxo.Script` paths.
252
+ * Consumers must NOT rely on `contract.type === "boarding"` to identify the
253
+ * boarding purpose — resolve the boarding script via
254
+ * `wallet.getBoardingAddress()` / `wallet.boardingTapscript` (which never depend
255
+ * on the persisted contract's type) and match by script when needed.
256
+ */
257
+ declare const BoardingContractHandler: ContractHandler<BoardingContractParams, DefaultVtxo.Script> & Discoverable;
258
+
259
+ export { BoardingContractHandler as B, DefaultContractHandler as D, VHTLC as V, type BoardingContractParams as a, type DefaultContractParams as b, DelegateContractHandler as c, type DelegateContractParams as d, VHTLCContractHandler as e, type VHTLCContractParams as f, contractHandlers as g };