@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,380 @@
1
+ /**
2
+ * Template Loader
3
+ *
4
+ * Utility for loading and registering built-in templates
5
+ */
6
+ import { templateRegistry } from './template';
7
+ // Import template JSON files (will be bundled by build tool)
8
+ // Note: In actual implementation, these would be imported as:
9
+ // import isoTemplate from '../../templates/iso.template.json'
10
+ // For now, we'll use a dynamic loading approach
11
+ /**
12
+ * Load built-in ISO template
13
+ */
14
+ export function loadISOTemplate() {
15
+ const template = {
16
+ type: 'iso',
17
+ name: 'ISO Merchant Services Dashboard',
18
+ version: '1.0.0',
19
+ description: 'Payment processing and merchant management platform for Independent Sales Organizations',
20
+ contracts: [
21
+ {
22
+ name: 'MerchantRegistry',
23
+ description: 'Merchant registration and management',
24
+ abi: '../../contracts/abis/iso/MerchantRegistry.json',
25
+ addresses: {
26
+ 'arbitrum-sepolia': '',
27
+ 'arbitrum-l3-testnet': '',
28
+ 'arbitrum-l3-mainnet': ''
29
+ },
30
+ required: true
31
+ },
32
+ {
33
+ name: 'TransactionVault',
34
+ description: 'Transaction recording and storage',
35
+ abi: '../../contracts/abis/iso/TransactionVault.json',
36
+ addresses: {
37
+ 'arbitrum-sepolia': '',
38
+ 'arbitrum-l3-testnet': '',
39
+ 'arbitrum-l3-mainnet': ''
40
+ },
41
+ required: true
42
+ },
43
+ {
44
+ name: 'RepPerformance',
45
+ description: 'Sales representative performance tracking',
46
+ abi: '../../contracts/abis/iso/RepPerformance.json',
47
+ addresses: {
48
+ 'arbitrum-sepolia': '',
49
+ 'arbitrum-l3-testnet': '',
50
+ 'arbitrum-l3-mainnet': ''
51
+ },
52
+ required: true
53
+ },
54
+ {
55
+ name: 'ResidualCalculator',
56
+ description: 'Residual income calculation and distribution',
57
+ abi: '../../contracts/abis/iso/ResidualCalculator.json',
58
+ addresses: {
59
+ 'arbitrum-sepolia': '',
60
+ 'arbitrum-l3-testnet': '',
61
+ 'arbitrum-l3-mainnet': ''
62
+ },
63
+ required: true
64
+ },
65
+ {
66
+ name: 'AccessControlRegistry',
67
+ description: 'Role-based access control',
68
+ abi: '../../contracts/abis/iso/AccessControlRegistry.json',
69
+ addresses: {
70
+ 'arbitrum-sepolia': '',
71
+ 'arbitrum-l3-testnet': '',
72
+ 'arbitrum-l3-mainnet': ''
73
+ },
74
+ required: true
75
+ },
76
+ {
77
+ name: 'DataProofRegistry',
78
+ description: 'Data integrity and ownership proofs',
79
+ abi: '../../contracts/abis/iso/DataProofRegistry.json',
80
+ addresses: {
81
+ 'arbitrum-sepolia': '',
82
+ 'arbitrum-l3-testnet': '',
83
+ 'arbitrum-l3-mainnet': ''
84
+ },
85
+ required: true
86
+ }
87
+ ],
88
+ entities: [
89
+ {
90
+ name: 'merchant',
91
+ displayName: 'Merchant',
92
+ description: 'Business registered for payment processing',
93
+ idField: 'merchantId',
94
+ displayField: 'businessName',
95
+ fields: [
96
+ {
97
+ name: 'merchantId',
98
+ label: 'Merchant ID',
99
+ type: 'string',
100
+ required: true
101
+ },
102
+ {
103
+ name: 'businessName',
104
+ label: 'Business Name',
105
+ type: 'string',
106
+ required: true
107
+ },
108
+ {
109
+ name: 'walletAddress',
110
+ label: 'Wallet Address',
111
+ type: 'address',
112
+ required: true
113
+ },
114
+ {
115
+ name: 'status',
116
+ label: 'Status',
117
+ type: 'enum',
118
+ required: true,
119
+ enumValues: ['PENDING', 'ACTIVE', 'SUSPENDED', 'TERMINATED']
120
+ },
121
+ {
122
+ name: 'monthlyVolume',
123
+ label: 'Monthly Volume',
124
+ type: 'number'
125
+ },
126
+ {
127
+ name: 'onboardedBy',
128
+ label: 'Onboarded By',
129
+ type: 'address'
130
+ }
131
+ ],
132
+ endpoints: {
133
+ list: '/api/v1/merchants',
134
+ get: '/api/v1/merchants/:id',
135
+ create: '/api/v1/merchants',
136
+ update: '/api/v1/merchants/:id'
137
+ }
138
+ },
139
+ {
140
+ name: 'transaction',
141
+ displayName: 'Transaction',
142
+ description: 'Payment transaction record',
143
+ idField: 'transactionId',
144
+ displayField: 'transactionId',
145
+ fields: [
146
+ {
147
+ name: 'transactionId',
148
+ label: 'Transaction ID',
149
+ type: 'string',
150
+ required: true
151
+ },
152
+ {
153
+ name: 'merchantId',
154
+ label: 'Merchant ID',
155
+ type: 'string',
156
+ required: true
157
+ },
158
+ {
159
+ name: 'amount',
160
+ label: 'Amount',
161
+ type: 'number',
162
+ required: true
163
+ },
164
+ {
165
+ name: 'type',
166
+ label: 'Type',
167
+ type: 'enum',
168
+ required: true,
169
+ enumValues: ['SALE', 'REFUND', 'CHARGEBACK', 'ADJUSTMENT']
170
+ },
171
+ {
172
+ name: 'timestamp',
173
+ label: 'Timestamp',
174
+ type: 'date',
175
+ required: true
176
+ }
177
+ ],
178
+ endpoints: {
179
+ list: '/api/v1/transactions',
180
+ get: '/api/v1/transactions/:id',
181
+ create: '/api/v1/transactions'
182
+ }
183
+ },
184
+ {
185
+ name: 'rep',
186
+ displayName: 'Sales Representative',
187
+ description: 'Sales representative managing merchants',
188
+ idField: 'repAddress',
189
+ displayField: 'repAddress',
190
+ fields: [
191
+ {
192
+ name: 'repAddress',
193
+ label: 'Rep Address',
194
+ type: 'address',
195
+ required: true
196
+ },
197
+ {
198
+ name: 'status',
199
+ label: 'Status',
200
+ type: 'enum',
201
+ required: true,
202
+ enumValues: ['ACTIVE', 'INACTIVE', 'SUSPENDED']
203
+ },
204
+ {
205
+ name: 'totalMerchants',
206
+ label: 'Total Merchants',
207
+ type: 'number'
208
+ },
209
+ {
210
+ name: 'totalResiduals',
211
+ label: 'Total Residuals',
212
+ type: 'number'
213
+ }
214
+ ],
215
+ endpoints: {
216
+ list: '/api/v1/reps',
217
+ get: '/api/v1/reps/:address',
218
+ create: '/api/v1/reps'
219
+ }
220
+ }
221
+ ],
222
+ events: [
223
+ {
224
+ name: 'merchant.registered',
225
+ displayName: 'Merchant Registered',
226
+ description: 'New merchant registered for processing',
227
+ category: 'merchant'
228
+ },
229
+ {
230
+ name: 'merchant.updated',
231
+ displayName: 'Merchant Updated',
232
+ description: 'Merchant information updated',
233
+ category: 'merchant'
234
+ },
235
+ {
236
+ name: 'merchant.status_changed',
237
+ displayName: 'Merchant Status Changed',
238
+ description: 'Merchant status changed (activated, suspended, etc.)',
239
+ category: 'merchant'
240
+ },
241
+ {
242
+ name: 'transaction.created',
243
+ displayName: 'Transaction Created',
244
+ description: 'New transaction recorded',
245
+ category: 'transaction'
246
+ },
247
+ {
248
+ name: 'transaction.voided',
249
+ displayName: 'Transaction Voided',
250
+ description: 'Transaction voided or refunded',
251
+ category: 'transaction'
252
+ },
253
+ {
254
+ name: 'rep.registered',
255
+ displayName: 'Rep Registered',
256
+ description: 'New sales representative registered',
257
+ category: 'rep'
258
+ },
259
+ {
260
+ name: 'residual.calculated',
261
+ displayName: 'Residual Calculated',
262
+ description: 'Monthly residual income calculated',
263
+ category: 'residual'
264
+ },
265
+ {
266
+ name: 'residual.paid',
267
+ displayName: 'Residual Paid',
268
+ description: 'Residual income paid to representative',
269
+ category: 'residual'
270
+ }
271
+ ],
272
+ metrics: [
273
+ {
274
+ name: 'total_merchants',
275
+ displayName: 'Total Merchants',
276
+ description: 'Total number of active merchants',
277
+ type: 'count',
278
+ source: '/api/v1/analytics/metrics/merchants/count',
279
+ unit: 'merchants'
280
+ },
281
+ {
282
+ name: 'total_volume',
283
+ displayName: 'Total Processing Volume',
284
+ description: 'Total payment processing volume',
285
+ type: 'sum',
286
+ source: '/api/v1/analytics/metrics/transactions/volume',
287
+ unit: 'USD',
288
+ format: 'currency'
289
+ },
290
+ {
291
+ name: 'avg_transaction_size',
292
+ displayName: 'Average Transaction Size',
293
+ description: 'Average transaction amount',
294
+ type: 'average',
295
+ source: '/api/v1/analytics/metrics/transactions/avg_size',
296
+ unit: 'USD',
297
+ format: 'currency'
298
+ },
299
+ {
300
+ name: 'chargeback_rate',
301
+ displayName: 'Chargeback Rate',
302
+ description: 'Percentage of transactions resulting in chargebacks',
303
+ type: 'percentage',
304
+ source: '/api/v1/analytics/metrics/transactions/chargeback_rate',
305
+ unit: '%',
306
+ format: 'percentage'
307
+ },
308
+ {
309
+ name: 'active_reps',
310
+ displayName: 'Active Representatives',
311
+ description: 'Number of active sales representatives',
312
+ type: 'count',
313
+ source: '/api/v1/analytics/metrics/reps/active_count',
314
+ unit: 'reps'
315
+ }
316
+ ],
317
+ dashboards: [
318
+ {
319
+ name: 'overview',
320
+ displayName: 'Overview Dashboard',
321
+ description: 'High-level metrics and KPIs',
322
+ defaultTimeRange: 'last_30_days',
323
+ widgets: [
324
+ {
325
+ type: 'kpi',
326
+ title: 'Total Merchants',
327
+ source: 'total_merchants',
328
+ size: { width: 3, height: 2 },
329
+ position: { x: 0, y: 0 }
330
+ },
331
+ {
332
+ type: 'kpi',
333
+ title: 'Processing Volume',
334
+ source: 'total_volume',
335
+ size: { width: 3, height: 2 },
336
+ position: { x: 3, y: 0 }
337
+ },
338
+ {
339
+ type: 'chart',
340
+ title: 'Volume Trend',
341
+ source: '/api/v1/analytics/trends/volume',
342
+ size: { width: 6, height: 4 },
343
+ position: { x: 0, y: 2 },
344
+ config: { chartType: 'line' }
345
+ }
346
+ ]
347
+ }
348
+ ],
349
+ storage: {
350
+ customerNamespacePattern: 'customer-iso-{company-id}',
351
+ encryptionEnabled: true,
352
+ litProtocolEnabled: true,
353
+ celestiaDAEnabled: true,
354
+ zkProofsEnabled: true
355
+ },
356
+ api: {
357
+ basePath: '/api/v1/iso'
358
+ },
359
+ features: {
360
+ analytics: true,
361
+ forecasting: true,
362
+ webhooks: true,
363
+ notifications: true,
364
+ export: true,
365
+ cache: true,
366
+ monitoring: true
367
+ }
368
+ };
369
+ templateRegistry.register(template);
370
+ return template;
371
+ }
372
+ /**
373
+ * Load all built-in templates
374
+ */
375
+ export function loadAllTemplates() {
376
+ loadISOTemplate();
377
+ // Future: loadHealthcareTemplate(), loadFinanceTemplate(), loadRetailTemplate()
378
+ }
379
+ // Auto-load templates when module is imported
380
+ loadAllTemplates();
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Template Configuration System
3
+ *
4
+ * Defines the schema and types for Varity templates (ISO, Healthcare, Finance, Retail, etc.)
5
+ * Enables dynamic SDK configuration based on template selection
6
+ */
7
+ import type { Network } from './types';
8
+ /**
9
+ * Available template types
10
+ */
11
+ export type TemplateType = 'iso' | 'healthcare' | 'finance' | 'retail' | 'custom';
12
+ /**
13
+ * Contract configuration for a template
14
+ */
15
+ export interface TemplateContract {
16
+ /** Contract name */
17
+ name: string;
18
+ /** Contract description */
19
+ description?: string;
20
+ /** ABI file path or inline ABI */
21
+ abi: string | any[];
22
+ /** Contract address (per network) */
23
+ addresses: Partial<Record<Network, string>>;
24
+ /** Whether contract is required for template */
25
+ required?: boolean;
26
+ }
27
+ /**
28
+ * Entity configuration (e.g., Merchant, Patient, Customer)
29
+ */
30
+ export interface TemplateEntity {
31
+ /** Entity name */
32
+ name: string;
33
+ /** Display name */
34
+ displayName: string;
35
+ /** Entity description */
36
+ description?: string;
37
+ /** Primary identifier field */
38
+ idField: string;
39
+ /** Display field for entity */
40
+ displayField: string;
41
+ /** Available fields */
42
+ fields: EntityField[];
43
+ /** API endpoints for entity CRUD */
44
+ endpoints?: {
45
+ list?: string;
46
+ get?: string;
47
+ create?: string;
48
+ update?: string;
49
+ delete?: string;
50
+ };
51
+ /** Contract mapping configuration (optional - defaults to standard patterns) */
52
+ contractMapping?: {
53
+ /** Contract name (defaults to '{Entity}Registry') */
54
+ contractName?: string;
55
+ /** Function names for CRUD operations */
56
+ functions?: {
57
+ /** Create function (defaults to 'create{Entity}') */
58
+ create?: string;
59
+ /** Get/Read function (defaults to 'get{Entity}') */
60
+ get?: string;
61
+ /** Get all/List function (defaults to 'getAll{Entity}s') */
62
+ getAll?: string;
63
+ /** Update function (defaults to 'update{Entity}') */
64
+ update?: string;
65
+ /** Delete function (defaults to 'delete{Entity}') */
66
+ delete?: string;
67
+ /** Count function (defaults to 'get{Entity}Count') */
68
+ count?: string;
69
+ };
70
+ /** Field mappings (if contract field names differ from entity field names) */
71
+ fieldMappings?: Record<string, string>;
72
+ };
73
+ }
74
+ /**
75
+ * Entity field types - Universal support for all industries
76
+ */
77
+ export type EntityFieldType = 'string' | 'number' | 'boolean' | 'enum' | 'array' | 'object' | 'currency' | 'decimal' | 'percentage' | 'date' | 'time' | 'datetime' | 'duration' | 'email' | 'phone' | 'url' | 'address' | 'ssn' | 'tax-id' | 'medical-code' | 'sku' | 'barcode' | 'rich-text' | 'markdown' | 'json' | 'file' | 'image' | 'document' | 'lookup' | 'multi-select' | 'coordinates' | 'color' | 'ip-address';
78
+ /**
79
+ * Entity field definition
80
+ */
81
+ export interface EntityField {
82
+ /** Field name */
83
+ name: string;
84
+ /** Display label */
85
+ label: string;
86
+ /** Field type */
87
+ type: EntityFieldType;
88
+ /** Whether field is required */
89
+ required?: boolean;
90
+ /** Field description */
91
+ description?: string;
92
+ /** Enum values (if type is enum or multi-select) */
93
+ enumValues?: string[];
94
+ /** Lookup configuration (if type is lookup) */
95
+ lookupConfig?: {
96
+ entity: string;
97
+ displayField: string;
98
+ valueField: string;
99
+ };
100
+ /** Validation rules */
101
+ validation?: {
102
+ min?: number;
103
+ max?: number;
104
+ minLength?: number;
105
+ maxLength?: number;
106
+ pattern?: string;
107
+ precision?: number;
108
+ fileTypes?: string[];
109
+ maxFileSize?: number;
110
+ custom?: string;
111
+ };
112
+ /** Default value */
113
+ defaultValue?: any;
114
+ /** Placeholder text */
115
+ placeholder?: string;
116
+ /** Help text */
117
+ helperText?: string;
118
+ }
119
+ /**
120
+ * Event configuration for webhooks and notifications
121
+ */
122
+ export interface TemplateEvent {
123
+ /** Event name */
124
+ name: string;
125
+ /** Display name */
126
+ displayName: string;
127
+ /** Event description */
128
+ description?: string;
129
+ /** Event category */
130
+ category: string;
131
+ /** Payload schema */
132
+ payloadSchema?: Record<string, any>;
133
+ }
134
+ /**
135
+ * Metric configuration for analytics
136
+ */
137
+ export interface TemplateMetric {
138
+ /** Metric name */
139
+ name: string;
140
+ /** Display name */
141
+ displayName: string;
142
+ /** Metric description */
143
+ description?: string;
144
+ /** Metric type */
145
+ type: 'count' | 'sum' | 'average' | 'percentage' | 'rate';
146
+ /** Data source (API endpoint or query) */
147
+ source: string;
148
+ /** Aggregation function */
149
+ aggregation?: string;
150
+ /** Unit of measurement */
151
+ unit?: string;
152
+ /** Format for display */
153
+ format?: string;
154
+ }
155
+ /**
156
+ * Dashboard configuration
157
+ */
158
+ export interface TemplateDashboard {
159
+ /** Dashboard name */
160
+ name: string;
161
+ /** Display name */
162
+ displayName: string;
163
+ /** Dashboard description */
164
+ description?: string;
165
+ /** Widgets to display */
166
+ widgets: DashboardWidget[];
167
+ /** Default time range */
168
+ defaultTimeRange?: string;
169
+ }
170
+ /**
171
+ * Dashboard widget configuration
172
+ */
173
+ export interface DashboardWidget {
174
+ /** Widget type */
175
+ type: 'kpi' | 'chart' | 'table' | 'map' | 'list' | 'custom';
176
+ /** Widget title */
177
+ title: string;
178
+ /** Data source (metric name or API endpoint) */
179
+ source: string;
180
+ /** Widget size (grid units) */
181
+ size?: {
182
+ width: number;
183
+ height: number;
184
+ };
185
+ /** Widget position */
186
+ position?: {
187
+ x: number;
188
+ y: number;
189
+ };
190
+ /** Widget configuration */
191
+ config?: Record<string, any>;
192
+ }
193
+ /**
194
+ * Storage layer configuration for template
195
+ */
196
+ export interface TemplateStorageConfig {
197
+ /** Varity internal namespace */
198
+ varityNamespace?: string;
199
+ /** Industry RAG namespace */
200
+ industryNamespace?: string;
201
+ /** Customer data namespace pattern */
202
+ customerNamespacePattern: string;
203
+ /** Encryption enabled */
204
+ encryptionEnabled: boolean;
205
+ /** Lit Protocol access conditions */
206
+ litProtocolEnabled: boolean;
207
+ /** Celestia DA enabled */
208
+ celestiaDAEnabled: boolean;
209
+ /** ZK proofs enabled */
210
+ zkProofsEnabled: boolean;
211
+ }
212
+ /**
213
+ * Complete template configuration
214
+ */
215
+ export interface TemplateConfig {
216
+ /** Template type identifier */
217
+ type: TemplateType;
218
+ /** Template name */
219
+ name: string;
220
+ /** Template version */
221
+ version: string;
222
+ /** Template description */
223
+ description?: string;
224
+ /** Smart contracts for this template */
225
+ contracts: TemplateContract[];
226
+ /** Entities (data models) */
227
+ entities: TemplateEntity[];
228
+ /** Available events */
229
+ events: TemplateEvent[];
230
+ /** Available metrics */
231
+ metrics: TemplateMetric[];
232
+ /** Dashboard configurations */
233
+ dashboards?: TemplateDashboard[];
234
+ /** Storage configuration */
235
+ storage: TemplateStorageConfig;
236
+ /** API configuration */
237
+ api?: {
238
+ /** Base path for template APIs */
239
+ basePath: string;
240
+ /** Custom endpoints */
241
+ customEndpoints?: Record<string, string>;
242
+ };
243
+ /** Feature flags */
244
+ features?: {
245
+ analytics?: boolean;
246
+ forecasting?: boolean;
247
+ webhooks?: boolean;
248
+ notifications?: boolean;
249
+ export?: boolean;
250
+ cache?: boolean;
251
+ monitoring?: boolean;
252
+ };
253
+ /** Custom configuration */
254
+ custom?: Record<string, any>;
255
+ }
256
+ /**
257
+ * Template registry for loading and managing templates
258
+ */
259
+ export declare class TemplateRegistry {
260
+ private templates;
261
+ /**
262
+ * Register a template configuration
263
+ */
264
+ register(config: TemplateConfig): void;
265
+ /**
266
+ * Get template configuration by type
267
+ */
268
+ get(type: TemplateType): TemplateConfig | undefined;
269
+ /**
270
+ * Check if template is registered
271
+ */
272
+ has(type: TemplateType): boolean;
273
+ /**
274
+ * List all registered templates
275
+ */
276
+ list(): TemplateConfig[];
277
+ /**
278
+ * Load template from JSON
279
+ */
280
+ loadFromJSON(json: string): TemplateConfig;
281
+ /**
282
+ * Load template from URL
283
+ */
284
+ loadFromURL(url: string): Promise<TemplateConfig>;
285
+ }
286
+ /**
287
+ * Global template registry instance
288
+ */
289
+ export declare const templateRegistry: TemplateRegistry;
290
+ /**
291
+ * Validate template configuration
292
+ */
293
+ export declare function validateTemplate(config: TemplateConfig): {
294
+ valid: boolean;
295
+ errors: string[];
296
+ };
297
+ /**
298
+ * Get contract ABI by name from template
299
+ */
300
+ export declare function getContractABI(template: TemplateConfig, contractName: string): any[] | null;
301
+ /**
302
+ * Get contract address for network
303
+ */
304
+ export declare function getContractAddress(template: TemplateConfig, contractName: string, network: Network): string | null;
305
+ /**
306
+ * Get entity configuration by name
307
+ */
308
+ export declare function getEntity(template: TemplateConfig, entityName: string): TemplateEntity | null;
309
+ /**
310
+ * Get metric configuration by name
311
+ */
312
+ export declare function getMetric(template: TemplateConfig, metricName: string): TemplateMetric | null;
313
+ /**
314
+ * Get event configuration by name
315
+ */
316
+ export declare function getEvent(template: TemplateConfig, eventName: string): TemplateEvent | null;
317
+ /**
318
+ * Merge template configuration with overrides
319
+ */
320
+ export declare function mergeTemplateConfig(base: TemplateConfig, overrides: Partial<TemplateConfig>): TemplateConfig;
321
+ //# sourceMappingURL=template.d.ts.map