@varity-labs/sdk 2.0.0-alpha.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 (295) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +253 -0
  3. package/dist/analytics/index.d.ts +7 -0
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/index.js +6 -0
  6. package/dist/analytics/tracker.d.ts +128 -0
  7. package/dist/analytics/tracker.d.ts.map +1 -0
  8. package/dist/analytics/tracker.js +203 -0
  9. package/dist/blockchain/BlockchainService.d.ts +100 -0
  10. package/dist/blockchain/BlockchainService.d.ts.map +1 -0
  11. package/dist/blockchain/BlockchainService.js +188 -0
  12. package/dist/blockchain/NFTLicensingService.d.ts +69 -0
  13. package/dist/blockchain/NFTLicensingService.d.ts.map +1 -0
  14. package/dist/blockchain/NFTLicensingService.js +136 -0
  15. package/dist/blockchain/RevenueSplitService.d.ts +71 -0
  16. package/dist/blockchain/RevenueSplitService.d.ts.map +1 -0
  17. package/dist/blockchain/RevenueSplitService.js +111 -0
  18. package/dist/blockchain/index.d.ts +48 -0
  19. package/dist/blockchain/index.d.ts.map +1 -0
  20. package/dist/blockchain/index.js +46 -0
  21. package/dist/blockchain/types.d.ts +63 -0
  22. package/dist/blockchain/types.d.ts.map +1 -0
  23. package/dist/blockchain/types.js +6 -0
  24. package/dist/chains/arbitrum.d.ts +89 -0
  25. package/dist/chains/arbitrum.d.ts.map +1 -0
  26. package/dist/chains/arbitrum.js +134 -0
  27. package/dist/chains/base.d.ts +84 -0
  28. package/dist/chains/base.d.ts.map +1 -0
  29. package/dist/chains/base.js +131 -0
  30. package/dist/chains/index.d.ts +36 -0
  31. package/dist/chains/index.d.ts.map +1 -0
  32. package/dist/chains/index.js +32 -0
  33. package/dist/chains/registry.d.ts +113 -0
  34. package/dist/chains/registry.d.ts.map +1 -0
  35. package/dist/chains/registry.js +201 -0
  36. package/dist/chains/varityL3.d.ts +81 -0
  37. package/dist/chains/varityL3.d.ts.map +1 -0
  38. package/dist/chains/varityL3.js +125 -0
  39. package/dist/cli/commands/clone.d.ts +8 -0
  40. package/dist/cli/commands/clone.d.ts.map +1 -0
  41. package/dist/cli/commands/clone.js +391 -0
  42. package/dist/cli/commands/dev.d.ts +8 -0
  43. package/dist/cli/commands/dev.d.ts.map +1 -0
  44. package/dist/cli/commands/dev.js +40 -0
  45. package/dist/cli/commands/generate.d.ts +8 -0
  46. package/dist/cli/commands/generate.d.ts.map +1 -0
  47. package/dist/cli/commands/generate.js +303 -0
  48. package/dist/cli/commands/init.d.ts +8 -0
  49. package/dist/cli/commands/init.d.ts.map +1 -0
  50. package/dist/cli/commands/init.js +317 -0
  51. package/dist/cli/commands/validate.d.ts +8 -0
  52. package/dist/cli/commands/validate.d.ts.map +1 -0
  53. package/dist/cli/commands/validate.js +69 -0
  54. package/dist/cli/index.d.ts +8 -0
  55. package/dist/cli/index.d.ts.map +1 -0
  56. package/dist/cli/index.js +33 -0
  57. package/dist/cli/utils/logger.d.ts +17 -0
  58. package/dist/cli/utils/logger.d.ts.map +1 -0
  59. package/dist/cli/utils/logger.js +35 -0
  60. package/dist/cli/utils/prompts.d.ts +21 -0
  61. package/dist/cli/utils/prompts.d.ts.map +1 -0
  62. package/dist/cli/utils/prompts.js +103 -0
  63. package/dist/contracts/abis/iso/AccessControlRegistry.json +1468 -0
  64. package/dist/contracts/abis/iso/DataProofRegistry.json +797 -0
  65. package/dist/contracts/abis/iso/MerchantRegistry.json +1237 -0
  66. package/dist/contracts/abis/iso/RepPerformance.json +1351 -0
  67. package/dist/contracts/abis/iso/ResidualCalculator.json +1118 -0
  68. package/dist/contracts/abis/iso/TransactionVault.json +1588 -0
  69. package/dist/contracts/abis/iso/VarityWalletFactory.json +475 -0
  70. package/dist/contracts/addresses.d.ts +88 -0
  71. package/dist/contracts/addresses.d.ts.map +1 -0
  72. package/dist/contracts/addresses.js +94 -0
  73. package/dist/contracts/index.d.ts +7 -0
  74. package/dist/contracts/index.d.ts.map +1 -0
  75. package/dist/contracts/index.js +6 -0
  76. package/dist/core/VaritySDK.d.ts +177 -0
  77. package/dist/core/VaritySDK.d.ts.map +1 -0
  78. package/dist/core/VaritySDK.js +325 -0
  79. package/dist/core/config.d.ts +120 -0
  80. package/dist/core/config.d.ts.map +1 -0
  81. package/dist/core/config.js +187 -0
  82. package/dist/core/credentials-proxy.d.ts +157 -0
  83. package/dist/core/credentials-proxy.d.ts.map +1 -0
  84. package/dist/core/credentials-proxy.js +345 -0
  85. package/dist/core/credentials.d.ts +219 -0
  86. package/dist/core/credentials.d.ts.map +1 -0
  87. package/dist/core/credentials.js +345 -0
  88. package/dist/core/template-loader.d.ts +15 -0
  89. package/dist/core/template-loader.d.ts.map +1 -0
  90. package/dist/core/template-loader.js +380 -0
  91. package/dist/core/template.d.ts +321 -0
  92. package/dist/core/template.d.ts.map +1 -0
  93. package/dist/core/template.js +189 -0
  94. package/dist/core/types.d.ts +572 -0
  95. package/dist/core/types.d.ts.map +1 -0
  96. package/dist/core/types.js +52 -0
  97. package/dist/dev/dev-server.d.ts +16 -0
  98. package/dist/dev/dev-server.d.ts.map +1 -0
  99. package/dist/dev/dev-server.js +119 -0
  100. package/dist/generators/contracts/generator.d.ts +21 -0
  101. package/dist/generators/contracts/generator.d.ts.map +1 -0
  102. package/dist/generators/contracts/generator.js +252 -0
  103. package/dist/generators/tests/generator.d.ts +20 -0
  104. package/dist/generators/tests/generator.d.ts.map +1 -0
  105. package/dist/generators/tests/generator.js +375 -0
  106. package/dist/generators/types/generator.d.ts +19 -0
  107. package/dist/generators/types/generator.d.ts.map +1 -0
  108. package/dist/generators/types/generator.js +165 -0
  109. package/dist/generators/ui/component-generator.d.ts +20 -0
  110. package/dist/generators/ui/component-generator.d.ts.map +1 -0
  111. package/dist/generators/ui/component-generator.js +749 -0
  112. package/dist/generators/ui/dashboard-generator.d.ts +20 -0
  113. package/dist/generators/ui/dashboard-generator.d.ts.map +1 -0
  114. package/dist/generators/ui/dashboard-generator.js +349 -0
  115. package/dist/index.d.ts +61 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +74 -0
  118. package/dist/modules/analytics/AnalyticsModule.d.ts +349 -0
  119. package/dist/modules/analytics/AnalyticsModule.d.ts.map +1 -0
  120. package/dist/modules/analytics/AnalyticsModule.js +274 -0
  121. package/dist/modules/analytics/index.d.ts +3 -0
  122. package/dist/modules/analytics/index.d.ts.map +1 -0
  123. package/dist/modules/analytics/index.js +1 -0
  124. package/dist/modules/auth/AccessKeyModule.d.ts +189 -0
  125. package/dist/modules/auth/AccessKeyModule.d.ts.map +1 -0
  126. package/dist/modules/auth/AccessKeyModule.js +322 -0
  127. package/dist/modules/auth/AuthModule.d.ts +133 -0
  128. package/dist/modules/auth/AuthModule.d.ts.map +1 -0
  129. package/dist/modules/auth/AuthModule.js +214 -0
  130. package/dist/modules/auth/index.d.ts +8 -0
  131. package/dist/modules/auth/index.d.ts.map +1 -0
  132. package/dist/modules/auth/index.js +6 -0
  133. package/dist/modules/cache/CacheModule.d.ts +279 -0
  134. package/dist/modules/cache/CacheModule.d.ts.map +1 -0
  135. package/dist/modules/cache/CacheModule.js +493 -0
  136. package/dist/modules/cache/index.d.ts +3 -0
  137. package/dist/modules/cache/index.d.ts.map +1 -0
  138. package/dist/modules/cache/index.js +1 -0
  139. package/dist/modules/compute/ComputeModule.d.ts +226 -0
  140. package/dist/modules/compute/ComputeModule.d.ts.map +1 -0
  141. package/dist/modules/compute/ComputeModule.js +379 -0
  142. package/dist/modules/compute/index.d.ts +6 -0
  143. package/dist/modules/compute/index.d.ts.map +1 -0
  144. package/dist/modules/compute/index.js +4 -0
  145. package/dist/modules/contracts/ContractsModule.d.ts +164 -0
  146. package/dist/modules/contracts/ContractsModule.d.ts.map +1 -0
  147. package/dist/modules/contracts/ContractsModule.js +242 -0
  148. package/dist/modules/contracts/index.d.ts +6 -0
  149. package/dist/modules/contracts/index.d.ts.map +1 -0
  150. package/dist/modules/contracts/index.js +4 -0
  151. package/dist/modules/export/ExportModule.d.ts +346 -0
  152. package/dist/modules/export/ExportModule.d.ts.map +1 -0
  153. package/dist/modules/export/ExportModule.js +432 -0
  154. package/dist/modules/export/index.d.ts +3 -0
  155. package/dist/modules/export/index.d.ts.map +1 -0
  156. package/dist/modules/export/index.js +1 -0
  157. package/dist/modules/forecasting/ForecastingModule.d.ts +579 -0
  158. package/dist/modules/forecasting/ForecastingModule.d.ts.map +1 -0
  159. package/dist/modules/forecasting/ForecastingModule.js +310 -0
  160. package/dist/modules/forecasting/index.d.ts +3 -0
  161. package/dist/modules/forecasting/index.d.ts.map +1 -0
  162. package/dist/modules/forecasting/index.js +1 -0
  163. package/dist/modules/monitoring/MonitoringModule.d.ts +359 -0
  164. package/dist/modules/monitoring/MonitoringModule.d.ts.map +1 -0
  165. package/dist/modules/monitoring/MonitoringModule.js +483 -0
  166. package/dist/modules/monitoring/index.d.ts +3 -0
  167. package/dist/modules/monitoring/index.d.ts.map +1 -0
  168. package/dist/modules/monitoring/index.js +1 -0
  169. package/dist/modules/notifications/NotificationsModule.d.ts +336 -0
  170. package/dist/modules/notifications/NotificationsModule.d.ts.map +1 -0
  171. package/dist/modules/notifications/NotificationsModule.js +418 -0
  172. package/dist/modules/notifications/index.d.ts +3 -0
  173. package/dist/modules/notifications/index.d.ts.map +1 -0
  174. package/dist/modules/notifications/index.js +1 -0
  175. package/dist/modules/oracle/OracleModule.d.ts +110 -0
  176. package/dist/modules/oracle/OracleModule.d.ts.map +1 -0
  177. package/dist/modules/oracle/OracleModule.js +151 -0
  178. package/dist/modules/oracle/index.d.ts +6 -0
  179. package/dist/modules/oracle/index.d.ts.map +1 -0
  180. package/dist/modules/oracle/index.js +4 -0
  181. package/dist/modules/storage/S3Module.d.ts +377 -0
  182. package/dist/modules/storage/S3Module.d.ts.map +1 -0
  183. package/dist/modules/storage/S3Module.js +680 -0
  184. package/dist/modules/storage/StorageModule.d.ts +157 -0
  185. package/dist/modules/storage/StorageModule.d.ts.map +1 -0
  186. package/dist/modules/storage/StorageModule.js +302 -0
  187. package/dist/modules/storage/adapters/AdapterFactory.d.ts +100 -0
  188. package/dist/modules/storage/adapters/AdapterFactory.d.ts.map +1 -0
  189. package/dist/modules/storage/adapters/AdapterFactory.js +209 -0
  190. package/dist/modules/storage/adapters/FilecoinAdapter.d.ts +94 -0
  191. package/dist/modules/storage/adapters/FilecoinAdapter.d.ts.map +1 -0
  192. package/dist/modules/storage/adapters/FilecoinAdapter.js +263 -0
  193. package/dist/modules/storage/adapters/IStorageAdapter.d.ts +287 -0
  194. package/dist/modules/storage/adapters/IStorageAdapter.d.ts.map +1 -0
  195. package/dist/modules/storage/adapters/IStorageAdapter.js +81 -0
  196. package/dist/modules/storage/adapters/MultiTierAdapter.d.ts +187 -0
  197. package/dist/modules/storage/adapters/MultiTierAdapter.d.ts.map +1 -0
  198. package/dist/modules/storage/adapters/MultiTierAdapter.js +430 -0
  199. package/dist/modules/storage/adapters/index.d.ts +12 -0
  200. package/dist/modules/storage/adapters/index.d.ts.map +1 -0
  201. package/dist/modules/storage/adapters/index.js +12 -0
  202. package/dist/modules/storage/index.d.ts +16 -0
  203. package/dist/modules/storage/index.d.ts.map +1 -0
  204. package/dist/modules/storage/index.js +15 -0
  205. package/dist/modules/storage/tiering/AccessAnalyzer.d.ts +227 -0
  206. package/dist/modules/storage/tiering/AccessAnalyzer.d.ts.map +1 -0
  207. package/dist/modules/storage/tiering/AccessAnalyzer.js +367 -0
  208. package/dist/modules/storage/tiering/CostOptimizer.d.ts +248 -0
  209. package/dist/modules/storage/tiering/CostOptimizer.d.ts.map +1 -0
  210. package/dist/modules/storage/tiering/CostOptimizer.js +356 -0
  211. package/dist/modules/storage/tiering/MetadataStore.d.ts +287 -0
  212. package/dist/modules/storage/tiering/MetadataStore.d.ts.map +1 -0
  213. package/dist/modules/storage/tiering/MetadataStore.js +535 -0
  214. package/dist/modules/storage/tiering/TieringEngine.d.ts +237 -0
  215. package/dist/modules/storage/tiering/TieringEngine.d.ts.map +1 -0
  216. package/dist/modules/storage/tiering/TieringEngine.js +419 -0
  217. package/dist/modules/storage/tiering/example.d.ts +8 -0
  218. package/dist/modules/storage/tiering/example.d.ts.map +1 -0
  219. package/dist/modules/storage/tiering/example.js +250 -0
  220. package/dist/modules/storage/tiering/index.d.ts +17 -0
  221. package/dist/modules/storage/tiering/index.d.ts.map +1 -0
  222. package/dist/modules/storage/tiering/index.js +13 -0
  223. package/dist/modules/webhooks/WebhooksModule.d.ts +476 -0
  224. package/dist/modules/webhooks/WebhooksModule.d.ts.map +1 -0
  225. package/dist/modules/webhooks/WebhooksModule.js +359 -0
  226. package/dist/modules/webhooks/index.d.ts +3 -0
  227. package/dist/modules/webhooks/index.d.ts.map +1 -0
  228. package/dist/modules/webhooks/index.js +1 -0
  229. package/dist/modules/zk/ZKModule.d.ts +153 -0
  230. package/dist/modules/zk/ZKModule.d.ts.map +1 -0
  231. package/dist/modules/zk/ZKModule.js +262 -0
  232. package/dist/modules/zk/index.d.ts +7 -0
  233. package/dist/modules/zk/index.d.ts.map +1 -0
  234. package/dist/modules/zk/index.js +4 -0
  235. package/dist/thirdweb/BridgeClient.d.ts +228 -0
  236. package/dist/thirdweb/BridgeClient.d.ts.map +1 -0
  237. package/dist/thirdweb/BridgeClient.js +160 -0
  238. package/dist/thirdweb/EngineClient.d.ts +396 -0
  239. package/dist/thirdweb/EngineClient.d.ts.map +1 -0
  240. package/dist/thirdweb/EngineClient.js +386 -0
  241. package/dist/thirdweb/GatewayClient.d.ts +190 -0
  242. package/dist/thirdweb/GatewayClient.d.ts.map +1 -0
  243. package/dist/thirdweb/GatewayClient.js +257 -0
  244. package/dist/thirdweb/NebulaClient.d.ts +292 -0
  245. package/dist/thirdweb/NebulaClient.d.ts.map +1 -0
  246. package/dist/thirdweb/NebulaClient.js +180 -0
  247. package/dist/thirdweb/StorageClient.d.ts +445 -0
  248. package/dist/thirdweb/StorageClient.d.ts.map +1 -0
  249. package/dist/thirdweb/StorageClient.js +405 -0
  250. package/dist/thirdweb/ThirdwebWrapper.d.ts +236 -0
  251. package/dist/thirdweb/ThirdwebWrapper.d.ts.map +1 -0
  252. package/dist/thirdweb/ThirdwebWrapper.js +332 -0
  253. package/dist/thirdweb/index.d.ts +21 -0
  254. package/dist/thirdweb/index.d.ts.map +1 -0
  255. package/dist/thirdweb/index.js +28 -0
  256. package/dist/thirdweb/varity-chain.d.ts +48 -0
  257. package/dist/thirdweb/varity-chain.d.ts.map +1 -0
  258. package/dist/thirdweb/varity-chain.js +64 -0
  259. package/dist/thirdweb/x402Client.d.ts +319 -0
  260. package/dist/thirdweb/x402Client.d.ts.map +1 -0
  261. package/dist/thirdweb/x402Client.js +223 -0
  262. package/dist/tracking/gasTracker.d.ts +158 -0
  263. package/dist/tracking/gasTracker.d.ts.map +1 -0
  264. package/dist/tracking/gasTracker.js +227 -0
  265. package/dist/tracking/index.d.ts +10 -0
  266. package/dist/tracking/index.d.ts.map +1 -0
  267. package/dist/tracking/index.js +8 -0
  268. package/dist/tracking/types.d.ts +327 -0
  269. package/dist/tracking/types.d.ts.map +1 -0
  270. package/dist/tracking/types.js +8 -0
  271. package/dist/ui/components/ChartWidget.d.ts +36 -0
  272. package/dist/ui/components/ChartWidget.d.ts.map +1 -0
  273. package/dist/ui/components/ChartWidget.js +82 -0
  274. package/dist/ui/components/DashboardLayout.d.ts +41 -0
  275. package/dist/ui/components/DashboardLayout.d.ts.map +1 -0
  276. package/dist/ui/components/DashboardLayout.js +102 -0
  277. package/dist/ui/components/DataTable.d.ts +49 -0
  278. package/dist/ui/components/DataTable.d.ts.map +1 -0
  279. package/dist/ui/components/DataTable.js +96 -0
  280. package/dist/ui/components/EntityForm.d.ts +60 -0
  281. package/dist/ui/components/EntityForm.d.ts.map +1 -0
  282. package/dist/ui/components/EntityForm.js +182 -0
  283. package/dist/ui/components/KPICard.d.ts +29 -0
  284. package/dist/ui/components/KPICard.d.ts.map +1 -0
  285. package/dist/ui/components/KPICard.js +61 -0
  286. package/dist/ui/components/Modal.d.ts +34 -0
  287. package/dist/ui/components/Modal.d.ts.map +1 -0
  288. package/dist/ui/components/Modal.js +30 -0
  289. package/dist/ui/components/index.d.ts +18 -0
  290. package/dist/ui/components/index.d.ts.map +1 -0
  291. package/dist/ui/components/index.js +11 -0
  292. package/dist/validation/template-validator.d.ts +25 -0
  293. package/dist/validation/template-validator.d.ts.map +1 -0
  294. package/dist/validation/template-validator.js +305 -0
  295. package/package.json +102 -0
