@flashbacktech/flashbackclient 0.1.60 → 0.1.62
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.
|
@@ -27,21 +27,12 @@ class BucketOps {
|
|
|
27
27
|
{ value: params.sla_avg_latency_ms, type: 'u32' },
|
|
28
28
|
{ value: params.sla_avg_uptime_pct, type: 'u32' }
|
|
29
29
|
]);
|
|
30
|
-
console.log('Contract response:', JSON.stringify(response, null, 2));
|
|
31
|
-
console.log('Response isSuccess:', response.isSuccess);
|
|
32
|
-
console.log('Response result:', response.result);
|
|
33
|
-
console.log('Response result type:', typeof response.result);
|
|
34
|
-
console.log('Response result constructor:', response.result?.constructor?.name);
|
|
35
30
|
if (!response.isSuccess) {
|
|
36
31
|
console.error('Contract call failed - isSuccess is false');
|
|
37
32
|
throw new Error('Failed to create bucket');
|
|
38
33
|
}
|
|
39
34
|
const result = response.result;
|
|
40
|
-
console.log('Processing result:', result);
|
|
41
|
-
console.log('Result type:', typeof result);
|
|
42
|
-
console.log('Result constructor:', result?.constructor?.name);
|
|
43
35
|
if (typeof result === 'number') {
|
|
44
|
-
console.log('Result is a number, returning:', result);
|
|
45
36
|
return result;
|
|
46
37
|
}
|
|
47
38
|
console.error('Result is not a number, throwing error. Result:', result);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientContext } from '.';
|
|
2
|
-
import { Deal, DealCreateParams, DealConsumptionUpdateParams, DealSLAUpdateParams } from '../models';
|
|
2
|
+
import { Deal, DealCreateParams, DealConsumptionUpdateParams, DealSLAUpdateParams, DealInfo } from '../models';
|
|
3
3
|
/**
|
|
4
4
|
* Deal operations client for FlashOnStellar V2
|
|
5
5
|
* Implements all deal-related contract methods
|
|
@@ -15,7 +15,7 @@ export declare class DealOps {
|
|
|
15
15
|
* @param params - Deal creation parameters
|
|
16
16
|
* @returns Promise resolving to the created deal ID
|
|
17
17
|
*/
|
|
18
|
-
createDeal: (consumer_id: string, provider_id: string, bucket_id: number, params: DealCreateParams) => Promise<
|
|
18
|
+
createDeal: (consumer_id: string, provider_id: string, bucket_id: number, params: DealCreateParams) => Promise<any>;
|
|
19
19
|
/**
|
|
20
20
|
* Sets a deal as accepted by the provider
|
|
21
21
|
* @param consumer_id - Address of the consumer
|
|
@@ -98,13 +98,13 @@ export declare class DealOps {
|
|
|
98
98
|
* @param consumer_id - Address of the consumer
|
|
99
99
|
* @returns Promise resolving to an array of Deal objects
|
|
100
100
|
*/
|
|
101
|
-
getDealsByConsumer(consumer_id: string): Promise<
|
|
101
|
+
getDealsByConsumer(consumer_id: string): Promise<DealInfo[]>;
|
|
102
102
|
/**
|
|
103
103
|
* Retrieves all deals for a specific provider
|
|
104
104
|
* @param provider_id - Address of the provider
|
|
105
105
|
* @returns Promise resolving to an array of Deal objects
|
|
106
106
|
*/
|
|
107
|
-
getDealsByProvider(provider_id: string): Promise<
|
|
107
|
+
getDealsByProvider(provider_id: string): Promise<DealInfo[]>;
|
|
108
108
|
/**
|
|
109
109
|
* Retrieves all active deals
|
|
110
110
|
* @param skip - Number of items to skip for pagination
|
|
@@ -27,13 +27,15 @@ class DealOps {
|
|
|
27
27
|
{ value: params.api_compatibility, type: 'string' }
|
|
28
28
|
]);
|
|
29
29
|
if (!response.isSuccess) {
|
|
30
|
+
console.error('Contract call failed - isSuccess is false');
|
|
30
31
|
throw new Error('Failed to create deal');
|
|
31
32
|
}
|
|
32
33
|
const result = response.result;
|
|
33
34
|
if (typeof result === 'number') {
|
|
34
35
|
return result;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
console.error('Result is not a number, throwing error. Result:', result);
|
|
38
|
+
return result;
|
|
37
39
|
});
|
|
38
40
|
/**
|
|
39
41
|
* Sets a deal as accepted by the provider
|
|
@@ -96,6 +96,14 @@ export interface Deal {
|
|
|
96
96
|
slash_egress_gb: number;
|
|
97
97
|
slash_amount_usd: bigint;
|
|
98
98
|
}
|
|
99
|
+
export interface DealInfo {
|
|
100
|
+
deal: Deal;
|
|
101
|
+
bucket: Bucket;
|
|
102
|
+
provider_name: string;
|
|
103
|
+
provider_reputation: string;
|
|
104
|
+
consumer_name: string;
|
|
105
|
+
consumer_reputation: string;
|
|
106
|
+
}
|
|
99
107
|
export declare enum DealStatus {
|
|
100
108
|
Pending = "Pending",
|
|
101
109
|
Accepted = "Accepted",
|