@arkade-os/sdk 0.4.43 → 0.4.44

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 (48) hide show
  1. package/README.md +65 -0
  2. package/dist/adapters/expo.cjs +4 -4
  3. package/dist/adapters/expo.js +2 -2
  4. package/dist/adapters/indexedDB.cjs +3 -3
  5. package/dist/adapters/indexedDB.js +2 -2
  6. package/dist/{asyncStorageTaskQueue-CjoL-35w.d.ts → asyncStorageTaskQueue-BtSOVZFn.d.ts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-D1FfHfgK.d.cts → asyncStorageTaskQueue-Dap7qUlF.d.cts} +2 -2
  8. package/dist/{chunk-B4R36PRN.js → chunk-FMI2GKYO.js} +1088 -181
  9. package/dist/chunk-FMI2GKYO.js.map +1 -0
  10. package/dist/{chunk-US274KZO.js → chunk-LCQQPOIT.js} +3 -3
  11. package/dist/{chunk-US274KZO.js.map → chunk-LCQQPOIT.js.map} +1 -1
  12. package/dist/{chunk-763XHDAJ.js → chunk-LJ35HPJW.js} +3 -3
  13. package/dist/{chunk-763XHDAJ.js.map → chunk-LJ35HPJW.js.map} +1 -1
  14. package/dist/{chunk-JIWCE2IK.cjs → chunk-RJ6XVCX4.cjs} +7 -7
  15. package/dist/{chunk-JIWCE2IK.cjs.map → chunk-RJ6XVCX4.cjs.map} +1 -1
  16. package/dist/{chunk-3AQNLQPM.cjs → chunk-UBYY2TPK.cjs} +3 -3
  17. package/dist/{chunk-3AQNLQPM.cjs.map → chunk-UBYY2TPK.cjs.map} +1 -1
  18. package/dist/{chunk-VKKLOT2E.js → chunk-V7WIZR2B.js} +3 -3
  19. package/dist/{chunk-VKKLOT2E.js.map → chunk-V7WIZR2B.js.map} +1 -1
  20. package/dist/{chunk-PLJZRIFZ.cjs → chunk-X37EKDIH.cjs} +11 -11
  21. package/dist/{chunk-PLJZRIFZ.cjs.map → chunk-X37EKDIH.cjs.map} +1 -1
  22. package/dist/{chunk-QGNTDGMN.cjs → chunk-XIVCG6EP.cjs} +1163 -253
  23. package/dist/chunk-XIVCG6EP.cjs.map +1 -0
  24. package/dist/index.cjs +138 -126
  25. package/dist/index.d.cts +232 -1
  26. package/dist/index.d.ts +232 -1
  27. package/dist/index.js +2 -2
  28. package/dist/repositories/realm/index.cjs +17 -17
  29. package/dist/repositories/realm/index.js +3 -3
  30. package/dist/repositories/sqlite/index.cjs +16 -16
  31. package/dist/repositories/sqlite/index.js +3 -3
  32. package/dist/{taskRunner-Djlhfgi1.d.ts → taskRunner-Bptw9UMa.d.ts} +1 -1
  33. package/dist/{taskRunner-BSnslNmq.d.cts → taskRunner-CeFxKhSH.d.cts} +1 -1
  34. package/dist/wallet/expo/background.cjs +12 -12
  35. package/dist/wallet/expo/background.d.cts +2 -2
  36. package/dist/wallet/expo/background.d.ts +2 -2
  37. package/dist/wallet/expo/background.js +4 -4
  38. package/dist/wallet/expo/index.cjs +12 -12
  39. package/dist/wallet/expo/index.d.cts +1 -1
  40. package/dist/wallet/expo/index.d.ts +1 -1
  41. package/dist/wallet/expo/index.js +3 -3
  42. package/dist/worker/expo/index.cjs +7 -7
  43. package/dist/worker/expo/index.d.cts +3 -3
  44. package/dist/worker/expo/index.d.ts +3 -3
  45. package/dist/worker/expo/index.js +3 -3
  46. package/package.json +1 -1
  47. package/dist/chunk-B4R36PRN.js.map +0 -1
  48. package/dist/chunk-QGNTDGMN.cjs.map +0 -1
