1
- use std:: str:: FromStr ;
1
+ use std:: { collections :: HashMap , str:: FromStr } ;
2
2
3
3
use serde:: { Deserialize , Serialize } ;
4
4
@@ -48,7 +48,10 @@ pub struct ApplicationFile {
48
48
pub id : String ,
49
49
#[ serde( rename = "Issue Number" ) ]
50
50
pub issue_number : String ,
51
- #[ serde( rename = "Client Contract Address" ) ]
51
+ #[ serde(
52
+ rename = "Client Contract Address" ,
53
+ skip_serializing_if = "Option::is_none"
54
+ ) ]
52
55
pub client_contract_address : Option < String > ,
53
56
#[ serde( rename = "Client" ) ]
54
57
pub client : Client ,
@@ -60,6 +63,11 @@ pub struct ApplicationFile {
60
63
pub lifecycle : LifeCycle ,
61
64
#[ serde( rename = "Allocation Requests" ) ]
62
65
pub allocation : Allocations ,
66
+ #[ serde(
67
+ rename = "Storage Providers Change Requests" ,
68
+ skip_serializing_if = "Option::is_none"
69
+ ) ]
70
+ pub allowed_sps : Option < SpsChangeRequests > ,
63
71
}
64
72
65
73
#[ derive( Serialize , Deserialize , Debug , Clone , Default ) ]
@@ -254,6 +262,7 @@ pub enum AppState {
254
262
StartSignDatacap ,
255
263
Granted ,
256
264
TotalDatacapReached ,
265
+ ChangingSP ,
257
266
Error ,
258
267
}
259
268
@@ -281,6 +290,9 @@ pub struct LifeCycle {
281
290
#[ derive( Serialize , Deserialize , Debug , Clone , Default ) ]
282
291
pub struct Allocations ( pub Vec < Allocation > ) ;
283
292
293
+ #[ derive( Serialize , Deserialize , Debug , Clone , Default ) ]
294
+ pub struct SpsChangeRequests ( pub Vec < SpsChangeRequest > ) ;
295
+
284
296
#[ derive( serde:: Serialize , serde:: Deserialize , Debug , Clone ) ]
285
297
pub enum AllocationRequestType {
286
298
First ,
@@ -316,6 +328,27 @@ pub struct Allocation {
316
328
pub signers : Verifiers ,
317
329
}
318
330
331
+ #[ derive( Serialize , Deserialize , Debug , Clone ) ]
332
+ pub struct SpsChangeRequest {
333
+ #[ serde( rename = "ID" ) ]
334
+ pub id : String ,
335
+ #[ serde( rename = "Created At" ) ]
336
+ pub created_at : String ,
337
+ #[ serde( rename = "Updated At" ) ]
338
+ pub updated_at : String ,
339
+ #[ serde( rename = "Active" ) ]
340
+ pub is_active : bool ,
341
+ #[ serde(
342
+ rename = "Allowed Storage Providers" ,
343
+ skip_serializing_if = "Option::is_none"
344
+ ) ]
345
+ pub allowed_sps : Option < Vec < u64 > > ,
346
+ #[ serde( rename = "Max Deviation" , skip_serializing_if = "Option::is_none" ) ]
347
+ pub max_deviation : Option < String > ,
348
+ #[ serde( rename = "Signers" ) ]
349
+ pub signers : StorageProviderChangeVerifiers ,
350
+ }
351
+
319
352
impl ApplicationFile {
320
353
pub fn remove_active_allocation ( & mut self ) {
321
354
self . allocation . 0 . retain ( |alloc| !alloc. is_active ) ;
@@ -365,6 +398,9 @@ impl ApplicationFile {
365
398
#[ derive( Serialize , Deserialize , Debug , Clone , Default ) ]
366
399
pub struct Verifiers ( pub Vec < Verifier > ) ;
367
400
401
+ #[ derive( Serialize , Deserialize , Debug , Clone , Default ) ]
402
+ pub struct StorageProviderChangeVerifiers ( pub Vec < StorageProviderChangeVerifier > ) ;
403
+
368
404
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
369
405
pub struct VerifierInput {
370
406
pub github_username : String ,
@@ -396,6 +432,29 @@ pub struct Verifier {
396
432
pub message_cid : String ,
397
433
}
398
434
435
+ #[ derive( Serialize , Deserialize , Debug , Clone ) ]
436
+ pub struct StorageProviderChangeVerifier {
437
+ #[ serde( rename = "Github Username" ) ]
438
+ pub github_username : String ,
439
+ #[ serde( rename = "Signing Address" ) ]
440
+ pub signing_address : String ,
441
+ #[ serde(
442
+ rename = "Set Max Deviation CID" ,
443
+ skip_serializing_if = "Option::is_none"
444
+ ) ]
445
+ pub max_deviation_cid : Option < String > ,
446
+ #[ serde(
447
+ rename = "Add Allowed Storage Providers CID" ,
448
+ skip_serializing_if = "Option::is_none"
449
+ ) ]
450
+ pub add_allowed_sps_cids : Option < HashMap < String , Vec < String > > > ,
451
+ #[ serde(
452
+ rename = "Remove Allowed Storage Providers CID" ,
453
+ skip_serializing_if = "Option::is_none"
454
+ ) ]
455
+ pub remove_allowed_sps_cids : Option < HashMap < String , Vec < String > > > ,
456
+ }
457
+
399
458
#[ derive( serde:: Serialize , serde:: Deserialize , Debug , Clone ) ]
400
459
pub struct AllocationRequest {
401
460
pub actor : String ,
0 commit comments