@rpp402/protocol 0.1.3

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.
@@ -0,0 +1,727 @@
1
+ type ChainId = string;
2
+ type WalletAddress = `0x${string}`;
3
+ type DecimalString = string;
4
+ type Timestamp = string;
5
+ /** RPP402-001 §Protocol */
6
+ type AssetRef = {
7
+ type: "stablecoin";
8
+ symbol: string;
9
+ chain_id: ChainId;
10
+ contract: WalletAddress;
11
+ } | {
12
+ type: "tokenized_security";
13
+ symbol: string;
14
+ chain_id: ChainId;
15
+ contract: WalletAddress;
16
+ issuer: string;
17
+ };
18
+ /** RPP402-002 §Protocol */
19
+ interface Money {
20
+ asset: AssetRef;
21
+ amount: DecimalString;
22
+ }
23
+ /** RPP402-001 -Discovery Document */
24
+ interface Capability {
25
+ name: string;
26
+ description: string;
27
+ pricing_summary?: string;
28
+ }
29
+ interface DiscoveryDocument {
30
+ rpp402_version: "1.0";
31
+ service: {
32
+ id: string;
33
+ name: string;
34
+ description: string;
35
+ };
36
+ wallet: {
37
+ address: WalletAddress;
38
+ chain_id: ChainId;
39
+ };
40
+ capabilities: Capability[];
41
+ supported_assets: AssetRef[];
42
+ endpoints: {
43
+ quote: string;
44
+ session: string;
45
+ receipts: string;
46
+ };
47
+ }
48
+ /** RPP402-002 -Quote */
49
+ interface QuoteRequest {
50
+ capability: string;
51
+ params?: Record<string, unknown>;
52
+ settlement_asset: AssetRef;
53
+ agent_wallet: WalletAddress;
54
+ }
55
+ interface Quote {
56
+ rpp402_version: "1.0";
57
+ id: `quote_${string}`;
58
+ service_id: `svc_${string}`;
59
+ capability: string;
60
+ price: Money;
61
+ expires_at: Timestamp;
62
+ created_at: Timestamp;
63
+ }
64
+ /** RPP402-003 -Commerce Session */
65
+ type SessionStatus = "created" | "quoting" | "intent_authorized" | "settling" | "settled" | "receipt_issued" | "expired" | "cancelled" | "failed";
66
+ interface SessionLeg {
67
+ quote_id: `quote_${string}`;
68
+ service_id: `svc_${string}`;
69
+ capability: string;
70
+ price: Money;
71
+ }
72
+ interface CommerceSession {
73
+ rpp402_version: "1.0";
74
+ id: `sess_${string}`;
75
+ agent_wallet: WalletAddress;
76
+ status: SessionStatus;
77
+ legs: SessionLeg[];
78
+ intent_id: `intent_${string}` | null;
79
+ settlement_id: `settle_${string}` | null;
80
+ receipt_id: `rcpt_${string}` | null;
81
+ created_at: Timestamp;
82
+ expires_at: Timestamp;
83
+ }
84
+ /** RPP402-004 -Payment Intent */
85
+ type AmountMode = "fixed_quantity" | "notional_usd";
86
+ type IntentAuthorization = {
87
+ type: "eip712_signature";
88
+ signer: WalletAddress;
89
+ signature: `0x${string}`;
90
+ nonce: string;
91
+ } | {
92
+ type: "agentic_account_delegation";
93
+ account_id: `aa_${string}`;
94
+ delegation_ref: `del_${string}`;
95
+ risk_check?: string;
96
+ };
97
+ type IntentStatus = "pending" | "authorized" | "revoked" | "expired";
98
+ interface PaymentIntent {
99
+ rpp402_version: "1.0";
100
+ id: `intent_${string}`;
101
+ session_id: `sess_${string}`;
102
+ payer_wallet: WalletAddress;
103
+ asset: AssetRef;
104
+ amount_mode: AmountMode | null;
105
+ amount: DecimalString;
106
+ status: IntentStatus;
107
+ authorization: IntentAuthorization;
108
+ created_at: Timestamp;
109
+ expires_at: Timestamp;
110
+ }
111
+ /** RPP402-005 -Settlement */
112
+ type SettlementStatus = "pending" | "submitted" | "confirmed" | "failed";
113
+ interface Transfer {
114
+ from: WalletAddress;
115
+ to: WalletAddress;
116
+ asset: AssetRef;
117
+ amount: DecimalString;
118
+ }
119
+ interface ReferencePrice {
120
+ oracle: string;
121
+ symbol: string;
122
+ price_usd: DecimalString;
123
+ sourced_at: Timestamp;
124
+ }
125
+ interface Settlement {
126
+ rpp402_version: "1.0";
127
+ id: `settle_${string}`;
128
+ intent_id: `intent_${string}`;
129
+ session_id: `sess_${string}`;
130
+ chain_id: ChainId;
131
+ tx_hash: `0x${string}` | null;
132
+ block_number: number | null;
133
+ status: SettlementStatus;
134
+ transfers: Transfer[];
135
+ reference_price: ReferencePrice | null;
136
+ created_at: Timestamp;
137
+ confirmed_at: Timestamp | null;
138
+ }
139
+ /** RPP402-006 -Receipt */
140
+ interface LineItem {
141
+ service_id: `svc_${string}`;
142
+ capability: string;
143
+ quote_id: `quote_${string}`;
144
+ amount: Money;
145
+ }
146
+ interface SettlementRef {
147
+ chain_id: ChainId;
148
+ tx_hash: `0x${string}`;
149
+ block_number: number;
150
+ }
151
+ interface ReceiptSignature {
152
+ algorithm: "eip712";
153
+ signer: WalletAddress;
154
+ signature: `0x${string}`;
155
+ }
156
+ interface Receipt {
157
+ rpp402_version: "1.0";
158
+ id: `rcpt_${string}`;
159
+ session_id: `sess_${string}`;
160
+ settlement_id: `settle_${string}`;
161
+ payer_wallet: WalletAddress;
162
+ line_items: LineItem[];
163
+ total: Money;
164
+ settlement_ref: SettlementRef;
165
+ signature: ReceiptSignature;
166
+ issued_at: Timestamp;
167
+ }
168
+
169
+ declare const schemas: {
170
+ readonly assetRef: {
171
+ $schema: string;
172
+ $id: string;
173
+ title: string;
174
+ type: string;
175
+ required: string[];
176
+ properties: {
177
+ type: {
178
+ type: string;
179
+ enum: string[];
180
+ };
181
+ symbol: {
182
+ type: string;
183
+ };
184
+ chain_id: {
185
+ type: string;
186
+ };
187
+ contract: {
188
+ type: string;
189
+ pattern: string;
190
+ };
191
+ issuer: {
192
+ type: string;
193
+ };
194
+ };
195
+ if: {
196
+ properties: {
197
+ type: {
198
+ const: string;
199
+ };
200
+ };
201
+ };
202
+ then: {
203
+ required: string[];
204
+ };
205
+ };
206
+ readonly discovery: {
207
+ $schema: string;
208
+ $id: string;
209
+ title: string;
210
+ type: string;
211
+ required: string[];
212
+ properties: {
213
+ rpp402_version: {
214
+ type: string;
215
+ const: string;
216
+ };
217
+ service: {
218
+ type: string;
219
+ required: string[];
220
+ properties: {
221
+ id: {
222
+ type: string;
223
+ pattern: string;
224
+ };
225
+ name: {
226
+ type: string;
227
+ minLength: number;
228
+ };
229
+ description: {
230
+ type: string;
231
+ minLength: number;
232
+ };
233
+ };
234
+ };
235
+ wallet: {
236
+ type: string;
237
+ required: string[];
238
+ properties: {
239
+ address: {
240
+ type: string;
241
+ pattern: string;
242
+ };
243
+ chain_id: {
244
+ type: string;
245
+ };
246
+ };
247
+ };
248
+ capabilities: {
249
+ type: string;
250
+ minItems: number;
251
+ items: {
252
+ type: string;
253
+ required: string[];
254
+ properties: {
255
+ name: {
256
+ type: string;
257
+ pattern: string;
258
+ };
259
+ description: {
260
+ type: string;
261
+ };
262
+ pricing_summary: {
263
+ type: string;
264
+ };
265
+ };
266
+ };
267
+ };
268
+ supported_assets: {
269
+ type: string;
270
+ minItems: number;
271
+ items: {
272
+ $ref: string;
273
+ };
274
+ };
275
+ endpoints: {
276
+ type: string;
277
+ required: string[];
278
+ properties: {
279
+ quote: {
280
+ type: string;
281
+ format: string;
282
+ };
283
+ session: {
284
+ type: string;
285
+ format: string;
286
+ };
287
+ receipts: {
288
+ type: string;
289
+ format: string;
290
+ };
291
+ };
292
+ };
293
+ };
294
+ };
295
+ readonly quote: {
296
+ $schema: string;
297
+ $id: string;
298
+ title: string;
299
+ type: string;
300
+ required: string[];
301
+ properties: {
302
+ rpp402_version: {
303
+ type: string;
304
+ const: string;
305
+ };
306
+ id: {
307
+ type: string;
308
+ pattern: string;
309
+ };
310
+ service_id: {
311
+ type: string;
312
+ pattern: string;
313
+ };
314
+ capability: {
315
+ type: string;
316
+ pattern: string;
317
+ };
318
+ price: {
319
+ type: string;
320
+ required: string[];
321
+ properties: {
322
+ asset: {
323
+ $ref: string;
324
+ };
325
+ amount: {
326
+ type: string;
327
+ pattern: string;
328
+ };
329
+ };
330
+ };
331
+ expires_at: {
332
+ type: string;
333
+ format: string;
334
+ };
335
+ created_at: {
336
+ type: string;
337
+ format: string;
338
+ };
339
+ };
340
+ };
341
+ readonly commerceSession: {
342
+ $schema: string;
343
+ $id: string;
344
+ title: string;
345
+ type: string;
346
+ required: string[];
347
+ properties: {
348
+ rpp402_version: {
349
+ type: string;
350
+ const: string;
351
+ };
352
+ id: {
353
+ type: string;
354
+ pattern: string;
355
+ };
356
+ agent_wallet: {
357
+ type: string;
358
+ pattern: string;
359
+ };
360
+ status: {
361
+ type: string;
362
+ enum: string[];
363
+ };
364
+ legs: {
365
+ type: string;
366
+ items: {
367
+ type: string;
368
+ required: string[];
369
+ properties: {
370
+ quote_id: {
371
+ type: string;
372
+ pattern: string;
373
+ };
374
+ service_id: {
375
+ type: string;
376
+ pattern: string;
377
+ };
378
+ capability: {
379
+ type: string;
380
+ };
381
+ price: {
382
+ type: string;
383
+ required: string[];
384
+ properties: {
385
+ asset: {
386
+ $ref: string;
387
+ };
388
+ amount: {
389
+ type: string;
390
+ pattern: string;
391
+ };
392
+ };
393
+ };
394
+ };
395
+ };
396
+ };
397
+ intent_id: {
398
+ type: string[];
399
+ };
400
+ settlement_id: {
401
+ type: string[];
402
+ };
403
+ receipt_id: {
404
+ type: string[];
405
+ };
406
+ created_at: {
407
+ type: string;
408
+ format: string;
409
+ };
410
+ expires_at: {
411
+ type: string;
412
+ format: string;
413
+ };
414
+ };
415
+ };
416
+ readonly paymentIntent: {
417
+ $schema: string;
418
+ $id: string;
419
+ title: string;
420
+ type: string;
421
+ required: string[];
422
+ properties: {
423
+ rpp402_version: {
424
+ type: string;
425
+ const: string;
426
+ };
427
+ id: {
428
+ type: string;
429
+ pattern: string;
430
+ };
431
+ session_id: {
432
+ type: string;
433
+ pattern: string;
434
+ };
435
+ payer_wallet: {
436
+ type: string;
437
+ pattern: string;
438
+ };
439
+ asset: {
440
+ $ref: string;
441
+ };
442
+ amount_mode: {
443
+ type: string[];
444
+ enum: (string | null)[];
445
+ };
446
+ amount: {
447
+ type: string;
448
+ pattern: string;
449
+ };
450
+ status: {
451
+ type: string;
452
+ enum: string[];
453
+ };
454
+ authorization: {
455
+ oneOf: ({
456
+ type: string;
457
+ required: string[];
458
+ properties: {
459
+ type: {
460
+ const: string;
461
+ };
462
+ signer: {
463
+ type: string;
464
+ pattern: string;
465
+ };
466
+ signature: {
467
+ type: string;
468
+ pattern: string;
469
+ };
470
+ nonce: {
471
+ type: string;
472
+ };
473
+ account_id?: never;
474
+ delegation_ref?: never;
475
+ risk_check?: never;
476
+ };
477
+ } | {
478
+ type: string;
479
+ required: string[];
480
+ properties: {
481
+ type: {
482
+ const: string;
483
+ };
484
+ account_id: {
485
+ type: string;
486
+ pattern: string;
487
+ };
488
+ delegation_ref: {
489
+ type: string;
490
+ pattern: string;
491
+ };
492
+ risk_check: {
493
+ type: string;
494
+ };
495
+ signer?: never;
496
+ signature?: never;
497
+ nonce?: never;
498
+ };
499
+ })[];
500
+ };
501
+ created_at: {
502
+ type: string;
503
+ format: string;
504
+ };
505
+ expires_at: {
506
+ type: string;
507
+ format: string;
508
+ };
509
+ };
510
+ if: {
511
+ properties: {
512
+ asset: {
513
+ properties: {
514
+ type: {
515
+ const: string;
516
+ };
517
+ };
518
+ };
519
+ };
520
+ };
521
+ then: {
522
+ required: string[];
523
+ };
524
+ };
525
+ readonly settlement: {
526
+ $schema: string;
527
+ $id: string;
528
+ title: string;
529
+ type: string;
530
+ required: string[];
531
+ properties: {
532
+ rpp402_version: {
533
+ type: string;
534
+ const: string;
535
+ };
536
+ id: {
537
+ type: string;
538
+ pattern: string;
539
+ };
540
+ intent_id: {
541
+ type: string;
542
+ pattern: string;
543
+ };
544
+ session_id: {
545
+ type: string;
546
+ pattern: string;
547
+ };
548
+ chain_id: {
549
+ type: string;
550
+ };
551
+ tx_hash: {
552
+ type: string[];
553
+ pattern: string;
554
+ };
555
+ block_number: {
556
+ type: string[];
557
+ };
558
+ status: {
559
+ type: string;
560
+ enum: string[];
561
+ };
562
+ transfers: {
563
+ type: string;
564
+ minItems: number;
565
+ items: {
566
+ type: string;
567
+ required: string[];
568
+ properties: {
569
+ from: {
570
+ type: string;
571
+ pattern: string;
572
+ };
573
+ to: {
574
+ type: string;
575
+ pattern: string;
576
+ };
577
+ asset: {
578
+ $ref: string;
579
+ };
580
+ amount: {
581
+ type: string;
582
+ pattern: string;
583
+ };
584
+ };
585
+ };
586
+ };
587
+ reference_price: {
588
+ type: string[];
589
+ properties: {
590
+ oracle: {
591
+ type: string;
592
+ };
593
+ symbol: {
594
+ type: string;
595
+ };
596
+ price_usd: {
597
+ type: string;
598
+ };
599
+ sourced_at: {
600
+ type: string;
601
+ format: string;
602
+ };
603
+ };
604
+ };
605
+ created_at: {
606
+ type: string;
607
+ format: string;
608
+ };
609
+ confirmed_at: {
610
+ type: string[];
611
+ format: string;
612
+ };
613
+ };
614
+ };
615
+ readonly receipt: {
616
+ $schema: string;
617
+ $id: string;
618
+ title: string;
619
+ type: string;
620
+ required: string[];
621
+ properties: {
622
+ rpp402_version: {
623
+ type: string;
624
+ const: string;
625
+ };
626
+ id: {
627
+ type: string;
628
+ pattern: string;
629
+ };
630
+ session_id: {
631
+ type: string;
632
+ pattern: string;
633
+ };
634
+ settlement_id: {
635
+ type: string;
636
+ pattern: string;
637
+ };
638
+ payer_wallet: {
639
+ type: string;
640
+ pattern: string;
641
+ };
642
+ line_items: {
643
+ type: string;
644
+ minItems: number;
645
+ items: {
646
+ type: string;
647
+ required: string[];
648
+ properties: {
649
+ service_id: {
650
+ type: string;
651
+ };
652
+ capability: {
653
+ type: string;
654
+ };
655
+ quote_id: {
656
+ type: string;
657
+ };
658
+ amount: {
659
+ type: string;
660
+ required: string[];
661
+ properties: {
662
+ asset: {
663
+ $ref: string;
664
+ };
665
+ amount: {
666
+ type: string;
667
+ };
668
+ };
669
+ };
670
+ };
671
+ };
672
+ };
673
+ total: {
674
+ type: string;
675
+ required: string[];
676
+ properties: {
677
+ asset: {
678
+ $ref: string;
679
+ };
680
+ amount: {
681
+ type: string;
682
+ };
683
+ };
684
+ };
685
+ settlement_ref: {
686
+ type: string;
687
+ required: string[];
688
+ properties: {
689
+ chain_id: {
690
+ type: string;
691
+ };
692
+ tx_hash: {
693
+ type: string;
694
+ pattern: string;
695
+ };
696
+ block_number: {
697
+ type: string;
698
+ };
699
+ };
700
+ };
701
+ signature: {
702
+ type: string;
703
+ required: string[];
704
+ properties: {
705
+ algorithm: {
706
+ const: string;
707
+ };
708
+ signer: {
709
+ type: string;
710
+ pattern: string;
711
+ };
712
+ signature: {
713
+ type: string;
714
+ pattern: string;
715
+ };
716
+ };
717
+ };
718
+ issued_at: {
719
+ type: string;
720
+ format: string;
721
+ };
722
+ };
723
+ };
724
+ };
725
+ declare const RPP_VERSION: "1.0";
726
+
727
+ export { type AmountMode, type AssetRef, type Capability, type ChainId, type CommerceSession, type DecimalString, type DiscoveryDocument, type IntentAuthorization, type IntentStatus, type LineItem, type Money, type PaymentIntent, type Quote, type QuoteRequest, RPP_VERSION, type Receipt, type ReceiptSignature, type ReferencePrice, type SessionLeg, type SessionStatus, type Settlement, type SettlementRef, type SettlementStatus, type Timestamp, type Transfer, type WalletAddress, schemas };