@flashbacktech/flashbackclient 0.1.59 → 0.1.61

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<number>;
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<Deal[]>;
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<Deal[]>;
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
@@ -18,25 +18,24 @@ class DealOps {
18
18
  * @returns Promise resolving to the created deal ID
19
19
  */
20
20
  this.createDeal = (0, decorator_1.withSignature)(async (consumer_id, provider_id, bucket_id, params) => {
21
- const response = await (0, transaction_1.prepareTransaction)(this.context, consumer_id, {
22
- method: 'create_deal',
23
- args: [
24
- { value: provider_id, type: 'address' },
25
- { value: bucket_id, type: 'u32' },
26
- { value: params.duration_secs, type: 'u64' },
27
- { value: params.agreed_storage_gb, type: 'u32' },
28
- { value: params.agreed_egress_gb, type: 'u32' },
29
- { value: params.api_compatibility, type: 'string' }
30
- ]
31
- });
21
+ const response = await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "create_deal", [
22
+ { value: provider_id, type: 'address' },
23
+ { value: bucket_id, type: 'u32' },
24
+ { value: params.duration_secs, type: 'u64' },
25
+ { value: params.agreed_storage_gb, type: 'u32' },
26
+ { value: params.agreed_egress_gb, type: 'u32' },
27
+ { value: params.api_compatibility, type: 'string' }
28
+ ]);
32
29
  if (!response.isSuccess) {
30
+ console.error('Contract call failed - isSuccess is false');
33
31
  throw new Error('Failed to create deal');
34
32
  }
35
33
  const result = response.result;
36
34
  if (typeof result === 'number') {
37
35
  return result;
38
36
  }
39
- throw new Error('Failed to create deal');
37
+ console.error('Result is not a number, throwing error. Result:', result);
38
+ return result;
40
39
  });
41
40
  /**
42
41
  * Sets a deal as accepted by the provider
@@ -96,6 +96,13 @@ 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
+ provider_name: string;
102
+ provider_reputation: string;
103
+ consumer_name: string;
104
+ consumer_reputation: string;
105
+ }
99
106
  export declare enum DealStatus {
100
107
  Pending = "Pending",
101
108
  Accepted = "Accepted",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"