@explorins/pers-sdk 1.1.2 → 1.1.3
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.
- package/dist/analytics/api/analytics-api.d.ts +17 -0
- package/dist/analytics/api/analytics-api.d.ts.map +1 -0
- package/{src/analytics/index.ts → dist/analytics/index.d.ts} +28 -52
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/models/index.d.ts +61 -0
- package/dist/analytics/models/index.d.ts.map +1 -0
- package/dist/analytics/services/analytics-service.d.ts +19 -0
- package/dist/analytics/services/analytics-service.d.ts.map +1 -0
- package/dist/analytics.cjs +76 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.ts +28 -0
- package/dist/analytics.js +72 -0
- package/dist/analytics.js.map +1 -0
- package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
- package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
- package/dist/auth-admin/index.d.ts +26 -0
- package/dist/auth-admin/index.d.ts.map +1 -0
- package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
- package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
- package/dist/auth-admin.cjs +96 -0
- package/dist/auth-admin.cjs.map +1 -0
- package/dist/auth-admin.d.ts +26 -0
- package/dist/auth-admin.js +92 -0
- package/dist/auth-admin.js.map +1 -0
- package/dist/business/api/business-api.d.ts +133 -0
- package/dist/business/api/business-api.d.ts.map +1 -0
- package/dist/business/index.d.ts +34 -0
- package/dist/business/index.d.ts.map +1 -0
- package/dist/business/models/index.d.ts +8 -0
- package/dist/business/models/index.d.ts.map +1 -0
- package/dist/business/services/business-service.d.ts +51 -0
- package/dist/business/services/business-service.d.ts.map +1 -0
- package/dist/business.cjs +303 -0
- package/dist/business.cjs.map +1 -0
- package/dist/business.d.ts +34 -0
- package/dist/business.js +299 -0
- package/dist/business.js.map +1 -0
- package/dist/campaign/api/campaign-api.d.ts +213 -0
- package/dist/campaign/api/campaign-api.d.ts.map +1 -0
- package/dist/campaign/index.d.ts +44 -0
- package/dist/campaign/index.d.ts.map +1 -0
- package/dist/campaign/services/campaign-service.d.ts +88 -0
- package/dist/campaign/services/campaign-service.d.ts.map +1 -0
- package/dist/campaign.cjs +506 -0
- package/dist/campaign.cjs.map +1 -0
- package/dist/campaign.d.ts +44 -0
- package/dist/campaign.js +502 -0
- package/dist/campaign.js.map +1 -0
- package/dist/core/abstractions/http-client.d.ts +22 -0
- package/dist/core/abstractions/http-client.d.ts.map +1 -0
- package/dist/core/auth/auth-provider.interface.d.ts +12 -0
- package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
- package/dist/core/auth/create-auth-provider.d.ts +27 -0
- package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
- package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
- package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/pers-api-client.d.ts +54 -0
- package/dist/core/pers-api-client.d.ts.map +1 -0
- package/dist/core/pers-config.d.ts +38 -0
- package/dist/core/pers-config.d.ts.map +1 -0
- package/dist/core/utils/jwt.function.d.ts +2 -0
- package/dist/core/utils/jwt.function.d.ts.map +1 -0
- package/dist/core.cjs +506 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +13 -0
- package/dist/core.js +497 -0
- package/dist/core.js.map +1 -0
- package/dist/donation/api/donation-api.d.ts +18 -0
- package/dist/donation/api/donation-api.d.ts.map +1 -0
- package/dist/donation/index.d.ts +25 -0
- package/dist/donation/index.d.ts.map +1 -0
- package/{src/donation/models/index.ts → dist/donation/models/index.d.ts} +8 -11
- package/dist/donation/models/index.d.ts.map +1 -0
- package/dist/donation/services/donation-service.d.ts +19 -0
- package/dist/donation/services/donation-service.d.ts.map +1 -0
- package/dist/donation.cjs +78 -0
- package/dist/donation.cjs.map +1 -0
- package/dist/donation.d.ts +25 -0
- package/dist/donation.js +74 -0
- package/dist/donation.js.map +1 -0
- package/dist/index.cjs +4217 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4164 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +148 -0
- package/dist/payment/api/payment-api.d.ts +105 -0
- package/dist/payment/api/payment-api.d.ts.map +1 -0
- package/dist/payment/index.d.ts +36 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/models/index.d.ts +12 -0
- package/dist/payment/models/index.d.ts.map +1 -0
- package/dist/payment/services/payment-service.d.ts +40 -0
- package/dist/payment/services/payment-service.d.ts.map +1 -0
- package/dist/payment.cjs +258 -0
- package/dist/payment.cjs.map +1 -0
- package/dist/payment.d.ts +36 -0
- package/dist/payment.js +254 -0
- package/dist/payment.js.map +1 -0
- package/dist/pers-sdk.d.ts +29 -0
- package/dist/pers-sdk.d.ts.map +1 -0
- package/dist/redemption/api/redemption-api.d.ts +147 -0
- package/dist/redemption/api/redemption-api.d.ts.map +1 -0
- package/dist/redemption/index.d.ts +35 -0
- package/dist/redemption/index.d.ts.map +1 -0
- package/dist/redemption/models/index.d.ts +8 -0
- package/dist/redemption/models/index.d.ts.map +1 -0
- package/dist/redemption/services/redemption-service.d.ts +56 -0
- package/dist/redemption/services/redemption-service.d.ts.map +1 -0
- package/dist/redemption.cjs +333 -0
- package/dist/redemption.cjs.map +1 -0
- package/dist/redemption.d.ts +35 -0
- package/dist/redemption.js +329 -0
- package/dist/redemption.js.map +1 -0
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
- package/dist/tenant/api/tenant-api.d.ts +56 -0
- package/dist/tenant/api/tenant-api.d.ts.map +1 -0
- package/dist/tenant/index.d.ts +34 -0
- package/dist/tenant/index.d.ts.map +1 -0
- package/dist/tenant/models/index.d.ts +11 -0
- package/dist/tenant/models/index.d.ts.map +1 -0
- package/dist/tenant/services/tenant-service.d.ts +46 -0
- package/dist/tenant/services/tenant-service.d.ts.map +1 -0
- package/dist/tenant.cjs +177 -0
- package/dist/tenant.cjs.map +1 -0
- package/dist/tenant.d.ts +34 -0
- package/dist/tenant.js +173 -0
- package/dist/tenant.js.map +1 -0
- package/dist/token/api/token-api.d.ts +64 -0
- package/dist/token/api/token-api.d.ts.map +1 -0
- package/dist/token/base/base-token-service.d.ts +87 -0
- package/dist/token/base/base-token-service.d.ts.map +1 -0
- package/dist/token/index.d.ts +13 -0
- package/dist/token/index.d.ts.map +1 -0
- package/dist/token/models/index.d.ts +18 -0
- package/dist/token/models/index.d.ts.map +1 -0
- package/dist/token/services/token-service.d.ts +68 -0
- package/dist/token/services/token-service.d.ts.map +1 -0
- package/dist/token/token-sdk.d.ts +140 -0
- package/dist/token/token-sdk.d.ts.map +1 -0
- package/dist/token.cjs +537 -0
- package/dist/token.cjs.map +1 -0
- package/dist/token.d.ts +13 -0
- package/dist/token.js +532 -0
- package/dist/token.js.map +1 -0
- package/dist/transaction/api/transaction-api.d.ts +133 -0
- package/dist/transaction/api/transaction-api.d.ts.map +1 -0
- package/dist/transaction/index.d.ts +38 -0
- package/dist/transaction/index.d.ts.map +1 -0
- package/dist/transaction/models/index.d.ts +42 -0
- package/dist/transaction/models/index.d.ts.map +1 -0
- package/dist/transaction/services/transaction-service.d.ts +56 -0
- package/dist/transaction/services/transaction-service.d.ts.map +1 -0
- package/dist/transaction.cjs +394 -0
- package/dist/transaction.cjs.map +1 -0
- package/dist/transaction.d.ts +38 -0
- package/dist/transaction.js +390 -0
- package/dist/transaction.js.map +1 -0
- package/dist/user/api/user-api.d.ts +56 -0
- package/dist/user/api/user-api.d.ts.map +1 -0
- package/dist/user/index.d.ts +36 -0
- package/dist/user/index.d.ts.map +1 -0
- package/{src/user/models/index.ts → dist/user/models/index.d.ts} +12 -10
- package/dist/user/models/index.d.ts.map +1 -0
- package/dist/user/services/user-service.d.ts +46 -0
- package/dist/user/services/user-service.d.ts.map +1 -0
- package/dist/user-status/api/user-status-api.d.ts +37 -0
- package/dist/user-status/api/user-status-api.d.ts.map +1 -0
- package/dist/user-status/index.d.ts +28 -0
- package/dist/user-status/index.d.ts.map +1 -0
- package/{src/user-status/models/index.ts → dist/user-status/models/index.d.ts} +8 -11
- package/dist/user-status/models/index.d.ts.map +1 -0
- package/dist/user-status/services/user-status-service.d.ts +26 -0
- package/dist/user-status/services/user-status-service.d.ts.map +1 -0
- package/dist/user-status.cjs +147 -0
- package/dist/user-status.cjs.map +1 -0
- package/dist/user-status.d.ts +28 -0
- package/dist/user-status.js +143 -0
- package/dist/user-status.js.map +1 -0
- package/dist/user.cjs +188 -0
- package/dist/user.cjs.map +1 -0
- package/dist/user.d.ts +36 -0
- package/dist/user.js +184 -0
- package/dist/user.js.map +1 -0
- package/dist/web3/api/web3-api.d.ts +27 -0
- package/dist/web3/api/web3-api.d.ts.map +1 -0
- package/dist/web3/index.d.ts +16 -0
- package/dist/web3/index.d.ts.map +1 -0
- package/dist/web3/models/index.d.ts +92 -0
- package/dist/web3/models/index.d.ts.map +1 -0
- package/dist/web3/services/web3-service.d.ts +21 -0
- package/dist/web3/services/web3-service.d.ts.map +1 -0
- package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
- package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
- package/dist/web3-chain/index.d.ts +17 -0
- package/dist/web3-chain/index.d.ts.map +1 -0
- package/{src/web3-chain/models/index.ts → dist/web3-chain/models/index.d.ts} +38 -45
- package/dist/web3-chain/models/index.d.ts.map +1 -0
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
- package/dist/web3-chain/services/provider.service.d.ts +15 -0
- package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
- package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
- package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
- package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
- package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
- package/dist/web3-chain.cjs +316 -0
- package/dist/web3-chain.cjs.map +1 -0
- package/dist/web3-chain.d.ts +17 -0
- package/dist/web3-chain.js +310 -0
- package/dist/web3-chain.js.map +1 -0
- package/dist/web3.cjs +516 -0
- package/dist/web3.cjs.map +1 -0
- package/dist/web3.d.ts +16 -0
- package/dist/web3.js +513 -0
- package/dist/web3.js.map +1 -0
- package/package.json +70 -67
- package/config/domains.js +0 -22
- package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
- package/rollup.config.js +0 -74
- package/scripts/copy-declarations.js +0 -147
- package/src/analytics/api/analytics-api.ts +0 -24
- package/src/analytics/models/index.ts +0 -74
- package/src/analytics/services/analytics-service.ts +0 -28
- package/src/auth-admin/api/auth-admin-api.ts +0 -42
- package/src/auth-admin/index.ts +0 -47
- package/src/auth-admin/services/auth-admin-service.ts +0 -36
- package/src/business/api/business-api.ts +0 -234
- package/src/business/index.ts +0 -53
- package/src/business/models/index.ts +0 -13
- package/src/business/services/business-service.ts +0 -88
- package/src/campaign/api/campaign-api.ts +0 -376
- package/src/campaign/index.ts +0 -67
- package/src/campaign/services/campaign-service.ts +0 -164
- package/src/core/abstractions/http-client.ts +0 -24
- package/src/core/auth/auth-provider.interface.ts +0 -16
- package/src/core/auth/create-auth-provider.ts +0 -136
- package/src/core/auth/simple-auth-config.interface.ts +0 -15
- package/src/core/index.ts +0 -33
- package/src/core/pers-api-client.ts +0 -343
- package/src/core/pers-config.ts +0 -65
- package/src/core/utils/jwt.function.ts +0 -24
- package/src/donation/api/donation-api.ts +0 -24
- package/src/donation/index.ts +0 -47
- package/src/donation/services/donation-service.ts +0 -25
- package/src/index.ts +0 -55
- package/src/payment/api/payment-api.ts +0 -185
- package/src/payment/index.ts +0 -64
- package/src/payment/models/index.ts +0 -29
- package/src/payment/services/payment-service.ts +0 -70
- package/src/pers-sdk.ts +0 -45
- package/src/redemption/api/redemption-api.ts +0 -241
- package/src/redemption/index.ts +0 -60
- package/src/redemption/models/index.ts +0 -17
- package/src/redemption/services/redemption-service.ts +0 -103
- package/src/shared/interfaces/pers-shared-lib.interfaces.ts +0 -99
- package/src/tenant/api/tenant-api.ts +0 -92
- package/src/tenant/index.ts +0 -61
- package/src/tenant/models/index.ts +0 -20
- package/src/tenant/services/tenant-service.ts +0 -78
- package/src/token/api/token-api.ts +0 -129
- package/src/token/base/base-token-service.ts +0 -167
- package/src/token/index.ts +0 -38
- package/src/token/models/index.ts +0 -30
- package/src/token/services/token-service.ts +0 -125
- package/src/token/token-sdk.ts +0 -231
- package/src/transaction/api/transaction-api.ts +0 -296
- package/src/transaction/index.ts +0 -65
- package/src/transaction/models/index.ts +0 -60
- package/src/transaction/services/transaction-service.ts +0 -104
- package/src/user/api/user-api.ts +0 -98
- package/src/user/index.ts +0 -62
- package/src/user/services/user-service.ts +0 -75
- package/src/user-status/api/user-status-api.ts +0 -78
- package/src/user-status/index.ts +0 -55
- package/src/user-status/services/user-status-service.ts +0 -51
- package/src/web3/api/web3-api.ts +0 -68
- package/src/web3/index.ts +0 -38
- package/src/web3/models/index.ts +0 -150
- package/src/web3/services/web3-service.ts +0 -338
- package/src/web3-chain/api/web3-chain-api.ts +0 -42
- package/src/web3-chain/index.ts +0 -27
- package/src/web3-chain/services/getWeb3FCD.service.ts +0 -47
- package/src/web3-chain/services/provider.service.ts +0 -123
- package/src/web3-chain/services/public-http-provider.service.ts +0 -26
- package/src/web3-chain/services/web3-chain-service.ts +0 -131
- 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
|
-
}
|
package/src/token/index.ts
DELETED
|
@@ -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
|
-
}
|