@arkade-os/sdk 0.3.13 → 0.4.0-next.1

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 (270) hide show
  1. package/README.md +586 -54
  2. package/dist/cjs/asset/assetGroup.js +141 -0
  3. package/dist/cjs/asset/assetId.js +88 -0
  4. package/dist/cjs/asset/assetInput.js +204 -0
  5. package/dist/cjs/asset/assetOutput.js +159 -0
  6. package/dist/cjs/asset/assetRef.js +82 -0
  7. package/dist/cjs/asset/index.js +24 -0
  8. package/dist/cjs/asset/metadata.js +172 -0
  9. package/dist/cjs/asset/packet.js +164 -0
  10. package/dist/cjs/asset/types.js +25 -0
  11. package/dist/cjs/asset/utils.js +105 -0
  12. package/dist/cjs/bip322/index.js +270 -0
  13. package/dist/cjs/contracts/arkcontract.js +148 -0
  14. package/dist/cjs/contracts/contractManager.js +436 -0
  15. package/dist/cjs/contracts/contractWatcher.js +567 -0
  16. package/dist/cjs/contracts/handlers/default.js +85 -0
  17. package/dist/cjs/contracts/handlers/delegate.js +89 -0
  18. package/dist/cjs/contracts/handlers/helpers.js +105 -0
  19. package/dist/cjs/contracts/handlers/index.js +19 -0
  20. package/dist/cjs/contracts/handlers/registry.js +89 -0
  21. package/dist/cjs/contracts/handlers/vhtlc.js +193 -0
  22. package/dist/cjs/contracts/index.js +41 -0
  23. package/dist/cjs/contracts/types.js +2 -0
  24. package/dist/cjs/forfeit.js +12 -8
  25. package/dist/cjs/identity/index.js +1 -0
  26. package/dist/cjs/identity/seedIdentity.js +255 -0
  27. package/dist/cjs/index.js +72 -14
  28. package/dist/cjs/intent/index.js +47 -11
  29. package/dist/cjs/providers/ark.js +7 -0
  30. package/dist/cjs/providers/delegator.js +66 -0
  31. package/dist/cjs/providers/expoIndexer.js +5 -0
  32. package/dist/cjs/providers/indexer.js +68 -1
  33. package/dist/cjs/providers/utils.js +1 -0
  34. package/dist/cjs/repositories/contractRepository.js +0 -103
  35. package/dist/cjs/repositories/inMemory/contractRepository.js +55 -0
  36. package/dist/cjs/repositories/inMemory/walletRepository.js +80 -0
  37. package/dist/cjs/repositories/index.js +16 -0
  38. package/dist/cjs/repositories/indexedDB/contractRepository.js +187 -0
  39. package/dist/cjs/repositories/indexedDB/db.js +19 -0
  40. package/dist/cjs/repositories/indexedDB/manager.js +97 -0
  41. package/dist/cjs/repositories/indexedDB/schema.js +159 -0
  42. package/dist/cjs/repositories/indexedDB/walletRepository.js +338 -0
  43. package/dist/cjs/repositories/indexedDB/websqlAdapter.js +144 -0
  44. package/dist/cjs/repositories/migrations/contractRepositoryImpl.js +127 -0
  45. package/dist/cjs/repositories/migrations/fromStorageAdapter.js +66 -0
  46. package/dist/cjs/repositories/migrations/walletRepositoryImpl.js +180 -0
  47. package/dist/cjs/repositories/realm/contractRepository.js +120 -0
  48. package/dist/cjs/repositories/realm/index.js +9 -0
  49. package/dist/cjs/repositories/realm/schemas.js +108 -0
  50. package/dist/cjs/repositories/realm/types.js +7 -0
  51. package/dist/cjs/repositories/realm/walletRepository.js +273 -0
  52. package/dist/cjs/repositories/serialization.js +49 -0
  53. package/dist/cjs/repositories/sqlite/contractRepository.js +139 -0
  54. package/dist/cjs/repositories/sqlite/index.js +7 -0
  55. package/dist/cjs/repositories/sqlite/types.js +2 -0
  56. package/dist/cjs/repositories/sqlite/walletRepository.js +328 -0
  57. package/dist/cjs/repositories/walletRepository.js +0 -169
  58. package/dist/cjs/script/base.js +54 -0
  59. package/dist/cjs/script/delegate.js +49 -0
  60. package/dist/cjs/storage/asyncStorage.js +4 -1
  61. package/dist/cjs/storage/fileSystem.js +3 -0
  62. package/dist/cjs/storage/inMemory.js +3 -0
  63. package/dist/cjs/storage/indexedDB.js +5 -1
  64. package/dist/cjs/storage/localStorage.js +3 -0
  65. package/dist/cjs/utils/arkTransaction.js +16 -0
  66. package/dist/cjs/utils/transactionHistory.js +50 -0
  67. package/dist/cjs/wallet/asset-manager.js +338 -0
  68. package/dist/cjs/wallet/asset.js +117 -0
  69. package/dist/cjs/wallet/batch.js +1 -1
  70. package/dist/cjs/wallet/delegator.js +235 -0
  71. package/dist/cjs/wallet/expo/background.js +133 -0
  72. package/dist/cjs/wallet/expo/index.js +9 -0
  73. package/dist/cjs/wallet/expo/wallet.js +231 -0
  74. package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +568 -0
  75. package/dist/cjs/wallet/serviceWorker/wallet.js +383 -102
  76. package/dist/cjs/wallet/utils.js +58 -0
  77. package/dist/cjs/wallet/validation.js +151 -0
  78. package/dist/cjs/wallet/vtxo-manager.js +8 -1
  79. package/dist/cjs/wallet/wallet.js +702 -260
  80. package/dist/cjs/worker/browser/service-worker-manager.js +82 -0
  81. package/dist/cjs/{wallet/serviceWorker → worker/browser}/utils.js +2 -1
  82. package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +78 -0
  83. package/dist/cjs/worker/expo/index.js +12 -0
  84. package/dist/cjs/worker/expo/processors/contractPollProcessor.js +61 -0
  85. package/dist/cjs/worker/expo/processors/index.js +6 -0
  86. package/dist/cjs/worker/expo/taskQueue.js +41 -0
  87. package/dist/cjs/worker/expo/taskRunner.js +57 -0
  88. package/dist/cjs/worker/messageBus.js +252 -0
  89. package/dist/esm/asset/assetGroup.js +137 -0
  90. package/dist/esm/asset/assetId.js +84 -0
  91. package/dist/esm/asset/assetInput.js +199 -0
  92. package/dist/esm/asset/assetOutput.js +154 -0
  93. package/dist/esm/asset/assetRef.js +78 -0
  94. package/dist/esm/asset/index.js +8 -0
  95. package/dist/esm/asset/metadata.js +167 -0
  96. package/dist/esm/asset/packet.js +159 -0
  97. package/dist/esm/asset/types.js +22 -0
  98. package/dist/esm/asset/utils.js +99 -0
  99. package/dist/esm/bip322/index.js +267 -0
  100. package/dist/esm/contracts/arkcontract.js +141 -0
  101. package/dist/esm/contracts/contractManager.js +432 -0
  102. package/dist/esm/contracts/contractWatcher.js +563 -0
  103. package/dist/esm/contracts/handlers/default.js +82 -0
  104. package/dist/esm/contracts/handlers/delegate.js +86 -0
  105. package/dist/esm/contracts/handlers/helpers.js +66 -0
  106. package/dist/esm/contracts/handlers/index.js +12 -0
  107. package/dist/esm/contracts/handlers/registry.js +86 -0
  108. package/dist/esm/contracts/handlers/vhtlc.js +190 -0
  109. package/dist/esm/contracts/index.js +13 -0
  110. package/dist/esm/contracts/types.js +1 -0
  111. package/dist/esm/forfeit.js +11 -8
  112. package/dist/esm/identity/index.js +1 -0
  113. package/dist/esm/identity/seedIdentity.js +249 -0
  114. package/dist/esm/index.js +28 -15
  115. package/dist/esm/intent/index.js +44 -9
  116. package/dist/esm/providers/ark.js +7 -0
  117. package/dist/esm/providers/delegator.js +62 -0
  118. package/dist/esm/providers/expoIndexer.js +5 -0
  119. package/dist/esm/providers/indexer.js +68 -1
  120. package/dist/esm/providers/utils.js +1 -0
  121. package/dist/esm/repositories/contractRepository.js +1 -101
  122. package/dist/esm/repositories/inMemory/contractRepository.js +51 -0
  123. package/dist/esm/repositories/inMemory/walletRepository.js +76 -0
  124. package/dist/esm/repositories/index.js +8 -0
  125. package/dist/esm/repositories/indexedDB/contractRepository.js +183 -0
  126. package/dist/esm/repositories/indexedDB/db.js +4 -0
  127. package/dist/esm/repositories/indexedDB/manager.js +92 -0
  128. package/dist/esm/repositories/indexedDB/schema.js +155 -0
  129. package/dist/esm/repositories/indexedDB/walletRepository.js +334 -0
  130. package/dist/esm/repositories/indexedDB/websqlAdapter.js +138 -0
  131. package/dist/esm/repositories/migrations/contractRepositoryImpl.js +121 -0
  132. package/dist/esm/repositories/migrations/fromStorageAdapter.js +58 -0
  133. package/dist/esm/repositories/migrations/walletRepositoryImpl.js +176 -0
  134. package/dist/esm/repositories/realm/contractRepository.js +116 -0
  135. package/dist/esm/repositories/realm/index.js +3 -0
  136. package/dist/esm/repositories/realm/schemas.js +105 -0
  137. package/dist/esm/repositories/realm/types.js +6 -0
  138. package/dist/esm/repositories/realm/walletRepository.js +269 -0
  139. package/dist/esm/repositories/serialization.js +40 -0
  140. package/dist/esm/repositories/sqlite/contractRepository.js +135 -0
  141. package/dist/esm/repositories/sqlite/index.js +2 -0
  142. package/dist/esm/repositories/sqlite/types.js +1 -0
  143. package/dist/esm/repositories/sqlite/walletRepository.js +324 -0
  144. package/dist/esm/repositories/walletRepository.js +1 -167
  145. package/dist/esm/script/base.js +21 -1
  146. package/dist/esm/script/delegate.js +46 -0
  147. package/dist/esm/storage/asyncStorage.js +4 -1
  148. package/dist/esm/storage/fileSystem.js +3 -0
  149. package/dist/esm/storage/inMemory.js +3 -0
  150. package/dist/esm/storage/indexedDB.js +5 -1
  151. package/dist/esm/storage/localStorage.js +3 -0
  152. package/dist/esm/utils/arkTransaction.js +15 -0
  153. package/dist/esm/utils/transactionHistory.js +50 -0
  154. package/dist/esm/wallet/asset-manager.js +333 -0
  155. package/dist/esm/wallet/asset.js +111 -0
  156. package/dist/esm/wallet/batch.js +1 -1
  157. package/dist/esm/wallet/delegator.js +231 -0
  158. package/dist/esm/wallet/expo/background.js +128 -0
  159. package/dist/esm/wallet/expo/index.js +2 -0
  160. package/dist/esm/wallet/expo/wallet.js +194 -0
  161. package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +564 -0
  162. package/dist/esm/wallet/serviceWorker/wallet.js +382 -101
  163. package/dist/esm/wallet/utils.js +54 -0
  164. package/dist/esm/wallet/validation.js +139 -0
  165. package/dist/esm/wallet/vtxo-manager.js +8 -1
  166. package/dist/esm/wallet/wallet.js +704 -229
  167. package/dist/esm/worker/browser/service-worker-manager.js +76 -0
  168. package/dist/esm/{wallet/serviceWorker → worker/browser}/utils.js +2 -1
  169. package/dist/esm/worker/expo/asyncStorageTaskQueue.js +74 -0
  170. package/dist/esm/worker/expo/index.js +4 -0
  171. package/dist/esm/worker/expo/processors/contractPollProcessor.js +58 -0
  172. package/dist/esm/worker/expo/processors/index.js +1 -0
  173. package/dist/esm/worker/expo/taskQueue.js +37 -0
  174. package/dist/esm/worker/expo/taskRunner.js +54 -0
  175. package/dist/esm/worker/messageBus.js +248 -0
  176. package/dist/types/asset/assetGroup.d.ts +28 -0
  177. package/dist/types/asset/assetId.d.ts +19 -0
  178. package/dist/types/asset/assetInput.d.ts +46 -0
  179. package/dist/types/asset/assetOutput.d.ts +39 -0
  180. package/dist/types/asset/assetRef.d.ts +25 -0
  181. package/dist/types/asset/index.d.ts +8 -0
  182. package/dist/types/asset/metadata.d.ts +37 -0
  183. package/dist/types/asset/packet.d.ts +27 -0
  184. package/dist/types/asset/types.d.ts +18 -0
  185. package/dist/types/asset/utils.d.ts +21 -0
  186. package/dist/types/bip322/index.d.ts +55 -0
  187. package/dist/types/contracts/arkcontract.d.ts +101 -0
  188. package/dist/types/contracts/contractManager.d.ts +331 -0
  189. package/dist/types/contracts/contractWatcher.d.ts +192 -0
  190. package/dist/types/contracts/handlers/default.d.ts +19 -0
  191. package/dist/types/contracts/handlers/delegate.d.ts +21 -0
  192. package/dist/types/contracts/handlers/helpers.d.ts +18 -0
  193. package/dist/types/contracts/handlers/index.d.ts +7 -0
  194. package/dist/types/contracts/handlers/registry.d.ts +65 -0
  195. package/dist/types/contracts/handlers/vhtlc.d.ts +32 -0
  196. package/dist/types/contracts/index.d.ts +14 -0
  197. package/dist/types/contracts/types.d.ts +222 -0
  198. package/dist/types/forfeit.d.ts +2 -1
  199. package/dist/types/identity/index.d.ts +1 -0
  200. package/dist/types/identity/seedIdentity.d.ts +128 -0
  201. package/dist/types/index.d.ts +22 -12
  202. package/dist/types/intent/index.d.ts +15 -1
  203. package/dist/types/providers/ark.d.ts +11 -2
  204. package/dist/types/providers/delegator.d.ts +29 -0
  205. package/dist/types/providers/indexer.d.ts +11 -1
  206. package/dist/types/repositories/contractRepository.d.ts +30 -19
  207. package/dist/types/repositories/inMemory/contractRepository.d.ts +17 -0
  208. package/dist/types/repositories/inMemory/walletRepository.d.ts +26 -0
  209. package/dist/types/repositories/index.d.ts +7 -0
  210. package/dist/types/repositories/indexedDB/contractRepository.d.ts +21 -0
  211. package/dist/types/repositories/indexedDB/db.d.ts +4 -0
  212. package/dist/types/repositories/indexedDB/manager.d.ts +22 -0
  213. package/dist/types/repositories/indexedDB/schema.d.ts +8 -0
  214. package/dist/types/repositories/indexedDB/walletRepository.d.ts +25 -0
  215. package/dist/types/repositories/indexedDB/websqlAdapter.d.ts +49 -0
  216. package/dist/types/repositories/migrations/contractRepositoryImpl.d.ts +24 -0
  217. package/dist/types/repositories/migrations/fromStorageAdapter.d.ts +19 -0
  218. package/dist/types/repositories/migrations/walletRepositoryImpl.d.ts +27 -0
  219. package/dist/types/repositories/realm/contractRepository.d.ts +24 -0
  220. package/dist/types/repositories/realm/index.d.ts +4 -0
  221. package/dist/types/repositories/realm/schemas.d.ts +208 -0
  222. package/dist/types/repositories/realm/types.d.ts +16 -0
  223. package/dist/types/repositories/realm/walletRepository.d.ts +31 -0
  224. package/dist/types/repositories/serialization.d.ts +40 -0
  225. package/dist/types/repositories/sqlite/contractRepository.d.ts +33 -0
  226. package/dist/types/repositories/sqlite/index.d.ts +3 -0
  227. package/dist/types/repositories/sqlite/types.d.ts +18 -0
  228. package/dist/types/repositories/sqlite/walletRepository.d.ts +40 -0
  229. package/dist/types/repositories/walletRepository.d.ts +13 -24
  230. package/dist/types/script/base.d.ts +1 -0
  231. package/dist/types/script/delegate.d.ts +36 -0
  232. package/dist/types/storage/asyncStorage.d.ts +4 -0
  233. package/dist/types/storage/fileSystem.d.ts +3 -0
  234. package/dist/types/storage/inMemory.d.ts +3 -0
  235. package/dist/types/storage/index.d.ts +3 -0
  236. package/dist/types/storage/indexedDB.d.ts +3 -0
  237. package/dist/types/storage/localStorage.d.ts +3 -0
  238. package/dist/types/utils/arkTransaction.d.ts +6 -0
  239. package/dist/types/wallet/asset-manager.d.ts +78 -0
  240. package/dist/types/wallet/asset.d.ts +21 -0
  241. package/dist/types/wallet/batch.d.ts +1 -1
  242. package/dist/types/wallet/delegator.d.ts +24 -0
  243. package/dist/types/wallet/expo/background.d.ts +66 -0
  244. package/dist/types/wallet/expo/index.d.ts +4 -0
  245. package/dist/types/wallet/expo/wallet.d.ts +97 -0
  246. package/dist/types/wallet/index.d.ts +75 -2
  247. package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +366 -0
  248. package/dist/types/wallet/serviceWorker/wallet.d.ts +20 -11
  249. package/dist/types/wallet/utils.d.ts +12 -1
  250. package/dist/types/wallet/validation.d.ts +24 -0
  251. package/dist/types/wallet/wallet.d.ts +111 -17
  252. package/dist/types/worker/browser/service-worker-manager.d.ts +21 -0
  253. package/dist/types/{wallet/serviceWorker → worker/browser}/utils.d.ts +2 -1
  254. package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +46 -0
  255. package/dist/types/worker/expo/index.d.ts +7 -0
  256. package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +14 -0
  257. package/dist/types/worker/expo/processors/index.d.ts +1 -0
  258. package/dist/types/worker/expo/taskQueue.d.ts +50 -0
  259. package/dist/types/worker/expo/taskRunner.d.ts +42 -0
  260. package/dist/types/worker/messageBus.d.ts +109 -0
  261. package/package.json +69 -11
  262. package/dist/cjs/wallet/serviceWorker/request.js +0 -78
  263. package/dist/cjs/wallet/serviceWorker/response.js +0 -222
  264. package/dist/cjs/wallet/serviceWorker/worker.js +0 -655
  265. package/dist/esm/wallet/serviceWorker/request.js +0 -75
  266. package/dist/esm/wallet/serviceWorker/response.js +0 -219
  267. package/dist/esm/wallet/serviceWorker/worker.js +0 -651
  268. package/dist/types/wallet/serviceWorker/request.d.ts +0 -74
  269. package/dist/types/wallet/serviceWorker/response.d.ts +0 -123
  270. package/dist/types/wallet/serviceWorker/worker.d.ts +0 -53
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@arkade-os/sdk",
3
- "version": "0.3.13",
3
+ "version": "0.4.0-next.1",
4
4
  "description": "Bitcoin wallet SDK with Taproot and Ark integration",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "module": "./dist/esm/index.js",
