synapse-filecoin-sdk 0.1.0__py3-none-any.whl

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.
Files changed (64) hide show
  1. pynapse/__init__.py +6 -0
  2. pynapse/_version.py +1 -0
  3. pynapse/contracts/__init__.py +34 -0
  4. pynapse/contracts/abi_registry.py +11 -0
  5. pynapse/contracts/addresses.json +30 -0
  6. pynapse/contracts/erc20_abi.json +92 -0
  7. pynapse/contracts/errorsAbi.json +933 -0
  8. pynapse/contracts/filecoinPayV1Abi.json +2424 -0
  9. pynapse/contracts/filecoinWarmStorageServiceAbi.json +2363 -0
  10. pynapse/contracts/filecoinWarmStorageServiceStateViewAbi.json +651 -0
  11. pynapse/contracts/generated.py +35 -0
  12. pynapse/contracts/payments_abi.json +205 -0
  13. pynapse/contracts/pdpVerifierAbi.json +1266 -0
  14. pynapse/contracts/providerIdSetAbi.json +161 -0
  15. pynapse/contracts/serviceProviderRegistryAbi.json +1479 -0
  16. pynapse/contracts/sessionKeyRegistryAbi.json +147 -0
  17. pynapse/core/__init__.py +68 -0
  18. pynapse/core/abis.py +25 -0
  19. pynapse/core/chains.py +97 -0
  20. pynapse/core/constants.py +27 -0
  21. pynapse/core/errors.py +22 -0
  22. pynapse/core/piece.py +263 -0
  23. pynapse/core/rand.py +14 -0
  24. pynapse/core/typed_data.py +320 -0
  25. pynapse/core/utils.py +30 -0
  26. pynapse/evm/__init__.py +3 -0
  27. pynapse/evm/client.py +26 -0
  28. pynapse/filbeam/__init__.py +3 -0
  29. pynapse/filbeam/service.py +39 -0
  30. pynapse/payments/__init__.py +17 -0
  31. pynapse/payments/service.py +826 -0
  32. pynapse/pdp/__init__.py +21 -0
  33. pynapse/pdp/server.py +331 -0
  34. pynapse/pdp/types.py +38 -0
  35. pynapse/pdp/verifier.py +82 -0
  36. pynapse/retriever/__init__.py +12 -0
  37. pynapse/retriever/async_chain.py +227 -0
  38. pynapse/retriever/chain.py +209 -0
  39. pynapse/session/__init__.py +12 -0
  40. pynapse/session/key.py +30 -0
  41. pynapse/session/permissions.py +57 -0
  42. pynapse/session/registry.py +90 -0
  43. pynapse/sp_registry/__init__.py +11 -0
  44. pynapse/sp_registry/capabilities.py +25 -0
  45. pynapse/sp_registry/pdp_capabilities.py +102 -0
  46. pynapse/sp_registry/service.py +446 -0
  47. pynapse/sp_registry/types.py +52 -0
  48. pynapse/storage/__init__.py +57 -0
  49. pynapse/storage/async_context.py +682 -0
  50. pynapse/storage/async_manager.py +757 -0
  51. pynapse/storage/context.py +680 -0
  52. pynapse/storage/manager.py +758 -0
  53. pynapse/synapse.py +191 -0
  54. pynapse/utils/__init__.py +25 -0
  55. pynapse/utils/constants.py +25 -0
  56. pynapse/utils/errors.py +3 -0
  57. pynapse/utils/metadata.py +35 -0
  58. pynapse/utils/piece_url.py +16 -0
  59. pynapse/warm_storage/__init__.py +13 -0
  60. pynapse/warm_storage/service.py +513 -0
  61. synapse_filecoin_sdk-0.1.0.dist-info/METADATA +74 -0
  62. synapse_filecoin_sdk-0.1.0.dist-info/RECORD +64 -0
  63. synapse_filecoin_sdk-0.1.0.dist-info/WHEEL +4 -0
  64. synapse_filecoin_sdk-0.1.0.dist-info/licenses/LICENSE.md +228 -0
