@explorins/pers-sdk 1.6.28 → 1.6.30
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/campaign/api/campaign-api.d.ts +2 -12
- package/dist/campaign/api/campaign-api.d.ts.map +1 -1
- package/dist/campaign.cjs +1 -1
- package/dist/campaign.js +1 -1
- package/dist/chunks/{campaign-service-Dd7gMjC9.js → campaign-service-BBB_HlK2.js} +3 -17
- package/dist/chunks/campaign-service-BBB_HlK2.js.map +1 -0
- package/dist/chunks/{campaign-service-CWK9I388.cjs → campaign-service-sLgVhBUK.cjs} +3 -17
- package/dist/chunks/campaign-service-sLgVhBUK.cjs.map +1 -0
- package/dist/chunks/{pers-sdk-xQqoP4zx.js → pers-sdk-Bt9D_tLS.js} +72 -3
- package/dist/chunks/{pers-sdk-xQqoP4zx.js.map → pers-sdk-Bt9D_tLS.js.map} +1 -1
- package/dist/chunks/{pers-sdk-BOphq5pm.cjs → pers-sdk-CQpjfRIm.cjs} +74 -5
- package/dist/chunks/{pers-sdk-BOphq5pm.cjs.map → pers-sdk-CQpjfRIm.cjs.map} +1 -1
- package/dist/chunks/transaction-service-C2sVByGQ.js +332 -0
- package/dist/chunks/transaction-service-C2sVByGQ.js.map +1 -0
- package/dist/chunks/transaction-service-oA5BRzWy.cjs +335 -0
- package/dist/chunks/transaction-service-oA5BRzWy.cjs.map +1 -0
- package/dist/core.cjs +3 -3
- package/dist/core.js +3 -3
- package/dist/index.cjs +5 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/managers/transaction-manager.d.ts +61 -5
- package/dist/managers/transaction-manager.d.ts.map +1 -1
- package/dist/package.json +2 -2
- package/dist/transaction/api/transaction-api.d.ts +10 -12
- package/dist/transaction/api/transaction-api.d.ts.map +1 -1
- package/dist/transaction/index.d.ts +0 -1
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction/models/index.d.ts +0 -34
- package/dist/transaction/models/index.d.ts.map +1 -1
- package/dist/transaction/services/transaction-service.d.ts +19 -6
- package/dist/transaction/services/transaction-service.d.ts.map +1 -1
- package/dist/transaction.cjs +4 -346
- package/dist/transaction.cjs.map +1 -1
- package/dist/transaction.js +2 -341
- package/dist/transaction.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/campaign-service-CWK9I388.cjs.map +0 -1
- package/dist/chunks/campaign-service-Dd7gMjC9.js.map +0 -1
|
@@ -4,39 +4,5 @@
|
|
|
4
4
|
* Re-exports from @explorins/pers-shared for consistency with backend
|
|
5
5
|
* and to provide a single import source for transaction-related types.
|
|
6
6
|
*/
|
|
7
|
-
import { TransactionDTO } from 'src/shared';
|
|
8
7
|
export type { TransactionDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
9
|
-
export interface UserBurnTokenRequestDTO {
|
|
10
|
-
tokenAddress: string;
|
|
11
|
-
tokenMetadataIncrementalId: string;
|
|
12
|
-
chainId: number;
|
|
13
|
-
amount: number;
|
|
14
|
-
}
|
|
15
|
-
export declare enum TransactionAccountType {
|
|
16
|
-
}
|
|
17
|
-
export interface TransactionPaginationParams {
|
|
18
|
-
page: number;
|
|
19
|
-
limit: number;
|
|
20
|
-
participantId?: string;
|
|
21
|
-
status?: string;
|
|
22
|
-
sortBy?: string;
|
|
23
|
-
sortOrder?: 'ASC' | 'DESC';
|
|
24
|
-
filters?: {
|
|
25
|
-
startDate?: string;
|
|
26
|
-
endDate?: string;
|
|
27
|
-
type?: string[];
|
|
28
|
-
tokenType?: string[];
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export interface TransactionPaginationResponse {
|
|
32
|
-
data: TransactionDTO[];
|
|
33
|
-
pagination: {
|
|
34
|
-
page: string;
|
|
35
|
-
limit: string;
|
|
36
|
-
total: number;
|
|
37
|
-
pages: number;
|
|
38
|
-
hasNext: boolean;
|
|
39
|
-
hasPrev: boolean;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/models/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/models/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { PaginatedResponseDTO, TransactionRequestResponseDTO, TransactionRole } from '@explorins/pers-shared';
|
|
2
|
-
import { TransactionDTO, TransactionRequestDTO, TransactionSubmissionRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
1
|
+
import { PaginatedResponseDTO, TransactionAnalyticsRequestDTO, TransactionAnalyticsResponseDTO, TransactionPaginationRequestDTO, TransactionRequestResponseDTO, TransactionRole } from '@explorins/pers-shared';
|
|
2
|
+
import { AccountSelectorDTO, TransactionDTO, TransactionRequestDTO, TransactionSubmissionRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
|
|
3
3
|
import { TransactionApi } from '../api/transaction-api';
|
|
4
|
-
import { TransactionPaginationParams } from '../models';
|
|
5
4
|
/**
|
|
6
5
|
* Platform-Agnostic Transaction Service
|
|
7
6
|
*
|
|
@@ -27,11 +26,13 @@ export declare class TransactionService {
|
|
|
27
26
|
*/
|
|
28
27
|
getUserTransactionHistory(role?: TransactionRole, limit?: number): Promise<TransactionDTO[]>;
|
|
29
28
|
/**
|
|
30
|
-
* AUTH: Prepare client
|
|
29
|
+
* AUTH: Prepare existing transaction for client-side signing
|
|
31
30
|
*/
|
|
31
|
+
prepareExistingTransaction(transactionId: string): Promise<TransactionRequestResponseDTO>;
|
|
32
32
|
/**
|
|
33
|
-
* AUTH:
|
|
33
|
+
* AUTH: Prepare client signed transaction
|
|
34
34
|
*/
|
|
35
|
+
prepareClientSignedTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO>;
|
|
35
36
|
/**
|
|
36
37
|
* BUSINESS: Create business transaction
|
|
37
38
|
*/
|
|
@@ -45,10 +46,22 @@ export declare class TransactionService {
|
|
|
45
46
|
/**
|
|
46
47
|
* ADMIN: Get paginated transactions with filtering and sorting
|
|
47
48
|
*/
|
|
48
|
-
getPaginatedTransactions(params:
|
|
49
|
+
getPaginatedTransactions(params: TransactionPaginationRequestDTO): Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
49
50
|
/**
|
|
50
51
|
* ADMIN: Export transactions to CSV
|
|
51
52
|
*/
|
|
52
53
|
exportTransactionsCSV(): Promise<Blob>;
|
|
54
|
+
/**
|
|
55
|
+
* Query transactions by sender
|
|
56
|
+
*/
|
|
57
|
+
queryTransactionsBySender(accountSelector: AccountSelectorDTO): Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
58
|
+
/**
|
|
59
|
+
* Query transactions by recipient
|
|
60
|
+
*/
|
|
61
|
+
queryTransactionsByRecipient(accountSelector: AccountSelectorDTO): Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
62
|
+
/**
|
|
63
|
+
* ADMIN: Get transaction analytics
|
|
64
|
+
*/
|
|
65
|
+
getTransactionAnalytics(analyticsRequest: TransactionAnalyticsRequestDTO): Promise<TransactionAnalyticsResponseDTO>;
|
|
53
66
|
}
|
|
54
67
|
//# sourceMappingURL=transaction-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-service.d.ts","sourceRoot":"","sources":["../../../src/transaction/services/transaction-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction-service.d.ts","sourceRoot":"","sources":["../../../src/transaction/services/transaction-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAChN,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAChK,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAElD;;OAEG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAQxE;;OAEG;IAKG,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAIzF,uBAAuB,CAAC,YAAY,EAAE,+BAA+B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAIpH;;OAEG;IACG,yBAAyB,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,KAAK,GAAE,MAAa,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxG;;OAEG;IACG,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAI/F;;OAEG;IACG,8BAA8B,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAQ5G;;OAEG;IASH;;OAEG;IAKH;;OAEG;IACG,qBAAqB,CAAC,KAAK,GAAE,MAAa,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAI5E;;OAEG;IACG,wBAAwB,CAAC,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAItH;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5C;;OAEG;IACG,yBAAyB,CAAC,eAAe,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAInH;;OAEG;IACG,4BAA4B,CAAC,eAAe,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAItH;;OAEG;IACG,uBAAuB,CAAC,gBAAgB,EAAE,8BAA8B,GAAG,OAAO,CAAC,+BAA+B,CAAC;CAG1H"}
|
package/dist/transaction.cjs
CHANGED
|
@@ -1,352 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var transactionService = require('./chunks/transaction-service-oA5BRzWy.cjs');
|
|
4
|
+
require('@explorins/pers-shared');
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Platform-Agnostic Transaction API Client (UPDATED FOR NEW RESTful ENDPOINTS)
|
|
7
|
-
*
|
|
8
|
-
* Handles transaction operations using the PERS backend.
|
|
9
|
-
* Uses @explorins/pers-shared DTOs for consistency with backend.
|
|
10
|
-
*
|
|
11
|
-
* MIGRATION NOTES:
|
|
12
|
-
* - All endpoints changed from /transaction to /transactions
|
|
13
|
-
* - Role-based paths removed (no more /auth, /admin, /business in URLs)
|
|
14
|
-
* - New RESTful resource-based structure
|
|
15
|
-
* - Added new client-side transaction flow methods
|
|
16
|
-
* - Enhanced admin query capabilities
|
|
17
|
-
*/
|
|
18
|
-
class TransactionApi {
|
|
19
|
-
constructor(apiClient) {
|
|
20
|
-
this.apiClient = apiClient;
|
|
21
|
-
this.basePath = '/transactions';
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get transaction by ID (public endpoint)
|
|
25
|
-
*
|
|
26
|
-
* UPDATED: /transaction/{id} → /transactions/{id}
|
|
27
|
-
*/
|
|
28
|
-
async getTransactionById(transactionId) {
|
|
29
|
-
return this.apiClient.get(`${this.basePath}/${transactionId}`);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Unique method to create a transaction
|
|
33
|
-
* @param request
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
async createTransaction(request) {
|
|
37
|
-
return this.apiClient.post(`${this.basePath}`, request);
|
|
38
|
-
// return this.apiClient.post<TransactionDTO>(`${this.basePath}/system`, request);
|
|
39
|
-
}
|
|
40
|
-
// ==========================================
|
|
41
|
-
// AUTHENTICATED USER OPERATIONS
|
|
42
|
-
// ==========================================
|
|
43
|
-
/**
|
|
44
|
-
* AUTH: Get user transaction history with role-based filtering
|
|
45
|
-
*
|
|
46
|
-
* UPDATED: Uses consolidated /transactions/me endpoint with role parameter
|
|
47
|
-
* @param role - Optional role filter (SENDER, RECIPIENT). If undefined, returns all user transactions
|
|
48
|
-
* @param limit - Maximum number of transactions to return (default: 1000)
|
|
49
|
-
*/
|
|
50
|
-
async getUserTransactionHistory(role, limit = 1000) {
|
|
51
|
-
const params = new URLSearchParams({
|
|
52
|
-
limit: limit.toString(),
|
|
53
|
-
timestamp: Date.now().toString()
|
|
54
|
-
});
|
|
55
|
-
// Add role parameter if specified
|
|
56
|
-
if (role === persShared.TransactionRole.SENDER) {
|
|
57
|
-
params.set('role', persShared.TransactionRole.SENDER);
|
|
58
|
-
}
|
|
59
|
-
else if (role === persShared.TransactionRole.RECIPIENT) {
|
|
60
|
-
params.set('role', persShared.TransactionRole.RECIPIENT);
|
|
61
|
-
}
|
|
62
|
-
// If no role specified, get all transactions for the user
|
|
63
|
-
const response = await this.apiClient.get(`${this.basePath}/me?${params.toString()}`);
|
|
64
|
-
return [...(response.data || [])];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* AUTH: Prepare existing transaction for client-side signing
|
|
68
|
-
*
|
|
69
|
-
* NEW ENDPOINT: GET /transactions/{id}/prepare
|
|
70
|
-
*/
|
|
71
|
-
async prepareExistingTransaction(transactionId) {
|
|
72
|
-
return this.apiClient.get(`${this.basePath}/${transactionId}/prepare`);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* AUTH: Submit client-side signed transaction
|
|
76
|
-
*
|
|
77
|
-
* NEW ENDPOINT: POST /transactions/{id}/submit
|
|
78
|
-
*/
|
|
79
|
-
async submitSignedTransaction(signedTxData) {
|
|
80
|
-
return this.apiClient.post(`${this.basePath}/submit`, signedTxData);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* AUTH: Burn user tokens
|
|
84
|
-
*
|
|
85
|
-
* UPDATED: Uses new user transaction endpoint with burn-specific parameters
|
|
86
|
-
* Note: This might need backend confirmation on burn functionality implementation
|
|
87
|
-
*/
|
|
88
|
-
/* async burnUserTokens(request: UserBurnTokenRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
89
|
-
// Map burn request to TransactionRequestDTO format for new endpoint
|
|
90
|
-
const transactionRequest: TransactionRequestDTO = {
|
|
91
|
-
...request,
|
|
92
|
-
// Add any specific burn transaction parameters here
|
|
93
|
-
} as any;
|
|
94
|
-
|
|
95
|
-
return this.apiClient.post<TransactionRequestResponseDTO>(`${this.basePath}`, transactionRequest);
|
|
96
|
-
} */
|
|
97
|
-
// ==========================================
|
|
98
|
-
// BUSINESS OPERATIONS
|
|
99
|
-
// ==========================================
|
|
100
|
-
/**
|
|
101
|
-
* BUSINESS: Create business transaction
|
|
102
|
-
*
|
|
103
|
-
* UPDATED: /transaction/business/transaction → /transactions/business
|
|
104
|
-
*/
|
|
105
|
-
/* async createBusinessTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
106
|
-
return this.apiClient.post<TransactionRequestResponseDTO>(`${this.basePath}`, request);
|
|
107
|
-
} */
|
|
108
|
-
// ==========================================
|
|
109
|
-
// ADMIN OPERATIONS
|
|
110
|
-
// ==========================================
|
|
111
|
-
/**
|
|
112
|
-
* ADMIN: Create admin transaction
|
|
113
|
-
*
|
|
114
|
-
* UPDATED: /transaction/admin/transaction → /transactions/admin
|
|
115
|
-
*/
|
|
116
|
-
/* async createAdminTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
117
|
-
// return this.apiClient.post<TransactionRequestResponseDTO>(`${this.basePath}`, request);
|
|
118
|
-
return this.apiClient.post<TransactionDTO>(`${this.basePath}/system`, request);
|
|
119
|
-
} */
|
|
120
|
-
/**
|
|
121
|
-
* AUTH: Prepare client signed transaction
|
|
122
|
-
*
|
|
123
|
-
* UPDATED: /transaction/auth/prepare-signing → /transactions/prepare
|
|
124
|
-
*/
|
|
125
|
-
async prepareClientSignedTransaction(request) {
|
|
126
|
-
return this.apiClient.post(`${this.basePath}`, request);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* ADMIN: Get all tenant transactions
|
|
130
|
-
*
|
|
131
|
-
* UPDATED: /transaction/admin → /transactions
|
|
132
|
-
*/
|
|
133
|
-
async getTenantTransactions(limit = 1000) {
|
|
134
|
-
const params = new URLSearchParams({
|
|
135
|
-
limit: limit.toString()
|
|
136
|
-
});
|
|
137
|
-
const result = await this.apiClient.get(`${this.basePath}?${params.toString()}`);
|
|
138
|
-
// Extract data array from paginated response
|
|
139
|
-
return [...(result.data || [])];
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* ADMIN: Get paginated transactions with filtering and sorting
|
|
143
|
-
*
|
|
144
|
-
* UPDATED: /transaction/admin → /transactions (same endpoint, better structure)
|
|
145
|
-
*/
|
|
146
|
-
async getPaginatedTransactions(params) {
|
|
147
|
-
// Build query parameters
|
|
148
|
-
const queryParams = {
|
|
149
|
-
page: params.page.toString(),
|
|
150
|
-
limit: params.limit.toString()
|
|
151
|
-
};
|
|
152
|
-
// Add sorting parameters if provided
|
|
153
|
-
if (params.sortBy) {
|
|
154
|
-
queryParams['sortBy'] = params.sortBy;
|
|
155
|
-
}
|
|
156
|
-
if (params.sortOrder) {
|
|
157
|
-
queryParams['sortOrder'] = params.sortOrder;
|
|
158
|
-
}
|
|
159
|
-
// Add user-specific filtering if provided
|
|
160
|
-
if (params.participantId) {
|
|
161
|
-
queryParams['participantId'] = params.participantId;
|
|
162
|
-
}
|
|
163
|
-
// Add status filtering if provided
|
|
164
|
-
if (params.status) {
|
|
165
|
-
queryParams['status'] = params.status;
|
|
166
|
-
}
|
|
167
|
-
// Add additional filters if provided
|
|
168
|
-
if (params.filters) {
|
|
169
|
-
if (params.filters.startDate) {
|
|
170
|
-
queryParams['startDate'] = params.filters.startDate;
|
|
171
|
-
}
|
|
172
|
-
if (params.filters.endDate) {
|
|
173
|
-
queryParams['endDate'] = params.filters.endDate;
|
|
174
|
-
}
|
|
175
|
-
if (params.filters.type && params.filters.type.length > 0) {
|
|
176
|
-
queryParams['type'] = params.filters.type.join(',');
|
|
177
|
-
}
|
|
178
|
-
if (params.filters.tokenType && params.filters.tokenType.length > 0) {
|
|
179
|
-
queryParams['tokenType'] = params.filters.tokenType.join(',');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
// Build query string
|
|
183
|
-
const queryString = Object.entries(queryParams)
|
|
184
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
185
|
-
.join('&');
|
|
186
|
-
return this.apiClient.get(`${this.basePath}?${queryString}`);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* ADMIN: Export transactions to CSV
|
|
190
|
-
*
|
|
191
|
-
* UPDATED: /transaction/admin/export/csv → /transactions/export/csv
|
|
192
|
-
*/
|
|
193
|
-
async exportTransactionsCSV() {
|
|
194
|
-
return this.apiClient.get(`${this.basePath}/export/csv`, 'blob');
|
|
195
|
-
}
|
|
196
|
-
// ==========================================
|
|
197
|
-
// NEW ADMIN QUERY METHODS
|
|
198
|
-
// ==========================================
|
|
199
|
-
/**
|
|
200
|
-
* ADMIN: Query transactions by sender
|
|
201
|
-
*
|
|
202
|
-
* NEW ENDPOINT: POST /transactions/query-sender
|
|
203
|
-
*/
|
|
204
|
-
/**
|
|
205
|
-
* Query transactions by sender using unified endpoint
|
|
206
|
-
*/
|
|
207
|
-
async queryTransactionsBySender(accountSelector) {
|
|
208
|
-
// Build query parameters safely
|
|
209
|
-
const queryParams = {};
|
|
210
|
-
if (accountSelector.accountId) {
|
|
211
|
-
queryParams['participantId'] = accountSelector.accountId;
|
|
212
|
-
}
|
|
213
|
-
queryParams['role'] = persShared.TransactionRole.SENDER.toString();
|
|
214
|
-
const params = new URLSearchParams(queryParams);
|
|
215
|
-
return this.apiClient.get(`${this.basePath}?${params.toString()}`).then(response => response); // Extract items from paginated response
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Query transactions by recipient using unified endpoint
|
|
219
|
-
*/
|
|
220
|
-
async queryTransactionsByRecipient(accountSelector) {
|
|
221
|
-
// Build query parameters safely
|
|
222
|
-
const queryParams = {};
|
|
223
|
-
if (accountSelector.accountId) {
|
|
224
|
-
queryParams['participantId'] = accountSelector.accountId;
|
|
225
|
-
}
|
|
226
|
-
queryParams['role'] = persShared.TransactionRole.RECIPIENT.toString();
|
|
227
|
-
const params = new URLSearchParams(queryParams);
|
|
228
|
-
return this.apiClient.get(`${this.basePath}?${params.toString()}`).then(response => response); // Extract items from paginated response
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* ADMIN: Get transaction analytics
|
|
232
|
-
*
|
|
233
|
-
* NEW ENDPOINT: POST /transactions/analytics
|
|
234
|
-
*/
|
|
235
|
-
async getTransactionAnalytics(analyticsRequest) {
|
|
236
|
-
return this.apiClient.post(`${this.basePath}/analytics`, analyticsRequest);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
6
|
|
|
240
|
-
/**
|
|
241
|
-
* Platform-Agnostic Transaction Service
|
|
242
|
-
*
|
|
243
|
-
* Contains transaction business logic and operations that work across platforms.
|
|
244
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
245
|
-
*
|
|
246
|
-
* Focuses only on actual backend capabilities.
|
|
247
|
-
*/
|
|
248
|
-
class TransactionService {
|
|
249
|
-
constructor(transactionApi) {
|
|
250
|
-
this.transactionApi = transactionApi;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Get transaction by ID
|
|
254
|
-
*/
|
|
255
|
-
async getTransactionById(transactionId) {
|
|
256
|
-
return this.transactionApi.getTransactionById(transactionId);
|
|
257
|
-
}
|
|
258
|
-
// ==========================================
|
|
259
|
-
// AUTHENTICATED OPERATIONS
|
|
260
|
-
// ==========================================
|
|
261
|
-
/**
|
|
262
|
-
* AUTH: Create authenticated transaction
|
|
263
|
-
*/
|
|
264
|
-
/* async createAuthTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
265
|
-
return this.transactionApi.createAuthTransaction(request);
|
|
266
|
-
} */
|
|
267
|
-
async createTransaction(request) {
|
|
268
|
-
return this.transactionApi.createTransaction(request);
|
|
269
|
-
}
|
|
270
|
-
async submitSignedTransaction(signedTxData) {
|
|
271
|
-
return this.transactionApi.submitSignedTransaction(signedTxData);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* AUTH: Get user transaction history by type
|
|
275
|
-
*/
|
|
276
|
-
async getUserTransactionHistory(role, limit = 1000) {
|
|
277
|
-
return this.transactionApi.getUserTransactionHistory(role, limit);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* AUTH: Prepare client signed transaction
|
|
281
|
-
*/
|
|
282
|
-
/* async prepareClientSignedTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
283
|
-
return this.transactionApi.prepareClientSignedTransaction(request);
|
|
284
|
-
} */
|
|
285
|
-
/**
|
|
286
|
-
* AUTH: Burn user tokens
|
|
287
|
-
*/
|
|
288
|
-
/* async burnUserTokens(request: UserBurnTokenRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
289
|
-
return this.transactionApi.burnUserTokens(request);
|
|
290
|
-
} */
|
|
291
|
-
// ==========================================
|
|
292
|
-
// BUSINESS OPERATIONS
|
|
293
|
-
// ==========================================
|
|
294
|
-
/**
|
|
295
|
-
* BUSINESS: Create business transaction
|
|
296
|
-
*/
|
|
297
|
-
/* async createBusinessTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
298
|
-
return this.transactionApi.createBusinessTransaction(request);
|
|
299
|
-
} */
|
|
300
|
-
// ==========================================
|
|
301
|
-
// ADMIN OPERATIONS
|
|
302
|
-
// ==========================================
|
|
303
|
-
/**
|
|
304
|
-
* ADMIN: Create admin transaction
|
|
305
|
-
*/
|
|
306
|
-
/* async createAdminTransaction(request: TransactionRequestDTO): Promise<TransactionRequestResponseDTO> {
|
|
307
|
-
return this.transactionApi.createAdminTransaction(request);
|
|
308
|
-
} */
|
|
309
|
-
/**
|
|
310
|
-
* ADMIN: Get all tenant transactions
|
|
311
|
-
*/
|
|
312
|
-
async getTenantTransactions(limit = 1000) {
|
|
313
|
-
return this.transactionApi.getTenantTransactions(limit);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* ADMIN: Get paginated transactions with filtering and sorting
|
|
317
|
-
*/
|
|
318
|
-
async getPaginatedTransactions(params) {
|
|
319
|
-
return this.transactionApi.getPaginatedTransactions(params);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* ADMIN: Export transactions to CSV
|
|
323
|
-
*/
|
|
324
|
-
async exportTransactionsCSV() {
|
|
325
|
-
return this.transactionApi.exportTransactionsCSV();
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
7
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
*
|
|
332
|
-
* Re-exports from @explorins/pers-shared for consistency with backend
|
|
333
|
-
* and to provide a single import source for transaction-related types.
|
|
334
|
-
*/
|
|
335
|
-
// Transaction account types (domain-specific enum)
|
|
336
|
-
exports.TransactionAccountType = void 0;
|
|
337
|
-
(function (TransactionAccountType) {
|
|
338
|
-
// Add specific transaction account types as needed
|
|
339
|
-
// This should match the enum used in the infrastructure layer
|
|
340
|
-
})(exports.TransactionAccountType || (exports.TransactionAccountType = {}));
|
|
341
|
-
|
|
342
|
-
Object.defineProperty(exports, "AccountOwnerType", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function () { return persShared.AccountOwnerType; }
|
|
345
|
-
});
|
|
346
|
-
Object.defineProperty(exports, "ApiKeyType", {
|
|
347
|
-
enumerable: true,
|
|
348
|
-
get: function () { return persShared.ApiKeyType; }
|
|
349
|
-
});
|
|
350
|
-
exports.TransactionApi = TransactionApi;
|
|
351
|
-
exports.TransactionService = TransactionService;
|
|
8
|
+
exports.TransactionApi = transactionService.TransactionApi;
|
|
9
|
+
exports.TransactionService = transactionService.TransactionService;
|
|
352
10
|
//# sourceMappingURL=transaction.cjs.map
|
package/dist/transaction.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"transaction.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|