@fenelabs/fene-sdk 0.4.0 → 0.5.0

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/index.d.mts CHANGED
@@ -19,7 +19,7 @@ interface AuthVerifyRequest {
19
19
  }
20
20
  interface AuthResponse {
21
21
  token: string;
22
- role: 'validator' | 'delegator';
22
+ role: "validator" | "delegator";
23
23
  expires_at: number;
24
24
  }
25
25
  declare enum ValidatorStatus {
@@ -102,7 +102,7 @@ interface GeoNode {
102
102
  country: string;
103
103
  country_code: string;
104
104
  last_seen: string;
105
- node_type: 'validator' | 'rpc' | 'bootstrap';
105
+ node_type: "validator" | "rpc" | "bootstrap";
106
106
  online: boolean;
107
107
  }
108
108
  interface GeoStats {
@@ -124,6 +124,8 @@ interface NetworkStats {
124
124
  current_block: number;
125
125
  epoch: number;
126
126
  block_time: number;
127
+ min_stake_delegator: string;
128
+ min_stake_validator: string;
127
129
  }
128
130
  interface EpochInfo {
129
131
  number: number;
@@ -162,6 +164,42 @@ interface RewardHistory {
162
164
  amount: string;
163
165
  timestamp: string;
164
166
  }
167
+ interface Transaction {
168
+ id: number;
169
+ tx_hash: string;
170
+ block_number: number;
171
+ from_address: string;
172
+ to_address: string;
173
+ method_name: string;
174
+ method_selector: string;
175
+ value: string;
176
+ gas_used: number;
177
+ timestamp: number;
178
+ status: string;
179
+ }
180
+ interface TransactionsList {
181
+ transactions: Transaction[];
182
+ total: number;
183
+ page: number;
184
+ limit: number;
185
+ }
186
+ interface TransactionStats {
187
+ total_24h: number;
188
+ gas_used_24h: number;
189
+ }
190
+ interface TransactionsParams {
191
+ page?: number;
192
+ limit?: number;
193
+ method?: string;
194
+ address?: string;
195
+ sort?: "asc" | "desc";
196
+ }
197
+ interface PriceResponse {
198
+ price: number;
199
+ currency: string;
200
+ provider: string;
201
+ updated_at: number;
202
+ }
165
203
 
166
204
  interface RequestContext {
167
205
  method: string;
@@ -251,6 +289,9 @@ declare class ResonanceClient {
251
289
  getAvatar(address: Address): Promise<AvatarResponse>;
252
290
  getDailyBlockStats(days?: number): Promise<DailyBlockStats[]>;
253
291
  getValidatorRewardHistory(address: Address, limit?: number): Promise<RewardHistory[]>;
292
+ getTransactions(params?: TransactionsParams): Promise<TransactionsList>;
293
+ getTransactionStats(): Promise<TransactionStats>;
294
+ getCoinPrice(): Promise<PriceResponse>;
254
295
  }
255
296
  declare function createResonanceClient(config: ResonanceClientConfig): ResonanceClient;
256
297
 
@@ -334,4 +375,4 @@ declare class EventBus {
334
375
  }
335
376
  declare const eventBus: EventBus;
336
377
 
337
- export { type APIErrorResponse, type Address, type AuthResponse, type AuthVerifyRequest, type AvatarResponse, type DailyBlockStats, type Delegator, type DelegatorRewards, type DelegatorStake, DelegatorStatus, type EpochInfo, ErrorCode, type ErrorCodeType, type GeoNode, type GeoStats, type GeoUpdateRequest, type NetworkAPR, type NetworkStats, type NonceResponse, type PaginatedResponse, type ReferralKey, type RequestContext, ResonanceClient, type ResonanceClientConfig, ResonanceError, type ResponseContext, type RewardHistory, type UploadResponse, type Validator, type ValidatorAPR, ValidatorStatus, type ValidatorSummary, type WhitelistCheckRequest, type WhitelistCheckResponse, createResonanceClient, eventBus, hasErrorCode, isAuthError, isNetworkError, isNotFoundError, isResonanceError };
378
+ export { type APIErrorResponse, type Address, type AuthResponse, type AuthVerifyRequest, type AvatarResponse, type DailyBlockStats, type Delegator, type DelegatorRewards, type DelegatorStake, DelegatorStatus, type EpochInfo, ErrorCode, type ErrorCodeType, type GeoNode, type GeoStats, type GeoUpdateRequest, type NetworkAPR, type NetworkStats, type NonceResponse, type PaginatedResponse, type PriceResponse, type ReferralKey, type RequestContext, ResonanceClient, type ResonanceClientConfig, ResonanceError, type ResponseContext, type RewardHistory, type Transaction, type TransactionStats, type TransactionsList, type TransactionsParams, type UploadResponse, type Validator, type ValidatorAPR, ValidatorStatus, type ValidatorSummary, type WhitelistCheckRequest, type WhitelistCheckResponse, createResonanceClient, eventBus, hasErrorCode, isAuthError, isNetworkError, isNotFoundError, isResonanceError };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ interface AuthVerifyRequest {
19
19
  }
20
20
  interface AuthResponse {
21
21
  token: string;
22
- role: 'validator' | 'delegator';
22
+ role: "validator" | "delegator";
23
23
  expires_at: number;
24
24
  }
25
25
  declare enum ValidatorStatus {
@@ -102,7 +102,7 @@ interface GeoNode {
102
102
  country: string;
103
103
  country_code: string;
104
104
  last_seen: string;
105
- node_type: 'validator' | 'rpc' | 'bootstrap';
105
+ node_type: "validator" | "rpc" | "bootstrap";
106
106
  online: boolean;
107
107
  }
108
108
  interface GeoStats {
@@ -124,6 +124,8 @@ interface NetworkStats {
124
124
  current_block: number;
125
125
  epoch: number;
126
126
  block_time: number;
127
+ min_stake_delegator: string;
128
+ min_stake_validator: string;
127
129
  }
128
130
  interface EpochInfo {
129
131
  number: number;
@@ -162,6 +164,42 @@ interface RewardHistory {
162
164
  amount: string;
163
165
  timestamp: string;
164
166
  }
167
+ interface Transaction {
168
+ id: number;
169
+ tx_hash: string;
170
+ block_number: number;
171
+ from_address: string;
172
+ to_address: string;
173
+ method_name: string;
174
+ method_selector: string;
175
+ value: string;
176
+ gas_used: number;
177
+ timestamp: number;
178
+ status: string;
179
+ }
180
+ interface TransactionsList {
181
+ transactions: Transaction[];
182
+ total: number;
183
+ page: number;
184
+ limit: number;
185
+ }
186
+ interface TransactionStats {
187
+ total_24h: number;
188
+ gas_used_24h: number;
189
+ }
190
+ interface TransactionsParams {
191
+ page?: number;
192
+ limit?: number;
193
+ method?: string;
194
+ address?: string;
195
+ sort?: "asc" | "desc";
196
+ }
197
+ interface PriceResponse {
198
+ price: number;
199
+ currency: string;
200
+ provider: string;
201
+ updated_at: number;
202
+ }
165
203
 
166
204
  interface RequestContext {
167
205
  method: string;
@@ -251,6 +289,9 @@ declare class ResonanceClient {
251
289
  getAvatar(address: Address): Promise<AvatarResponse>;
252
290
  getDailyBlockStats(days?: number): Promise<DailyBlockStats[]>;
253
291
  getValidatorRewardHistory(address: Address, limit?: number): Promise<RewardHistory[]>;
292
+ getTransactions(params?: TransactionsParams): Promise<TransactionsList>;
293
+ getTransactionStats(): Promise<TransactionStats>;
294
+ getCoinPrice(): Promise<PriceResponse>;
254
295
  }
255
296
  declare function createResonanceClient(config: ResonanceClientConfig): ResonanceClient;
256
297
 
@@ -334,4 +375,4 @@ declare class EventBus {
334
375
  }
335
376
  declare const eventBus: EventBus;
336
377
 
337
- export { type APIErrorResponse, type Address, type AuthResponse, type AuthVerifyRequest, type AvatarResponse, type DailyBlockStats, type Delegator, type DelegatorRewards, type DelegatorStake, DelegatorStatus, type EpochInfo, ErrorCode, type ErrorCodeType, type GeoNode, type GeoStats, type GeoUpdateRequest, type NetworkAPR, type NetworkStats, type NonceResponse, type PaginatedResponse, type ReferralKey, type RequestContext, ResonanceClient, type ResonanceClientConfig, ResonanceError, type ResponseContext, type RewardHistory, type UploadResponse, type Validator, type ValidatorAPR, ValidatorStatus, type ValidatorSummary, type WhitelistCheckRequest, type WhitelistCheckResponse, createResonanceClient, eventBus, hasErrorCode, isAuthError, isNetworkError, isNotFoundError, isResonanceError };
378
+ export { type APIErrorResponse, type Address, type AuthResponse, type AuthVerifyRequest, type AvatarResponse, type DailyBlockStats, type Delegator, type DelegatorRewards, type DelegatorStake, DelegatorStatus, type EpochInfo, ErrorCode, type ErrorCodeType, type GeoNode, type GeoStats, type GeoUpdateRequest, type NetworkAPR, type NetworkStats, type NonceResponse, type PaginatedResponse, type PriceResponse, type ReferralKey, type RequestContext, ResonanceClient, type ResonanceClientConfig, ResonanceError, type ResponseContext, type RewardHistory, type Transaction, type TransactionStats, type TransactionsList, type TransactionsParams, type UploadResponse, type Validator, type ValidatorAPR, ValidatorStatus, type ValidatorSummary, type WhitelistCheckRequest, type WhitelistCheckResponse, createResonanceClient, eventBus, hasErrorCode, isAuthError, isNetworkError, isNotFoundError, isResonanceError };
package/dist/index.js CHANGED
@@ -263,7 +263,10 @@ var ResonanceClient = class {
263
263
  if (refreshed) {
264
264
  return this.executeRequest(path, options, attemptNumber);
265
265
  }
266
- eventBus.emit("api:unauthorized", { url, method: options.method || "GET" });
266
+ eventBus.emit("api:unauthorized", {
267
+ url,
268
+ method: options.method || "GET"
269
+ });
267
270
  this.onTokenExpired?.();
268
271
  }
269
272
  if (!response.ok) {
@@ -507,6 +510,28 @@ var ResonanceClient = class {
507
510
  async getValidatorRewardHistory(address, limit = 100) {
508
511
  return this.request(`/eth/v1/analytics/rewards/${address}?limit=${limit}`);
509
512
  }
513
+ // ============================================
514
+ // Transactions (NEW)
515
+ // ============================================
516
+ async getTransactions(params = {}) {
517
+ const queryParams = new URLSearchParams();
518
+ if (params.page) queryParams.set("page", params.page.toString());
519
+ if (params.limit) queryParams.set("limit", params.limit.toString());
520
+ if (params.method) queryParams.set("method", params.method);
521
+ if (params.address) queryParams.set("address", params.address);
522
+ if (params.sort) queryParams.set("sort", params.sort);
523
+ const query = queryParams.toString();
524
+ return this.request(`/eth/v1/transactions${query ? `?${query}` : ""}`);
525
+ }
526
+ async getTransactionStats() {
527
+ return this.request("/eth/v1/transactions/stats");
528
+ }
529
+ // ============================================
530
+ // Price (NEW)
531
+ // ============================================
532
+ async getCoinPrice() {
533
+ return this.request("/eth/v1/price");
534
+ }
510
535
  };
511
536
  function createResonanceClient(config) {
512
537
  return new ResonanceClient(config);
package/dist/index.mjs CHANGED
@@ -227,7 +227,10 @@ var ResonanceClient = class {
227
227
  if (refreshed) {
228
228
  return this.executeRequest(path, options, attemptNumber);
229
229
  }
230
- eventBus.emit("api:unauthorized", { url, method: options.method || "GET" });
230
+ eventBus.emit("api:unauthorized", {
231
+ url,
232
+ method: options.method || "GET"
233
+ });
231
234
  this.onTokenExpired?.();
232
235
  }
233
236
  if (!response.ok) {
@@ -471,6 +474,28 @@ var ResonanceClient = class {
471
474
  async getValidatorRewardHistory(address, limit = 100) {
472
475
  return this.request(`/eth/v1/analytics/rewards/${address}?limit=${limit}`);
473
476
  }
477
+ // ============================================
478
+ // Transactions (NEW)
479
+ // ============================================
480
+ async getTransactions(params = {}) {
481
+ const queryParams = new URLSearchParams();
482
+ if (params.page) queryParams.set("page", params.page.toString());
483
+ if (params.limit) queryParams.set("limit", params.limit.toString());
484
+ if (params.method) queryParams.set("method", params.method);
485
+ if (params.address) queryParams.set("address", params.address);
486
+ if (params.sort) queryParams.set("sort", params.sort);
487
+ const query = queryParams.toString();
488
+ return this.request(`/eth/v1/transactions${query ? `?${query}` : ""}`);
489
+ }
490
+ async getTransactionStats() {
491
+ return this.request("/eth/v1/transactions/stats");
492
+ }
493
+ // ============================================
494
+ // Price (NEW)
495
+ // ============================================
496
+ async getCoinPrice() {
497
+ return this.request("/eth/v1/price");
498
+ }
474
499
  };
475
500
  function createResonanceClient(config) {
476
501
  return new ResonanceClient(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenelabs/fene-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript SDK for Fene API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",