forked from Manuel1234477/Stellar-Micro-Donation-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
846 lines (846 loc) · 21 KB
/
Copy pathopenapi.yaml
File metadata and controls
846 lines (846 loc) · 21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
openapi: 3.0.0
info:
title: Stellar Micro-Donation API
version: 1.0.0
description: API for managing micro-donations on the Stellar blockchain network.
servers:
- url: /
description: Current server
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-api-key
description: API key passed in the x-api-key header. Obtain via `npm run keys:create`.
schemas:
Error:
type: object
properties:
success:
type: boolean
example: false
error:
type: object
properties:
message:
type: string
example: Validation failed
code:
type: string
example: VALIDATION_ERROR
ValidationError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
properties:
error:
type: object
properties:
code:
type: string
example: VALIDATION_ERROR
message:
type: string
example: Invalid request parameters
details:
type: array
items:
type: object
properties:
field:
type: string
message:
type: string
UnauthorizedError:
type: object
properties:
success:
type: boolean
example: false
error:
type: object
properties:
code:
type: string
example: UNAUTHORIZED
message:
type: string
example: Invalid or missing API key
NotFoundError:
type: object
properties:
success:
type: boolean
example: false
error:
type: object
properties:
code:
type: string
example: NOT_FOUND
message:
type: string
example: Resource not found
PaginationMeta:
type: object
properties:
limit:
type: integer
example: 20
direction:
type: string
enum:
- next
- prev
example: next
next_cursor:
type: string
nullable: true
example: eyJ0aW1lc3RhbXAiOiIyMDI0LTAxLTAxVDAwOjAwOjAwLjAwMFoiLCJpZCI6IjEifQ==
prev_cursor:
type: string
nullable: true
example: null
responses:
Unauthorized:
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedError'
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundError'
ValidationError:
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
security:
- ApiKeyAuth: []
paths:
/donations:
post:
tags:
- Donations
summary: Create a new donation
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- senderSecret
- recipientPublicKey
- amount
properties:
senderSecret:
type: string
description: Stellar secret key of the sender
recipientPublicKey:
type: string
description: Stellar public key of the recipient
amount:
type: number
description: Amount in XLM
memo:
type: string
description: Optional transaction memo
responses:
'201':
description: Donation created successfully
'400':
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Unauthorized
get:
tags:
- Donations
summary: List all donations
security:
- ApiKeyAuth: []
parameters:
- in: query
name: limit
schema:
type: integer
description: Maximum number of results
- in: query
name: cursor
schema:
type: string
description: Pagination cursor
responses:
'200':
description: List of donations
'401':
description: Unauthorized
/donations/{id}:
get:
tags:
- Donations
summary: Get a specific donation
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Donation details
'404':
description: Donation not found
/donations/{id}/status:
patch:
tags:
- Donations
summary: Update donation status
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
enum:
- pending
- completed
- failed
responses:
'200':
description: Status updated
'404':
description: Donation not found
/donations/verify:
post:
tags:
- Donations
summary: Verify a transaction on the blockchain
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- transactionHash
properties:
transactionHash:
type: string
responses:
'200':
description: Verification result
/donations/limits:
get:
tags:
- Donations
summary: Get donation amount limits
security:
- ApiKeyAuth: []
responses:
'200':
description: Donation limits
/donations/recent:
get:
tags:
- Donations
summary: Get recent donations
security:
- ApiKeyAuth: []
parameters:
- in: query
name: limit
schema:
type: integer
default: 10
responses:
'200':
description: Recent donations
/wallets:
post:
tags:
- Wallets
summary: Create wallet metadata
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- publicKey
properties:
publicKey:
type: string
description: Stellar public key
label:
type: string
responses:
'201':
description: Wallet created
'400':
description: Validation error
get:
tags:
- Wallets
summary: List all wallets
security:
- ApiKeyAuth: []
responses:
'200':
description: List of wallets
/wallets/{id}:
get:
tags:
- Wallets
summary: Get a specific wallet
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Wallet details
'404':
description: Wallet not found
patch:
tags:
- Wallets
summary: Update wallet metadata
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
label:
type: string
responses:
'200':
description: Wallet updated
/wallets/{publicKey}/transactions:
get:
tags:
- Wallets
summary: Get all transactions for a wallet
security:
- ApiKeyAuth: []
parameters:
- in: path
name: publicKey
required: true
schema:
type: string
responses:
'200':
description: Transaction list
/stream/create:
post:
tags:
- Stream
summary: Create a recurring donation schedule
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- donorPublicKey
- recipientPublicKey
- amount
- frequency
properties:
donorPublicKey:
type: string
recipientPublicKey:
type: string
amount:
type: number
frequency:
type: string
enum:
- daily
- weekly
- monthly
responses:
'201':
description: Schedule created
'400':
description: Validation error
/stream/schedules:
get:
tags:
- Stream
summary: List all recurring donation schedules
security:
- ApiKeyAuth: []
responses:
'200':
description: List of schedules
/stream/schedules/{id}:
get:
tags:
- Stream
summary: Get a specific schedule
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Schedule details
'404':
description: Schedule not found
delete:
tags:
- Stream
summary: Cancel a recurring donation schedule
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Schedule cancelled
'404':
description: Schedule not found
/transactions:
get:
tags:
- Transactions
summary: Get paginated transactions
security:
- ApiKeyAuth: []
parameters:
- in: query
name: limit
schema:
type: integer
default: 20
- in: query
name: cursor
schema:
type: string
responses:
'200':
description: Paginated transaction list
/transactions/sync:
post:
tags:
- Transactions
summary: Sync wallet transactions from Stellar network
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- publicKey
properties:
publicKey:
type: string
responses:
'200':
description: Sync completed
/transactions/multisig:
post:
tags:
- Transactions
summary: Create a pending multi-sig transaction
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- transaction_xdr
- network_passphrase
- required_signers
- signer_keys
properties:
transaction_xdr:
type: string
network_passphrase:
type: string
required_signers:
type: integer
minimum: 2
signer_keys:
type: array
items:
type: string
responses:
'201':
description: Multi-sig transaction created
/transactions/multisig/collect:
post:
tags:
- Transactions
summary: Collect a signature for a pending multi-sig transaction
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- id
- signer
- signed_xdr
properties:
id:
type: integer
signer:
type: string
signed_xdr:
type: string
responses:
'200':
description: Signature collected; submitted if threshold met
'400':
description: Insufficient signatures
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: object
properties:
code:
type: string
example: INSUFFICIENT_SIGNATURES
required:
type: integer
collected:
type: integer
remaining:
type: integer
/stats/daily:
get:
tags:
- Statistics
summary: Get daily donation statistics
security:
- ApiKeyAuth: []
responses:
'200':
description: Daily stats
/stats/weekly:
get:
tags:
- Statistics
summary: Get weekly donation statistics
security:
- ApiKeyAuth: []
responses:
'200':
description: Weekly stats
/stats/summary:
get:
tags:
- Statistics
summary: Get summary analytics
security:
- ApiKeyAuth: []
responses:
'200':
description: Summary analytics
/stats/donors:
get:
tags:
- Statistics
summary: Get donor statistics
security:
- ApiKeyAuth: []
responses:
'200':
description: Donor stats
/stats/recipients:
get:
tags:
- Statistics
summary: Get recipient statistics
security:
- ApiKeyAuth: []
responses:
'200':
description: Recipient stats
/liquidity-pools/deposit:
post:
tags:
- LiquidityPools
summary: Deposit assets into a Stellar liquidity pool
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- secret
- assetA
- assetB
- maxAmountA
- maxAmountB
properties:
secret:
type: string
description: Source account secret key
assetA:
type: object
description: First asset (e.g. {type:"native"} or {type:"credit_alphanum4",code:"USDC",issuer:"G..."})
assetB:
type: object
description: Second asset
maxAmountA:
type: string
description: Maximum amount of assetA to deposit
maxAmountB:
type: string
description: Maximum amount of assetB to deposit
responses:
'200':
description: Deposit successful
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
poolId:
type: string
sharesReceived:
type: string
transactionId:
type: string
ledger:
type: integer
'400':
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Unauthorized
/liquidity-pools/withdraw:
post:
tags:
- LiquidityPools
summary: Withdraw assets from a Stellar liquidity pool
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- secret
- poolId
- amount
properties:
secret:
type: string
poolId:
type: string
amount:
type: string
description: Number of pool shares to redeem
responses:
'200':
description: Withdrawal successful
'400':
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Unauthorized
/liquidity-pools/{id}/earnings:
get:
tags:
- LiquidityPools
summary: Get earnings for a liquidity pool
security:
- ApiKeyAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: string
description: Pool ID
responses:
'200':
description: Pool earnings
'404':
description: Pool not found
/admin/audit-logs/export:
post:
tags:
- AuditLogExport
summary: Queue an async audit log export job
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
startDate:
type: string
format: date-time
endDate:
type: string
format: date-time
eventType:
type: string
format:
type: string
enum:
- json
- csv
default: json
responses:
'202':
description: Export job queued
'400':
description: Validation error
/admin/audit-logs/export/{jobId}/status:
get:
tags:
- AuditLogExport
summary: Poll export job status
security:
- ApiKeyAuth: []
parameters:
- in: path
name: jobId
required: true
schema:
type: string
responses:
'200':
description: Job status
'404':
description: Job not found
/admin/audit-logs/export/{jobId}/download:
get:
tags:
- AuditLogExport
summary: Get signed download URL for completed export
security:
- ApiKeyAuth: []
parameters:
- in: path
name: jobId
required: true
schema:
type: string
- in: query
name: format
schema:
type: string
enum:
- json
- csv
responses:
'200':
description: Signed download URL
'202':
description: Export not yet complete
'404':
description: Job not found
tags:
- name: Donations
description: Create and manage donations on the Stellar network
- name: Wallets
description: Wallet metadata management
- name: Stream
description: Recurring donation schedules
- name: Transactions
description: Transaction history and synchronization
- name: Statistics
description: Donation analytics and statistics
- name: LiquidityPools
description: Stellar AMM liquidity pool deposit, withdrawal, and earnings
- name: AuditLogExport
description: Compliance audit log export with async jobs and signed URLs