@arkade-os/sdk 0.4.53 → 0.4.55

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 (81) 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-B69ugeJw.d.cts → ark-Do9Lqfsp.d.cts} +36 -2
  8. package/dist/{ark-B69ugeJw.d.ts → ark-Do9Lqfsp.d.ts} +36 -2
  9. package/dist/{asyncStorageTaskQueue-B0SUQMXw.d.cts → asyncStorageTaskQueue-C3DYxvAT.d.cts} +1 -1
  10. package/dist/{asyncStorageTaskQueue-DWqxuIAs.d.ts → asyncStorageTaskQueue-DOnBOEDn.d.ts} +1 -1
  11. package/dist/{chunk-CZTQLA55.cjs → chunk-C6UYPHTQ.cjs} +9 -9
  12. package/dist/{chunk-CZTQLA55.cjs.map → chunk-C6UYPHTQ.cjs.map} +1 -1
  13. package/dist/{chunk-4GB73TRR.cjs → chunk-CSS74VCN.cjs} +17 -17
  14. package/dist/{chunk-4GB73TRR.cjs.map → chunk-CSS74VCN.cjs.map} +1 -1
  15. package/dist/{chunk-LHYNNDY6.js → chunk-ENWR2F2P.js} +8 -1327
  16. package/dist/chunk-ENWR2F2P.js.map +1 -0
  17. package/dist/{chunk-RNMLFY2V.cjs → chunk-G7DOBFQN.cjs} +19 -1367
  18. package/dist/chunk-G7DOBFQN.cjs.map +1 -0
  19. package/dist/chunk-JCJ5WFS3.js +2326 -0
  20. package/dist/chunk-JCJ5WFS3.js.map +1 -0
  21. package/dist/{chunk-B4WZOJAI.js → chunk-LAONNMM5.js} +4 -4
  22. package/dist/{chunk-B4WZOJAI.js.map → chunk-LAONNMM5.js.map} +1 -1
  23. package/dist/chunk-OWCPXRGP.cjs +2415 -0
  24. package/dist/chunk-OWCPXRGP.cjs.map +1 -0
  25. package/dist/{chunk-UZLQUWYP.js → chunk-QMPNPZ2T.js} +23 -4
  26. package/dist/chunk-QMPNPZ2T.js.map +1 -0
  27. package/dist/{chunk-3MMUKLCI.js → chunk-QO3IKBYL.js} +827 -130
  28. package/dist/chunk-QO3IKBYL.js.map +1 -0
  29. package/dist/{chunk-3XWDMLOI.js → chunk-SG4X7SEC.js} +4 -4
  30. package/dist/{chunk-3XWDMLOI.js.map → chunk-SG4X7SEC.js.map} +1 -1
  31. package/dist/{chunk-IEMPH7J6.cjs → chunk-V2TOHHPW.cjs} +60 -40
  32. package/dist/chunk-V2TOHHPW.cjs.map +1 -0
  33. package/dist/{chunk-3YC3LQ2E.cjs → chunk-ZPL34T2Q.cjs} +1191 -471
  34. package/dist/chunk-ZPL34T2Q.cjs.map +1 -0
  35. package/dist/contracts/handlers/index.cjs +8 -8
  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-C_Y2YrXC.d.cts → delegate-C0iIBxen.d.cts} +1 -1
  40. package/dist/{delegate-BU-Cpyjw.d.ts → delegate-DmhFrtdq.d.ts} +1 -1
  41. package/dist/{index-BWF-C9eh.d.ts → index-BNt4wcSh.d.ts} +2 -2
  42. package/dist/{index-tzAInyiX.d.cts → index-BnLM1XxA.d.cts} +2 -2
  43. package/dist/index.cjs +348 -240
  44. package/dist/index.d.cts +424 -14
  45. package/dist/index.d.ts +424 -14
  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-nzJFH8qb.d.ts → taskRunner-Bgs-0I3x.d.ts} +1 -1
  56. package/dist/{taskRunner-B7svzMhT.d.cts → taskRunner-RwUvgQ5M.d.cts} +1 -1
  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 +5 -5
  63. package/dist/wallet/expo/index.d.ts +5 -5
  64. package/dist/wallet/expo/index.js +5 -5
  65. package/dist/{wallet-B6Xiferv.d.cts → wallet-5Aou-V5n.d.ts} +83 -6
  66. package/dist/{wallet-CuHAI-eW.d.ts → wallet-Ck7BH8zR.d.cts} +83 -6
  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-3MMUKLCI.js.map +0 -1
  73. package/dist/chunk-3YC3LQ2E.cjs.map +0 -1
  74. package/dist/chunk-E7HB3GKK.cjs +0 -1030
  75. package/dist/chunk-E7HB3GKK.cjs.map +0 -1
  76. package/dist/chunk-EFNLTS6Q.js +0 -976
  77. package/dist/chunk-EFNLTS6Q.js.map +0 -1
  78. package/dist/chunk-IEMPH7J6.cjs.map +0 -1
  79. package/dist/chunk-LHYNNDY6.js.map +0 -1
  80. package/dist/chunk-RNMLFY2V.cjs.map +0 -1
  81. package/dist/chunk-UZLQUWYP.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunk4GB73TRR_cjs = require('../chunk-4GB73TRR.cjs');
