@arkade-os/sdk 0.5.3 → 0.5.5

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 (114) hide show
  1. package/README.md +138 -50
  2. package/dist/adapters/expo.cjs +10 -5
  3. package/dist/adapters/expo.d.cts +13 -8
  4. package/dist/adapters/expo.d.ts +13 -8
  5. package/dist/adapters/expo.js +4 -3
  6. package/dist/{asyncStorageTaskQueue-C9PkPcW_.d.cts → asyncStorageTaskQueue-BbH-THYJ.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-B3U5gQ-i.d.ts → asyncStorageTaskQueue-BlvkJyTa.d.ts} +2 -2
  8. package/dist/base-C-Y5t_0F.d.cts +359 -0
  9. package/dist/base-C-Y5t_0F.d.ts +359 -0
  10. package/dist/{chunk-OPX2HRWM.js → chunk-4I53THL6.js} +210 -937
  11. package/dist/chunk-4I53THL6.js.map +1 -0
  12. package/dist/{chunk-5WRA66RV.cjs → chunk-5SYUEVJH.cjs} +10 -10
  13. package/dist/chunk-5SYUEVJH.cjs.map +1 -0
  14. package/dist/{chunk-6FL4N4S2.js → chunk-7GIKLFHC.js} +83 -20
  15. package/dist/chunk-7GIKLFHC.js.map +1 -0
  16. package/dist/{chunk-BYPBVHVA.cjs → chunk-AMH7Q3DF.cjs} +61 -935
  17. package/dist/chunk-AMH7Q3DF.cjs.map +1 -0
  18. package/dist/{chunk-P7B4LQ3H.js → chunk-BCA6D255.js} +18 -842
  19. package/dist/chunk-BCA6D255.js.map +1 -0
  20. package/dist/{chunk-T7C3E2HL.js → chunk-CE46RS6L.js} +20 -39
  21. package/dist/chunk-CE46RS6L.js.map +1 -0
  22. package/dist/chunk-DNFTHG73.js +829 -0
  23. package/dist/chunk-DNFTHG73.js.map +1 -0
  24. package/dist/chunk-FDJ734CH.js +882 -0
  25. package/dist/chunk-FDJ734CH.js.map +1 -0
  26. package/dist/chunk-FLPWNMX3.cjs +930 -0
  27. package/dist/chunk-FLPWNMX3.cjs.map +1 -0
  28. package/dist/{chunk-Y4BL3YYX.js → chunk-FVVXCDNE.js} +4 -4
  29. package/dist/chunk-FVVXCDNE.js.map +1 -0
  30. package/dist/{chunk-ZPF4I3K2.cjs → chunk-HQQ4NRXI.cjs} +29 -47
  31. package/dist/chunk-HQQ4NRXI.cjs.map +1 -0
  32. package/dist/chunk-JFJNB7ZH.cjs +884 -0
  33. package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
  34. package/dist/{chunk-KW7ZEWYS.cjs → chunk-KCL5AVML.cjs} +223 -985
  35. package/dist/chunk-KCL5AVML.cjs.map +1 -0
  36. package/dist/{chunk-HAQAWBYG.js → chunk-OO2KEK64.js} +2860 -1366
  37. package/dist/chunk-OO2KEK64.js.map +1 -0
  38. package/dist/{chunk-OUTWUYJ4.cjs → chunk-T254PXSN.cjs} +3337 -1824
  39. package/dist/chunk-T254PXSN.cjs.map +1 -0
  40. package/dist/chunk-V3ZLL5VY.js +380 -0
  41. package/dist/chunk-V3ZLL5VY.js.map +1 -0
  42. package/dist/chunk-X6ZI53DZ.cjs +383 -0
  43. package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
  44. package/dist/{chunk-ZMSM3NOH.cjs → chunk-XWUCNMPN.cjs} +98 -34
  45. package/dist/chunk-XWUCNMPN.cjs.map +1 -0
  46. package/dist/compiler.cjs +50 -0
  47. package/dist/compiler.cjs.map +1 -0
  48. package/dist/compiler.d.cts +38 -0
  49. package/dist/compiler.d.ts +38 -0
  50. package/dist/compiler.js +47 -0
  51. package/dist/compiler.js.map +1 -0
  52. package/dist/contracts/handlers/index.cjs +11 -9
  53. package/dist/contracts/handlers/index.d.cts +6 -4
  54. package/dist/contracts/handlers/index.d.ts +6 -4
  55. package/dist/contracts/handlers/index.js +4 -2
  56. package/dist/{delegate-Cd28gxpM.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
  57. package/dist/{delegate-ByfKszb6.d.cts → delegate-iyDum4fw.d.ts} +1 -1
  58. package/dist/{index-B6X2E7W_.d.ts → index-BWwVnJhU.d.cts} +7 -272
  59. package/dist/{index-DgH_0j14.d.cts → index-Bx-iArDs.d.ts} +7 -272
  60. package/dist/{index-BURzbRup.d.cts → index-DCml4QJn.d.ts} +1090 -1140
  61. package/dist/{index-BURzbRup.d.ts → index-DkyzIzKL.d.cts} +1090 -1140
  62. package/dist/index.cjs +470 -371
  63. package/dist/index.d.cts +687 -410
  64. package/dist/index.d.ts +687 -410
  65. package/dist/index.js +7 -4
  66. package/dist/{wallet-BnmhohgZ.d.ts → keyringDescriptorProvider-CS4w4PWd.d.ts} +427 -372
  67. package/dist/{wallet-BjQugVUt.d.cts → keyringDescriptorProvider-CmHXrIXd.d.cts} +427 -372
  68. package/dist/program-BARSNg3X.d.ts +286 -0
  69. package/dist/program-znrWkxE4.d.cts +286 -0
  70. package/dist/repositories/realm/index.cjs +100 -51
  71. package/dist/repositories/realm/index.cjs.map +1 -1
  72. package/dist/repositories/realm/index.d.cts +25 -10
  73. package/dist/repositories/realm/index.d.ts +25 -10
  74. package/dist/repositories/realm/index.js +72 -24
  75. package/dist/repositories/realm/index.js.map +1 -1
  76. package/dist/repositories/sqlite/index.cjs +222 -131
  77. package/dist/repositories/sqlite/index.cjs.map +1 -1
  78. package/dist/repositories/sqlite/index.d.cts +36 -17
  79. package/dist/repositories/sqlite/index.d.ts +36 -17
  80. package/dist/repositories/sqlite/index.js +196 -107
  81. package/dist/repositories/sqlite/index.js.map +1 -1
  82. package/dist/{taskRunner-BaNCSxqK.d.ts → taskRunner-DgMLSk_O.d.ts} +4 -4
  83. package/dist/{taskRunner-i56-drQV.d.cts → taskRunner-buh6aFpG.d.cts} +4 -4
  84. package/dist/wallet/expo/background.cjs +17 -14
  85. package/dist/wallet/expo/background.cjs.map +1 -1
  86. package/dist/wallet/expo/background.d.cts +5 -4
  87. package/dist/wallet/expo/background.d.ts +5 -4
  88. package/dist/wallet/expo/background.js +10 -7
  89. package/dist/wallet/expo/background.js.map +1 -1
  90. package/dist/wallet/expo/index.cjs +29 -16
  91. package/dist/wallet/expo/index.cjs.map +1 -1
  92. package/dist/wallet/expo/index.d.cts +12 -7
  93. package/dist/wallet/expo/index.d.ts +12 -7
  94. package/dist/wallet/expo/index.js +20 -7
  95. package/dist/wallet/expo/index.js.map +1 -1
  96. package/dist/worker/expo/index.cjs +12 -9
  97. package/dist/worker/expo/index.cjs.map +1 -1
  98. package/dist/worker/expo/index.d.cts +6 -5
  99. package/dist/worker/expo/index.d.ts +6 -5
  100. package/dist/worker/expo/index.js +8 -5
  101. package/dist/worker/expo/index.js.map +1 -1
  102. package/package.json +16 -1
  103. package/dist/chunk-5WRA66RV.cjs.map +0 -1
  104. package/dist/chunk-6FL4N4S2.js.map +0 -1
  105. package/dist/chunk-BYPBVHVA.cjs.map +0 -1
  106. package/dist/chunk-HAQAWBYG.js.map +0 -1
  107. package/dist/chunk-KW7ZEWYS.cjs.map +0 -1
  108. package/dist/chunk-OPX2HRWM.js.map +0 -1
  109. package/dist/chunk-OUTWUYJ4.cjs.map +0 -1
  110. package/dist/chunk-P7B4LQ3H.js.map +0 -1
  111. package/dist/chunk-T7C3E2HL.js.map +0 -1
  112. package/dist/chunk-Y4BL3YYX.js.map +0 -1
  113. package/dist/chunk-ZMSM3NOH.cjs.map +0 -1
  114. package/dist/chunk-ZPF4I3K2.cjs.map +0 -1
@@ -1,13 +1,16 @@
1
- import { W as WalletRepository, P as PageRequest, O as Outpoint, F as PageResult, D as ExtendedVirtualCoin, H as ScriptVtxoCursor, J as ScriptVtxoPageOptions, K as StoredVtxo, L as VtxoRepositoryKey, E as ExtendedCoin, M as TransactionHistoryPageFilter, Q as TransactionHistoryPageCursor, h as ArkTransaction, U as WalletState, C as ContractRepository, X as ContractFilter, B as Contract, Y as IntentRepository, Z as ArkIntent, _ as IntentPageFilter, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch } from '../../index-BURzbRup.js';
2
- export { a2 as ChainedTxType } from '../../index-BURzbRup.js';
1
+ import { W as WalletRepository, Q as AtomicWalletState, P as PageRequest, B as Outpoint, D as PageResult, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, U as WalletState, C as ContractRepository, X as ContractFilter, y as Contract, Y as BatchRegistrationRepository, Z as ArkIntent, _ as IntentPageFilter, $ as BatchRegistration, a0 as VirtualTxRepository, a1 as VirtualTx, a2 as VtxoBranch } from '../../index-DCml4QJn.js';
2
+ export { a3 as ChainedTxType } from '../../index-DCml4QJn.js';
3
3
  import '@scure/btc-signer/utils.js';
4
- import '@scure/btc-signer/psbt.js';
5
4
  import '@scure/btc-signer';
5
+ import '@scure/btc-signer/psbt.js';
6
+ import '../../base-C-Y5t_0F.js';
6
7
  import '@scure/btc-signer/transaction.js';
7
8
 
8
9
  /**
9
10
  * Minimal SQL execution interface that consumers implement
10
11
  * to connect their SQLite (or any SQL) database to the SDK.
12
+ * Share one executor object per connection across SDK repositories; separate wrappers
13
+ * and direct raw-driver calls bypass the SDK operation queue.
11
14
  *
12
15
  * Example for expo-sqlite:
13
16
  * ```
@@ -27,6 +30,12 @@ interface SQLExecutor {
27
30
  interface SQLiteWalletRepositoryOptions {
28
31
  /** Table name prefix (default: "ark_") */
29
32
  prefix?: string;
33
+ /** Opt in only with a dedicated connection or all operations coordinated through
34
+ * getSerializedExecutor/runInTransaction on the same executor object. Default: false.
35
+ * All read-modify-write callers must use atomic updates; queued legacy updates can still race. */
36
+ walletStateTransactions?: boolean;
37
+ /** Caller asserts durable backing; requires walletStateTransactions. No storage detection. */
38
+ persistentWalletState?: boolean;
30
39
  }