@@ -0,0 +1,651 @@
1
+ [
2
+ {
3
+ "type": "constructor",
4
+ "inputs": [
5
+ {
6
+ "name": "_service",
7
+ "internalType": "contract FilecoinWarmStorageService",
8
+ "type": "address"
9
+ }
10
+ ],
11
+ "stateMutability": "nonpayable"
12
+ },
13
+ {
14
+ "type": "function",
15
+ "inputs": [
16
+ {
17
+ "name": "payer",
18
+ "internalType": "address",
19
+ "type": "address"
20
+ }
21
+ ],
22
+ "name": "clientDataSets",
23
+ "outputs": [
24
+ {
25
+ "name": "dataSetIds",
26
+ "internalType": "uint256[]",
27
+ "type": "uint256[]"
28
+ }
29
+ ],
30
+ "stateMutability": "view"
31
+ },
32
+ {
33
+ "type": "function",
34
+ "inputs": [
35
+ {
36
+ "name": "payer",
37
+ "internalType": "address",
38
+ "type": "address"
39
+ },
40
+ {
41
+ "name": "nonce",
42
+ "internalType": "uint256",
43
+ "type": "uint256"
44
+ }
45
+ ],
46
+ "name": "clientNonces",
47
+ "outputs": [
48
+ {
49
+ "name": "",
50
+ "internalType": "uint256",
51
+ "type": "uint256"
52
+ }
53
+ ],
54
+ "stateMutability": "view"
55
+ },
56
+ {
57
+ "type": "function",
58
+ "inputs": [],
59
+ "name": "filBeamControllerAddress",
60
+ "outputs": [
61
+ {
62
+ "name": "",
63
+ "internalType": "address",
64
+ "type": "address"
65
+ }
66
+ ],
67
+ "stateMutability": "view"
68
+ },
69
+ {
70
+ "type": "function",
71
+ "inputs": [
72
+ {
73
+ "name": "dataSetId",
74
+ "internalType": "uint256",
75
+ "type": "uint256"
76
+ }
77
+ ],
78
+ "name": "getAllDataSetMetadata",
79
+ "outputs": [
80
+ {
81
+ "name": "keys",
82
+ "internalType": "string[]",
83
+ "type": "string[]"
84
+ },
85
+ {
86
+ "name": "values",
87
+ "internalType": "string[]",
88
+ "type": "string[]"
89
+ }
90
+ ],
91
+ "stateMutability": "view"
92
+ },
93
+ {
94
+ "type": "function",
95
+ "inputs": [
96
+ {
97
+ "name": "dataSetId",
98
+ "internalType": "uint256",
99
+ "type": "uint256"
100
+ },
101
+ {
102
+ "name": "pieceId",
103
+ "internalType": "uint256",
104
+ "type": "uint256"
105
+ }
106
+ ],
107
+ "name": "getAllPieceMetadata",
108
+ "outputs": [
109
+ {
110
+ "name": "keys",
111
+ "internalType": "string[]",
112
+ "type": "string[]"
113
+ },
114
+ {
115
+ "name": "values",
116
+ "internalType": "string[]",
117
+ "type": "string[]"
118
+ }
119
+ ],
120
+ "stateMutability": "view"
121
+ },
122
+ {
123
+ "type": "function",
124
+ "inputs": [
125
+ {
126
+ "name": "offset",
127
+ "internalType": "uint256",
128
+ "type": "uint256"
129
+ },
130
+ {
131
+ "name": "limit",
132
+ "internalType": "uint256",
133
+ "type": "uint256"
134
+ }
135
+ ],
136
+ "name": "getApprovedProviders",
137
+ "outputs": [
138
+ {
139
+ "name": "providerIds",
140
+ "internalType": "uint256[]",
141
+ "type": "uint256[]"
142
+ }
143
+ ],
144
+ "stateMutability": "view"
145
+ },
146
+ {
147
+ "type": "function",
148
+ "inputs": [],
149
+ "name": "getApprovedProvidersLength",
150
+ "outputs": [
151
+ {
152
+ "name": "count",
153
+ "internalType": "uint256",
154
+ "type": "uint256"
155
+ }
156
+ ],
157
+ "stateMutability": "view"
158
+ },
159
+ {
160
+ "type": "function",
161
+ "inputs": [
162
+ {
163
+ "name": "client",
164
+ "internalType": "address",
165
+ "type": "address"
166
+ }
167
+ ],
168
+ "name": "getClientDataSets",
169
+ "outputs": [
170
+ {
171
+ "name": "infos",
172
+ "internalType": "struct FilecoinWarmStorageService.DataSetInfoView[]",
173
+ "type": "tuple[]",
174
+ "components": [
175
+ {
176
+ "name": "pdpRailId",
177
+ "internalType": "uint256",
178
+ "type": "uint256"
179
+ },
180
+ {
181
+ "name": "cacheMissRailId",
182
+ "internalType": "uint256",
183
+ "type": "uint256"
184
+ },
185
+ {
186
+ "name": "cdnRailId",
187
+ "internalType": "uint256",
188
+ "type": "uint256"
189
+ },
190
+ {
191
+ "name": "payer",
192
+ "internalType": "address",
193
+ "type": "address"
194
+ },
195
+ {
196
+ "name": "payee",
197
+ "internalType": "address",
198
+ "type": "address"
199
+ },
200
+ {
201
+ "name": "serviceProvider",
202
+ "internalType": "address",
203
+ "type": "address"
204
+ },
205
+ {
206
+ "name": "commissionBps",
207
+ "internalType": "uint256",
208
+ "type": "uint256"
209
+ },
210
+ {
211
+ "name": "clientDataSetId",
212
+ "internalType": "uint256",
213
+ "type": "uint256"
214
+ },
215
+ {
216
+ "name": "pdpEndEpoch",
217
+ "internalType": "uint256",
218
+ "type": "uint256"
219
+ },
220
+ {
221
+ "name": "providerId",
222
+ "internalType": "uint256",
223
+ "type": "uint256"
224
+ },
225
+ {
226
+ "name": "dataSetId",
227
+ "internalType": "uint256",
228
+ "type": "uint256"
229
+ }
230
+ ]
231
+ }
232
+ ],
233
+ "stateMutability": "view"
234
+ },
235
+ {
236
+ "type": "function",
237
+ "inputs": [],
238
+ "name": "getCurrentPricingRates",
239
+ "outputs": [
240
+ {
241
+ "name": "storagePrice",
242
+ "internalType": "uint256",
243
+ "type": "uint256"
244
+ },
245
+ {
246
+ "name": "minimumRate",
247
+ "internalType": "uint256",
248
+ "type": "uint256"
249
+ }
250
+ ],
251
+ "stateMutability": "view"
252
+ },
253
+ {
254
+ "type": "function",
255
+ "inputs": [
256
+ {
257
+ "name": "dataSetId",
258
+ "internalType": "uint256",
259
+ "type": "uint256"
260
+ }
261
+ ],
262
+ "name": "getDataSet",
263
+ "outputs": [
264
+ {
265
+ "name": "info",
266
+ "internalType": "struct FilecoinWarmStorageService.DataSetInfoView",
267
+ "type": "tuple",
268
+ "components": [
269
+ {
270
+ "name": "pdpRailId",
271
+ "internalType": "uint256",
272
+ "type": "uint256"
273
+ },
274
+ {
275
+ "name": "cacheMissRailId",
276
+ "internalType": "uint256",
277
+ "type": "uint256"
278
+ },
279
+ {
280
+ "name": "cdnRailId",
281
+ "internalType": "uint256",
282
+ "type": "uint256"
283
+ },
284
+ {
285
+ "name": "payer",
286
+ "internalType": "address",
287
+ "type": "address"
288
+ },
289
+ {
290
+ "name": "payee",
291
+ "internalType": "address",
292
+ "type": "address"
293
+ },
294
+ {
295
+ "name": "serviceProvider",
296
+ "internalType": "address",
297
+ "type": "address"
298
+ },
299
+ {
300
+ "name": "commissionBps",
301
+ "internalType": "uint256",
302
+ "type": "uint256"
303
+ },
304
+ {
305
+ "name": "clientDataSetId",
306
+ "internalType": "uint256",
307
+ "type": "uint256"
308
+ },
309
+ {
310
+ "name": "pdpEndEpoch",
311
+ "internalType": "uint256",
312
+ "type": "uint256"
313
+ },
314
+ {
315
+ "name": "providerId",
316
+ "internalType": "uint256",
317
+ "type": "uint256"
318
+ },
319
+ {
320
+ "name": "dataSetId",
321
+ "internalType": "uint256",
322
+ "type": "uint256"
323
+ }
324
+ ]
325
+ }
326
+ ],
327
+ "stateMutability": "view"
328
+ },
329
+ {
330
+ "type": "function",
331
+ "inputs": [
332
+ {
333
+ "name": "dataSetId",
334
+ "internalType": "uint256",
335
+ "type": "uint256"
336
+ },
337
+ {
338
+ "name": "key",
339
+ "internalType": "string",
340
+ "type": "string"
341
+ }
342
+ ],
343
+ "name": "getDataSetMetadata",
344
+ "outputs": [
345
+ {
346
+ "name": "exists",
347
+ "internalType": "bool",
348
+ "type": "bool"
349
+ },
350
+ {
351
+ "name": "value",
352
+ "internalType": "string",
353
+ "type": "string"
354
+ }
355
+ ],
356
+ "stateMutability": "view"
357
+ },
358
+ {
359
+ "type": "function",
360
+ "inputs": [
361
+ {
362
+ "name": "leafCount",
363
+ "internalType": "uint256",
364
+ "type": "uint256"
365
+ }
366
+ ],
367
+ "name": "getDataSetSizeInBytes",
368
+ "outputs": [
369
+ {
370
+ "name": "",
371
+ "internalType": "uint256",
372
+ "type": "uint256"
373
+ }
374
+ ],
375
+ "stateMutability": "pure"
376
+ },
377
+ {
378
+ "type": "function",
379
+ "inputs": [
380
+ {
381
+ "name": "dataSetId",
382
+ "internalType": "uint256",
383
+ "type": "uint256"
384
+ }
385
+ ],
386
+ "name": "getDataSetStatus",
387
+ "outputs": [
388
+ {
389
+ "name": "status",
390
+ "internalType": "enum FilecoinWarmStorageService.DataSetStatus",
391
+ "type": "uint8"
392
+ }
393
+ ],
394
+ "stateMutability": "view"
395
+ },
396
+ {
397
+ "type": "function",
398
+ "inputs": [],
399
+ "name": "getPDPConfig",
400
+ "outputs": [
401
+ {
402
+ "name": "maxProvingPeriod",
403
+ "internalType": "uint64",
404
+ "type": "uint64"
405
+ },
406
+ {
407
+ "name": "challengeWindowSize",
408
+ "internalType": "uint256",
409
+ "type": "uint256"
410
+ },
411
+ {
412
+ "name": "challengesPerProof",
413
+ "internalType": "uint256",
414
+ "type": "uint256"
415
+ },
416
+ {
417
+ "name": "initChallengeWindowStart",
418
+ "internalType": "uint256",
419
+ "type": "uint256"
420
+ }
421
+ ],
422
+ "stateMutability": "view"
423
+ },
424
+ {
425
+ "type": "function",
426
+ "inputs": [
427
+ {
428
+ "name": "dataSetId",
429
+ "internalType": "uint256",
430
+ "type": "uint256"
431
+ },
432
+ {
433
+ "name": "pieceId",
434
+ "internalType": "uint256",
435
+ "type": "uint256"
436
+ },
437
+ {
438
+ "name": "key",
439
+ "internalType": "string",
440
+ "type": "string"
441
+ }
442
+ ],
443
+ "name": "getPieceMetadata",
444
+ "outputs": [
445
+ {
446
+ "name": "exists",
447
+ "internalType": "bool",
448
+ "type": "bool"
449
+ },
450
+ {
451
+ "name": "value",
452
+ "internalType": "string",
453
+ "type": "string"
454
+ }
455
+ ],
456
+ "stateMutability": "view"
457
+ },
458
+ {
459
+ "type": "function",
460
+ "inputs": [
461
+ {
462
+ "name": "providerId",
463
+ "internalType": "uint256",
464
+ "type": "uint256"
465
+ }
466
+ ],
467
+ "name": "isProviderApproved",
468
+ "outputs": [
469
+ {
470
+ "name": "",
471
+ "internalType": "bool",
472
+ "type": "bool"
473
+ }
474
+ ],
475
+ "stateMutability": "view"
476
+ },
477
+ {
478
+ "type": "function",
479
+ "inputs": [
480
+ {
481
+ "name": "setId",
482
+ "internalType": "uint256",
483
+ "type": "uint256"
484
+ }
485
+ ],
486
+ "name": "nextPDPChallengeWindowStart",
487
+ "outputs": [
488
+ {
489
+ "name": "",
490
+ "internalType": "uint256",
491
+ "type": "uint256"
492
+ }
493
+ ],
494
+ "stateMutability": "view"
495
+ },
496
+ {
497
+ "type": "function",
498
+ "inputs": [],
499
+ "name": "nextUpgrade",
500
+ "outputs": [
501
+ {
502
+ "name": "nextImplementation",
503
+ "internalType": "address",
504
+ "type": "address"
505
+ },
506
+ {
507
+ "name": "afterEpoch",
508
+ "internalType": "uint96",
509
+ "type": "uint96"
510
+ }
511
+ ],
512
+ "stateMutability": "view"
513
+ },
514
+ {
515
+ "type": "function",
516
+ "inputs": [
517
+ {
518
+ "name": "dataSetId",
519
+ "internalType": "uint256",
520
+ "type": "uint256"
521
+ },
522
+ {
523
+ "name": "periodId",
524
+ "internalType": "uint256",
525
+ "type": "uint256"
526
+ }
527
+ ],
528
+ "name": "provenPeriods",
529
+ "outputs": [
530
+ {
531
+ "name": "",
532
+ "internalType": "bool",
533
+ "type": "bool"
534
+ }
535
+ ],
536
+ "stateMutability": "view"
537
+ },
538
+ {
539
+ "type": "function",
540
+ "inputs": [
541
+ {
542
+ "name": "dataSetId",
543
+ "internalType": "uint256",
544
+ "type": "uint256"
545
+ }
546
+ ],
547
+ "name": "provenThisPeriod",
548
+ "outputs": [
549
+ {
550
+ "name": "",
551
+ "internalType": "bool",
552
+ "type": "bool"
553
+ }
554
+ ],
555
+ "stateMutability": "view"
556
+ },
557
+ {
558
+ "type": "function",
559
+ "inputs": [
560
+ {
561
+ "name": "dataSetId",
562
+ "internalType": "uint256",
563
+ "type": "uint256"
564
+ }
565
+ ],
566
+ "name": "provingActivationEpoch",
567
+ "outputs": [
568
+ {
569
+ "name": "",
570
+ "internalType": "uint256",
571
+ "type": "uint256"
572
+ }
573
+ ],
574
+ "stateMutability": "view"
575
+ },
576
+ {
577
+ "type": "function",
578
+ "inputs": [
579
+ {
580
+ "name": "setId",
581
+ "internalType": "uint256",
582
+ "type": "uint256"
583
+ }
584
+ ],
585
+ "name": "provingDeadline",
586
+ "outputs": [
587
+ {
588
+ "name": "",
589
+ "internalType": "uint256",
590
+ "type": "uint256"
591
+ }
592
+ ],
593
+ "stateMutability": "view"
594
+ },
595
+ {
596
+ "type": "function",
597
+ "inputs": [
598
+ {
599
+ "name": "railId",
600
+ "internalType": "uint256",
601
+ "type": "uint256"
602
+ }
603
+ ],
604
+ "name": "railToDataSet",
605
+ "outputs": [
606
+ {
607
+ "name": "",
608
+ "internalType": "uint256",
609
+ "type": "uint256"
610
+ }
611
+ ],
612
+ "stateMutability": "view"
613
+ },
614
+ {
615
+ "type": "function",
616
+ "inputs": [],
617
+ "name": "service",
618
+ "outputs": [
619
+ {
620
+ "name": "",
621
+ "internalType": "contract FilecoinWarmStorageService",
622
+ "type": "address"
623
+ }
624
+ ],
625
+ "stateMutability": "view"
626
+ },
627
+ {
628
+ "type": "function",
629
+ "inputs": [],
630
+ "name": "serviceCommissionBps",
631
+ "outputs": [
632
+ {
633
+ "name": "",
634
+ "internalType": "uint256",
635
+ "type": "uint256"
636
+ }
637
+ ],
638
+ "stateMutability": "view"
639
+ },
640
+ {
641
+ "type": "error",
642
+ "inputs": [
643
+ {
644
+ "name": "dataSetId",
645
+ "internalType": "uint256",
646
+ "type": "uint256"
647
+ }
648
+ ],
649
+ "name": "ProvingPeriodNotInitialized"
650
+ }
651
+ ]
@@ -0,0 +1,35 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any, Dict, List
6
+
7
+
8
+ _BASE = Path(__file__).parent
9
+
10
+
11
+ def _load(name: str) -> Any:
12
+ return json.loads((_BASE / name).read_text())
13
+
14
+
15
+ ERRORS_ABI = _load("errorsAbi.json")
16
+ FILECOIN_PAY_V1_ABI = _load("filecoinPayV1Abi.json")
17
+ FWSS_ABI = _load("filecoinWarmStorageServiceAbi.json")
18
+ FWSS_VIEW_ABI = _load("filecoinWarmStorageServiceStateViewAbi.json")
19
+ PDP_VERIFIER_ABI = _load("pdpVerifierAbi.json")
20
+ PROVIDER_ID_SET_ABI = _load("providerIdSetAbi.json")
21
+ SERVICE_PROVIDER_REGISTRY_ABI = _load("serviceProviderRegistryAbi.json")
22
+ SESSION_KEY_REGISTRY_ABI = _load("sessionKeyRegistryAbi.json")
23
+ ADDRESSES = _load("addresses.json")
24
+
25
+ __all__ = [
26
+ "ERRORS_ABI",
27
+ "FILECOIN_PAY_V1_ABI",
28
+ "FWSS_ABI",
29
+ "FWSS_VIEW_ABI",
30
+ "PDP_VERIFIER_ABI",
31
+ "PROVIDER_ID_SET_ABI",
32
+ "SERVICE_PROVIDER_REGISTRY_ABI",
33
+ "SESSION_KEY_REGISTRY_ABI",
34
+ "ADDRESSES",
35
+ ]