4
- require('../chunk-RNMLFY2V.cjs');
5
- require('../chunk-E7HB3GKK.cjs');
3
+ var chunkCSS74VCN_cjs = require('../chunk-CSS74VCN.cjs');
4
+ require('../chunk-G7DOBFQN.cjs');
5
+ require('../chunk-OWCPXRGP.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 chunk4GB73TRR_cjs.ExpoArkProvider; }
12
+ get: function () { return chunkCSS74VCN_cjs.ExpoArkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "ExpoIndexerProvider", {
15
15
  enumerable: true,
16
- get: function () { return chunk4GB73TRR_cjs.ExpoIndexerProvider; }
16
+ get: function () { return chunkCSS74VCN_cjs.ExpoIndexerProvider; }
17
17
  });
18
18
  //# sourceMappingURL=expo.cjs.map
19
19
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-B69ugeJw.cjs';
2
- export { n as ArkProvider, o as IndexerProvider } from '../ark-B69ugeJw.cjs';
1
+ import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-Do9Lqfsp.cjs';
2
+ export { n as ArkProvider, o as IndexerProvider } from '../ark-Do9Lqfsp.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 { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-B69ugeJw.js';
2
- export { n as ArkProvider, o as IndexerProvider } from '../ark-B69ugeJw.js';
1
+ import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-Do9Lqfsp.js';
2
+ export { n as ArkProvider, o as IndexerProvider } from '../ark-Do9Lqfsp.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-3XWDMLOI.js';
2
- import '../chunk-LHYNNDY6.js';
3
- import '../chunk-EFNLTS6Q.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-SG4X7SEC.js';
2
+ import '../chunk-ENWR2F2P.js';
3
+ import '../chunk-JCJ5WFS3.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 chunk3YC3LQ2E_cjs = require('../chunk-3YC3LQ2E.cjs');
4
- require('../chunk-RNMLFY2V.cjs');
5
- require('../chunk-IEMPH7J6.cjs');
6
- require('../chunk-E7HB3GKK.cjs');
3
+ var chunkZPL34T2Q_cjs = require('../chunk-ZPL34T2Q.cjs');
4
+ require('../chunk-G7DOBFQN.cjs');
5
+ require('../chunk-V2TOHHPW.cjs');
6
+ require('../chunk-OWCPXRGP.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 = chunk3YC3LQ2E_cjs.DB_VERSION) {
14
+ constructor(dbName, version = chunkZPL34T2Q_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-3MMUKLCI.js';
2
- import '../chunk-LHYNNDY6.js';
3
- import '../chunk-UZLQUWYP.js';
4
- import '../chunk-EFNLTS6Q.js';
1
+ import { DB_VERSION } from '../chunk-QO3IKBYL.js';
2
+ import '../chunk-ENWR2F2P.js';
3
+ import '../chunk-QMPNPZ2T.js';
4
+ import '../chunk-JCJ5WFS3.js';
5
5
  import '../chunk-NSBPE2FW.js';
6
6
 
7
7
  // src/storage/indexedDB.ts
@@ -427,6 +427,7 @@ type TapLeafScript = [
427
427
  Bytes
428
428
  ];
429
429
  declare const TapTreeCoder: (typeof PSBTOutput.tapTree)[2];
430
+ declare function scriptFromTapLeafScript(leaf: TapLeafScript): Bytes;
430
431
  /**
431
432
  * VtxoScript is a script that contains a list of tapleaf scripts.
432
433
  * It is used to create virtual output scripts.
@@ -3526,7 +3527,25 @@ declare class ActivityRegistry {
3526
3527
  }
3527
3528
  /** Built-in resolver: labels on-chain boarding (deposit) transactions. */
3528
3529
  declare function boardingResolver(): ActivityResolver;
3529
- /** Default registry with SDK built-ins. */
3530
+ /** Built-in resolver: labels collaborative exits (VTXOs forfeited to chain in a batch). */
3531
+ declare function collabExitResolver(): ActivityResolver;
3532
+ /**
3533
+ * Built-in resolver: labels the genesis transaction of a minted asset — "Asset
3534
+ * mint" on the issuer's sent tx, "Asset receive" when the fresh supply arrives
3535
+ * in the genesis tx itself. An asset id encodes its genesis txid; reissues and
3536
+ * transfers carry the asset under a different `arkTxid`, so they are left plain.
3537
+ *
3538
+ * `metadata.amount` is the decimal string of the asset's `bigint` amount, kept
3539
+ * as a string so large supplies survive JSON round-trips without truncation.
3540
+ * Recover the value with `BigInt(metadata.amount as string)` — using it
3541
+ * directly in arithmetic coerces (`"10" + 1` is `"101"`, not `11`) and loses
3542
+ * precision past `Number.MAX_SAFE_INTEGER`.
3543
+ */
3544
+ declare function assetMintResolver(): ActivityResolver;
3545
+ /**
3546
+ * A registry pre-populated with the SDK's built-in resolvers: `boarding`,
3547
+ * `collab-exit`, and `asset-mint`.
3548
+ */
3530
3549
  declare function createDefaultActivityRegistry(): ActivityRegistry;
3531
3550
 
3532
3551
  /**
@@ -4194,6 +4213,15 @@ interface TxKey {
4194
4213
  /** Arkade transaction id, when applicable. */
4195
4214
  arkTxid: string;
4196
4215
  }
4216
+ /** The categories the history builder itself assigns. */
4217
+ type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch";
4218
+ /**
4219
+ * The category the history builder assigns to a transaction. The `(string & {})`
4220
+ * arm keeps the union open — apps and resolvers can introduce their own
4221
+ * categories without a breaking change — while preserving editor autocomplete
4222
+ * for the built-in four.
4223
+ */
4224
+ type TxTag = BuiltinTxTag | (string & {});
4197
4225
  /**
4198
4226
  * Wallet transaction history entry.
4199
4227
  *
@@ -4213,6 +4241,12 @@ interface ArkTransaction {
4213
4241
  createdAt: number;
4214
4242
  /** Assets sent or received by this transaction, if any. */
4215
4243
  assets?: Asset[];
4244
+ /**
4245
+ * The {@link TxTag} category assigned by the history builder. Always set on
4246
+ * transactions returned by the wallet's `getTransactionHistory()`; optional
4247
+ * only because a hand-built `ArkTransaction` may omit it.
4248
+ */
4249
+ tag?: TxTag;
4216
4250
  }
4217
4251
  /**
4218
4252
  * Tapleaves required to spend or settle a wallet output.
@@ -5166,4 +5200,4 @@ declare namespace ProtoTypes {
5166
5200
  export { };
5167
5201
  }
5168
5202
 
5169
- export { type NetworkName as $, type ArkTransaction as A, type BatchStartedEvent as B, type ContractRepository as C, type TreeTxEvent as D, type ExtendedCoin as E, type TreeSignatureEvent as F, type GetVtxosFilter as G, type DescriptorProvider as H, type IWallet as I, type IReadonlyWallet as J, type ReadonlyIdentity as K, type Network as L, type DelegateProvider as M, type NormalizedExtendedVirtualCoin as N, type OnchainProvider as O, type ReadonlyWalletConfig as P, type IntentRepository as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type VirtualTxRepository as U, VtxoScript as V, type WalletRepository as W, type ExitCaptureMode as X, type ExitDataSource as Y, type IReadonlyAssetManager as Z, type ContractSyncState as _, type Identity as a, CLTVMultisigTapscript as a$, type ArkInfo as a0, ArkAddress as a1, type Coin as a2, ContractManager as a3, type ContractManagerConfig as a4, CSVMultisigTapscript as a5, type SettlementConfig as a6, VtxoManager as a7, type SignerSession as a8, type SignedIntent as a9, type ReissuanceParams as aA, type BurnParams as aB, type RenewVtxosOptions as aC, type ContractWithVtxos as aD, type PathSelection as aE, type ContractEvent as aF, type AssetDetails as aG, type IssuanceResult as aH, type DelegateInfo as aI, type MigrationGlobalSkipReason as aJ, type MigrationLegSkipReason as aK, type SignerStatus as aL, type StorageConfig as aM, type IVtxoManager as aN, type ExplorerTransaction as aO, type EncodedVtxoScript as aP, type Status as aQ, type ChainTx as aR, type PathContext as aS, type ActivityIntent as aT, type ActivityResolver as aU, type ArkIntentState as aV, type ArkTapscript as aW, type AssetMetadata as aX, type BaseWalletConfig as aY, type BatchInfo as aZ, type BatchSignableIdentity as a_, Intent as aa, type TimeHeight as ab, type VtxoRepositoryKey as ac, type WalletState as ad, type ContractFilter as ae, type ArkIntent as af, type IntentFilter as ag, type Outpoint as ah, type VirtualTx as ai, type VtxoBranch as aj, ChainedTxType as ak, type DescriptorSigningRequest as al, Transaction as am, type IntentFeeConfig as an, type OffchainInput as ao, FeeAmount as ap, type OnchainInput as aq, type FeeOutput as ar, type ContractWatcherConfig as as, type Asset as at, type FeeInfo as au, type CreateContractParams as av, type GetContractsFilter as aw, type GetSpendablePathsOptions as ax, type GetAllSpendingPathsOptions as ay, type IssuanceParams as az, type WalletConfig as b, type Vtxo as b$, type CandidateDeps as b0, ChainTxType as b1, type CommitmentTx as b2, ConditionCSVMultisigTapscript as b3, ConditionMultisigTapscript as b4, type ContractBalance as b5, type ContractEventCallback as b6, type ContractHandler as b7, type ContractState as b8, type ContractVtxo as b9, type Output as bA, type PageResponse as bB, type PaginationOptions as bC, PartialSig as bD, type ProviderClass as bE, RestDelegateProvider as bF, RestDelegatorProvider as bG, type ScanContractsOptions as bH, type ScanResult as bI, type ScheduledSession as bJ, SettlementEventType as bK, type SignRequest as bL, type SignerClassification as bM, type SignerSet as bN, type SubscriptionEvent as bO, type SubscriptionHeartbeat as bP, type TapLeaves as bQ, TapTreeCoder as bR, TapscriptType as bS, type TreeNonces as bT, type TreePartialSigs as bU, type Tx as bV, type TxHistoryRecord as bW, type TxKey as bX, type TxTreeNode as bY, TxType as bZ, type VirtualStatus as b_, ContractWatcher as ba, DelegateManagerImpl as bb, type DelegateOptions as bc, DelegatorManagerImpl as bd, type DelegatorProvider as be, type DeprecatedSignerMigrationReport as bf, type DeprecatedSignerReport as bg, DigestMismatchError as bh, type Discoverable as bi, type DiscoveredContract as bj, type DiscoveryDeps as bk, ESPLORA_URL as bl, EsploraProvider as bm, type ExitChainResolver as bn, type ExtendedContractVtxo as bo, type GroupMembership as bp, type HandlerError as bq, type IDelegatorManager as br, INTENT_TERMINAL_STATES as bs, IndexerTxType as bt, type KnownMetadata as bu, type MigrateDeprecatedSignerOptions as bv, type MigrationLegReport as bw, type MigrationVtxoRef as bx, MultisigTapscript as by, type Nonces as bz, type WalletBalance as c, type VtxoChain as c0, type VtxoType as c1, type WalletMode as c2, boardingResolver as c3, canRecoverOnchain as c4, canSpendOffchain as c5, classifyAgainstSignerSet as c6, classifyContractSigner as c7, createDefaultActivityRegistry as c8, createExitChainResolver as c9, decodeTapscript as ca, getNetwork as cb, getSequence as cc, hasCandidates as cd, hasTerminalSpend as ce, isBatchSignable as cf, isCooperativelyMigratable as cg, isDiscoverable as ch, isExpired as ci, isPastExpiry as cj, isRecoverable as ck, isSpendable as cl, isSubdust as cm, isTerminalIntentState as cn, isVirtualCoin as co, isVtxoExpiringSoon as cp, networks as cq, signerSetFromInfo as cr, toXOnlySignerHex as cs, type TapscriptDeriving as ct, ActivityRegistry as d, type Activity as e, type IContractManager as f, type IDelegateManager as g, type SettleParams as h, type SettlementEvent as i, type IAssetManager as j, RestArkProvider as k, RestIndexerProvider as l, type SubscriptionResponse as m, type ArkProvider as n, type IndexerProvider as o, type RelativeTimelock as p, type TapLeafScript as q, type VirtualCoin as r, type Contract as s, type ExtendedVirtualCoin as t, type TreeSigningStartedEvent as u, TxTree as v, type TreeNoncesEvent as w, type BatchFinalizationEvent as x, type BatchFinalizedEvent as y, type BatchFailedEvent as z };
5203
+ export { type ReadonlyIdentity as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedCoin 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 NormalizedExtendedVirtualCoin as N, type Outpoint as O, type BatchFinalizationEvent as P, type BatchFinalizedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type BatchFailedEvent as U, VtxoScript as V, type WalletRepository as W, type TreeTxEvent as X, type TreeSignatureEvent as Y, type DescriptorProvider as Z, type IReadonlyWallet as _, type Identity as a, CLTVMultisigTapscript as a$, type Network as a0, type OnchainProvider as a1, type DelegateProvider as a2, type ReadonlyWalletConfig as a3, type ExitCaptureMode as a4, type ExitDataSource as a5, type IReadonlyAssetManager as a6, type ContractSyncState as a7, type NetworkName as a8, type ArkInfo as a9, type ReissuanceParams as aA, type BurnParams as aB, type RenewVtxosOptions as aC, type ContractWithVtxos as aD, type PathSelection as aE, type ContractEvent as aF, type AssetDetails as aG, type IssuanceResult as aH, type DelegateInfo as aI, type MigrationGlobalSkipReason as aJ, type MigrationLegSkipReason as aK, type SignerStatus as aL, type StorageConfig as aM, type IVtxoManager as aN, type ExplorerTransaction as aO, type EncodedVtxoScript as aP, type Status as aQ, type ChainTx as aR, type PathContext as aS, type ActivityIntent as aT, type ActivityResolver as aU, type ArkIntentState as aV, type ArkTapscript as aW, type AssetMetadata as aX, type BaseWalletConfig as aY, type BatchInfo as aZ, type BatchSignableIdentity as a_, ArkAddress as aa, type Coin as ab, ContractManager as ac, type ContractManagerConfig as ad, CSVMultisigTapscript as ae, type SettlementConfig as af, VtxoManager as ag, type SignerSession as ah, type SignedIntent as ai, Intent as aj, type TimeHeight as ak, type DescriptorSigningRequest as al, Transaction as am, type IntentFeeConfig as an, type OffchainInput as ao, FeeAmount as ap, type OnchainInput as aq, type FeeOutput as ar, type ContractWatcherConfig as as, type Asset as at, type FeeInfo as au, type CreateContractParams as av, type GetContractsFilter as aw, type GetSpendablePathsOptions as ax, type GetAllSpendingPathsOptions as ay, type IssuanceParams as az, type WalletConfig as b, type VirtualStatus as b$, type CandidateDeps as b0, ChainTxType as b1, type CommitmentTx as b2, ConditionCSVMultisigTapscript as b3, ConditionMultisigTapscript as b4, type ContractBalance as b5, type ContractEventCallback as b6, type ContractHandler as b7, type ContractState as b8, type ContractVtxo as b9, type Output as bA, type PageResponse as bB, type PaginationOptions as bC, PartialSig as bD, type ProviderClass as bE, RestDelegateProvider as bF, RestDelegatorProvider as bG, type ScanContractsOptions as bH, type ScanResult as bI, type ScheduledSession as bJ, SettlementEventType as bK, type SignRequest as bL, type SignerClassification as bM, type SignerSet as bN, type SubscriptionEvent as bO, type SubscriptionHeartbeat as bP, type TapLeaves as bQ, TapTreeCoder as bR, TapscriptType as bS, type TreeNonces as bT, type TreePartialSigs as bU, type Tx as bV, type TxHistoryRecord as bW, type TxKey as bX, type TxTag as bY, type TxTreeNode as bZ, TxType as b_, ContractWatcher as ba, DelegateManagerImpl as bb, type DelegateOptions as bc, DelegatorManagerImpl as bd, type DelegatorProvider as be, type DeprecatedSignerMigrationReport as bf, type DeprecatedSignerReport as bg, DigestMismatchError as bh, type Discoverable as bi, type DiscoveredContract as bj, type DiscoveryDeps as bk, ESPLORA_URL as bl, EsploraProvider as bm, type ExitChainResolver as bn, type ExtendedContractVtxo as bo, type GroupMembership as bp, type HandlerError as bq, type IDelegatorManager as br, INTENT_TERMINAL_STATES as bs, IndexerTxType as bt, type KnownMetadata as bu, type MigrateDeprecatedSignerOptions as bv, type MigrationLegReport as bw, type MigrationVtxoRef as bx, MultisigTapscript as by, type Nonces as bz, type WalletBalance as c, type Vtxo as c0, type VtxoChain as c1, type VtxoType as c2, type WalletMode as c3, assetMintResolver as c4, boardingResolver as c5, canRecoverOnchain as c6, canSpendOffchain as c7, classifyAgainstSignerSet as c8, classifyContractSigner as c9, collabExitResolver as ca, createDefaultActivityRegistry as cb, createExitChainResolver as cc, decodeTapscript as cd, getNetwork as ce, getSequence as cf, hasCandidates as cg, hasTerminalSpend as ch, isBatchSignable as ci, isCooperativelyMigratable as cj, isDiscoverable as ck, isExpired as cl, isPastExpiry as cm, isRecoverable as cn, isSpendable as co, isSubdust as cp, isTerminalIntentState as cq, isVirtualCoin as cr, isVtxoExpiringSoon as cs, networks as ct, scriptFromTapLeafScript as cu, signerSetFromInfo as cv, toXOnlySignerHex as cw, type TapscriptDeriving as cx, ActivityRegistry as d, type Activity as e, type IContractManager as f, type IDelegateManager as g, type SettleParams as h, type SettlementEvent as i, type IAssetManager as j, RestArkProvider as k, RestIndexerProvider as l, type SubscriptionResponse as m, type ArkProvider as n, type IndexerProvider as o, type RelativeTimelock as p, type TapLeafScript as q, type VirtualCoin as r, type Contract as s, type ExtendedVirtualCoin 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 };
@@ -427,6 +427,7 @@ type TapLeafScript = [
427
427
  Bytes
428
428
  ];
429
429
  declare const TapTreeCoder: (typeof PSBTOutput.tapTree)[2];
430
+ declare function scriptFromTapLeafScript(leaf: TapLeafScript): Bytes;
430
431
  /**
431
432
  * VtxoScript is a script that contains a list of tapleaf scripts.
432
433
  * It is used to create virtual output scripts.
@@ -3526,7 +3527,25 @@ declare class ActivityRegistry {
3526
3527
  }
3527
3528
  /** Built-in resolver: labels on-chain boarding (deposit) transactions. */
3528
3529
  declare function boardingResolver(): ActivityResolver;
3529
- /** Default registry with SDK built-ins. */
3530
+ /** Built-in resolver: labels collaborative exits (VTXOs forfeited to chain in a batch). */
3531
+ declare function collabExitResolver(): ActivityResolver;
3532
+ /**
3533
+ * Built-in resolver: labels the genesis transaction of a minted asset — "Asset
3534
+ * mint" on the issuer's sent tx, "Asset receive" when the fresh supply arrives
3535
+ * in the genesis tx itself. An asset id encodes its genesis txid; reissues and
3536
+ * transfers carry the asset under a different `arkTxid`, so they are left plain.
3537
+ *
3538
+ * `metadata.amount` is the decimal string of the asset's `bigint` amount, kept
3539
+ * as a string so large supplies survive JSON round-trips without truncation.
3540
+ * Recover the value with `BigInt(metadata.amount as string)` — using it
3541
+ * directly in arithmetic coerces (`"10" + 1` is `"101"`, not `11`) and loses
3542
+ * precision past `Number.MAX_SAFE_INTEGER`.
3543
+ */
3544
+ declare function assetMintResolver(): ActivityResolver;
3545
+ /**
3546
+ * A registry pre-populated with the SDK's built-in resolvers: `boarding`,
3547
+ * `collab-exit`, and `asset-mint`.
3548
+ */
3530
3549
  declare function createDefaultActivityRegistry(): ActivityRegistry;
3531
3550
 
3532
3551
  /**
@@ -4194,6 +4213,15 @@ interface TxKey {
4194
4213
  /** Arkade transaction id, when applicable. */
4195
4214
  arkTxid: string;
4196
4215
  }
