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
651 lines (651 loc) · 17.7 KB
/
Copy pathopenapi.yaml
File metadata and controls
651 lines (651 loc) · 17.7 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
components:
headers:
XRequestID:
description: >-
Unique identifier for the request. Include this in support requests to correlate client activity with server
logs. If you supply a valid UUID v4 in the `X-Request-ID` request header the server echoes it back; otherwise
the server generates one automatically.
schema:
example: 550e8400-e29b-41d4-a716-446655440000
format: uuid
type: string
XSchemaVersion:
description: >-
Request-body schema variant. Accepted values are full semver strings (e.g. "1.0.0", "2.0.0"). An integer
shorthand (e.g. "1") is also accepted and is normalised to "1.0.0" for backward compatibility. Omitting this
header selects the latest stable schema for the endpoint. Supported versions for a given endpoint are listed in
the X-Schema-Version-Supported response header. NOTE: this header governs the request-body schema only — it is
independent of the URL API version (/api/v1). The URL version changes only on breaking (MAJOR) API releases.
schema:
example: 1.0.0
type: string
responses:
NotFound:
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundError'
description: Resource not found
Unauthorized:
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedError'
description: Missing or invalid API key
ValidationError:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
description: Validation error
schemas:
Error:
properties:
error:
properties:
code:
example: VALIDATION_ERROR
type: string
message:
example: Validation failed
type: string
type: object
success:
example: false
type: boolean
type: object
NotFoundError:
properties:
error:
properties:
code:
example: NOT_FOUND
type: string
message:
example: Resource not found
type: string
type: object
success:
example: false
type: boolean
type: object
PaginationMeta:
properties:
direction:
enum:
- next
- prev
example: next
type: string
limit:
example: 20
type: integer
next_cursor:
example: eyJ0aW1lc3RhbXAiOiIyMDI0LTAxLTAxVDAwOjAwOjAwLjAwMFoiLCJpZCI6IjEifQ==
nullable: true
type: string
prev_cursor:
example: null
nullable: true
type: string
type: object
UnauthorizedError:
properties:
error:
properties:
code:
example: UNAUTHORIZED
type: string
message:
example: Invalid or missing API key
type: string
type: object
success:
example: false
type: boolean
type: object
ValidationError:
allOf:
- $ref: '#/components/schemas/Error'
- properties:
error:
properties:
code:
example: VALIDATION_ERROR
type: string
details:
items:
properties:
field:
type: string
message:
type: string
type: object
type: array
message:
example: Invalid request parameters
type: string
type: object
type: object
securitySchemes:
ApiKeyAuth:
description: API key passed in the x-api-key header. Obtain via `npm run keys:create`.
in: header
name: x-api-key
type: apiKey
info:
description: API for managing micro-donations on the Stellar blockchain network.
title: Stellar Micro-Donation API
version: 1.0.0
openapi: 3.1.0
paths:
/admin/audit-logs/export:
post:
requestBody:
content:
application/json:
schema:
properties:
endDate:
format: date-time
type: string
eventType:
type: string
format:
default: json
enum:
- json
- csv
type: string
startDate:
format: date-time
type: string
type: object
required: true
responses:
'202':
description: Export job queued
'400':
description: Validation error
security:
- ApiKeyAuth: []
summary: Queue an async audit log export job
tags:
- AuditLogExport
/admin/audit-logs/export/{jobId}/download:
get:
parameters:
- in: path
name: jobId
required: true
schema:
type: string
- in: query
name: format
schema:
enum:
- json
- csv
type: string
responses:
'200':
description: Signed download URL
'202':
description: Export not yet complete
'404':
description: Job not found
security:
- ApiKeyAuth: []
summary: Get signed download URL for completed export
tags:
- AuditLogExport
/admin/audit-logs/export/{jobId}/status:
get:
parameters:
- in: path
name: jobId
required: true
schema:
type: string
responses:
'200':
description: Job status
'404':
description: Job not found
security:
- ApiKeyAuth: []
summary: Poll export job status
tags:
- AuditLogExport
/donations/{id}/approve:
post:
description: >
Donations above the configured MULTISIG_THRESHOLD_XLM are created with status `awaiting_approval` instead of
being submitted immediately. Each call records one signer's approval; once the required number of distinct
signers have approved, the donation is submitted to Stellar automatically. Requires the `donations:approve`
permission (granted to the `signer` and `admin` roles).
parameters:
- in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
signerKeyId:
description: Identifier of the approving signer (e.g. their Stellar public key)
type: string
required:
- signerKeyId
type: object
required: true
responses:
'200':
description: Approval recorded (and donation submitted if fully approved)
'400':
description: Validation error (missing signerKeyId, duplicate approval)
'403':
description: Caller lacks the donations:approve permission
'404':
description: Donation not found
'422':
description: Donation is not currently awaiting approval, or the approval window has expired
security:
- ApiKeyAuth: []
summary: Record a multi-signer approval for a high-value donation (#1498)
tags:
- Donations
/liquidity-pools/deposit:
post:
requestBody:
content:
application/json:
schema:
properties:
assetA:
description: First asset (e.g. {type:"native"} or {type:"credit_alphanum4",code:"USDC",issuer:"G..."})
type: object
assetB:
description: Second asset
type: object
maxAmountA:
description: Maximum amount of assetA to deposit
type: string
maxAmountB:
description: Maximum amount of assetB to deposit
type: string
secret:
description: Source account secret key
type: string
required:
- secret
- assetA
- assetB
- maxAmountA
- maxAmountB
type: object
required: true
responses:
'200':
content:
application/json:
schema:
properties:
data:
properties:
ledger:
type: integer
poolId:
type: string
sharesReceived:
type: string
transactionId:
type: string
type: object
success:
type: boolean
type: object
description: Deposit successful
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Validation error
'401':
description: Unauthorized
security:
- ApiKeyAuth: []
summary: Deposit assets into a Stellar liquidity pool
tags:
- LiquidityPools
/liquidity-pools/withdraw:
post:
requestBody:
content:
application/json:
schema:
properties:
amount:
description: Number of pool shares to redeem
type: string
poolId:
type: string
secret:
type: string
required:
- secret
- poolId
- amount
type: object
required: true
responses:
'200':
description: Withdrawal successful
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Validation error
'401':
description: Unauthorized
security:
- ApiKeyAuth: []
summary: Withdraw assets from a Stellar liquidity pool
tags:
- LiquidityPools
/liquidity-pools/{id}/earnings:
get:
parameters:
- description: Pool ID
in: path
name: id
required: true
schema:
type: string
responses:
'200':
description: Pool earnings
'404':
description: Pool not found
security:
- ApiKeyAuth: []
summary: Get earnings for a liquidity pool
tags:
- LiquidityPools
/stats/daily:
get:
responses:
'200':
description: Daily stats
security:
- ApiKeyAuth: []
summary: Get daily donation statistics
tags:
- Statistics
/stats/donors:
get:
responses:
'200':
description: Donor stats
security:
- ApiKeyAuth: []
summary: Get donor statistics
tags:
- Statistics
/stats/recipients:
get:
responses:
'200':
description: Recipient stats
security:
- ApiKeyAuth: []
summary: Get recipient statistics
tags:
- Statistics
/stats/summary:
get:
responses:
'200':
description: Summary analytics
security:
- ApiKeyAuth: []
summary: Get summary analytics
tags:
- Statistics
/stats/weekly:
get:
responses:
'200':
description: Weekly stats
security:
- ApiKeyAuth: []
summary: Get weekly donation statistics
tags:
- Statistics
/stream/create:
post:
requestBody:
content:
application/json:
schema:
properties:
amount:
type: number
donorPublicKey:
type: string
frequency:
enum:
- daily
- weekly
- monthly
type: string
recipientPublicKey:
type: string
required:
- donorPublicKey
- recipientPublicKey
- amount
- frequency
type: object
required: true
responses:
'201':
description: Schedule created
'400':
description: Validation error
security:
- ApiKeyAuth: []
summary: Create a recurring donation schedule
tags:
- Stream
/stream/schedules:
get:
responses:
'200':
description: List of schedules
security:
- ApiKeyAuth: []
summary: List all recurring donation schedules
tags:
- Stream
/stream/schedules/{id}:
delete:
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Schedule cancelled
'404':
description: Schedule not found
security:
- ApiKeyAuth: []
summary: Cancel a recurring donation schedule
tags:
- Stream
get:
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
'200':
description: Schedule details
'404':
description: Schedule not found
security:
- ApiKeyAuth: []
summary: Get a specific schedule
tags:
- Stream
/transactions:
get:
parameters:
- in: query
name: limit
schema:
default: 20
type: integer
- in: query
name: cursor
schema:
type: string
responses:
'200':
description: Paginated transaction list
security:
- ApiKeyAuth: []
summary: Get paginated transactions
tags:
- Transactions
/transactions/multisig:
post:
requestBody:
content:
application/json:
schema:
properties:
network_passphrase:
type: string
required_signers:
minimum: 2
type: integer
signer_keys:
items:
type: string
type: array
transaction_xdr:
type: string
required:
- transaction_xdr
- network_passphrase
- required_signers
- signer_keys
type: object
required: true
responses:
'201':
description: Multi-sig transaction created
security:
- ApiKeyAuth: []
summary: Create a pending multi-sig transaction
tags:
- Transactions
/transactions/multisig/collect:
post:
requestBody:
content:
application/json:
schema:
properties:
id:
type: integer
signed_xdr:
type: string
signer:
type: string
required:
- id
- signer
- signed_xdr
type: object
required: true
responses:
'200':
description: Signature collected; submitted if threshold met
'400':
content:
application/json:
schema:
properties:
error:
properties:
code:
example: INSUFFICIENT_SIGNATURES
type: string
collected:
type: integer
remaining:
type: integer
required:
type: integer
type: object
success:
example: false
type: boolean
type: object
description: Insufficient signatures
security:
- ApiKeyAuth: []
summary: Collect a signature for a pending multi-sig transaction
tags:
- Transactions
/transactions/sync:
post:
requestBody:
content:
application/json:
schema:
properties:
publicKey:
type: string
required:
- publicKey
type: object
required: true
responses:
'200':
description: Sync completed
security:
- ApiKeyAuth: []
summary: Sync wallet transactions from Stellar network
tags:
- Transactions
security:
- ApiKeyAuth: []
servers:
- description: Current server
url: /
tags:
- description: Create and manage donations on the Stellar network
name: Donations
- description: Recurring donation schedules
name: Stream
- description: Transaction history and synchronization
name: Transactions
- description: Donation analytics and statistics
name: Statistics
- description: Stellar AMM liquidity pool deposit, withdrawal, and earnings
name: LiquidityPools
- description: Compliance audit log export with async jobs and signed URLs
name: AuditLogExport