@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
package/src/token/token-sdk.ts
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { TokenApi } from './api/token-api';
|
|
2
|
-
import { TokenService } from './services/token-service';
|
|
3
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
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
|
-
* Token SDK - Class-based Promise SDK for Token Operations
|
|
15
|
-
*
|
|
16
|
-
* Modern, performant SDK with direct method access and excellent TypeScript support.
|
|
17
|
-
* Optimized for bundle size, performance, and developer experience.
|
|
18
|
-
*
|
|
19
|
-
* Usage:
|
|
20
|
-
* const tokenSDK = new TokenSDK(apiClient);
|
|
21
|
-
* const tokens = await tokenSDK.getTokens();
|
|
22
|
-
* const creditToken = await tokenSDK.getActiveCreditToken();
|
|
23
|
-
*/
|
|
24
|
-
export class TokenSDK {
|
|
25
|
-
private readonly tokenApi: TokenApi;
|
|
26
|
-
private readonly tokenService: TokenService;
|
|
27
|
-
|
|
28
|
-
constructor(apiClient: PersApiClient) {
|
|
29
|
-
this.tokenApi = new TokenApi(apiClient);
|
|
30
|
-
this.tokenService = new TokenService(this.tokenApi);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ==========================================
|
|
34
|
-
// CONVENIENCE METHODS - Direct Promise API
|
|
35
|
-
// ==========================================
|
|
36
|
-
// Simplified method names for better developer experience
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get all tokens
|
|
40
|
-
* @returns Promise with all available tokens
|
|
41
|
-
*/
|
|
42
|
-
async getTokens(): Promise<TokenDTO[]> {
|
|
43
|
-
return this.tokenService.getRemoteTokens();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Get all token types
|
|
48
|
-
* @returns Promise with all available token types
|
|
49
|
-
*/
|
|
50
|
-
async getTokenTypes(): Promise<TokenTypeDTO[]> {
|
|
51
|
-
return this.tokenService.getRemoteTokenTypes();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Get the active credit token
|
|
56
|
-
* @returns Promise with the current active credit token
|
|
57
|
-
*/
|
|
58
|
-
async getActiveCreditToken(): Promise<TokenDTO> {
|
|
59
|
-
return this.tokenService.getRemoteActiveCreditToken();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Get all reward tokens
|
|
64
|
-
* @returns Promise with all reward tokens
|
|
65
|
-
*/
|
|
66
|
-
async getRewardTokens(): Promise<TokenDTO[]> {
|
|
67
|
-
return this.tokenService.getRemoteRewardTokens();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Get all status tokens
|
|
72
|
-
* @returns Promise with all status tokens
|
|
73
|
-
*/
|
|
74
|
-
async getStatusTokens(): Promise<TokenDTO[]> {
|
|
75
|
-
return this.tokenService.getRemoteStatusTokens();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Get token by contract address
|
|
80
|
-
* @param contractAddress - The contract address to search for
|
|
81
|
-
* @param contractTokenId - Optional contract token ID
|
|
82
|
-
* @returns Promise with the matching token
|
|
83
|
-
*/
|
|
84
|
-
async getTokenByContract(contractAddress: string, contractTokenId: string | null = null): Promise<TokenDTO> {
|
|
85
|
-
return this.tokenService.getTokenByContractAddress(contractAddress, contractTokenId);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ==========================================
|
|
89
|
-
// ADMIN METHODS - Token Management
|
|
90
|
-
// ==========================================
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Create token metadata
|
|
94
|
-
* @param tokenId - The token ID
|
|
95
|
-
* @param tokenData - The token storage data
|
|
96
|
-
* @returns Promise with the updated token
|
|
97
|
-
*/
|
|
98
|
-
async createTokenMetadata(tokenId: string, tokenData: TokenStorageData): Promise<TokenDTO> {
|
|
99
|
-
return this.tokenService.createTokenMetadata(tokenId, tokenData);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Toggle token active status
|
|
104
|
-
* @param tokenId - The token ID to toggle
|
|
105
|
-
* @returns Promise with the updated token
|
|
106
|
-
*/
|
|
107
|
-
async toggleTokenActive(tokenId: string): Promise<TokenDTO> {
|
|
108
|
-
return this.tokenService.toggleTokenActive(tokenId);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Create a new token
|
|
113
|
-
* @param tokenData - The token creation data
|
|
114
|
-
* @returns Promise with the created token
|
|
115
|
-
*/
|
|
116
|
-
async createToken(tokenData: TokenCreateRequestDTO): Promise<TokenDTO> {
|
|
117
|
-
return this.tokenService.createToken(tokenData);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Update an existing token
|
|
122
|
-
* @param tokenId - The token ID to update
|
|
123
|
-
* @param tokenData - The token update data
|
|
124
|
-
* @returns Promise with the updated token
|
|
125
|
-
*/
|
|
126
|
-
async updateToken(tokenId: string, tokenData: TokenUpdateRequestDTO): Promise<TokenDTO> {
|
|
127
|
-
return this.tokenService.updateToken(tokenId, tokenData);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Set mainnet contract address for a token
|
|
132
|
-
* @param tokenId - The token ID
|
|
133
|
-
* @param contractAddress - The contract address
|
|
134
|
-
* @param chainId - The blockchain chain ID
|
|
135
|
-
* @returns Promise with the updated token
|
|
136
|
-
*/
|
|
137
|
-
async setMainnetContract(tokenId: string, contractAddress: string, chainId: number): Promise<TokenDTO> {
|
|
138
|
-
return this.tokenService.setMainnetContract(tokenId, contractAddress, chainId);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Toggle token metadata status
|
|
143
|
-
* @param metadataId - The metadata ID to toggle
|
|
144
|
-
* @returns Promise with the updated metadata
|
|
145
|
-
*/
|
|
146
|
-
async toggleTokenMetadataStatus(metadataId: string): Promise<TokenMetadataDTO> {
|
|
147
|
-
return this.tokenService.toggleTokenMetadataStatus(metadataId);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Create a new token type
|
|
152
|
-
* @param tokenType - The token type data
|
|
153
|
-
* @returns Promise with the created token type
|
|
154
|
-
*/
|
|
155
|
-
async createTokenType(tokenType: TokenTypeDTO): Promise<TokenTypeDTO> {
|
|
156
|
-
return this.tokenService.createTokenType(tokenType);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ==========================================
|
|
160
|
-
// ADVANCED ACCESS - For Complex Operations
|
|
161
|
-
// ==========================================
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Get direct access to the token service for advanced operations
|
|
165
|
-
* @returns The underlying TokenService instance
|
|
166
|
-
*/
|
|
167
|
-
getTokenService(): TokenService {
|
|
168
|
-
return this.tokenService;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Get direct access to the token API for low-level operations
|
|
173
|
-
* @returns The underlying TokenApi instance
|
|
174
|
-
*/
|
|
175
|
-
getTokenApi(): TokenApi {
|
|
176
|
-
return this.tokenApi;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// ==========================================
|
|
180
|
-
// FRAMEWORK COMPATIBILITY METHODS
|
|
181
|
-
// ==========================================
|
|
182
|
-
// These maintain compatibility with existing framework method names
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* @deprecated Use getTokens() instead
|
|
186
|
-
* Framework compatibility method
|
|
187
|
-
*/
|
|
188
|
-
async getRemoteTokens(): Promise<TokenDTO[]> {
|
|
189
|
-
return this.getTokens();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @deprecated Use getTokenTypes() instead
|
|
194
|
-
* Framework compatibility method
|
|
195
|
-
*/
|
|
196
|
-
async getRemoteTokenTypes(): Promise<TokenTypeDTO[]> {
|
|
197
|
-
return this.getTokenTypes();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @deprecated Use getActiveCreditToken() instead
|
|
202
|
-
* Framework compatibility method
|
|
203
|
-
*/
|
|
204
|
-
async getRemoteActiveCreditToken(): Promise<TokenDTO> {
|
|
205
|
-
return this.getActiveCreditToken();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* @deprecated Use getRewardTokens() instead
|
|
210
|
-
* Framework compatibility method
|
|
211
|
-
*/
|
|
212
|
-
async getRemoteRewardTokens(): Promise<TokenDTO[]> {
|
|
213
|
-
return this.getRewardTokens();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @deprecated Use getStatusTokens() instead
|
|
218
|
-
* Framework compatibility method
|
|
219
|
-
*/
|
|
220
|
-
async getRemoteStatusTokens(): Promise<TokenDTO[]> {
|
|
221
|
-
return this.getStatusTokens();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @deprecated Use getTokenByContract() instead
|
|
226
|
-
* Framework compatibility method
|
|
227
|
-
*/
|
|
228
|
-
async getTokenByContractAddress(contractAddress: string, contractTokenId: string | null): Promise<TokenDTO> {
|
|
229
|
-
return this.getTokenByContract(contractAddress, contractTokenId);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { PersApiClient } from '../../core/pers-api-client';
|
|
2
|
-
import {
|
|
3
|
-
TransactionDTO,
|
|
4
|
-
TransactionRequestDTO,
|
|
5
|
-
ClientTransactionRequestDTO,
|
|
6
|
-
ClientTransactionRequestResponseDto,
|
|
7
|
-
AccountSelectorDTO
|
|
8
|
-
} from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
9
|
-
import { TransactionPaginationParams, TransactionPaginationResponse, UserBurnTokenRequestDTO } from '../models';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Platform-Agnostic Transaction API Client (UPDATED FOR NEW RESTful ENDPOINTS)
|
|
13
|
-
*
|
|
14
|
-
* Handles transaction operations using the PERS backend.
|
|
15
|
-
* Uses @explorins/pers-shared DTOs for consistency with backend.
|
|
16
|
-
*
|
|
17
|
-
* MIGRATION NOTES:
|
|
18
|
-
* - All endpoints changed from /transaction to /transactions
|
|
19
|
-
* - Role-based paths removed (no more /auth, /admin, /business in URLs)
|
|
20
|
-
* - New RESTful resource-based structure
|
|
21
|
-
* - Added new client-side transaction flow methods
|
|
22
|
-
* - Enhanced admin query capabilities
|
|
23
|
-
*/
|
|
24
|
-
export class TransactionApi {
|
|
25
|
-
constructor(private apiClient: PersApiClient) {}
|
|
26
|
-
|
|
27
|
-
private readonly basePath = '/transactions';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get transaction by ID (public endpoint)
|
|
31
|
-
*
|
|
32
|
-
* UPDATED: /transaction/{id} → /transactions/{id}
|
|
33
|
-
*/
|
|
34
|
-
async getTransactionById(transactionId: string): Promise<TransactionDTO> {
|
|
35
|
-
return this.apiClient.get<TransactionDTO>(`${this.basePath}/${transactionId}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ==========================================
|
|
39
|
-
// AUTHENTICATED USER OPERATIONS
|
|
40
|
-
// ==========================================
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* AUTH: Create authenticated user transaction
|
|
44
|
-
*
|
|
45
|
-
* UPDATED: /transaction/auth/transaction → /transactions/user
|
|
46
|
-
*/
|
|
47
|
-
async createAuthTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
48
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/user`, request);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* AUTH: Get user's sent transactions
|
|
53
|
-
*
|
|
54
|
-
* UPDATED: /transaction/auth/sender → /transactions/me/sent
|
|
55
|
-
*/
|
|
56
|
-
async getUserSentTransactions(): Promise<TransactionDTO[]> {
|
|
57
|
-
const params = new URLSearchParams({
|
|
58
|
-
timestamp: Date.now().toString()
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return this.apiClient.get<TransactionDTO[]>(`${this.basePath}/me/sent?${params.toString()}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* AUTH: Get user's received transactions
|
|
66
|
-
*
|
|
67
|
-
* UPDATED: /transaction/auth/recipient → /transactions/me/received
|
|
68
|
-
*/
|
|
69
|
-
async getUserReceivedTransactions(): Promise<TransactionDTO[]> {
|
|
70
|
-
const params = new URLSearchParams({
|
|
71
|
-
timestamp: Date.now().toString()
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return this.apiClient.get<TransactionDTO[]>(`${this.basePath}/me/received?${params.toString()}`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* AUTH: Get user transaction history by type (backwards compatibility)
|
|
79
|
-
*
|
|
80
|
-
* UPDATED: Maps to appropriate /transactions/me/* endpoints
|
|
81
|
-
*/
|
|
82
|
-
async getUserTransactionHistory(type: string): Promise<TransactionDTO[]> {
|
|
83
|
-
const params = new URLSearchParams({
|
|
84
|
-
timestamp: Date.now().toString()
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// Map legacy type parameter to new endpoints
|
|
88
|
-
switch (type.toLowerCase()) {
|
|
89
|
-
case 'sender':
|
|
90
|
-
case 'sent':
|
|
91
|
-
return this.apiClient.get<TransactionDTO[]>(`${this.basePath}/me/sent?${params.toString()}`);
|
|
92
|
-
case 'recipient':
|
|
93
|
-
case 'received':
|
|
94
|
-
return this.apiClient.get<TransactionDTO[]>(`${this.basePath}/me/received?${params.toString()}`);
|
|
95
|
-
default:
|
|
96
|
-
// Default to sent transactions for backwards compatibility
|
|
97
|
-
return this.apiClient.get<TransactionDTO[]>(`${this.basePath}/me/sent?${params.toString()}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* AUTH: Prepare client signed transaction
|
|
103
|
-
*
|
|
104
|
-
* UPDATED: /transaction/auth/prepare-signing → /transactions/prepare
|
|
105
|
-
*/
|
|
106
|
-
async prepareClientSignedTransaction(request: ClientTransactionRequestDTO): Promise<ClientTransactionRequestResponseDto> {
|
|
107
|
-
return this.apiClient.post<ClientTransactionRequestResponseDto>(`${this.basePath}/prepare`, request);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* AUTH: Prepare existing transaction for client-side signing
|
|
112
|
-
*
|
|
113
|
-
* NEW ENDPOINT: GET /transactions/{id}/prepare
|
|
114
|
-
*/
|
|
115
|
-
async prepareExistingTransaction(transactionId: string): Promise<ClientTransactionRequestResponseDto> {
|
|
116
|
-
return this.apiClient.get<ClientTransactionRequestResponseDto>(`${this.basePath}/${transactionId}/prepare`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* AUTH: Submit client-side signed transaction
|
|
121
|
-
*
|
|
122
|
-
* NEW ENDPOINT: POST /transactions/{id}/submit
|
|
123
|
-
*/
|
|
124
|
-
async submitSignedTransaction(transactionId: string, signedData: any): Promise<TransactionDTO> {
|
|
125
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/${transactionId}/submit`, signedData);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* AUTH: Burn user tokens
|
|
130
|
-
*
|
|
131
|
-
* UPDATED: Uses new user transaction endpoint with burn-specific parameters
|
|
132
|
-
* Note: This might need backend confirmation on burn functionality implementation
|
|
133
|
-
*/
|
|
134
|
-
async burnUserTokens(request: UserBurnTokenRequestDTO): Promise<TransactionDTO> {
|
|
135
|
-
// Map burn request to TransactionRequestDTO format for new endpoint
|
|
136
|
-
const transactionRequest: TransactionRequestDTO = {
|
|
137
|
-
...request,
|
|
138
|
-
// Add any specific burn transaction parameters here
|
|
139
|
-
} as any;
|
|
140
|
-
|
|
141
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/user`, transactionRequest);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ==========================================
|
|
145
|
-
// BUSINESS OPERATIONS
|
|
146
|
-
// ==========================================
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* BUSINESS: Create business transaction
|
|
150
|
-
*
|
|
151
|
-
* UPDATED: /transaction/business/transaction → /transactions/business
|
|
152
|
-
*/
|
|
153
|
-
async createBusinessTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
154
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/business`, request);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// ==========================================
|
|
158
|
-
// ADMIN OPERATIONS
|
|
159
|
-
// ==========================================
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* ADMIN: Create admin transaction
|
|
163
|
-
*
|
|
164
|
-
* UPDATED: /transaction/admin/transaction → /transactions/admin
|
|
165
|
-
*/
|
|
166
|
-
async createAdminTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
|
|
167
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/system`, request);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* ADMIN: Get all tenant transactions
|
|
172
|
-
*
|
|
173
|
-
* UPDATED: /transaction/admin → /transactions
|
|
174
|
-
*/
|
|
175
|
-
async getTenantTransactions(): Promise<TransactionDTO[]> {
|
|
176
|
-
const result = await this.apiClient.get<TransactionPaginationResponse>(`${this.basePath}`);
|
|
177
|
-
// If the new endpoint returns paginated response, extract the data array
|
|
178
|
-
if ('data' in result) {
|
|
179
|
-
return result.data;
|
|
180
|
-
}
|
|
181
|
-
// Fallback for direct array response
|
|
182
|
-
return result as any as TransactionDTO[];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* ADMIN: Get paginated transactions with filtering and sorting
|
|
187
|
-
*
|
|
188
|
-
* UPDATED: /transaction/admin → /transactions (same endpoint, better structure)
|
|
189
|
-
*/
|
|
190
|
-
async getPaginatedTransactions(params: TransactionPaginationParams): Promise<TransactionPaginationResponse> {
|
|
191
|
-
// Build query parameters
|
|
192
|
-
const queryParams: Record<string, string> = {
|
|
193
|
-
page: params.page.toString(),
|
|
194
|
-
limit: params.limit.toString()
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// Add sorting parameters if provided
|
|
198
|
-
if (params.sortBy) {
|
|
199
|
-
queryParams['sortBy'] = params.sortBy;
|
|
200
|
-
}
|
|
201
|
-
if (params.sortOrder) {
|
|
202
|
-
queryParams['sortOrder'] = params.sortOrder;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Add user-specific filtering if provided
|
|
206
|
-
if (params.participantId) {
|
|
207
|
-
queryParams['participantId'] = params.participantId;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Add status filtering if provided
|
|
211
|
-
if (params.status) {
|
|
212
|
-
queryParams['status'] = params.status;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Add additional filters if provided
|
|
216
|
-
if (params.filters) {
|
|
217
|
-
if (params.filters.startDate) {
|
|
218
|
-
queryParams['startDate'] = params.filters.startDate;
|
|
219
|
-
}
|
|
220
|
-
if (params.filters.endDate) {
|
|
221
|
-
queryParams['endDate'] = params.filters.endDate;
|
|
222
|
-
}
|
|
223
|
-
if (params.filters.type && params.filters.type.length > 0) {
|
|
224
|
-
queryParams['type'] = params.filters.type.join(',');
|
|
225
|
-
}
|
|
226
|
-
if (params.filters.tokenType && params.filters.tokenType.length > 0) {
|
|
227
|
-
queryParams['tokenType'] = params.filters.tokenType.join(',');
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Build query string
|
|
232
|
-
const queryString = Object.entries(queryParams)
|
|
233
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
234
|
-
.join('&');
|
|
235
|
-
|
|
236
|
-
return this.apiClient.get<TransactionPaginationResponse>(`${this.basePath}?${queryString}`);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* ADMIN: Export transactions to CSV
|
|
241
|
-
*
|
|
242
|
-
* UPDATED: /transaction/admin/export/csv → /transactions/export/csv
|
|
243
|
-
*/
|
|
244
|
-
async exportTransactionsCSV(): Promise<Blob> {
|
|
245
|
-
return this.apiClient.get<Blob>(`${this.basePath}/export/csv`, 'blob');
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ==========================================
|
|
249
|
-
// NEW ADMIN QUERY METHODS
|
|
250
|
-
// ==========================================
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* ADMIN: Query transactions by sender
|
|
254
|
-
*
|
|
255
|
-
* NEW ENDPOINT: POST /transactions/query-sender
|
|
256
|
-
*/
|
|
257
|
-
async queryTransactionsBySender(accountSelector: AccountSelectorDTO): Promise<TransactionDTO[]> {
|
|
258
|
-
return this.apiClient.post<TransactionDTO[]>(`${this.basePath}/query-sender`, accountSelector);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* ADMIN: Query transactions by recipient
|
|
263
|
-
*
|
|
264
|
-
* NEW ENDPOINT: POST /transactions/query-recipient
|
|
265
|
-
*/
|
|
266
|
-
async queryTransactionsByRecipient(accountSelector: AccountSelectorDTO): Promise<TransactionDTO[]> {
|
|
267
|
-
return this.apiClient.post<TransactionDTO[]>(`${this.basePath}/query-recipient`, accountSelector);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* ADMIN: Get transaction analytics
|
|
272
|
-
*
|
|
273
|
-
* NEW ENDPOINT: POST /transactions/analytics
|
|
274
|
-
*/
|
|
275
|
-
async getTransactionAnalytics(analyticsRequest: any): Promise<any> {
|
|
276
|
-
return this.apiClient.post<any>(`${this.basePath}/analytics`, analyticsRequest);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// ==========================================
|
|
280
|
-
// CONVENIENCE METHODS (BACKWARDS COMPATIBILITY)
|
|
281
|
-
// ==========================================
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Convenience method: Get user sent transactions (alias)
|
|
285
|
-
*/
|
|
286
|
-
async getUserSenderTransactions(): Promise<TransactionDTO[]> {
|
|
287
|
-
return this.getUserSentTransactions();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Convenience method: Get user received transactions (alias)
|
|
292
|
-
*/
|
|
293
|
-
async getUserRecipientTransactions(): Promise<TransactionDTO[]> {
|
|
294
|
-
return this.getUserReceivedTransactions();
|
|
295
|
-
}
|
|
296
|
-
}
|
package/src/transaction/index.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @explorins/pers-sdk-transaction
|
|
3
|
-
*
|
|
4
|
-
* Platform-agnostic Transaction Domain SDK for PERS ecosystem
|
|
5
|
-
* Handles transaction operations across different authorization levels
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// API Layer
|
|
9
|
-
export { TransactionApi } from './api/transaction-api';
|
|
10
|
-
|
|
11
|
-
// Service Layer
|
|
12
|
-
export { TransactionService } from './services/transaction-service';
|
|
13
|
-
|
|
14
|
-
// Models & Types
|
|
15
|
-
export * from './models';
|
|
16
|
-
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
17
|
-
|
|
18
|
-
// Models & Types
|
|
19
|
-
export * from './models';
|
|
20
|
-
|
|
21
|
-
import { ClientTransactionRequestDTO, TransactionRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
22
|
-
// Factory function for creating transaction SDK instance
|
|
23
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
24
|
-
import { TransactionApi } from './api/transaction-api';
|
|
25
|
-
import { TransactionService } from './services/transaction-service';
|
|
26
|
-
import { TransactionPaginationParams, UserBurnTokenRequestDTO } from './models';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Create a complete Transaction SDK instance
|
|
30
|
-
*
|
|
31
|
-
* @param apiClient - Configured PERS API client
|
|
32
|
-
* @returns Transaction SDK with flattened structure for better DX
|
|
33
|
-
*/
|
|
34
|
-
export function createTransactionSDK(apiClient: PersApiClient) {
|
|
35
|
-
const transactionApi = new TransactionApi(apiClient);
|
|
36
|
-
const transactionService = new TransactionService(transactionApi);
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
// Direct access to service methods (primary interface)
|
|
40
|
-
|
|
41
|
-
// Public methods
|
|
42
|
-
getTransactionById: (transactionId: string) => transactionService.getTransactionById(transactionId),
|
|
43
|
-
|
|
44
|
-
// Auth methods
|
|
45
|
-
createAuthTransaction: (request: TransactionRequestDTO) => transactionService.createAuthTransaction(request),
|
|
46
|
-
getUserTransactionHistory: (type: string) => transactionService.getUserTransactionHistory(type),
|
|
47
|
-
prepareClientSignedTransaction: (request: ClientTransactionRequestDTO) => transactionService.prepareClientSignedTransaction(request),
|
|
48
|
-
burnUserTokens: (request: UserBurnTokenRequestDTO) => transactionService.burnUserTokens(request),
|
|
49
|
-
|
|
50
|
-
// Business methods
|
|
51
|
-
createBusinessTransaction: (request: TransactionRequestDTO) => transactionService.createBusinessTransaction(request),
|
|
52
|
-
|
|
53
|
-
// Admin methods
|
|
54
|
-
createAdminTransaction: (request: TransactionRequestDTO) => transactionService.createAdminTransaction(request),
|
|
55
|
-
getTenantTransactions: () => transactionService.getTenantTransactions(),
|
|
56
|
-
getPaginatedTransactions: (params: TransactionPaginationParams) => transactionService.getPaginatedTransactions(params),
|
|
57
|
-
exportTransactionsCSV: () => transactionService.exportTransactionsCSV(),
|
|
58
|
-
|
|
59
|
-
// Advanced access for edge cases
|
|
60
|
-
api: transactionApi,
|
|
61
|
-
service: transactionService
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export type TransactionSDK = ReturnType<typeof createTransactionSDK>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transaction Domain Models
|
|
3
|
-
*
|
|
4
|
-
* Re-exports from @explorins/pers-shared for consistency with backend
|
|
5
|
-
* and to provide a single import source for transaction-related types.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Core transaction entities from centralized pers-shared interfaces
|
|
9
|
-
export type {
|
|
10
|
-
TransactionDTO,
|
|
11
|
-
TransactionRequestDTO,
|
|
12
|
-
ClientTransactionRequestDTO,
|
|
13
|
-
ClientTransactionRequestResponseDto,
|
|
14
|
-
UserToBusinessTokenTransactionCreateRequestDTO
|
|
15
|
-
} from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
16
|
-
|
|
17
|
-
// Import for local interface usage
|
|
18
|
-
import { TransactionDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
19
|
-
|
|
20
|
-
// Local transaction interfaces
|
|
21
|
-
// TODO: Move these to @explorins/pers-shared when standardized across domains
|
|
22
|
-
export interface TransactionPaginationParams {
|
|
23
|
-
page: number;
|
|
24
|
-
limit: number;
|
|
25
|
-
participantId?: string; // User ID for filtering user transactions
|
|
26
|
-
status?: string;
|
|
27
|
-
sortBy?: string; // ✅ ADD: Column to sort by
|
|
28
|
-
sortOrder?: 'ASC' | 'DESC'; // ✅ ADD: Sort direction
|
|
29
|
-
filters?: {
|
|
30
|
-
startDate?: string;
|
|
31
|
-
endDate?: string;
|
|
32
|
-
type?: string[];
|
|
33
|
-
tokenType?: string[];
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TransactionPaginationResponse {
|
|
38
|
-
data: TransactionDTO[];
|
|
39
|
-
pagination: {
|
|
40
|
-
page: string;
|
|
41
|
-
limit: string;
|
|
42
|
-
total: number;
|
|
43
|
-
pages: number;
|
|
44
|
-
hasNext: boolean;
|
|
45
|
-
hasPrev: boolean;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface UserBurnTokenRequestDTO {
|
|
50
|
-
tokenAddress: string;
|
|
51
|
-
tokenMetadataIncrementalId: string;
|
|
52
|
-
chainId: number;
|
|
53
|
-
amount: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Transaction account types (domain-specific enum)
|
|
57
|
-
export enum TransactionAccountType {
|
|
58
|
-
// Add specific transaction account types as needed
|
|
59
|
-
// This should match the enum used in the infrastructure layer
|
|
60
|
-
}
|