package/README.md CHANGED
@@ -797,6 +797,71 @@ await Unroll.completeUnroll(
797
797
  - The `completeUnroll` method can only be called after all virtual outputs are fully unrolled and the timelock has expired
798
798
  - You need sufficient onchain funds in the `OnchainWallet` to pay for P2A transaction fees
799
799
 
800
+ ### Unilateral Exit Packages (pre-signed)
801
+
802
+ `Unroll.Session` requires the wallet (keys + indexer access) to stay online for the whole
803
+ multi-day exit. `UnilateralExit` removes that requirement: it pre-signs **every** transaction
804
+ needed to unroll a VTXO's offchain transaction chain onchain **and** sweep each matured output
805
+ to an address you solely control, then emits a versioned JSON package that anything with an
806
+ Esplora-compatible endpoint can execute — no keys, no Arkade infrastructure.
807
+
808
+ > **Note:** Unilateral exit handles **BTC value only** and does not represent any assets a
809
+ > VTXO carries — do not pass asset-bearing VTXOs (those with a non-empty `assets` field).
810
+
811
+ The flow is **quote → fund → prepare → execute**:
812
+
813
+ ```typescript
814
+ import { UnilateralExit, OnchainWallet, serializeExitPackage } from '@arkade-os/sdk'
815
+
816
+ const onchainWallet = await OnchainWallet.create(identity, 'mainnet')
817
+
818
+ // 1. Quote: how many txs, how many sats (no funds needed, nothing signed)
819
+ const quote = await UnilateralExit.estimate({
820
+ wallet,
821
+ onchainWallet,
822
+ sweepAddress: 'bc1p...', // where the exited funds land
823
+ // feeRate: 2, // sat/vB — defaults to the provider estimate
824
+ })
825
+ console.log(quote.totals.txCount, quote.totals.fundingRequiredSats, quote.shortfallSats)
826
+
827
+ // 2. Deposit quote.shortfallSats to quote.fundingAddress, wait for confirmation
828
+
829
+ // 3. Prepare: signs everything and broadcasts the fee-funding splitter,
830
+ // reserving the fee budget onchain
831
+ const pkg = await UnilateralExit.prepare({ wallet, onchainWallet, sweepAddress: 'bc1p...' })
832
+ const json = serializeExitPackage(pkg) // hand this to any executor
833
+
834
+ // 4. Execute anywhere — here, or on a machine that has only an Esplora URL
835
+ const executor = new UnilateralExit.Executor(pkg, wallet.onchainProvider)
836
+ for await (const event of executor) {
837
+ console.log(event.stepIndex, event.kind, event.status)
838
+ }
839
+ ```
840
+
841
+ Every exit terminates in a **sweep**. Unrolling only lands a VTXO back onchain still encumbered
842
+ by its Arkade script; the funds become yours unilaterally only once a sweep spends that output
843
+ through the CSV-timelocked exit path to `sweepAddress`. So the package always pairs each exited
844
+ VTXO with a pre-signed sweep, and `totals.recoveredSats` is what arrives at `sweepAddress` after
845
+ the timelocks mature. A VTXO whose sweep cannot be signed — e.g. a contract path that needs
846
+ another party — is dropped from the package rather than left half-exited onchain.
847
+
848
+ Key properties:
849
+
850
+ - **Contract-aware**: exit paths are resolved through the contract handler registry, so
851
+ contract VTXOs (e.g. a VHTLC whose preimage is in the contract params) are pre-signable
852
+ too — paths needing other parties' signatures are skipped with a reason.
853
+ - **Shared ancestors are paid once**: VTXOs under the same commitment share tree
854
+ transactions; the package contains one step (and one fee) per unique transaction.
855
+ - **Idempotent execution**: the executor re-checks the chain before every action, so it can
856
+ be killed, moved, and re-run at any point; already-confirmed steps are skipped.
857
+ - **Per-VTXO isolation**: one sweep per VTXO plus fan-out fee funding means one failed
858
+ branch never blocks the others.
859
+ - **Confidentiality**: packages contain no key material, but sweeps of condition paths embed
860
+ the condition witness (e.g. a VHTLC preimage) — treat the file as confidential until
861
+ broadcast.
862
+ - `validUntil` carries the earliest batch expiry: execute before it, or the operator may
863
+ sweep the expired batch first.
864
+
800
865
  ### Running the wallet in a service worker
801
866
 
802
867
  The SDK provides a `MessageBus` orchestrator that runs inside a service worker
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkPLJZRIFZ_cjs = require('../chunk-PLJZRIFZ.cjs');
4
- require('../chunk-3AQNLQPM.cjs');
3
+ var chunkX37EKDIH_cjs = require('../chunk-X37EKDIH.cjs');
4
+ require('../chunk-UBYY2TPK.cjs');
5
5
  require('../chunk-HXDZ2QTW.cjs');
6
6
  require('../chunk-5BLDMQED.cjs');
7
7
 
@@ -9,11 +9,11 @@ require('../chunk-5BLDMQED.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "ExpoArkProvider", {
11
11
  enumerable: true,
12
- get: function () { return chunkPLJZRIFZ_cjs.ExpoArkProvider; }
12
+ get: function () { return chunkX37EKDIH_cjs.ExpoArkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "ExpoIndexerProvider", {
15
15
  enumerable: true,
16
- get: function () { return chunkPLJZRIFZ_cjs.ExpoIndexerProvider; }
16
+ get: function () { return chunkX37EKDIH_cjs.ExpoIndexerProvider; }
17
17
  });
18
18
  //# sourceMappingURL=expo.cjs.map
19
19
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-VKKLOT2E.js';
2
- import '../chunk-763XHDAJ.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-V7WIZR2B.js';
2
+ import '../chunk-LJ35HPJW.js';
3
3
  import '../chunk-BE5MUB7T.js';
4
4
  import '../chunk-NSBPE2FW.js';
5
5
  //# sourceMappingURL=expo.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQGNTDGMN_cjs = require('../chunk-QGNTDGMN.cjs');
4
- require('../chunk-3AQNLQPM.cjs');
3
+ var chunkXIVCG6EP_cjs = require('../chunk-XIVCG6EP.cjs');
4
+ require('../chunk-UBYY2TPK.cjs');
5
5
  require('../chunk-32YKLQPS.cjs');
6
6
  require('../chunk-HXDZ2QTW.cjs');
7
7
  require('../chunk-5BLDMQED.cjs');
@@ -11,7 +11,7 @@ var IndexedDBStorageAdapter = class {
11
11
  dbName;
12
12
  version;
13
13
  db = null;
14
- constructor(dbName, version = chunkQGNTDGMN_cjs.DB_VERSION) {
14
+ constructor(dbName, version = chunkXIVCG6EP_cjs.DB_VERSION) {
15
15
  this.dbName = dbName;
16
16
  this.version = version;
17
17
  }
@@ -1,5 +1,5 @@
1
- import { DB_VERSION } from '../chunk-B4R36PRN.js';
2
- import '../chunk-763XHDAJ.js';
1
+ import { DB_VERSION } from '../chunk-FMI2GKYO.js';
2
+ import '../chunk-LJ35HPJW.js';
3
3
  import '../chunk-YNEDJTX2.js';
4
4
  import '../chunk-BE5MUB7T.js';
5
5
  import '../chunk-NSBPE2FW.js';
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-Djlhfgi1.js';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-Bptw9UMa.js';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -46,4 +46,4 @@ declare class AsyncStorageTaskQueue implements TaskQueue {
46
46
  private writeList;
47
47
  }
48
48
 
49
- export { AsyncStorageTaskQueue as A, type AsyncStorageLike as a };
49
+ export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-BSnslNmq.cjs';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-CeFxKhSH.cjs';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -46,4 +46,4 @@ declare class AsyncStorageTaskQueue implements TaskQueue {
46
46
  private writeList;
47
47
  }
48
48
 
49
- export { AsyncStorageTaskQueue as A, type AsyncStorageLike as a };
49
+ export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };