@flashbacktech/flashbackclient 0.2.78 → 0.2.79

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.
@@ -903,7 +903,10 @@ class ApiClient {
903
903
  };
904
904
  /** Consumption = transactions with direction 'out' (backend uses same endpoint) */
905
905
  this.getCreditsConsumption = async (query) => {
906
- return this.makeRequest('credits/transactions', 'GET', { ...query, direction: 'out' });
906
+ return this.makeRequest('credits/transactions', 'GET', {
907
+ ...query,
908
+ direction: 'out',
909
+ });
907
910
  };
908
911
  this.buyCreditsPack = async (body) => {
909
912
  return this.makeRequest('credits/packs/buy', 'POST', body);
@@ -24,4 +24,4 @@ import * as AiStatsTypes from './types/ai/stats';
24
24
  import * as LinksTypes from './types/platform/links';
25
25
  import * as CreditsTypes from './types/platform/credits';
26
26
  import * as DashboardStatsTypes from './types/dashboard/stats';
27
- export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes, AiStatsTypes, LinksTypes, CreditsTypes, DashboardStatsTypes };
27
+ export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes, AiStatsTypes, LinksTypes, CreditsTypes, DashboardStatsTypes, };
@@ -148,7 +148,7 @@ export interface PolicyValidationResult {
148
148
  score: number;
149
149
  advice: string;
150
150
  issues: Issue[];
151
- severity: "none" | "low" | "medium" | "high";
151
+ severity: 'none' | 'low' | 'medium' | 'high';
152
152
  }
