killswitch-agentkit 0.0.0-stage → 0.1.1

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.
package/dist/index.js ADDED
@@ -0,0 +1,2412 @@
1
+ // packages/agentkit/src/index.ts
2
+ import { ActionProvider, ViemWalletProvider } from "@coinbase/agentkit";
3
+ import { z } from "zod";
4
+ import { createWalletClient, http as http2 } from "viem";
5
+ import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
6
+
7
+ // packages/sdk/index.ts
8
+ import {
9
+ createPublicClient,
10
+ encodeFunctionData as encodeFunctionData2,
11
+ formatUnits as formatUnits2,
12
+ http,
13
+ parseUnits,
14
+ toHex
15
+ } from "viem";
16
+ import { privateKeyToAccount } from "viem/accounts";
17
+
18
+ // shared/abi.ts
19
+ var KillswitchAccountAbi = [
20
+ {
21
+ "type": "constructor",
22
+ "inputs": [
23
+ {
24
+ "name": "owner_",
25
+ "type": "address",
26
+ "internalType": "address"
27
+ },
28
+ {
29
+ "name": "guardian_",
30
+ "type": "address",
31
+ "internalType": "address"
32
+ }
33
+ ],
34
+ "stateMutability": "nonpayable"
35
+ },
36
+ {
37
+ "type": "receive",
38
+ "stateMutability": "payable"
39
+ },
40
+ {
41
+ "type": "function",
42
+ "name": "MAX_AUTHORIZATION_TTL",
43
+ "inputs": [],
44
+ "outputs": [
45
+ {
46
+ "name": "",
47
+ "type": "uint256",
48
+ "internalType": "uint256"
49
+ }
50
+ ],
51
+ "stateMutability": "view"
52
+ },
53
+ {
54
+ "type": "function",
55
+ "name": "MAX_LIMITS",
56
+ "inputs": [],
57
+ "outputs": [
58
+ {
59
+ "name": "",
60
+ "type": "uint256",
61
+ "internalType": "uint256"
62
+ }
63
+ ],
64
+ "stateMutability": "view"
65
+ },
66
+ {
67
+ "type": "function",
68
+ "name": "MAX_RULES",
69
+ "inputs": [],
70
+ "outputs": [
71
+ {
72
+ "name": "",
73
+ "type": "uint256",
74
+ "internalType": "uint256"
75
+ }
76
+ ],
77
+ "stateMutability": "view"
78
+ },
79
+ {
80
+ "type": "function",
81
+ "name": "OP_TYPEHASH",
82
+ "inputs": [],
83
+ "outputs": [
84
+ {
85
+ "name": "",
86
+ "type": "bytes32",
87
+ "internalType": "bytes32"
88
+ }
89
+ ],
90
+ "stateMutability": "view"
91
+ },
92
+ {
93
+ "type": "function",
94
+ "name": "agentIds",
95
+ "inputs": [],
96
+ "outputs": [
97
+ {
98
+ "name": "",
99
+ "type": "bytes32[]",
100
+ "internalType": "bytes32[]"
101
+ }
102
+ ],
103
+ "stateMutability": "view"
104
+ },
105
+ {
106
+ "type": "function",
107
+ "name": "authorizationDigest",
108
+ "inputs": [
109
+ {
110
+ "name": "token",
111
+ "type": "address",
112
+ "internalType": "address"
113
+ },
114
+ {
115
+ "name": "to",
116
+ "type": "address",
117
+ "internalType": "address"
118
+ },
119
+ {
120
+ "name": "value",
121
+ "type": "uint256",
122
+ "internalType": "uint256"
123
+ },
124
+ {
125
+ "name": "validAfter",
126
+ "type": "uint256",
127
+ "internalType": "uint256"
128
+ },
129
+ {
130
+ "name": "validBefore",
131
+ "type": "uint256",
132
+ "internalType": "uint256"
133
+ },
134
+ {
135
+ "name": "nonce",
136
+ "type": "bytes32",
137
+ "internalType": "bytes32"
138
+ }
139
+ ],
140
+ "outputs": [
141
+ {
142
+ "name": "",
143
+ "type": "bytes32",
144
+ "internalType": "bytes32"
145
+ }
146
+ ],
147
+ "stateMutability": "view"
148
+ },
149
+ {
150
+ "type": "function",
151
+ "name": "authorizeTransfer",
152
+ "inputs": [
153
+ {
154
+ "name": "",
155
+ "type": "address",
156
+ "internalType": "address"
157
+ },
158
+ {
159
+ "name": "",
160
+ "type": "address",
161
+ "internalType": "address"
162
+ },
163
+ {
164
+ "name": "",
165
+ "type": "uint256",
166
+ "internalType": "uint256"
167
+ },
168
+ {
169
+ "name": "",
170
+ "type": "uint256",
171
+ "internalType": "uint256"
172
+ },
173
+ {
174
+ "name": "",
175
+ "type": "uint256",
176
+ "internalType": "uint256"
177
+ },
178
+ {
179
+ "name": "",
180
+ "type": "bytes32",
181
+ "internalType": "bytes32"
182
+ }
183
+ ],
184
+ "outputs": [],
185
+ "stateMutability": "pure"
186
+ },
187
+ {
188
+ "type": "function",
189
+ "name": "eip712Domain",
190
+ "inputs": [],
191
+ "outputs": [
192
+ {
193
+ "name": "fields",
194
+ "type": "bytes1",
195
+ "internalType": "bytes1"
196
+ },
197
+ {
198
+ "name": "name",
199
+ "type": "string",
200
+ "internalType": "string"
201
+ },
202
+ {
203
+ "name": "version",
204
+ "type": "string",
205
+ "internalType": "string"
206
+ },
207
+ {
208
+ "name": "chainId",
209
+ "type": "uint256",
210
+ "internalType": "uint256"
211
+ },
212
+ {
213
+ "name": "verifyingContract",
214
+ "type": "address",
215
+ "internalType": "address"
216
+ },
217
+ {
218
+ "name": "salt",
219
+ "type": "bytes32",
220
+ "internalType": "bytes32"
221
+ },
222
+ {
223
+ "name": "extensions",
224
+ "type": "uint256[]",
225
+ "internalType": "uint256[]"
226
+ }
227
+ ],
228
+ "stateMutability": "view"
229
+ },
230
+ {
231
+ "type": "function",
232
+ "name": "epoch",
233
+ "inputs": [],
234
+ "outputs": [
235
+ {
236
+ "name": "",
237
+ "type": "uint64",
238
+ "internalType": "uint64"
239
+ }
240
+ ],
241
+ "stateMutability": "view"
242
+ },
243
+ {
244
+ "type": "function",
245
+ "name": "execute",
246
+ "inputs": [
247
+ {
248
+ "name": "calls",
249
+ "type": "tuple[]",
250
+ "internalType": "struct KillswitchAccount.Call[]",
251
+ "components": [
252
+ {
253
+ "name": "target",
254
+ "type": "address",
255
+ "internalType": "address"
256
+ },
257
+ {
258
+ "name": "value",
259
+ "type": "uint256",
260
+ "internalType": "uint256"
261
+ },
262
+ {
263
+ "name": "data",
264
+ "type": "bytes",
265
+ "internalType": "bytes"
266
+ }
267
+ ]
268
+ }
269
+ ],
270
+ "outputs": [],
271
+ "stateMutability": "nonpayable"
272
+ },
273
+ {
274
+ "type": "function",
275
+ "name": "executeAsAgent",
276
+ "inputs": [
277
+ {
278
+ "name": "agentId",
279
+ "type": "bytes32",
280
+ "internalType": "bytes32"
281
+ },
282
+ {
283
+ "name": "calls",
284
+ "type": "tuple[]",
285
+ "internalType": "struct KillswitchAccount.Call[]",
286
+ "components": [
287
+ {
288
+ "name": "target",
289
+ "type": "address",
290
+ "internalType": "address"
291
+ },
292
+ {
293
+ "name": "value",
294
+ "type": "uint256",
295
+ "internalType": "uint256"
296
+ },
297
+ {
298
+ "name": "data",
299
+ "type": "bytes",
300
+ "internalType": "bytes"
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ "name": "deadline",
306
+ "type": "uint256",
307
+ "internalType": "uint256"
308
+ },
309
+ {
310
+ "name": "agentSig",
311
+ "type": "bytes",
312
+ "internalType": "bytes"
313
+ },
314
+ {
315
+ "name": "guardianSig",
316
+ "type": "bytes",
317
+ "internalType": "bytes"
318
+ }
319
+ ],
320
+ "outputs": [
321
+ {
322
+ "name": "outflows",
323
+ "type": "uint256[]",
324
+ "internalType": "uint256[]"
325
+ }
326
+ ],
327
+ "stateMutability": "nonpayable"
328
+ },
329
+ {
330
+ "type": "function",
331
+ "name": "getAgent",
332
+ "inputs": [
333
+ {
334
+ "name": "agentId",
335
+ "type": "bytes32",
336
+ "internalType": "bytes32"
337
+ }
338
+ ],
339
+ "outputs": [
340
+ {
341
+ "name": "a",
342
+ "type": "tuple",
343
+ "internalType": "struct KillswitchAccount.Agent",
344
+ "components": [
345
+ {
346
+ "name": "sessionKey",
347
+ "type": "address",
348
+ "internalType": "address"
349
+ },
350
+ {
351
+ "name": "validUntil",
352
+ "type": "uint48",
353
+ "internalType": "uint48"
354
+ },
355
+ {
356
+ "name": "epoch",
357
+ "type": "uint64",
358
+ "internalType": "uint64"
359
+ },
360
+ {
361
+ "name": "nonce",
362
+ "type": "uint64",
363
+ "internalType": "uint64"
364
+ },
365
+ {
366
+ "name": "paused",
367
+ "type": "bool",
368
+ "internalType": "bool"
369
+ },
370
+ {
371
+ "name": "exists",
372
+ "type": "bool",
373
+ "internalType": "bool"
374
+ }
375
+ ]
376
+ },
377
+ {
378
+ "name": "active",
379
+ "type": "bool",
380
+ "internalType": "bool"
381
+ }
382
+ ],
383
+ "stateMutability": "view"
384
+ },
385
+ {
386
+ "type": "function",
387
+ "name": "getLimits",
388
+ "inputs": [
389
+ {
390
+ "name": "agentId",
391
+ "type": "bytes32",
392
+ "internalType": "bytes32"
393
+ }
394
+ ],
395
+ "outputs": [
396
+ {
397
+ "name": "",
398
+ "type": "tuple[]",
399
+ "internalType": "struct KillswitchAccount.SpendLimit[]",
400
+ "components": [
401
+ {
402
+ "name": "token",
403
+ "type": "address",
404
+ "internalType": "address"
405
+ },
406
+ {
407
+ "name": "maxPerPeriod",
408
+ "type": "uint128",
409
+ "internalType": "uint128"
410
+ },
411
+ {
412
+ "name": "cosignAbove",
413
+ "type": "uint128",
414
+ "internalType": "uint128"
415
+ },
416
+ {
417
+ "name": "period",
418
+ "type": "uint32",
419
+ "internalType": "uint32"
420
+ }
421
+ ]
422
+ }
423
+ ],
424
+ "stateMutability": "view"
425
+ },
426
+ {
427
+ "type": "function",
428
+ "name": "getRules",
429
+ "inputs": [
430
+ {
431
+ "name": "agentId",
432
+ "type": "bytes32",
433
+ "internalType": "bytes32"
434
+ }
435
+ ],
436
+ "outputs": [
437
+ {
438
+ "name": "",
439
+ "type": "tuple[]",
440
+ "internalType": "struct KillswitchAccount.CallRule[]",
441
+ "components": [
442
+ {
443
+ "name": "target",
444
+ "type": "address",
445
+ "internalType": "address"
446
+ },
447
+ {
448
+ "name": "selector",
449
+ "type": "bytes4",
450
+ "internalType": "bytes4"
451
+ }
452
+ ]
453
+ }
454
+ ],
455
+ "stateMutability": "view"
456
+ },
457
+ {
458
+ "type": "function",
459
+ "name": "grant",
460
+ "inputs": [
461
+ {
462
+ "name": "agentId",
463
+ "type": "bytes32",
464
+ "internalType": "bytes32"
465
+ },
466
+ {
467
+ "name": "label",
468
+ "type": "string",
469
+ "internalType": "string"
470
+ },
471
+ {
472
+ "name": "sessionKey",
473
+ "type": "address",
474
+ "internalType": "address"
475
+ },
476
+ {
477
+ "name": "validUntil",
478
+ "type": "uint48",
479
+ "internalType": "uint48"
480
+ },
481
+ {
482
+ "name": "rules",
483
+ "type": "tuple[]",
484
+ "internalType": "struct KillswitchAccount.CallRule[]",
485
+ "components": [
486
+ {
487
+ "name": "target",
488
+ "type": "address",
489
+ "internalType": "address"
490
+ },
491
+ {
492
+ "name": "selector",
493
+ "type": "bytes4",
494
+ "internalType": "bytes4"
495
+ }
496
+ ]
497
+ },
498
+ {
499
+ "name": "limits",
500
+ "type": "tuple[]",
501
+ "internalType": "struct KillswitchAccount.SpendLimit[]",
502
+ "components": [
503
+ {
504
+ "name": "token",
505
+ "type": "address",
506
+ "internalType": "address"
507
+ },
508
+ {
509
+ "name": "maxPerPeriod",
510
+ "type": "uint128",
511
+ "internalType": "uint128"
512
+ },
513
+ {
514
+ "name": "cosignAbove",
515
+ "type": "uint128",
516
+ "internalType": "uint128"
517
+ },
518
+ {
519
+ "name": "period",
520
+ "type": "uint32",
521
+ "internalType": "uint32"
522
+ }
523
+ ]
524
+ }
525
+ ],
526
+ "outputs": [],
527
+ "stateMutability": "nonpayable"
528
+ },
529
+ {
530
+ "type": "function",
531
+ "name": "guardian",
532
+ "inputs": [],
533
+ "outputs": [
534
+ {
535
+ "name": "",
536
+ "type": "address",
537
+ "internalType": "address"
538
+ }
539
+ ],
540
+ "stateMutability": "view"
541
+ },
542
+ {
543
+ "type": "function",
544
+ "name": "isValidSignature",
545
+ "inputs": [
546
+ {
547
+ "name": "hash",
548
+ "type": "bytes32",
549
+ "internalType": "bytes32"
550
+ },
551
+ {
552
+ "name": "",
553
+ "type": "bytes",
554
+ "internalType": "bytes"
555
+ }
556
+ ],
557
+ "outputs": [
558
+ {
559
+ "name": "",
560
+ "type": "bytes4",
561
+ "internalType": "bytes4"
562
+ }
563
+ ],
564
+ "stateMutability": "view"
565
+ },
566
+ {
567
+ "type": "function",
568
+ "name": "killAll",
569
+ "inputs": [],
570
+ "outputs": [],
571
+ "stateMutability": "nonpayable"
572
+ },
573
+ {
574
+ "type": "function",
575
+ "name": "opDigest",
576
+ "inputs": [
577
+ {
578
+ "name": "agentId",
579
+ "type": "bytes32",
580
+ "internalType": "bytes32"
581
+ },
582
+ {
583
+ "name": "calls",
584
+ "type": "tuple[]",
585
+ "internalType": "struct KillswitchAccount.Call[]",
586
+ "components": [
587
+ {
588
+ "name": "target",
589
+ "type": "address",
590
+ "internalType": "address"
591
+ },
592
+ {
593
+ "name": "value",
594
+ "type": "uint256",
595
+ "internalType": "uint256"
596
+ },
597
+ {
598
+ "name": "data",
599
+ "type": "bytes",
600
+ "internalType": "bytes"
601
+ }
602
+ ]
603
+ },
604
+ {
605
+ "name": "nonce",
606
+ "type": "uint256",
607
+ "internalType": "uint256"
608
+ },
609
+ {
610
+ "name": "deadline",
611
+ "type": "uint256",
612
+ "internalType": "uint256"
613
+ }
614
+ ],
615
+ "outputs": [
616
+ {
617
+ "name": "",
618
+ "type": "bytes32",
619
+ "internalType": "bytes32"
620
+ }
621
+ ],
622
+ "stateMutability": "view"
623
+ },
624
+ {
625
+ "type": "function",
626
+ "name": "owner",
627
+ "inputs": [],
628
+ "outputs": [
629
+ {
630
+ "name": "",
631
+ "type": "address",
632
+ "internalType": "address"
633
+ }
634
+ ],
635
+ "stateMutability": "view"
636
+ },
637
+ {
638
+ "type": "function",
639
+ "name": "pause",
640
+ "inputs": [
641
+ {
642
+ "name": "agentId",
643
+ "type": "bytes32",
644
+ "internalType": "bytes32"
645
+ }
646
+ ],
647
+ "outputs": [],
648
+ "stateMutability": "nonpayable"
649
+ },
650
+ {
651
+ "type": "function",
652
+ "name": "revoke",
653
+ "inputs": [
654
+ {
655
+ "name": "agentId",
656
+ "type": "bytes32",
657
+ "internalType": "bytes32"
658
+ }
659
+ ],
660
+ "outputs": [],
661
+ "stateMutability": "nonpayable"
662
+ },
663
+ {
664
+ "type": "function",
665
+ "name": "setGuardian",
666
+ "inputs": [
667
+ {
668
+ "name": "guardian_",
669
+ "type": "address",
670
+ "internalType": "address"
671
+ }
672
+ ],
673
+ "outputs": [],
674
+ "stateMutability": "nonpayable"
675
+ },
676
+ {
677
+ "type": "function",
678
+ "name": "simulate",
679
+ "inputs": [
680
+ {
681
+ "name": "agentId",
682
+ "type": "bytes32",
683
+ "internalType": "bytes32"
684
+ },
685
+ {
686
+ "name": "calls",
687
+ "type": "tuple[]",
688
+ "internalType": "struct KillswitchAccount.Call[]",
689
+ "components": [
690
+ {
691
+ "name": "target",
692
+ "type": "address",
693
+ "internalType": "address"
694
+ },
695
+ {
696
+ "name": "value",
697
+ "type": "uint256",
698
+ "internalType": "uint256"
699
+ },
700
+ {
701
+ "name": "data",
702
+ "type": "bytes",
703
+ "internalType": "bytes"
704
+ }
705
+ ]
706
+ }
707
+ ],
708
+ "outputs": [],
709
+ "stateMutability": "nonpayable"
710
+ },
711
+ {
712
+ "type": "function",
713
+ "name": "spent",
714
+ "inputs": [
715
+ {
716
+ "name": "agentId",
717
+ "type": "bytes32",
718
+ "internalType": "bytes32"
719
+ },
720
+ {
721
+ "name": "token",
722
+ "type": "address",
723
+ "internalType": "address"
724
+ }
725
+ ],
726
+ "outputs": [
727
+ {
728
+ "name": "used",
729
+ "type": "uint256",
730
+ "internalType": "uint256"
731
+ },
732
+ {
733
+ "name": "max",
734
+ "type": "uint256",
735
+ "internalType": "uint256"
736
+ },
737
+ {
738
+ "name": "resetsAt",
739
+ "type": "uint256",
740
+ "internalType": "uint256"
741
+ }
742
+ ],
743
+ "stateMutability": "view"
744
+ },
745
+ {
746
+ "type": "function",
747
+ "name": "unpause",
748
+ "inputs": [
749
+ {
750
+ "name": "agentId",
751
+ "type": "bytes32",
752
+ "internalType": "bytes32"
753
+ }
754
+ ],
755
+ "outputs": [],
756
+ "stateMutability": "nonpayable"
757
+ },
758
+ {
759
+ "type": "event",
760
+ "name": "AgentExecuted",
761
+ "inputs": [
762
+ {
763
+ "name": "agentId",
764
+ "type": "bytes32",
765
+ "indexed": true,
766
+ "internalType": "bytes32"
767
+ },
768
+ {
769
+ "name": "nonce",
770
+ "type": "uint64",
771
+ "indexed": false,
772
+ "internalType": "uint64"
773
+ },
774
+ {
775
+ "name": "submitter",
776
+ "type": "address",
777
+ "indexed": false,
778
+ "internalType": "address"
779
+ },
780
+ {
781
+ "name": "cosigned",
782
+ "type": "bool",
783
+ "indexed": false,
784
+ "internalType": "bool"
785
+ },
786
+ {
787
+ "name": "outflows",
788
+ "type": "uint256[]",
789
+ "indexed": false,
790
+ "internalType": "uint256[]"
791
+ }
792
+ ],
793
+ "anonymous": false
794
+ },
795
+ {
796
+ "type": "event",
797
+ "name": "AgentGranted",
798
+ "inputs": [
799
+ {
800
+ "name": "agentId",
801
+ "type": "bytes32",
802
+ "indexed": true,
803
+ "internalType": "bytes32"
804
+ },
805
+ {
806
+ "name": "sessionKey",
807
+ "type": "address",
808
+ "indexed": false,
809
+ "internalType": "address"
810
+ },
811
+ {
812
+ "name": "validUntil",
813
+ "type": "uint48",
814
+ "indexed": false,
815
+ "internalType": "uint48"
816
+ },
817
+ {
818
+ "name": "label",
819
+ "type": "string",
820
+ "indexed": false,
821
+ "internalType": "string"
822
+ }
823
+ ],
824
+ "anonymous": false
825
+ },
826
+ {
827
+ "type": "event",
828
+ "name": "AgentPaused",
829
+ "inputs": [
830
+ {
831
+ "name": "agentId",
832
+ "type": "bytes32",
833
+ "indexed": true,
834
+ "internalType": "bytes32"
835
+ },
836
+ {
837
+ "name": "by",
838
+ "type": "address",
839
+ "indexed": false,
840
+ "internalType": "address"
841
+ }
842
+ ],
843
+ "anonymous": false
844
+ },
845
+ {
846
+ "type": "event",
847
+ "name": "AgentRevoked",
848
+ "inputs": [
849
+ {
850
+ "name": "agentId",
851
+ "type": "bytes32",
852
+ "indexed": true,
853
+ "internalType": "bytes32"
854
+ }
855
+ ],
856
+ "anonymous": false
857
+ },
858
+ {
859
+ "type": "event",
860
+ "name": "AgentUnpaused",
861
+ "inputs": [
862
+ {
863
+ "name": "agentId",
864
+ "type": "bytes32",
865
+ "indexed": true,
866
+ "internalType": "bytes32"
867
+ }
868
+ ],
869
+ "anonymous": false
870
+ },
871
+ {
872
+ "type": "event",
873
+ "name": "EIP712DomainChanged",
874
+ "inputs": [],
875
+ "anonymous": false
876
+ },
877
+ {
878
+ "type": "event",
879
+ "name": "GuardianChanged",
880
+ "inputs": [
881
+ {
882
+ "name": "guardian",
883
+ "type": "address",
884
+ "indexed": false,
885
+ "internalType": "address"
886
+ }
887
+ ],
888
+ "anonymous": false
889
+ },
890
+ {
891
+ "type": "event",
892
+ "name": "KilledAll",
893
+ "inputs": [
894
+ {
895
+ "name": "newEpoch",
896
+ "type": "uint64",
897
+ "indexed": false,
898
+ "internalType": "uint64"
899
+ }
900
+ ],
901
+ "anonymous": false
902
+ },
903
+ {
904
+ "type": "event",
905
+ "name": "OwnerExecuted",
906
+ "inputs": [
907
+ {
908
+ "name": "calls",
909
+ "type": "uint256",
910
+ "indexed": false,
911
+ "internalType": "uint256"
912
+ }
913
+ ],
914
+ "anonymous": false
915
+ },
916
+ {
917
+ "type": "event",
918
+ "name": "TransferAuthorized",
919
+ "inputs": [
920
+ {
921
+ "name": "agentId",
922
+ "type": "bytes32",
923
+ "indexed": true,
924
+ "internalType": "bytes32"
925
+ },
926
+ {
927
+ "name": "token",
928
+ "type": "address",
929
+ "indexed": true,
930
+ "internalType": "address"
931
+ },
932
+ {
933
+ "name": "to",
934
+ "type": "address",
935
+ "indexed": true,
936
+ "internalType": "address"
937
+ },
938
+ {
939
+ "name": "value",
940
+ "type": "uint256",
941
+ "indexed": false,
942
+ "internalType": "uint256"
943
+ },
944
+ {
945
+ "name": "validBefore",
946
+ "type": "uint256",
947
+ "indexed": false,
948
+ "internalType": "uint256"
949
+ },
950
+ {
951
+ "name": "nonce",
952
+ "type": "bytes32",
953
+ "indexed": false,
954
+ "internalType": "bytes32"
955
+ },
956
+ {
957
+ "name": "digest",
958
+ "type": "bytes32",
959
+ "indexed": false,
960
+ "internalType": "bytes32"
961
+ }
962
+ ],
963
+ "anonymous": false
964
+ },
965
+ {
966
+ "type": "error",
967
+ "name": "AgentIsPaused",
968
+ "inputs": []
969
+ },
970
+ {
971
+ "type": "error",
972
+ "name": "AgentKilled",
973
+ "inputs": []
974
+ },
975
+ {
976
+ "type": "error",
977
+ "name": "AgentOnly",
978
+ "inputs": []
979
+ },
980
+ {
981
+ "type": "error",
982
+ "name": "AuthorizationWindow",
983
+ "inputs": []
984
+ },
985
+ {
986
+ "type": "error",
987
+ "name": "BadAgentSignature",
988
+ "inputs": []
989
+ },
990
+ {
991
+ "type": "error",
992
+ "name": "BadGuardianSignature",
993
+ "inputs": []
994
+ },
995
+ {
996
+ "type": "error",
997
+ "name": "BadPeriod",
998
+ "inputs": []
999
+ },
1000
+ {
1001
+ "type": "error",
1002
+ "name": "CallFailed",
1003
+ "inputs": [
1004
+ {
1005
+ "name": "index",
1006
+ "type": "uint256",
1007
+ "internalType": "uint256"
1008
+ },
1009
+ {
1010
+ "name": "reason",
1011
+ "type": "bytes",
1012
+ "internalType": "bytes"
1013
+ }
1014
+ ]
1015
+ },
1016
+ {
1017
+ "type": "error",
1018
+ "name": "CallNotAllowed",
1019
+ "inputs": [
1020
+ {
1021
+ "name": "target",
1022
+ "type": "address",
1023
+ "internalType": "address"
1024
+ },
1025
+ {
1026
+ "name": "selector",
1027
+ "type": "bytes4",
1028
+ "internalType": "bytes4"
1029
+ }
1030
+ ]
1031
+ },
1032
+ {
1033
+ "type": "error",
1034
+ "name": "CapExceeded",
1035
+ "inputs": [
1036
+ {
1037
+ "name": "token",
1038
+ "type": "address",
1039
+ "internalType": "address"
1040
+ },
1041
+ {
1042
+ "name": "used",
1043
+ "type": "uint256",
1044
+ "internalType": "uint256"
1045
+ },
1046
+ {
1047
+ "name": "max",
1048
+ "type": "uint256",
1049
+ "internalType": "uint256"
1050
+ }
1051
+ ]
1052
+ },
1053
+ {
1054
+ "type": "error",
1055
+ "name": "CosignRequired",
1056
+ "inputs": [
1057
+ {
1058
+ "name": "token",
1059
+ "type": "address",
1060
+ "internalType": "address"
1061
+ },
1062
+ {
1063
+ "name": "outflow",
1064
+ "type": "uint256",
1065
+ "internalType": "uint256"
1066
+ },
1067
+ {
1068
+ "name": "threshold",
1069
+ "type": "uint256",
1070
+ "internalType": "uint256"
1071
+ }
1072
+ ]
1073
+ },
1074
+ {
1075
+ "type": "error",
1076
+ "name": "DanglingAllowance",
1077
+ "inputs": [
1078
+ {
1079
+ "name": "token",
1080
+ "type": "address",
1081
+ "internalType": "address"
1082
+ },
1083
+ {
1084
+ "name": "spender",
1085
+ "type": "address",
1086
+ "internalType": "address"
1087
+ }
1088
+ ]
1089
+ },
1090
+ {
1091
+ "type": "error",
1092
+ "name": "DeadlinePassed",
1093
+ "inputs": []
1094
+ },
1095
+ {
1096
+ "type": "error",
1097
+ "name": "ECDSAInvalidSignature",
1098
+ "inputs": []
1099
+ },
1100
+ {
1101
+ "type": "error",
1102
+ "name": "ECDSAInvalidSignatureLength",
1103
+ "inputs": [
1104
+ {
1105
+ "name": "length",
1106
+ "type": "uint256",
1107
+ "internalType": "uint256"
1108
+ }
1109
+ ]
1110
+ },
1111
+ {
1112
+ "type": "error",
1113
+ "name": "ECDSAInvalidSignatureS",
1114
+ "inputs": [
1115
+ {
1116
+ "name": "s",
1117
+ "type": "bytes32",
1118
+ "internalType": "bytes32"
1119
+ }
1120
+ ]
1121
+ },
1122
+ {
1123
+ "type": "error",
1124
+ "name": "InvalidShortString",
1125
+ "inputs": []
1126
+ },
1127
+ {
1128
+ "type": "error",
1129
+ "name": "NativeValueNotAllowed",
1130
+ "inputs": []
1131
+ },
1132
+ {
1133
+ "type": "error",
1134
+ "name": "NotOwner",
1135
+ "inputs": []
1136
+ },
1137
+ {
1138
+ "type": "error",
1139
+ "name": "NotOwnerOrGuardian",
1140
+ "inputs": []
1141
+ },
1142
+ {
1143
+ "type": "error",
1144
+ "name": "PermissionExpired",
1145
+ "inputs": []
1146
+ },
1147
+ {
1148
+ "type": "error",
1149
+ "name": "Reentrancy",
1150
+ "inputs": []
1151
+ },
1152
+ {
1153
+ "type": "error",
1154
+ "name": "SelfCallForbidden",
1155
+ "inputs": []
1156
+ },
1157
+ {
1158
+ "type": "error",
1159
+ "name": "SimulationResult",
1160
+ "inputs": [
1161
+ {
1162
+ "name": "outflows",
1163
+ "type": "uint256[]",
1164
+ "internalType": "uint256[]"
1165
+ }
1166
+ ]
1167
+ },
1168
+ {
1169
+ "type": "error",
1170
+ "name": "SpenderNotAllowed",
1171
+ "inputs": [
1172
+ {
1173
+ "name": "token",
1174
+ "type": "address",
1175
+ "internalType": "address"
1176
+ },
1177
+ {
1178
+ "name": "spender",
1179
+ "type": "address",
1180
+ "internalType": "address"
1181
+ }
1182
+ ]
1183
+ },
1184
+ {
1185
+ "type": "error",
1186
+ "name": "StringTooLong",
1187
+ "inputs": [
1188
+ {
1189
+ "name": "str",
1190
+ "type": "string",
1191
+ "internalType": "string"
1192
+ }
1193
+ ]
1194
+ },
1195
+ {
1196
+ "type": "error",
1197
+ "name": "TokenDomainMismatch",
1198
+ "inputs": [
1199
+ {
1200
+ "name": "token",
1201
+ "type": "address",
1202
+ "internalType": "address"
1203
+ }
1204
+ ]
1205
+ },
1206
+ {
1207
+ "type": "error",
1208
+ "name": "TooMany",
1209
+ "inputs": []
1210
+ },
1211
+ {
1212
+ "type": "error",
1213
+ "name": "UncappedTokenRule",
1214
+ "inputs": [
1215
+ {
1216
+ "name": "token",
1217
+ "type": "address",
1218
+ "internalType": "address"
1219
+ }
1220
+ ]
1221
+ },
1222
+ {
1223
+ "type": "error",
1224
+ "name": "UnknownAgent",
1225
+ "inputs": []
1226
+ }
1227
+ ];
1228
+ var MockERC20Abi = [
1229
+ {
1230
+ "type": "constructor",
1231
+ "inputs": [
1232
+ {
1233
+ "name": "name_",
1234
+ "type": "string",
1235
+ "internalType": "string"
1236
+ },
1237
+ {
1238
+ "name": "symbol_",
1239
+ "type": "string",
1240
+ "internalType": "string"
1241
+ },
1242
+ {
1243
+ "name": "decimals_",
1244
+ "type": "uint8",
1245
+ "internalType": "uint8"
1246
+ }
1247
+ ],
1248
+ "stateMutability": "nonpayable"
1249
+ },
1250
+ {
1251
+ "type": "function",
1252
+ "name": "DOMAIN_SEPARATOR",
1253
+ "inputs": [],
1254
+ "outputs": [
1255
+ {
1256
+ "name": "",
1257
+ "type": "bytes32",
1258
+ "internalType": "bytes32"
1259
+ }
1260
+ ],
1261
+ "stateMutability": "view"
1262
+ },
1263
+ {
1264
+ "type": "function",
1265
+ "name": "TRANSFER_WITH_AUTHORIZATION_TYPEHASH",
1266
+ "inputs": [],
1267
+ "outputs": [
1268
+ {
1269
+ "name": "",
1270
+ "type": "bytes32",
1271
+ "internalType": "bytes32"
1272
+ }
1273
+ ],
1274
+ "stateMutability": "view"
1275
+ },
1276
+ {
1277
+ "type": "function",
1278
+ "name": "allowance",
1279
+ "inputs": [
1280
+ {
1281
+ "name": "owner",
1282
+ "type": "address",
1283
+ "internalType": "address"
1284
+ },
1285
+ {
1286
+ "name": "spender",
1287
+ "type": "address",
1288
+ "internalType": "address"
1289
+ }
1290
+ ],
1291
+ "outputs": [
1292
+ {
1293
+ "name": "",
1294
+ "type": "uint256",
1295
+ "internalType": "uint256"
1296
+ }
1297
+ ],
1298
+ "stateMutability": "view"
1299
+ },
1300
+ {
1301
+ "type": "function",
1302
+ "name": "approve",
1303
+ "inputs": [
1304
+ {
1305
+ "name": "spender",
1306
+ "type": "address",
1307
+ "internalType": "address"
1308
+ },
1309
+ {
1310
+ "name": "value",
1311
+ "type": "uint256",
1312
+ "internalType": "uint256"
1313
+ }
1314
+ ],
1315
+ "outputs": [
1316
+ {
1317
+ "name": "",
1318
+ "type": "bool",
1319
+ "internalType": "bool"
1320
+ }
1321
+ ],
1322
+ "stateMutability": "nonpayable"
1323
+ },
1324
+ {
1325
+ "type": "function",
1326
+ "name": "authorizationState",
1327
+ "inputs": [
1328
+ {
1329
+ "name": "",
1330
+ "type": "address",
1331
+ "internalType": "address"
1332
+ },
1333
+ {
1334
+ "name": "",
1335
+ "type": "bytes32",
1336
+ "internalType": "bytes32"
1337
+ }
1338
+ ],
1339
+ "outputs": [
1340
+ {
1341
+ "name": "",
1342
+ "type": "bool",
1343
+ "internalType": "bool"
1344
+ }
1345
+ ],
1346
+ "stateMutability": "view"
1347
+ },
1348
+ {
1349
+ "type": "function",
1350
+ "name": "balanceOf",
1351
+ "inputs": [
1352
+ {
1353
+ "name": "account",
1354
+ "type": "address",
1355
+ "internalType": "address"
1356
+ }
1357
+ ],
1358
+ "outputs": [
1359
+ {
1360
+ "name": "",
1361
+ "type": "uint256",
1362
+ "internalType": "uint256"
1363
+ }
1364
+ ],
1365
+ "stateMutability": "view"
1366
+ },
1367
+ {
1368
+ "type": "function",
1369
+ "name": "decimals",
1370
+ "inputs": [],
1371
+ "outputs": [
1372
+ {
1373
+ "name": "",
1374
+ "type": "uint8",
1375
+ "internalType": "uint8"
1376
+ }
1377
+ ],
1378
+ "stateMutability": "view"
1379
+ },
1380
+ {
1381
+ "type": "function",
1382
+ "name": "eip712Domain",
1383
+ "inputs": [],
1384
+ "outputs": [
1385
+ {
1386
+ "name": "fields",
1387
+ "type": "bytes1",
1388
+ "internalType": "bytes1"
1389
+ },
1390
+ {
1391
+ "name": "name",
1392
+ "type": "string",
1393
+ "internalType": "string"
1394
+ },
1395
+ {
1396
+ "name": "version",
1397
+ "type": "string",
1398
+ "internalType": "string"
1399
+ },
1400
+ {
1401
+ "name": "chainId",
1402
+ "type": "uint256",
1403
+ "internalType": "uint256"
1404
+ },
1405
+ {
1406
+ "name": "verifyingContract",
1407
+ "type": "address",
1408
+ "internalType": "address"
1409
+ },
1410
+ {
1411
+ "name": "salt",
1412
+ "type": "bytes32",
1413
+ "internalType": "bytes32"
1414
+ },
1415
+ {
1416
+ "name": "extensions",
1417
+ "type": "uint256[]",
1418
+ "internalType": "uint256[]"
1419
+ }
1420
+ ],
1421
+ "stateMutability": "view"
1422
+ },
1423
+ {
1424
+ "type": "function",
1425
+ "name": "mint",
1426
+ "inputs": [
1427
+ {
1428
+ "name": "to",
1429
+ "type": "address",
1430
+ "internalType": "address"
1431
+ },
1432
+ {
1433
+ "name": "amount",
1434
+ "type": "uint256",
1435
+ "internalType": "uint256"
1436
+ }
1437
+ ],
1438
+ "outputs": [],
1439
+ "stateMutability": "nonpayable"
1440
+ },
1441
+ {
1442
+ "type": "function",
1443
+ "name": "name",
1444
+ "inputs": [],
1445
+ "outputs": [
1446
+ {
1447
+ "name": "",
1448
+ "type": "string",
1449
+ "internalType": "string"
1450
+ }
1451
+ ],
1452
+ "stateMutability": "view"
1453
+ },
1454
+ {
1455
+ "type": "function",
1456
+ "name": "symbol",
1457
+ "inputs": [],
1458
+ "outputs": [
1459
+ {
1460
+ "name": "",
1461
+ "type": "string",
1462
+ "internalType": "string"
1463
+ }
1464
+ ],
1465
+ "stateMutability": "view"
1466
+ },
1467
+ {
1468
+ "type": "function",
1469
+ "name": "totalSupply",
1470
+ "inputs": [],
1471
+ "outputs": [
1472
+ {
1473
+ "name": "",
1474
+ "type": "uint256",
1475
+ "internalType": "uint256"
1476
+ }
1477
+ ],
1478
+ "stateMutability": "view"
1479
+ },
1480
+ {
1481
+ "type": "function",
1482
+ "name": "transfer",
1483
+ "inputs": [
1484
+ {
1485
+ "name": "to",
1486
+ "type": "address",
1487
+ "internalType": "address"
1488
+ },
1489
+ {
1490
+ "name": "value",
1491
+ "type": "uint256",
1492
+ "internalType": "uint256"
1493
+ }
1494
+ ],
1495
+ "outputs": [
1496
+ {
1497
+ "name": "",
1498
+ "type": "bool",
1499
+ "internalType": "bool"
1500
+ }
1501
+ ],
1502
+ "stateMutability": "nonpayable"
1503
+ },
1504
+ {
1505
+ "type": "function",
1506
+ "name": "transferFrom",
1507
+ "inputs": [
1508
+ {
1509
+ "name": "from",
1510
+ "type": "address",
1511
+ "internalType": "address"
1512
+ },
1513
+ {
1514
+ "name": "to",
1515
+ "type": "address",
1516
+ "internalType": "address"
1517
+ },
1518
+ {
1519
+ "name": "value",
1520
+ "type": "uint256",
1521
+ "internalType": "uint256"
1522
+ }
1523
+ ],
1524
+ "outputs": [
1525
+ {
1526
+ "name": "",
1527
+ "type": "bool",
1528
+ "internalType": "bool"
1529
+ }
1530
+ ],
1531
+ "stateMutability": "nonpayable"
1532
+ },
1533
+ {
1534
+ "type": "function",
1535
+ "name": "transferWithAuthorization",
1536
+ "inputs": [
1537
+ {
1538
+ "name": "from",
1539
+ "type": "address",
1540
+ "internalType": "address"
1541
+ },
1542
+ {
1543
+ "name": "to",
1544
+ "type": "address",
1545
+ "internalType": "address"
1546
+ },
1547
+ {
1548
+ "name": "value",
1549
+ "type": "uint256",
1550
+ "internalType": "uint256"
1551
+ },
1552
+ {
1553
+ "name": "validAfter",
1554
+ "type": "uint256",
1555
+ "internalType": "uint256"
1556
+ },
1557
+ {
1558
+ "name": "validBefore",
1559
+ "type": "uint256",
1560
+ "internalType": "uint256"
1561
+ },
1562
+ {
1563
+ "name": "nonce",
1564
+ "type": "bytes32",
1565
+ "internalType": "bytes32"
1566
+ },
1567
+ {
1568
+ "name": "signature",
1569
+ "type": "bytes",
1570
+ "internalType": "bytes"
1571
+ }
1572
+ ],
1573
+ "outputs": [],
1574
+ "stateMutability": "nonpayable"
1575
+ },
1576
+ {
1577
+ "type": "function",
1578
+ "name": "transferWithAuthorization",
1579
+ "inputs": [
1580
+ {
1581
+ "name": "from",
1582
+ "type": "address",
1583
+ "internalType": "address"
1584
+ },
1585
+ {
1586
+ "name": "to",
1587
+ "type": "address",
1588
+ "internalType": "address"
1589
+ },
1590
+ {
1591
+ "name": "value",
1592
+ "type": "uint256",
1593
+ "internalType": "uint256"
1594
+ },
1595
+ {
1596
+ "name": "validAfter",
1597
+ "type": "uint256",
1598
+ "internalType": "uint256"
1599
+ },
1600
+ {
1601
+ "name": "validBefore",
1602
+ "type": "uint256",
1603
+ "internalType": "uint256"
1604
+ },
1605
+ {
1606
+ "name": "nonce",
1607
+ "type": "bytes32",
1608
+ "internalType": "bytes32"
1609
+ },
1610
+ {
1611
+ "name": "v",
1612
+ "type": "uint8",
1613
+ "internalType": "uint8"
1614
+ },
1615
+ {
1616
+ "name": "r",
1617
+ "type": "bytes32",
1618
+ "internalType": "bytes32"
1619
+ },
1620
+ {
1621
+ "name": "s",
1622
+ "type": "bytes32",
1623
+ "internalType": "bytes32"
1624
+ }
1625
+ ],
1626
+ "outputs": [],
1627
+ "stateMutability": "nonpayable"
1628
+ },
1629
+ {
1630
+ "type": "function",
1631
+ "name": "version",
1632
+ "inputs": [],
1633
+ "outputs": [
1634
+ {
1635
+ "name": "",
1636
+ "type": "string",
1637
+ "internalType": "string"
1638
+ }
1639
+ ],
1640
+ "stateMutability": "pure"
1641
+ },
1642
+ {
1643
+ "type": "event",
1644
+ "name": "Approval",
1645
+ "inputs": [
1646
+ {
1647
+ "name": "owner",
1648
+ "type": "address",
1649
+ "indexed": true,
1650
+ "internalType": "address"
1651
+ },
1652
+ {
1653
+ "name": "spender",
1654
+ "type": "address",
1655
+ "indexed": true,
1656
+ "internalType": "address"
1657
+ },
1658
+ {
1659
+ "name": "value",
1660
+ "type": "uint256",
1661
+ "indexed": false,
1662
+ "internalType": "uint256"
1663
+ }
1664
+ ],
1665
+ "anonymous": false
1666
+ },
1667
+ {
1668
+ "type": "event",
1669
+ "name": "AuthorizationUsed",
1670
+ "inputs": [
1671
+ {
1672
+ "name": "authorizer",
1673
+ "type": "address",
1674
+ "indexed": true,
1675
+ "internalType": "address"
1676
+ },
1677
+ {
1678
+ "name": "nonce",
1679
+ "type": "bytes32",
1680
+ "indexed": true,
1681
+ "internalType": "bytes32"
1682
+ }
1683
+ ],
1684
+ "anonymous": false
1685
+ },
1686
+ {
1687
+ "type": "event",
1688
+ "name": "EIP712DomainChanged",
1689
+ "inputs": [],
1690
+ "anonymous": false
1691
+ },
1692
+ {
1693
+ "type": "event",
1694
+ "name": "Transfer",
1695
+ "inputs": [
1696
+ {
1697
+ "name": "from",
1698
+ "type": "address",
1699
+ "indexed": true,
1700
+ "internalType": "address"
1701
+ },
1702
+ {
1703
+ "name": "to",
1704
+ "type": "address",
1705
+ "indexed": true,
1706
+ "internalType": "address"
1707
+ },
1708
+ {
1709
+ "name": "value",
1710
+ "type": "uint256",
1711
+ "indexed": false,
1712
+ "internalType": "uint256"
1713
+ }
1714
+ ],
1715
+ "anonymous": false
1716
+ },
1717
+ {
1718
+ "type": "error",
1719
+ "name": "AuthorizationExpired",
1720
+ "inputs": []
1721
+ },
1722
+ {
1723
+ "type": "error",
1724
+ "name": "AuthorizationNotYetValid",
1725
+ "inputs": []
1726
+ },
1727
+ {
1728
+ "type": "error",
1729
+ "name": "AuthorizationUsedAlready",
1730
+ "inputs": []
1731
+ },
1732
+ {
1733
+ "type": "error",
1734
+ "name": "ERC20InsufficientAllowance",
1735
+ "inputs": [
1736
+ {
1737
+ "name": "spender",
1738
+ "type": "address",
1739
+ "internalType": "address"
1740
+ },
1741
+ {
1742
+ "name": "allowance",
1743
+ "type": "uint256",
1744
+ "internalType": "uint256"
1745
+ },
1746
+ {
1747
+ "name": "needed",
1748
+ "type": "uint256",
1749
+ "internalType": "uint256"
1750
+ }
1751
+ ]
1752
+ },
1753
+ {
1754
+ "type": "error",
1755
+ "name": "ERC20InsufficientBalance",
1756
+ "inputs": [
1757
+ {
1758
+ "name": "sender",
1759
+ "type": "address",
1760
+ "internalType": "address"
1761
+ },
1762
+ {
1763
+ "name": "balance",
1764
+ "type": "uint256",
1765
+ "internalType": "uint256"
1766
+ },
1767
+ {
1768
+ "name": "needed",
1769
+ "type": "uint256",
1770
+ "internalType": "uint256"
1771
+ }
1772
+ ]
1773
+ },
1774
+ {
1775
+ "type": "error",
1776
+ "name": "ERC20InvalidApprover",
1777
+ "inputs": [
1778
+ {
1779
+ "name": "approver",
1780
+ "type": "address",
1781
+ "internalType": "address"
1782
+ }
1783
+ ]
1784
+ },
1785
+ {
1786
+ "type": "error",
1787
+ "name": "ERC20InvalidReceiver",
1788
+ "inputs": [
1789
+ {
1790
+ "name": "receiver",
1791
+ "type": "address",
1792
+ "internalType": "address"
1793
+ }
1794
+ ]
1795
+ },
1796
+ {
1797
+ "type": "error",
1798
+ "name": "ERC20InvalidSender",
1799
+ "inputs": [
1800
+ {
1801
+ "name": "sender",
1802
+ "type": "address",
1803
+ "internalType": "address"
1804
+ }
1805
+ ]
1806
+ },
1807
+ {
1808
+ "type": "error",
1809
+ "name": "ERC20InvalidSpender",
1810
+ "inputs": [
1811
+ {
1812
+ "name": "spender",
1813
+ "type": "address",
1814
+ "internalType": "address"
1815
+ }
1816
+ ]
1817
+ },
1818
+ {
1819
+ "type": "error",
1820
+ "name": "InvalidShortString",
1821
+ "inputs": []
1822
+ },
1823
+ {
1824
+ "type": "error",
1825
+ "name": "InvalidSignature",
1826
+ "inputs": []
1827
+ },
1828
+ {
1829
+ "type": "error",
1830
+ "name": "StringTooLong",
1831
+ "inputs": [
1832
+ {
1833
+ "name": "str",
1834
+ "type": "string",
1835
+ "internalType": "string"
1836
+ }
1837
+ ]
1838
+ }
1839
+ ];
1840
+ var MockDEXAbi = [
1841
+ {
1842
+ "type": "constructor",
1843
+ "inputs": [
1844
+ {
1845
+ "name": "a",
1846
+ "type": "address",
1847
+ "internalType": "contract IERC20"
1848
+ },
1849
+ {
1850
+ "name": "b",
1851
+ "type": "address",
1852
+ "internalType": "contract IERC20"
1853
+ },
1854
+ {
1855
+ "name": "aPerB_",
1856
+ "type": "uint256",
1857
+ "internalType": "uint256"
1858
+ }
1859
+ ],
1860
+ "stateMutability": "nonpayable"
1861
+ },
1862
+ {
1863
+ "type": "function",
1864
+ "name": "aPerB",
1865
+ "inputs": [],
1866
+ "outputs": [
1867
+ {
1868
+ "name": "",
1869
+ "type": "uint256",
1870
+ "internalType": "uint256"
1871
+ }
1872
+ ],
1873
+ "stateMutability": "view"
1874
+ },
1875
+ {
1876
+ "type": "function",
1877
+ "name": "quote",
1878
+ "inputs": [
1879
+ {
1880
+ "name": "tokenIn",
1881
+ "type": "address",
1882
+ "internalType": "address"
1883
+ },
1884
+ {
1885
+ "name": "amountIn",
1886
+ "type": "uint256",
1887
+ "internalType": "uint256"
1888
+ }
1889
+ ],
1890
+ "outputs": [
1891
+ {
1892
+ "name": "",
1893
+ "type": "uint256",
1894
+ "internalType": "uint256"
1895
+ }
1896
+ ],
1897
+ "stateMutability": "view"
1898
+ },
1899
+ {
1900
+ "type": "function",
1901
+ "name": "swapExactIn",
1902
+ "inputs": [
1903
+ {
1904
+ "name": "tokenIn",
1905
+ "type": "address",
1906
+ "internalType": "address"
1907
+ },
1908
+ {
1909
+ "name": "amountIn",
1910
+ "type": "uint256",
1911
+ "internalType": "uint256"
1912
+ },
1913
+ {
1914
+ "name": "minOut",
1915
+ "type": "uint256",
1916
+ "internalType": "uint256"
1917
+ }
1918
+ ],
1919
+ "outputs": [
1920
+ {
1921
+ "name": "out",
1922
+ "type": "uint256",
1923
+ "internalType": "uint256"
1924
+ }
1925
+ ],
1926
+ "stateMutability": "nonpayable"
1927
+ },
1928
+ {
1929
+ "type": "function",
1930
+ "name": "tokenA",
1931
+ "inputs": [],
1932
+ "outputs": [
1933
+ {
1934
+ "name": "",
1935
+ "type": "address",
1936
+ "internalType": "contract IERC20"
1937
+ }
1938
+ ],
1939
+ "stateMutability": "view"
1940
+ },
1941
+ {
1942
+ "type": "function",
1943
+ "name": "tokenB",
1944
+ "inputs": [],
1945
+ "outputs": [
1946
+ {
1947
+ "name": "",
1948
+ "type": "address",
1949
+ "internalType": "contract IERC20"
1950
+ }
1951
+ ],
1952
+ "stateMutability": "view"
1953
+ },
1954
+ {
1955
+ "type": "event",
1956
+ "name": "Swapped",
1957
+ "inputs": [
1958
+ {
1959
+ "name": "trader",
1960
+ "type": "address",
1961
+ "indexed": true,
1962
+ "internalType": "address"
1963
+ },
1964
+ {
1965
+ "name": "tokenIn",
1966
+ "type": "address",
1967
+ "indexed": false,
1968
+ "internalType": "address"
1969
+ },
1970
+ {
1971
+ "name": "amountIn",
1972
+ "type": "uint256",
1973
+ "indexed": false,
1974
+ "internalType": "uint256"
1975
+ },
1976
+ {
1977
+ "name": "amountOut",
1978
+ "type": "uint256",
1979
+ "indexed": false,
1980
+ "internalType": "uint256"
1981
+ }
1982
+ ],
1983
+ "anonymous": false
1984
+ }
1985
+ ];
1986
+
1987
+ // shared/protocol.ts
1988
+ import {
1989
+ decodeErrorResult,
1990
+ decodeFunctionData,
1991
+ encodeAbiParameters,
1992
+ encodeFunctionData,
1993
+ formatUnits,
1994
+ keccak256
1995
+ } from "viem";
1996
+ var callTuple = [
1997
+ {
1998
+ type: "tuple[]",
1999
+ components: [
2000
+ { name: "target", type: "address" },
2001
+ { name: "value", type: "uint256" },
2002
+ { name: "data", type: "bytes" }
2003
+ ]
2004
+ }
2005
+ ];
2006
+ function callsHash(calls) {
2007
+ return keccak256(encodeAbiParameters(callTuple, [calls]));
2008
+ }
2009
+ function opTypedData(p) {
2010
+ return {
2011
+ domain: { name: "Killswitch", version: "1", chainId: p.chainId, verifyingContract: p.account },
2012
+ types: {
2013
+ AgentOp: [
2014
+ { name: "agentId", type: "bytes32" },
2015
+ { name: "callsHash", type: "bytes32" },
2016
+ { name: "nonce", type: "uint256" },
2017
+ { name: "deadline", type: "uint256" }
2018
+ ]
2019
+ },
2020
+ primaryType: "AgentOp",
2021
+ message: { agentId: p.agentId, callsHash: callsHash(p.calls), nonce: p.nonce, deadline: p.deadline }
2022
+ };
2023
+ }
2024
+ var toWire = (calls) => calls.map((c) => ({ target: c.target, value: c.value.toString(), data: c.data }));
2025
+ var X402_NETWORKS = {
2026
+ 1: "ethereum",
2027
+ 8453: "base",
2028
+ 84532: "base-sepolia",
2029
+ 11155111: "sepolia",
2030
+ 31337: "localhost"
2031
+ };
2032
+ function authorizeTransferCall(account, token, a) {
2033
+ return {
2034
+ target: account,
2035
+ value: 0n,
2036
+ data: encodeFunctionData({
2037
+ abi: KillswitchAccountAbi,
2038
+ functionName: "authorizeTransfer",
2039
+ args: [token, a.to, BigInt(a.value), BigInt(a.validAfter), BigInt(a.validBefore), a.nonce]
2040
+ })
2041
+ };
2042
+ }
2043
+ var b64encode = (s) => btoa(Array.from(new TextEncoder().encode(s), (b) => String.fromCharCode(b)).join(""));
2044
+ var b64decode = (s) => new TextDecoder().decode(Uint8Array.from(atob(s), (c) => c.charCodeAt(0)));
2045
+ var x402NetworkIds = (chainId) => [X402_NETWORKS[chainId], `eip155:${chainId}`].filter(Boolean);
2046
+ async function readX402Ask(res) {
2047
+ const header = res.headers.get("payment-required");
2048
+ if (header) {
2049
+ const pr = JSON.parse(b64decode(header));
2050
+ return {
2051
+ version: 2,
2052
+ resource: pr.resource,
2053
+ extensions: pr.extensions,
2054
+ error: pr.error,
2055
+ offers: (pr.accepts ?? []).map((r) => ({
2056
+ version: 2,
2057
+ scheme: r.scheme,
2058
+ network: r.network,
2059
+ asset: r.asset,
2060
+ amount: String(r.amount),
2061
+ payTo: r.payTo,
2062
+ maxTimeoutSeconds: r.maxTimeoutSeconds,
2063
+ resource: pr.resource?.url ?? "",
2064
+ description: pr.resource?.description,
2065
+ extra: r.extra,
2066
+ raw: r
2067
+ }))
2068
+ };
2069
+ }
2070
+ const body = await res.json().catch(() => null);
2071
+ if (!body || !Array.isArray(body.accepts)) return null;
2072
+ return {
2073
+ version: 1,
2074
+ error: body.error,
2075
+ offers: body.accepts.map((r) => ({
2076
+ version: 1,
2077
+ scheme: r.scheme,
2078
+ network: r.network,
2079
+ asset: r.asset,
2080
+ amount: String(r.maxAmountRequired),
2081
+ payTo: r.payTo,
2082
+ maxTimeoutSeconds: r.maxTimeoutSeconds,
2083
+ resource: r.resource ?? "",
2084
+ description: r.description,
2085
+ extra: r.extra,
2086
+ raw: r
2087
+ }))
2088
+ };
2089
+ }
2090
+ function x402PaymentHeaders(ask, offer, payload) {
2091
+ if (offer.version === 2) {
2092
+ const body = { x402Version: 2, payload, extensions: ask.extensions, resource: ask.resource, accepted: offer.raw };
2093
+ return { "PAYMENT-SIGNATURE": b64encode(JSON.stringify(body)) };
2094
+ }
2095
+ return { "X-PAYMENT": b64encode(JSON.stringify({ x402Version: 1, scheme: offer.scheme, network: offer.network, payload })) };
2096
+ }
2097
+ function readX402Receipt(res) {
2098
+ const h = res.headers.get("payment-response") ?? res.headers.get("x-payment-response");
2099
+ if (!h) return void 0;
2100
+ try {
2101
+ return JSON.parse(b64decode(h));
2102
+ } catch {
2103
+ return void 0;
2104
+ }
2105
+ }
2106
+
2107
+ // packages/sdk/index.ts
2108
+ function createKillswitchAgent(opts) {
2109
+ const signer = privateKeyToAccount(opts.sessionKey);
2110
+ const base = opts.relayUrl.replace(/\/$/, "");
2111
+ let cfg = null;
2112
+ async function api(path, init) {
2113
+ const r = await fetch(base + path, { ...init, headers: { "content-type": "application/json", ...init?.headers ?? {} } });
2114
+ const body = await r.json();
2115
+ if (!r.ok) throw new Error(`Killswitch: ${body.error ?? r.statusText}`);
2116
+ return body;
2117
+ }
2118
+ async function config() {
2119
+ cfg ??= await api("/v1/config");
2120
+ return cfg;
2121
+ }
2122
+ function token(c, symbol) {
2123
+ const t = c.tokens[symbol.toUpperCase()];
2124
+ if (!t) throw new Error(`unknown token ${symbol}; known: ${Object.keys(c.tokens).join(", ")}`);
2125
+ return t;
2126
+ }
2127
+ async function status() {
2128
+ return api(`/v1/accounts/${opts.account}/agents/${opts.agentId}`);
2129
+ }
2130
+ async function balances() {
2131
+ const a = await api(`/v1/accounts/${opts.account}`);
2132
+ const c = await config();
2133
+ const out = {};
2134
+ for (const [sym, raw] of Object.entries(a.balances)) {
2135
+ const dec = sym === "ETH" ? 18 : (c.tokens[sym] ?? Object.values(c.tokens).find((t) => t.symbol === sym))?.decimals ?? 18;
2136
+ out[sym] = (Number(raw) / 10 ** dec).toString();
2137
+ }
2138
+ return out;
2139
+ }
2140
+ async function send(calls, intent, ttlSec = 1800, x402) {
2141
+ const c = await config();
2142
+ const st = await status();
2143
+ if (!st.exists) throw new Error("Killswitch: this agent has no permission on the wallet");
2144
+ const deadline = BigInt(Math.floor(Date.now() / 1e3) + ttlSec);
2145
+ const signature = await signer.signTypedData(
2146
+ opTypedData({ chainId: c.chainId, account: opts.account, agentId: opts.agentId, calls, nonce: BigInt(st.nonce), deadline })
2147
+ );
2148
+ return api("/v1/ops", {
2149
+ method: "POST",
2150
+ body: JSON.stringify({ account: opts.account, agentId: opts.agentId, calls: toWire(calls), deadline: deadline.toString(), signature, intent, x402 })
2151
+ });
2152
+ }
2153
+ async function transfer(symbol, to, amount, intent) {
2154
+ const c = await config();
2155
+ const t = token(c, symbol);
2156
+ const data = encodeFunctionData2({ abi: MockERC20Abi, functionName: "transfer", args: [to, parseUnits(amount, t.decimals)] });
2157
+ return send([{ target: t.address, value: 0n, data }], intent);
2158
+ }
2159
+ async function swap(fromSymbol, toSymbol, amount, intent, slippageBps = 100) {
2160
+ const c = await config();
2161
+ const tIn = token(c, fromSymbol);
2162
+ token(c, toSymbol);
2163
+ const amountIn = parseUnits(amount, tIn.decimals);
2164
+ const pub = createPublicClient({ transport: http(c.rpc) });
2165
+ const quote = await pub.readContract({ address: c.dex, abi: MockDEXAbi, functionName: "quote", args: [tIn.address, amountIn] });
2166
+ const minOut = quote * BigInt(1e4 - slippageBps) / 10000n;
2167
+ return send(
2168
+ [
2169
+ { target: tIn.address, value: 0n, data: encodeFunctionData2({ abi: MockERC20Abi, functionName: "approve", args: [c.dex, amountIn] }) },
2170
+ { target: c.dex, value: 0n, data: encodeFunctionData2({ abi: MockDEXAbi, functionName: "swapExactIn", args: [tIn.address, amountIn, minOut] }) }
2171
+ ],
2172
+ intent
2173
+ );
2174
+ }
2175
+ async function waitForDecision(id, timeoutMs = 12e4) {
2176
+ const end = Date.now() + timeoutMs;
2177
+ while (Date.now() < end) {
2178
+ const op = await api(`/v1/ops/${id}`);
2179
+ if (op.status !== "held" && op.status !== "pending") return op;
2180
+ await new Promise((r) => setTimeout(r, 1500));
2181
+ }
2182
+ return api(`/v1/ops/${id}`);
2183
+ }
2184
+ async function payX402(url, o = {}) {
2185
+ const c = await config();
2186
+ const init = { method: o.method ?? "GET", headers: o.headers, body: o.body };
2187
+ const get = o.fetch ?? fetch;
2188
+ const first = await get(url, init);
2189
+ if (first.status !== 402) return { paid: false, status: first.status, body: await first.text(), note: "no payment was asked" };
2190
+ const ask = await readX402Ask(first);
2191
+ const networks = x402NetworkIds(c.chainId);
2192
+ const tokens = Object.values(c.tokens);
2193
+ const req = (ask?.offers ?? []).find(
2194
+ (r) => r.scheme === "exact" && networks.includes(r.network) && tokens.some((t2) => t2.address.toLowerCase() === r.asset?.toLowerCase()) && (r.extra?.assetTransferMethod ?? "eip3009") === "eip3009"
2195
+ );
2196
+ if (!ask || !req) {
2197
+ const offered = (ask?.offers ?? []).map((r) => `${r.scheme} on ${r.network}${r.extra?.assetTransferMethod === "permit2" ? " (Permit2)" : ""}`).join(", ") || "nothing readable";
2198
+ return { paid: false, status: 402, body: "", note: `this site asks for a payment this wallet can't make (it offers: ${offered}; this wallet pays on ${networks.join(" / ")})` };
2199
+ }
2200
+ const t = tokens.find((x) => x.address.toLowerCase() === req.asset.toLowerCase());
2201
+ const value = BigInt(req.amount);
2202
+ const price = `${formatUnits2(value, t.decimals)} ${t.symbol}`;
2203
+ if (o.maxAmount !== void 0 && value > parseUnits(o.maxAmount, t.decimals)) {
2204
+ return { paid: false, status: 402, body: "", price, note: `the site asks ${price}, more than the ${o.maxAmount} ${t.symbol} you allowed for this request` };
2205
+ }
2206
+ const now = Math.floor(Date.now() / 1e3);
2207
+ const ttl = Math.min(Math.max(req.maxTimeoutSeconds ?? 300, 120), 3e3);
2208
+ const authorization = {
2209
+ from: opts.account,
2210
+ to: req.payTo,
2211
+ value: value.toString(),
2212
+ validAfter: "0",
2213
+ validBefore: String(now + ttl),
2214
+ nonce: toHex(crypto.getRandomValues(new Uint8Array(32)))
2215
+ };
2216
+ const intent = `x402: pay ${price} for ${req.resource || url}${req.description ? ` (${req.description})` : ""}${o.reason ? `. ${o.reason}` : ""}`;
2217
+ let op = await send([authorizeTransferCall(opts.account, t.address, authorization)], intent, ttl, { url: req.resource || url });
2218
+ if (op.status === "held" && o.waitForApprovalMs) {
2219
+ const after = await waitForDecision(op.id, o.waitForApprovalMs);
2220
+ op = { ...op, status: after.status, txHash: after.tx_hash ?? void 0, reasons: after.reasons ?? op.reasons };
2221
+ }
2222
+ if (op.status !== "confirmed") return { paid: false, status: 402, body: "", price, op, note: `Killswitch did not approve the payment (${op.status})` };
2223
+ const payment = x402PaymentHeaders(ask, req, { authorization, signature: opts.agentId });
2224
+ const paidRes = await get(url, { ...init, headers: { ...o.headers ?? {}, ...payment } });
2225
+ return {
2226
+ paid: paidRes.ok,
2227
+ status: paidRes.status,
2228
+ body: await paidRes.text(),
2229
+ price,
2230
+ payTo: req.payTo,
2231
+ op,
2232
+ settlement: readX402Receipt(paidRes),
2233
+ x402Version: req.version,
2234
+ note: paidRes.ok ? void 0 : "the site refused the payment after Killswitch approved it; the approval expires unused"
2235
+ };
2236
+ }
2237
+ return { address: signer.address, config, status, balances, send, transfer, swap, payX402, waitForDecision };
2238
+ }
2239
+
2240
+ // packages/sdk/actions.ts
2241
+ import { isAddress } from "viem";
2242
+ var ACTIONS = {
2243
+ status: {
2244
+ name: "wallet_status",
2245
+ description: "Show what this agent is allowed to do with the user's wallet: active/paused, allowed actions, spending caps and how much is left, plus wallet balances. Call this before spending.",
2246
+ fields: {}
2247
+ },
2248
+ send: {
2249
+ name: "wallet_send",
2250
+ description: "Send tokens from the user's wallet. Subject to the owner's caps and guardian review. Always state the real reason in `reason`.",
2251
+ fields: {
2252
+ token: { description: "Token symbol, e.g. USDC" },
2253
+ to: { description: "Recipient address (0x\u2026)" },
2254
+ amount: { description: 'Amount in whole units, e.g. "12.5"' },
2255
+ reason: { description: "Why you are sending this, in plain words" }
2256
+ }
2257
+ },
2258
+ swap: {
2259
+ name: "wallet_swap",
2260
+ description: "Swap one token for another on the approved exchange (e.g. USDC \u2192 WETH). Subject to the owner's caps and guardian review.",
2261
+ fields: {
2262
+ from: { description: "Token to sell, e.g. USDC" },
2263
+ to: { description: "Token to buy, e.g. WETH" },
2264
+ amount: { description: "Amount of `from` to sell, in whole units" },
2265
+ reason: { description: "Why you are making this trade" }
2266
+ }
2267
+ },
2268
+ payX402: {
2269
+ name: "wallet_pay_x402",
2270
+ description: "Fetch a paid web resource or API that charges per request with x402 (it answers HTTP 402 Payment Required). The price the site asks is paid from the user's wallet only if the owner's caps and guardian review allow it, and the response is returned. Use it when a site or API asks for payment; set maxAmount to the most you would pay.",
2271
+ fields: {
2272
+ url: { description: "The URL to fetch, e.g. https://api.example.com/report" },
2273
+ method: { description: "HTTP method, default GET", optional: true },
2274
+ body: { description: "Request body for POST/PUT, as text (e.g. JSON)", optional: true },
2275
+ maxAmount: { description: 'The most this one request may cost, in whole token units, e.g. "0.10"', optional: true },
2276
+ reason: { description: "Why you are buying this, in plain words" }
2277
+ }
2278
+ }
2279
+ };
2280
+ function zodShape(z2, spec) {
2281
+ return Object.fromEntries(
2282
+ Object.entries(spec.fields).map(([k, f]) => {
2283
+ const s = z2.string().describe(f.description);
2284
+ return [k, f.optional ? s.optional() : s];
2285
+ })
2286
+ );
2287
+ }
2288
+ function explain(r) {
2289
+ const lines = [`status: ${r.status}`];
2290
+ if (r.status === "confirmed") lines.push(`done. tx ${r.txHash}`);
2291
+ if (r.status === "held") lines.push("The wallet owner must approve this operation. Do not retry; tell the user it is waiting for approval.");
2292
+ if (r.status === "blocked" || r.status === "rejected") lines.push("This operation is NOT allowed. Do not retry or try to work around it; report it to the user.");
2293
+ if (r.paused) lines.push("Your permission has been PAUSED by the guardian. Stop using the wallet and tell the user.");
2294
+ if (r.reasons?.length) lines.push("reasons:", ...r.reasons.map((x) => `- ${x}`));
2295
+ if (r.remaining) lines.push(`remaining allowance this period: ${Object.values(r.remaining).join(", ")}`);
2296
+ return lines.join("\n");
2297
+ }
2298
+ var str = (v) => typeof v === "string" ? v : JSON.stringify(v, null, 2);
2299
+ function walletActions(agent, opts = {}) {
2300
+ const guard = (fn) => fn().catch((e) => `error: ${e.message}`);
2301
+ return {
2302
+ status: () => guard(async () => {
2303
+ const [s, b] = await Promise.all([agent.status(), agent.balances()]);
2304
+ return str({
2305
+ agent: s.label,
2306
+ active: s.active,
2307
+ paused: s.paused,
2308
+ killed: s.killed,
2309
+ expires: new Date(s.validUntil * 1e3).toISOString(),
2310
+ allowed: s.rules.map((r) => r.name),
2311
+ caps: s.limits.map((l) => `${l.text} used this period (guardian co-signs single ops above ${Number(l.cosignAbove) / 10 ** l.decimals} ${l.symbol})`),
2312
+ balances: b,
2313
+ networkFees: "Paid by the Killswitch relayer. This wallet needs no ETH for gas; the agent never pays fees."
2314
+ });
2315
+ }),
2316
+ send: (a) => guard(async () => {
2317
+ if (!isAddress(a.to)) return "invalid recipient address";
2318
+ return explain(await agent.transfer(a.token, a.to, a.amount, a.reason));
2319
+ }),
2320
+ swap: (a) => guard(async () => explain(await agent.swap(a.from, a.to, a.amount, a.reason))),
2321
+ payX402: (a) => guard(async () => {
2322
+ try {
2323
+ new URL(a.url);
2324
+ } catch {
2325
+ return "invalid url";
2326
+ }
2327
+ const headers = a.body ? { "content-type": "application/json" } : void 0;
2328
+ const r = await agent.payX402(a.url, {
2329
+ method: a.method,
2330
+ body: a.body,
2331
+ headers,
2332
+ maxAmount: a.maxAmount,
2333
+ reason: a.reason,
2334
+ waitForApprovalMs: opts.waitForApprovalMs ?? 9e4,
2335
+ fetch: opts.fetch
2336
+ });
2337
+ const lines = [r.paid ? `paid ${r.price} to ${r.payTo}` : r.note ?? `not paid (HTTP ${r.status})`];
2338
+ if (r.op && !r.paid) lines.push(explain(r.op));
2339
+ if (r.op?.status === "held") lines.push("The owner has not decided yet. Tell the user the payment is waiting for approval in the Killswitch dashboard.");
2340
+ if (r.settlement?.transaction) lines.push(`settled on-chain: ${r.settlement.transaction}`);
2341
+ if (r.body) lines.push(`HTTP ${r.status} response:`, r.body.length > 6e3 ? `${r.body.slice(0, 6e3)}
2342
+ \u2026 (truncated)` : r.body);
2343
+ return lines.join("\n");
2344
+ })
2345
+ };
2346
+ }
2347
+
2348
+ // packages/agentkit/src/index.ts
2349
+ function killswitchConfigFromEnv(env = process.env) {
2350
+ const need = (k) => {
2351
+ const v = env[k];
2352
+ if (!v) throw new Error(`Killswitch: ${k} is not set. Create an agent in the Killswitch dashboard and copy its settings.`);
2353
+ return v;
2354
+ };
2355
+ return {
2356
+ relayUrl: env.KS_RELAY ?? "https://usekillswitch.xyz",
2357
+ account: need("KS_ACCOUNT"),
2358
+ agentId: need("KS_AGENT_ID"),
2359
+ sessionKey: need("KS_SESSION_KEY")
2360
+ };
2361
+ }
2362
+ var KillswitchActionProvider = class extends ActionProvider {
2363
+ run;
2364
+ constructor(config) {
2365
+ super("killswitch", []);
2366
+ const agent = createKillswitchAgent({ relayUrl: config.relayUrl, account: config.account, agentId: config.agentId, sessionKey: config.sessionKey });
2367
+ this.run = walletActions(agent, { waitForApprovalMs: config.waitForApprovalMs });
2368
+ }
2369
+ /** The four Killswitch actions. They don't use AgentKit's wallet: the Killswitch wallet acts through the relay. */
2370
+ getActions(_walletProvider) {
2371
+ const action = (spec, invoke) => ({
2372
+ name: spec.name,
2373
+ description: spec.description,
2374
+ schema: z.object(zodShape(z, spec)),
2375
+ invoke
2376
+ });
2377
+ return [
2378
+ action(ACTIONS.status, () => this.run.status()),
2379
+ action(ACTIONS.send, this.run.send),
2380
+ action(ACTIONS.swap, this.run.swap),
2381
+ action(ACTIONS.payX402, this.run.payX402)
2382
+ ];
2383
+ }
2384
+ /** Any network: the actions run on the Killswitch wallet's own chain, whatever AgentKit's wallet is on. */
2385
+ supportsNetwork(_network) {
2386
+ return true;
2387
+ }
2388
+ };
2389
+ var killswitchActionProvider = (config) => new KillswitchActionProvider(config);
2390
+ var KillswitchWalletProvider = class extends ViemWalletProvider {
2391
+ };
2392
+ KillswitchWalletProvider.prototype.trackInitialization = () => {
2393
+ };
2394
+ async function killswitchWalletProvider(config) {
2395
+ const res = await fetch(`${config.relayUrl.replace(/\/$/, "")}/v1/config`);
2396
+ if (!res.ok) throw new Error(`Killswitch: the relay at ${config.relayUrl} did not answer (${res.status})`);
2397
+ const c = await res.json();
2398
+ const chain = {
2399
+ id: c.chainId,
2400
+ name: `chain-${c.chainId}`,
2401
+ nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
2402
+ rpcUrls: { default: { http: [c.rpc] } }
2403
+ };
2404
+ const client = createWalletClient({ account: privateKeyToAccount2(config.sessionKey), chain, transport: http2(c.rpc) });
2405
+ return new KillswitchWalletProvider(client);
2406
+ }
2407
+ export {
2408
+ KillswitchActionProvider,
2409
+ killswitchActionProvider,
2410
+ killswitchConfigFromEnv,
2411
+ killswitchWalletProvider
2412
+ };