4216
+ /** The categories the history builder itself assigns. */
4217
+ type BuiltinTxTag = "offchain" | "boarding" | "exit" | "batch";
4218
+ /**
4219
+ * The category the history builder assigns to a transaction. The `(string & {})`
4220
+ * arm keeps the union open — apps and resolvers can introduce their own
4221
+ * categories without a breaking change — while preserving editor autocomplete
4222
+ * for the built-in four.
4223
+ */
4224
+ type TxTag = BuiltinTxTag | (string & {});
4197
4225
  /**
4198
4226
  * Wallet transaction history entry.
4199
4227
  *
@@ -4213,6 +4241,12 @@ interface ArkTransaction {
4213
4241
  createdAt: number;
4214
4242
  /** Assets sent or received by this transaction, if any. */
4215
4243
  assets?: Asset[];
4244
+ /**
4245
+ * The {@link TxTag} category assigned by the history builder. Always set on
4246
+ * transactions returned by the wallet's `getTransactionHistory()`; optional
4247
+ * only because a hand-built `ArkTransaction` may omit it.
4248
+ */
4249
+ tag?: TxTag;
4216
4250
  }
4217
4251
  /**
4218
4252
  * Tapleaves required to spend or settle a wallet output.
@@ -5166,4 +5200,4 @@ declare namespace ProtoTypes {
5166
5200
  export { };
5167
5201
  }
5168
5202
 
5169
- export { type NetworkName as $, type ArkTransaction as A, type BatchStartedEvent as B, type ContractRepository as C, type TreeTxEvent as D, type ExtendedCoin as E, type TreeSignatureEvent as F, type GetVtxosFilter as G, type DescriptorProvider as H, type IWallet as I, type IReadonlyWallet as J, type ReadonlyIdentity as K, type Network as L, type DelegateProvider as M, type NormalizedExtendedVirtualCoin as N, type OnchainProvider as O, type ReadonlyWalletConfig as P, type IntentRepository as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type VirtualTxRepository as U, VtxoScript as V, type WalletRepository as W, type ExitCaptureMode as X, type ExitDataSource as Y, type IReadonlyAssetManager as Z, type ContractSyncState as _, type Identity as a, CLTVMultisigTapscript as a$, type ArkInfo as a0, ArkAddress as a1, type Coin as a2, ContractManager as a3, type ContractManagerConfig as a4, CSVMultisigTapscript as a5, type SettlementConfig as a6, VtxoManager as a7, type SignerSession as a8, type SignedIntent as a9, type ReissuanceParams as aA, type BurnParams as aB, type RenewVtxosOptions as aC, type ContractWithVtxos as aD, type PathSelection as aE, type ContractEvent as aF, type AssetDetails as aG, type IssuanceResult as aH, type DelegateInfo as aI, type MigrationGlobalSkipReason as aJ, type MigrationLegSkipReason as aK, type SignerStatus as aL, type StorageConfig as aM, type IVtxoManager as aN, type ExplorerTransaction as aO, type EncodedVtxoScript as aP, type Status as aQ, type ChainTx as aR, type PathContext as aS, type ActivityIntent as aT, type ActivityResolver as aU, type ArkIntentState as aV, type ArkTapscript as aW, type AssetMetadata as aX, type BaseWalletConfig as aY, type BatchInfo as aZ, type BatchSignableIdentity as a_, Intent as aa, type TimeHeight as ab, type VtxoRepositoryKey as ac, type WalletState as ad, type ContractFilter as ae, type ArkIntent as af, type IntentFilter as ag, type Outpoint as ah, type VirtualTx as ai, type VtxoBranch as aj, ChainedTxType as ak, type DescriptorSigningRequest as al, Transaction as am, type IntentFeeConfig as an, type OffchainInput as ao, FeeAmount as ap, type OnchainInput as aq, type FeeOutput as ar, type ContractWatcherConfig as as, type Asset as at, type FeeInfo as au, type CreateContractParams as av, type GetContractsFilter as aw, type GetSpendablePathsOptions as ax, type GetAllSpendingPathsOptions as ay, type IssuanceParams as az, type WalletConfig as b, type Vtxo as b$, type CandidateDeps as b0, ChainTxType as b1, type CommitmentTx as b2, ConditionCSVMultisigTapscript as b3, ConditionMultisigTapscript as b4, type ContractBalance as b5, type ContractEventCallback as b6, type ContractHandler as b7, type ContractState as b8, type ContractVtxo as b9, type Output as bA, type PageResponse as bB, type PaginationOptions as bC, PartialSig as bD, type ProviderClass as bE, RestDelegateProvider as bF, RestDelegatorProvider as bG, type ScanContractsOptions as bH, type ScanResult as bI, type ScheduledSession as bJ, SettlementEventType as bK, type SignRequest as bL, type SignerClassification as bM, type SignerSet as bN, type SubscriptionEvent as bO, type SubscriptionHeartbeat as bP, type TapLeaves as bQ, TapTreeCoder as bR, TapscriptType as bS, type TreeNonces as bT, type TreePartialSigs as bU, type Tx as bV, type TxHistoryRecord as bW, type TxKey as bX, type TxTreeNode as bY, TxType as bZ, type VirtualStatus as b_, ContractWatcher as ba, DelegateManagerImpl as bb, type DelegateOptions as bc, DelegatorManagerImpl as bd, type DelegatorProvider as be, type DeprecatedSignerMigrationReport as bf, type DeprecatedSignerReport as bg, DigestMismatchError as bh, type Discoverable as bi, type DiscoveredContract as bj, type DiscoveryDeps as bk, ESPLORA_URL as bl, EsploraProvider as bm, type ExitChainResolver as bn, type ExtendedContractVtxo as bo, type GroupMembership as bp, type HandlerError as bq, type IDelegatorManager as br, INTENT_TERMINAL_STATES as bs, IndexerTxType as bt, type KnownMetadata as bu, type MigrateDeprecatedSignerOptions as bv, type MigrationLegReport as bw, type MigrationVtxoRef as bx, MultisigTapscript as by, type Nonces as bz, type WalletBalance as c, type VtxoChain as c0, type VtxoType as c1, type WalletMode as c2, boardingResolver as c3, canRecoverOnchain as c4, canSpendOffchain as c5, classifyAgainstSignerSet as c6, classifyContractSigner as c7, createDefaultActivityRegistry as c8, createExitChainResolver as c9, decodeTapscript as ca, getNetwork as cb, getSequence as cc, hasCandidates as cd, hasTerminalSpend as ce, isBatchSignable as cf, isCooperativelyMigratable as cg, isDiscoverable as ch, isExpired as ci, isPastExpiry as cj, isRecoverable as ck, isSpendable as cl, isSubdust as cm, isTerminalIntentState as cn, isVirtualCoin as co, isVtxoExpiringSoon as cp, networks as cq, signerSetFromInfo as cr, toXOnlySignerHex as cs, type TapscriptDeriving as ct, ActivityRegistry as d, type Activity as e, type IContractManager as f, type IDelegateManager as g, type SettleParams as h, type SettlementEvent as i, type IAssetManager as j, RestArkProvider as k, RestIndexerProvider as l, type SubscriptionResponse as m, type ArkProvider as n, type IndexerProvider as o, type RelativeTimelock as p, type TapLeafScript as q, type VirtualCoin as r, type Contract as s, type ExtendedVirtualCoin as t, type TreeSigningStartedEvent as u, TxTree as v, type TreeNoncesEvent as w, type BatchFinalizationEvent as x, type BatchFinalizedEvent as y, type BatchFailedEvent as z };
5203
+ export { type ReadonlyIdentity as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedCoin 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 NormalizedExtendedVirtualCoin as N, type Outpoint as O, type BatchFinalizationEvent as P, type BatchFinalizedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type BatchFailedEvent as U, VtxoScript as V, type WalletRepository as W, type TreeTxEvent as X, type TreeSignatureEvent as Y, type DescriptorProvider as Z, type IReadonlyWallet as _, type Identity as a, CLTVMultisigTapscript as a$, type Network as a0, type OnchainProvider as a1, type DelegateProvider as a2, type ReadonlyWalletConfig as a3, type ExitCaptureMode as a4, type ExitDataSource as a5, type IReadonlyAssetManager as a6, type ContractSyncState as a7, type NetworkName as a8, type ArkInfo as a9, type ReissuanceParams as aA, type BurnParams as aB, type RenewVtxosOptions as aC, type ContractWithVtxos as aD, type PathSelection as aE, type ContractEvent as aF, type AssetDetails as aG, type IssuanceResult as aH, type DelegateInfo as aI, type MigrationGlobalSkipReason as aJ, type MigrationLegSkipReason as aK, type SignerStatus as aL, type StorageConfig as aM, type IVtxoManager as aN, type ExplorerTransaction as aO, type EncodedVtxoScript as aP, type Status as aQ, type ChainTx as aR, type PathContext as aS, type ActivityIntent as aT, type ActivityResolver as aU, type ArkIntentState as aV, type ArkTapscript as aW, type AssetMetadata as aX, type BaseWalletConfig as aY, type BatchInfo as aZ, type BatchSignableIdentity as a_, ArkAddress as aa, type Coin as ab, ContractManager as ac, type ContractManagerConfig as ad, CSVMultisigTapscript as ae, type SettlementConfig as af, VtxoManager as ag, type SignerSession as ah, type SignedIntent as ai, Intent as aj, type TimeHeight as ak, type DescriptorSigningRequest as al, Transaction as am, type IntentFeeConfig as an, type OffchainInput as ao, FeeAmount as ap, type OnchainInput as aq, type FeeOutput as ar, type ContractWatcherConfig as as, type Asset as at, type FeeInfo as au, type CreateContractParams as av, type GetContractsFilter as aw, type GetSpendablePathsOptions as ax, type GetAllSpendingPathsOptions as ay, type IssuanceParams as az, type WalletConfig as b, type VirtualStatus as b$, type CandidateDeps as b0, ChainTxType as b1, type CommitmentTx as b2, ConditionCSVMultisigTapscript as b3, ConditionMultisigTapscript as b4, type ContractBalance as b5, type ContractEventCallback as b6, type ContractHandler as b7, type ContractState as b8, type ContractVtxo as b9, type Output as bA, type PageResponse as bB, type PaginationOptions as bC, PartialSig as bD, type ProviderClass as bE, RestDelegateProvider as bF, RestDelegatorProvider as bG, type ScanContractsOptions as bH, type ScanResult as bI, type ScheduledSession as bJ, SettlementEventType as bK, type SignRequest as bL, type SignerClassification as bM, type SignerSet as bN, type SubscriptionEvent as bO, type SubscriptionHeartbeat as bP, type TapLeaves as bQ, TapTreeCoder as bR, TapscriptType as bS, type TreeNonces as bT, type TreePartialSigs as bU, type Tx as bV, type TxHistoryRecord as bW, type TxKey as bX, type TxTag as bY, type TxTreeNode as bZ, TxType as b_, ContractWatcher as ba, DelegateManagerImpl as bb, type DelegateOptions as bc, DelegatorManagerImpl as bd, type DelegatorProvider as be, type DeprecatedSignerMigrationReport as bf, type DeprecatedSignerReport as bg, DigestMismatchError as bh, type Discoverable as bi, type DiscoveredContract as bj, type DiscoveryDeps as bk, ESPLORA_URL as bl, EsploraProvider as bm, type ExitChainResolver as bn, type ExtendedContractVtxo as bo, type GroupMembership as bp, type HandlerError as bq, type IDelegatorManager as br, INTENT_TERMINAL_STATES as bs, IndexerTxType as bt, type KnownMetadata as bu, type MigrateDeprecatedSignerOptions as bv, type MigrationLegReport as bw, type MigrationVtxoRef as bx, MultisigTapscript as by, type Nonces as bz, type WalletBalance as c, type Vtxo as c0, type VtxoChain as c1, type VtxoType as c2, type WalletMode as c3, assetMintResolver as c4, boardingResolver as c5, canRecoverOnchain as c6, canSpendOffchain as c7, classifyAgainstSignerSet as c8, classifyContractSigner as c9, collabExitResolver as ca, createDefaultActivityRegistry as cb, createExitChainResolver as cc, decodeTapscript as cd, getNetwork as ce, getSequence as cf, hasCandidates as cg, hasTerminalSpend as ch, isBatchSignable as ci, isCooperativelyMigratable as cj, isDiscoverable as ck, isExpired as cl, isPastExpiry as cm, isRecoverable as cn, isSpendable as co, isSubdust as cp, isTerminalIntentState as cq, isVirtualCoin as cr, isVtxoExpiringSoon as cs, networks as ct, scriptFromTapLeafScript as cu, signerSetFromInfo as cv, toXOnlySignerHex as cw, type TapscriptDeriving as cx, ActivityRegistry as d, type Activity as e, type IContractManager as f, type IDelegateManager as g, type SettleParams as h, type SettlementEvent as i, type IAssetManager as j, RestArkProvider as k, RestIndexerProvider as l, type SubscriptionResponse as m, type ArkProvider as n, type IndexerProvider as o, type RelativeTimelock as p, type TapLeafScript as q, type VirtualCoin as r, type Contract as s, type ExtendedVirtualCoin 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-B7svzMhT.cjs';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-RwUvgQ5M.cjs';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-nzJFH8qb.js';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-Bgs-0I3x.js';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk3YC3LQ2E_cjs = require('./chunk-3YC3LQ2E.cjs');
4
- var chunkE7HB3GKK_cjs = require('./chunk-E7HB3GKK.cjs');
3
+ var chunkZPL34T2Q_cjs = require('./chunk-ZPL34T2Q.cjs');
4
+ var chunkOWCPXRGP_cjs = require('./chunk-OWCPXRGP.cjs');
5
5
 
6
6
  // src/worker/expo/taskRunner.ts
7
7
  async function runTasks(queue, processors, deps) {
@@ -33,7 +33,7 @@ async function runTasks(queue, processors, deps) {
33
33
  }
34
34
  const result = {
35
35
  ...partial,
36
- id: chunk3YC3LQ2E_cjs.getRandomId(),
36
+ id: chunkZPL34T2Q_cjs.getRandomId(),
37
37
  executedAt: Date.now()
38
38
  };
39
39
  await queue.pushResult(result);
@@ -45,7 +45,7 @@ async function runTasks(queue, processors, deps) {
45
45
  function createTaskDependencies(options) {
46
46
  return {
47
47
  ...options,
48
- extendVtxo: (vtxo, contract) => chunk3YC3LQ2E_cjs.extendVirtualCoinForContract(vtxo, contract)
48
+ extendVtxo: (vtxo, contract) => chunkZPL34T2Q_cjs.extendVirtualCoinForContract(vtxo, contract)
49
49
  };
50
50
  }
51
51
 
@@ -64,7 +64,7 @@ var contractPollProcessor = {
64
64
  let hasMore = true;
65
65
  const allVtxos = [];
66
66
  while (hasMore) {
67
- const { vtxos, page } = await chunkE7HB3GKK_cjs.getNormalizedVtxos(indexerProvider, {
67
+ const { vtxos, page } = await chunkOWCPXRGP_cjs.getNormalizedVtxos(indexerProvider, {
68
68
  scripts: [contract.script],
69
69
  pageIndex,
70
70
  pageSize
@@ -75,12 +75,12 @@ var contractPollProcessor = {
75
75
  hasMore = page ? vtxos.length === pageSize : false;
76
76
  pageIndex++;
77
77
  }
78
- const filtered = chunk3YC3LQ2E_cjs.warnAndFilterVtxosForScript(
78
+ const filtered = chunkZPL34T2Q_cjs.warnAndFilterVtxosForScript(
79
79
  allVtxos,
80
80
  contract.script,
81
81
  "contractPollProcessor"
82
82
  );
83
- await chunk3YC3LQ2E_cjs.saveVtxosForContract(walletRepository, contract, filtered);
83
+ await chunkZPL34T2Q_cjs.saveVtxosForContract(walletRepository, contract, filtered);
84
84
  vtxosSaved += filtered.length;
85
85
  contractsProcessed++;
86
86
  }
@@ -97,5 +97,5 @@ exports.CONTRACT_POLL_TASK_TYPE = CONTRACT_POLL_TASK_TYPE;
97
97
  exports.contractPollProcessor = contractPollProcessor;
98
98
  exports.createTaskDependencies = createTaskDependencies;
99
99
  exports.runTasks = runTasks;
100
- //# sourceMappingURL=chunk-CZTQLA55.cjs.map
101
- //# sourceMappingURL=chunk-CZTQLA55.cjs.map
100
+ //# sourceMappingURL=chunk-C6UYPHTQ.cjs.map
101
+ //# sourceMappingURL=chunk-C6UYPHTQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":["getRandomId","extendVirtualCoinForContract","getNormalizedVtxos","warnAndFilterVtxosForScript","saveVtxosForContract"],"mappings":";;;;;;AAkDA,eAAsB,QAAA,CAClB,KAAA,EACA,UAAA,EACA,IAAA,EACqB;AACrB,EAAA,MAAM,KAAA,GAAQ,MAAM,KAAA,CAAM,QAAA,EAAS;AACnC,EAAA,MAAM,YAAA,GAAe,IAAI,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,CAAC,CAAA,CAAE,QAAA,EAAU,CAAC,CAAC,CAAC,CAAA;AACnE,EAAA,MAAM,UAAwB,EAAC;AAE/B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACtB,IAAA,MA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A,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-CZTQLA55.cjs","sourcesContent":["import type { TaskItem, TaskResult, TaskQueue } from \"./taskQueue\";\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { IndexerProvider } from \"../../providers/indexer\";\nimport type { ArkProvider } from \"../../providers/ark\";\nimport type { ExtendedVirtualCoin, VirtualCoin } from \"../../wallet\";\nimport type { Contract } from \"../../contracts/types\";\nimport { getRandomId, extendVirtualCoinForContract } from \"../../wallet/utils\";\n\n/**\n * Shared dependencies injected into every processor at runtime.\n *\n * `extendVtxo` requires the owning contract — processors must resolve each\n * vtxo's `script` to a known contract (via the contract repository) before\n * calling this. The strict signature prevents the footgun where a missing\n * contract silently falls back to the wallet's default tapscript.\n */\nexport interface TaskDependencies {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) => ExtendedVirtualCoin;\n}\n\n/**\n * A stateless unit that handles one type of task item.\n *\n * Processors must not keep in-memory state across invocations —\n * all coordination lives in the @see TaskQueue and repositories.\n *\n * The `TDeps` parameter defaults to @see TaskDependencies but\n * can be overridden for domain-specific processors (e.g. swap processing).\n */\nexport interface TaskProcessor<TDeps = TaskDependencies> {\n readonly taskType: string;\n execute(item: TaskItem, deps: TDeps): Promise<Omit<TaskResult, \"id\" | \"executedAt\">>;\n}\n\n/**\n * Run all pending tasks from the queue through matching processors.\n *\n * For each task in the inbox:\n * 1. Find the processor whose `taskType` matches `task.type`.\n * 2. Execute it, producing a @see TaskResult.\n * 3. Push the result to the outbox and remove the task from the inbox.\n *\n * Tasks with no matching processor produce a `\"noop\"` result.\n * Processor errors produce a `\"failed\"` result with the error message.\n */\nexport async function runTasks<TDeps = TaskDependencies>(\n queue: TaskQueue,\n processors: TaskProcessor<TDeps>[],\n deps: TDeps,\n): Promise<TaskResult[]> {\n const tasks = await queue.getTasks();\n const processorMap = new Map(processors.map((p) => [p.taskType, p]));\n const results: TaskResult[] = [];\n\n for (const task of tasks) {\n const processor = processorMap.get(task.type);\n\n let partial: Omit<TaskResult, \"id\" | \"executedAt\">;\n\n if (!processor) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"noop\",\n };\n } else {\n try {\n partial = await processor.execute(task, deps);\n } catch (error) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"failed\",\n data: {\n error: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n const result: TaskResult = {\n ...partial,\n id: getRandomId(),\n executedAt: Date.now(),\n };\n\n await queue.pushResult(result);\n await queue.removeTask(task.id);\n results.push(result);\n }\n\n return results;\n}\n\n/**\n * Options for @see createTaskDependencies.\n */\nexport interface CreateTaskDependenciesOptions {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n}\n\n/**\n * Build the @see TaskDependencies needed by task processors\n * (e.g. `src/worker/expo/processors/contractPollProcessor.ts`)\n *\n * This is the same construction that `defineExpoBackgroundTask` does\n * internally, extracted so that consumers with custom schedulers\n * (e.g. bare React Native with `react-native-background-fetch`)\n * can build deps without depending on Expo.\n */\nexport function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies {\n return {\n ...options,\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) =>\n extendVirtualCoinForContract(vtxo, contract),\n };\n}\n","import type { TaskItem, TaskResult } from \"../taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../taskRunner\";\nimport type { ExtendedVirtualCoin } from \"../../../wallet\";\nimport { getNormalizedVtxos } from \"../../../wallet/vtxo\";\nimport {\n warnAndFilterVtxosForScript,\n saveVtxosForContract,\n} from \"../../../contracts/vtxoOwnership\";\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 getNormalizedVtxos(indexerProvider, {\n scripts: [contract.script],\n pageIndex,\n pageSize,\n });\n\n for (const vtxo of vtxos) {\n allVtxos.push(extendVtxo(vtxo, contract));\n }\n\n hasMore = page ? vtxos.length === pageSize : false;\n pageIndex++;\n }\n\n // Skip wrong-script rows (legacy duplicates or indexer drift)\n // before persisting; the loop must keep going for the remaining\n // contracts even when one row is rejected.\n const filtered = warnAndFilterVtxosForScript(\n allVtxos,\n contract.script,\n \"contractPollProcessor\",\n );\n await saveVtxosForContract(walletRepository, contract, filtered);\n vtxosSaved += filtered.length;\n contractsProcessed++;\n }\n\n return {\n taskItemId: item.id,\n type: CONTRACT_POLL_TASK_TYPE,\n status: \"success\",\n data: { contractsProcessed, vtxosSaved },\n };\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/worker/expo/taskRunner.ts","../src/worker/expo/processors/contractPollProcessor.ts"],"names":["getRandomId","extendVirtualCoinForContract","getNormalizedVtxos","warnAndFilterVtxosForScript","saveVtxosForContract"],"mappings":";;;;;;AAkDA,eAAsB,QAAA,CAClB,KAAA,EACA,UAAA,EACA,IAAA,EACqB;AACrB,EAAA,MAAM,KAAA,GAAQ,MAAM,KAAA,CAAM,QAAA,EAAS;AACnC,EAAA,MAAM,YAAA,GAAe,IAAI,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,CAAC,CAAA,CAAE,QAAA,EAAU,CAAC,CAAC,CAAC,CAAA;AACnE,EAAA,MAAM,UAAwB,EAAC;AAE/B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACtB,IAAA,MAAM,SAAA,GAAY,YAAA,CAAa,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA;AAE5C,IAAA,IAAI,OAAA;AAEJ,IAAA,IAAI,CAAC,SAAA,EAAW;AACZ,MAAA,OAAA,GAAU;AAAA,QACN,YAAY,IAAA,CAAK,EAAA;AAAA,QACjB,MAAM,IAAA,CAAK,IAAA;AAAA,QACX,MAAA,EAAQ;AAAA,OACZ;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,IAAI;AACA,QAAA,OAAA,GAAU,MAAM,SAAA,CAAU,OAAA,CAAQ,IAAA,EAAM,IAAI,CAAA;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,S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,QAAA,CAAS,MAAM,CAAA;AAAA,UACzB,SAAA;AAAA,UACA;AAAA,SACH,CAAA;AAED,QAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACtB,UAAA,QAAA,CAAS,IAAA,CAAK,UAAA,CAAW,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,QAC5C;AAEA,QAAA,OAAA,GAAU,IAAA,GAAO,KAAA,CAAM,MAAA,KAAW,QAAA,GAAW,KAAA;AAC7C,QAAA,SAAA,EAAA;AAAA,MACJ;AAKA,MAAA,MAAM,QAAA,GAAWC,6CAAA;AAAA,QACb,QAAA;AAAA,QACA,QAAA,CAAS,MAAA;AAAA,QACT;AAAA,OACJ;AACA,MAAA,MAAMC,sCAAA,CAAqB,gBAAA,EAAkB,QAAA,EAAU,QAAQ,CAAA;AAC/D,MAAA,UAAA,IAAc,QAAA,CAAS,MAAA;AACvB,MAAA,kBAAA,EAAA;AAAA,IACJ;AAEA,IAAA,OAAO;AAAA,MACH,YAAY,IAAA,CAAK,EAAA;AAAA,MACjB,IAAA,EAAM,uBAAA;AAAA,MACN,MAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAM,EAAE,kBAAA,EAAoB,UAAA;AAAW,KAC3C;AAAA,EACJ;AACJ","file":"chunk-C6UYPHTQ.cjs","sourcesContent":["import type { TaskItem, TaskResult, TaskQueue } from \"./taskQueue\";\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { IndexerProvider } from \"../../providers/indexer\";\nimport type { ArkProvider } from \"../../providers/ark\";\nimport type { ExtendedVirtualCoin, VirtualCoin } from \"../../wallet\";\nimport type { Contract } from \"../../contracts/types\";\nimport { getRandomId, extendVirtualCoinForContract } from \"../../wallet/utils\";\n\n/**\n * Shared dependencies injected into every processor at runtime.\n *\n * `extendVtxo` requires the owning contract — processors must resolve each\n * vtxo's `script` to a known contract (via the contract repository) before\n * calling this. The strict signature prevents the footgun where a missing\n * contract silently falls back to the wallet's default tapscript.\n */\nexport interface TaskDependencies {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) => ExtendedVirtualCoin;\n}\n\n/**\n * A stateless unit that handles one type of task item.\n *\n * Processors must not keep in-memory state across invocations —\n * all coordination lives in the @see TaskQueue and repositories.\n *\n * The `TDeps` parameter defaults to @see TaskDependencies but\n * can be overridden for domain-specific processors (e.g. swap processing).\n */\nexport interface TaskProcessor<TDeps = TaskDependencies> {\n readonly taskType: string;\n execute(item: TaskItem, deps: TDeps): Promise<Omit<TaskResult, \"id\" | \"executedAt\">>;\n}\n\n/**\n * Run all pending tasks from the queue through matching processors.\n *\n * For each task in the inbox:\n * 1. Find the processor whose `taskType` matches `task.type`.\n * 2. Execute it, producing a @see TaskResult.\n * 3. Push the result to the outbox and remove the task from the inbox.\n *\n * Tasks with no matching processor produce a `\"noop\"` result.\n * Processor errors produce a `\"failed\"` result with the error message.\n */\nexport async function runTasks<TDeps = TaskDependencies>(\n queue: TaskQueue,\n processors: TaskProcessor<TDeps>[],\n deps: TDeps,\n): Promise<TaskResult[]> {\n const tasks = await queue.getTasks();\n const processorMap = new Map(processors.map((p) => [p.taskType, p]));\n const results: TaskResult[] = [];\n\n for (const task of tasks) {\n const processor = processorMap.get(task.type);\n\n let partial: Omit<TaskResult, \"id\" | \"executedAt\">;\n\n if (!processor) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"noop\",\n };\n } else {\n try {\n partial = await processor.execute(task, deps);\n } catch (error) {\n partial = {\n taskItemId: task.id,\n type: task.type,\n status: \"failed\",\n data: {\n error: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n const result: TaskResult = {\n ...partial,\n id: getRandomId(),\n executedAt: Date.now(),\n };\n\n await queue.pushResult(result);\n await queue.removeTask(task.id);\n results.push(result);\n }\n\n return results;\n}\n\n/**\n * Options for @see createTaskDependencies.\n */\nexport interface CreateTaskDependenciesOptions {\n walletRepository: WalletRepository;\n contractRepository: ContractRepository;\n indexerProvider: IndexerProvider;\n arkProvider: ArkProvider;\n}\n\n/**\n * Build the @see TaskDependencies needed by task processors\n * (e.g. `src/worker/expo/processors/contractPollProcessor.ts`)\n *\n * This is the same construction that `defineExpoBackgroundTask` does\n * internally, extracted so that consumers with custom schedulers\n * (e.g. bare React Native with `react-native-background-fetch`)\n * can build deps without depending on Expo.\n */\nexport function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies {\n return {\n ...options,\n extendVtxo: (vtxo: VirtualCoin, contract: Contract) =>\n extendVirtualCoinForContract(vtxo, contract),\n };\n}\n","import type { TaskItem, TaskResult } from \"../taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../taskRunner\";\nimport type { ExtendedVirtualCoin } from \"../../../wallet\";\nimport { getNormalizedVtxos } from \"../../../wallet/vtxo\";\nimport {\n warnAndFilterVtxosForScript,\n saveVtxosForContract,\n} from \"../../../contracts/vtxoOwnership\";\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 getNormalizedVtxos(indexerProvider, {\n scripts: [contract.script],\n pageIndex,\n pageSize,\n });\n\n for (const vtxo of vtxos) {\n allVtxos.push(extendVtxo(vtxo, contract));\n }\n\n hasMore = page ? vtxos.length === pageSize : false;\n pageIndex++;\n }\n\n // Skip wrong-script rows (legacy duplicates or indexer drift)\n // before persisting; the loop must keep going for the remaining\n // contracts even when one row is rejected.\n const filtered = warnAndFilterVtxosForScript(\n allVtxos,\n contract.script,\n \"contractPollProcessor\",\n );\n await saveVtxosForContract(walletRepository, contract, filtered);\n vtxosSaved += filtered.length;\n contractsProcessed++;\n }\n\n return {\n taskItemId: item.id,\n type: CONTRACT_POLL_TASK_TYPE,\n status: \"success\",\n data: { contractsProcessed, vtxosSaved },\n };\n },\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkRNMLFY2V_cjs = require('./chunk-RNMLFY2V.cjs');
4
- var chunkE7HB3GKK_cjs = require('./chunk-E7HB3GKK.cjs');
3
+ var chunkG7DOBFQN_cjs = require('./chunk-G7DOBFQN.cjs');
4
+ var chunkOWCPXRGP_cjs = require('./chunk-OWCPXRGP.cjs');
5
5
 
6
6
  // src/providers/expoUtils.ts
7
7
  async function getExpoFetch(options) {
@@ -10,8 +10,8 @@ async function getExpoFetch(options) {
10
10
  console.debug("Using expo/fetch for streaming");
11
11
  const expoFetchWithHeader = (input, init) => {
12
12
  const headers = new Headers(init?.headers);
13
- headers.set("X-Build-Version", chunkRNMLFY2V_cjs.buildVersion);
14
- headers.set("X-SDK-VERSION", chunkRNMLFY2V_cjs.sdkVersion);
13
+ headers.set("X-Build-Version", chunkOWCPXRGP_cjs.buildVersion);
14
+ headers.set("X-SDK-VERSION", chunkOWCPXRGP_cjs.sdkVersion);
15
15
  return expoFetchModule.fetch(input, { ...init, headers });
16
16
  };
17
17
  return expoFetchWithHeader;
@@ -20,7 +20,7 @@ async function getExpoFetch(options) {
20
20
  "Using standard fetch instead of expo/fetch. Streaming may not be fully supported in some environments.",
21
21
  error
22
22
  );
23
- return chunkRNMLFY2V_cjs.fetch;
23
+ return chunkOWCPXRGP_cjs.fetch;
24
24
  }
25
25
  }
26
26
  async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData) {
@@ -77,8 +77,8 @@ async function* sseStreamIterator(url, abortSignal, fetchFn, headers, parseData)
77
77
  }
