@explorins/pers-sdk 1.1.2 → 1.2.0

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 (276) hide show
  1. package/dist/analytics/api/analytics-api.d.ts +17 -0
  2. package/dist/analytics/api/analytics-api.d.ts.map +1 -0
  3. package/{src/analytics/index.ts → dist/analytics/index.d.ts} +28 -52
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/models/index.d.ts +61 -0
  6. package/dist/analytics/models/index.d.ts.map +1 -0
  7. package/dist/analytics/services/analytics-service.d.ts +19 -0
  8. package/dist/analytics/services/analytics-service.d.ts.map +1 -0
  9. package/dist/analytics.cjs +76 -0
  10. package/dist/analytics.cjs.map +1 -0
  11. package/dist/analytics.js +72 -0
  12. package/dist/analytics.js.map +1 -0
  13. package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
  14. package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
  15. package/dist/auth-admin/index.d.ts +26 -0
  16. package/dist/auth-admin/index.d.ts.map +1 -0
  17. package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
  18. package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
  19. package/dist/auth-admin.cjs +96 -0
  20. package/dist/auth-admin.cjs.map +1 -0
  21. package/dist/auth-admin.js +92 -0
  22. package/dist/auth-admin.js.map +1 -0
  23. package/dist/business/api/business-api.d.ts +133 -0
  24. package/dist/business/api/business-api.d.ts.map +1 -0
  25. package/dist/business/index.d.ts +34 -0
  26. package/dist/business/index.d.ts.map +1 -0
  27. package/dist/business/models/index.d.ts +8 -0
  28. package/dist/business/models/index.d.ts.map +1 -0
  29. package/dist/business/services/business-service.d.ts +51 -0
  30. package/dist/business/services/business-service.d.ts.map +1 -0
  31. package/dist/business.cjs +303 -0
  32. package/dist/business.cjs.map +1 -0
  33. package/dist/business.js +299 -0
  34. package/dist/business.js.map +1 -0
  35. package/dist/campaign/api/campaign-api.d.ts +213 -0
  36. package/dist/campaign/api/campaign-api.d.ts.map +1 -0
  37. package/dist/campaign/index.d.ts +44 -0
  38. package/dist/campaign/index.d.ts.map +1 -0
  39. package/dist/campaign/services/campaign-service.d.ts +88 -0
  40. package/dist/campaign/services/campaign-service.d.ts.map +1 -0
  41. package/dist/campaign.cjs +506 -0
  42. package/dist/campaign.cjs.map +1 -0
  43. package/dist/campaign.js +502 -0
  44. package/dist/campaign.js.map +1 -0
  45. package/dist/core/abstractions/http-client.d.ts +22 -0
  46. package/dist/core/abstractions/http-client.d.ts.map +1 -0
  47. package/dist/core/auth/auth-provider.interface.d.ts +12 -0
  48. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
  49. package/dist/core/auth/create-auth-provider.d.ts +27 -0
  50. package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
  51. package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
  52. package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
  53. package/dist/core/index.d.ts +13 -0
  54. package/dist/core/index.d.ts.map +1 -0
  55. package/dist/core/pers-api-client.d.ts +54 -0
  56. package/dist/core/pers-api-client.d.ts.map +1 -0
  57. package/dist/core/pers-config.d.ts +38 -0
  58. package/dist/core/pers-config.d.ts.map +1 -0
  59. package/dist/core/utils/jwt.function.d.ts +2 -0
  60. package/dist/core/utils/jwt.function.d.ts.map +1 -0
  61. package/dist/core.cjs +506 -0
  62. package/dist/core.cjs.map +1 -0
  63. package/dist/core.js +497 -0
  64. package/dist/core.js.map +1 -0
  65. package/dist/donation/api/donation-api.d.ts +18 -0
  66. package/dist/donation/api/donation-api.d.ts.map +1 -0
  67. package/dist/donation/index.d.ts +25 -0
  68. package/dist/donation/index.d.ts.map +1 -0
  69. package/{src/donation/models/index.ts → dist/donation/models/index.d.ts} +8 -11
  70. package/dist/donation/models/index.d.ts.map +1 -0
  71. package/dist/donation/services/donation-service.d.ts +19 -0
  72. package/dist/donation/services/donation-service.d.ts.map +1 -0
  73. package/dist/donation.cjs +78 -0
  74. package/dist/donation.cjs.map +1 -0
  75. package/dist/donation.js +74 -0
  76. package/dist/donation.js.map +1 -0
  77. package/dist/index.cjs +4217 -0
  78. package/dist/index.cjs.map +1 -0
  79. package/dist/index.d.ts +21 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +4164 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/package.json +129 -0
  84. package/dist/payment/api/payment-api.d.ts +105 -0
  85. package/dist/payment/api/payment-api.d.ts.map +1 -0
  86. package/dist/payment/index.d.ts +36 -0
  87. package/dist/payment/index.d.ts.map +1 -0
  88. package/dist/payment/models/index.d.ts +12 -0
  89. package/dist/payment/models/index.d.ts.map +1 -0
  90. package/dist/payment/services/payment-service.d.ts +40 -0
  91. package/dist/payment/services/payment-service.d.ts.map +1 -0
  92. package/dist/payment.cjs +258 -0
  93. package/dist/payment.cjs.map +1 -0
  94. package/dist/payment.js +254 -0
  95. package/dist/payment.js.map +1 -0
  96. package/dist/pers-sdk.d.ts +29 -0
  97. package/dist/pers-sdk.d.ts.map +1 -0
  98. package/dist/redemption/api/redemption-api.d.ts +147 -0
  99. package/dist/redemption/api/redemption-api.d.ts.map +1 -0
  100. package/dist/redemption/index.d.ts +35 -0
  101. package/dist/redemption/index.d.ts.map +1 -0
  102. package/dist/redemption/models/index.d.ts +8 -0
  103. package/dist/redemption/models/index.d.ts.map +1 -0
  104. package/dist/redemption/services/redemption-service.d.ts +56 -0
  105. package/dist/redemption/services/redemption-service.d.ts.map +1 -0
  106. package/dist/redemption.cjs +333 -0
  107. package/dist/redemption.cjs.map +1 -0
  108. package/dist/redemption.js +329 -0
  109. package/dist/redemption.js.map +1 -0
  110. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
  111. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
  112. package/dist/tenant/api/tenant-api.d.ts +56 -0
  113. package/dist/tenant/api/tenant-api.d.ts.map +1 -0
  114. package/dist/tenant/index.d.ts +34 -0
  115. package/dist/tenant/index.d.ts.map +1 -0
  116. package/dist/tenant/models/index.d.ts +11 -0
  117. package/dist/tenant/models/index.d.ts.map +1 -0
  118. package/dist/tenant/services/tenant-service.d.ts +46 -0
  119. package/dist/tenant/services/tenant-service.d.ts.map +1 -0
  120. package/dist/tenant.cjs +177 -0
  121. package/dist/tenant.cjs.map +1 -0
  122. package/dist/tenant.js +173 -0
  123. package/dist/tenant.js.map +1 -0
  124. package/dist/token/api/token-api.d.ts +64 -0
  125. package/dist/token/api/token-api.d.ts.map +1 -0
  126. package/dist/token/base/base-token-service.d.ts +87 -0
  127. package/dist/token/base/base-token-service.d.ts.map +1 -0
  128. package/dist/token/index.d.ts +13 -0
  129. package/dist/token/index.d.ts.map +1 -0
  130. package/dist/token/models/index.d.ts +18 -0
  131. package/dist/token/models/index.d.ts.map +1 -0
  132. package/dist/token/services/token-service.d.ts +68 -0
  133. package/dist/token/services/token-service.d.ts.map +1 -0
  134. package/dist/token/token-sdk.d.ts +140 -0
  135. package/dist/token/token-sdk.d.ts.map +1 -0
  136. package/dist/token.cjs +537 -0
  137. package/dist/token.cjs.map +1 -0
  138. package/dist/token.js +532 -0
  139. package/dist/token.js.map +1 -0
  140. package/dist/transaction/api/transaction-api.d.ts +133 -0
  141. package/dist/transaction/api/transaction-api.d.ts.map +1 -0
  142. package/dist/transaction/index.d.ts +38 -0
  143. package/dist/transaction/index.d.ts.map +1 -0
  144. package/dist/transaction/models/index.d.ts +42 -0
  145. package/dist/transaction/models/index.d.ts.map +1 -0
  146. package/dist/transaction/services/transaction-service.d.ts +56 -0
  147. package/dist/transaction/services/transaction-service.d.ts.map +1 -0
  148. package/dist/transaction.cjs +394 -0
  149. package/dist/transaction.cjs.map +1 -0
  150. package/dist/transaction.js +390 -0
  151. package/dist/transaction.js.map +1 -0
  152. package/dist/user/api/user-api.d.ts +56 -0
  153. package/dist/user/api/user-api.d.ts.map +1 -0
  154. package/dist/user/index.d.ts +36 -0
  155. package/dist/user/index.d.ts.map +1 -0
  156. package/{src/user/models/index.ts → dist/user/models/index.d.ts} +12 -10
  157. package/dist/user/models/index.d.ts.map +1 -0
  158. package/dist/user/services/user-service.d.ts +46 -0
  159. package/dist/user/services/user-service.d.ts.map +1 -0
  160. package/dist/user-status/api/user-status-api.d.ts +37 -0
  161. package/dist/user-status/api/user-status-api.d.ts.map +1 -0
  162. package/dist/user-status/index.d.ts +28 -0
  163. package/dist/user-status/index.d.ts.map +1 -0
  164. package/{src/user-status/models/index.ts → dist/user-status/models/index.d.ts} +8 -11
  165. package/dist/user-status/models/index.d.ts.map +1 -0
  166. package/dist/user-status/services/user-status-service.d.ts +26 -0
  167. package/dist/user-status/services/user-status-service.d.ts.map +1 -0
  168. package/dist/user-status.cjs +147 -0
  169. package/dist/user-status.cjs.map +1 -0
  170. package/dist/user-status.js +143 -0
  171. package/dist/user-status.js.map +1 -0
  172. package/dist/user.cjs +188 -0
  173. package/dist/user.cjs.map +1 -0
  174. package/dist/user.js +184 -0
  175. package/dist/user.js.map +1 -0
  176. package/dist/web3/api/web3-api.d.ts +27 -0
  177. package/dist/web3/api/web3-api.d.ts.map +1 -0
  178. package/dist/web3/index.d.ts +16 -0
  179. package/dist/web3/index.d.ts.map +1 -0
  180. package/dist/web3/models/index.d.ts +92 -0
  181. package/dist/web3/models/index.d.ts.map +1 -0
  182. package/dist/web3/services/web3-service.d.ts +21 -0
  183. package/dist/web3/services/web3-service.d.ts.map +1 -0
  184. package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
  185. package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
  186. package/dist/web3-chain/index.d.ts +17 -0
  187. package/dist/web3-chain/index.d.ts.map +1 -0
  188. package/{src/web3-chain/models/index.ts → dist/web3-chain/models/index.d.ts} +38 -45
  189. package/dist/web3-chain/models/index.d.ts.map +1 -0
  190. package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
  191. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
  192. package/dist/web3-chain/services/provider.service.d.ts +15 -0
  193. package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
  194. package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
  195. package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
  196. package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
  197. package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
  198. package/dist/web3-chain.cjs +316 -0
  199. package/dist/web3-chain.cjs.map +1 -0
  200. package/dist/web3-chain.js +310 -0
  201. package/dist/web3-chain.js.map +1 -0
  202. package/dist/web3.cjs +516 -0
  203. package/dist/web3.cjs.map +1 -0
  204. package/dist/web3.js +513 -0
  205. package/dist/web3.js.map +1 -0
  206. package/package.json +56 -72
  207. package/config/domains.js +0 -22
  208. package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
  209. package/rollup.config.js +0 -74
  210. package/scripts/copy-declarations.js +0 -147
  211. package/src/analytics/api/analytics-api.ts +0 -24
  212. package/src/analytics/models/index.ts +0 -74
  213. package/src/analytics/services/analytics-service.ts +0 -28
  214. package/src/auth-admin/api/auth-admin-api.ts +0 -42
  215. package/src/auth-admin/index.ts +0 -47
  216. package/src/auth-admin/services/auth-admin-service.ts +0 -36
  217. package/src/business/api/business-api.ts +0 -234
  218. package/src/business/index.ts +0 -53
  219. package/src/business/models/index.ts +0 -13
  220. package/src/business/services/business-service.ts +0 -88
  221. package/src/campaign/api/campaign-api.ts +0 -376
  222. package/src/campaign/index.ts +0 -67
  223. package/src/campaign/services/campaign-service.ts +0 -164
  224. package/src/core/abstractions/http-client.ts +0 -24
  225. package/src/core/auth/auth-provider.interface.ts +0 -16
  226. package/src/core/auth/create-auth-provider.ts +0 -136
  227. package/src/core/auth/simple-auth-config.interface.ts +0 -15
  228. package/src/core/index.ts +0 -33
  229. package/src/core/pers-api-client.ts +0 -343
  230. package/src/core/pers-config.ts +0 -65
  231. package/src/core/utils/jwt.function.ts +0 -24
  232. package/src/donation/api/donation-api.ts +0 -24
  233. package/src/donation/index.ts +0 -47
  234. package/src/donation/services/donation-service.ts +0 -25
  235. package/src/index.ts +0 -55
  236. package/src/payment/api/payment-api.ts +0 -185
  237. package/src/payment/index.ts +0 -64
  238. package/src/payment/models/index.ts +0 -29
  239. package/src/payment/services/payment-service.ts +0 -70
  240. package/src/pers-sdk.ts +0 -45
  241. package/src/redemption/api/redemption-api.ts +0 -241
  242. package/src/redemption/index.ts +0 -60
  243. package/src/redemption/models/index.ts +0 -17
  244. package/src/redemption/services/redemption-service.ts +0 -103
  245. package/src/shared/interfaces/pers-shared-lib.interfaces.ts +0 -99
  246. package/src/tenant/api/tenant-api.ts +0 -92
  247. package/src/tenant/index.ts +0 -61
  248. package/src/tenant/models/index.ts +0 -20
  249. package/src/tenant/services/tenant-service.ts +0 -78
  250. package/src/token/api/token-api.ts +0 -129
  251. package/src/token/base/base-token-service.ts +0 -167
  252. package/src/token/index.ts +0 -38
  253. package/src/token/models/index.ts +0 -30
  254. package/src/token/services/token-service.ts +0 -125
  255. package/src/token/token-sdk.ts +0 -231
  256. package/src/transaction/api/transaction-api.ts +0 -296
  257. package/src/transaction/index.ts +0 -65
  258. package/src/transaction/models/index.ts +0 -60
  259. package/src/transaction/services/transaction-service.ts +0 -104
  260. package/src/user/api/user-api.ts +0 -98
  261. package/src/user/index.ts +0 -62
  262. package/src/user/services/user-service.ts +0 -75
  263. package/src/user-status/api/user-status-api.ts +0 -78
  264. package/src/user-status/index.ts +0 -55
  265. package/src/user-status/services/user-status-service.ts +0 -51
  266. package/src/web3/api/web3-api.ts +0 -68
  267. package/src/web3/index.ts +0 -38
  268. package/src/web3/models/index.ts +0 -150
  269. package/src/web3/services/web3-service.ts +0 -338
  270. package/src/web3-chain/api/web3-chain-api.ts +0 -42
  271. package/src/web3-chain/index.ts +0 -27
  272. package/src/web3-chain/services/getWeb3FCD.service.ts +0 -47
  273. package/src/web3-chain/services/provider.service.ts +0 -123
  274. package/src/web3-chain/services/public-http-provider.service.ts +0 -26
  275. package/src/web3-chain/services/web3-chain-service.ts +0 -131
  276. package/tsconfig.json +0 -28