@@ -0,0 +1,418 @@
1
+ /**
2
+ * NotificationsModule - Universal notifications and alerting
3
+ *
4
+ * Provides multi-channel notification delivery with templates, scheduling,
5
+ * preferences, and alert rules. Works across all templates by using
6
+ * template-specific notification templates.
7
+ */
8
+ export class NotificationsModule {
9
+ constructor(sdk) {
10
+ this.sdk = sdk;
11
+ }
12
+ /**
13
+ * Send notification immediately
14
+ *
15
+ * Universal method - sends notifications via any channel for any template.
16
+ * Template configuration provides template-specific message content.
17
+ *
18
+ * @example ISO Dashboard
19
+ * ```typescript
20
+ * await sdk.notifications.send({
21
+ * type: 'email',
22
+ * to: 'merchant@example.com',
23
+ * template: 'merchant_registered',
24
+ * data: { merchantName: 'Acme Corp' }
25
+ * })
26
+ * ```
27
+ *
28
+ * @example Healthcare Dashboard
29
+ * ```typescript
30
+ * await sdk.notifications.send({
31
+ * type: 'sms',
32
+ * to: '+1234567890',
33
+ * template: 'appointment_reminder',
34
+ * data: { patientName: 'John Doe', appointmentTime: '2025-01-15 10:00' }
35
+ * })
36
+ * ```
37
+ */
38
+ async send(options) {
39
+ const apiEndpoint = this.sdk.getAPIEndpoint();
40
+ const apiKey = this.sdk.getAPIKey();
41
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/send`, {
42
+ method: 'POST',
43
+ headers: {
44
+ 'Content-Type': 'application/json',
45
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
46
+ },
47
+ body: JSON.stringify(options)
48
+ });
49
+ if (!response.ok) {
50
+ throw new Error(`Failed to send notification: ${response.statusText}`);
51
+ }
52
+ return await response.json();
53
+ }
54
+ /**
55
+ * Send batch notifications
56
+ *
57
+ * Universal method - sends multiple notifications efficiently.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const results = await sdk.notifications.sendBatch([
62
+ * { type: 'email', to: 'user1@example.com', template: 'alert' },
63
+ * { type: 'email', to: 'user2@example.com', template: 'alert' },
64
+ * { type: 'sms', to: '+1234567890', template: 'urgent_alert' }
65
+ * ])
66
+ * ```
67
+ */
68
+ async sendBatch(notifications) {
69
+ const apiEndpoint = this.sdk.getAPIEndpoint();
70
+ const apiKey = this.sdk.getAPIKey();
71
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/send-batch`, {
72
+ method: 'POST',
73
+ headers: {
74
+ 'Content-Type': 'application/json',
75
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
76
+ },
77
+ body: JSON.stringify({ notifications })
78
+ });
79
+ if (!response.ok) {
80
+ throw new Error(`Failed to send batch notifications: ${response.statusText}`);
81
+ }
82
+ return await response.json();
83
+ }
84
+ /**
85
+ * Get notification preferences for a user
86
+ *
87
+ * Universal method - retrieves user notification preferences.
88
+ */
89
+ async getPreferences(userId) {
90
+ const apiEndpoint = this.sdk.getAPIEndpoint();
91
+ const apiKey = this.sdk.getAPIKey();
92
+ const url = userId
93
+ ? `${apiEndpoint}/api/v1/notifications/preferences?userId=${userId}`
94
+ : `${apiEndpoint}/api/v1/notifications/preferences`;
95
+ const response = await fetch(url, {
96
+ method: 'GET',
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
100
+ }
101
+ });
102
+ if (!response.ok) {
103
+ throw new Error(`Failed to get notification preferences: ${response.statusText}`);
104
+ }
105
+ return await response.json();
106
+ }
107
+ /**
108
+ * Set notification preferences for a user
109
+ *
110
+ * Universal method - updates user notification preferences.
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * await sdk.notifications.setPreferences({
115
+ * email: true,
116
+ * slack: true,
117
+ * push: false,
118
+ * alerts: ['compliance', 'anomaly', 'milestone'],
119
+ * quietHours: {
120
+ * enabled: true,
121
+ * start: '22:00',
122
+ * end: '08:00',
123
+ * timezone: 'America/New_York'
124
+ * }
125
+ * })
126
+ * ```
127
+ */
128
+ async setPreferences(preferences, userId) {
129
+ const apiEndpoint = this.sdk.getAPIEndpoint();
130
+ const apiKey = this.sdk.getAPIKey();
131
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/preferences`, {
132
+ method: 'PUT',
133
+ headers: {
134
+ 'Content-Type': 'application/json',
135
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
136
+ },
137
+ body: JSON.stringify({ preferences, userId })
138
+ });
139
+ if (!response.ok) {
140
+ throw new Error(`Failed to set notification preferences: ${response.statusText}`);
141
+ }
142
+ }
143
+ /**
144
+ * Get notification history
145
+ *
146
+ * Universal method - retrieves past notifications with filtering.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const history = await sdk.notifications.getHistory({
151
+ * type: 'email',
152
+ * status: 'delivered',
153
+ * startDate: '2025-01-01',
154
+ * limit: 50
155
+ * })
156
+ * ```
157
+ */
158
+ async getHistory(options = {}) {
159
+ const apiEndpoint = this.sdk.getAPIEndpoint();
160
+ const apiKey = this.sdk.getAPIKey();
161
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/history`, {
162
+ method: 'POST',
163
+ headers: {
164
+ 'Content-Type': 'application/json',
165
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
166
+ },
167
+ body: JSON.stringify(options)
168
+ });
169
+ if (!response.ok) {
170
+ throw new Error(`Failed to get notification history: ${response.statusText}`);
171
+ }
172
+ return await response.json();
173
+ }
174
+ /**
175
+ * Schedule notification for later delivery
176
+ *
177
+ * Universal method - schedules notifications for future delivery.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const scheduled = await sdk.notifications.schedule({
182
+ * type: 'email',
183
+ * to: 'user@example.com',
184
+ * template: 'monthly_report',
185
+ * scheduledFor: '2025-02-01T09:00:00Z',
186
+ * repeat: {
187
+ * interval: 'monthly',
188
+ * count: 12
189
+ * }
190
+ * })
191
+ * ```
192
+ */
193
+ async schedule(options) {
194
+ const apiEndpoint = this.sdk.getAPIEndpoint();
195
+ const apiKey = this.sdk.getAPIKey();
196
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/schedule`, {
197
+ method: 'POST',
198
+ headers: {
199
+ 'Content-Type': 'application/json',
200
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
201
+ },
202
+ body: JSON.stringify(options)
203
+ });
204
+ if (!response.ok) {
205
+ throw new Error(`Failed to schedule notification: ${response.statusText}`);
206
+ }
207
+ return await response.json();
208
+ }
209
+ /**
210
+ * Cancel scheduled notification
211
+ *
212
+ * Universal method - cancels a scheduled notification.
213
+ */
214
+ async cancelScheduled(notificationId) {
215
+ const apiEndpoint = this.sdk.getAPIEndpoint();
216
+ const apiKey = this.sdk.getAPIKey();
217
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/schedule/${notificationId}`, {
218
+ method: 'DELETE',
219
+ headers: {
220
+ 'Content-Type': 'application/json',
221
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
222
+ }
223
+ });
224
+ if (!response.ok) {
225
+ throw new Error(`Failed to cancel scheduled notification: ${response.statusText}`);
226
+ }
227
+ }
228
+ /**
229
+ * List scheduled notifications
230
+ *
231
+ * Universal method - lists all scheduled notifications.
232
+ */
233
+ async listScheduled(options = {}) {
234
+ const apiEndpoint = this.sdk.getAPIEndpoint();
235
+ const apiKey = this.sdk.getAPIKey();
236
+ const queryParams = new URLSearchParams();
237
+ if (options.status)
238
+ queryParams.append('status', options.status);
239
+ if (options.limit)
240
+ queryParams.append('limit', options.limit.toString());
241
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/scheduled?${queryParams}`, {
242
+ method: 'GET',
243
+ headers: {
244
+ 'Content-Type': 'application/json',
245
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
246
+ }
247
+ });
248
+ if (!response.ok) {
249
+ throw new Error(`Failed to list scheduled notifications: ${response.statusText}`);
250
+ }
251
+ return await response.json();
252
+ }
253
+ /**
254
+ * Create alert rule
255
+ *
256
+ * Universal method - creates an automatic alert based on conditions.
257
+ *
258
+ * @example ISO Dashboard
259
+ * ```typescript
260
+ * await sdk.notifications.createAlertRule({
261
+ * name: 'High Residual Alert',
262
+ * condition: {
263
+ * metric: 'residual_amount',
264
+ * operator: '>',
265
+ * threshold: 10000,
266
+ * duration: 300 // 5 minutes
267
+ * },
268
+ * notification: {
269
+ * type: 'email',
270
+ * to: 'admin@example.com',
271
+ * template: 'high_residual_alert'
272
+ * },
273
+ * enabled: true
274
+ * })
275
+ * ```
276
+ */
277
+ async createAlertRule(rule) {
278
+ const apiEndpoint = this.sdk.getAPIEndpoint();
279
+ const apiKey = this.sdk.getAPIKey();
280
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/alert-rules`, {
281
+ method: 'POST',
282
+ headers: {
283
+ 'Content-Type': 'application/json',
284
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
285
+ },
286
+ body: JSON.stringify(rule)
287
+ });
288
+ if (!response.ok) {
289
+ throw new Error(`Failed to create alert rule: ${response.statusText}`);
290
+ }
291
+ return await response.json();
292
+ }
293
+ /**
294
+ * Update alert rule
295
+ *
296
+ * Universal method - updates an existing alert rule.
297
+ */
298
+ async updateAlertRule(ruleId, updates) {
299
+ const apiEndpoint = this.sdk.getAPIEndpoint();
300
+ const apiKey = this.sdk.getAPIKey();
301
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/alert-rules/${ruleId}`, {
302
+ method: 'PUT',
303
+ headers: {
304
+ 'Content-Type': 'application/json',
305
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
306
+ },
307
+ body: JSON.stringify(updates)
308
+ });
309
+ if (!response.ok) {
310
+ throw new Error(`Failed to update alert rule: ${response.statusText}`);
311
+ }
312
+ return await response.json();
313
+ }
314
+ /**
315
+ * Delete alert rule
316
+ *
317
+ * Universal method - deletes an alert rule.
318
+ */
319
+ async deleteAlertRule(ruleId) {
320
+ const apiEndpoint = this.sdk.getAPIEndpoint();
321
+ const apiKey = this.sdk.getAPIKey();
322
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/alert-rules/${ruleId}`, {
323
+ method: 'DELETE',
324
+ headers: {
325
+ 'Content-Type': 'application/json',
326
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
327
+ }
328
+ });
329
+ if (!response.ok) {
330
+ throw new Error(`Failed to delete alert rule: ${response.statusText}`);
331
+ }
332
+ }
333
+ /**
334
+ * List alert rules
335
+ *
336
+ * Universal method - lists all alert rules.
337
+ */
338
+ async listAlertRules(options = {}) {
339
+ const apiEndpoint = this.sdk.getAPIEndpoint();
340
+ const apiKey = this.sdk.getAPIKey();
341
+ const queryParams = new URLSearchParams();
342
+ if (options.enabled !== undefined)
343
+ queryParams.append('enabled', options.enabled.toString());
344
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/alert-rules?${queryParams}`, {
345
+ method: 'GET',
346
+ headers: {
347
+ 'Content-Type': 'application/json',
348
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
349
+ }
350
+ });
351
+ if (!response.ok) {
352
+ throw new Error(`Failed to list alert rules: ${response.statusText}`);
353
+ }
354
+ return await response.json();
355
+ }
356
+ /**
357
+ * Create notification template
358
+ *
359
+ * Universal method - creates a reusable notification template.
360
+ */
361
+ async createTemplate(template) {
362
+ const apiEndpoint = this.sdk.getAPIEndpoint();
363
+ const apiKey = this.sdk.getAPIKey();
364
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/templates`, {
365
+ method: 'POST',
366
+ headers: {
367
+ 'Content-Type': 'application/json',
368
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
369
+ },
370
+ body: JSON.stringify(template)
371
+ });
372
+ if (!response.ok) {
373
+ throw new Error(`Failed to create notification template: ${response.statusText}`);
374
+ }
375
+ return await response.json();
376
+ }
377
+ /**
378
+ * Get notification template
379
+ *
380
+ * Universal method - retrieves a notification template by name.
381
+ */
382
+ async getTemplate(templateName) {
383
+ const apiEndpoint = this.sdk.getAPIEndpoint();
384
+ const apiKey = this.sdk.getAPIKey();
385
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/templates/${templateName}`, {
386
+ method: 'GET',
387
+ headers: {
388
+ 'Content-Type': 'application/json',
389
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
390
+ }
391
+ });
392
+ if (!response.ok) {
393
+ throw new Error(`Failed to get notification template: ${response.statusText}`);
394
+ }
395
+ return await response.json();
396
+ }
397
+ /**
398
+ * List notification templates
399
+ *
400
+ * Universal method - lists all available notification templates.
401
+ */
402
+ async listTemplates(type) {
403
+ const apiEndpoint = this.sdk.getAPIEndpoint();
404
+ const apiKey = this.sdk.getAPIKey();
405
+ const queryParams = type ? `?type=${type}` : '';
406
+ const response = await fetch(`${apiEndpoint}/api/v1/notifications/templates${queryParams}`, {
407
+ method: 'GET',
408
+ headers: {
409
+ 'Content-Type': 'application/json',
410
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
411
+ }
412
+ });
413
+ if (!response.ok) {
414
+ throw new Error(`Failed to list notification templates: ${response.statusText}`);
415
+ }
416
+ return await response.json();
417
+ }
418
+ }
@@ -0,0 +1,3 @@
1
+ export { NotificationsModule } from './NotificationsModule';
2
+ export type { NotificationType, NotificationPriority, NotificationStatus, SendNotificationOptions, NotificationAttachment, NotificationResult, NotificationPreferences, NotificationHistoryOptions, NotificationHistoryEntry, NotificationHistoryResult, ScheduleNotificationOptions, ScheduledNotification, AlertRule, AlertCondition, AlertRuleResult, NotificationTemplate } from './NotificationsModule';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACrB,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1 @@
1
+ export { NotificationsModule } from './NotificationsModule';
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Varity SDK - Oracle Module
3
+ *
4
+ * Universal oracle data fetching.
5
+ * Works across all templates (ISO, Healthcare, Retail, etc.)
6
+ */
7
+ import type { VaritySDK } from '../../core/VaritySDK';
8
+ export interface OracleQuery {
9
+ source: string;
10
+ parameters: Record<string, any>;
11
+ }
12
+ export interface OracleData {
13
+ value: any;
14
+ timestamp: number;
15
+ source: string;
16
+ confidence?: number;
17
+ }
18
+ export interface DataCallback {
19
+ (data: OracleData): void;
20
+ }
21
+ export interface Subscription {
22
+ id: string;
23
+ unsubscribe: () => Promise<void>;
24
+ }
25
+ export interface PriceData {
26
+ asset: string;
27
+ price: number;
28
+ currency: string;
29
+ timestamp: number;
30
+ source: string;
31
+ }
32
+ export interface TimeRange {
33
+ start: Date;
34
+ end: Date;
35
+ }
36
+ export interface PriceHistory {
37
+ asset: string;
38
+ prices: Array<{
39
+ price: number;
40
+ timestamp: number;
41
+ }>;
42
+ range: TimeRange;
43
+ }
44
+ /**
45
+ * OracleModule - Universal oracle data fetching
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * // Get oracle data
50
+ * const data = await sdk.oracle.getData({
51
+ * source: 'chainlink',
52
+ * parameters: { asset: 'ETH/USD' }
53
+ * })
54
+ *
55
+ * // Get price feed
56
+ * const price = await sdk.oracle.getPrice('ETH')
57
+ *
58
+ * // Subscribe to updates
59
+ * const sub = await sdk.oracle.subscribe(
60
+ * { source: 'chainlink', parameters: { asset: 'ETH/USD' } },
61
+ * (data) => console.log('New price:', data.value)
62
+ * )
63
+ * ```
64
+ */
65
+ export declare class OracleModule {
66
+ private sdk;
67
+ private subscriptions;
68
+ constructor(sdk: VaritySDK);
69
+ /**
70
+ * Get data from oracle
71
+ *
72
+ * @param query - Oracle query
73
+ * @returns Oracle data
74
+ */
75
+ getData(query: OracleQuery): Promise<OracleData>;
76
+ /**
77
+ * Subscribe to oracle data updates
78
+ *
79
+ * @param query - Oracle query
80
+ * @param callback - Data callback
81
+ * @returns Subscription
82
+ */
83
+ subscribe(query: OracleQuery, callback: DataCallback): Promise<Subscription>;
84
+ /**
85
+ * Unsubscribe from oracle data
86
+ *
87
+ * @param subscriptionId - Subscription identifier
88
+ */
89
+ unsubscribe(subscriptionId: string): Promise<void>;
90
+ /**
91
+ * Get current price for an asset
92
+ *
93
+ * @param asset - Asset symbol (e.g., 'ETH', 'BTC')
94
+ * @returns Price data
95
+ */
96
+ getPrice(asset: string): Promise<PriceData>;
97
+ /**
98
+ * Get price history for an asset
99
+ *
100
+ * @param asset - Asset symbol
101
+ * @param range - Time range
102
+ * @returns Price history
103
+ */
104
+ getPriceHistory(asset: string, range: TimeRange): Promise<PriceHistory>;
105
+ /**
106
+ * Remove all subscriptions
107
+ */
108
+ removeAllSubscriptions(): Promise<void>;
109
+ }
110
+ //# sourceMappingURL=OracleModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OracleModule.d.ts","sourceRoot":"","sources":["../../../src/modules/oracle/OracleModule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,CAAA;IACX,GAAG,EAAE,IAAI,CAAA;CACV;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC,CAAA;IACF,KAAK,EAAE,SAAS,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAW;IACtB,OAAO,CAAC,aAAa,CAA8B;gBAEvC,GAAG,EAAE,SAAS;IAI1B;;;;;OAKG;IACG,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAoBtD;;;;;;OAMG;IACG,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAuBlF;;;;OAIG;IACG,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxD;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAejD;;;;;;OAMG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;IA2B7E;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9C"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Varity SDK - Oracle Module
3
+ *
4
+ * Universal oracle data fetching.
5
+ * Works across all templates (ISO, Healthcare, Retail, etc.)
6
+ */
7
+ /**
8
+ * OracleModule - Universal oracle data fetching
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Get oracle data
13
+ * const data = await sdk.oracle.getData({
14
+ * source: 'chainlink',
15
+ * parameters: { asset: 'ETH/USD' }
16
+ * })
17
+ *
18
+ * // Get price feed
19
+ * const price = await sdk.oracle.getPrice('ETH')
20
+ *
21
+ * // Subscribe to updates
22
+ * const sub = await sdk.oracle.subscribe(
23
+ * { source: 'chainlink', parameters: { asset: 'ETH/USD' } },
24
+ * (data) => console.log('New price:', data.value)
25
+ * )
26
+ * ```
27
+ */
28
+ export class OracleModule {
29
+ constructor(sdk) {
30
+ this.subscriptions = new Map();
31
+ this.sdk = sdk;
32
+ }
33
+ /**
34
+ * Get data from oracle
35
+ *
36
+ * @param query - Oracle query
37
+ * @returns Oracle data
38
+ */
39
+ async getData(query) {
40
+ const apiEndpoint = this.sdk.getAPIEndpoint();
41
+ const apiKey = this.sdk.getAPIKey();
42
+ const response = await fetch(`${apiEndpoint}/api/v1/oracle/query`, {
43
+ method: 'POST',
44
+ headers: {
45
+ 'Content-Type': 'application/json',
46
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
47
+ },
48
+ body: JSON.stringify(query)
49
+ });
50
+ if (!response.ok) {
51
+ throw new Error(`Oracle query failed: ${response.statusText}`);
52
+ }
53
+ return await response.json();
54
+ }
55
+ /**
56
+ * Subscribe to oracle data updates
57
+ *
58
+ * @param query - Oracle query
59
+ * @param callback - Data callback
60
+ * @returns Subscription
61
+ */
62
+ async subscribe(query, callback) {
63
+ const subscriptionId = `${query.source}:${JSON.stringify(query.parameters)}`;
64
+ // For v1, we use polling. Future versions could use WebSocket
65
+ const pollInterval = setInterval(async () => {
66
+ try {
67
+ const data = await this.getData(query);
68
+ callback(data);
69
+ }
70
+ catch (error) {
71
+ console.error('Oracle subscription error:', error);
72
+ }
73
+ }, 5000); // Poll every 5 seconds
74
+ this.subscriptions.set(subscriptionId, pollInterval);
75
+ return {
76
+ id: subscriptionId,
77
+ unsubscribe: async () => {
78
+ await this.unsubscribe(subscriptionId);
79
+ }
80
+ };
81
+ }
82
+ /**
83
+ * Unsubscribe from oracle data
84
+ *
85
+ * @param subscriptionId - Subscription identifier
86
+ */
87
+ async unsubscribe(subscriptionId) {
88
+ const interval = this.subscriptions.get(subscriptionId);
89
+ if (interval) {
90
+ clearInterval(interval);
91
+ this.subscriptions.delete(subscriptionId);
92
+ console.log(`✅ Unsubscribed from ${subscriptionId}`);
93
+ }
94
+ }
95
+ /**
96
+ * Get current price for an asset
97
+ *
98
+ * @param asset - Asset symbol (e.g., 'ETH', 'BTC')
99
+ * @returns Price data
100
+ */
101
+ async getPrice(asset) {
102
+ const data = await this.getData({
103
+ source: 'chainlink',
104
+ parameters: { asset: `${asset}/USD` }
105
+ });
106
+ return {
107
+ asset,
108
+ price: data.value,
109
+ currency: 'USD',
110
+ timestamp: data.timestamp,
111
+ source: data.source
112
+ };
113
+ }
114
+ /**
115
+ * Get price history for an asset
116
+ *
117
+ * @param asset - Asset symbol
118
+ * @param range - Time range
119
+ * @returns Price history
120
+ */
121
+ async getPriceHistory(asset, range) {
122
+ const apiEndpoint = this.sdk.getAPIEndpoint();
123
+ const apiKey = this.sdk.getAPIKey();
124
+ const response = await fetch(`${apiEndpoint}/api/v1/oracle/price-history`, {
125
+ method: 'POST',
126
+ headers: {
127
+ 'Content-Type': 'application/json',
128
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
129
+ },
130
+ body: JSON.stringify({
131
+ asset,
132
+ start: range.start.toISOString(),
133
+ end: range.end.toISOString()
134
+ })
135
+ });
136
+ if (!response.ok) {
137
+ throw new Error(`Price history failed: ${response.statusText}`);
138
+ }
139
+ return await response.json();
140
+ }
141
+ /**
142
+ * Remove all subscriptions
143
+ */
144
+ async removeAllSubscriptions() {
145
+ for (const [id, interval] of this.subscriptions.entries()) {
146
+ clearInterval(interval);
147
+ }
148
+ this.subscriptions.clear();
149
+ console.log('✅ All oracle subscriptions removed');
150
+ }
151
+ }