78
78
 
79
79
  // src/providers/expoArk.ts
80
- var ExpoArkProvider = class extends chunkRNMLFY2V_cjs.RestArkProvider {
81
- constructor(serverUrl = chunkE7HB3GKK_cjs.DEFAULT_ARKADE_SERVER_URL) {
80
+ var ExpoArkProvider = class extends chunkOWCPXRGP_cjs.RestArkProvider {
81
+ constructor(serverUrl = chunkOWCPXRGP_cjs.DEFAULT_ARKADE_SERVER_URL) {
82
82
  super(serverUrl);
83
83
  }
84
84
  async *getEventStream(signal, topics) {
@@ -98,7 +98,7 @@ var ExpoArkProvider = class extends chunkRNMLFY2V_cjs.RestArkProvider {
98
98
  if (error instanceof Error && error.name === "AbortError") {
99
99
  break;
100
100
  }
101
- if (chunkRNMLFY2V_cjs.isFetchTimeoutError(error)) {
101
+ if (chunkOWCPXRGP_cjs.isFetchTimeoutError(error)) {
102
102
  console.debug("Timeout error ignored");
103
103
  continue;
104
104
  }
@@ -119,7 +119,7 @@ var ExpoArkProvider = class extends chunkRNMLFY2V_cjs.RestArkProvider {
119
119
  if (error instanceof Error && error.name === "AbortError") {
120
120
  break;
121
121
  }
122
- if (chunkRNMLFY2V_cjs.isFetchTimeoutError(error)) {
122
+ if (chunkOWCPXRGP_cjs.isFetchTimeoutError(error)) {
123
123
  console.debug("Timeout error ignored");
124
124
  continue;
125
125
  }
@@ -131,8 +131,8 @@ var ExpoArkProvider = class extends chunkRNMLFY2V_cjs.RestArkProvider {
131
131
  };
132
132
 
133
133
  // src/providers/expoIndexer.ts
134
- var ExpoIndexerProvider = class extends chunkRNMLFY2V_cjs.RestIndexerProvider {
135
- constructor(serverUrl = chunkE7HB3GKK_cjs.DEFAULT_ARKADE_SERVER_URL) {
134
+ var ExpoIndexerProvider = class extends chunkG7DOBFQN_cjs.RestIndexerProvider {
135
+ constructor(serverUrl = chunkOWCPXRGP_cjs.DEFAULT_ARKADE_SERVER_URL) {
136
136
  super(serverUrl);
137
137
  }
138
138
  async *getSubscription(subscriptionId, abortSignal) {
@@ -161,9 +161,9 @@ var ExpoIndexerProvider = class extends chunkRNMLFY2V_cjs.RestIndexerProvider {
161
161
  return {
162
162
  txid: data.event.txid,
163
163
  scripts: data.event.scripts || [],
164
- newVtxos: (data.event.newVtxos || []).map(chunkE7HB3GKK_cjs.convertVtxo),
165
- spentVtxos: (data.event.spentVtxos || []).map(chunkE7HB3GKK_cjs.convertVtxo),
166
- sweptVtxos: (data.event.sweptVtxos || []).map(chunkE7HB3GKK_cjs.convertVtxo),
164
+ newVtxos: (data.event.newVtxos || []).map(chunkOWCPXRGP_cjs.convertVtxo),
165
+ spentVtxos: (data.event.spentVtxos || []).map(chunkOWCPXRGP_cjs.convertVtxo),
166
+ sweptVtxos: (data.event.sweptVtxos || []).map(chunkOWCPXRGP_cjs.convertVtxo),
167
167
  tx: data.event.tx,
168
168
  checkpointTxs: data.event.checkpointTxs
169
169
  };
@@ -175,7 +175,7 @@ var ExpoIndexerProvider = class extends chunkRNMLFY2V_cjs.RestIndexerProvider {
175
175
  if (error instanceof Error && error.name === "AbortError") {
176
176
  break;
177
177
  }
178
- if (chunkRNMLFY2V_cjs.isFetchTimeoutError(error)) {
178
+ if (chunkOWCPXRGP_cjs.isFetchTimeoutError(error)) {
179
179
  console.debug("Timeout error ignored");
180
180
  continue;
181
181
  }
@@ -188,5 +188,5 @@ var ExpoIndexerProvider = class extends chunkRNMLFY2V_cjs.RestIndexerProvider {
188
188
 
189
189
  exports.ExpoArkProvider = ExpoArkProvider;
190
190
  exports.ExpoIndexerProvider = ExpoIndexerProvider;
191
- //# sourceMappingURL=chunk-4GB73TRR.cjs.map
192
- //# sourceMappingURL=chunk-4GB73TRR.cjs.map
191
+ //# sourceMappingURL=chunk-CSS74VCN.cjs.map
192
+ //# sourceMappingURL=chunk-CSS74VCN.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/providers/expoUtils.ts","../src/providers/expoArk.ts","../src/providers/expoIndexer.ts"],"names":["buildVersion","sdkVersion","fetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAO,YAAY,CAAA;AACjD,IAAA,OAAA,CAAQ,MAAM,gCAAgC,CAAA;AAC9C,IAAA,MAAM,mBAAA,GAAsB,CAAC,KAAA,EAAoB,IAAA,KAAuB;AACpE,MAAA,MAAM,OAAA,GAAU,IAAI,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA;AACzC,MAAA,OAAA,CAAQ,GAAA,CAAI,mBAAmBA,8BAAY,CAAA;AAC3C,MAAA,OAAA,CAAQ,GAAA,CAAI,iBAAiBC,4BAAU,CAAA;AACvC,MAAA,OAAO,gBAAgB,KAAA,CAAM,KAAA,EAAO,EAAE,GAAG,IAAA,EAAM,SAAS,CAAA;AAAA,IAC5D,CAAA;AACA,IAAA,OAAO,mBAAA;AAAA,EACX,SAAS,KAAA,EAAO;AAQZ,IAAA,OAAA,CAAQ,IAAA;AAAA,MACJ,wGAAA;AAAA,MAEA;AAAA,KACJ;AACA,IAAA,OAAOC,uBAAA;AAAA,EACX;AACJ;AAYA,gBAAuB,iBAAA,CACnB,GAAA,EACA,WAAA,EACA,OAAA,EACA,SACA,SAAA,EACgC;AAChC,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,CAAC,IAAA,KAAsC;AAEnC,YAAA,IAAI,IAAA,CAAK,cAAc,KAAA,CAAA,EAAW;AAE9B,cAAA,OAAO,IAAA;AAAA,YACX;AAEA,YAAA,IAAI,KAAK,KAAA,EAAO;AACZ,cAAA,OAAO;AAAA,gBACH,IAAA,EAAM,KAAK,KAAA,CAAM,IAAA;AAAA,gBACjB,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,OAAA,IAAW,EAAC;AAAA,gBAChC,WAAW,IAAA,CAAK,KAAA,CAAM,YAAY,EAAC,EAAG,IAAIG,6BAAW,CAAA;AAAA,gBACrD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAIA,6BAAW,CAAA;AAAA,gBACzD,aAAa,IAAA,CAAK,KAAA,CAAM,cAAc,EAAC,EAAG,IAAIA,6BAAW,CAAA;AAAA,gBACzD,EAAA,EAAI,KAAK,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,IAAIF,qCAAA,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-4GB73TRR.cjs","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 } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\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":["buildVersion","sdkVersion","fetch","RestArkProvider","DEFAULT_ARKADE_SERVER_URL","isFetchTimeoutError","RestIndexerProvider","convertVtxo"],"mappings":";;;;;;AAMA,eAAsB,aAAa,OAAA,EAA4D;AAG3F,EAAA,IAAI;AACA,IAAA,MAAM,eAAA,GAAkB,MAAM,O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AI,KAAK,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,IAAIF,qCAAA,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-CSS74VCN.cjs","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 } from \"./indexer\";\nimport { isFetchTimeoutError } from \"./ark\";\nimport { convertVtxo } from \"../wallet/vtxo\";\nimport { getExpoFetch, sseStreamIterator } from \"./expoUtils\";\nimport { DEFAULT_ARKADE_SERVER_URL } from \"../networks\";\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"]}