@@ -1,78 +0,0 @@
1
- import { AdminDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
2
- import { TenantApi } from '../api/tenant-api';
3
- import {
4
- TenantPublicDTO,
5
- TenantClientConfigDTO,
6
- AdminCreateRequestDTO
7
- } from '../models';
8
-
9
- /**
10
- * Platform-Agnostic Tenant Service
11
- *
12
- * Contains tenant business logic and operations that work across platforms.
13
- * No framework dependencies - pure TypeScript business logic.
14
- * Matches framework TenantApiService capabilities exactly.
15
- */
16
- export class TenantService {
17
- constructor(private tenantApi: TenantApi) {}
18
-
19
- // ==========================================
20
- // PUBLIC OPERATIONS
21
- // ==========================================
22
-
23
- /**
24
- * PUBLIC: Get tenant public information
25
- */
26
- async getRemoteTenant(): Promise<TenantPublicDTO> {
27
- return this.tenantApi.getRemoteTenant();
28
- }
29
-
30
- /**
31
- * PUBLIC: Get remote login token
32
- */
33
- async getRemoteLoginToken(): Promise<string> {
34
- return this.tenantApi.getRemoteLoginToken();
35
- }
36
-
37
- /**
38
- * PUBLIC: Get remote client configuration
39
- */
40
- async getRemoteClientConfig(): Promise<TenantClientConfigDTO> {
41
- return this.tenantApi.getRemoteClientConfig();
42
- }
43
-
44
- // ==========================================
45
- // ADMIN OPERATIONS
46
- // ==========================================
47
-
48
- /**
49
- * ADMIN: Update tenant information
50
- * ✅ FIXED: Uses TenantPublicDTO directly like framework
51
- */
52
- async updateRemoteTenant(tenantData: TenantPublicDTO): Promise<TenantPublicDTO> {
53
- return this.tenantApi.updateRemoteTenant(tenantData);
54
- }
55
-
56
- /**
57
- * ADMIN: Get all tenant admins
58
- */
59
- async getAdmins(): Promise<AdminDTO[]> {
60
- return this.tenantApi.getAdmins();
61
- }
62
-
63
- /**
64
- * ADMIN: Create new admin
65
- * ✅ FIXED: Renamed to match framework postAdmin method
66
- */
67
- async postAdmin(adminData: AdminCreateRequestDTO): Promise<AdminDTO> {
68
- return this.tenantApi.postAdmin(adminData);
69
- }
70
-
71
- /**
72
- * ADMIN: Update admin (toggle tenant association)
73
- * ✅ FIXED: Renamed to match framework putAdmin method
74
- */
75
- async putAdmin(adminId: string, adminData: AdminCreateRequestDTO): Promise<AdminDTO> {
76
- return this.tenantApi.putAdmin(adminId, adminData);
77
- }
78
- }
@@ -1,129 +0,0 @@
1
- import { PersApiClient } from '../../core/pers-api-client';
2
- import {
3
- TokenDTO,
4
- TokenTypeDTO,
5
- TokenCreateRequestDTO,
6
- TokenStorageData,
7
- TokenUpdateRequestDTO,
8
- TokenMetadataDTO
9
- } from '../models';
10
-
11
-
12
- export class TokenApi {
13
- constructor(private apiClient: PersApiClient) {}
14
-
15
- private basePath = '/tokens';
16
-
17
- // ==========================================
18
- // PUBLIC OPERATIONS
19
- // ==========================================
20
-
21
- /**
22
- * PUBLIC: Get all remote tokens
23
- * ENHANCED: Added admin filtering capability
24
- */
25
- async getRemoteTokens(includeInactive: boolean = false): Promise<TokenDTO[]> {
26
- const url = includeInactive ? `${this.basePath}?active=false` : `${this.basePath}`;
27
- return this.apiClient.get<TokenDTO[]>(url);
28
- }
29
-
30
- /**
31
- * PUBLIC: Get all remote token types
32
- */
33
- async getRemoteTokenTypes(): Promise<TokenTypeDTO[]> {
34
- return this.apiClient.get<TokenTypeDTO[]>(`${this.basePath}/types`);
35
- }
36
-
37
- /**
38
- * PUBLIC: Get active point token (was credit token)
39
- */
40
- async getRemoteActiveCreditToken(): Promise<TokenDTO> {
41
- return this.apiClient.get<TokenDTO>(`${this.basePath}/points`);
42
- }
43
-
44
- /**
45
- * PUBLIC: Get reward tokens
46
- * ENHANCED: Added admin filtering capability
47
- */
48
- async getRemoteRewardTokens(includeInactive: boolean = false): Promise<TokenDTO[]> {
49
- const url = includeInactive ? `${this.basePath}/rewards?active=false` : `${this.basePath}/rewards`;
50
- return this.apiClient.get<TokenDTO[]>(url);
51
- }
52
-
53
- /**
54
- * PUBLIC: Get stamp tokens (was status tokens)
55
- * ENHANCED: Added admin filtering capability
56
- */
57
- async getRemoteStatusTokens(includeInactive: boolean = false): Promise<TokenDTO[]> {
58
- const url = includeInactive ? `${this.basePath}/stamps?active=false` : `${this.basePath}/stamps`;
59
- return this.apiClient.get<TokenDTO[]>(url);
60
- }
61
-
62
- /**
63
- * PUBLIC: Get token by contract address
64
- */
65
- async getTokenByContractAddress(contractAddress: string, contractTokenId: string | null): Promise<TokenDTO> {
66
- let url = `${this.basePath}/address/${contractAddress}`;
67
- if (contractTokenId) {
68
- url += `?contractTokenId=${contractTokenId}`;
69
- }
70
- return this.apiClient.get<TokenDTO>(url);
71
- }
72
-
73
- // ==========================================
74
- // ADMIN OPERATIONS
75
- // ==========================================
76
-
77
- /**
78
- * ADMIN: Create new token
79
- */
80
- async createToken(tokenData: TokenCreateRequestDTO): Promise<TokenDTO> {
81
- return this.apiClient.post<TokenDTO>(`${this.basePath}`, tokenData);
82
- }
83
-
84
- /**
85
- * ADMIN: Update token
86
- */
87
- async updateToken(tokenId: string, tokenData: TokenUpdateRequestDTO): Promise<TokenDTO> {
88
- return this.apiClient.put<TokenDTO>(`${this.basePath}/${tokenId}`, tokenData);
89
- }
90
-
91
- /**
92
- * ADMIN: Toggle token active status
93
- * FIXED: Now calls correct endpoint
94
- */
95
- async toggleTokenActive(tokenId: string): Promise<TokenDTO> {
96
- return this.apiClient.put<TokenDTO>(`${this.basePath}/${tokenId}/status`, {});
97
- }
98
-
99
- /**
100
- * ADMIN: Set mainnet contract address
101
- */
102
- async setMainnetContract(tokenId: string, contractAddress: string, chainId: number): Promise<TokenDTO> {
103
- return this.apiClient.put<TokenDTO>(`${this.basePath}/${tokenId}/mainnet`, {
104
- contractAddress,
105
- chainId
106
- });
107
- }
108
-
109
- /**
110
- * ADMIN: Create token metadata
111
- */
112
- async createTokenMetadata(tokenId: string, tokenData: TokenStorageData): Promise<TokenDTO> {
113
- return this.apiClient.post<TokenDTO>(`${this.basePath}/${tokenId}/metadata`, tokenData);
114
- }
115
-
116
- /**
117
- * ADMIN: Toggle token metadata status (separate from token status)
118
- */
119
- async toggleTokenMetadataStatus(metadataId: string): Promise<TokenMetadataDTO> {
120
- return this.apiClient.put<TokenMetadataDTO>(`${this.basePath}/metadata/${metadataId}/status`, {});
121
- }
122
-
123
- /**
124
- * ADMIN: Create token type
125
- */
126
- async createTokenType(tokenType: TokenTypeDTO): Promise<TokenTypeDTO> {
127
- return this.apiClient.post<TokenTypeDTO>(`${this.basePath}/types`, tokenType);
128
- }
129
- }
@@ -1,167 +0,0 @@
1
- import { PersApiClient } from '../../core/pers-api-client';
2
- import { TokenApi } from '../api/token-api';
3
- import { TokenService as TokenBusinessService } from '../services/token-service';
4
- import {
5
- TokenDTO,
6
- TokenStorageData,
7
- TokenCreateRequestDTO,
8
- TokenUpdateRequestDTO,
9
- TokenMetadataDTO
10
- } from '../models';
11
- import { TokenTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
12
-
13
- /**
14
- * Abstract Base Token Service - Explicit Initialization Pattern
15
- *
16
- * Platform-agnostic token operations with Promise-based API.
17
- * Framework services extend this and control initialization lifecycle.
18
- *
19
- * Benefits:
20
- * - Explicit initialization control
21
- * - Better error boundaries
22
- * - Clear lifecycle management
23
- * - Testable initialization state
24
- * - Zero framework dependencies
25
- */
26
- export abstract class BaseTokenService {
27
- // Private token service layers - initialized explicitly
28
- private _tokenApi?: TokenApi;
29
- private _tokenBusinessService?: TokenBusinessService;
30
- private _isInitialized = false;
31
-
32
- // ==========================================
33
- // INITIALIZATION LIFECYCLE
34
- // ==========================================
35
-
36
- /**
37
- * LIFECYCLE: Initialize token service with API client
38
- * Must be called before using any token operations
39
- */
40
- protected initializeTokenService(apiClient: PersApiClient): void {
41
- if (!apiClient) {
42
- throw new Error('Cannot initialize TokenService: apiClient is null or undefined');
43
- }
44
-
45
- if (!this._isInitialized) {
46
- this._tokenApi = new TokenApi(apiClient);
47
- this._tokenBusinessService = new TokenBusinessService(this._tokenApi);
48
- this._isInitialized = true;
49
- }
50
- }
51
-
52
- /**
53
- * LIFECYCLE: Check if token service is initialized
54
- */
55
- protected get isTokenServiceInitialized(): boolean {
56
- return this._isInitialized;
57
- }
58
-
59
- /**
60
- * INTERNAL: Get token business service (throws if not initialized)
61
- */
62
- private get tokenBusinessService(): TokenBusinessService {
63
- if (!this._tokenBusinessService) {
64
- throw new Error('TokenService not initialized. Call initializeTokenService(apiClient) first.');
65
- }
66
- return this._tokenBusinessService;
67
- }
68
-
69
- // ==========================================
70
- // PUBLIC OPERATIONS
71
- // ==========================================
72
-
73
- /**
74
- * PUBLIC: Get all remote tokens
75
- */
76
- public getRemoteTokens(): Promise<TokenDTO[]> {
77
- return this.tokenBusinessService.getRemoteTokens();
78
- }
79
-
80
- /**
81
- * PUBLIC: Get all remote token types
82
- */
83
- public getRemoteTokenTypes(): Promise<TokenTypeDTO[]> {
84
- return this.tokenBusinessService.getRemoteTokenTypes();
85
- }
86
-
87
- /**
88
- * PUBLIC: Get active credit token
89
- */
90
- public getRemoteActiveCreditToken(): Promise<TokenDTO> {
91
- return this.tokenBusinessService.getRemoteActiveCreditToken();
92
- }
93
-
94
- /**
95
- * PUBLIC: Get reward tokens
96
- */
97
- public getRemoteRewardTokens(): Promise<TokenDTO[]> {
98
- return this.tokenBusinessService.getRemoteRewardTokens();
99
- }
100
-
101
- /**
102
- * PUBLIC: Get status tokens
103
- */
104
- public getRemoteStatusTokens(): Promise<TokenDTO[]> {
105
- return this.tokenBusinessService.getRemoteStatusTokens();
106
- }
107
-
108
- /**
109
- * PUBLIC: Get token by contract address
110
- */
111
- public getTokenByContractAddress(contractAddress: string, contractTokenId: string | null): Promise<TokenDTO> {
112
- return this.tokenBusinessService.getTokenByContractAddress(contractAddress, contractTokenId);
113
- }
114
-
115
- // ==========================================
116
- // ADMIN OPERATIONS
117
- // ==========================================
118
-
119
- /**
120
- * ADMIN: Create token metadata
121
- */
122
- public createTokenMetadata(tokenId: string, tokenData: TokenStorageData): Promise<TokenDTO> {
123
- return this.tokenBusinessService.createTokenMetadata(tokenId, tokenData);
124
- }
125
-
126
- /**
127
- * ADMIN: Toggle token active status
128
- */
129
- public toggleTokenActive(tokenId: string): Promise<TokenDTO> {
130
- return this.tokenBusinessService.toggleTokenActive(tokenId);
131
- }
132
-
133
- /**
134
- * ADMIN: Create new token
135
- */
136
- public createToken(tokenData: TokenCreateRequestDTO): Promise<TokenDTO> {
137
- return this.tokenBusinessService.createToken(tokenData);
138
- }
139
-
140
- /**
141
- * ADMIN: Update token
142
- */
143
- public updateToken(tokenId: string, tokenData: TokenUpdateRequestDTO): Promise<TokenDTO> {
144
- return this.tokenBusinessService.updateToken(tokenId, tokenData);
145
- }
146
-
147
- /**
148
- * ADMIN: Set mainnet contract address
149
- */
150
- public setMainnetContract(tokenId: string, contractAddress: string, chainId: number): Promise<TokenDTO> {
151
- return this.tokenBusinessService.setMainnetContract(tokenId, contractAddress, chainId);
152
- }
153
-
154
- /**
155
- * ADMIN: Toggle token metadata status
156
- */
157
- public toggleTokenMetadataStatus(metadataId: string): Promise<TokenMetadataDTO> {
158
- return this.tokenBusinessService.toggleTokenMetadataStatus(metadataId);
159
- }
160
-
161
- /**
162
- * ADMIN: Create token type
163
- */
164
- public createTokenType(tokenType: TokenTypeDTO): Promise<TokenTypeDTO> {
165
- return this.tokenBusinessService.createTokenType(tokenType);
166
- }
167
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-token
3
- *
4
- * Platform-agnostic Token Domain SDK for PERS ecosystem
5
- * Modern class-based approach for optimal performance and developer experience
6
- */
7
-
8
- // 🚀 MAIN SDK EXPORT - Recommended approach
9
- export { TokenSDK } from './token-sdk';
10
-
11
- // 🔧 CORE COMPONENTS - For advanced usage
12
- export { TokenApi } from './api/token-api';
13
- export { TokenService } from './services/token-service';
14
-
15
- // 📋 MODELS & TYPES
16
- export * from './models';
17
- export * from '../shared/interfaces/pers-shared-lib.interfaces';
18
-
19
- // 🔄 LEGACY EXPORTS - For backward compatibility (deprecated)
20
- export { BaseTokenService } from './base/base-token-service';
21
- // Note: ConcreteTokenService has been replaced by TokenSDK class-based approach
22
-
23
- // ==========================================
24
- // INHERITANCE PATTERN - CLEAN ARCHITECTURE
25
- // ==========================================
26
- // Framework services extend TokenService directly:
27
- //
28
- // Example usage:
29
- // export class TokenSdkApiService extends TokenService {
30
- // private persSDK = inject(PERS_ANGULAR_SDK_SERVICE);
31
- // protected get apiClient() { return this.persSDK.api(); }
32
- // }
33
- //
34
- // Benefits:
35
- // - Zero boilerplate: Just extend and provide apiClient
36
- // - Type safety: Full IntelliSense support
37
- // - Platform agnostic: SDK stays pure Promise-based
38
- // - Framework flexibility: Add Observable wrappers as needed
@@ -1,30 +0,0 @@
1
- /**
2
- * Token Domain Models
3
- *
4
- * Re-exports from @explorins/pers-shared for consistency with backend
5
- * and to provide a single import source for token-related types.
6
- */
7
-
8
- // Core token entities from centralized pers-shared interfaces
9
- export type {
10
- TokenDTO,
11
- TokenTypeDTO,
12
- TokenCreateRequestDTO,
13
- TokenUpdateRequestDTO,
14
- TokenMetadataDTO,
15
- TokenStorageData
16
- } from '../../shared/interfaces/pers-shared-lib.interfaces';
17
-
18
- // Local token interfaces
19
- export interface TokenMetadataAttribute {
20
- trait_type: TokenMetadataAttributeType;
21
- value: string;
22
- }
23
-
24
- export type TokenMetadataAttributeType = 'expiry_date' | 'creator_account_address' | 'preview_url' | 'creatorAccountAddress'
25
-
26
- export interface TokenAttribute {
27
- trait_type: string;
28
- value: string | number;
29
- display_type?: string;
30
- }
@@ -1,125 +0,0 @@
1
- import { TokenApi } from '../api/token-api';
2
- import {
3
- TokenDTO,
4
- TokenStorageData,
5
- TokenCreateRequestDTO,
6
- TokenUpdateRequestDTO,
7
- TokenMetadataDTO
8
- } from '../models';
9
- import { TokenTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
10
-
11
- /**
12
- * Platform-Agnostic Token Service
13
- *
14
- * Contains token business logic and operations that work across platforms.
15
- * No framework dependencies - pure TypeScript business logic.
16
- * Matches framework TokenApiService capabilities exactly.
17
- */
18
- export class TokenService {
19
- constructor(private tokenApi: TokenApi) {}
20
-
21
- // ==========================================
22
- // PUBLIC OPERATIONS
23
- // ==========================================
24
-
25
- /**
26
- * PUBLIC: Get all remote tokens
27
- */
28
- async getRemoteTokens(): Promise<TokenDTO[]> {
29
- return this.tokenApi.getRemoteTokens();
30
- }
31
-
32
- /**
33
- * PUBLIC: Get all remote token types
34
- */
35
- async getRemoteTokenTypes(): Promise<TokenTypeDTO[]> {
36
- return this.tokenApi.getRemoteTokenTypes();
37
- }
38
-
39
- /**
40
- * PUBLIC: Get active credit token
41
- */
42
- async getRemoteActiveCreditToken(): Promise<TokenDTO> {
43
- return this.tokenApi.getRemoteActiveCreditToken();
44
- }
45
-
46
- /**
47
- * PUBLIC: Get reward tokens
48
- */
49
- async getRemoteRewardTokens(): Promise<TokenDTO[]> {
50
- return this.tokenApi.getRemoteRewardTokens();
51
- }
52
-
53
- /**
54
- * PUBLIC: Get status tokens
55
- */
56
- async getRemoteStatusTokens(): Promise<TokenDTO[]> {
57
- return this.tokenApi.getRemoteStatusTokens();
58
- }
59
-
60
- /**
61
- * PUBLIC: Get token by contract address
62
- * ✅ FIXED: Matches framework parameter types exactly
63
- */
64
- async getTokenByContractAddress(contractAddress: string, contractTokenId: string | null): Promise<TokenDTO> {
65
- return this.tokenApi.getTokenByContractAddress(contractAddress, contractTokenId);
66
- }
67
-
68
- // ==========================================
69
- // ADMIN OPERATIONS
70
- // ==========================================
71
-
72
- /**
73
- * ADMIN: Create token metadata
74
- */
75
- async createTokenMetadata(tokenId: string, tokenData: TokenStorageData): Promise<TokenDTO> {
76
- return this.tokenApi.createTokenMetadata(tokenId, tokenData);
77
- }
78
-
79
- /**
80
- * ADMIN: Toggle token active status
81
- */
82
- async toggleTokenActive(tokenId: string): Promise<TokenDTO> {
83
- return this.tokenApi.toggleTokenActive(tokenId);
84
- }
85
-
86
- /**
87
- * ADMIN: Create new token
88
- */
89
- async createToken(tokenData: TokenCreateRequestDTO): Promise<TokenDTO> {
90
- return this.tokenApi.createToken(tokenData);
91
- }
92
-
93
- /**
94
- * ADMIN: Update token
95
- */
96
- async updateToken(tokenId: string, tokenData: TokenUpdateRequestDTO): Promise<TokenDTO> {
97
- return this.tokenApi.updateToken(tokenId, tokenData);
98
- }
99
-
100
- /**
101
- * ADMIN: Set mainnet contract address
102
- */
103
- async setMainnetContract(tokenId: string, contractAddress: string, chainId: number): Promise<TokenDTO> {
104
- return this.tokenApi.setMainnetContract(tokenId, contractAddress, chainId);
105
- }
106
-
107
- /**
108
- * ADMIN: Toggle token metadata status
109
- */
110
- async toggleTokenMetadataStatus(metadataId: string): Promise<TokenMetadataDTO> {
111
- return this.tokenApi.toggleTokenMetadataStatus(metadataId);
112
- }
113
-
114
- /**
115
- * ADMIN: Create token type
116
- */
117
- async createTokenType(tokenType: TokenTypeDTO): Promise<TokenTypeDTO> {
118
- return this.tokenApi.createTokenType(tokenType);
119
- }
120
-
121
- // ❌ REMOVED: Business logic methods not present in framework
122
- // - validateTokenMetadata() - Framework doesn't need this logic
123
- // - processTokenTransaction() - Framework doesn't handle transactions
124
- // These can be added later if actually needed
125
- }