@explorins/pers-sdk 1.2.6 → 1.3.2
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/README.md +416 -0
- package/dist/business/api/business-api.d.ts.map +1 -1
- package/dist/business.cjs +6 -8
- package/dist/business.cjs.map +1 -1
- package/dist/business.js +6 -8
- package/dist/business.js.map +1 -1
- package/dist/campaign/api/campaign-api.d.ts +19 -65
- package/dist/campaign/api/campaign-api.d.ts.map +1 -1
- package/dist/campaign.cjs +51 -105
- package/dist/campaign.cjs.map +1 -1
- package/dist/campaign.js +49 -103
- package/dist/campaign.js.map +1 -1
- package/dist/chunks/base-token-service-BA81_Ouq.js +532 -0
- package/dist/chunks/base-token-service-BA81_Ouq.js.map +1 -0
- package/dist/chunks/base-token-service-BQ6uFoki.cjs +537 -0
- package/dist/chunks/base-token-service-BQ6uFoki.cjs.map +1 -0
- package/dist/chunks/environment-C2AkkLPd.js +46 -0
- package/dist/chunks/environment-C2AkkLPd.js.map +1 -0
- package/dist/chunks/environment-CRROnwAY.cjs +50 -0
- package/dist/chunks/environment-CRROnwAY.cjs.map +1 -0
- package/dist/chunks/jwt.function-BYiyl-z_.cjs +25 -0
- package/dist/chunks/jwt.function-BYiyl-z_.cjs.map +1 -0
- package/dist/chunks/jwt.function-d6jPtBqI.js +23 -0
- package/dist/chunks/jwt.function-d6jPtBqI.js.map +1 -0
- package/dist/chunks/pers-sdk-Ct_uUMJl.cjs +1424 -0
- package/dist/chunks/pers-sdk-Ct_uUMJl.cjs.map +1 -0
- package/dist/chunks/pers-sdk-tKHGQr5x.js +1417 -0
- package/dist/chunks/pers-sdk-tKHGQr5x.js.map +1 -0
- package/dist/core/auth/api/auth-api.d.ts +5 -2
- package/dist/core/auth/api/auth-api.d.ts.map +1 -1
- package/dist/core/auth/auth-constants.d.ts +33 -0
- package/dist/core/auth/auth-constants.d.ts.map +1 -0
- package/dist/core/auth/auth-errors.d.ts +8 -0
- package/dist/core/auth/auth-errors.d.ts.map +1 -0
- package/dist/core/auth/auth-provider.interface.d.ts +49 -3
- package/dist/core/auth/auth-provider.interface.d.ts.map +1 -1
- package/dist/core/auth/create-auth-provider.d.ts.map +1 -1
- package/dist/core/auth/default-auth-provider.d.ts +71 -0
- package/dist/core/auth/default-auth-provider.d.ts.map +1 -0
- package/dist/core/auth/index.d.ts +1 -22
- package/dist/core/auth/index.d.ts.map +1 -1
- package/dist/core/auth/services/auth-service.d.ts +10 -1
- package/dist/core/auth/services/auth-service.d.ts.map +1 -1
- package/dist/core/auth/token-refresh.d.ts +91 -0
- package/dist/core/auth/token-refresh.d.ts.map +1 -0
- package/dist/core/auth/token-storage.d.ts +74 -0
- package/dist/core/auth/token-storage.d.ts.map +1 -0
- package/dist/core/environment.d.ts +26 -0
- package/dist/core/environment.d.ts.map +1 -0
- package/dist/core/errors/index.d.ts +80 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/pers-api-client.d.ts +184 -19
- package/dist/core/pers-api-client.d.ts.map +1 -1
- package/dist/core/pers-config.d.ts +36 -1
- package/dist/core/pers-config.d.ts.map +1 -1
- package/dist/core/utils/jwt.function.d.ts.map +1 -1
- package/dist/core.cjs +12 -814
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +3 -803
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +82 -4912
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -4857
- package/dist/index.js.map +1 -1
- package/dist/package.json +147 -129
- package/dist/pers-sdk.d.ts +49 -7
- package/dist/pers-sdk.d.ts.map +1 -1
- package/dist/redemption/api/redemption-api.d.ts +12 -13
- package/dist/redemption/api/redemption-api.d.ts.map +1 -1
- package/dist/redemption.cjs +24 -24
- package/dist/redemption.cjs.map +1 -1
- package/dist/redemption.js +24 -24
- package/dist/redemption.js.map +1 -1
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +1 -0
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -1
- package/dist/tenant/api/tenant-api.d.ts +28 -10
- package/dist/tenant/api/tenant-api.d.ts.map +1 -1
- package/dist/tenant/index.d.ts +4 -4
- package/dist/tenant.cjs +40 -11
- package/dist/tenant.cjs.map +1 -1
- package/dist/tenant.js +40 -11
- package/dist/tenant.js.map +1 -1
- package/dist/token.cjs +7 -534
- package/dist/token.cjs.map +1 -1
- package/dist/token.js +1 -532
- package/dist/token.js.map +1 -1
- package/dist/web3/index.d.ts.map +1 -1
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts +1 -1
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -1
- package/dist/web3-chain.cjs +12 -152
- package/dist/web3-chain.cjs.map +1 -1
- package/dist/web3-chain.js +8 -148
- package/dist/web3-chain.js.map +1 -1
- package/dist/web3.cjs +12 -538
- package/dist/web3.cjs.map +1 -1
- package/dist/web3.js +10 -536
- package/dist/web3.js.map +1 -1
- package/package.json +147 -129
- package/dist/core/auth/simple-sdk-auth-provider.d.ts +0 -27
- package/dist/core/auth/simple-sdk-auth-provider.d.ts.map +0 -1
package/dist/token.js
CHANGED
|
@@ -1,534 +1,3 @@
|
|
|
1
|
+
export { B as BaseTokenService, a as TokenApi, T as TokenSDK, b as TokenService } from './chunks/base-token-service-BA81_Ouq.js';
|
|
1
2
|
export { AccountOwnerType } from '@explorins/pers-shared';
|
|
2
|
-
|
|
3
|
-
class TokenApi {
|
|
4
|
-
constructor(apiClient) {
|
|
5
|
-
this.apiClient = apiClient;
|
|
6
|
-
this.basePath = '/tokens';
|
|
7
|
-
}
|
|
8
|
-
// ==========================================
|
|
9
|
-
// PUBLIC OPERATIONS
|
|
10
|
-
// ==========================================
|
|
11
|
-
/**
|
|
12
|
-
* PUBLIC: Get all remote tokens
|
|
13
|
-
* ENHANCED: Added admin filtering capability
|
|
14
|
-
*/
|
|
15
|
-
async getRemoteTokens(includeInactive = false) {
|
|
16
|
-
const url = includeInactive ? `${this.basePath}?active=false` : `${this.basePath}`;
|
|
17
|
-
return this.apiClient.get(url);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* PUBLIC: Get all remote token types
|
|
21
|
-
*/
|
|
22
|
-
async getRemoteTokenTypes() {
|
|
23
|
-
return this.apiClient.get(`${this.basePath}/types`);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* PUBLIC: Get active point token (was credit token)
|
|
27
|
-
*/
|
|
28
|
-
async getRemoteActiveCreditToken() {
|
|
29
|
-
return this.apiClient.get(`${this.basePath}/points`);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* PUBLIC: Get reward tokens
|
|
33
|
-
* ENHANCED: Added admin filtering capability
|
|
34
|
-
*/
|
|
35
|
-
async getRemoteRewardTokens(includeInactive = false) {
|
|
36
|
-
const url = includeInactive ? `${this.basePath}/rewards?active=false` : `${this.basePath}/rewards`;
|
|
37
|
-
return this.apiClient.get(url);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* PUBLIC: Get stamp tokens (was status tokens)
|
|
41
|
-
* ENHANCED: Added admin filtering capability
|
|
42
|
-
*/
|
|
43
|
-
async getRemoteStatusTokens(includeInactive = false) {
|
|
44
|
-
const url = includeInactive ? `${this.basePath}/stamps?active=false` : `${this.basePath}/stamps`;
|
|
45
|
-
return this.apiClient.get(url);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* PUBLIC: Get token by contract address
|
|
49
|
-
*/
|
|
50
|
-
async getTokenByContractAddress(contractAddress, contractTokenId) {
|
|
51
|
-
let url = `${this.basePath}/address/${contractAddress}`;
|
|
52
|
-
if (contractTokenId) {
|
|
53
|
-
url += `?contractTokenId=${contractTokenId}`;
|
|
54
|
-
}
|
|
55
|
-
return this.apiClient.get(url);
|
|
56
|
-
}
|
|
57
|
-
// ==========================================
|
|
58
|
-
// ADMIN OPERATIONS
|
|
59
|
-
// ==========================================
|
|
60
|
-
/**
|
|
61
|
-
* ADMIN: Create new token
|
|
62
|
-
*/
|
|
63
|
-
async createToken(tokenData) {
|
|
64
|
-
return this.apiClient.post(`${this.basePath}`, tokenData);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* ADMIN: Update token
|
|
68
|
-
*/
|
|
69
|
-
async updateToken(tokenId, tokenData) {
|
|
70
|
-
return this.apiClient.put(`${this.basePath}/${tokenId}`, tokenData);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* ADMIN: Toggle token active status
|
|
74
|
-
* FIXED: Now calls correct endpoint
|
|
75
|
-
*/
|
|
76
|
-
async toggleTokenActive(tokenId) {
|
|
77
|
-
return this.apiClient.put(`${this.basePath}/${tokenId}/status`, {});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* ADMIN: Set mainnet contract address
|
|
81
|
-
*/
|
|
82
|
-
async setMainnetContract(tokenId, contractAddress, chainId) {
|
|
83
|
-
return this.apiClient.put(`${this.basePath}/${tokenId}/mainnet`, {
|
|
84
|
-
contractAddress,
|
|
85
|
-
chainId
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* ADMIN: Create token metadata
|
|
90
|
-
*/
|
|
91
|
-
async createTokenMetadata(tokenId, tokenData) {
|
|
92
|
-
return this.apiClient.post(`${this.basePath}/${tokenId}/metadata`, tokenData);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* ADMIN: Toggle token metadata status (separate from token status)
|
|
96
|
-
*/
|
|
97
|
-
async toggleTokenMetadataStatus(metadataId) {
|
|
98
|
-
return this.apiClient.put(`${this.basePath}/metadata/${metadataId}/status`, {});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* ADMIN: Create token type
|
|
102
|
-
*/
|
|
103
|
-
async createTokenType(tokenType) {
|
|
104
|
-
return this.apiClient.post(`${this.basePath}/types`, tokenType);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Platform-Agnostic Token Service
|
|
110
|
-
*
|
|
111
|
-
* Contains token business logic and operations that work across platforms.
|
|
112
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
113
|
-
* Matches framework TokenApiService capabilities exactly.
|
|
114
|
-
*/
|
|
115
|
-
class TokenService {
|
|
116
|
-
constructor(tokenApi) {
|
|
117
|
-
this.tokenApi = tokenApi;
|
|
118
|
-
}
|
|
119
|
-
// ==========================================
|
|
120
|
-
// PUBLIC OPERATIONS
|
|
121
|
-
// ==========================================
|
|
122
|
-
/**
|
|
123
|
-
* PUBLIC: Get all remote tokens
|
|
124
|
-
*/
|
|
125
|
-
async getRemoteTokens() {
|
|
126
|
-
return this.tokenApi.getRemoteTokens();
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* PUBLIC: Get all remote token types
|
|
130
|
-
*/
|
|
131
|
-
async getRemoteTokenTypes() {
|
|
132
|
-
return this.tokenApi.getRemoteTokenTypes();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* PUBLIC: Get active credit token
|
|
136
|
-
*/
|
|
137
|
-
async getRemoteActiveCreditToken() {
|
|
138
|
-
return this.tokenApi.getRemoteActiveCreditToken();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* PUBLIC: Get reward tokens
|
|
142
|
-
*/
|
|
143
|
-
async getRemoteRewardTokens() {
|
|
144
|
-
return this.tokenApi.getRemoteRewardTokens();
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* PUBLIC: Get status tokens
|
|
148
|
-
*/
|
|
149
|
-
async getRemoteStatusTokens() {
|
|
150
|
-
return this.tokenApi.getRemoteStatusTokens();
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* PUBLIC: Get token by contract address
|
|
154
|
-
* ✅ FIXED: Matches framework parameter types exactly
|
|
155
|
-
*/
|
|
156
|
-
async getTokenByContractAddress(contractAddress, contractTokenId) {
|
|
157
|
-
return this.tokenApi.getTokenByContractAddress(contractAddress, contractTokenId);
|
|
158
|
-
}
|
|
159
|
-
// ==========================================
|
|
160
|
-
// ADMIN OPERATIONS
|
|
161
|
-
// ==========================================
|
|
162
|
-
/**
|
|
163
|
-
* ADMIN: Create token metadata
|
|
164
|
-
*/
|
|
165
|
-
async createTokenMetadata(tokenId, tokenData) {
|
|
166
|
-
return this.tokenApi.createTokenMetadata(tokenId, tokenData);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* ADMIN: Toggle token active status
|
|
170
|
-
*/
|
|
171
|
-
async toggleTokenActive(tokenId) {
|
|
172
|
-
return this.tokenApi.toggleTokenActive(tokenId);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* ADMIN: Create new token
|
|
176
|
-
*/
|
|
177
|
-
async createToken(tokenData) {
|
|
178
|
-
return this.tokenApi.createToken(tokenData);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* ADMIN: Update token
|
|
182
|
-
*/
|
|
183
|
-
async updateToken(tokenId, tokenData) {
|
|
184
|
-
return this.tokenApi.updateToken(tokenId, tokenData);
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* ADMIN: Set mainnet contract address
|
|
188
|
-
*/
|
|
189
|
-
async setMainnetContract(tokenId, contractAddress, chainId) {
|
|
190
|
-
return this.tokenApi.setMainnetContract(tokenId, contractAddress, chainId);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* ADMIN: Toggle token metadata status
|
|
194
|
-
*/
|
|
195
|
-
async toggleTokenMetadataStatus(metadataId) {
|
|
196
|
-
return this.tokenApi.toggleTokenMetadataStatus(metadataId);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* ADMIN: Create token type
|
|
200
|
-
*/
|
|
201
|
-
async createTokenType(tokenType) {
|
|
202
|
-
return this.tokenApi.createTokenType(tokenType);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Token SDK - Class-based Promise SDK for Token Operations
|
|
208
|
-
*
|
|
209
|
-
* Modern, performant SDK with direct method access and excellent TypeScript support.
|
|
210
|
-
* Optimized for bundle size, performance, and developer experience.
|
|
211
|
-
*
|
|
212
|
-
* Usage:
|
|
213
|
-
* const tokenSDK = new TokenSDK(apiClient);
|
|
214
|
-
* const tokens = await tokenSDK.getTokens();
|
|
215
|
-
* const creditToken = await tokenSDK.getActiveCreditToken();
|
|
216
|
-
*/
|
|
217
|
-
class TokenSDK {
|
|
218
|
-
constructor(apiClient) {
|
|
219
|
-
this.tokenApi = new TokenApi(apiClient);
|
|
220
|
-
this.tokenService = new TokenService(this.tokenApi);
|
|
221
|
-
}
|
|
222
|
-
// ==========================================
|
|
223
|
-
// CONVENIENCE METHODS - Direct Promise API
|
|
224
|
-
// ==========================================
|
|
225
|
-
// Simplified method names for better developer experience
|
|
226
|
-
/**
|
|
227
|
-
* Get all tokens
|
|
228
|
-
* @returns Promise with all available tokens
|
|
229
|
-
*/
|
|
230
|
-
async getTokens() {
|
|
231
|
-
return this.tokenService.getRemoteTokens();
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Get all token types
|
|
235
|
-
* @returns Promise with all available token types
|
|
236
|
-
*/
|
|
237
|
-
async getTokenTypes() {
|
|
238
|
-
return this.tokenService.getRemoteTokenTypes();
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get the active credit token
|
|
242
|
-
* @returns Promise with the current active credit token
|
|
243
|
-
*/
|
|
244
|
-
async getActiveCreditToken() {
|
|
245
|
-
return this.tokenService.getRemoteActiveCreditToken();
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get all reward tokens
|
|
249
|
-
* @returns Promise with all reward tokens
|
|
250
|
-
*/
|
|
251
|
-
async getRewardTokens() {
|
|
252
|
-
return this.tokenService.getRemoteRewardTokens();
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Get all status tokens
|
|
256
|
-
* @returns Promise with all status tokens
|
|
257
|
-
*/
|
|
258
|
-
async getStatusTokens() {
|
|
259
|
-
return this.tokenService.getRemoteStatusTokens();
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Get token by contract address
|
|
263
|
-
* @param contractAddress - The contract address to search for
|
|
264
|
-
* @param contractTokenId - Optional contract token ID
|
|
265
|
-
* @returns Promise with the matching token
|
|
266
|
-
*/
|
|
267
|
-
async getTokenByContract(contractAddress, contractTokenId = null) {
|
|
268
|
-
return this.tokenService.getTokenByContractAddress(contractAddress, contractTokenId);
|
|
269
|
-
}
|
|
270
|
-
// ==========================================
|
|
271
|
-
// ADMIN METHODS - Token Management
|
|
272
|
-
// ==========================================
|
|
273
|
-
/**
|
|
274
|
-
* Create token metadata
|
|
275
|
-
* @param tokenId - The token ID
|
|
276
|
-
* @param tokenData - The token storage data
|
|
277
|
-
* @returns Promise with the updated token
|
|
278
|
-
*/
|
|
279
|
-
async createTokenMetadata(tokenId, tokenData) {
|
|
280
|
-
return this.tokenService.createTokenMetadata(tokenId, tokenData);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Toggle token active status
|
|
284
|
-
* @param tokenId - The token ID to toggle
|
|
285
|
-
* @returns Promise with the updated token
|
|
286
|
-
*/
|
|
287
|
-
async toggleTokenActive(tokenId) {
|
|
288
|
-
return this.tokenService.toggleTokenActive(tokenId);
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Create a new token
|
|
292
|
-
* @param tokenData - The token creation data
|
|
293
|
-
* @returns Promise with the created token
|
|
294
|
-
*/
|
|
295
|
-
async createToken(tokenData) {
|
|
296
|
-
return this.tokenService.createToken(tokenData);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Update an existing token
|
|
300
|
-
* @param tokenId - The token ID to update
|
|
301
|
-
* @param tokenData - The token update data
|
|
302
|
-
* @returns Promise with the updated token
|
|
303
|
-
*/
|
|
304
|
-
async updateToken(tokenId, tokenData) {
|
|
305
|
-
return this.tokenService.updateToken(tokenId, tokenData);
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Set mainnet contract address for a token
|
|
309
|
-
* @param tokenId - The token ID
|
|
310
|
-
* @param contractAddress - The contract address
|
|
311
|
-
* @param chainId - The blockchain chain ID
|
|
312
|
-
* @returns Promise with the updated token
|
|
313
|
-
*/
|
|
314
|
-
async setMainnetContract(tokenId, contractAddress, chainId) {
|
|
315
|
-
return this.tokenService.setMainnetContract(tokenId, contractAddress, chainId);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Toggle token metadata status
|
|
319
|
-
* @param metadataId - The metadata ID to toggle
|
|
320
|
-
* @returns Promise with the updated metadata
|
|
321
|
-
*/
|
|
322
|
-
async toggleTokenMetadataStatus(metadataId) {
|
|
323
|
-
return this.tokenService.toggleTokenMetadataStatus(metadataId);
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Create a new token type
|
|
327
|
-
* @param tokenType - The token type data
|
|
328
|
-
* @returns Promise with the created token type
|
|
329
|
-
*/
|
|
330
|
-
async createTokenType(tokenType) {
|
|
331
|
-
return this.tokenService.createTokenType(tokenType);
|
|
332
|
-
}
|
|
333
|
-
// ==========================================
|
|
334
|
-
// ADVANCED ACCESS - For Complex Operations
|
|
335
|
-
// ==========================================
|
|
336
|
-
/**
|
|
337
|
-
* Get direct access to the token service for advanced operations
|
|
338
|
-
* @returns The underlying TokenService instance
|
|
339
|
-
*/
|
|
340
|
-
getTokenService() {
|
|
341
|
-
return this.tokenService;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Get direct access to the token API for low-level operations
|
|
345
|
-
* @returns The underlying TokenApi instance
|
|
346
|
-
*/
|
|
347
|
-
getTokenApi() {
|
|
348
|
-
return this.tokenApi;
|
|
349
|
-
}
|
|
350
|
-
// ==========================================
|
|
351
|
-
// FRAMEWORK COMPATIBILITY METHODS
|
|
352
|
-
// ==========================================
|
|
353
|
-
// These maintain compatibility with existing framework method names
|
|
354
|
-
/**
|
|
355
|
-
* @deprecated Use getTokens() instead
|
|
356
|
-
* Framework compatibility method
|
|
357
|
-
*/
|
|
358
|
-
async getRemoteTokens() {
|
|
359
|
-
return this.getTokens();
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* @deprecated Use getTokenTypes() instead
|
|
363
|
-
* Framework compatibility method
|
|
364
|
-
*/
|
|
365
|
-
async getRemoteTokenTypes() {
|
|
366
|
-
return this.getTokenTypes();
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* @deprecated Use getActiveCreditToken() instead
|
|
370
|
-
* Framework compatibility method
|
|
371
|
-
*/
|
|
372
|
-
async getRemoteActiveCreditToken() {
|
|
373
|
-
return this.getActiveCreditToken();
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* @deprecated Use getRewardTokens() instead
|
|
377
|
-
* Framework compatibility method
|
|
378
|
-
*/
|
|
379
|
-
async getRemoteRewardTokens() {
|
|
380
|
-
return this.getRewardTokens();
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* @deprecated Use getStatusTokens() instead
|
|
384
|
-
* Framework compatibility method
|
|
385
|
-
*/
|
|
386
|
-
async getRemoteStatusTokens() {
|
|
387
|
-
return this.getStatusTokens();
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* @deprecated Use getTokenByContract() instead
|
|
391
|
-
* Framework compatibility method
|
|
392
|
-
*/
|
|
393
|
-
async getTokenByContractAddress(contractAddress, contractTokenId) {
|
|
394
|
-
return this.getTokenByContract(contractAddress, contractTokenId);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Abstract Base Token Service - Explicit Initialization Pattern
|
|
400
|
-
*
|
|
401
|
-
* Platform-agnostic token operations with Promise-based API.
|
|
402
|
-
* Framework services extend this and control initialization lifecycle.
|
|
403
|
-
*
|
|
404
|
-
* Benefits:
|
|
405
|
-
* - Explicit initialization control
|
|
406
|
-
* - Better error boundaries
|
|
407
|
-
* - Clear lifecycle management
|
|
408
|
-
* - Testable initialization state
|
|
409
|
-
* - Zero framework dependencies
|
|
410
|
-
*/
|
|
411
|
-
class BaseTokenService {
|
|
412
|
-
constructor() {
|
|
413
|
-
this._isInitialized = false;
|
|
414
|
-
}
|
|
415
|
-
// ==========================================
|
|
416
|
-
// INITIALIZATION LIFECYCLE
|
|
417
|
-
// ==========================================
|
|
418
|
-
/**
|
|
419
|
-
* LIFECYCLE: Initialize token service with API client
|
|
420
|
-
* Must be called before using any token operations
|
|
421
|
-
*/
|
|
422
|
-
initializeTokenService(apiClient) {
|
|
423
|
-
if (!apiClient) {
|
|
424
|
-
throw new Error('Cannot initialize TokenService: apiClient is null or undefined');
|
|
425
|
-
}
|
|
426
|
-
if (!this._isInitialized) {
|
|
427
|
-
this._tokenApi = new TokenApi(apiClient);
|
|
428
|
-
this._tokenBusinessService = new TokenService(this._tokenApi);
|
|
429
|
-
this._isInitialized = true;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* LIFECYCLE: Check if token service is initialized
|
|
434
|
-
*/
|
|
435
|
-
get isTokenServiceInitialized() {
|
|
436
|
-
return this._isInitialized;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* INTERNAL: Get token business service (throws if not initialized)
|
|
440
|
-
*/
|
|
441
|
-
get tokenBusinessService() {
|
|
442
|
-
if (!this._tokenBusinessService) {
|
|
443
|
-
throw new Error('TokenService not initialized. Call initializeTokenService(apiClient) first.');
|
|
444
|
-
}
|
|
445
|
-
return this._tokenBusinessService;
|
|
446
|
-
}
|
|
447
|
-
// ==========================================
|
|
448
|
-
// PUBLIC OPERATIONS
|
|
449
|
-
// ==========================================
|
|
450
|
-
/**
|
|
451
|
-
* PUBLIC: Get all remote tokens
|
|
452
|
-
*/
|
|
453
|
-
getRemoteTokens() {
|
|
454
|
-
return this.tokenBusinessService.getRemoteTokens();
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* PUBLIC: Get all remote token types
|
|
458
|
-
*/
|
|
459
|
-
getRemoteTokenTypes() {
|
|
460
|
-
return this.tokenBusinessService.getRemoteTokenTypes();
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* PUBLIC: Get active credit token
|
|
464
|
-
*/
|
|
465
|
-
getRemoteActiveCreditToken() {
|
|
466
|
-
return this.tokenBusinessService.getRemoteActiveCreditToken();
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* PUBLIC: Get reward tokens
|
|
470
|
-
*/
|
|
471
|
-
getRemoteRewardTokens() {
|
|
472
|
-
return this.tokenBusinessService.getRemoteRewardTokens();
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* PUBLIC: Get status tokens
|
|
476
|
-
*/
|
|
477
|
-
getRemoteStatusTokens() {
|
|
478
|
-
return this.tokenBusinessService.getRemoteStatusTokens();
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* PUBLIC: Get token by contract address
|
|
482
|
-
*/
|
|
483
|
-
getTokenByContractAddress(contractAddress, contractTokenId) {
|
|
484
|
-
return this.tokenBusinessService.getTokenByContractAddress(contractAddress, contractTokenId);
|
|
485
|
-
}
|
|
486
|
-
// ==========================================
|
|
487
|
-
// ADMIN OPERATIONS
|
|
488
|
-
// ==========================================
|
|
489
|
-
/**
|
|
490
|
-
* ADMIN: Create token metadata
|
|
491
|
-
*/
|
|
492
|
-
createTokenMetadata(tokenId, tokenData) {
|
|
493
|
-
return this.tokenBusinessService.createTokenMetadata(tokenId, tokenData);
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* ADMIN: Toggle token active status
|
|
497
|
-
*/
|
|
498
|
-
toggleTokenActive(tokenId) {
|
|
499
|
-
return this.tokenBusinessService.toggleTokenActive(tokenId);
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* ADMIN: Create new token
|
|
503
|
-
*/
|
|
504
|
-
createToken(tokenData) {
|
|
505
|
-
return this.tokenBusinessService.createToken(tokenData);
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* ADMIN: Update token
|
|
509
|
-
*/
|
|
510
|
-
updateToken(tokenId, tokenData) {
|
|
511
|
-
return this.tokenBusinessService.updateToken(tokenId, tokenData);
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* ADMIN: Set mainnet contract address
|
|
515
|
-
*/
|
|
516
|
-
setMainnetContract(tokenId, contractAddress, chainId) {
|
|
517
|
-
return this.tokenBusinessService.setMainnetContract(tokenId, contractAddress, chainId);
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* ADMIN: Toggle token metadata status
|
|
521
|
-
*/
|
|
522
|
-
toggleTokenMetadataStatus(metadataId) {
|
|
523
|
-
return this.tokenBusinessService.toggleTokenMetadataStatus(metadataId);
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* ADMIN: Create token type
|
|
527
|
-
*/
|
|
528
|
-
createTokenType(tokenType) {
|
|
529
|
-
return this.tokenBusinessService.createTokenType(tokenType);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export { BaseTokenService, TokenApi, TokenSDK, TokenService };
|
|
534
3
|
//# sourceMappingURL=token.js.map
|
package/dist/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sources":[
|
|
1
|
+
{"version":3,"file":"token.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/web3/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,OAAO,EACL,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAGvB,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa;+BAgBK,mBAAmB;gCAGlB,mBAAmB;kCAGjB,mBAAmB;0BAG3B,MAAM,WAAW,MAAM;wCAGT,MAAM,WAAW,MAAM;;EAK9D;AAGD,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,MAAM,wCAAwC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainData } from "@explorins/web3-ts";
|
|
2
|
-
import { JsonRpcProvider } from
|
|
2
|
+
import { JsonRpcProvider } from 'ethers/providers';
|
|
3
3
|
export declare const getWeb3ProviderFromChainData: (chainData: ChainData, timeout?: number, customUserAgentName?: string, tokenRefresher?: () => Promise<string>) => {
|
|
4
4
|
web3Provider: null;
|
|
5
5
|
ethersProvider: JsonRpcProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWeb3FCD.service.d.ts","sourceRoot":"","sources":["../../../src/web3-chain/services/getWeb3FCD.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"getWeb3FCD.service.d.ts","sourceRoot":"","sources":["../../../src/web3-chain/services/getWeb3FCD.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,eAAO,MAAM,4BAA4B,GACvC,WAAW,SAAS,EACpB,gBAAe,EACf,4BAAwB,EACxB,iBAAiB,MAAM,OAAO,CAAC,MAAM,CAAC;;;;CA4CvC,CAAC;AAGF,eAAO,MAAM,wBAAwB,GACnC,WAAW,SAAS,EACpB,gBAAe,EACf,4BAAwB,EACxB,iBAAiB,MAAM,OAAO,CAAC,MAAM,CAAC,EACtC;;;;CAAiE;;;;EAuClE,CAAC"}
|