@flashbacktech/flashbackclient 0.1.30 → 0.1.31

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.
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DealOps = void 0;
4
+ const transaction_1 = require("./transaction");
5
+ /**
6
+ * Deal operations client for FlashOnStellar V2
7
+ * Implements all deal-related contract methods
8
+ */
9
+ class DealOps {
10
+ constructor(context) {
11
+ this.context = context;
12
+ }
13
+ /**
14
+ * Creates a new deal between a consumer and provider
15
+ * @param consumer_id - Address of the consumer creating the deal
16
+ * @param provider_id - Address of the provider
17
+ * @param bucket_id - ID of the bucket for the deal
18
+ * @param params - Deal creation parameters
19
+ * @returns Promise resolving to the created deal ID
20
+ */
21
+ async createDeal(consumer_id, provider_id, bucket_id, params) {
22
+ const result = await (0, transaction_1.callContractMethod)(this.context, consumer_id, {
23
+ method: 'create_deal',
24
+ args: [
25
+ { value: consumer_id, type: 'address' },
26
+ { value: provider_id, type: 'address' },
27
+ { value: bucket_id, type: 'u32' },
28
+ { value: params.duration_secs, type: 'u64' },
29
+ { value: params.agreed_storage_gb, type: 'u32' },
30
+ { value: params.agreed_egress_gb, type: 'u32' },
31
+ { value: params.fb_repo_id, type: 'string' },
32
+ { value: params.api_compatibility, type: 'string' }
33
+ ]
34
+ });
35
+ if (typeof result === 'number') {
36
+ return result;
37
+ }
38
+ throw new Error('Failed to create deal');
39
+ }
40
+ /**
41
+ * Sets a deal as accepted by the provider
42
+ * @param consumer_id - Address of the consumer
43
+ * @param provider_id - Address of the provider accepting the deal
44
+ * @param deal_id - ID of the deal to accept
45
+ * @returns Promise resolving to the acceptance result
46
+ */
47
+ async setDealAccepted(consumer_id, provider_id, deal_id) {
48
+ return (0, transaction_1.callContractMethod)(this.context, provider_id, {
49
+ method: 'set_deal_accepted',
50
+ args: [
51
+ { value: consumer_id, type: 'address' },
52
+ { value: provider_id, type: 'address' },
53
+ { value: deal_id, type: 'u32' }
54
+ ]
55
+ });
56
+ }
57
+ /**
58
+ * Sets a deal as funded by the consumer
59
+ * @param consumer_id - Address of the consumer funding the deal
60
+ * @param provider_id - Address of the provider
61
+ * @param deal_id - ID of the deal to fund
62
+ * @param amount_usd - Amount to fund in USD (scaled by 10^7)
63
+ * @returns Promise resolving to the funding result
64
+ */
65
+ async setDealFunded(consumer_id, provider_id, deal_id, amount_usd) {
66
+ return (0, transaction_1.callContractMethod)(this.context, consumer_id, {
67
+ method: 'set_deal_funded',
68
+ args: [
69
+ { value: provider_id, type: 'address' },
70
+ { value: consumer_id, type: 'address' },
71
+ { value: deal_id, type: 'u32' },
72
+ { value: amount_usd, type: 'u128' }
73
+ ]
74
+ });
75
+ }
76
+ /**
77
+ * Sets a deal as completed
78
+ * @param consumer_id - Address of the consumer
79
+ * @param provider_id - Address of the provider
80
+ * @param deal_id - ID of the deal to complete
81
+ * @returns Promise resolving to the completion result
82
+ */
83
+ async setDealCompleted(consumer_id, provider_id, deal_id) {
84
+ return (0, transaction_1.callContractMethod)(this.context, consumer_id, {
85
+ method: 'set_deal_completed',
86
+ args: [
87
+ { value: provider_id, type: 'address' },
88
+ { value: consumer_id, type: 'address' },
89
+ { value: deal_id, type: 'u32' }
90
+ ]
91
+ });
92
+ }
93
+ /**
94
+ * Sets a deal as cancelled
95
+ * @param consumer_id - Address of the consumer
96
+ * @param provider_id - Address of the provider
97
+ * @param deal_id - ID of the deal to cancel
98
+ * @returns Promise resolving to the cancellation result
99
+ */
100
+ async setDealCancelled(consumer_id, provider_id, deal_id) {
101
+ return (0, transaction_1.callContractMethod)(this.context, provider_id, {
102
+ method: 'set_deal_cancelled',
103
+ args: [
104
+ { value: consumer_id, type: 'address' },
105
+ { value: provider_id, type: 'address' },
106
+ { value: deal_id, type: 'u32' }
107
+ ]
108
+ });
109
+ }
110
+ /**
111
+ * Marks a deal as breached by the consumer
112
+ * @param consumer_id - Address of the consumer
113
+ * @param provider_id - Address of the provider
114
+ * @param deal_id - ID of the deal
115
+ * @returns Promise resolving to the breach marking result
116
+ */
117
+ async setDealBreachedConsumer(consumer_id, provider_id, deal_id) {
118
+ return (0, transaction_1.callContractMethod)(this.context, provider_id, {
119
+ method: 'set_deal_breached_consumer',
120
+ args: [
121
+ { value: consumer_id, type: 'address' },
122
+ { value: provider_id, type: 'address' },
123
+ { value: deal_id, type: 'u32' }
124
+ ]
125
+ });
126
+ }
127
+ /**
128
+ * Marks a deal as breached by the provider
129
+ * @param consumer_id - Address of the consumer
130
+ * @param provider_id - Address of the provider
131
+ * @param deal_id - ID of the deal
132
+ * @returns Promise resolving to the breach marking result
133
+ */
134
+ async setDealBreachedProvider(consumer_id, provider_id, deal_id) {
135
+ return (0, transaction_1.callContractMethod)(this.context, consumer_id, {
136
+ method: 'set_deal_breached_provider',
137
+ args: [
138
+ { value: provider_id, type: 'address' },
139
+ { value: consumer_id, type: 'address' },
140
+ { value: deal_id, type: 'u32' }
141
+ ]
142
+ });
143
+ }
144
+ /**
145
+ * Deletes a deal from the system (owner only)
146
+ * @param consumer_id - Address of the consumer
147
+ * @param provider_id - Address of the provider
148
+ * @param deal_id - ID of the deal to delete
149
+ * @returns Promise resolving to the deletion result
150
+ */
151
+ async deleteDeal(consumer_id, provider_id, deal_id) {
152
+ return (0, transaction_1.callContractMethod)(this.context, '', {
153
+ method: 'delete_deal',
154
+ args: [
155
+ { value: consumer_id, type: 'address' },
156
+ { value: provider_id, type: 'address' },
157
+ { value: deal_id, type: 'u32' }
158
+ ]
159
+ });
160
+ }
161
+ /**
162
+ * Retrieves deal information
163
+ * @param consumer_id - Address of the consumer
164
+ * @param provider_id - Address of the provider
165
+ * @param deal_id - ID of the deal to retrieve
166
+ * @returns Promise resolving to Deal object or null if not found
167
+ */
168
+ async getDeal(consumer_id, provider_id, deal_id) {
169
+ const result = await (0, transaction_1.callContractMethod)(this.context, consumer_id, {
170
+ method: 'get_deal',
171
+ args: [
172
+ { value: consumer_id, type: 'address' },
173
+ { value: provider_id, type: 'address' },
174
+ { value: deal_id, type: 'u32' }
175
+ ]
176
+ });
177
+ if (result && typeof result === 'object') {
178
+ return result;
179
+ }
180
+ return null;
181
+ }
182
+ /**
183
+ * Gets the total count of deals in the system
184
+ * @returns Promise resolving to the total number of deals
185
+ */
186
+ async getDealCount() {
187
+ const result = await (0, transaction_1.callContractMethod)(this.context, '', {
188
+ method: 'get_deal_count',
189
+ args: []
190
+ });
191
+ if (typeof result === 'number') {
192
+ return result;
193
+ }
194
+ return 0;
195
+ }
196
+ /**
197
+ * Retrieves a paginated list of all deals
198
+ * @param skip - Number of items to skip for pagination
199
+ * @param take - Number of items to take per page
200
+ * @returns Promise resolving to an array of Deal objects
201
+ */
202
+ async getDeals(skip = 0, take = 10) {
203
+ const result = await (0, transaction_1.callContractMethod)(this.context, '', {
204
+ method: 'get_deals',
205
+ args: [
206
+ { value: skip, type: 'u32' },
207
+ { value: take, type: 'u32' }
208
+ ]
209
+ });
210
+ if (Array.isArray(result)) {
211
+ return result;
212
+ }
213
+ return [];
214
+ }
215
+ /**
216
+ * Retrieves all deals for a specific consumer
217
+ * @param consumer_id - Address of the consumer
218
+ * @returns Promise resolving to an array of Deal objects
219
+ */
220
+ async getDealsByConsumer(consumer_id) {
221
+ const result = await (0, transaction_1.callContractMethod)(this.context, consumer_id, {
222
+ method: 'get_deals_by_consumer',
223
+ args: [
224
+ { value: consumer_id, type: 'address' }
225
+ ]
226
+ });
227
+ if (Array.isArray(result)) {
228
+ return result;
229
+ }
230
+ return [];
231
+ }
232
+ /**
233
+ * Retrieves all deals for a specific provider
234
+ * @param provider_id - Address of the provider
235
+ * @returns Promise resolving to an array of Deal objects
236
+ */
237
+ async getDealsByProvider(provider_id) {
238
+ const result = await (0, transaction_1.callContractMethod)(this.context, provider_id, {
239
+ method: 'get_deals_by_provider',
240
+ args: [
241
+ { value: provider_id, type: 'address' }
242
+ ]
243
+ });
244
+ if (Array.isArray(result)) {
245
+ return result;
246
+ }
247
+ return [];
248
+ }
249
+ /**
250
+ * Retrieves all active deals
251
+ * @param skip - Number of items to skip for pagination
252
+ * @param take - Number of items to take per page
253
+ * @returns Promise resolving to an array of active Deal objects
254
+ */
255
+ async getActiveDeals(skip = 0, take = 10) {
256
+ const result = await (0, transaction_1.callContractMethod)(this.context, '', {
257
+ method: 'get_active_deals',
258
+ args: [
259
+ { value: skip, type: 'u32' },
260
+ { value: take, type: 'u32' }
261
+ ]
262
+ });
263
+ if (Array.isArray(result)) {
264
+ return result;
265
+ }
266
+ return [];
267
+ }
268
+ /**
269
+ * Pays for pending consumption in a deal (owner only)
270
+ * @param provider_id - Address of the provider
271
+ * @param consumer_id - Address of the consumer
272
+ * @param deal_id - ID of the deal
273
+ * @returns Promise resolving to the payment result
274
+ */
275
+ async payPendingConsumption(provider_id, consumer_id, deal_id) {
276
+ return (0, transaction_1.callContractMethod)(this.context, '', {
277
+ method: 'pay_pending_consumption',
278
+ args: [
279
+ { value: provider_id, type: 'address' },
280
+ { value: consumer_id, type: 'address' },
281
+ { value: deal_id, type: 'u32' }
282
+ ]
283
+ });
284
+ }
285
+ /**
286
+ * Updates deal consumption metrics (owner only)
287
+ * @param provider_id - Address of the provider
288
+ * @param consumer_id - Address of the consumer
289
+ * @param deal_id - ID of the deal
290
+ * @param params - Consumption update parameters
291
+ * @returns Promise resolving to the update result
292
+ */
293
+ async updateDealConsumption(provider_id, consumer_id, deal_id, params) {
294
+ return (0, transaction_1.callContractMethod)(this.context, '', {
295
+ method: 'update_deal_consumption',
296
+ args: [
297
+ { value: provider_id, type: 'address' },
298
+ { value: consumer_id, type: 'address' },
299
+ { value: deal_id, type: 'u32' },
300
+ { value: params.storage_gb, type: 'u32' },
301
+ { value: params.egress_gb, type: 'u32' }
302
+ ]
303
+ });
304
+ }
305
+ /**
306
+ * Updates deal SLA metrics (owner only)
307
+ * @param provider_id - Address of the provider
308
+ * @param consumer_id - Address of the consumer
309
+ * @param deal_id - ID of the deal
310
+ * @param params - SLA update parameters
311
+ * @returns Promise resolving to the update result
312
+ */
313
+ async updateDealSLA(provider_id, consumer_id, deal_id, params) {
314
+ return (0, transaction_1.callContractMethod)(this.context, '', {
315
+ method: 'update_deal_sla',
316
+ args: [
317
+ { value: provider_id, type: 'address' },
318
+ { value: consumer_id, type: 'address' },
319
+ { value: deal_id, type: 'u32' },
320
+ { value: params.sla_avg_latency_ms, type: 'u32' },
321
+ { value: params.sla_avg_uptime_pct, type: 'u32' }
322
+ ]
323
+ });
324
+ }
325
+ /**
326
+ * Gets deal status information
327
+ * @param consumer_id - Address of the consumer
328
+ * @param provider_id - Address of the provider
329
+ * @param deal_id - ID of the deal
330
+ * @returns Promise resolving to deal status or null if deal not found
331
+ */
332
+ async getDealStatus(consumer_id, provider_id, deal_id) {
333
+ const deal = await this.getDeal(consumer_id, provider_id, deal_id);
334
+ if (!deal) {
335
+ return null;
336
+ }
337
+ return deal.status;
338
+ }
339
+ /**
340
+ * Gets deal balance information
341
+ * @param consumer_id - Address of the consumer
342
+ * @param provider_id - Address of the provider
343
+ * @param deal_id - ID of the deal
344
+ * @returns Promise resolving to deal balances or null if deal not found
345
+ */
346
+ async getDealBalances(consumer_id, provider_id, deal_id) {
347
+ const deal = await this.getDeal(consumer_id, provider_id, deal_id);
348
+ if (!deal) {
349
+ return null;
350
+ }
351
+ return {
352
+ balance_consumer: deal.balance_consumer,
353
+ balance_provider: deal.balance_provider
354
+ };
355
+ }
356
+ }
357
+ exports.DealOps = DealOps;
@@ -0,0 +1,46 @@
1
+ import { ClientContext } from './client';
2
+ /**
3
+ * Funding operations client for FlashOnStellar V2
4
+ * Implements all funding-related contract methods (owner only)
5
+ */
6
+ export declare class FundingOps {
7
+ private context;
8
+ constructor(context: ClientContext);
9
+ /**
10
+ * Sends funds from the contract to a receiver (owner only)
11
+ * @param receiver - Address of the receiver
12
+ * @param amount - Amount to send in the stable asset's smallest unit
13
+ * @returns Promise resolving to the transfer result
14
+ */
15
+ sendFundsOwner(receiver: string, amount: bigint): Promise<boolean>;
16
+ /**
17
+ * Test faucet function for minting tokens to a receiver (owner only)
18
+ * @param receiver - Address of the receiver
19
+ * @param amount - Amount to mint in the stable asset's smallest unit
20
+ * @returns Promise resolving to the minting result
21
+ */
22
+ testFaucetOwner(receiver: string, amount: bigint): Promise<boolean>;
23
+ /**
24
+ * Changes the admin of the stable asset contract (owner only)
25
+ * @param new_admin - Address of the new admin
26
+ * @returns Promise resolving to the admin change result
27
+ */
28
+ changeAssetAdmin(new_admin: string): Promise<boolean>;
29
+ /**
30
+ * Gets the stable asset address from the contract
31
+ * @returns Promise resolving to the stable asset contract address
32
+ */
33
+ getStableAssetAddress(): Promise<string>;
34
+ /**
35
+ * Checks if an address is authorized for the stable asset
36
+ * @param address - Address to check
37
+ * @returns Promise resolving to true if authorized, false otherwise
38
+ */
39
+ isAuthorizedForAsset(address: string): Promise<boolean>;
40
+ /**
41
+ * Gets the balance of an address for the stable asset
42
+ * @param address - Address to check balance for
43
+ * @returns Promise resolving to the balance amount
44
+ */
45
+ getAssetBalance(address: string): Promise<bigint>;
46
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FundingOps = void 0;
4
+ const transaction_1 = require("./transaction");
5
+ /**
6
+ * Funding operations client for FlashOnStellar V2
7
+ * Implements all funding-related contract methods (owner only)
8
+ */
9
+ class FundingOps {
10
+ constructor(context) {
11
+ this.context = context;
12
+ }
13
+ /**
14
+ * Sends funds from the contract to a receiver (owner only)
15
+ * @param receiver - Address of the receiver
16
+ * @param amount - Amount to send in the stable asset's smallest unit
17
+ * @returns Promise resolving to the transfer result
18
+ */
19
+ async sendFundsOwner(receiver, amount) {
20
+ return (0, transaction_1.callContractMethod)(this.context, '', {
21
+ method: 'send_funds_owner',
22
+ args: [
23
+ { value: receiver, type: 'address' },
24
+ { value: amount, type: 'i128' }
25
+ ]
26
+ });
27
+ }
28
+ /**
29
+ * Test faucet function for minting tokens to a receiver (owner only)
30
+ * @param receiver - Address of the receiver
31
+ * @param amount - Amount to mint in the stable asset's smallest unit
32
+ * @returns Promise resolving to the minting result
33
+ */
34
+ async testFaucetOwner(receiver, amount) {
35
+ return (0, transaction_1.callContractMethod)(this.context, '', {
36
+ method: 'test_faucet_owner',
37
+ args: [
38
+ { value: receiver, type: 'address' },
39
+ { value: amount, type: 'i128' }
40
+ ]
41
+ });
42
+ }
43
+ /**
44
+ * Changes the admin of the stable asset contract (owner only)
45
+ * @param new_admin - Address of the new admin
46
+ * @returns Promise resolving to the admin change result
47
+ */
48
+ async changeAssetAdmin(new_admin) {
49
+ return (0, transaction_1.callContractMethod)(this.context, '', {
50
+ method: 'change_asset_admin',
51
+ args: [
52
+ { value: new_admin, type: 'address' }
53
+ ]
54
+ });
55
+ }
56
+ /**
57
+ * Gets the stable asset address from the contract
58
+ * @returns Promise resolving to the stable asset contract address
59
+ */
60
+ async getStableAssetAddress() {
61
+ // This would typically be a getter method, but since it's not in the FundingOps trait,
62
+ // we'll need to implement it separately or access it through the main contract
63
+ throw new Error('getStableAssetAddress not implemented in FundingOps - use main contract methods');
64
+ }
65
+ /**
66
+ * Checks if an address is authorized for the stable asset
67
+ * @param address - Address to check
68
+ * @returns Promise resolving to true if authorized, false otherwise
69
+ */
70
+ async isAuthorizedForAsset(address) {
71
+ // This would typically be a getter method on the stable asset contract
72
+ // Implementation depends on the specific stable asset contract interface
73
+ throw new Error('isAuthorizedForAsset not implemented - requires stable asset contract interaction');
74
+ }
75
+ /**
76
+ * Gets the balance of an address for the stable asset
77
+ * @param address - Address to check balance for
78
+ * @returns Promise resolving to the balance amount
79
+ */
80
+ async getAssetBalance(address) {
81
+ // This would typically be a getter method on the stable asset contract
82
+ // Implementation depends on the specific stable asset contract interface
83
+ throw new Error('getAssetBalance not implemented - requires stable asset contract interaction');
84
+ }
85
+ }
86
+ exports.FundingOps = FundingOps;
@@ -0,0 +1,9 @@
1
+ import { StellarNetwork } from './transaction';
2
+ import { FlashOnStellarClientV2, FlashOnStellarClientConfigV2 } from './client';
3
+ export { ConsumerOps } from './consumer';
4
+ export { ProviderOps } from './provider';
5
+ export { BucketOps } from './bucket';
6
+ export { DealOps } from './deal';
7
+ export { FundingOps } from './funding';
8
+ export * from './models';
9
+ export { StellarNetwork, FlashOnStellarClientV2, FlashOnStellarClientConfigV2 };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.FlashOnStellarClientV2 = exports.FundingOps = exports.DealOps = exports.BucketOps = exports.ProviderOps = exports.ConsumerOps = void 0;
18
+ const client_1 = require("./client");
19
+ Object.defineProperty(exports, "FlashOnStellarClientV2", { enumerable: true, get: function () { return client_1.FlashOnStellarClientV2; } });
20
+ // Export operation classes
21
+ var consumer_1 = require("./consumer");
22
+ Object.defineProperty(exports, "ConsumerOps", { enumerable: true, get: function () { return consumer_1.ConsumerOps; } });
23
+ var provider_1 = require("./provider");
24
+ Object.defineProperty(exports, "ProviderOps", { enumerable: true, get: function () { return provider_1.ProviderOps; } });
25
+ var bucket_1 = require("./bucket");
26
+ Object.defineProperty(exports, "BucketOps", { enumerable: true, get: function () { return bucket_1.BucketOps; } });
27
+ var deal_1 = require("./deal");
28
+ Object.defineProperty(exports, "DealOps", { enumerable: true, get: function () { return deal_1.DealOps; } });
29
+ var funding_1 = require("./funding");
30
+ Object.defineProperty(exports, "FundingOps", { enumerable: true, get: function () { return funding_1.FundingOps; } });
31
+ // Export models and types
32
+ __exportStar(require("./models"), exports);
@@ -0,0 +1,149 @@
1
+ /**
2
+ * TypeScript models for FlashOnStellar V2 contract
3
+ * These models correspond to the Rust contract types
4
+ */
5
+ export interface Consumer {
6
+ consumer_id: string;
7
+ description: string;
8
+ reputation: number;
9
+ registered_ts: bigint;
10
+ last_update_ts: bigint;
11
+ deals: Map<string, bigint>;
12
+ active_deals: Map<string, bigint>;
13
+ }
14
+ export interface Provider {
15
+ provider_id: string;
16
+ buckets: Map<string, bigint>;
17
+ deals: Map<string, bigint>;
18
+ active_deals: Map<string, bigint>;
19
+ description: string;
20
+ reputation: number;
21
+ registered_ts: bigint;
22
+ last_update_ts: bigint;
23
+ units_count: number;
24
+ }
25
+ export interface Bucket {
26
+ bucket_id: number;
27
+ name: string;
28
+ region: string;
29
+ country: string;
30
+ provider_id: string;
31
+ fb_bucket_id: string;
32
+ price_per_gb_storage: bigint;
33
+ price_per_gb_egress: bigint;
34
+ max_storage_gb: number;
35
+ max_egress_gb: number;
36
+ versioning_enabled: boolean;
37
+ encryption_at_rest: boolean;
38
+ encryption_in_transit: boolean;
39
+ object_locking: boolean;
40
+ api_compatibility: string;
41
+ sla_avg_latency_ms: number;
42
+ sla_avg_uptime_pct: number;
43
+ access_scope: string;
44
+ tags: string[];
45
+ created_ts: bigint;
46
+ status: BucketStatus;
47
+ locked: boolean;
48
+ }
49
+ export declare enum BucketStatus {
50
+ Active = "Active",
51
+ Inactive = "Inactive",
52
+ Deleted = "Deleted"
53
+ }
54
+ export interface Deal {
55
+ deal_id: number;
56
+ consumer_id: string;
57
+ provider_id: string;
58
+ bucket_id: number;
59
+ fb_repo_id: string;
60
+ api_compatibility: string;
61
+ start_ts: bigint;
62
+ duration_secs: bigint;
63
+ agreed_storage_gb: number;
64
+ agreed_egress_gb: number;
65
+ unpaid_storage_gb: number;
66
+ unpaid_egress_gb: number;
67
+ paid_storage_gb: number;
68
+ paid_egress_gb: number;
69
+ status: DealStatus;
70
+ balance_consumer: bigint;
71
+ balance_provider: bigint;
72
+ sla_avg_latency_ms: number;
73
+ sla_avg_uptime_pct: number;
74
+ slash_storage_gb: number;
75
+ slash_egress_gb: number;
76
+ slash_amount_usd: bigint;
77
+ }
78
+ export declare enum DealStatus {
79
+ Pending = "Pending",
80
+ Accepted = "Accepted",
81
+ Funded = "Funded",
82
+ Completed = "Completed",
83
+ Cancelled = "Cancelled",
84
+ BreachedConsumer = "BreachedConsumer",
85
+ BreachedProvider = "BreachedProvider"
86
+ }
87
+ export declare enum DataKey {
88
+ Owner = "Owner",
89
+ StableAssetAddress = "StableAssetAddress",
90
+ Provider = "Provider",
91
+ ProviderCount = "ProviderCount",
92
+ ProviderMap = "ProviderMap",
93
+ Consumer = "Consumer",
94
+ ConsumerCount = "ConsumerCount",
95
+ ConsumerMap = "ConsumerMap",
96
+ Bucket = "Bucket",
97
+ BucketCount = "BucketCount",
98
+ BucketMap = "BucketMap",
99
+ Deal = "Deal",
100
+ DealCount = "DealCount",
101
+ DealMap = "DealMap",
102
+ ActiveDealMap = "ActiveDealMap"
103
+ }
104
+ export declare enum ErrorCode {
105
+ ConsumerAlreadyExists = "ConsumerAlreadyExists",
106
+ ProviderAlreadyExists = "ProviderAlreadyExists",
107
+ BucketAlreadyExists = "BucketAlreadyExists",
108
+ BucketLocked = "BucketLocked"
109
+ }
110
+ export interface BucketCreateParams {
111
+ name: string;
112
+ region: string;
113
+ country: string;
114
+ versioning_enabled: boolean;
115
+ fb_bucket_id: string;
116
+ api_compatibility: string;
117
+ price_per_gb_storage: bigint;
118
+ price_per_gb_egress: bigint;
119
+ }
120
+ export interface DealCreateParams {
121
+ duration_secs: bigint;
122
+ agreed_storage_gb: number;
123
+ agreed_egress_gb: number;
124
+ fb_repo_id: string;
125
+ api_compatibility: string;
126
+ }
127
+ export interface BucketUpdateBasicParams {
128
+ name?: string;
129
+ region?: string;
130
+ country?: string;
131
+ }
132
+ export interface BucketUpdatePricingParams {
133
+ price_per_gb_storage?: bigint;
134
+ price_per_gb_egress?: bigint;
135
+ max_storage_gb?: number;
136
+ max_egress_gb?: number;
137
+ }
138
+ export interface BucketUpdateSLAParams {
139
+ sla_avg_latency_ms?: number;
140
+ sla_avg_uptime_pct?: number;
141
+ }
142
+ export interface DealConsumptionUpdateParams {
143
+ storage_gb: number;
144
+ egress_gb: number;
145
+ }
146
+ export interface DealSLAUpdateParams {
147
+ sla_avg_latency_ms: number;
148
+ sla_avg_uptime_pct: number;
149
+ }