31
40
  /**
32
41
  * SQLite-based implementation of WalletRepository.
@@ -38,8 +47,9 @@ interface SQLiteWalletRepositoryOptions {
38
47
  * The consumer owns the SQLExecutor lifecycle — `[Symbol.asyncDispose]` is a no-op.
39
48
  */
40
49
  declare class SQLiteWalletRepository implements WalletRepository {
41
- private readonly db;
42
50
  readonly version: 2;
51
+ readonly atomicWalletState?: AtomicWalletState;
52
+ private readonly db;
43
53
  private initPromise;
44
54
  private readonly prefix;
45
55
  private readonly tables;
@@ -103,6 +113,7 @@ declare class SQLiteWalletRepository implements WalletRepository {
103
113
  getTransactionHistoryPage(filter: TransactionHistoryPageFilter, page: PageRequest<TransactionHistoryPageCursor>): Promise<PageResult<ArkTransaction, TransactionHistoryPageCursor>>;
104
114
  saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
105
115
  deleteTransactions(address: string): Promise<void>;
116
+ private readonly atomicState;
106
117
  getWalletState(): Promise<WalletState | null>;
107
118
  saveWalletState(state: WalletState): Promise<void>;
108
119
  }
@@ -121,8 +132,8 @@ interface SQLiteContractRepositoryOptions {
121
132
  * The consumer owns the SQLExecutor lifecycle — `[Symbol.asyncDispose]` is a no-op.
122
133
  */
123
134
  declare class SQLiteContractRepository implements ContractRepository {
135
+ readonly version: 4;
124
136
  private readonly db;
125
- readonly version: 3;
126
137
  private initPromise;
127
138
  private readonly prefix;
128
139
  private readonly table;
@@ -138,9 +149,9 @@ declare class SQLiteContractRepository implements ContractRepository {
138
149
  private addFilterCondition;
139
150
  }
140
151
 
141
- declare class SQLiteIntentRepository implements IntentRepository {
142
- private readonly db;
152
+ declare class SQLiteBatchRegistrationRepository implements BatchRegistrationRepository {
143
153
  readonly version: 1;
154
+ private readonly db;
144
155
  private initPromise;
145
156
  private readonly prefix;
146
157
  private readonly t;
@@ -150,15 +161,23 @@ declare class SQLiteIntentRepository implements IntentRepository {
150
161
  private ensureInit;
151
162
  private init;
152
163
  clear(): Promise<void>;
153
- saveIntent(intent: ArkIntent): Promise<void>;
154
- getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
164
+ saveBatchRegistration(intent: ArkIntent): Promise<void>;
165
+ getBatchRegistrationsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
155
166
  getLockedVtxoOutpoints(): Promise<Outpoint[]>;
167
+ /** @deprecated Use {@link saveBatchRegistration}. */
168
+ saveIntent(intent: ArkIntent): Promise<void>;
169
+ /** @deprecated Use {@link getBatchRegistrationsPage}. */
170
+ getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<BatchRegistration, string>>;
156
171
  [Symbol.asyncDispose](): Promise<void>;
157
172
  }
173
+ /** @deprecated Use {@link SQLiteBatchRegistrationRepository}. */
174
+ declare const SQLiteIntentRepository: typeof SQLiteBatchRegistrationRepository;
175
+ /** @deprecated Use {@link SQLiteBatchRegistrationRepository}. */
176
+ type SQLiteIntentRepository = SQLiteBatchRegistrationRepository;
158
177
 
159
178
  declare class SQLiteVirtualTxRepository implements VirtualTxRepository {
160
- private readonly db;
161
179
  readonly version: 1;
180
+ private readonly db;
162
181
  private initPromise;
163
182
  private readonly prefix;
164
183
  private readonly tTx;
@@ -178,14 +197,14 @@ declare class SQLiteVirtualTxRepository implements VirtualTxRepository {
178
197
  [Symbol.asyncDispose](): Promise<void>;
179
198
  }
180
199
 
200
+ /** SDK reads and writes share the transaction queue; direct raw-driver calls do not. */
201
+ declare function getSerializedExecutor(db: SQLExecutor): SQLExecutor;
181
202
  /**
182
- * Run `fn` inside a serialized `BEGIN IMMEDIATE` / `COMMIT` on `db`.
183
- *
184
- * `fn` must issue only raw `db.run`/`db.all` calls: calling `runInTransaction`
185
- * again on the same `db` from within `fn` would wait on the chain it is part of
186
- * and deadlock.
203
+ * Run `fn` inside `BEGIN IMMEDIATE` / `COMMIT`, excluding queued SDK reads and writes.
204
+ * Use only the supplied raw executor inside `fn`; repository calls or nested transactions deadlock.
205
+ * Existing zero-argument callbacks closing over the original raw executor remain supported.
187
206
  */
188
- declare function runInTransaction(db: SQLExecutor, fn: () => Promise<void>): Promise<void>;
207
+ declare function runInTransaction(db: SQLExecutor, fn: (tx: SQLExecutor) => Promise<void>): Promise<void>;
189
208
 
190
209
  /**
191
210
  * Validate a SQLite table prefix and return it unchanged.
@@ -195,4 +214,4 @@ declare function runInTransaction(db: SQLExecutor, fn: () => Promise<void>): Pro
195
214
  */
196
215
  declare function sanitizeTablePrefix(p: string): string;
197
216
 
198
- export { type SQLExecutor, SQLiteContractRepository, SQLiteIntentRepository, SQLiteVirtualTxRepository, SQLiteWalletRepository, VirtualTx, VirtualTxRepository, VtxoBranch, runInTransaction, sanitizeTablePrefix };
217
+ export { type SQLExecutor, SQLiteBatchRegistrationRepository, SQLiteContractRepository, SQLiteIntentRepository, SQLiteVirtualTxRepository, SQLiteWalletRepository, VirtualTx, VirtualTxRepository, VtxoBranch, getSerializedExecutor, runInTransaction, sanitizeTablePrefix };