@arkade-os/sdk 0.4.46 → 0.4.47

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 (83) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +5 -5
  6. package/dist/adapters/indexedDB.js +4 -4
  7. package/dist/{ark-C9ognsOV.d.cts → ark-CoJgwTi_.d.cts} +26 -2
  8. package/dist/{ark-C9ognsOV.d.ts → ark-CoJgwTi_.d.ts} +26 -2
  9. package/dist/{asyncStorageTaskQueue-CmBYVlxw.d.cts → asyncStorageTaskQueue-Dowyo59a.d.cts} +2 -2
  10. package/dist/{asyncStorageTaskQueue-BAKZ5cS5.d.ts → asyncStorageTaskQueue-Z3aFoXCl.d.ts} +2 -2
  11. package/dist/{chunk-R2SVAM5Q.js → chunk-3N5I6GT6.js} +3 -3
  12. package/dist/{chunk-R2SVAM5Q.js.map → chunk-3N5I6GT6.js.map} +1 -1
  13. package/dist/{chunk-JTCQ6QXQ.js → chunk-AJQ4AOT3.js} +4 -4
  14. package/dist/{chunk-JTCQ6QXQ.js.map → chunk-AJQ4AOT3.js.map} +1 -1
  15. package/dist/{chunk-FWG4TSPN.js → chunk-C7TXXTMS.js} +4 -5
  16. package/dist/chunk-C7TXXTMS.js.map +1 -0
  17. package/dist/{chunk-CWJ7ZCP7.js → chunk-CDDWXBEM.js} +87 -16
  18. package/dist/chunk-CDDWXBEM.js.map +1 -0
  19. package/dist/{chunk-7IYIFMF4.cjs → chunk-HHV5FPC6.cjs} +94 -20
  20. package/dist/chunk-HHV5FPC6.cjs.map +1 -0
  21. package/dist/{chunk-SOXGAA52.cjs → chunk-JAYOXOLT.cjs} +14 -14
  22. package/dist/{chunk-SOXGAA52.cjs.map → chunk-JAYOXOLT.cjs.map} +1 -1
  23. package/dist/{chunk-MQB5H4X5.cjs → chunk-L5ND2FJJ.cjs} +4 -5
  24. package/dist/chunk-L5ND2FJJ.cjs.map +1 -0
  25. package/dist/{chunk-P6VBP3CT.js → chunk-OCS5S3L3.js} +1010 -98
  26. package/dist/chunk-OCS5S3L3.js.map +1 -0
  27. package/dist/chunk-RQSA7ADZ.cjs +2286 -0
  28. package/dist/chunk-RQSA7ADZ.cjs.map +1 -0
  29. package/dist/{chunk-6TQJOD72.cjs → chunk-VE67GMGM.cjs} +7 -7
  30. package/dist/{chunk-6TQJOD72.cjs.map → chunk-VE67GMGM.cjs.map} +1 -1
  31. package/dist/{chunk-D46YDM36.cjs → chunk-WTTLIFS7.cjs} +1207 -285
  32. package/dist/chunk-WTTLIFS7.cjs.map +1 -0
  33. package/dist/chunk-XN3554FT.js +2244 -0
  34. package/dist/chunk-XN3554FT.js.map +1 -0
  35. package/dist/contracts/handlers/index.cjs +11 -7
  36. package/dist/contracts/handlers/index.d.cts +3 -3
  37. package/dist/contracts/handlers/index.d.ts +3 -3
  38. package/dist/contracts/handlers/index.js +2 -2
  39. package/dist/{delegate-aOd5qINr.d.ts → delegate-CuaDqqQi.d.ts} +1 -1
  40. package/dist/{delegate-DVEgyRwI.d.cts → delegate-Dl87_zMA.d.cts} +1 -1
  41. package/dist/index-BC_G0VTh.d.cts +512 -0
  42. package/dist/index-CKwpZEpw.d.ts +512 -0
  43. package/dist/index.cjs +213 -161
  44. package/dist/index.d.cts +3097 -2090
  45. package/dist/index.d.ts +3097 -2090
  46. package/dist/index.js +4 -4
  47. package/dist/repositories/realm/index.cjs +19 -19
  48. package/dist/repositories/realm/index.d.cts +2 -2
  49. package/dist/repositories/realm/index.d.ts +2 -2
  50. package/dist/repositories/realm/index.js +5 -5
  51. package/dist/repositories/sqlite/index.cjs +18 -18
  52. package/dist/repositories/sqlite/index.d.cts +2 -2
  53. package/dist/repositories/sqlite/index.d.ts +2 -2
  54. package/dist/repositories/sqlite/index.js +5 -5
  55. package/dist/{taskRunner-B48-V-Pb.d.ts → taskRunner-Dz-TI4Rb.d.ts} +2 -2
  56. package/dist/{taskRunner-nNecmQ2C.d.cts → taskRunner-Dz47k0lp.d.cts} +2 -2
  57. package/dist/wallet/expo/background.cjs +14 -14
  58. package/dist/wallet/expo/background.d.cts +3 -3
  59. package/dist/wallet/expo/background.d.ts +3 -3
  60. package/dist/wallet/expo/background.js +6 -6
  61. package/dist/wallet/expo/index.cjs +14 -14
  62. package/dist/wallet/expo/index.d.cts +4 -4
  63. package/dist/wallet/expo/index.d.ts +4 -4
  64. package/dist/wallet/expo/index.js +5 -5
  65. package/dist/{wallet-BUg3D4WJ.d.cts → wallet-Oxz_wLxo.d.cts} +13 -3
  66. package/dist/{wallet-DM0oShTu.d.ts → wallet-x7egmXq6.d.ts} +13 -3
  67. package/dist/worker/expo/index.cjs +9 -9
  68. package/dist/worker/expo/index.d.cts +4 -4
  69. package/dist/worker/expo/index.d.ts +4 -4
  70. package/dist/worker/expo/index.js +5 -5
  71. package/package.json +1 -1
  72. package/dist/chunk-4KXOCVXP.cjs +0 -973
  73. package/dist/chunk-4KXOCVXP.cjs.map +0 -1
  74. package/dist/chunk-7IYIFMF4.cjs.map +0 -1
  75. package/dist/chunk-CWJ7ZCP7.js.map +0 -1
  76. package/dist/chunk-D46YDM36.cjs.map +0 -1
  77. package/dist/chunk-FWG4TSPN.js.map +0 -1
  78. package/dist/chunk-MQB5H4X5.cjs.map +0 -1
  79. package/dist/chunk-P6VBP3CT.js.map +0 -1
  80. package/dist/chunk-QKC2T54O.js +0 -960
  81. package/dist/chunk-QKC2T54O.js.map +0 -1
  82. package/dist/index-CPzL4tqg.d.ts +0 -259
  83. package/dist/index-D8vmtWWO.d.cts +0 -259
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunkSOXGAA52_cjs = require('../chunk-SOXGAA52.cjs');
4
- require('../chunk-7IYIFMF4.cjs');
5
- require('../chunk-MQB5H4X5.cjs');
3
+ var chunkJAYOXOLT_cjs = require('../chunk-JAYOXOLT.cjs');
4
+ require('../chunk-HHV5FPC6.cjs');
5
+ require('../chunk-L5ND2FJJ.cjs');
6
6
  require('../chunk-5BLDMQED.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "ExpoArkProvider", {
11
11
  enumerable: true,
12
- get: function () { return chunkSOXGAA52_cjs.ExpoArkProvider; }
12
+ get: function () { return chunkJAYOXOLT_cjs.ExpoArkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "ExpoIndexerProvider", {
15
15
  enumerable: true,
16
- get: function () { return chunkSOXGAA52_cjs.ExpoIndexerProvider; }
16
+ get: function () { return chunkJAYOXOLT_cjs.ExpoIndexerProvider; }
17
17
  });
18
18
  //# sourceMappingURL=expo.cjs.map
19
19
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { l as RestArkProvider, j as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../ark-C9ognsOV.cjs';
2
- export { o as ArkProvider, p as IndexerProvider } from '../ark-C9ognsOV.cjs';
1
+ import { l as RestArkProvider, j as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../ark-CoJgwTi_.cjs';
2
+ export { o as ArkProvider, p as IndexerProvider } from '../ark-CoJgwTi_.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';
@@ -1,5 +1,5 @@
1
- import { l as RestArkProvider, j as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../ark-C9ognsOV.js';
2
- export { o as ArkProvider, p as IndexerProvider } from '../ark-C9ognsOV.js';
1
+ import { l as RestArkProvider, j as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../ark-CoJgwTi_.js';
2
+ export { o as ArkProvider, p as IndexerProvider } from '../ark-CoJgwTi_.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';
@@ -1,6 +1,6 @@
1
- export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-JTCQ6QXQ.js';
2
- import '../chunk-CWJ7ZCP7.js';
3
- import '../chunk-FWG4TSPN.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-AJQ4AOT3.js';
2
+ import '../chunk-CDDWXBEM.js';
3
+ import '../chunk-C7TXXTMS.js';
4
4
  import '../chunk-NSBPE2FW.js';
5
5
  //# sourceMappingURL=expo.js.map
6
6
  //# sourceMappingURL=expo.js.map
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkD46YDM36_cjs = require('../chunk-D46YDM36.cjs');
4
- require('../chunk-7IYIFMF4.cjs');
5
- require('../chunk-4KXOCVXP.cjs');
6
- require('../chunk-MQB5H4X5.cjs');
3
+ var chunkWTTLIFS7_cjs = require('../chunk-WTTLIFS7.cjs');
4
+ require('../chunk-HHV5FPC6.cjs');
5
+ require('../chunk-RQSA7ADZ.cjs');
6
+ require('../chunk-L5ND2FJJ.cjs');
7
7
  require('../chunk-5BLDMQED.cjs');
8
8
 
9
9
  // src/storage/indexedDB.ts
@@ -11,7 +11,7 @@ var IndexedDBStorageAdapter = class {
11
11
  dbName;
12
12
  version;
13
13
  db = null;
14
- constructor(dbName, version = chunkD46YDM36_cjs.DB_VERSION) {
14
+ constructor(dbName, version = chunkWTTLIFS7_cjs.DB_VERSION) {
15
15
  this.dbName = dbName;
16
16
  this.version = version;
17
17
  }
@@ -1,7 +1,7 @@
1
- import { DB_VERSION } from '../chunk-P6VBP3CT.js';
2
- import '../chunk-CWJ7ZCP7.js';
3
- import '../chunk-QKC2T54O.js';
4
- import '../chunk-FWG4TSPN.js';
1
+ import { DB_VERSION } from '../chunk-OCS5S3L3.js';
2
+ import '../chunk-CDDWXBEM.js';
3
+ import '../chunk-XN3554FT.js';
4
+ import '../chunk-C7TXXTMS.js';
5
5
  import '../chunk-NSBPE2FW.js';
6
6
 
7
7
  // src/storage/indexedDB.ts
@@ -442,6 +442,7 @@ declare class VtxoScript {
442
442
  readonly scripts: Bytes[];
443
443
  readonly leaves: TapLeafScript[];
444
444
  readonly tweakedPublicKey: Bytes;
445
+ readonly pkScript: Bytes;
445
446
  /**
446
447
  * Decode a virtual output script from an encoded TapTree.
447
448
  *
@@ -480,7 +481,6 @@ declare class VtxoScript {
480
481
  * @see ArkAddress
481
482
  */
482
483
  address(prefix: string | undefined, serverPubKey: Bytes): ArkAddress;
483
- get pkScript(): Bytes;
484
484
  /**
485
485
  * Build the Taproot onchain address corresponding to this virtual output script.
486
486
  *
@@ -2634,6 +2634,26 @@ interface Discoverable {
2634
2634
  }
2635
2635
  /** Duck-typed guard (mirrors `hasReceiveRotatorFactory`). */
2636
2636
  declare function isDiscoverable(handler: ContractHandler<unknown> | undefined): handler is ContractHandler<unknown> & Discoverable;
2637
+ /**
2638
+ * The per-contract tapscript annotation stamped onto every VTXO locked to a
2639
+ * contract (see `extendVirtualCoinForContract`): the leaf used to co-sign
2640
+ * forfeits, the leaf committed in intent proofs, and the encoded taproot tree.
2641
+ */
2642
+ interface DerivedContractTapscripts {
2643
+ forfeitTapLeafScript: TapLeafScript;
2644
+ intentTapLeafScript: TapLeafScript;
2645
+ tapTree: Bytes;
2646
+ }
2647
+ /**
2648
+ * Optional capability a {@link ContractHandler} implements to provide the
2649
+ * forfeit/intent tapscripts for VTXO annotation. Handlers whose script shape
2650
+ * doesn't expose the legacy `forfeit()` method (e.g. program-compiled arkade
2651
+ * contracts, where the right leaf depends on the program) implement this so
2652
+ * the annotation pipeline stays type-agnostic.
2653
+ */
2654
+ interface TapscriptDeriving<S extends VtxoScript = VtxoScript> {
2655
+ deriveTapscripts(script: S, contract: Contract): DerivedContractTapscripts;
2656
+ }
2637
2657
  /**
2638
2658
  * Event emitted when contract-related changes occur.
2639
2659
  */
@@ -3546,6 +3566,10 @@ interface Recipient {
3546
3566
  amount?: number;
3547
3567
  /** Assets to send to the same recipient (`assetId` & `amount`) */
3548
3568
  assets?: Asset[];
3569
+ extensions?: Array<{
3570
+ type: number;
3571
+ payload: Uint8Array;
3572
+ }>;
3549
3573
  }
3550
3574
  /**
3551
3575
  * Known asset metadata fields.
@@ -4786,4 +4810,4 @@ declare namespace ProtoTypes {
4786
4810
  export { };
4787
4811
  }
4788
4812
 
4789
- export { type Network as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedVirtualCoin as E, type VtxoBranch as F, type GetVtxosFilter as G, ChainedTxType as H, type IWallet as I, type BatchStartedEvent as J, type TreeSigningStartedEvent as K, TxTree as L, type TreeNoncesEvent as M, type BatchFinalizationEvent as N, type Outpoint as O, type BatchFinalizedEvent as P, type BatchFailedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type TreeTxEvent as U, VtxoScript as V, type WalletRepository as W, type TreeSignatureEvent as X, type DescriptorProvider as Y, type IReadonlyWallet as Z, type ReadonlyIdentity as _, type Identity as a, ConditionCSVMultisigTapscript as a$, type OnchainProvider as a0, type DelegateProvider as a1, type ReadonlyWalletConfig as a2, type ExitCaptureMode as a3, type ExitDataSource as a4, type IReadonlyAssetManager as a5, type ContractSyncState as a6, type NetworkName as a7, type ArkInfo as a8, ArkAddress as a9, type PathSelection as aA, type ContractEvent as aB, type AssetDetails as aC, type IssuanceResult as aD, type DelegateInfo as aE, type MigrationGlobalSkipReason as aF, type MigrationLegSkipReason as aG, type SignerStatus as aH, type StorageConfig as aI, type IVtxoManager as aJ, type ExplorerTransaction as aK, type EncodedVtxoScript as aL, type Status as aM, type ChainTx as aN, type PathContext as aO, type ActivityIntent as aP, type ActivityResolver as aQ, type ArkIntentState as aR, type ArkTapscript as aS, type Asset as aT, type AssetMetadata as aU, type BaseWalletConfig as aV, type BatchInfo as aW, type BatchSignableIdentity as aX, CLTVMultisigTapscript as aY, ChainTxType as aZ, type CommitmentTx as a_, type Coin as aa, ContractManager as ab, CSVMultisigTapscript as ac, type SettlementConfig as ad, VtxoManager as ae, type SignerSession as af, type SignedIntent as ag, Intent as ah, type DescriptorSigningRequest as ai, Transaction as aj, type IntentFeeConfig as ak, type OffchainInput as al, FeeAmount as am, type OnchainInput as an, type FeeOutput as ao, type ContractWatcherConfig as ap, type FeeInfo as aq, type CreateContractParams as ar, type GetContractsFilter as as, type GetSpendablePathsOptions as at, type GetAllSpendingPathsOptions as au, type IssuanceParams as av, type ReissuanceParams as aw, type BurnParams as ax, type RenewVtxosOptions as ay, type ContractWithVtxos as az, type WalletConfig as b, type WalletMode as b$, ConditionMultisigTapscript as b0, type ContractBalance as b1, type ContractEventCallback as b2, type ContractHandler as b3, type ContractManagerConfig as b4, type ContractState as b5, type ContractVtxo as b6, ContractWatcher as b7, DelegateManagerImpl as b8, type DelegateOptions as b9, PartialSig as bA, type ProviderClass as bB, RestDelegateProvider as bC, RestDelegatorProvider as bD, type ScanContractsOptions as bE, type ScanResult as bF, type ScheduledSession as bG, SettlementEventType as bH, type SignRequest as bI, type SignerClassification as bJ, type SignerSet as bK, type SubscriptionEvent as bL, type SubscriptionHeartbeat as bM, type TapLeaves as bN, TapTreeCoder as bO, TapscriptType as bP, type TreeNonces as bQ, type TreePartialSigs as bR, type Tx as bS, type TxHistoryRecord as bT, type TxKey as bU, type TxTreeNode as bV, TxType as bW, type VirtualStatus as bX, type Vtxo as bY, type VtxoChain as bZ, type VtxoType as b_, DelegatorManagerImpl as ba, type DelegatorProvider as bb, type DeprecatedSignerMigrationReport as bc, type DeprecatedSignerReport as bd, DigestMismatchError as be, type Discoverable as bf, type DiscoveredContract as bg, type DiscoveryDeps as bh, ESPLORA_URL as bi, EsploraProvider as bj, type ExitChainResolver as bk, type ExtendedContractVtxo as bl, type GroupMembership as bm, type HandlerError as bn, type IDelegatorManager as bo, INTENT_TERMINAL_STATES as bp, IndexerTxType as bq, type KnownMetadata as br, type MigrateDeprecatedSignerOptions as bs, type MigrationLegReport as bt, type MigrationVtxoRef as bu, MultisigTapscript as bv, type Nonces as bw, type Output as bx, type PageResponse as by, type PaginationOptions as bz, type WalletBalance as c, boardingResolver as c0, classifyAgainstSignerSet as c1, classifyContractSigner as c2, createDefaultActivityRegistry as c3, createExitChainResolver as c4, decodeTapscript as c5, getNetwork as c6, getSequence as c7, isBatchSignable as c8, isCooperativelyMigratable as c9, isDiscoverable as ca, isExpired as cb, isRecoverable as cc, isSpendable as cd, isSubdust as ce, isTerminalIntentState as cf, isVtxoExpiringSoon as cg, networks as ch, signerSetFromInfo as ci, toXOnlySignerHex as cj, type ExtendedCoin as d, ActivityRegistry as e, type Activity as f, type IContractManager as g, type IDelegateManager as h, type SettleParams as i, type SettlementEvent as j, type IAssetManager as k, RestArkProvider as l, RestIndexerProvider as m, type SubscriptionResponse as n, type ArkProvider as o, type IndexerProvider as p, type RelativeTimelock as q, type TapLeafScript as r, type VirtualCoin as s, type Contract as t, type VtxoRepositoryKey as u, type WalletState as v, type ContractFilter as w, type IntentRepository as x, type ArkIntent as y, type IntentFilter as z };
4813
+ export { type Network as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedVirtualCoin as E, type VtxoBranch as F, type GetVtxosFilter as G, ChainedTxType as H, type IWallet as I, type BatchStartedEvent as J, type TreeSigningStartedEvent as K, TxTree as L, type TreeNoncesEvent as M, type BatchFinalizationEvent as N, type Outpoint as O, type BatchFinalizedEvent as P, type BatchFailedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type TreeTxEvent as U, VtxoScript as V, type WalletRepository as W, type TreeSignatureEvent as X, type DescriptorProvider as Y, type IReadonlyWallet as Z, type ReadonlyIdentity as _, type Identity as a, ConditionCSVMultisigTapscript as a$, type OnchainProvider as a0, type DelegateProvider as a1, type ReadonlyWalletConfig as a2, type ExitCaptureMode as a3, type ExitDataSource as a4, type IReadonlyAssetManager as a5, type ContractSyncState as a6, type NetworkName as a7, type ArkInfo as a8, ArkAddress as a9, type ContractWithVtxos as aA, type PathSelection as aB, type ContractEvent as aC, type AssetDetails as aD, type IssuanceResult as aE, type DelegateInfo as aF, type MigrationGlobalSkipReason as aG, type MigrationLegSkipReason as aH, type SignerStatus as aI, type StorageConfig as aJ, type IVtxoManager as aK, type ExplorerTransaction as aL, type EncodedVtxoScript as aM, type Status as aN, type ChainTx as aO, type PathContext as aP, type ActivityIntent as aQ, type ActivityResolver as aR, type ArkIntentState as aS, type ArkTapscript as aT, type AssetMetadata as aU, type BaseWalletConfig as aV, type BatchInfo as aW, type BatchSignableIdentity as aX, CLTVMultisigTapscript as aY, ChainTxType as aZ, type CommitmentTx as a_, type Coin as aa, ContractManager as ab, CSVMultisigTapscript as ac, type SettlementConfig as ad, VtxoManager as ae, type SignerSession as af, type SignedIntent as ag, Intent as ah, type DescriptorSigningRequest as ai, Transaction as aj, type IntentFeeConfig as ak, type OffchainInput as al, FeeAmount as am, type OnchainInput as an, type FeeOutput as ao, type ContractWatcherConfig as ap, type Asset as aq, type FeeInfo as ar, type CreateContractParams as as, type GetContractsFilter as at, type GetSpendablePathsOptions as au, type GetAllSpendingPathsOptions as av, type IssuanceParams as aw, type ReissuanceParams as ax, type BurnParams as ay, type RenewVtxosOptions as az, type WalletConfig as b, type WalletMode as b$, ConditionMultisigTapscript as b0, type ContractBalance as b1, type ContractEventCallback as b2, type ContractHandler as b3, type ContractManagerConfig as b4, type ContractState as b5, type ContractVtxo as b6, ContractWatcher as b7, DelegateManagerImpl as b8, type DelegateOptions as b9, PartialSig as bA, type ProviderClass as bB, RestDelegateProvider as bC, RestDelegatorProvider as bD, type ScanContractsOptions as bE, type ScanResult as bF, type ScheduledSession as bG, SettlementEventType as bH, type SignRequest as bI, type SignerClassification as bJ, type SignerSet as bK, type SubscriptionEvent as bL, type SubscriptionHeartbeat as bM, type TapLeaves as bN, TapTreeCoder as bO, TapscriptType as bP, type TreeNonces as bQ, type TreePartialSigs as bR, type Tx as bS, type TxHistoryRecord as bT, type TxKey as bU, type TxTreeNode as bV, TxType as bW, type VirtualStatus as bX, type Vtxo as bY, type VtxoChain as bZ, type VtxoType as b_, DelegatorManagerImpl as ba, type DelegatorProvider as bb, type DeprecatedSignerMigrationReport as bc, type DeprecatedSignerReport as bd, DigestMismatchError as be, type Discoverable as bf, type DiscoveredContract as bg, type DiscoveryDeps as bh, ESPLORA_URL as bi, EsploraProvider as bj, type ExitChainResolver as bk, type ExtendedContractVtxo as bl, type GroupMembership as bm, type HandlerError as bn, type IDelegatorManager as bo, INTENT_TERMINAL_STATES as bp, IndexerTxType as bq, type KnownMetadata as br, type MigrateDeprecatedSignerOptions as bs, type MigrationLegReport as bt, type MigrationVtxoRef as bu, MultisigTapscript as bv, type Nonces as bw, type Output as bx, type PageResponse as by, type PaginationOptions as bz, type WalletBalance as c, boardingResolver as c0, classifyAgainstSignerSet as c1, classifyContractSigner as c2, createDefaultActivityRegistry as c3, createExitChainResolver as c4, decodeTapscript as c5, getNetwork as c6, getSequence as c7, isBatchSignable as c8, isCooperativelyMigratable as c9, isDiscoverable as ca, isExpired as cb, isRecoverable as cc, isSpendable as cd, isSubdust as ce, isTerminalIntentState as cf, isVtxoExpiringSoon as cg, networks as ch, signerSetFromInfo as ci, toXOnlySignerHex as cj, type TapscriptDeriving as ck, type ExtendedCoin as d, ActivityRegistry as e, type Activity as f, type IContractManager as g, type IDelegateManager as h, type SettleParams as i, type SettlementEvent as j, type IAssetManager as k, RestArkProvider as l, RestIndexerProvider as m, type SubscriptionResponse as n, type ArkProvider as o, type IndexerProvider as p, type RelativeTimelock as q, type TapLeafScript as r, type VirtualCoin as s, type Contract as t, type VtxoRepositoryKey as u, type WalletState as v, type ContractFilter as w, type IntentRepository as x, type ArkIntent as y, type IntentFilter as z };
@@ -442,6 +442,7 @@ declare class VtxoScript {
442
442
  readonly scripts: Bytes[];
443
443
  readonly leaves: TapLeafScript[];
444
444
  readonly tweakedPublicKey: Bytes;
445
+ readonly pkScript: Bytes;
445
446
  /**
446
447
  * Decode a virtual output script from an encoded TapTree.
447
448
  *
@@ -480,7 +481,6 @@ declare class VtxoScript {
480
481
  * @see ArkAddress
481
482
  */
482
483
  address(prefix: string | undefined, serverPubKey: Bytes): ArkAddress;
483
- get pkScript(): Bytes;
484
484
  /**
485
485
  * Build the Taproot onchain address corresponding to this virtual output script.
486
486
  *
@@ -2634,6 +2634,26 @@ interface Discoverable {
2634
2634
  }
2635
2635
  /** Duck-typed guard (mirrors `hasReceiveRotatorFactory`). */
2636
2636
  declare function isDiscoverable(handler: ContractHandler<unknown> | undefined): handler is ContractHandler<unknown> & Discoverable;
2637
+ /**
2638
+ * The per-contract tapscript annotation stamped onto every VTXO locked to a
2639
+ * contract (see `extendVirtualCoinForContract`): the leaf used to co-sign
2640
+ * forfeits, the leaf committed in intent proofs, and the encoded taproot tree.
2641
+ */
2642
+ interface DerivedContractTapscripts {
2643
+ forfeitTapLeafScript: TapLeafScript;
2644
+ intentTapLeafScript: TapLeafScript;
2645
+ tapTree: Bytes;
2646
+ }
2647
+ /**
2648
+ * Optional capability a {@link ContractHandler} implements to provide the
2649
+ * forfeit/intent tapscripts for VTXO annotation. Handlers whose script shape
2650
+ * doesn't expose the legacy `forfeit()` method (e.g. program-compiled arkade
2651
+ * contracts, where the right leaf depends on the program) implement this so
2652
+ * the annotation pipeline stays type-agnostic.
2653
+ */
2654
+ interface TapscriptDeriving<S extends VtxoScript = VtxoScript> {
2655
+ deriveTapscripts(script: S, contract: Contract): DerivedContractTapscripts;
2656
+ }
2637
2657
  /**
2638
2658
  * Event emitted when contract-related changes occur.
2639
2659
  */
@@ -3546,6 +3566,10 @@ interface Recipient {
3546
3566
  amount?: number;
3547
3567
  /** Assets to send to the same recipient (`assetId` & `amount`) */
3548
3568
  assets?: Asset[];
3569
+ extensions?: Array<{
3570
+ type: number;
3571
+ payload: Uint8Array;
3572
+ }>;
3549
3573
  }
3550
3574
  /**
3551
3575
  * Known asset metadata fields.
@@ -4786,4 +4810,4 @@ declare namespace ProtoTypes {
4786
4810
  export { };
4787
4811
  }
4788
4812
 
4789
- export { type Network as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedVirtualCoin as E, type VtxoBranch as F, type GetVtxosFilter as G, ChainedTxType as H, type IWallet as I, type BatchStartedEvent as J, type TreeSigningStartedEvent as K, TxTree as L, type TreeNoncesEvent as M, type BatchFinalizationEvent as N, type Outpoint as O, type BatchFinalizedEvent as P, type BatchFailedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type TreeTxEvent as U, VtxoScript as V, type WalletRepository as W, type TreeSignatureEvent as X, type DescriptorProvider as Y, type IReadonlyWallet as Z, type ReadonlyIdentity as _, type Identity as a, ConditionCSVMultisigTapscript as a$, type OnchainProvider as a0, type DelegateProvider as a1, type ReadonlyWalletConfig as a2, type ExitCaptureMode as a3, type ExitDataSource as a4, type IReadonlyAssetManager as a5, type ContractSyncState as a6, type NetworkName as a7, type ArkInfo as a8, ArkAddress as a9, type PathSelection as aA, type ContractEvent as aB, type AssetDetails as aC, type IssuanceResult as aD, type DelegateInfo as aE, type MigrationGlobalSkipReason as aF, type MigrationLegSkipReason as aG, type SignerStatus as aH, type StorageConfig as aI, type IVtxoManager as aJ, type ExplorerTransaction as aK, type EncodedVtxoScript as aL, type Status as aM, type ChainTx as aN, type PathContext as aO, type ActivityIntent as aP, type ActivityResolver as aQ, type ArkIntentState as aR, type ArkTapscript as aS, type Asset as aT, type AssetMetadata as aU, type BaseWalletConfig as aV, type BatchInfo as aW, type BatchSignableIdentity as aX, CLTVMultisigTapscript as aY, ChainTxType as aZ, type CommitmentTx as a_, type Coin as aa, ContractManager as ab, CSVMultisigTapscript as ac, type SettlementConfig as ad, VtxoManager as ae, type SignerSession as af, type SignedIntent as ag, Intent as ah, type DescriptorSigningRequest as ai, Transaction as aj, type IntentFeeConfig as ak, type OffchainInput as al, FeeAmount as am, type OnchainInput as an, type FeeOutput as ao, type ContractWatcherConfig as ap, type FeeInfo as aq, type CreateContractParams as ar, type GetContractsFilter as as, type GetSpendablePathsOptions as at, type GetAllSpendingPathsOptions as au, type IssuanceParams as av, type ReissuanceParams as aw, type BurnParams as ax, type RenewVtxosOptions as ay, type ContractWithVtxos as az, type WalletConfig as b, type WalletMode as b$, ConditionMultisigTapscript as b0, type ContractBalance as b1, type ContractEventCallback as b2, type ContractHandler as b3, type ContractManagerConfig as b4, type ContractState as b5, type ContractVtxo as b6, ContractWatcher as b7, DelegateManagerImpl as b8, type DelegateOptions as b9, PartialSig as bA, type ProviderClass as bB, RestDelegateProvider as bC, RestDelegatorProvider as bD, type ScanContractsOptions as bE, type ScanResult as bF, type ScheduledSession as bG, SettlementEventType as bH, type SignRequest as bI, type SignerClassification as bJ, type SignerSet as bK, type SubscriptionEvent as bL, type SubscriptionHeartbeat as bM, type TapLeaves as bN, TapTreeCoder as bO, TapscriptType as bP, type TreeNonces as bQ, type TreePartialSigs as bR, type Tx as bS, type TxHistoryRecord as bT, type TxKey as bU, type TxTreeNode as bV, TxType as bW, type VirtualStatus as bX, type Vtxo as bY, type VtxoChain as bZ, type VtxoType as b_, DelegatorManagerImpl as ba, type DelegatorProvider as bb, type DeprecatedSignerMigrationReport as bc, type DeprecatedSignerReport as bd, DigestMismatchError as be, type Discoverable as bf, type DiscoveredContract as bg, type DiscoveryDeps as bh, ESPLORA_URL as bi, EsploraProvider as bj, type ExitChainResolver as bk, type ExtendedContractVtxo as bl, type GroupMembership as bm, type HandlerError as bn, type IDelegatorManager as bo, INTENT_TERMINAL_STATES as bp, IndexerTxType as bq, type KnownMetadata as br, type MigrateDeprecatedSignerOptions as bs, type MigrationLegReport as bt, type MigrationVtxoRef as bu, MultisigTapscript as bv, type Nonces as bw, type Output as bx, type PageResponse as by, type PaginationOptions as bz, type WalletBalance as c, boardingResolver as c0, classifyAgainstSignerSet as c1, classifyContractSigner as c2, createDefaultActivityRegistry as c3, createExitChainResolver as c4, decodeTapscript as c5, getNetwork as c6, getSequence as c7, isBatchSignable as c8, isCooperativelyMigratable as c9, isDiscoverable as ca, isExpired as cb, isRecoverable as cc, isSpendable as cd, isSubdust as ce, isTerminalIntentState as cf, isVtxoExpiringSoon as cg, networks as ch, signerSetFromInfo as ci, toXOnlySignerHex as cj, type ExtendedCoin as d, ActivityRegistry as e, type Activity as f, type IContractManager as g, type IDelegateManager as h, type SettleParams as i, type SettlementEvent as j, type IAssetManager as k, RestArkProvider as l, RestIndexerProvider as m, type SubscriptionResponse as n, type ArkProvider as o, type IndexerProvider as p, type RelativeTimelock as q, type TapLeafScript as r, type VirtualCoin as s, type Contract as t, type VtxoRepositoryKey as u, type WalletState as v, type ContractFilter as w, type IntentRepository as x, type ArkIntent as y, type IntentFilter as z };
4813
+ export { type Network as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedVirtualCoin as E, type VtxoBranch as F, type GetVtxosFilter as G, ChainedTxType as H, type IWallet as I, type BatchStartedEvent as J, type TreeSigningStartedEvent as K, TxTree as L, type TreeNoncesEvent as M, type BatchFinalizationEvent as N, type Outpoint as O, type BatchFinalizedEvent as P, type BatchFailedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type TreeTxEvent as U, VtxoScript as V, type WalletRepository as W, type TreeSignatureEvent as X, type DescriptorProvider as Y, type IReadonlyWallet as Z, type ReadonlyIdentity as _, type Identity as a, ConditionCSVMultisigTapscript as a$, type OnchainProvider as a0, type DelegateProvider as a1, type ReadonlyWalletConfig as a2, type ExitCaptureMode as a3, type ExitDataSource as a4, type IReadonlyAssetManager as a5, type ContractSyncState as a6, type NetworkName as a7, type ArkInfo as a8, ArkAddress as a9, type ContractWithVtxos as aA, type PathSelection as aB, type ContractEvent as aC, type AssetDetails as aD, type IssuanceResult as aE, type DelegateInfo as aF, type MigrationGlobalSkipReason as aG, type MigrationLegSkipReason as aH, type SignerStatus as aI, type StorageConfig as aJ, type IVtxoManager as aK, type ExplorerTransaction as aL, type EncodedVtxoScript as aM, type Status as aN, type ChainTx as aO, type PathContext as aP, type ActivityIntent as aQ, type ActivityResolver as aR, type ArkIntentState as aS, type ArkTapscript as aT, type AssetMetadata as aU, type BaseWalletConfig as aV, type BatchInfo as aW, type BatchSignableIdentity as aX, CLTVMultisigTapscript as aY, ChainTxType as aZ, type CommitmentTx as a_, type Coin as aa, ContractManager as ab, CSVMultisigTapscript as ac, type SettlementConfig as ad, VtxoManager as ae, type SignerSession as af, type SignedIntent as ag, Intent as ah, type DescriptorSigningRequest as ai, Transaction as aj, type IntentFeeConfig as ak, type OffchainInput as al, FeeAmount as am, type OnchainInput as an, type FeeOutput as ao, type ContractWatcherConfig as ap, type Asset as aq, type FeeInfo as ar, type CreateContractParams as as, type GetContractsFilter as at, type GetSpendablePathsOptions as au, type GetAllSpendingPathsOptions as av, type IssuanceParams as aw, type ReissuanceParams as ax, type BurnParams as ay, type RenewVtxosOptions as az, type WalletConfig as b, type WalletMode as b$, ConditionMultisigTapscript as b0, type ContractBalance as b1, type ContractEventCallback as b2, type ContractHandler as b3, type ContractManagerConfig as b4, type ContractState as b5, type ContractVtxo as b6, ContractWatcher as b7, DelegateManagerImpl as b8, type DelegateOptions as b9, PartialSig as bA, type ProviderClass as bB, RestDelegateProvider as bC, RestDelegatorProvider as bD, type ScanContractsOptions as bE, type ScanResult as bF, type ScheduledSession as bG, SettlementEventType as bH, type SignRequest as bI, type SignerClassification as bJ, type SignerSet as bK, type SubscriptionEvent as bL, type SubscriptionHeartbeat as bM, type TapLeaves as bN, TapTreeCoder as bO, TapscriptType as bP, type TreeNonces as bQ, type TreePartialSigs as bR, type Tx as bS, type TxHistoryRecord as bT, type TxKey as bU, type TxTreeNode as bV, TxType as bW, type VirtualStatus as bX, type Vtxo as bY, type VtxoChain as bZ, type VtxoType as b_, DelegatorManagerImpl as ba, type DelegatorProvider as bb, type DeprecatedSignerMigrationReport as bc, type DeprecatedSignerReport as bd, DigestMismatchError as be, type Discoverable as bf, type DiscoveredContract as bg, type DiscoveryDeps as bh, ESPLORA_URL as bi, EsploraProvider as bj, type ExitChainResolver as bk, type ExtendedContractVtxo as bl, type GroupMembership as bm, type HandlerError as bn, type IDelegatorManager as bo, INTENT_TERMINAL_STATES as bp, IndexerTxType as bq, type KnownMetadata as br, type MigrateDeprecatedSignerOptions as bs, type MigrationLegReport as bt, type MigrationVtxoRef as bu, MultisigTapscript as bv, type Nonces as bw, type Output as bx, type PageResponse as by, type PaginationOptions as bz, type WalletBalance as c, boardingResolver as c0, classifyAgainstSignerSet as c1, classifyContractSigner as c2, createDefaultActivityRegistry as c3, createExitChainResolver as c4, decodeTapscript as c5, getNetwork as c6, getSequence as c7, isBatchSignable as c8, isCooperativelyMigratable as c9, isDiscoverable as ca, isExpired as cb, isRecoverable as cc, isSpendable as cd, isSubdust as ce, isTerminalIntentState as cf, isVtxoExpiringSoon as cg, networks as ch, signerSetFromInfo as ci, toXOnlySignerHex as cj, type TapscriptDeriving as ck, type ExtendedCoin as d, ActivityRegistry as e, type Activity as f, type IContractManager as g, type IDelegateManager as h, type SettleParams as i, type SettlementEvent as j, type IAssetManager as k, RestArkProvider as l, RestIndexerProvider as m, type SubscriptionResponse as n, type ArkProvider as o, type IndexerProvider as p, type RelativeTimelock as q, type TapLeafScript as r, type VirtualCoin as s, type Contract as t, type VtxoRepositoryKey as u, type WalletState as v, type ContractFilter as w, type IntentRepository as x, type ArkIntent as y, type IntentFilter as z };
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-nNecmQ2C.cjs';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-Dz47k0lp.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 };
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-B48-V-Pb.js';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-Dz-TI4Rb.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 { getRandomId, extendVirtualCoinForContract, warnAndFilterVtxosForScript, saveVtxosForContract } from './chunk-P6VBP3CT.js';
1
+ import { getRandomId, extendVirtualCoinForContract, warnAndFilterVtxosForScript, saveVtxosForContract } from './chunk-OCS5S3L3.js';
2
2
 
3
3
  // src/worker/expo/taskRunner.ts
4
4
  async function runTasks(queue, processors, deps) {
@@ -91,5 +91,5 @@ var contractPollProcessor = {
91
91
  };
92
92
 
93
93
  export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks };
94
- //# sourceMappingURL=chunk-R2SVAM5Q.js.map
95
- //# sourceMappingURL=chunk-R2SVAM5Q.js.map
94
+ //# sourceMappingURL=chunk-3N5I6GT6.js.map
95
+ //# sourceMappingURL=chunk-3N5I6GT6.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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AAc,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-R2SVAM5Q.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 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":[],"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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,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-3N5I6GT6.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 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,5 +1,5 @@
1
- import { RestArkProvider, isFetchTimeoutError, RestIndexerProvider, buildVersion, sdkVersion, fetch } from './chunk-CWJ7ZCP7.js';
2
- import { DEFAULT_ARKADE_SERVER_URL } from './chunk-FWG4TSPN.js';
1
+ import { RestArkProvider, isFetchTimeoutError, RestIndexerProvider, buildVersion, sdkVersion, fetch } from './chunk-CDDWXBEM.js';
2
+ import { DEFAULT_ARKADE_SERVER_URL } from './chunk-C7TXXTMS.js';
3
3
 
4
4
  // src/providers/expoUtils.ts
5
5
  async function getExpoFetch(options) {
@@ -212,5 +212,5 @@ var ExpoIndexerProvider = class extends RestIndexerProvider {
212
212
  };
213
213
 
214
214
  export { ExpoArkProvider, ExpoIndexerProvider };
215
- //# sourceMappingURL=chunk-JTCQ6QXQ.js.map
216
- //# sourceMappingURL=chunk-JTCQ6QXQ.js.map
215
+ //# sourceMappingURL=chunk-AJQ4AOT3.js.map
216
+ //# sourceMappingURL=chunk-AJQ4AOT3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/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AK,KAAA,CAAM,EAAA;AAAA,gBACf,aAAA,EAAe,KAAK,KAAA,CAAM;AAAA,eAC9B;AAAA,YACJ;AACA,YAAA,OAAO,IAAA;AAAA,UACX;AAAA,SACJ;AAAA,MACJ,SAAS,KAAA,EAAO;AACZ,QAAA,IAAI,KAAA,YAAiB,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,YAAA,EAAc;AACvD,UAAA;AAAA,QACJ;AAIA,QAAA,IAAI,mBAAA,CAAoB,KAAK,CAAA,EAAG;AAC5B,UAAA,OAAA,CAAQ,MAAM,uBAAuB,CAAA;AACrC,UAAA;AAAA,QACJ;AAEA,QAAA,OAAA,CAAQ,KAAA,CAAM,uBAAuB,KAAK,CAAA;AAC1C,QAAA,MAAM,KAAA;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ","file":"chunk-JTCQ6QXQ.js","sourcesContent":["import { fetch, buildVersion, sdkVersion } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch with fallback to standard fetch.\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n const expoFetchWithHeader = (input: RequestInfo, init?: RequestInit) => {\n const headers = new Headers(init?.headers);\n headers.set(\"X-Build-Version\", buildVersion);\n headers.set(\"X-SDK-VERSION\", sdkVersion);\n return expoFetchModule.fetch(input, { ...init, headers });\n };\n return expoFetchWithHeader as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return fetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotification, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{\n commitmentTx?: TxNotification;\n arkTx?: TxNotification;\n }> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse, Vtxo } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { VirtualCoin } from \"../wallet\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n// Helper function to convert Vtxo to VirtualCoin (same as in indexer.ts)\nfunction convertVtxo(vtxo: Vtxo): VirtualCoin {\n return {\n txid: vtxo.outpoint.txid,\n vout: vtxo.outpoint.vout,\n value: Number(vtxo.amount),\n status: {\n confirmed: !vtxo.isSwept && !vtxo.isPreconfirmed,\n isLeaf: !vtxo.isPreconfirmed,\n },\n virtualStatus: {\n state: vtxo.isSwept ? \"swept\" : vtxo.isPreconfirmed ? \"preconfirmed\" : \"settled\",\n commitmentTxIds: vtxo.commitmentTxids,\n batchExpiry: vtxo.expiresAt ? Number(vtxo.expiresAt) * 1000 : undefined,\n },\n spentBy: vtxo.spentBy ?? \"\",\n settledBy: vtxo.settledBy,\n arkTxId: vtxo.arkTxid,\n createdAt: new Date(Number(vtxo.createdAt) * 1000),\n isUnrolled: vtxo.isUnrolled,\n isSpent: vtxo.isSpent,\n script: vtxo.script,\n assets: vtxo.assets?.map((a) => ({\n assetId: a.assetId,\n amount: BigInt(a.amount),\n })),\n };\n}\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":[],"mappings":";;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD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,SAAS,KAAA,EAAO;AACZ,QAAA,IAAI,KAAA,YAAiB,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,YAAA,EAAc;AACvD,UAAA;AAAA,QACJ;AAIA,QAAA,IAAI,mBAAA,CAAoB,KAAK,CAAA,EAAG;AAC5B,UAAA,OAAA,CAAQ,MAAM,uBAAuB,CAAA;AACrC,UAAA;AAAA,QACJ;AAEA,QAAA,OAAA,CAAQ,KAAA,CAAM,uBAAuB,KAAK,CAAA;AAC1C,QAAA,MAAM,KAAA;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ","file":"chunk-AJQ4AOT3.js","sourcesContent":["import { fetch, buildVersion, sdkVersion } from \"../utils/fetch\";\n\n/**\n * Dynamically imports expo/fetch with fallback to standard fetch.\n * @returns A fetch function suitable for SSE streaming\n */\nexport async function getExpoFetch(options?: { requireExpo?: boolean }): Promise<typeof fetch> {\n const requireExpo = options?.requireExpo ?? false;\n\n try {\n const expoFetchModule = await import(\"expo/fetch\");\n console.debug(\"Using expo/fetch for streaming\");\n const expoFetchWithHeader = (input: RequestInfo, init?: RequestInit) => {\n const headers = new Headers(init?.headers);\n headers.set(\"X-Build-Version\", buildVersion);\n headers.set(\"X-SDK-VERSION\", sdkVersion);\n return expoFetchModule.fetch(input, { ...init, headers });\n };\n return expoFetchWithHeader as unknown as typeof fetch;\n } catch (error) {\n if (requireExpo) {\n throw new Error(\n \"expo/fetch is unavailable in this environment. \" +\n \"Please ensure expo/fetch is installed and properly configured.\",\n );\n }\n\n console.warn(\n \"Using standard fetch instead of expo/fetch. \" +\n \"Streaming may not be fully supported in some environments.\",\n error,\n );\n return fetch;\n }\n}\n\n/**\n * Generic SSE stream processor using fetch API with ReadableStream.\n * Handles SSE format parsing, buffer management, and abort signals.\n *\n * @param url - The SSE endpoint URL\n * @param abortSignal - Signal to abort the stream\n * @param fetchFn - Fetch function to use (defaults to standard fetch)\n * @param headers - Additional headers to send\n * @param parseData - Function to parse and yield data from SSE events\n */\nexport async function* sseStreamIterator<T>(\n url: string,\n abortSignal: AbortSignal,\n fetchFn: typeof fetch,\n headers: Record<string, string>,\n parseData: (data: any) => T | null,\n): AsyncGenerator<T, void, unknown> {\n const fetchController = new AbortController();\n const cleanup = () => fetchController.abort();\n abortSignal?.addEventListener(\"abort\", cleanup, { once: true });\n\n try {\n const response = await fetchFn(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...headers,\n },\n signal: fetchController.signal,\n });\n\n if (!response.ok) {\n throw new Error(`Unexpected status ${response.status} when fetching SSE stream`);\n }\n\n if (!response.body) {\n throw new Error(\"Response body is null\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!abortSignal?.aborted) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n\n for (let i = 0; i < lines.length - 1; i++) {\n const line = lines[i].trim();\n if (!line) continue;\n\n if (line.startsWith(\"data:\")) {\n const jsonStr = line.substring(5).trim();\n if (!jsonStr) continue;\n\n try {\n const data = JSON.parse(jsonStr);\n const parsed = parseData(data);\n if (parsed !== null) {\n yield parsed;\n }\n } catch (parseError) {\n console.error(\"Failed to parse SSE data:\", parseError);\n throw parseError;\n }\n }\n }\n\n buffer = lines[lines.length - 1];\n }\n } finally {\n abortSignal?.removeEventListener(\"abort\", cleanup);\n }\n}\n","import { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\nimport { RestArkProvider, SettlementEvent, TxNotification, isFetchTimeoutError } from \"./ark\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\n\n/**\n * Expo-compatible Arkade provider implementation using expo/fetch for SSE support.\n * This provider works specifically in React Native/Expo environments where\n * standard EventSource is not available but expo/fetch provides SSE capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';\n *\n * const provider = new ExpoArkProvider('https://arkade.computer');\n * const info = await provider.getInfo();\n * ```\n */\nexport class ExpoArkProvider extends RestArkProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getEventStream(\n signal: AbortSignal,\n topics: string[],\n ): AsyncIterableIterator<SettlementEvent> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/batch/events`;\n const queryParams =\n topics.length > 0\n ? `?${topics.map((topic) => `topics=${encodeURIComponent(topic)}`).join(\"&\")}`\n : \"\";\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url + queryParams, signal, expoFetch, {}, (data) => {\n // Handle different response structures\n // v8 mesh API might wrap in {result: ...} or send directly\n const eventData = data.result || data;\n\n // Skip heartbeat messages\n if (eventData.heartbeat !== undefined) {\n return null;\n }\n\n return this.parseSettlementEvent(eventData);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Event stream error:\", error);\n throw error;\n }\n }\n }\n\n override async *getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{\n commitmentTx?: TxNotification;\n arkTx?: TxNotification;\n }> {\n const expoFetch = await getExpoFetch();\n const url = `${this.serverUrl}/v1/txs`;\n\n while (!signal?.aborted) {\n try {\n yield* sseStreamIterator(url, signal, expoFetch, {}, (data) => {\n return this.parseTransactionNotification(data.result);\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Transaction stream error:\", error);\n throw error;\n }\n }\n }\n}\n","import { RestIndexerProvider, SubscriptionResponse, Vtxo } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { VirtualCoin } from \"../wallet\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\n\n// Helper function to convert Vtxo to VirtualCoin (same as in indexer.ts)\nfunction convertVtxo(vtxo: Vtxo): VirtualCoin {\n return {\n txid: vtxo.outpoint.txid,\n vout: vtxo.outpoint.vout,\n value: Number(vtxo.amount),\n status: {\n confirmed: !vtxo.isSwept && !vtxo.isPreconfirmed,\n isLeaf: !vtxo.isPreconfirmed,\n },\n virtualStatus: {\n state: vtxo.isSwept ? \"swept\" : vtxo.isPreconfirmed ? \"preconfirmed\" : \"settled\",\n commitmentTxIds: vtxo.commitmentTxids,\n batchExpiry: vtxo.expiresAt ? Number(vtxo.expiresAt) * 1000 : undefined,\n },\n spentBy: vtxo.spentBy ?? \"\",\n settledBy: vtxo.settledBy,\n arkTxId: vtxo.arkTxid,\n createdAt: new Date(Number(vtxo.createdAt) * 1000),\n isUnrolled: vtxo.isUnrolled,\n isSpent: vtxo.isSpent,\n script: vtxo.script,\n assets: vtxo.assets?.map((a) => ({\n assetId: a.assetId,\n amount: BigInt(a.amount),\n })),\n };\n}\n\n/**\n * Expo-compatible Indexer provider implementation using expo/fetch for streaming support.\n * This provider works specifically in React Native/Expo environments where\n * standard fetch streaming may not work properly but expo/fetch provides streaming capabilities.\n *\n * @example\n * ```typescript\n * import { ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';\n *\n * const provider = new ExpoIndexerProvider('https://indexer.example.com');\n * const vtxos = await provider.getVtxos({ scripts: ['script1'] });\n * ```\n */\nexport class ExpoIndexerProvider extends RestIndexerProvider {\n constructor(serverUrl: string = DEFAULT_ARKADE_SERVER_URL) {\n super(serverUrl);\n }\n\n override async *getSubscription(\n subscriptionId: string,\n abortSignal: AbortSignal,\n ): AsyncIterableIterator<SubscriptionResponse> {\n // Detect if we're running in React Native/Expo environment\n const isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\n\n const expoFetch = await getExpoFetch().catch((error) => {\n // In React Native/Expo, expo/fetch is required for proper streaming support\n if (isReactNative) {\n throw new Error(\n \"expo/fetch is unavailable in React Native environment. \" +\n \"Please ensure expo/fetch is installed and properly configured. \" +\n \"Streaming support may not work with standard fetch in React Native.\",\n );\n }\n throw error;\n });\n\n const url = `${this.serverUrl}/v1/indexer/script/subscription/${subscriptionId}`;\n\n while (!abortSignal.aborted) {\n try {\n yield* sseStreamIterator(\n url,\n abortSignal,\n expoFetch,\n { \"Content-Type\": \"application/json\" },\n (data): SubscriptionResponse | null => {\n // Handle new v8 proto format with heartbeat or event\n if (data.heartbeat !== undefined) {\n // Skip heartbeat messages\n return null;\n }\n // Process event messages\n if (data.event) {\n return {\n txid: data.event.txid,\n scripts: data.event.scripts || [],\n newVtxos: (data.event.newVtxos || []).map(convertVtxo),\n spentVtxos: (data.event.spentVtxos || []).map(convertVtxo),\n sweptVtxos: (data.event.sweptVtxos || []).map(convertVtxo),\n tx: data.event.tx,\n checkpointTxs: data.event.checkpointTxs,\n };\n }\n return null;\n },\n );\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n break;\n }\n\n // ignore timeout errors, they're expected when the server is not sending anything for 5 min\n // these timeouts are set by expo/fetch function\n if (isFetchTimeoutError(error)) {\n console.debug(\"Timeout error ignored\");\n continue;\n }\n\n console.error(\"Subscription error:\", error);\n throw error;\n }\n }\n }\n}\n"]}
@@ -685,10 +685,12 @@ var VtxoScript = class _VtxoScript {
685
685
  }
686
686
  this.leaves = payment.tapLeafScript;
687
687
  this.tweakedPublicKey = payment.tweakedPubkey;
688
+ this.pkScript = payment.script;
688
689
  }
689
690
  scripts;
690
691
  leaves;
691
692
  tweakedPublicKey;
693
+ pkScript;
692
694
  /**
693
695
  * Decode a virtual output script from an encoded TapTree.
694
696
  *
@@ -729,9 +731,6 @@ var VtxoScript = class _VtxoScript {
729
731
  address(prefix = DEFAULT_NETWORK.hrp, serverPubKey) {
730
732
  return new ArkAddress(serverPubKey, this.tweakedPublicKey, prefix);
731
733
  }
732
- get pkScript() {
733
- return Script.encode(["OP_1", this.tweakedPublicKey]);
734
- }
735
734
  /**
736
735
  * Build the Taproot onchain address corresponding to this virtual output script.
737
736
  *
@@ -804,5 +803,5 @@ function getSequence(tapLeafScript) {
804
803
  }
805
804
 
806
805
  export { ArkAddress, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, DEFAULT_ARKADE_SERVER_URL, DEFAULT_NETWORK, DEFAULT_NETWORK_NAME, MultisigTapscript, TapTreeCoder, VtxoScript, assembleBtcdTaprootTree, decodeTapscript, getNetwork, getSequence, networks, scriptFromTapLeafScript, sequenceToTimelock, timelockToSequence };
807
- //# sourceMappingURL=chunk-FWG4TSPN.js.map
808
- //# sourceMappingURL=chunk-FWG4TSPN.js.map
806
+ //# sourceMappingURL=chunk-C7TXXTMS.js.map
807
+ //# sourceMappingURL=chunk-C7TXXTMS.js.map