153
153
  export interface PolicyValidationResponse {
154
154
  results: PolicyValidationResult[];
@@ -160,8 +160,8 @@ export interface PolicyRecommendationRequest {
160
160
  }
161
161
  export interface PolicyRecommendation {
162
162
  content: string;
163
- riskType: "low" | "medium" | "high";
164
- alertType: "log" | "alert" | "block";
163
+ riskType: 'low' | 'medium' | 'high';
164
+ alertType: 'log' | 'alert' | 'block';
165
165
  }
166
166
  export interface PolicyRecommendationResponse {
167
167
  level: 0 | 1 | 2;
@@ -1,4 +1,4 @@
1
- import { DeviceInfo } from "./device";
1
+ import { DeviceInfo } from './device';
2
2
  export declare enum MFAType {
3
3
  GOOGLE_AUTH = "GOOGLE_AUTH",
4
4
  MAGIC_LINK = "MAGIC_LINK",
@@ -1,4 +1,4 @@
1
- import { OrgRoles } from "./roles";
1
+ import { OrgRoles } from './roles';
2
2
  export interface CreateOrgUserRequest {
3
3
  email: string;
4
4
  password: string;
@@ -7,5 +7,5 @@ var OrgRoles;
7
7
  OrgRoles[OrgRoles["BILLING"] = 1] = "BILLING";
8
8
  OrgRoles[OrgRoles["WORKSPACES"] = 2] = "WORKSPACES";
9
9
  OrgRoles[OrgRoles["ADMINISTRATORS"] = 254] = "ADMINISTRATORS";
10
- OrgRoles[OrgRoles["OWNER"] = 255] = "OWNER"; // Full organization access
10
+ OrgRoles[OrgRoles["OWNER"] = 255] = "OWNER";
11
11
  })(OrgRoles || (exports.OrgRoles = OrgRoles = {}));
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
4
- ;
5
- ;
6
- ;
7
- ;
@@ -1,4 +1,4 @@
1
- import { PeriodType } from "./quota";
1
+ import { PeriodType } from './quota';
2
2
  export interface SubscriptionPeriodResponse {
3
3
  id: string;
4
4
  subscriptionId: string;
@@ -46,11 +46,11 @@ export declare class ContextTypeHelper {
46
46
  /**
47
47
  * Convert context text to 0-based index
48
48
  */
49
- static toIndex(context: typeof ContextTypeHelper.contextTypes[number]): number;
49
+ static toIndex(context: (typeof ContextTypeHelper.contextTypes)[number]): number;
50
50
  /**
51
51
  * Convert 0-based index to context text
52
52
  */
53
- static fromIndex(index: number): typeof ContextTypeHelper.contextTypes[number];
53
+ static fromIndex(index: number): (typeof ContextTypeHelper.contextTypes)[number];
54
54
  /**
55
55
  * Get all valid context types
56
56
  */
@@ -61,11 +61,11 @@ export declare class EventTypeHelper {
61
61
  /**
62
62
  * Convert event text to 0-based index
63
63
  */
64
- static toIndex(event: typeof EventTypeHelper.eventTypes[number]): number;
64
+ static toIndex(event: (typeof EventTypeHelper.eventTypes)[number]): number;
65
65
  /**
66
66
  * Convert 0-based index to event text
67
67
  */
68
- static fromIndex(index: number): typeof EventTypeHelper.eventTypes[number];
68
+ static fromIndex(index: number): (typeof EventTypeHelper.eventTypes)[number];
69
69
  /**
70
70
  * Get all valid event types
71
71
  */
@@ -44,7 +44,7 @@ ContextTypeHelper.contextTypes = [
44
44
  'orgkey',
45
45
  'aillm',
46
46
  'aillmapikey',
47
- 'conversation'
47
+ 'conversation',
48
48
  ];
49
49
  // Helper class for event type translation
50
50
  class EventTypeHelper {
@@ -75,8 +75,4 @@ class EventTypeHelper {
75
75
  }
76
76
  }
77
77
  exports.EventTypeHelper = EventTypeHelper;
78
- EventTypeHelper.eventTypes = [
79
- 'created',
80
- 'updated',
81
- 'deleted'
82
- ];
78
+ EventTypeHelper.eventTypes = ['created', 'updated', 'deleted'];
@@ -17,7 +17,7 @@ class BucketOps {
17
17
  */
18
18
  this.createBucket = (0, decorator_1.withSignature)(async (provider_id, params) => {
19
19
  console.log('Creating bucket with params:', JSON.stringify(params, null, 2));
20
- const response = await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "create_bucket", [
20
+ const response = await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'create_bucket', [
21
21
  { value: params.name, type: 'string' },
22
22
  { value: params.region, type: 'string' },
23
23
  { value: params.fb_bucket_id, type: 'string' },
@@ -25,7 +25,7 @@ class BucketOps {
25
25
  { value: params.price_per_gb_storage, type: 'u128' },
26
26
  { value: params.price_per_gb_egress, type: 'u128' },
27
27
  { value: params.sla_avg_latency_ms, type: 'u32' },
28
- { value: params.sla_avg_uptime_pct, type: 'u32' }
28
+ { value: params.sla_avg_uptime_pct, type: 'u32' },
29
29
  ]);
30
30
  if (!response.isSuccess) {
31
31
  console.error('Contract call failed - isSuccess is false');
@@ -73,11 +73,11 @@ class BucketOps {
73
73
  * @returns Promise resolving to the update result
74
74
  */
75
75
  this.updateBucketBasic = (0, decorator_1.withSignature)(async (provider_id, bucket_id, params) => {
76
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "update_bucket_basic", [
76
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'update_bucket_basic', [
77
77
  { value: bucket_id, type: 'u32' },
78
78
  { value: params.name || null, type: 'string' },
79
79
  { value: params.region || null, type: 'string' },
80
- { value: params.country || null, type: 'string' }
80
+ { value: params.country || null, type: 'string' },
81
81
  ]);
82
82
  });
83
83
  /**
@@ -88,14 +88,14 @@ class BucketOps {
88
88
  * @returns Promise resolving to the update result
89
89
  */
90
90
  this.updateBucketConditions = (0, decorator_1.withSignature)(async (provider_id, bucket_id, params) => {
91
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "update_bucket_conditions", [
91
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'update_bucket_conditions', [
92
92
  { value: bucket_id, type: 'u32' },
93
93
  { value: params.name || null, type: 'string' },
94
94
  { value: params.region || null, type: 'string' },
95
95
  { value: params.price_per_gb_storage || null, type: 'u128' },
96
96
  { value: params.price_per_gb_egress || null, type: 'u128' },
97
97
  { value: params.sla_avg_latency_ms || null, type: 'u32' },
98
- { value: params.sla_avg_uptime_pct || null, type: 'u32' }
98
+ { value: params.sla_avg_uptime_pct || null, type: 'u32' },
99
99
  ]);
100
100
  });
101
101
  /**
@@ -105,8 +105,8 @@ class BucketOps {
105
105
  * @returns Promise resolving to the lock result
106
106
  */
107
107
  this.lockBucket = (0, decorator_1.withSignature)(async (provider_id, bucket_id) => {
108
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "lock_bucket", [
109
- { value: bucket_id, type: 'u32' }
108
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'lock_bucket', [
109
+ { value: bucket_id, type: 'u32' },
110
110
  ]);
111
111
  });
112
112
  /**
@@ -116,8 +116,8 @@ class BucketOps {
116
116
  * @returns Promise resolving to the unlock result
117
117
  */
118
118
  this.unlockBucket = (0, decorator_1.withSignature)(async (provider_id, bucket_id) => {
119
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "unlock_bucket", [
120
- { value: bucket_id, type: 'u32' }
119
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'unlock_bucket', [
120
+ { value: bucket_id, type: 'u32' },
121
121
  ]);
122
122
  });
123
123
  /**
@@ -127,8 +127,8 @@ class BucketOps {
127
127
  * @returns Promise resolving to the deletion result
128
128
  */
129
129
  this.deleteBucket = (0, decorator_1.withSignature)(async (provider_id, bucket_id) => {
130
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "delete_bucket", [
131
- { value: bucket_id, type: 'u32' }
130
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'delete_bucket', [
131
+ { value: bucket_id, type: 'u32' },
132
132
  ]);
133
133
  });
134
134
  this.context = context;
@@ -142,9 +142,7 @@ class BucketOps {
142
142
  async getBucket(provider_id, bucket_id) {
143
143
  const response = await (0, transaction_1.prepareTransaction)(this.context, provider_id, {
144
144
  method: 'get_bucket',
145
- args: [
146
- { value: bucket_id, type: 'u32' }
147
- ]
145
+ args: [{ value: bucket_id, type: 'u32' }],
148
146
  });
149
147
  if (!response.isSuccess) {
150
148
  return null;
@@ -162,7 +160,7 @@ class BucketOps {
162
160
  async getBucketCount() {
163
161
  const response = await (0, transaction_1.prepareTransaction)(this.context, '', {
164
162
  method: 'get_bucket_count',
165
- args: []
163
+ args: [],
166
164
  });
167
165
  if (!response.isSuccess) {
168
166
  return 0;
@@ -184,8 +182,8 @@ class BucketOps {
184
182
  method: 'get_buckets',
185
183
  args: [
186
184
  { value: skip, type: 'u32' },
187
- { value: take, type: 'u32' }
188
- ]
185
+ { value: take, type: 'u32' },
186
+ ],
189
187
  });
190
188
  if (!response.isSuccess) {
191
189
  return [];
@@ -204,9 +202,7 @@ class BucketOps {
204
202
  async getBucketsByProvider(provider_id) {
205
203
  const response = await (0, transaction_1.prepareTransaction)(this.context, provider_id, {
206
204
  method: 'get_buckets_by_provider',
207
- args: [
208
- { value: provider_id, type: 'address' }
209
- ]
205
+ args: [{ value: provider_id, type: 'address' }],
210
206
  });
211
207
  if (!response.isSuccess) {
212
208
  return [];
@@ -245,7 +241,7 @@ class BucketOps {
245
241
  price_per_gb_storage: bucket.price_per_gb_storage,
246
242
  price_per_gb_egress: bucket.price_per_gb_egress,
247
243
  max_storage_gb: bucket.max_storage_gb,
248
- max_egress_gb: bucket.max_egress_gb
244
+ max_egress_gb: bucket.max_egress_gb,
249
245
  };
250
246
  }
251
247
  }
@@ -16,13 +16,13 @@ class ConsumerOps {
16
16
  * @returns Promise resolving to the registration result
17
17
  */
18
18
  this.registerConsumer = (0, decorator_1.withSignature)(async (consumer_id, description) => {
19
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "register_consumer", [
20
- { value: description, type: 'string' }
19
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'register_consumer', [
20
+ { value: description, type: 'string' },
21
21
  ]);
22
22
  });
23
23
  this.registerFullUser = (0, decorator_1.withSignature)(async (user_id, description) => {
24
- await (0, transaction_1.executeWalletTransaction)(this.context, user_id, "register_full_user", [
25
- { value: description, type: 'string' }
24
+ await (0, transaction_1.executeWalletTransaction)(this.context, user_id, 'register_full_user', [
25
+ { value: description, type: 'string' },
26
26
  ]);
27
27
  });
28
28
  /**
@@ -32,8 +32,8 @@ class ConsumerOps {
32
32
  * @returns Promise resolving to the update result
33
33
  */
34
34
  this.updateConsumer = (0, decorator_1.withSignature)(async (consumer_id, description) => {
35
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "update_consumer", [
36
- { value: description, type: 'string' }
35
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'update_consumer', [
36
+ { value: description, type: 'string' },
37
37
  ]);
38
38
  });
39
39
  /**
@@ -42,7 +42,7 @@ class ConsumerOps {
42
42
  * @returns Promise resolving to the deletion result
43
43
  */
44
44
  this.deleteConsumer = (0, decorator_1.withSignature)(async (consumer_id) => {
45
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "delete_consumer", []);
45
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'delete_consumer', []);
46
46
  });
47
47
  this.context = context;
48
48
  }
@@ -54,9 +54,7 @@ class ConsumerOps {
54
54
  async getConsumer(consumer_id) {
55
55
  const response = await (0, transaction_1.prepareTransaction)(this.context, consumer_id, {
56
56
  method: 'get_consumer',
57
- args: [
58
- { value: consumer_id, type: 'address' }
59
- ]
57
+ args: [{ value: consumer_id, type: 'address' }],
60
58
  });
61
59
  if (!response.isSuccess) {
62
60
  return null;
@@ -74,7 +72,7 @@ class ConsumerOps {
74
72
  async getConsumerCount() {
75
73
  const response = await (0, transaction_1.prepareTransaction)(this.context, '', {
76
74
  method: 'get_consumer_count',
77
- args: []
75
+ args: [],
78
76
  });
79
77
  if (!response.isSuccess) {
80
78
  return 0;
@@ -96,8 +94,8 @@ class ConsumerOps {
96
94
  method: 'get_consumers',
97
95
  args: [
98
96
  { value: skip, type: 'u32' },
99
- { value: take, type: 'u32' }
100
- ]
97
+ { value: take, type: 'u32' },
98
+ ],
101
99
  });
102
100
  if (!response.isSuccess) {
103
101
  return new Map();
@@ -18,14 +18,14 @@ 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, fb_repo_id, params) => {
21
- const response = await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "create_deal", [
21
+ const response = await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'create_deal', [
22
22
  { value: provider_id, type: 'address' },
23
23
  { value: bucket_id, type: 'u32' },
24
24
  { value: fb_repo_id, type: 'string' },
25
25
  { value: params.duration_secs, type: 'u64' },
26
26
  { value: params.agreed_storage_mb, type: 'u64' },
27
27
  { value: params.agreed_egress_mb, type: 'u64' },
28
- { value: params.api_compatibility, type: 'string' }
28
+ { value: params.api_compatibility, type: 'string' },
29
29
  ]);
30
30
  if (!response.isSuccess) {
31
31
  console.error('Contract call failed - isSuccess is false');
@@ -46,15 +46,15 @@ class DealOps {
46
46
  * @returns Promise resolving to the acceptance result
47
47
  */
48
48
  this.setDealAccepted = (0, decorator_1.withSignature)(async (provider_id, consumer_id, deal_id) => {
49
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "set_deal_accepted", [
49
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'set_deal_accepted', [
50
50
  { value: consumer_id, type: 'address' },
51
- { value: deal_id, type: 'u32' }
51
+ { value: deal_id, type: 'u32' },
52
52
  ]);
53
53
  });
54
54
  this.setDealRejected = (0, decorator_1.withSignature)(async (provider_id, consumer_id, deal_id) => {
55
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "set_deal_rejected", [
55
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'set_deal_rejected', [
56
56
  { value: consumer_id, type: 'address' },
57
- { value: deal_id, type: 'u32' }
57
+ { value: deal_id, type: 'u32' },
58
58
  ]);
59
59
  });
60
60
  /**
@@ -66,7 +66,7 @@ class DealOps {
66
66
  * @returns Promise resolving to the funding result
67
67
  */
68
68
  this.setDealFunded = (0, decorator_1.withSignature)(async (consumer_id, provider_id, deal_id, amount_usd, fb_repo_id) => {
69
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "set_deal_funded", [
69
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'set_deal_funded', [
70
70
  { value: provider_id, type: 'address' },
71
71
  { value: deal_id, type: 'u32' },
72
72
  { value: amount_usd, type: 'u128' },
@@ -81,9 +81,9 @@ class DealOps {
81
81
  * @returns Promise resolving to the completion result
82
82
  */
83
83
  this.setDealCompleted = (0, decorator_1.withSignature)(async (consumer_id, provider_id, deal_id) => {
84
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "set_deal_completed", [
84
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'set_deal_completed', [
85
85
  { value: provider_id, type: 'address' },
86
- { value: deal_id, type: 'u32' }
86
+ { value: deal_id, type: 'u32' },
87
87
  ]);
88
88
  });
89
89
  /**
@@ -94,9 +94,9 @@ class DealOps {
94
94
  * @returns Promise resolving to the cancellation result
95
95
  */
96
96
  this.setDealCancelled = (0, decorator_1.withSignature)(async (consumer_id, provider_id, deal_id) => {
97
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "set_deal_cancelled", [
97
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'set_deal_cancelled', [
98
98
  { value: consumer_id, type: 'address' },
99
- { value: deal_id, type: 'u32' }
99
+ { value: deal_id, type: 'u32' },
100
100
  ]);
101
101
  });
102
102
  /**
@@ -107,10 +107,10 @@ class DealOps {
107
107
  * @returns Promise resolving to the deletion result
108
108
  */
109
109
  this.deleteDeal = (0, decorator_1.withSignature)(async (consumer_id, provider_id, deal_id) => {
110
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "delete_deal", [
110
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'delete_deal', [
111
111
  { value: consumer_id, type: 'address' },
112
112
  { value: provider_id, type: 'address' },
113
- { value: deal_id, type: 'u32' }
113
+ { value: deal_id, type: 'u32' },
114
114
  ]);
115
115
  });
116
116
  /**
@@ -122,10 +122,10 @@ class DealOps {
122
122
  * @returns Promise resolving to the deposit result
123
123
  */
124
124
  this.depositToDeal = (0, decorator_1.withSignature)(async (consumer_id, provider_id, deal_id, amount_usd) => {
125
- await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, "deposit_to_deal", [
125
+ await (0, transaction_1.executeWalletTransaction)(this.context, consumer_id, 'deposit_to_deal', [
126
126
  { value: provider_id, type: 'address' },
127
127
  { value: deal_id, type: 'u32' },
128
- { value: amount_usd, type: 'u128' }
128
+ { value: amount_usd, type: 'u128' },
129
129
  ]);
130
130
  });
131
131
  /**
@@ -139,13 +139,13 @@ class DealOps {
139
139
  const args = [
140
140
  { value: provider_id, type: 'address' },
141
141
  { value: consumer_id, type: 'address' },
142
- { value: deal_id, type: 'u32' }
142
+ { value: deal_id, type: 'u32' },
143
143
  ];
144
144
  if (this.context.serverSourceAddress) {
145
- await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, "pay_pending_consumption", args);
145
+ await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, 'pay_pending_consumption', args);
146
146
  }
147
147
  else {
148
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "pay_pending_consumption", args);
148
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'pay_pending_consumption', args);
149
149
  }
150
150
  });
151
151
  /**
@@ -162,13 +162,13 @@ class DealOps {
162
162
  { value: consumer_id, type: 'address' },
163
163
  { value: deal_id, type: 'u32' },
164
164
  { value: params.storage_mb, type: 'u64' },
165
- { value: params.egress_mb, type: 'u64' }
165
+ { value: params.egress_mb, type: 'u64' },
166
166
  ];
167
167
  if (this.context.serverSourceAddress) {
168
- await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, "update_deal_consumption", args);
168
+ await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, 'update_deal_consumption', args);
169
169
  }
170
170
  else {
171
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "update_deal_consumption", args);
171
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'update_deal_consumption', args);
172
172
  }
173
173
  });
174
174
  /**
@@ -185,13 +185,13 @@ class DealOps {
185
185
  { value: consumer_id, type: 'address' },
186
186
  { value: deal_id, type: 'u32' },
187
187
  { value: params.sla_avg_latency_ms, type: 'u32' },
188
- { value: params.sla_avg_uptime_pct, type: 'u32' }
188
+ { value: params.sla_avg_uptime_pct, type: 'u32' },
189
189
  ];
190
190
  if (this.context.serverSourceAddress) {
191
- await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, "update_deal_sla", args);
191
+ await (0, transaction_1.executeServerTransaction)(this.context, this.context.serverSourceAddress, 'update_deal_sla', args);
192
192
  }
193
193
  else {
194
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "update_deal_sla", args);
194
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'update_deal_sla', args);
195
195
  }
196
196
  });
197
197
  this.context = context;
@@ -209,8 +209,8 @@ class DealOps {
209
209
  args: [
210
210
  { value: consumer_id, type: 'address' },
211
211
  { value: provider_id, type: 'address' },
212
- { value: deal_id, type: 'u32' }
213
- ]
212
+ { value: deal_id, type: 'u32' },
213
+ ],
214
214
  });
215
215
  if (!response.isSuccess) {
216
216
  return null;
@@ -228,7 +228,7 @@ class DealOps {
228
228
  async getDealCount() {
229
229
  const response = await (0, transaction_1.prepareTransaction)(this.context, '', {
230
230
  method: 'get_deal_count',
231
- args: []
231
+ args: [],
232
232
  });
233
233
  if (!response.isSuccess) {
234
234
  return 0;
@@ -250,8 +250,8 @@ class DealOps {
250
250
  method: 'get_deals',
251
251
  args: [
252
252
  { value: skip, type: 'u32' },
253
- { value: take, type: 'u32' }
254
- ]
253
+ { value: take, type: 'u32' },
254
+ ],
255
255
  });
256
256
  if (!response.isSuccess) {
257
257
  return [];
@@ -270,9 +270,7 @@ class DealOps {
270
270
  async getDealsByConsumer(consumer_id) {
271
271
  const response = await (0, transaction_1.prepareTransaction)(this.context, consumer_id, {
272
272
  method: 'get_deals_by_consumer',
273
- args: [
274
- { value: consumer_id, type: 'address' }
275
- ]
273
+ args: [{ value: consumer_id, type: 'address' }],
276
274
  });
277
275
  if (!response.isSuccess) {
278
276
  return [];
@@ -291,9 +289,7 @@ class DealOps {
291
289
  async getDealsByProvider(provider_id) {
292
290
  const response = await (0, transaction_1.prepareTransaction)(this.context, provider_id, {
293
291
  method: 'get_deals_by_provider',
294
- args: [
295
- { value: provider_id, type: 'address' }
296
- ]
292
+ args: [{ value: provider_id, type: 'address' }],
297
293
  });
298
294
  if (!response.isSuccess) {
299
295
  return [];
@@ -315,8 +311,8 @@ class DealOps {
315
311
  method: 'get_active_deals',
316
312
  args: [
317
313
  { value: skip, type: 'u32' },
318
- { value: take, type: 'u32' }
319
- ]
314
+ { value: take, type: 'u32' },
315
+ ],
320
316
  });
321
317
  if (!response.isSuccess) {
322
318
  return [];
@@ -355,7 +351,7 @@ class DealOps {
355
351
  }
356
352
  return {
357
353
  balance_consumer: deal.balance_consumer,
358
- balance_provider: deal.balance_provider
354
+ balance_provider: deal.balance_provider,
359
355
  };
360
356
  }
361
357
  }
@@ -16,9 +16,9 @@ class FundingOps {
16
16
  * @returns Promise resolving to the transfer result
17
17
  */
18
18
  this.sendFundsOwner = (0, decorator_1.withSignature)(async (receiver, amount) => {
19
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "send_funds_owner", [
19
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'send_funds_owner', [
20
20
  { value: receiver, type: 'address' },
21
- { value: amount, type: 'i128' }
21
+ { value: amount, type: 'i128' },
22
22
  ]);
23
23
  });
24
24
  /**
@@ -28,8 +28,8 @@ class FundingOps {
28
28
  * @returns Promise resolving to the minting result
29
29
  */
30
30
  this.testFaucet = (0, decorator_1.withSignature)(async (receiver, amount) => {
31
- await (0, transaction_1.executeWalletTransaction)(this.context, receiver, "test_faucet", [
32
- { value: amount, type: 'i128' }
31
+ await (0, transaction_1.executeWalletTransaction)(this.context, receiver, 'test_faucet', [
32
+ { value: amount, type: 'i128' },
33
33
  ]);
34
34
  });
35
35
  /**
@@ -38,8 +38,8 @@ class FundingOps {
38
38
  * @returns Promise resolving to the admin change result
39
39
  */
40
40
  this.changeAssetAdmin = (0, decorator_1.withSignature)(async (new_admin) => {
41
- await (0, transaction_1.executeWalletTransaction)(this.context, '', "change_asset_admin", [
42
- { value: new_admin, type: 'address' }
41
+ await (0, transaction_1.executeWalletTransaction)(this.context, '', 'change_asset_admin', [
42
+ { value: new_admin, type: 'address' },
43
43
  ]);
44
44
  });
45
45
  this.context = context;
@@ -47,7 +47,7 @@ class FundingOps {
47
47
  async getStableAssetName(wallet_address) {
48
48
  const response = await (0, transaction_1.prepareTransaction)(this.context, wallet_address, {
49
49
  method: 'get_stable_asset_name',
50
- args: []
50
+ args: [],
51
51
  });
52
52
  if (response.isSuccess) {
53
53
  return response.result;
@@ -57,7 +57,7 @@ class FundingOps {
57
57
  async getStableAssetAddress(wallet_address) {
58
58
  const response = await (0, transaction_1.prepareTransaction)(this.context, wallet_address, {
59
59
  method: 'get_stable_asset_address',
60
- args: []
60
+ args: [],
61
61
  });
62
62
  if (response.isSuccess) {
63
63
  return response.result;
@@ -43,17 +43,13 @@ class FlashOnStellarClientV2 {
43
43
  this.registerAsConsumerProvider = (0, decorator_1.withSignature)(async (address, description) => {
44
44
  await (0, transaction_1.executeMultiWalletTransactions)(this.getContext(), address, [
45
45
  {
46
- method: "register_consumer",
47
- additionalArgs: [
48
- { value: description, type: 'string' }
49
- ]
46
+ method: 'register_consumer',
47
+ additionalArgs: [{ value: description, type: 'string' }],
50
48
  },
51
49
  {
52
- method: "register_provider",
53
- additionalArgs: [
54
- { value: description, type: 'string' }
55
- ]
56
- }
50
+ method: 'register_provider',
51
+ additionalArgs: [{ value: description, type: 'string' }],
52
+ },
57
53
  ]);
58
54
  });
59
55
  this.signTransaction = config.signTransaction;
@@ -147,7 +143,7 @@ class FlashOnStellarClientV2 {
147
143
  this.consumers.getConsumerCount(),
148
144
  this.providers.getProviderCount(),
149
145
  this.buckets.getBucketCount(),
150
- this.deals.getDealCount()
146
+ this.deals.getDealCount(),
151
147
  ]);
152
148
  // Get active deals count
153
149
  const activeDeals = await this.deals.getActiveDeals(0, 1000); // Get all active deals
@@ -157,7 +153,7 @@ class FlashOnStellarClientV2 {
157
153
  providerCount,
158
154
  bucketCount,
159
155
  dealCount,
160
- activeDealCount
156
+ activeDealCount,
161
157
  };
162
158
  }
163
159
  catch (error) {
@@ -167,7 +163,7 @@ class FlashOnStellarClientV2 {
167
163
  providerCount: 0,
168
164
  bucketCount: 0,
169
165
  dealCount: 0,
170
- activeDealCount: 0
166
+ activeDealCount: 0,
171
167
  };
172
168
  }
173
169
  }
@@ -182,18 +178,18 @@ class FlashOnStellarClientV2 {
182
178
  this.providers.getProvider(provider_id),
183
179
  this.buckets.getBucketsByProvider(provider_id),
184
180
  this.deals.getDealsByProvider(provider_id),
185
- this.deals.getActiveDeals(0, 1000) // Get all active deals and filter by provider
181
+ this.deals.getActiveDeals(0, 1000), // Get all active deals and filter by provider
186
182
  ]);
187
183
  if (!provider) {
188
184
  return null;
189
185
  }
190
186
  // Filter active deals for this provider
191
- const providerActiveDeals = activeDeals.filter(deal => deal.provider_id === provider_id);
187
+ const providerActiveDeals = activeDeals.filter((deal) => deal.provider_id === provider_id);
192
188
  return {
193
189
  provider,
194
190
  buckets,
195
191
  deals,
196
- activeDeals: providerActiveDeals
192
+ activeDeals: providerActiveDeals,
197
193
  };
198
194
  }
199
195
  catch (error) {
@@ -211,17 +207,17 @@ class FlashOnStellarClientV2 {
211
207
  const [consumer, deals, activeDeals] = await Promise.all([
212
208
  this.consumers.getConsumer(consumer_id),
213
209
  this.deals.getDealsByConsumer(consumer_id),
214
- this.deals.getActiveDeals(0, 1000) // Get all active deals and filter by consumer
210
+ this.deals.getActiveDeals(0, 1000), // Get all active deals and filter by consumer
215
211
  ]);
216
212
  if (!consumer) {
217
213
  return null;
218
214
  }
219
215
  // Filter active deals for this consumer
220
- const consumerActiveDeals = activeDeals.filter(deal => deal.consumer_id === consumer_id);
216
+ const consumerActiveDeals = activeDeals.filter((deal) => deal.consumer_id === consumer_id);
221
217
  return {
222
218
  consumer,
223
219
  deals,
224
- activeDeals: consumerActiveDeals
220
+ activeDeals: consumerActiveDeals,
225
221
  };
226
222
  }
227
223
  catch (error) {
@@ -240,17 +236,17 @@ class FlashOnStellarClientV2 {
240
236
  const [bucket, provider, activeDeals] = await Promise.all([
241
237
  this.buckets.getBucket(provider_id, bucket_id),
242
238
  this.providers.getProvider(provider_id),
243
- this.deals.getActiveDeals(0, 1000) // Get all active deals and filter by bucket
239
+ this.deals.getActiveDeals(0, 1000), // Get all active deals and filter by bucket
244
240
  ]);
245
241
  if (!bucket) {
246
242
  return null;
247
243
  }
248
244
  // Filter active deals for this bucket
249
- const bucketActiveDeals = activeDeals.filter(deal => deal.bucket_id === bucket_id);
245
+ const bucketActiveDeals = activeDeals.filter((deal) => deal.bucket_id === bucket_id);
250
246
  return {
251
247
  bucket,
252
248
  provider,
253
- activeDeals: bucketActiveDeals
249
+ activeDeals: bucketActiveDeals,
254
250
  };
255
251
  }
256
252
  catch (error) {
@@ -16,8 +16,8 @@ class ProviderOps {
16
16
  * @returns Promise resolving to the registration result
17
17
  */
18
18
  this.registerProvider = (0, decorator_1.withSignature)(async (provider_id, description) => {
19
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "register_provider", [
20
- { value: description, type: 'string' }
19
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'register_provider', [
20
+ { value: description, type: 'string' },
21
21
  ]);
22
22
  });
23
23
  /**
@@ -27,8 +27,8 @@ class ProviderOps {
27
27
  * @returns Promise resolving to the update result
28
28
  */
29
29
  this.updateProvider = (0, decorator_1.withSignature)(async (provider_id, description) => {
30
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "update_provider", [
31
- { value: description, type: 'string' }
30
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'update_provider', [
31
+ { value: description, type: 'string' },
32
32
  ]);
33
33
  });
34
34
  /**
@@ -37,7 +37,7 @@ class ProviderOps {
37
37
  * @returns Promise resolving to the deletion result
38
38
  */
39
39
  this.deleteProvider = (0, decorator_1.withSignature)(async (provider_id) => {
40
- await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "delete_provider", []);
40
+ await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, 'delete_provider', []);
41
41
  });
42
42
  this.context = context;
43
43
  }
@@ -49,9 +49,7 @@ class ProviderOps {
49
49
  async getProvider(provider_id) {
50
50
  const response = await (0, transaction_1.prepareTransaction)(this.context, provider_id, {
51
51
  method: 'get_provider',
52
- args: [
53
- { value: provider_id, type: 'address' }
54
- ]
52
+ args: [{ value: provider_id, type: 'address' }],
55
53
  });
56
54
  if (!response.isSuccess) {
57
55
  return null;
@@ -69,7 +67,7 @@ class ProviderOps {
69
67
  async getProviderCount() {
70
68
  const response = await (0, transaction_1.prepareTransaction)(this.context, '', {
71
69
  method: 'get_provider_count',
72
- args: []
70
+ args: [],
73
71
  });
74
72
  if (!response.isSuccess) {
75
73
  return 0;
@@ -91,8 +89,8 @@ class ProviderOps {
91
89
  method: 'get_providers',
92
90
  args: [
93
91
  { value: skip, type: 'u32' },
94
- { value: take, type: 'u32' }
95
- ]
92
+ { value: take, type: 'u32' },
93
+ ],
96
94
  });
97
95
  if (!response.isSuccess) {
98
96
  return new Map();
@@ -1,5 +1,5 @@
1
1
  import { StellarNetwork } from './wallet/transaction';
2
2
  import { FlashOnStellarClientV2, FlashOnStellarClientConfigV2 } from './client';
3
- export * from "./wallet/index";
3
+ export * from './wallet/index';
4
4
  export * from './models';
5
5
  export { StellarNetwork, FlashOnStellarClientV2, FlashOnStellarClientConfigV2 };
@@ -13,10 +13,10 @@ function withSignature(method) {
13
13
  context = this.context;
14
14
  }
15
15
  else {
16
- throw new Error("FlashOnStellarClient: getContext method or context property is required for write operations");
16
+ throw new Error('FlashOnStellarClient: getContext method or context property is required for write operations');
17
17
  }
18
18
  if (!context.signTransaction) {
19
- throw new Error("FlashOnStellarClient: signTransaction method is required for write operations");
19
+ throw new Error('FlashOnStellarClient: signTransaction method is required for write operations');
20
20
  }
21
21
  return method.apply(this, args);
22
22
  };
@@ -38,10 +38,10 @@ function withSignatureProperty(target, propertyKey) {
38
38
  context = this.context;
39
39
  }
40
40
  else {
41
- throw new Error("FlashOnStellarClient: getContext method or context property is required for write operations");
41
+ throw new Error('FlashOnStellarClient: getContext method or context property is required for write operations');
42
42
  }
43
43
  if (!context.signTransaction) {
44
- throw new Error("FlashOnStellarClient: signTransaction method is required for write operations");
44
+ throw new Error('FlashOnStellarClient: signTransaction method is required for write operations');
45
45
  }
46
46
  return value.apply(this, args);
47
47
  };
@@ -1,4 +1,4 @@
1
- export type Environment = "node" | "browser";
1
+ export type Environment = 'node' | 'browser';
2
2
  /**
3
3
  * Detects the current runtime environment
4
4
  */
@@ -7,20 +7,20 @@ exports.isNode = isNode;
7
7
  * Detects the current runtime environment
8
8
  */
9
9
  function getEnvironment() {
10
- if (typeof window !== "undefined" && typeof document !== "undefined") {
11
- return "browser";
10
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
11
+ return 'browser';
12
12
  }
13
- return "node";
13
+ return 'node';
14
14
  }
15
15
  /**
16
16
  * Checks if the code is running in a browser environment
17
17
  */
18
18
  function isBrowser() {
19
- return getEnvironment() === "browser";
19
+ return getEnvironment() === 'browser';
20
20
  }
21
21
  /**
22
22
  * Checks if the code is running in a Node.js environment
23
23
  */
24
24
  function isNode() {
25
- return getEnvironment() === "node";
25
+ return getEnvironment() === 'node';
26
26
  }
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sleep = void 0;
4
4
  const getGlobalThis = () => {
5
- if (typeof globalThis !== "undefined")
5
+ if (typeof globalThis !== 'undefined')
6
6
  return globalThis;
7
- if (typeof self !== "undefined")
7
+ if (typeof self !== 'undefined')
8
8
  return self;
9
- if (typeof window !== "undefined")
9
+ if (typeof window !== 'undefined')
10
10
  return window;
11
- if (typeof global !== "undefined")
11
+ if (typeof global !== 'undefined')
12
12
  return global;
13
- throw new Error("Unable to locate global object");
13
+ throw new Error('Unable to locate global object');
14
14
  };
15
15
  const sleep = (ms) => {
16
16
  const globalScope = getGlobalThis();
@@ -1,2 +1,2 @@
1
- import { AccountResponse } from "@stellar/stellar-sdk/lib/horizon";
2
- export declare function getBalances(accountAddress: string, network: string): Promise<AccountResponse["balances"]>;
1
+ import { AccountResponse } from '@stellar/stellar-sdk/lib/horizon';
2
+ export declare function getBalances(accountAddress: string, network: string): Promise<AccountResponse['balances']>;
@@ -1,7 +1,7 @@
1
- import { ClientContext } from "../client/index";
1
+ import { ClientContext } from '../client/index';
2
2
  export type ContractArg = {
3
3
  value: string | number | bigint | boolean | null | undefined;
4
- type: "string" | "symbol" | "address" | "u32" | "i32" | "u64" | "i64" | "bool";
4
+ type: 'string' | 'symbol' | 'address' | 'u32' | 'i32' | 'u64' | 'i64' | 'bool';
5
5
  };
6
6
  export type ReadOperation<T> = {
7
7
  method: string;
@@ -16,17 +16,15 @@ async function batchReadOperations(context, wallet_address, operations) {
16
16
  const contractCalls = operations.map(({ operation, params }) => ({
17
17
  method: operation,
18
18
  args: [
19
- { value: wallet_address, type: "address" },
20
- ...params.map((param) => ({ value: param, type: "string" })),
19
+ { value: wallet_address, type: 'address' },
20
+ ...params.map((param) => ({ value: param, type: 'string' })),
21
21
  ],
22
22
  }));
23
23
  const response = await (0, transaction_1.prepareTransaction)(context, wallet_address, contractCalls);
24
24
  if (!response.isSuccess || !response.isReadOnly) {
25
- throw new Error("Batch read operation failed");
25
+ throw new Error('Batch read operation failed');
26
26
  }
27
- const results = Array.isArray(response.result)
28
- ? response.result
29
- : [response.result];
27
+ const results = Array.isArray(response.result) ? response.result : [response.result];
30
28
  return operations.map(({ transform }, index) => transform(results[index]));
31
29
  }
32
30
  /**
@@ -46,10 +44,10 @@ function createReadOperation(method, getArgs, transformResult) {
46
44
  function createOperationFromMethod(method, transformResult) {
47
45
  return createReadOperation(method, (wallet_address, ...extraParams) => {
48
46
  // First arg is always wallet_address
49
- const args = [{ value: wallet_address, type: "address" }];
47
+ const args = [{ value: wallet_address, type: 'address' }];
50
48
  // Add any extra params as strings (or we could make this more sophisticated)
51
49
  extraParams.forEach((param) => {
52
- args.push({ value: param, type: "string" });
50
+ args.push({ value: param, type: 'string' });
53
51
  });
54
52
  return args;
55
53
  }, transformResult);
@@ -65,8 +63,8 @@ async function batchWriteOperations(context, wallet_address, operations) {
65
63
  const contractCalls = operations.map(({ operation, params }) => ({
66
64
  method: operation,
67
65
  args: [
68
- { value: wallet_address, type: "address" },
69
- ...params.map((param) => ({ value: param, type: "string" })),
66
+ { value: wallet_address, type: 'address' },
67
+ ...params.map((param) => ({ value: param, type: 'string' })),
70
68
  ],
71
69
  }));
72
70
  const response = await (0, transaction_1.prepareTransaction)(context, wallet_address, contractCalls);
@@ -1,4 +1,4 @@
1
- export * from "./token";
2
- export * from "./transaction";
3
- export * from "./balance";
4
- export * from "./batch";
1
+ export * from './token';
2
+ export * from './transaction';
3
+ export * from './balance';
4
+ export * from './batch';
@@ -1,3 +1,3 @@
1
- import { StellarNetwork } from "./transaction";
1
+ import { StellarNetwork } from './transaction';
2
2
  declare const changeTrustXDR: (network: StellarNetwork, source: string, issuerPublikKey: string, asset_ticker: string, bRemove: boolean) => Promise<string>;
3
3
  export { changeTrustXDR };
@@ -7,7 +7,7 @@ const changeTrustXDR = async (network, source, issuerPublikKey, asset_ticker, bR
7
7
  const server = (0, transaction_1.getServer)(network);
8
8
  const account = await server.getAccount(source);
9
9
  const asset = new stellar_sdk_1.Asset(asset_ticker, issuerPublikKey);
10
- const changeParams = bRemove ? { limit: "0" } : {};
10
+ const changeParams = bRemove ? { limit: '0' } : {};
11
11
  const transaction = new stellar_sdk_1.TransactionBuilder(account, {
12
12
  fee: stellar_sdk_1.BASE_FEE,
13
13
  networkPassphrase: network.networkPassphrase,
@@ -1,6 +1,6 @@
1
- import { xdr, Transaction, Memo, MemoType, Operation, FeeBumpTransaction, Horizon } from "@stellar/stellar-sdk";
2
- import { rpc } from "@stellar/stellar-sdk";
3
- import { ClientContext } from "../client";
1
+ import { xdr, Transaction, Memo, MemoType, Operation, FeeBumpTransaction, Horizon } from '@stellar/stellar-sdk';
2
+ import { rpc } from '@stellar/stellar-sdk';
3
+ import { ClientContext } from '../client';
4
4
  export interface StellarNetwork {
5
5
  network: string;
6
6
  networkPassphrase: string;
@@ -18,7 +18,7 @@ interface ContractMethodCall {
18
18
  method: string;
19
19
  args?: Array<{
20
20
  value: number | string | bigint | boolean | null | undefined | Array<unknown>;
21
- type: "u32" | "i32" | "u64" | "i64" | "u128" | "i128" | "string" | "symbol" | "address" | "bool" | "vec";
21
+ type: 'u32' | 'i32' | 'u64' | 'i64' | 'u128' | 'i128' | 'string' | 'symbol' | 'address' | 'bool' | 'vec';
22
22
  }>;
23
23
  }
24
24
  export interface ContractMethodResponse {
@@ -15,13 +15,13 @@ if (typeof window !== 'undefined') {
15
15
  window.__STELLAR_SDK_ALLOW_HTTP__ = true;
16
16
  }
17
17
  const getNetwork = (network) => {
18
- let networkPassphrase = "";
18
+ let networkPassphrase = '';
19
19
  switch (network) {
20
- case "TESTNET":
21
- networkPassphrase = "Test SDF Network ; September 2015";
20
+ case 'TESTNET':
21
+ networkPassphrase = 'Test SDF Network ; September 2015';
22
22
  break;
23
- case "PUBLIC":
24
- networkPassphrase = "Public Global Stellar Network ; September 2015";
23
+ case 'PUBLIC':
24
+ networkPassphrase = 'Public Global Stellar Network ; September 2015';
25
25
  break;
26
26
  }
27
27
  return { network, networkPassphrase };
@@ -33,8 +33,8 @@ const getPublicKeyFromPrivateKey = (privateKey) => {
33
33
  };
34
34
  exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
35
35
  const DEFAULT_RPC_URLS = {
36
- TESTNET: "https://soroban-testnet.stellar.org",
37
- PUBLIC: "https://soroban-rpc.creit.tech",
36
+ TESTNET: 'https://soroban-testnet.stellar.org',
37
+ PUBLIC: 'https://soroban-rpc.creit.tech',
38
38
  };
39
39
  const customRpcUrls = {};
40
40
  /**
@@ -52,7 +52,7 @@ const setServer = (network, url) => {
52
52
  };
53
53
  exports.setServer = setServer;
54
54
  const getServer = (network) => {
55
- const serverUrl = customRpcUrls[network.network] ?? DEFAULT_RPC_URLS[network.network] ?? "";
55
+ const serverUrl = customRpcUrls[network.network] ?? DEFAULT_RPC_URLS[network.network] ?? '';
56
56
  if (!serverUrl) {
57
57
  throw new Error(`No RPC URL configured for network "${network.network}". Use setServer(network, url) or ensure the network is one of: TESTNET, PUBLIC.`);
58
58
  }
@@ -67,14 +67,14 @@ const getServer = (network) => {
67
67
  exports.getServer = getServer;
68
68
  const TIMEOUT_TRANSACTION = 60;
69
69
  const getHorizonServer = (network) => {
70
- if (network === "TESTNET") {
71
- return new stellar_sdk_1.Horizon.Server("https://horizon-testnet.stellar.org", {
72
- allowHttp: true
70
+ if (network === 'TESTNET') {
71
+ return new stellar_sdk_1.Horizon.Server('https://horizon-testnet.stellar.org', {
72
+ allowHttp: true,
73
73
  });
74
74
  }
75
75
  else {
76
- return new stellar_sdk_1.Horizon.Server("https://horizon.stellar.org", {
77
- allowHttp: true
76
+ return new stellar_sdk_1.Horizon.Server('https://horizon.stellar.org', {
77
+ allowHttp: true,
78
78
  });
79
79
  }
80
80
  };
@@ -115,7 +115,7 @@ const executeWalletTransaction = async (context, wallet_address, method, additio
115
115
  try {
116
116
  const response = await prepareTransaction(context, wallet_address, {
117
117
  method,
118
- args: [{ value: wallet_address, type: "address" }, ...additionalArgs],
118
+ args: [{ value: wallet_address, type: 'address' }, ...additionalArgs],
119
119
  });
120
120
  if (response.isSuccess) {
121
121
  if (response.isReadOnly) {
@@ -141,10 +141,7 @@ const executeMultiWalletTransactions = async (context, wallet_address, methods,
141
141
  try {
142
142
  const contractCalls = methods.map(({ method, additionalArgs = [] }) => ({
143
143
  method,
144
- args: [
145
- { value: wallet_address, type: "address" },
146
- ...additionalArgs,
147
- ],
144
+ args: [{ value: wallet_address, type: 'address' }, ...additionalArgs],
148
145
  }));
149
146
  const response = await prepareTransaction(context, wallet_address, contractCalls, extraOperations);
150
147
  if (response.isSuccess) {
@@ -175,7 +172,7 @@ const prepareTransaction = async (context, address, contractCalls, extraOperatio
175
172
  const response = {
176
173
  isSuccess: false,
177
174
  isReadOnly: false,
178
- result: "",
175
+ result: '',
179
176
  };
180
177
  // Ensure contractCalls is an array
181
178
  const calls = Array.isArray(contractCalls) ? contractCalls : [contractCalls];
@@ -185,19 +182,19 @@ const prepareTransaction = async (context, address, contractCalls, extraOperatio
185
182
  method: call.method,
186
183
  args: call.args?.map((arg) => {
187
184
  let scVal;
188
- if (arg.type === "vec") {
185
+ if (arg.type === 'vec') {
189
186
  if (arg.value === null) {
190
187
  // Handle null vectors as None
191
- scVal = (0, stellar_sdk_1.nativeToScVal)(null, { type: "vec" });
188
+ scVal = (0, stellar_sdk_1.nativeToScVal)(null, { type: 'vec' });
192
189
  }
193
190
  else if (Array.isArray(arg.value)) {
194
191
  // Handle non-empty vectors
195
192
  const vecScVals = arg.value.map((item) => (0, stellar_sdk_1.nativeToScVal)(item.value, { type: item.type }));
196
- scVal = (0, stellar_sdk_1.nativeToScVal)({ vec: vecScVals }, { type: "vec" });
193
+ scVal = (0, stellar_sdk_1.nativeToScVal)({ vec: vecScVals }, { type: 'vec' });
197
194
  }
198
195
  else {
199
196
  // Fallback for invalid vector values
200
- scVal = (0, stellar_sdk_1.nativeToScVal)(null, { type: "vec" });
197
+ scVal = (0, stellar_sdk_1.nativeToScVal)(null, { type: 'vec' });
201
198
  }
202
199
  }
203
200
  else {
@@ -219,9 +216,7 @@ const prepareTransaction = async (context, address, contractCalls, extraOperatio
219
216
  extraOperations.forEach((operation) => {
220
217
  transactionBuilder.addOperation(operation);
221
218
  });
222
- const builtTransaction = transactionBuilder
223
- .setTimeout(TIMEOUT_TRANSACTION)
224
- .build();
219
+ const builtTransaction = transactionBuilder.setTimeout(TIMEOUT_TRANSACTION).build();
225
220
  console.log(`About to simulate transaction for method: ${calls[0]?.method || 'unknown'}`);
226
221
  let sim;
227
222
  try {
@@ -234,9 +229,7 @@ const prepareTransaction = async (context, address, contractCalls, extraOperatio
234
229
  }
235
230
  if (stellar_sdk_2.rpc.Api.isSimulationSuccess(sim)) {
236
231
  response.isSuccess = true;
237
- const result = sim.result && sim.result.retval
238
- ? (0, stellar_sdk_1.scValToNative)(sim.result.retval)
239
- : undefined;
232
+ const result = sim.result && sim.result.retval ? (0, stellar_sdk_1.scValToNative)(sim.result.retval) : undefined;
240
233
  const footprint = sim.transactionData.getFootprint();
241
234
  const isReadOnly = footprint.readOnly().length > 0 && footprint.readWrite().length === 0;
242
235
  if (isReadOnly) {
@@ -253,7 +246,7 @@ const prepareTransaction = async (context, address, contractCalls, extraOperatio
253
246
  if (stellar_sdk_2.rpc.Api.isSimulationError(sim)) {
254
247
  throw new Error(`Transaction simulation error: ${JSON.stringify(sim.error)}`);
255
248
  }
256
- throw new Error("Transaction simulation failed");
249
+ throw new Error('Transaction simulation failed');
257
250
  }
258
251
  };
259
252
  exports.prepareTransaction = prepareTransaction;
@@ -285,10 +278,10 @@ const sendTransaction = async (context, signedTransactionXDR, bDebug = false) =>
285
278
  // then submit the transaction into the network for us. Then we will have to
286
279
  // wait, polling `getTransaction` until the transaction completes.
287
280
  const sendResponse = await server.sendTransaction(signedTransaction);
288
- if (sendResponse.status === "PENDING") {
281
+ if (sendResponse.status === 'PENDING') {
289
282
  let getResponse = await server.getTransaction(sendResponse.hash);
290
283
  let pollCount = 0;
291
- while (getResponse.status === "NOT_FOUND") {
284
+ while (getResponse.status === 'NOT_FOUND') {
292
285
  pollCount++;
293
286
  // See if the transaction is complete
294
287
  try {
@@ -306,7 +299,7 @@ const sendTransaction = async (context, signedTransactionXDR, bDebug = false) =>
306
299
  // Wait one second
307
300
  await (0, timing_1.sleep)(1000);
308
301
  }
309
- if (getResponse.status === "SUCCESS") {
302
+ if (getResponse.status === 'SUCCESS') {
310
303
  // In SDK v14, returnValue might be directly available
311
304
  if ('returnValue' in getResponse && getResponse.returnValue) {
312
305
  return getResponse.returnValue;
@@ -342,8 +335,11 @@ const sendTransaction = async (context, signedTransactionXDR, bDebug = false) =>
342
335
  returnValue = transactionMeta.returnValue;
343
336
  }
344
337
  // Try nested access
345
- if (!returnValue && '_value' in transactionMeta && transactionMeta._value &&
346
- typeof transactionMeta._value === 'object' && 'returnValue' in transactionMeta._value) {
338
+ if (!returnValue &&
339
+ '_value' in transactionMeta &&
340
+ transactionMeta._value &&
341
+ typeof transactionMeta._value === 'object' &&
342
+ 'returnValue' in transactionMeta._value) {
347
343
  returnValue = transactionMeta._value.returnValue;
348
344
  }
349
345
  if (returnValue) {
@@ -358,17 +354,17 @@ const sendTransaction = async (context, signedTransactionXDR, bDebug = false) =>
358
354
  return getResponse;
359
355
  }
360
356
  }
361
- else if (String(getResponse.status).includes("NOT_FOUND")) {
357
+ else if (String(getResponse.status).includes('NOT_FOUND')) {
362
358
  // If we get NOT_FOUND after polling, the transaction might have succeeded but we can't parse the response
363
359
  // This could happen due to XDR format changes in the network
364
360
  console.warn('sendTransaction: Transaction status indicates NOT_FOUND after polling - this might indicate XDR parsing issues');
365
361
  console.warn('sendTransaction: Since the transaction was submitted successfully, we will assume it succeeded');
366
362
  // Return a success response with the transaction hash
367
363
  return {
368
- status: "SUCCESS",
364
+ status: 'SUCCESS',
369
365
  hash: sendResponse.hash,
370
- message: "Transaction submitted successfully (XDR parsing issue prevented detailed response)",
371
- transactionHash: sendResponse.hash
366
+ message: 'Transaction submitted successfully (XDR parsing issue prevented detailed response)',
367
+ transactionHash: sendResponse.hash,
372
368
  };
373
369
  }
374
370
  else {
@@ -380,7 +376,7 @@ const sendTransaction = async (context, signedTransactionXDR, bDebug = false) =>
380
376
  else {
381
377
  console.error('sendTransaction: Send response status not PENDING:', sendResponse.status);
382
378
  console.error('sendTransaction: Error result:', sendResponse.errorResult);
383
- throw new Error(sendResponse.errorResult?.toString() || "Unknown error");
379
+ throw new Error(sendResponse.errorResult?.toString() || 'Unknown error');
384
380
  }
385
381
  }
386
382
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.78",
3
+ "version": "0.2.79",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"