@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,104 +0,0 @@
|
|
|
1
|
-
import { TransactionDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
2
|
-
import { TransactionApi } from '../api/transaction-api';
|
|
3
|
-
import {
|
|
4
|
-
TransactionRequestDTO,
|
|
5
|
-
ClientTransactionRequestDTO,
|
|
6
|
-
ClientTransactionRequestResponseDto,
|
|
7
|
-
TransactionPaginationParams,
|
|
8
|
-
TransactionPaginationResponse,
|
|
9
|
-
UserBurnTokenRequestDTO
|
|
10
|
-
} from '../models';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Platform-Agnostic Transaction Service
|
|
14
|
-
*
|
|
15
|
-
* Contains transaction business logic and operations that work across platforms.
|
|
16
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
17
|
-
*
|
|
18
|
-
* Focuses only on actual backend capabilities.
|
|
19
|
-
*/
|
|
20
|
-
export class TransactionService {
|
|
21
|
-
constructor(private transactionApi: TransactionApi) {}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Get transaction by ID
|
|
25
|
-
*/
|
|
26
|
-
async getTransactionById(transactionId: string): Promise<TransactionDTO> {
|
|
27
|
-
return this.transactionApi.getTransactionById(transactionId);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ==========================================
|
|
31
|
-
// AUTHENTICATED OPERATIONS
|
|
32
|
-
// ==========================================
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* AUTH: Create authenticated transaction
|
|
36
|
-
*/
|
|
37
|
-
async createAuthTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
38
|
-
return this.transactionApi.createAuthTransaction(request);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* AUTH: Get user transaction history by type
|
|
43
|
-
*/
|
|
44
|
-
async getUserTransactionHistory(type: string): Promise<TransactionDTO[]> {
|
|
45
|
-
return this.transactionApi.getUserTransactionHistory(type);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* AUTH: Prepare client signed transaction
|
|
50
|
-
*/
|
|
51
|
-
async prepareClientSignedTransaction(request: ClientTransactionRequestDTO): Promise<ClientTransactionRequestResponseDto> {
|
|
52
|
-
return this.transactionApi.prepareClientSignedTransaction(request);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* AUTH: Burn user tokens
|
|
57
|
-
*/
|
|
58
|
-
async burnUserTokens(request: UserBurnTokenRequestDTO): Promise<TransactionDTO> {
|
|
59
|
-
return this.transactionApi.burnUserTokens(request);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ==========================================
|
|
63
|
-
// BUSINESS OPERATIONS
|
|
64
|
-
// ==========================================
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* BUSINESS: Create business transaction
|
|
68
|
-
*/
|
|
69
|
-
async createBusinessTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
70
|
-
return this.transactionApi.createBusinessTransaction(request);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// ==========================================
|
|
74
|
-
// ADMIN OPERATIONS
|
|
75
|
-
// ==========================================
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* ADMIN: Create admin transaction
|
|
79
|
-
*/
|
|
80
|
-
async createAdminTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
81
|
-
return this.transactionApi.createAdminTransaction(request);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* ADMIN: Get all tenant transactions
|
|
86
|
-
*/
|
|
87
|
-
async getTenantTransactions(): Promise<TransactionDTO[]> {
|
|
88
|
-
return this.transactionApi.getTenantTransactions();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* ADMIN: Get paginated transactions with filtering and sorting
|
|
93
|
-
*/
|
|
94
|
-
async getPaginatedTransactions(params: TransactionPaginationParams): Promise<TransactionPaginationResponse> {
|
|
95
|
-
return this.transactionApi.getPaginatedTransactions(params);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* ADMIN: Export transactions to CSV
|
|
100
|
-
*/
|
|
101
|
-
async exportTransactionsCSV(): Promise<Blob> {
|
|
102
|
-
return this.transactionApi.exportTransactionsCSV();
|
|
103
|
-
}
|
|
104
|
-
}
|
package/src/user/api/user-api.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { UserDTO, UserCreateRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
2
|
-
import { PersApiClient } from '../../core/pers-api-client';
|
|
3
|
-
import { UserPublicProfileDTO } from '../models';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Platform-Agnostic User API Client
|
|
7
|
-
*
|
|
8
|
-
* Handles user operations using the PERS backend RESTful API.
|
|
9
|
-
* Updated to use new /users endpoints with enhanced security and consistency.
|
|
10
|
-
* Maintains framework UserApiService method compatibility.
|
|
11
|
-
*/
|
|
12
|
-
export class UserApi {
|
|
13
|
-
constructor(private apiClient: PersApiClient) {}
|
|
14
|
-
|
|
15
|
-
private readonly basePath = '/users';
|
|
16
|
-
|
|
17
|
-
// ==========================================
|
|
18
|
-
// PUBLIC OPERATIONS
|
|
19
|
-
// ==========================================
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* PUBLIC: Get all users public profiles with optional filtering
|
|
23
|
-
* ✅ UPDATED: Uses new RESTful /users/public endpoint
|
|
24
|
-
*/
|
|
25
|
-
async getAllUsersPublicProfiles(filter: {key: string, value: string} | null = null): Promise<UserPublicProfileDTO[]> {
|
|
26
|
-
let url = `${this.basePath}/public`;
|
|
27
|
-
|
|
28
|
-
if (filter) {
|
|
29
|
-
// ✅ MAINTAINED: Same parameter pattern for compatibility
|
|
30
|
-
const params = new URLSearchParams();
|
|
31
|
-
params.set('filterKey', filter.key);
|
|
32
|
-
params.set('filterValue', filter.value);
|
|
33
|
-
url += `?${params.toString()}`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return this.apiClient.get<UserPublicProfileDTO[]>(url);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// ==========================================
|
|
40
|
-
// AUTHENTICATED OPERATIONS
|
|
41
|
-
// ==========================================
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* AUTH: Get current authenticated user
|
|
45
|
-
* ✅ UPDATED: Uses new RESTful /users/me endpoint
|
|
46
|
-
*/
|
|
47
|
-
async getRemoteUser(): Promise<UserDTO> {
|
|
48
|
-
return this.apiClient.get<UserDTO>(`${this.basePath}/me`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* AUTH: Update current authenticated user
|
|
53
|
-
* ✅ UPDATED: Uses new RESTful /users/me endpoint
|
|
54
|
-
*/
|
|
55
|
-
async updateRemoteUser(updateRequest: UserCreateRequestDTO): Promise<UserDTO> {
|
|
56
|
-
return this.apiClient.put<UserDTO>(`${this.basePath}/me`, updateRequest);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ==========================================
|
|
60
|
-
// ADMIN OPERATIONS
|
|
61
|
-
// ==========================================
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* ADMIN: Get all remote users with query parameters
|
|
65
|
-
* ✅ UPDATED: Uses new RESTful /users endpoint with role-based access
|
|
66
|
-
* Note: Admin users get full data, non-admin users get public profiles only
|
|
67
|
-
*/
|
|
68
|
-
async getAllRemoteUsers(): Promise<UserDTO[]> {
|
|
69
|
-
// ✅ MAINTAINED: Same merge=soft parameter for compatibility
|
|
70
|
-
const url = `${this.basePath}?merge=soft`;
|
|
71
|
-
return this.apiClient.get<UserDTO[]>(url);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* ADMIN: Update user as admin
|
|
76
|
-
* ✅ UPDATED: Uses new RESTful /users/{id} endpoint
|
|
77
|
-
*/
|
|
78
|
-
async updateUserAsAdmin(id: string, userData: UserCreateRequestDTO): Promise<UserDTO> {
|
|
79
|
-
return this.apiClient.put<UserDTO>(`${this.basePath}/${id}`, userData);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* ADMIN: Toggle user active status
|
|
84
|
-
* ✅ UPDATED: Uses new consistent /users/{id}/status endpoint
|
|
85
|
-
* Enhanced: Follows RESTful status management pattern across all domains
|
|
86
|
-
*/
|
|
87
|
-
async toggleUserActiveStatusByUser(user: UserDTO): Promise<UserDTO> {
|
|
88
|
-
return this.apiClient.put<UserDTO>(`${this.basePath}/${user.id}/status`, {});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* ADMIN: Get user by unique identifier
|
|
93
|
-
* ✅ UPDATED: Uses new RESTful /users/{id} endpoint
|
|
94
|
-
*/
|
|
95
|
-
async getUserByUniqueIdentifier(id: string): Promise<UserDTO> {
|
|
96
|
-
return this.apiClient.get<UserDTO>(`${this.basePath}/${id}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
package/src/user/index.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @explorins/pers-sdk-user
|
|
3
|
-
*
|
|
4
|
-
* Platform-agnostic User Domain SDK for PERS ecosystem
|
|
5
|
-
* Handles user management, profiles, and authentication operations
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// API Layer
|
|
9
|
-
export { UserApi } from './api/user-api';
|
|
10
|
-
|
|
11
|
-
// Service Layer
|
|
12
|
-
export { UserService } from './services/user-service';
|
|
13
|
-
|
|
14
|
-
// Models & Types
|
|
15
|
-
export * from './models';
|
|
16
|
-
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
17
|
-
|
|
18
|
-
// Factory function for creating user SDK instance
|
|
19
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
20
|
-
import { UserApi } from './api/user-api';
|
|
21
|
-
import { UserService } from './services/user-service';
|
|
22
|
-
import { UserDTO, UserCreateRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Create a complete User SDK instance
|
|
26
|
-
*
|
|
27
|
-
* @param apiClient - Configured PERS API client
|
|
28
|
-
* @returns User SDK with flattened structure for better DX
|
|
29
|
-
*/
|
|
30
|
-
export function createUserSDK(apiClient: PersApiClient) {
|
|
31
|
-
const userApi = new UserApi(apiClient);
|
|
32
|
-
const userService = new UserService(userApi);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
// Direct access to service methods (primary interface)
|
|
36
|
-
|
|
37
|
-
// Public methods - matches framework exactly
|
|
38
|
-
getAllUsersPublicProfiles: (filter: {key: string, value: string} | null = null) =>
|
|
39
|
-
userService.getAllUsersPublicProfiles(filter),
|
|
40
|
-
|
|
41
|
-
// Auth methods - matches framework exactly
|
|
42
|
-
getRemoteUser: () => userService.getRemoteUser(),
|
|
43
|
-
updateRemoteUser: (updateRequest: UserCreateRequestDTO) =>
|
|
44
|
-
userService.updateRemoteUser(updateRequest),
|
|
45
|
-
|
|
46
|
-
// Admin methods - matches framework exactly
|
|
47
|
-
getAllRemoteUsers: () => userService.getAllRemoteUsers(),
|
|
48
|
-
updateUserAsAdmin: (id: string, userData: UserCreateRequestDTO) =>
|
|
49
|
-
userService.updateUserAsAdmin(id, userData),
|
|
50
|
-
toggleUserActiveStatusByUser: (user: UserDTO) =>
|
|
51
|
-
userService.toggleUserActiveStatusByUser(user),
|
|
52
|
-
|
|
53
|
-
getUserByUniqueIdentifier: (id: string) =>
|
|
54
|
-
userService.getUserByUniqueIdentifier(id),
|
|
55
|
-
|
|
56
|
-
// Advanced access for edge cases
|
|
57
|
-
api: userApi,
|
|
58
|
-
service: userService
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type UserSDK = ReturnType<typeof createUserSDK>;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { UserDTO, UserCreateRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
2
|
-
import { UserApi } from '../api/user-api';
|
|
3
|
-
import { UserPublicProfileDTO } from '../models';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Platform-Agnostic User Service
|
|
7
|
-
*
|
|
8
|
-
* Contains user business logic and operations that work across platforms.
|
|
9
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
10
|
-
* Matches framework UserApiService capabilities exactly.
|
|
11
|
-
*/
|
|
12
|
-
export class UserService {
|
|
13
|
-
constructor(private userApi: UserApi) {}
|
|
14
|
-
|
|
15
|
-
// ==========================================
|
|
16
|
-
// PUBLIC OPERATIONS
|
|
17
|
-
// ==========================================
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* PUBLIC: Get all users public profiles with optional filtering
|
|
21
|
-
* ✅ FIXED: Uses framework-compatible inline filter type
|
|
22
|
-
*/
|
|
23
|
-
async getAllUsersPublicProfiles(filter: {key: string, value: string} | null = null): Promise<UserPublicProfileDTO[]> {
|
|
24
|
-
return this.userApi.getAllUsersPublicProfiles(filter);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// ==========================================
|
|
28
|
-
// AUTHENTICATED OPERATIONS
|
|
29
|
-
// ==========================================
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* AUTH: Get current authenticated user
|
|
33
|
-
*/
|
|
34
|
-
async getRemoteUser(): Promise<UserDTO> {
|
|
35
|
-
return this.userApi.getRemoteUser();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* AUTH: Update current authenticated user
|
|
40
|
-
*/
|
|
41
|
-
async updateRemoteUser(updateRequest: UserCreateRequestDTO): Promise<UserDTO> {
|
|
42
|
-
return this.userApi.updateRemoteUser(updateRequest);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ==========================================
|
|
46
|
-
// ADMIN OPERATIONS
|
|
47
|
-
// ==========================================
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* ADMIN: Get all remote users
|
|
51
|
-
* ✅ FIXED: Matches API method signature (no parameters needed)
|
|
52
|
-
*/
|
|
53
|
-
async getAllRemoteUsers(): Promise<UserDTO[]> {
|
|
54
|
-
return this.userApi.getAllRemoteUsers();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* ADMIN: Update user as admin
|
|
59
|
-
*/
|
|
60
|
-
async updateUserAsAdmin(id: string, userData: UserCreateRequestDTO): Promise<UserDTO> {
|
|
61
|
-
return this.userApi.updateUserAsAdmin(id, userData);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async getUserByUniqueIdentifier(id: string): Promise<UserDTO> {
|
|
65
|
-
return this.userApi.getUserByUniqueIdentifier(id);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* ADMIN: Toggle user active status by user object
|
|
70
|
-
* ✅ FIXED: Matches API method signature exactly
|
|
71
|
-
*/
|
|
72
|
-
async toggleUserActiveStatusByUser(user: UserDTO): Promise<UserDTO> {
|
|
73
|
-
return this.userApi.toggleUserActiveStatusByUser(user);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { PersApiClient } from '../../core/pers-api-client';
|
|
2
|
-
import { UserStatusTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Platform-Agnostic User Status API Client
|
|
6
|
-
*
|
|
7
|
-
* Handles user status operations using the PERS backend.
|
|
8
|
-
* Matches framework UserStatusApiService methods exactly.
|
|
9
|
-
*
|
|
10
|
-
* ✅ UPDATED: All endpoints updated to new RESTful /users patterns
|
|
11
|
-
*
|
|
12
|
-
* Error handling patterns follow framework implementation:
|
|
13
|
-
* - getRemoteEarnedUserStatus() uses silent fallback (empty array)
|
|
14
|
-
* - Other operations throw errors for proper error handling
|
|
15
|
-
*/
|
|
16
|
-
export class UserStatusApi {
|
|
17
|
-
constructor(private apiClient: PersApiClient) {}
|
|
18
|
-
|
|
19
|
-
private readonly basePath = '/users';
|
|
20
|
-
|
|
21
|
-
// ==========================================
|
|
22
|
-
// PUBLIC OPERATIONS
|
|
23
|
-
// ==========================================
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* PUBLIC: Get remote user status types
|
|
27
|
-
* ✅ UPDATED: /user/status-type → /users/status-types
|
|
28
|
-
*/
|
|
29
|
-
async getRemoteUserStatusTypes(): Promise<UserStatusTypeDTO[]> {
|
|
30
|
-
try {
|
|
31
|
-
return await this.apiClient.get<UserStatusTypeDTO[]>(`${this.basePath}/status-types`);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error('Error getting user status types', error);
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ==========================================
|
|
39
|
-
// AUTHENTICATED OPERATIONS
|
|
40
|
-
// ==========================================
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* AUTH: Get earned user status for authenticated user
|
|
44
|
-
* ✅ UPDATED: /user/auth/status → /users/me/status
|
|
45
|
-
* ✅ FIXED: Returns UserStatusTypeDTO[] to match framework exactly
|
|
46
|
-
* Note: Uses silent fallback pattern from framework - returns empty array on error
|
|
47
|
-
*/
|
|
48
|
-
async getRemoteEarnedUserStatus(): Promise<UserStatusTypeDTO[]> {
|
|
49
|
-
try {
|
|
50
|
-
return await this.apiClient.get<UserStatusTypeDTO[]>(`${this.basePath}/me/status`);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error('Error getting user status', error);
|
|
53
|
-
// ✅ FIXED: Silent fallback pattern from framework implementation
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ==========================================
|
|
59
|
-
// ADMIN OPERATIONS
|
|
60
|
-
// ==========================================
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* ADMIN: Create user status type
|
|
64
|
-
* ✅ UPDATED: /user/admin/status-type → /users/status-types
|
|
65
|
-
*/
|
|
66
|
-
async createUserStatusType(userStatusType: UserStatusTypeDTO): Promise<UserStatusTypeDTO> {
|
|
67
|
-
try {
|
|
68
|
-
return await this.apiClient.post<UserStatusTypeDTO>(`${this.basePath}/status-types`, userStatusType);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
console.error('Error creating user status type', error);
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ❌ REMOVED: Methods not present in framework
|
|
76
|
-
// - updateUserStatusType() - Framework doesn't have this operation
|
|
77
|
-
// - toggleUserStatusTypeActive() - Framework doesn't have this operation
|
|
78
|
-
}
|
package/src/user-status/index.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @explorins/pers-sdk-user-status
|
|
3
|
-
*
|
|
4
|
-
* Platform-agnostic User Status Domain SDK for PERS ecosystem
|
|
5
|
-
* Handles user status management and type operations
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// API Layer
|
|
9
|
-
export { UserStatusApi } from './api/user-status-api';
|
|
10
|
-
|
|
11
|
-
// Service Layer
|
|
12
|
-
export { UserStatusService } from './services/user-status-service';
|
|
13
|
-
|
|
14
|
-
// Models & Types - re-export all centralized interfaces
|
|
15
|
-
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
16
|
-
|
|
17
|
-
// Models & Types - imported from centralized interfaces
|
|
18
|
-
|
|
19
|
-
// Factory function for creating user-status SDK instance
|
|
20
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
21
|
-
import { UserStatusApi } from './api/user-status-api';
|
|
22
|
-
import { UserStatusService } from './services/user-status-service';
|
|
23
|
-
import { UserStatusTypeDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Create a complete User Status SDK instance
|
|
27
|
-
*
|
|
28
|
-
* @param apiClient - Configured PERS API client
|
|
29
|
-
* @returns User Status SDK with flattened structure for better DX
|
|
30
|
-
*/
|
|
31
|
-
export function createUserStatusSDK(apiClient: PersApiClient) {
|
|
32
|
-
const userStatusApi = new UserStatusApi(apiClient);
|
|
33
|
-
const userStatusService = new UserStatusService(userStatusApi);
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
// Direct access to service methods (primary interface)
|
|
37
|
-
// ✅ FRAMEWORK ALIGNED: Only methods actually used by framework
|
|
38
|
-
|
|
39
|
-
// Public methods
|
|
40
|
-
getRemoteUserStatusTypes: () => userStatusService.getRemoteUserStatusTypes(),
|
|
41
|
-
|
|
42
|
-
// Auth methods
|
|
43
|
-
getRemoteEarnedUserStatus: () => userStatusService.getRemoteEarnedUserStatus(),
|
|
44
|
-
|
|
45
|
-
// Admin methods
|
|
46
|
-
createUserStatusType: (userStatusType: UserStatusTypeDTO) =>
|
|
47
|
-
userStatusService.createUserStatusType(userStatusType),
|
|
48
|
-
|
|
49
|
-
// Advanced access for edge cases
|
|
50
|
-
api: userStatusApi,
|
|
51
|
-
service: userStatusService
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type UserStatusSDK = ReturnType<typeof createUserStatusSDK>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { UserStatusApi } from '../api/user-status-api';
|
|
2
|
-
import { UserStatusTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Platform-Agnostic User Status Service
|
|
6
|
-
*
|
|
7
|
-
* Contains user status business logic and operations that work across platforms.
|
|
8
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
9
|
-
* Matches framework UserStatusApiService capabilities exactly.
|
|
10
|
-
*/
|
|
11
|
-
export class UserStatusService {
|
|
12
|
-
constructor(private userStatusApi: UserStatusApi) {}
|
|
13
|
-
|
|
14
|
-
// ==========================================
|
|
15
|
-
// PUBLIC OPERATIONS
|
|
16
|
-
// ==========================================
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* PUBLIC: Get remote user status types
|
|
20
|
-
*/
|
|
21
|
-
async getRemoteUserStatusTypes(): Promise<UserStatusTypeDTO[]> {
|
|
22
|
-
return this.userStatusApi.getRemoteUserStatusTypes();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ==========================================
|
|
26
|
-
// AUTHENTICATED OPERATIONS
|
|
27
|
-
// ==========================================
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* AUTH: Get earned user status for authenticated user
|
|
31
|
-
*/
|
|
32
|
-
async getRemoteEarnedUserStatus(): Promise<UserStatusTypeDTO[]> {
|
|
33
|
-
return this.userStatusApi.getRemoteEarnedUserStatus();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// ==========================================
|
|
37
|
-
// ADMIN OPERATIONS
|
|
38
|
-
// ==========================================
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* ADMIN: Create user status type
|
|
42
|
-
*/
|
|
43
|
-
async createUserStatusType(userStatusType: UserStatusTypeDTO): Promise<UserStatusTypeDTO> {
|
|
44
|
-
return this.userStatusApi.createUserStatusType(userStatusType);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ❌ REMOVED: Business logic methods not present in framework
|
|
48
|
-
// - hasUserReachedStatusLevel() - Framework doesn't need this logic
|
|
49
|
-
// - getUserHighestStatusLevel() - Framework doesn't need this logic
|
|
50
|
-
// These can be added later if actually needed
|
|
51
|
-
}
|
package/src/web3/api/web3-api.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Web3ChainService } from '../../web3-chain/services/web3-chain-service';
|
|
2
|
-
import type { ContractAbi } from 'web3';
|
|
3
|
-
import {
|
|
4
|
-
getAddressTokenBalanceByContract,
|
|
5
|
-
getSmartContractInstance,
|
|
6
|
-
getTokenOfOwnerByIndex,
|
|
7
|
-
getTokenUri
|
|
8
|
-
} from '@explorins/web3-ts';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export class Web3Api {
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private web3ChainService: Web3ChainService,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
async getTokenBalance(request: {
|
|
18
|
-
accountAddress: string;
|
|
19
|
-
contractAddress: string;
|
|
20
|
-
abi: ContractAbi;
|
|
21
|
-
tokenId: string | null;
|
|
22
|
-
chainId: number;
|
|
23
|
-
}): Promise<number> {
|
|
24
|
-
const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
|
|
25
|
-
|
|
26
|
-
const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
|
|
27
|
-
const balance = await getAddressTokenBalanceByContract(
|
|
28
|
-
tokenContract,
|
|
29
|
-
request.accountAddress,
|
|
30
|
-
request.tokenId
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return Number(balance);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async getTokenUri(request: {
|
|
37
|
-
contractAddress: string;
|
|
38
|
-
abi: ContractAbi;
|
|
39
|
-
tokenId: string;
|
|
40
|
-
chainId: number;
|
|
41
|
-
}): Promise<string> {
|
|
42
|
-
const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
|
|
43
|
-
|
|
44
|
-
// ✅ DIRECT: Use web3-ts functions directly
|
|
45
|
-
const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
|
|
46
|
-
const tokenId = Number(request.tokenId);
|
|
47
|
-
const tokenUri = await getTokenUri(tokenContract, tokenId);
|
|
48
|
-
|
|
49
|
-
return String(tokenUri);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async getTokenOfOwnerByIndex(request: {
|
|
54
|
-
contractAddress: string;
|
|
55
|
-
abi: ContractAbi;
|
|
56
|
-
accountAddress: string;
|
|
57
|
-
tokenIndex: number;
|
|
58
|
-
chainId: number;
|
|
59
|
-
}): Promise<string> {
|
|
60
|
-
const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
|
|
61
|
-
|
|
62
|
-
// ✅ DIRECT: Use web3-ts functions directly
|
|
63
|
-
const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
|
|
64
|
-
const tokenId = await getTokenOfOwnerByIndex(tokenContract, request.accountAddress, request.tokenIndex);
|
|
65
|
-
|
|
66
|
-
return String(tokenId);
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/web3/index.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
2
|
-
import { Web3Api } from './api/web3-api';
|
|
3
|
-
import { Web3Service } from './services/web3-service';
|
|
4
|
-
import { createWeb3ChainSDK } from '../web3-chain';
|
|
5
|
-
import { ContractAbi, ERC1155CollectionRequest, ERC20BalanceRequest, ERC721CollectionRequest, ERC721CollectionResponse, Web3BalanceRequest, Web3BalanceResponse, Web3TokenListRequest, Web3TokenListResponse } from './models';
|
|
6
|
-
import { Web3ProviderService } from '../web3-chain/services/provider.service';
|
|
7
|
-
|
|
8
|
-
export function createWeb3SDK(
|
|
9
|
-
apiClient: PersApiClient,
|
|
10
|
-
web3ProviderService: Web3ProviderService,
|
|
11
|
-
) {
|
|
12
|
-
const web3ChainSDK = createWeb3ChainSDK(apiClient, web3ProviderService);
|
|
13
|
-
|
|
14
|
-
const web3Api = new Web3Api(
|
|
15
|
-
web3ChainSDK.service,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const web3Service = new Web3Service(web3Api, web3ChainSDK.service);
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
|
|
22
|
-
getCreditsBalance: (request: ERC20BalanceRequest): Promise<Web3BalanceResponse> =>
|
|
23
|
-
web3Service.getERC20Balance(request),
|
|
24
|
-
|
|
25
|
-
getRewardsCollection: (request: ERC1155CollectionRequest): Promise<Web3TokenListResponse> =>
|
|
26
|
-
web3Service.getERC1155Collection(request),
|
|
27
|
-
|
|
28
|
-
getStampsCollection: (request: ERC721CollectionRequest): Promise<ERC721CollectionResponse> =>
|
|
29
|
-
web3Service.getERC721Collection(request),
|
|
30
|
-
|
|
31
|
-
api: web3Api,
|
|
32
|
-
service: web3Service
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export * from './models';
|
|
37
|
-
export type { ERC20BalanceRequest, ERC1155CollectionRequest, ERC721CollectionRequest, ERC721CollectionResponse, NFTItem } from './models';
|
|
38
|
-
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|