8
8
  "types": "./dist/types/index.d.ts",
9
- "sideEffects": false,
9
+ "sideEffects": [
10
+ "dist/esm/contracts/handlers/index.js",
11
+ "dist/cjs/contracts/handlers/index.js"
12
+ ],
10
13
  "exports": {
11
14
  ".": {
12
15
  "types": "./dist/types/index.d.ts",
@@ -43,6 +46,30 @@
43
46
  "import": "./dist/esm/adapters/asyncStorage.js",
44
47
  "require": "./dist/cjs/adapters/asyncStorage.js",
45
48
  "default": "./dist/esm/adapters/asyncStorage.js"
49
+ },
50
+ "./repositories/sqlite": {
51
+ "types": "./dist/types/repositories/sqlite/index.d.ts",
52
+ "import": "./dist/esm/repositories/sqlite/index.js",
53
+ "require": "./dist/cjs/repositories/sqlite/index.js",
54
+ "default": "./dist/esm/repositories/sqlite/index.js"
55
+ },
56
+ "./repositories/realm": {
57
+ "types": "./dist/types/repositories/realm/index.d.ts",
58
+ "import": "./dist/esm/repositories/realm/index.js",
59
+ "require": "./dist/cjs/repositories/realm/index.js",
60
+ "default": "./dist/esm/repositories/realm/index.js"
61
+ },
62
+ "./worker/expo": {
63
+ "types": "./dist/types/worker/expo/index.d.ts",
64
+ "import": "./dist/esm/worker/expo/index.js",
65
+ "require": "./dist/cjs/worker/expo/index.js",
66
+ "default": "./dist/esm/worker/expo/index.js"
67
+ },
68
+ "./wallet/expo": {
69
+ "types": "./dist/types/wallet/expo/index.d.ts",
70
+ "import": "./dist/esm/wallet/expo/index.js",
71
+ "require": "./dist/cjs/wallet/expo/index.js",
72
+ "default": "./dist/esm/wallet/expo/index.js"
46
73
  }
47
74
  },
