@brainai/satp-client 2.0.6 → 2.0.8

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,972 @@
1
+ {
2
+ "address": "HXCUWKR2NvRcZ7rNAJHwPcH6QAAWaLR4bRFbfyuDND6C",
3
+ "metadata": {
4
+ "name": "escrow_v3",
5
+ "version": "0.1.0",
6
+ "spec": "0.1.0",
7
+ "description": "SATP V3 Escrow — Identity-verified on-chain escrow for agent transactions"
8
+ },
9
+ "docs": [
10
+ "SATP V3 Escrow Program",
11
+ "",
12
+ "Identity-verified on-chain escrow for agent transactions.",
13
+ "Requires both client and agent to have SATP V3 Genesis Records.",
14
+ "",
15
+ "Upgrade over satp-escrow V1:",
16
+ "- CPI to identity_v3 — verifies agent has on-chain identity",
17
+ "- Minimum trust tier enforcement (optional per escrow)",
18
+ "- Agent \"born\" requirement (optional — can require burn-to-become)",
19
+ "- Configurable arbiter (third-party, not client-as-arbiter)",
20
+ "- Escrow fee support (percentage to protocol treasury)",
21
+ "- Milestone-based partial releases",
22
+ "",
23
+ "Security model:",
24
+ "- PDA seeds include client + agent_id_hash + nonce → unique per job",
25
+ "- Agent identity verified via Genesis Record PDA derivation",
26
+ "- Authority checks on all state transitions",
27
+ "- Deadline enforcement with grace period for disputes"
28
+ ],
29
+ "instructions": [
30
+ {
31
+ "name": "create_escrow",
32
+ "docs": [
33
+ "Create an escrow between a client and a verified SATP V3 agent.",
34
+ "",
35
+ "The instruction verifies the agent's Genesis Record exists on-chain",
36
+ "by checking the `identity_account` PDA derivation matches the expected",
37
+ "seeds. Optionally enforces minimum reputation and verification level.",
38
+ "",
39
+ "# Arguments",
40
+ "* `agent_id` - The agent's string identifier (used for PDA derivation)",
41
+ "* `amount` - Lamports to escrow",
42
+ "* `description_hash` - SHA256 of job description (for uniqueness + audit)",
43
+ "* `deadline` - Unix timestamp deadline for work submission",
44
+ "* `nonce` - Unique nonce (allows multiple escrows between same parties)",
45
+ "* `min_verification_level` - Minimum required verification level (0-5, 0 = no requirement)",
46
+ "* `require_born` - If true, agent must have completed burn-to-become"
47
+ ],
48
+ "discriminator": [
49
+ 253,
50
+ 215,
51
+ 165,
52
+ 116,
53
+ 36,
54
+ 108,
55
+ 68,
56
+ 80
57
+ ],
58
+ "accounts": [
59
+ {
60
+ "name": "client",
61
+ "writable": true,
62
+ "signer": true
63
+ },
64
+ {
65
+ "name": "agent_wallet",
66
+ "docs": [
67
+ "The agent's wallet that will receive funds"
68
+ ]
69
+ },
70
+ {
71
+ "name": "agent_identity",
72
+ "docs": [
73
+ "The agent's SATP V3 Genesis Record"
74
+ ]
75
+ },
76
+ {
77
+ "name": "arbiter",
78
+ "docs": [
79
+ "Arbiter for dispute resolution — must be a third party (not client or agent)"
80
+ ]
81
+ },
82
+ {
83
+ "name": "escrow",
84
+ "writable": true
85
+ },
86
+ {
87
+ "name": "system_program"
88
+ }
89
+ ],
90
+ "args": [
91
+ {
92
+ "name": "agent_id",
93
+ "type": "string"
94
+ },
95
+ {
96
+ "name": "amount",
97
+ "type": "u64"
98
+ },
99
+ {
100
+ "name": "description_hash",
101
+ "type": {
102
+ "array": [
103
+ "u8",
104
+ 32
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "name": "deadline",
110
+ "type": "i64"
111
+ },
112
+ {
113
+ "name": "nonce",
114
+ "type": "u64"
115
+ },
116
+ {
117
+ "name": "min_verification_level",
118
+ "type": "u8"
119
+ },
120
+ {
121
+ "name": "require_born",
122
+ "type": "bool"
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "name": "create_usdc_escrow",
128
+ "docs": [
129
+ "Create an escrow funded with USDC/SPL tokens.",
130
+ "",
131
+ "The vault must be the associated token account for the escrow PDA and",
132
+ "USDC mint. Clients are expected to include an idempotent ATA creation",
133
+ "instruction before this instruction when the vault may not exist."
134
+ ],
135
+ "discriminator": [
136
+ 90,
137
+ 241,
138
+ 187,
139
+ 228,
140
+ 185,
141
+ 194,
142
+ 187,
143
+ 152
144
+ ],
145
+ "accounts": [
146
+ {
147
+ "name": "client",
148
+ "writable": true,
149
+ "signer": true
150
+ },
151
+ {
152
+ "name": "agent_wallet"
153
+ },
154
+ {
155
+ "name": "agent_identity"
156
+ },
157
+ {
158
+ "name": "arbiter"
159
+ },
160
+ {
161
+ "name": "escrow",
162
+ "writable": true
163
+ },
164
+ {
165
+ "name": "usdc_mint"
166
+ },
167
+ {
168
+ "name": "client_usdc_account",
169
+ "writable": true
170
+ },
171
+ {
172
+ "name": "vault_usdc_account",
173
+ "writable": true
174
+ },
175
+ {
176
+ "name": "token_program"
177
+ },
178
+ {
179
+ "name": "system_program"
180
+ }
181
+ ],
182
+ "args": [
183
+ {
184
+ "name": "agent_id",
185
+ "type": "string"
186
+ },
187
+ {
188
+ "name": "amount",
189
+ "type": "u64"
190
+ },
191
+ {
192
+ "name": "description_hash",
193
+ "type": {
194
+ "array": [
195
+ "u8",
196
+ 32
197
+ ]
198
+ }
199
+ },
200
+ {
201
+ "name": "deadline",
202
+ "type": "i64"
203
+ },
204
+ {
205
+ "name": "nonce",
206
+ "type": "u64"
207
+ },
208
+ {
209
+ "name": "min_verification_level",
210
+ "type": "u8"
211
+ },
212
+ {
213
+ "name": "require_born",
214
+ "type": "bool"
215
+ },
216
+ {
217
+ "name": "token_decimals",
218
+ "type": "u8"
219
+ }
220
+ ]
221
+ },
222
+ {
223
+ "name": "submit_work",
224
+ "docs": [
225
+ "Agent submits work proof. Only callable before deadline."
226
+ ],
227
+ "discriminator": [
228
+ 158,
229
+ 80,
230
+ 101,
231
+ 51,
232
+ 114,
233
+ 130,
234
+ 101,
235
+ 253
236
+ ],
237
+ "accounts": [
238
+ {
239
+ "name": "escrow",
240
+ "writable": true
241
+ },
242
+ {
243
+ "name": "agent",
244
+ "signer": true
245
+ }
246
+ ],
247
+ "args": [
248
+ {
249
+ "name": "work_hash",
250
+ "type": {
251
+ "array": [
252
+ "u8",
253
+ 32
254
+ ]
255
+ }
256
+ }
257
+ ]
258
+ },
259
+ {
260
+ "name": "release",
261
+ "docs": [
262
+ "Client releases full remaining funds to agent.",
263
+ "Allowed in Active or WorkSubmitted status."
264
+ ],
265
+ "discriminator": [
266
+ 253,
267
+ 249,
268
+ 15,
269
+ 206,
270
+ 28,
271
+ 127,
272
+ 193,
273
+ 241
274
+ ],
275
+ "accounts": [
276
+ {
277
+ "name": "escrow",
278
+ "writable": true
279
+ },
280
+ {
281
+ "name": "client",
282
+ "signer": true
283
+ },
284
+ {
285
+ "name": "agent",
286
+ "writable": true
287
+ }
288
+ ],
289
+ "args": []
290
+ },
291
+ {
292
+ "name": "release_usdc",
293
+ "docs": [
294
+ "Client releases full remaining USDC/SPL funds to agent."
295
+ ],
296
+ "discriminator": [
297
+ 18,
298
+ 122,
299
+ 66,
300
+ 80,
301
+ 106,
302
+ 106,
303
+ 191,
304
+ 167
305
+ ],
306
+ "accounts": [
307
+ {
308
+ "name": "escrow",
309
+ "writable": true
310
+ },
311
+ {
312
+ "name": "client",
313
+ "signer": true
314
+ },
315
+ {
316
+ "name": "agent"
317
+ },
318
+ {
319
+ "name": "usdc_mint"
320
+ },
321
+ {
322
+ "name": "vault_usdc_account",
323
+ "writable": true
324
+ },
325
+ {
326
+ "name": "agent_usdc_account",
327
+ "writable": true
328
+ },
329
+ {
330
+ "name": "token_program"
331
+ }
332
+ ],
333
+ "args": []
334
+ },
335
+ {
336
+ "name": "partial_release",
337
+ "docs": [
338
+ "Client releases a partial amount (milestone payment).",
339
+ "Escrow stays Active until fully released or cancelled."
340
+ ],
341
+ "discriminator": [
342
+ 20,
343
+ 4,
344
+ 101,
345
+ 245,
346
+ 53,
347
+ 131,
348
+ 213,
349
+ 8
350
+ ],
351
+ "accounts": [
352
+ {
353
+ "name": "escrow",
354
+ "writable": true
355
+ },
356
+ {
357
+ "name": "client",
358
+ "signer": true
359
+ },
360
+ {
361
+ "name": "agent",
362
+ "writable": true
363
+ }
364
+ ],
365
+ "args": [
366
+ {
367
+ "name": "amount",
368
+ "type": "u64"
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ "name": "partial_release_usdc",
374
+ "docs": [
375
+ "Client releases a partial USDC/SPL amount."
376
+ ],
377
+ "discriminator": [
378
+ 96,
379
+ 50,
380
+ 106,
381
+ 239,
382
+ 190,
383
+ 153,
384
+ 153,
385
+ 106
386
+ ],
387
+ "accounts": [
388
+ {
389
+ "name": "escrow",
390
+ "writable": true
391
+ },
392
+ {
393
+ "name": "client",
394
+ "signer": true
395
+ },
396
+ {
397
+ "name": "agent"
398
+ },
399
+ {
400
+ "name": "usdc_mint"
401
+ },
402
+ {
403
+ "name": "vault_usdc_account",
404
+ "writable": true
405
+ },
406
+ {
407
+ "name": "agent_usdc_account",
408
+ "writable": true
409
+ },
410
+ {
411
+ "name": "token_program"
412
+ }
413
+ ],
414
+ "args": [
415
+ {
416
+ "name": "amount",
417
+ "type": "u64"
418
+ }
419
+ ]
420
+ },
421
+ {
422
+ "name": "cancel",
423
+ "docs": [
424
+ "Client cancels escrow and gets refund of unreleased funds.",
425
+ "Only if deadline passed AND status is Active (no work submitted)."
426
+ ],
427
+ "discriminator": [
428
+ 232,
429
+ 219,
430
+ 223,
431
+ 41,
432
+ 219,
433
+ 236,
434
+ 220,
435
+ 190
436
+ ],
437
+ "accounts": [
438
+ {
439
+ "name": "escrow",
440
+ "writable": true
441
+ },
442
+ {
443
+ "name": "client",
444
+ "writable": true,
445
+ "signer": true
446
+ }
447
+ ],
448
+ "args": []
449
+ },
450
+ {
451
+ "name": "cancel_usdc",
452
+ "docs": [
453
+ "Client cancels USDC/SPL escrow and gets refund of unreleased funds."
454
+ ],
455
+ "discriminator": [
456
+ 25,
457
+ 132,
458
+ 227,
459
+ 232,
460
+ 60,
461
+ 46,
462
+ 9,
463
+ 217
464
+ ],
465
+ "accounts": [
466
+ {
467
+ "name": "escrow",
468
+ "writable": true
469
+ },
470
+ {
471
+ "name": "client",
472
+ "writable": true,
473
+ "signer": true
474
+ },
475
+ {
476
+ "name": "usdc_mint"
477
+ },
478
+ {
479
+ "name": "vault_usdc_account",
480
+ "writable": true
481
+ },
482
+ {
483
+ "name": "client_usdc_account",
484
+ "writable": true
485
+ },
486
+ {
487
+ "name": "token_program"
488
+ }
489
+ ],
490
+ "args": []
491
+ },
492
+ {
493
+ "name": "raise_dispute",
494
+ "docs": [
495
+ "Either client or agent raises a dispute. Only when work has been submitted."
496
+ ],
497
+ "discriminator": [
498
+ 41,
499
+ 243,
500
+ 1,
501
+ 51,
502
+ 150,
503
+ 95,
504
+ 246,
505
+ 73
506
+ ],
507
+ "accounts": [
508
+ {
509
+ "name": "escrow",
510
+ "writable": true
511
+ },
512
+ {
513
+ "name": "signer",
514
+ "signer": true
515
+ }
516
+ ],
517
+ "args": [
518
+ {
519
+ "name": "reason_hash",
520
+ "type": {
521
+ "array": [
522
+ "u8",
523
+ 32
524
+ ]
525
+ }
526
+ }
527
+ ]
528
+ },
529
+ {
530
+ "name": "resolve_dispute",
531
+ "docs": [
532
+ "Arbiter resolves dispute. Can split funds between agent and client.",
533
+ "",
534
+ "# Arguments",
535
+ "* `agent_amount` - Lamports to release to agent",
536
+ "* `client_amount` - Lamports to refund to client",
537
+ "",
538
+ "agent_amount + client_amount must equal remaining escrowed funds."
539
+ ],
540
+ "discriminator": [
541
+ 231,
542
+ 6,
543
+ 202,
544
+ 6,
545
+ 96,
546
+ 103,
547
+ 12,
548
+ 230
549
+ ],
550
+ "accounts": [
551
+ {
552
+ "name": "escrow",
553
+ "writable": true
554
+ },
555
+ {
556
+ "name": "arbiter",
557
+ "signer": true
558
+ },
559
+ {
560
+ "name": "agent",
561
+ "writable": true
562
+ },
563
+ {
564
+ "name": "client_wallet",
565
+ "writable": true
566
+ }
567
+ ],
568
+ "args": [
569
+ {
570
+ "name": "agent_amount",
571
+ "type": "u64"
572
+ },
573
+ {
574
+ "name": "client_amount",
575
+ "type": "u64"
576
+ }
577
+ ]
578
+ },
579
+ {
580
+ "name": "resolve_dispute_usdc",
581
+ "docs": [
582
+ "Arbiter resolves USDC/SPL dispute. Split must equal remaining vault funds."
583
+ ],
584
+ "discriminator": [
585
+ 103,
586
+ 249,
587
+ 11,
588
+ 83,
589
+ 254,
590
+ 225,
591
+ 114,
592
+ 0
593
+ ],
594
+ "accounts": [
595
+ {
596
+ "name": "escrow",
597
+ "writable": true
598
+ },
599
+ {
600
+ "name": "arbiter",
601
+ "signer": true
602
+ },
603
+ {
604
+ "name": "agent"
605
+ },
606
+ {
607
+ "name": "client_wallet"
608
+ },
609
+ {
610
+ "name": "usdc_mint"
611
+ },
612
+ {
613
+ "name": "vault_usdc_account",
614
+ "writable": true
615
+ },
616
+ {
617
+ "name": "agent_usdc_account",
618
+ "writable": true
619
+ },
620
+ {
621
+ "name": "client_usdc_account",
622
+ "writable": true
623
+ },
624
+ {
625
+ "name": "token_program"
626
+ }
627
+ ],
628
+ "args": [
629
+ {
630
+ "name": "agent_amount",
631
+ "type": "u64"
632
+ },
633
+ {
634
+ "name": "client_amount",
635
+ "type": "u64"
636
+ }
637
+ ]
638
+ },
639
+ {
640
+ "name": "extend_deadline",
641
+ "docs": [
642
+ "Client extends the escrow deadline. Only when Active.",
643
+ "New deadline must be strictly after the current deadline."
644
+ ],
645
+ "discriminator": [
646
+ 18,
647
+ 209,
648
+ 27,
649
+ 175,
650
+ 87,
651
+ 13,
652
+ 213,
653
+ 188
654
+ ],
655
+ "accounts": [
656
+ {
657
+ "name": "escrow",
658
+ "writable": true
659
+ },
660
+ {
661
+ "name": "client",
662
+ "signer": true
663
+ }
664
+ ],
665
+ "args": [
666
+ {
667
+ "name": "new_deadline",
668
+ "type": "i64"
669
+ }
670
+ ]
671
+ },
672
+ {
673
+ "name": "close_escrow",
674
+ "docs": [
675
+ "Close a settled escrow account. Returns rent to client.",
676
+ "Only when Released, Cancelled, or Resolved."
677
+ ],
678
+ "discriminator": [
679
+ 139,
680
+ 171,
681
+ 94,
682
+ 146,
683
+ 191,
684
+ 91,
685
+ 144,
686
+ 50
687
+ ],
688
+ "accounts": [
689
+ {
690
+ "name": "escrow",
691
+ "writable": true
692
+ },
693
+ {
694
+ "name": "client",
695
+ "writable": true,
696
+ "signer": true
697
+ }
698
+ ],
699
+ "args": []
700
+ }
701
+ ],
702
+ "accounts": [
703
+ {
704
+ "name": "escrow_v3::EscrowV3",
705
+ "discriminator": [
706
+ 145,
707
+ 108,
708
+ 37,
709
+ 52,
710
+ 197,
711
+ 162,
712
+ 232,
713
+ 59
714
+ ]
715
+ }
716
+ ],
717
+ "types": [
718
+ {
719
+ "name": "escrow_v3::EscrowCurrency",
720
+ "type": {
721
+ "kind": "enum",
722
+ "variants": [
723
+ {
724
+ "name": "Sol"
725
+ },
726
+ {
727
+ "name": "Usdc"
728
+ }
729
+ ]
730
+ }
731
+ },
732
+ {
733
+ "name": "escrow_v3::EscrowStatus",
734
+ "type": {
735
+ "kind": "enum",
736
+ "variants": [
737
+ {
738
+ "name": "Active"
739
+ },
740
+ {
741
+ "name": "WorkSubmitted"
742
+ },
743
+ {
744
+ "name": "Released"
745
+ },
746
+ {
747
+ "name": "Cancelled"
748
+ },
749
+ {
750
+ "name": "Disputed"
751
+ },
752
+ {
753
+ "name": "Resolved"
754
+ }
755
+ ]
756
+ }
757
+ },
758
+ {
759
+ "name": "escrow_v3::EscrowV3",
760
+ "type": {
761
+ "kind": "struct",
762
+ "fields": [
763
+ {
764
+ "name": "client",
765
+ "docs": [
766
+ "Client who created the escrow"
767
+ ],
768
+ "type": "pubkey"
769
+ },
770
+ {
771
+ "name": "agent",
772
+ "docs": [
773
+ "Agent wallet that receives funds"
774
+ ],
775
+ "type": "pubkey"
776
+ },
777
+ {
778
+ "name": "agent_id_hash",
779
+ "docs": [
780
+ "SHA-256 of agent_id (links to Genesis Record)"
781
+ ],
782
+ "type": {
783
+ "array": [
784
+ "u8",
785
+ 32
786
+ ]
787
+ }
788
+ },
789
+ {
790
+ "name": "amount",
791
+ "docs": [
792
+ "Total escrowed amount in lamports"
793
+ ],
794
+ "type": "u64"
795
+ },
796
+ {
797
+ "name": "released_amount",
798
+ "docs": [
799
+ "Amount already released (for partial/milestone releases)"
800
+ ],
801
+ "type": "u64"
802
+ },
803
+ {
804
+ "name": "description_hash",
805
+ "docs": [
806
+ "SHA-256 of job description"
807
+ ],
808
+ "type": {
809
+ "array": [
810
+ "u8",
811
+ 32
812
+ ]
813
+ }
814
+ },
815
+ {
816
+ "name": "deadline",
817
+ "docs": [
818
+ "Deadline for work submission (Unix timestamp)"
819
+ ],
820
+ "type": "i64"
821
+ },
822
+ {
823
+ "name": "nonce",
824
+ "docs": [
825
+ "Nonce for uniqueness (same client+agent can have multiple escrows)"
826
+ ],
827
+ "type": "u64"
828
+ },
829
+ {
830
+ "name": "currency",
831
+ "docs": [
832
+ "Escrow funding currency."
833
+ ],
834
+ "type": {
835
+ "defined": {
836
+ "name": "escrow_v3::EscrowCurrency"
837
+ }
838
+ }
839
+ },
840
+ {
841
+ "name": "token_mint",
842
+ "docs": [
843
+ "SPL mint used for token-funded escrow; None for SOL."
844
+ ],
845
+ "type": {
846
+ "option": "pubkey"
847
+ }
848
+ },
849
+ {
850
+ "name": "token_vault",
851
+ "docs": [
852
+ "SPL vault ATA controlled by the escrow PDA; None for SOL."
853
+ ],
854
+ "type": {
855
+ "option": "pubkey"
856
+ }
857
+ },
858
+ {
859
+ "name": "token_decimals",
860
+ "docs": [
861
+ "SPL mint decimals used by transfer_checked; None for SOL."
862
+ ],
863
+ "type": {
864
+ "option": "u8"
865
+ }
866
+ },
867
+ {
868
+ "name": "status",
869
+ "docs": [
870
+ "Current escrow status"
871
+ ],
872
+ "type": {
873
+ "defined": {
874
+ "name": "escrow_v3::EscrowStatus"
875
+ }
876
+ }
877
+ },
878
+ {
879
+ "name": "min_verification_level",
880
+ "docs": [
881
+ "Minimum verification level required at creation"
882
+ ],
883
+ "type": "u8"
884
+ },
885
+ {
886
+ "name": "require_born",
887
+ "docs": [
888
+ "Whether born status was required at creation"
889
+ ],
890
+ "type": "bool"
891
+ },
892
+ {
893
+ "name": "created_at",
894
+ "docs": [
895
+ "Creation timestamp"
896
+ ],
897
+ "type": "i64"
898
+ },
899
+ {
900
+ "name": "arbiter",
901
+ "docs": [
902
+ "Designated arbiter for dispute resolution"
903
+ ],
904
+ "type": "pubkey"
905
+ },
906
+ {
907
+ "name": "work_hash",
908
+ "docs": [
909
+ "Work proof hash (set on submit_work)"
910
+ ],
911
+ "type": {
912
+ "option": {
913
+ "array": [
914
+ "u8",
915
+ 32
916
+ ]
917
+ }
918
+ }
919
+ },
920
+ {
921
+ "name": "work_submitted_at",
922
+ "docs": [
923
+ "When work was submitted"
924
+ ],
925
+ "type": {
926
+ "option": "i64"
927
+ }
928
+ },
929
+ {
930
+ "name": "dispute_reason_hash",
931
+ "docs": [
932
+ "Dispute reason hash (set on raise_dispute)"
933
+ ],
934
+ "type": {
935
+ "option": {
936
+ "array": [
937
+ "u8",
938
+ 32
939
+ ]
940
+ }
941
+ }
942
+ },
943
+ {
944
+ "name": "disputed_at",
945
+ "docs": [
946
+ "When dispute was raised"
947
+ ],
948
+ "type": {
949
+ "option": "i64"
950
+ }
951
+ },
952
+ {
953
+ "name": "disputed_by",
954
+ "docs": [
955
+ "Who raised the dispute"
956
+ ],
957
+ "type": {
958
+ "option": "pubkey"
959
+ }
960
+ },
961
+ {
962
+ "name": "bump",
963
+ "docs": [
964
+ "PDA bump seed"
965
+ ],
966
+ "type": "u8"
967
+ }
968
+ ]
969
+ }
970
+ }
971
+ ]
972
+ }