48
75
  "files": [
@@ -53,27 +80,56 @@
53
80
  "registry": "https://registry.npmjs.org/"
54
81
  },
55
82
  "dependencies": {
83
+ "@kukks/bitcoin-descriptors": "3.1.0",
56
84
  "@marcbachmann/cel-js": "7.3.1",
57
85
  "@noble/curves": "2.0.0",
58
86
  "@noble/secp256k1": "3.0.0",
59
87
  "@scure/base": "2.0.0",
88
+ "@scure/bip32": "2.0.0",
89
+ "@scure/bip39": "2.0.1",
60
90
  "@scure/btc-signer": "2.0.1",
61
91
  "bip68": "1.0.4"
62
92
  },
63
93
  "devDependencies": {
94
+ "@types/better-sqlite3": "7.6.13",
64
95
  "@types/node": "24.3.1",
65
96
  "@vitest/coverage-v8": "3.2.4",
97
+ "better-sqlite3": "12.6.2",
66
98
  "esbuild": "^0.27.3",
67
99
  "eventsource": "4.0.0",
68
- "expo": "~52.0.49",
69
100
  "glob": "11.1.0",
70
101
  "husky": "9.1.7",
102
+ "indexeddbshim": "16.1.0",
71
103
  "prettier": "3.6.2",
72
104
  "rimraf": "^6.1.2",
73
105
  "typedoc": "^0.28.16",
74
106
  "typescript": "5.9.2",
75
107
  "vitest": "3.2.4"
76
108
  },
109
+ "peerDependencies": {
110
+ "@react-native-async-storage/async-storage": ">=1.0.0",
111
+ "expo": ">=54.0.0",
112
+ "expo-background-task": "~1.0.10",
113
+ "expo-sqlite": "~16.0.10",
114
+ "expo-task-manager": "~14.0.9"
115
+ },
116
+ "peerDependenciesMeta": {
117
+ "expo": {
118
+ "optional": true
119
+ },
120
+ "expo-sqlite": {
121
+ "optional": true
122
+ },
123
+ "expo-background-task": {
124
+ "optional": true
125
+ },
126
+ "expo-task-manager": {
127
+ "optional": true
128
+ },
129
+ "@react-native-async-storage/async-storage": {
130
+ "optional": true
131
+ }
132
+ },
77
133
  "keywords": [
78
134
  "bitcoin",
79
135
  "wallet",
@@ -85,21 +141,27 @@
85
141
  "author": "Ark Labs",
86
142
  "license": "MIT",
87
143
  "engines": {
88
- "node": ">=20.0.0"
144
+ "node": ">=22.12.0 <23",
145
+ "pnpm": ">=10.25.0 <11"
89
146
  },
90
147
  "scripts": {
91
- "build": "rimraf dist && pnpm run build:esm && node scripts/add-extensions.js && pnpm run build:cjs && pnpm run build:types && node scripts/generate-package-files.js",
148
+ "build": "rimraf dist && pnpm run build:esm && pnpm run build:expo:esm && node scripts/add-extensions.js && pnpm run build:cjs && pnpm run build:expo:cjs && pnpm run build:types && pnpm run build:expo:types && node scripts/generate-package-files.js",
92
149
  "build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm",
93
150
  "build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs",
94
151
  "build:types": "tsc -p tsconfig.json --outDir dist/types --emitDeclarationOnly",
152
+ "build:expo:check": "node -e \"try{require.resolve('expo-sqlite')}catch{process.exit(1)}\"",
153
+ "build:expo:esm": "pnpm run build:expo:check || exit 0; tsc -p tsconfig.expo.json --outDir dist/esm",
154
+ "build:expo:cjs": "pnpm run build:expo:check || exit 0; tsc -p tsconfig.expo.json --module commonjs --outDir dist/cjs",
155
+ "build:expo:types": "pnpm run build:expo:check || exit 0; tsc -p tsconfig.expo.json --outDir dist/types --declaration --emitDeclarationOnly",
95
156
  "build:browser": "node scripts/build-browser.js",
96
157
  "docs:build": "pnpm run build:types && pnpm typedoc",
97
158
  "docs:open": "open ./docs/index.html",
98
159
  "test": "vitest run",
99
160
  "test:master": "ARK_ENV=master vitest run",
100
161
  "test:unit": "vitest run --exclude test/e2e",
101
- "test:setup": "node test/setup.js",
102
- "test:setup-docker": "node test/setup.js docker",
162
+ "test:setup": "node test/setup.mjs",
163
+ "regtest": "pnpm test:down-docker && pnpm test:build-docker && pnpm test:up-docker && pnpm test:setup-docker",
164
+ "test:setup-docker": "node test/setup.mjs docker",
103
165
  "test:build-docker": "docker compose -f docker-compose.yml build --no-cache",
104
166
  "test:up-docker": "docker compose -f docker-compose.yml up -d",
105
167
  "test:down-docker": "docker compose -f docker-compose.yml down",
@@ -107,13 +169,9 @@
107
169
  "test:integration-docker": "ARK_ENV=docker vitest run test/e2e/**",
108
170
  "test:watch": "vitest",
109
171
  "test:coverage": "vitest run --coverage",
110
- "test:sw": "pnpm run build:browser && node test/serviceWorker/serve.js",
111
- "expo:web:install": "cd examples/expo-demo && pnpm install",
112
- "expo:web": "cd examples/expo-demo && pnpm start",
113
172
  "format": "prettier --write src test examples",
114
173
  "lint": "prettier --check src test examples",
115
174
  "audit": "pnpm audit",
116
- "preinstall": "npx only-allow pnpm",
117
175
  "release": "bash scripts/release.sh",
118
176
  "release:dry-run": "bash scripts/release.sh --dry-run",
119
177
  "release:cleanup": "bash scripts/release.sh --cleanup"
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Request = void 0;
4
- /**
5
- * Request is the namespace that contains the request types for the service worker.
6
- */
7
- var Request;
8
- (function (Request) {
9
- function isBase(message) {
10
- return (typeof message === "object" && message !== null && "type" in message);
11
- }
12
- Request.isBase = isBase;
13
- function isInitWallet(message) {
14
- return (message.type === "INIT_WALLET" &&
15
- "arkServerUrl" in message &&
16
- typeof message.arkServerUrl === "string" &&
17
- ("arkServerPublicKey" in message
18
- ? message.arkServerPublicKey === undefined ||
19
- typeof message.arkServerPublicKey === "string"
20
- : true));
21
- }
22
- Request.isInitWallet = isInitWallet;
23
- function isSettle(message) {
24
- return message.type === "SETTLE";
25
- }
26
- Request.isSettle = isSettle;
27
- function isGetAddress(message) {
28
- return message.type === "GET_ADDRESS";
29
- }
30
- Request.isGetAddress = isGetAddress;
31
- function isGetBoardingAddress(message) {
32
- return message.type === "GET_BOARDING_ADDRESS";
33
- }
34
- Request.isGetBoardingAddress = isGetBoardingAddress;
35
- function isGetBalance(message) {
36
- return message.type === "GET_BALANCE";
37
- }
38
- Request.isGetBalance = isGetBalance;
39
- function isGetVtxos(message) {
40
- return message.type === "GET_VTXOS";
41
- }
42
- Request.isGetVtxos = isGetVtxos;
43
- function isGetVirtualCoins(message) {
44
- return message.type === "GET_VIRTUAL_COINS";
45
- }
46
- Request.isGetVirtualCoins = isGetVirtualCoins;
47
- function isGetBoardingUtxos(message) {
48
- return message.type === "GET_BOARDING_UTXOS";
49
- }
50
- Request.isGetBoardingUtxos = isGetBoardingUtxos;
51
- function isSendBitcoin(message) {
52
- return (message.type === "SEND_BITCOIN" &&
53
- "params" in message &&
54
- message.params !== null &&
55
- typeof message.params === "object" &&
56
- "address" in message.params &&
57
- typeof message.params.address === "string" &&
58
- "amount" in message.params &&
59
- typeof message.params.amount === "number");
60
- }
61
- Request.isSendBitcoin = isSendBitcoin;
62
- function isGetTransactionHistory(message) {
63
- return message.type === "GET_TRANSACTION_HISTORY";
64
- }
65
- Request.isGetTransactionHistory = isGetTransactionHistory;
66
- function isGetStatus(message) {
67
- return message.type === "GET_STATUS";
68
- }
69
- Request.isGetStatus = isGetStatus;
70
- function isClear(message) {
71
- return message.type === "CLEAR";
72
- }
73
- Request.isClear = isClear;
74
- function isReloadWallet(message) {
75
- return message.type === "RELOAD_WALLET";
76
- }
77
- Request.isReloadWallet = isReloadWallet;
78
- })(Request || (exports.Request = Request = {}));
@@ -1,222 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Response = void 0;
4
- const base_1 = require("@scure/base");
5
- function getRandomId() {
6
- const randomValue = crypto.getRandomValues(new Uint8Array(16));
7
- return base_1.hex.encode(randomValue);
8
- }
9
- /**
10
- * Response is the namespace that contains the response types for the service worker.
11
- */
12
- var Response;
13
- (function (Response) {
14
- Response.walletInitialized = (id) => ({
15
- type: "WALLET_INITIALIZED",
16
- success: true,
17
- id,
18
- });
19
- function error(id, message) {
20
- return {
21
- type: "ERROR",
22
- success: false,
23
- message,
24
- id,
25
- };
26
- }
27
- Response.error = error;
28
- function settleEvent(id, event) {
29
- return {
30
- type: "SETTLE_EVENT",
31
- success: true,
32
- event,
33
- id,
34
- };
35
- }
36
- Response.settleEvent = settleEvent;
37
- function settleSuccess(id, txid) {
38
- return {
39
- type: "SETTLE_SUCCESS",
40
- success: true,
41
- txid,
42
- id,
43
- };
44
- }
45
- Response.settleSuccess = settleSuccess;
46
- function isSettleSuccess(response) {
47
- return response.type === "SETTLE_SUCCESS" && response.success;
48
- }
49
- Response.isSettleSuccess = isSettleSuccess;
50
- function isAddress(response) {
51
- return response.type === "ADDRESS" && response.success === true;
52
- }
53
- Response.isAddress = isAddress;
54
- function isBoardingAddress(response) {
55
- return (response.type === "BOARDING_ADDRESS" && response.success === true);
56
- }
57
- Response.isBoardingAddress = isBoardingAddress;
58
- function address(id, address) {
59
- return {
60
- type: "ADDRESS",
61
- success: true,
62
- address,
63
- id,
64
- };
65
- }
66
- Response.address = address;
67
- function boardingAddress(id, address) {
68
- return {
69
- type: "BOARDING_ADDRESS",
70
- success: true,
71
- address,
72
- id,
73
- };
74
- }
75
- Response.boardingAddress = boardingAddress;
76
- function isBalance(response) {
77
- return response.type === "BALANCE" && response.success === true;
78
- }
79
- Response.isBalance = isBalance;
80
- function balance(id, balance) {
81
- return {
82
- type: "BALANCE",
83
- success: true,
84
- balance,
85
- id,
86
- };
87
- }
88
- Response.balance = balance;
89
- function isVtxos(response) {
90
- return response.type === "VTXOS" && response.success === true;
91
- }
92
- Response.isVtxos = isVtxos;
93
- function vtxos(id, vtxos) {
94
- return {
95
- type: "VTXOS",
96
- success: true,
97
- vtxos,
98
- id,
99
- };
100
- }
101
- Response.vtxos = vtxos;
102
- function isVirtualCoins(response) {
103
- return response.type === "VIRTUAL_COINS" && response.success === true;
104
- }
105
- Response.isVirtualCoins = isVirtualCoins;
106
- function virtualCoins(id, virtualCoins) {
107
- return {
108
- type: "VIRTUAL_COINS",
109
- success: true,
110
- virtualCoins,
111
- id,
112
- };
113
- }
114
- Response.virtualCoins = virtualCoins;
115
- function isBoardingUtxos(response) {
116
- return response.type === "BOARDING_UTXOS" && response.success === true;
117
- }
118
- Response.isBoardingUtxos = isBoardingUtxos;
119
- function boardingUtxos(id, boardingUtxos) {
120
- return {
121
- type: "BOARDING_UTXOS",
122
- success: true,
123
- boardingUtxos,
124
- id,
125
- };
126
- }
127
- Response.boardingUtxos = boardingUtxos;
128
- function isSendBitcoinSuccess(response) {
129
- return (response.type === "SEND_BITCOIN_SUCCESS" &&
130
- response.success === true);
131
- }
132
- Response.isSendBitcoinSuccess = isSendBitcoinSuccess;
133
- function sendBitcoinSuccess(id, txid) {
134
- return {
135
- type: "SEND_BITCOIN_SUCCESS",
136
- success: true,
137
- txid,
138
- id,
139
- };
140
- }
141
- Response.sendBitcoinSuccess = sendBitcoinSuccess;
142
- function isTransactionHistory(response) {
143
- return (response.type === "TRANSACTION_HISTORY" && response.success === true);
144
- }
145
- Response.isTransactionHistory = isTransactionHistory;
146
- function transactionHistory(id, transactions) {
147
- return {
148
- type: "TRANSACTION_HISTORY",
149
- success: true,
150
- transactions,
151
- id,
152
- };
153
- }
154
- Response.transactionHistory = transactionHistory;
155
- function isWalletStatus(response) {
156
- return response.type === "WALLET_STATUS" && response.success === true;
157
- }
158
- Response.isWalletStatus = isWalletStatus;
159
- function walletStatus(id, walletInitialized, xOnlyPublicKey) {
160
- return {
161
- type: "WALLET_STATUS",
162
- success: true,
163
- status: {
164
- walletInitialized,
165
- xOnlyPublicKey,
166
- },
167
- id,
168
- };
169
- }
170
- Response.walletStatus = walletStatus;
171
- function isClearResponse(response) {
172
- return response.type === "CLEAR_RESPONSE";
173
- }
174
- Response.isClearResponse = isClearResponse;
175
- function clearResponse(id, success) {
176
- return {
177
- type: "CLEAR_RESPONSE",
178
- success,
179
- id,
180
- };
181
- }
182
- Response.clearResponse = clearResponse;
183
- function isWalletReloaded(response) {
184
- return response.type === "WALLET_RELOADED";
185
- }
186
- Response.isWalletReloaded = isWalletReloaded;
187
- function walletReloaded(id, success) {
188
- return {
189
- type: "WALLET_RELOADED",
190
- success,
191
- id,
192
- };
193
- }
194
- Response.walletReloaded = walletReloaded;
195
- function isVtxoUpdate(response) {
196
- return response.type === "VTXO_UPDATE";
197
- }
198
- Response.isVtxoUpdate = isVtxoUpdate;
199
- function vtxoUpdate(newVtxos, spentVtxos) {
200
- return {
201
- type: "VTXO_UPDATE",
202
- id: getRandomId(), // spontaneous update, not tied to a request
203
- success: true,
204
- spentVtxos,
205
- newVtxos,
206
- };
207
- }
208
- Response.vtxoUpdate = vtxoUpdate;
209
- function isUtxoUpdate(response) {
210
- return response.type === "UTXO_UPDATE";
211
- }
212
- Response.isUtxoUpdate = isUtxoUpdate;
213
- function utxoUpdate(coins) {
214
- return {
215
- type: "UTXO_UPDATE",
216
- id: getRandomId(), // spontaneous update, not tied to a request
217
- success: true,
218
- coins,
219
- };
220
- }
221
- Response.utxoUpdate = utxoUpdate;
222
- })(Response || (exports.Response = Response = {}));