@mimicprotocol/sdk 0.0.2-rc.1 → 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/axia/validators.d.ts +217 -208
- package/dist/axia/validators.d.ts.map +1 -1
- package/dist/axia/validators.js +2 -0
- package/dist/axia/validators.js.map +1 -1
- package/dist/client/domains/IntentsClient.d.ts +1 -16
- package/dist/client/domains/IntentsClient.d.ts.map +1 -1
- package/dist/client/domains/IntentsClient.js +0 -16
- package/dist/client/domains/IntentsClient.js.map +1 -1
- package/dist/oracle/validators.d.ts +62 -62
- package/dist/registry/TriggerSigner.d.ts.map +1 -1
- package/dist/registry/TriggerSigner.js +2 -1
- package/dist/registry/TriggerSigner.js.map +1 -1
- package/dist/registry/validators.d.ts +579 -124
- package/dist/registry/validators.d.ts.map +1 -1
- package/dist/registry/validators.js +17 -2
- package/dist/registry/validators.js.map +1 -1
- package/dist/relayer/validators.d.ts +156 -132
- package/dist/relayer/validators.d.ts.map +1 -1
- package/dist/runner/validators.d.ts +46 -46
- package/dist/settler/svm/Controller.d.ts +4 -0
- package/dist/settler/svm/Controller.d.ts.map +1 -1
- package/dist/settler/svm/Controller.js +11 -0
- package/dist/settler/svm/Controller.js.map +1 -1
- package/dist/settler/svm/Settler.d.ts +14 -2
- package/dist/settler/svm/Settler.d.ts.map +1 -1
- package/dist/settler/svm/Settler.js +51 -2
- package/dist/settler/svm/Settler.js.map +1 -1
- package/dist/settler/svm/types.d.ts +5 -1
- package/dist/settler/svm/types.d.ts.map +1 -1
- package/dist/shared/codec/chains/evm.d.ts.map +1 -1
- package/dist/shared/codec/chains/evm.js +10 -2
- package/dist/shared/codec/chains/evm.js.map +1 -1
- package/dist/shared/codec/encoder.d.ts +6 -5
- package/dist/shared/codec/encoder.d.ts.map +1 -1
- package/dist/shared/eip712Types/index.d.ts +1 -1
- package/dist/shared/eip712Types/index.d.ts.map +1 -1
- package/dist/shared/eip712Types/index.js +1 -1
- package/dist/shared/eip712Types/index.js.map +1 -1
- package/dist/shared/utils/addresses.d.ts +1 -1
- package/dist/shared/utils/addresses.js +1 -1
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/index.js.map +1 -1
- package/dist/shared/utils/operations.d.ts +24 -0
- package/dist/shared/utils/operations.d.ts.map +1 -0
- package/dist/shared/utils/operations.js +32 -0
- package/dist/shared/utils/operations.js.map +1 -0
- package/dist/shared/utils/tokens.d.ts +3 -0
- package/dist/shared/utils/tokens.d.ts.map +1 -1
- package/dist/shared/utils/tokens.js +6 -1
- package/dist/shared/utils/tokens.js.map +1 -1
- package/dist/shared/validators/executions.d.ts +10 -10
- package/dist/shared/validators/intents.d.ts +88 -50
- package/dist/shared/validators/intents.d.ts.map +1 -1
- package/dist/shared/validators/intents.js +1 -0
- package/dist/shared/validators/intents.js.map +1 -1
- package/dist/shared/validators/primitives.d.ts +2 -2
- package/dist/shared/validators/primitives.js +13 -13
- package/dist/shared/validators/primitives.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/relayer/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAA;AAEF,eAAO,MAAM,kCAAkC
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/relayer/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO1C,CAAA"}
|
|
@@ -17,32 +17,32 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
17
17
|
to: z.ZodEffects<z.ZodString, string, string>;
|
|
18
18
|
data: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
data: string;
|
|
21
20
|
chainId: number;
|
|
22
|
-
|
|
21
|
+
data: string;
|
|
23
22
|
timestamp: number;
|
|
23
|
+
to: string;
|
|
24
24
|
}, {
|
|
25
|
-
data: string;
|
|
26
25
|
chainId: number;
|
|
27
|
-
|
|
26
|
+
data: string;
|
|
28
27
|
timestamp: number;
|
|
28
|
+
to: string;
|
|
29
29
|
}>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
name: "EvmCallQuery";
|
|
32
32
|
params: {
|
|
33
|
-
data: string;
|
|
34
33
|
chainId: number;
|
|
35
|
-
|
|
34
|
+
data: string;
|
|
36
35
|
timestamp: number;
|
|
36
|
+
to: string;
|
|
37
37
|
};
|
|
38
38
|
hash: string;
|
|
39
39
|
}, {
|
|
40
40
|
name: "EvmCallQuery";
|
|
41
41
|
params: {
|
|
42
|
-
data: string;
|
|
43
42
|
chainId: number;
|
|
44
|
-
|
|
43
|
+
data: string;
|
|
45
44
|
timestamp: number;
|
|
45
|
+
to: string;
|
|
46
46
|
};
|
|
47
47
|
hash: string;
|
|
48
48
|
}>;
|
|
@@ -60,10 +60,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
60
60
|
query: {
|
|
61
61
|
name: "EvmCallQuery";
|
|
62
62
|
params: {
|
|
63
|
-
data: string;
|
|
64
63
|
chainId: number;
|
|
65
|
-
|
|
64
|
+
data: string;
|
|
66
65
|
timestamp: number;
|
|
66
|
+
to: string;
|
|
67
67
|
};
|
|
68
68
|
hash: string;
|
|
69
69
|
};
|
|
@@ -75,10 +75,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
75
75
|
query: {
|
|
76
76
|
name: "EvmCallQuery";
|
|
77
77
|
params: {
|
|
78
|
-
data: string;
|
|
79
78
|
chainId: number;
|
|
80
|
-
|
|
79
|
+
data: string;
|
|
81
80
|
timestamp: number;
|
|
81
|
+
to: string;
|
|
82
82
|
};
|
|
83
83
|
hash: string;
|
|
84
84
|
};
|
|
@@ -101,36 +101,36 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
101
101
|
chainId: number;
|
|
102
102
|
}>;
|
|
103
103
|
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
timestamp: number;
|
|
104
105
|
token: {
|
|
105
106
|
address: string;
|
|
106
107
|
chainId: number;
|
|
107
108
|
};
|
|
108
|
-
timestamp: number;
|
|
109
109
|
}, {
|
|
110
|
+
timestamp: number;
|
|
110
111
|
token: {
|
|
111
112
|
address: string;
|
|
112
113
|
chainId: number;
|
|
113
114
|
};
|
|
114
|
-
timestamp: number;
|
|
115
115
|
}>;
|
|
116
116
|
}, "strip", z.ZodTypeAny, {
|
|
117
117
|
name: "TokenPriceQuery";
|
|
118
118
|
params: {
|
|
119
|
+
timestamp: number;
|
|
119
120
|
token: {
|
|
120
121
|
address: string;
|
|
121
122
|
chainId: number;
|
|
122
123
|
};
|
|
123
|
-
timestamp: number;
|
|
124
124
|
};
|
|
125
125
|
hash: string;
|
|
126
126
|
}, {
|
|
127
127
|
name: "TokenPriceQuery";
|
|
128
128
|
params: {
|
|
129
|
+
timestamp: number;
|
|
129
130
|
token: {
|
|
130
131
|
address: string;
|
|
131
132
|
chainId: number;
|
|
132
133
|
};
|
|
133
|
-
timestamp: number;
|
|
134
134
|
};
|
|
135
135
|
hash: string;
|
|
136
136
|
}>;
|
|
@@ -148,11 +148,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
148
148
|
query: {
|
|
149
149
|
name: "TokenPriceQuery";
|
|
150
150
|
params: {
|
|
151
|
+
timestamp: number;
|
|
151
152
|
token: {
|
|
152
153
|
address: string;
|
|
153
154
|
chainId: number;
|
|
154
155
|
};
|
|
155
|
-
timestamp: number;
|
|
156
156
|
};
|
|
157
157
|
hash: string;
|
|
158
158
|
};
|
|
@@ -164,11 +164,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
164
164
|
query: {
|
|
165
165
|
name: "TokenPriceQuery";
|
|
166
166
|
params: {
|
|
167
|
+
timestamp: number;
|
|
167
168
|
token: {
|
|
168
169
|
address: string;
|
|
169
170
|
chainId: number;
|
|
170
171
|
};
|
|
171
|
-
timestamp: number;
|
|
172
172
|
};
|
|
173
173
|
hash: string;
|
|
174
174
|
};
|
|
@@ -502,34 +502,34 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
502
502
|
data: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
503
503
|
rentEpoch: z.ZodEffects<z.ZodString, string, string>;
|
|
504
504
|
}, "strip", z.ZodTypeAny, {
|
|
505
|
-
data: string;
|
|
506
505
|
executable: boolean;
|
|
507
506
|
owner: string;
|
|
508
507
|
lamports: string;
|
|
508
|
+
data: string;
|
|
509
509
|
rentEpoch: string;
|
|
510
510
|
}, {
|
|
511
|
-
data: string;
|
|
512
511
|
executable: boolean;
|
|
513
512
|
owner: string;
|
|
514
513
|
lamports: string;
|
|
514
|
+
data: string;
|
|
515
515
|
rentEpoch: string;
|
|
516
516
|
}>, "many">;
|
|
517
517
|
slot: z.ZodEffects<z.ZodString, string, string>;
|
|
518
518
|
}, "strip", z.ZodTypeAny, {
|
|
519
519
|
accountsInfo: {
|
|
520
|
-
data: string;
|
|
521
520
|
executable: boolean;
|
|
522
521
|
owner: string;
|
|
523
522
|
lamports: string;
|
|
523
|
+
data: string;
|
|
524
524
|
rentEpoch: string;
|
|
525
525
|
}[];
|
|
526
526
|
slot: string;
|
|
527
527
|
}, {
|
|
528
528
|
accountsInfo: {
|
|
529
|
-
data: string;
|
|
530
529
|
executable: boolean;
|
|
531
530
|
owner: string;
|
|
532
531
|
lamports: string;
|
|
532
|
+
data: string;
|
|
533
533
|
rentEpoch: string;
|
|
534
534
|
}[];
|
|
535
535
|
slot: string;
|
|
@@ -537,10 +537,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
537
537
|
}, "strip", z.ZodTypeAny, {
|
|
538
538
|
value: {
|
|
539
539
|
accountsInfo: {
|
|
540
|
-
data: string;
|
|
541
540
|
executable: boolean;
|
|
542
541
|
owner: string;
|
|
543
542
|
lamports: string;
|
|
543
|
+
data: string;
|
|
544
544
|
rentEpoch: string;
|
|
545
545
|
}[];
|
|
546
546
|
slot: string;
|
|
@@ -548,10 +548,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
548
548
|
}, {
|
|
549
549
|
value: {
|
|
550
550
|
accountsInfo: {
|
|
551
|
-
data: string;
|
|
552
551
|
executable: boolean;
|
|
553
552
|
owner: string;
|
|
554
553
|
lamports: string;
|
|
554
|
+
data: string;
|
|
555
555
|
rentEpoch: string;
|
|
556
556
|
}[];
|
|
557
557
|
slot: string;
|
|
@@ -561,10 +561,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
561
561
|
result: {
|
|
562
562
|
value: {
|
|
563
563
|
accountsInfo: {
|
|
564
|
-
data: string;
|
|
565
564
|
executable: boolean;
|
|
566
565
|
owner: string;
|
|
567
566
|
lamports: string;
|
|
567
|
+
data: string;
|
|
568
568
|
rentEpoch: string;
|
|
569
569
|
}[];
|
|
570
570
|
slot: string;
|
|
@@ -583,10 +583,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
583
583
|
result: {
|
|
584
584
|
value: {
|
|
585
585
|
accountsInfo: {
|
|
586
|
-
data: string;
|
|
587
586
|
executable: boolean;
|
|
588
587
|
owner: string;
|
|
589
588
|
lamports: string;
|
|
589
|
+
data: string;
|
|
590
590
|
rentEpoch: string;
|
|
591
591
|
}[];
|
|
592
592
|
slot: string;
|
|
@@ -621,8 +621,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
621
621
|
version: z.ZodEffects<z.ZodString, string, string>;
|
|
622
622
|
}, "strip", z.ZodTypeAny, {
|
|
623
623
|
triggerSig: string;
|
|
624
|
-
user: string;
|
|
625
624
|
timestamp: number;
|
|
625
|
+
user: string;
|
|
626
626
|
hash: string;
|
|
627
627
|
version: string;
|
|
628
628
|
input: Record<string, unknown>;
|
|
@@ -640,10 +640,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
640
640
|
query: {
|
|
641
641
|
name: "EvmCallQuery";
|
|
642
642
|
params: {
|
|
643
|
-
data: string;
|
|
644
643
|
chainId: number;
|
|
645
|
-
|
|
644
|
+
data: string;
|
|
646
645
|
timestamp: number;
|
|
646
|
+
to: string;
|
|
647
647
|
};
|
|
648
648
|
hash: string;
|
|
649
649
|
};
|
|
@@ -652,10 +652,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
652
652
|
result: {
|
|
653
653
|
value: {
|
|
654
654
|
accountsInfo: {
|
|
655
|
-
data: string;
|
|
656
655
|
executable: boolean;
|
|
657
656
|
owner: string;
|
|
658
657
|
lamports: string;
|
|
658
|
+
data: string;
|
|
659
659
|
rentEpoch: string;
|
|
660
660
|
}[];
|
|
661
661
|
slot: string;
|
|
@@ -677,11 +677,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
677
677
|
query: {
|
|
678
678
|
name: "TokenPriceQuery";
|
|
679
679
|
params: {
|
|
680
|
+
timestamp: number;
|
|
680
681
|
token: {
|
|
681
682
|
address: string;
|
|
682
683
|
chainId: number;
|
|
683
684
|
};
|
|
684
|
-
timestamp: number;
|
|
685
685
|
};
|
|
686
686
|
hash: string;
|
|
687
687
|
};
|
|
@@ -735,8 +735,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
735
735
|
})[] | undefined;
|
|
736
736
|
}, {
|
|
737
737
|
triggerSig: string;
|
|
738
|
-
user: string;
|
|
739
738
|
timestamp: number;
|
|
739
|
+
user: string;
|
|
740
740
|
hash: string;
|
|
741
741
|
version: string;
|
|
742
742
|
input: Record<string, unknown>;
|
|
@@ -754,10 +754,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
754
754
|
query: {
|
|
755
755
|
name: "EvmCallQuery";
|
|
756
756
|
params: {
|
|
757
|
-
data: string;
|
|
758
757
|
chainId: number;
|
|
759
|
-
|
|
758
|
+
data: string;
|
|
760
759
|
timestamp: number;
|
|
760
|
+
to: string;
|
|
761
761
|
};
|
|
762
762
|
hash: string;
|
|
763
763
|
};
|
|
@@ -766,10 +766,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
766
766
|
result: {
|
|
767
767
|
value: {
|
|
768
768
|
accountsInfo: {
|
|
769
|
-
data: string;
|
|
770
769
|
executable: boolean;
|
|
771
770
|
owner: string;
|
|
772
771
|
lamports: string;
|
|
772
|
+
data: string;
|
|
773
773
|
rentEpoch: string;
|
|
774
774
|
}[];
|
|
775
775
|
slot: string;
|
|
@@ -791,11 +791,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
791
791
|
query: {
|
|
792
792
|
name: "TokenPriceQuery";
|
|
793
793
|
params: {
|
|
794
|
+
timestamp: number;
|
|
794
795
|
token: {
|
|
795
796
|
address: string;
|
|
796
797
|
chainId: number;
|
|
797
798
|
};
|
|
798
|
-
timestamp: number;
|
|
799
799
|
};
|
|
800
800
|
hash: string;
|
|
801
801
|
};
|
|
@@ -849,8 +849,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
849
849
|
})[] | undefined;
|
|
850
850
|
}>, {
|
|
851
851
|
triggerSig: string;
|
|
852
|
-
user: string;
|
|
853
852
|
timestamp: number;
|
|
853
|
+
user: string;
|
|
854
854
|
hash: string;
|
|
855
855
|
version: string;
|
|
856
856
|
input: Record<string, unknown>;
|
|
@@ -868,10 +868,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
868
868
|
query: {
|
|
869
869
|
name: "EvmCallQuery";
|
|
870
870
|
params: {
|
|
871
|
-
data: string;
|
|
872
871
|
chainId: number;
|
|
873
|
-
|
|
872
|
+
data: string;
|
|
874
873
|
timestamp: number;
|
|
874
|
+
to: string;
|
|
875
875
|
};
|
|
876
876
|
hash: string;
|
|
877
877
|
};
|
|
@@ -880,10 +880,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
880
880
|
result: {
|
|
881
881
|
value: {
|
|
882
882
|
accountsInfo: {
|
|
883
|
-
data: string;
|
|
884
883
|
executable: boolean;
|
|
885
884
|
owner: string;
|
|
886
885
|
lamports: string;
|
|
886
|
+
data: string;
|
|
887
887
|
rentEpoch: string;
|
|
888
888
|
}[];
|
|
889
889
|
slot: string;
|
|
@@ -905,11 +905,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
905
905
|
query: {
|
|
906
906
|
name: "TokenPriceQuery";
|
|
907
907
|
params: {
|
|
908
|
+
timestamp: number;
|
|
908
909
|
token: {
|
|
909
910
|
address: string;
|
|
910
911
|
chainId: number;
|
|
911
912
|
};
|
|
912
|
-
timestamp: number;
|
|
913
913
|
};
|
|
914
914
|
hash: string;
|
|
915
915
|
};
|
|
@@ -963,8 +963,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
963
963
|
})[] | undefined;
|
|
964
964
|
}, {
|
|
965
965
|
triggerSig: string;
|
|
966
|
-
user: string;
|
|
967
966
|
timestamp: number;
|
|
967
|
+
user: string;
|
|
968
968
|
hash: string;
|
|
969
969
|
version: string;
|
|
970
970
|
input: Record<string, unknown>;
|
|
@@ -982,10 +982,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
982
982
|
query: {
|
|
983
983
|
name: "EvmCallQuery";
|
|
984
984
|
params: {
|
|
985
|
-
data: string;
|
|
986
985
|
chainId: number;
|
|
987
|
-
|
|
986
|
+
data: string;
|
|
988
987
|
timestamp: number;
|
|
988
|
+
to: string;
|
|
989
989
|
};
|
|
990
990
|
hash: string;
|
|
991
991
|
};
|
|
@@ -994,10 +994,10 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
994
994
|
result: {
|
|
995
995
|
value: {
|
|
996
996
|
accountsInfo: {
|
|
997
|
-
data: string;
|
|
998
997
|
executable: boolean;
|
|
999
998
|
owner: string;
|
|
1000
999
|
lamports: string;
|
|
1000
|
+
data: string;
|
|
1001
1001
|
rentEpoch: string;
|
|
1002
1002
|
}[];
|
|
1003
1003
|
slot: string;
|
|
@@ -1019,11 +1019,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
|
|
|
1019
1019
|
query: {
|
|
1020
1020
|
name: "TokenPriceQuery";
|
|
1021
1021
|
params: {
|
|
1022
|
+
timestamp: number;
|
|
1022
1023
|
token: {
|
|
1023
1024
|
address: string;
|
|
1024
1025
|
chainId: number;
|
|
1025
1026
|
};
|
|
1026
|
-
timestamp: number;
|
|
1027
1027
|
};
|
|
1028
1028
|
hash: string;
|
|
1029
1029
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { IdlTypes, Program, Provider, web3 } from '@coral-xyz/anchor';
|
|
2
2
|
import { Controller } from './idls/types/controller';
|
|
3
|
+
import { SvmProviderLike } from './types';
|
|
3
4
|
export declare const EntityType: {
|
|
4
5
|
readonly Validator: 0;
|
|
5
6
|
readonly Axia: 1;
|
|
6
7
|
readonly Solver: 2;
|
|
7
8
|
};
|
|
8
9
|
export type EntityType = (typeof EntityType)[keyof typeof EntityType];
|
|
10
|
+
export type ControllerSettingsAccount = Awaited<ReturnType<Program<Controller>['account']['controllerSettings']['fetch']>>;
|
|
9
11
|
export default class SvmController {
|
|
10
12
|
protected program: Program<Controller>;
|
|
11
13
|
constructor(provider?: Provider);
|
|
14
|
+
static createFromSvmService(svmService: SvmProviderLike): SvmController;
|
|
12
15
|
initializeIx(admin: web3.PublicKey, minValidations: number, caller?: web3.PublicKey): Promise<web3.TransactionInstruction>;
|
|
13
16
|
resizeSettings(caller?: web3.PublicKey): Promise<web3.TransactionInstruction>;
|
|
14
17
|
setAdminIx(newAdmin: web3.PublicKey, caller?: web3.PublicKey): Promise<web3.TransactionInstruction>;
|
|
@@ -17,6 +20,7 @@ export default class SvmController {
|
|
|
17
20
|
closeEntityRegistryIx(entityType: EntityType, entityAddress: web3.PublicKey | Buffer, caller?: web3.PublicKey): Promise<web3.TransactionInstruction>;
|
|
18
21
|
getSignerKey(): web3.PublicKey;
|
|
19
22
|
getControllerSettingsPubkey(): web3.PublicKey;
|
|
23
|
+
getControllerSettings(): Promise<ControllerSettingsAccount>;
|
|
20
24
|
getEntityRegistryPubkey(entityType: EntityType, entityAddress: web3.PublicKey | Buffer): web3.PublicKey;
|
|
21
25
|
entityTypeToAnchorEnum(entityType: EntityType): IdlTypes<Controller>['entityType'];
|
|
22
26
|
private pubkeyOrBufferToBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../../src/settler/svm/Controller.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Controller.d.ts","sourceRoot":"","sources":["../../../src/settler/svm/Controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGrF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,eAAO,MAAM,UAAU;;;;CAIb,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AACrE,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC,CAC1E,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC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AAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;IAQlF,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -35,6 +35,9 @@ class SvmController {
|
|
|
35
35
|
constructor(provider) {
|
|
36
36
|
this.program = new anchor_1.Program(ControllerIDL, provider);
|
|
37
37
|
}
|
|
38
|
+
static createFromSvmService(svmService) {
|
|
39
|
+
return new SvmController(new anchor_1.AnchorProvider(svmService.getConnection(), svmService.getWallet()));
|
|
40
|
+
}
|
|
38
41
|
async initializeIx(admin, minValidations, caller) {
|
|
39
42
|
const controllerSettings = this.getControllerSettingsPubkey();
|
|
40
43
|
const ix = await this.program.methods
|
|
@@ -115,6 +118,14 @@ class SvmController {
|
|
|
115
118
|
getControllerSettingsPubkey() {
|
|
116
119
|
return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from('controller-settings')], this.program.programId)[0];
|
|
117
120
|
}
|
|
121
|
+
async getControllerSettings() {
|
|
122
|
+
try {
|
|
123
|
+
return await this.program.account.controllerSettings.fetch(this.getControllerSettingsPubkey());
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
throw new Error('Controller settings account does not exist: ' + String(e));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
118
129
|
getEntityRegistryPubkey(entityType, entityAddress) {
|
|
119
130
|
const entityAddressBuffer = this.pubkeyOrBufferToBuffer(entityAddress);
|
|
120
131
|
return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from('entity-registry'), Buffer.from([entityType]), entityAddressBuffer], this.program.programId)[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../../../src/settler/svm/Controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../../../src/settler/svm/Controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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AA8C,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7E,CAAC;IACH,CAAC;IAED,uBAAuB,CAAC,UAAsB,EAAE,aAAsC;QACpF,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAA;QACtE,OAAO,aAAI,CAAC,SAAS,CAAC,sBAAsB,CAC1C,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAChF,IAAI,CAAC,OAAO,CAAC,SAAS,CACvB,CAAC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,sBAAsB,CAAC,UAAsB;QAC3C,IAAI,UAAU,KAAK,kBAAU,CAAC,SAAS;YAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAAA;QACjE,IAAI,UAAU,KAAK,kBAAU,CAAC,IAAI;YAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;QACvD,IAAI,UAAU,KAAK,kBAAU,CAAC,MAAM;YAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;QAE3D,MAAM,IAAI,KAAK,CAAC,2BAA2B,UAAU,EAAE,CAAC,CAAA;IAC1D,CAAC;IAEO,sBAAsB,CAAC,cAAuC;QACpE,OAAO,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAA;IACrF,CAAC;CACF;AAzID,gCAyIC"}
|
|
@@ -3,13 +3,19 @@ import { AccountMeta } from '@solana/web3.js';
|
|
|
3
3
|
import { Intent, OpType, Proposal } from '../../shared';
|
|
4
4
|
import { Settler } from './idls/types/settler';
|
|
5
5
|
import { EntityType } from './Controller';
|
|
6
|
-
import { CreateIntentParams, CreateProposalParams, ExtendIntentParams, ProposalInstruction, SolanaEip712Domain } from './types';
|
|
6
|
+
import { CreateIntentParams, CreateProposalParams, ExtendIntentParams, ProposalInstruction, SolanaEip712Domain, SvmProviderLike } from './types';
|
|
7
|
+
type TokenAccountOverride = {
|
|
8
|
+
token: Address;
|
|
9
|
+
owner: Address;
|
|
10
|
+
tokenAccount: Address;
|
|
11
|
+
};
|
|
7
12
|
type ProposalAccount = NonNullable<Awaited<ReturnType<Program<Settler>['account']['proposal']['fetch']>>>;
|
|
8
13
|
export default class SvmSettler {
|
|
9
14
|
protected program: Program<Settler>;
|
|
10
15
|
private validatorSigner;
|
|
11
16
|
private proposalSigner;
|
|
12
17
|
constructor(provider: Provider);
|
|
18
|
+
static createFromSvmService(svmService: SvmProviderLike): SvmSettler;
|
|
13
19
|
initializeIx(domain: SolanaEip712Domain): Promise<web3.TransactionInstruction>;
|
|
14
20
|
updateEip712DomainIx(domain: SolanaEip712Domain): Promise<web3.TransactionInstruction>;
|
|
15
21
|
createIntentIx(intentHashHex: string, params: CreateIntentParams, isFinal?: boolean): Promise<web3.TransactionInstruction>;
|
|
@@ -20,7 +26,13 @@ export default class SvmSettler {
|
|
|
20
26
|
claimStaleProposalIx(intentHashHex: string): Promise<web3.TransactionInstruction>;
|
|
21
27
|
addValidatorSigIxs(intentHashHex: string, validatorEthAddress: string, signature: string): Promise<web3.TransactionInstruction[]>;
|
|
22
28
|
addAxiaSigIxs(intentHash: string, proposal: Proposal, axiaEthAddress: string, signature: string): Promise<web3.TransactionInstruction[]>;
|
|
23
|
-
executeProposalIx(intentHash: string, intent: Intent, proposal: Proposal,
|
|
29
|
+
executeProposalIx(intentHash: string, intent: Intent, proposal: Proposal, tokenAccountOverrides?: TokenAccountOverride[]): Promise<web3.TransactionInstruction>;
|
|
30
|
+
getExecuteProposalRemainingAccounts(intent: Intent, proposal: Proposal, tokenAccountOverrides?: TokenAccountOverride[]): AccountMeta[];
|
|
31
|
+
getExecuteProposalRemainingAccountsTransfer(intent: Intent, proposal: Proposal, tokenAccountOverrides?: TokenAccountOverride[]): AccountMeta[];
|
|
32
|
+
/**
|
|
33
|
+
* Calculates TokenKeg ATA unless an optional override is provided for a given (token,owner) bundle
|
|
34
|
+
*/
|
|
35
|
+
getAtaOrOverride(token: Address, owner: Address, tokenAccountOverrides?: TokenAccountOverride[]): web3.PublicKey;
|
|
24
36
|
getSettlerSettingsKey(): web3.PublicKey;
|
|
25
37
|
getIntentKey(intentHashHex: string): web3.PublicKey;
|
|
26
38
|
getFulfilledIntentKey(intentHashHex: string): web3.PublicKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settler.d.ts","sourceRoot":"","sources":["../../../src/settler/svm/Settler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Settler.d.ts","sourceRoot":"","sources":["../../../src/settler/svm/Settler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAGP,QAAQ,EACR,OAAO,EACP,QAAQ,EAGR,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAI7C,OAAO,EAIL,MAAM,EAGN,MAAM,EACN,QAAQ,EAGT,MAAM,cAAc,CAAA;AAMrB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EAEnB,kBAAkB,EAClB,eAAe,EAEhB,MAAM,SAAS,CAAA;AAkBhB,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAGD,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CA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GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAS/D,8BAA8B,CAC5B,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,MAAM,EAAE,GACnB,QAAQ,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAUhC,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,cAAc;CASvB"}
|
|
@@ -27,6 +27,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
27
27
|
const ethers_1 = require("ethers");
|
|
28
28
|
const axia_1 = require("../../axia");
|
|
29
29
|
const shared_1 = require("../../shared");
|
|
30
|
+
const svm_1 = require("../../shared/codec/chains/svm");
|
|
30
31
|
const validator_1 = require("../../validator");
|
|
31
32
|
const ControllerIDL = __importStar(require("./idls/controller.json"));
|
|
32
33
|
const SettlerIDL = __importStar(require("./idls/settler.json"));
|
|
@@ -37,6 +38,9 @@ class SvmSettler {
|
|
|
37
38
|
this.validatorSigner = new validator_1.ValidatorSigner();
|
|
38
39
|
this.proposalSigner = new axia_1.ProposalSigner();
|
|
39
40
|
}
|
|
41
|
+
static createFromSvmService(svmService) {
|
|
42
|
+
return new SvmSettler(new anchor_1.AnchorProvider(svmService.getConnection(), svmService.getWallet()));
|
|
43
|
+
}
|
|
40
44
|
async initializeIx(domain) {
|
|
41
45
|
const ix = await this.program.methods.initialize(this.parseSolanaEip712Domain(domain)).instruction();
|
|
42
46
|
return ix;
|
|
@@ -171,7 +175,7 @@ class SvmSettler {
|
|
|
171
175
|
.instruction();
|
|
172
176
|
return [secp256k1Ix, ix];
|
|
173
177
|
}
|
|
174
|
-
async executeProposalIx(intentHash, intent, proposal,
|
|
178
|
+
async executeProposalIx(intentHash, intent, proposal, tokenAccountOverrides = []) {
|
|
175
179
|
const ix = await this.program.methods
|
|
176
180
|
.executeProposal()
|
|
177
181
|
.accountsPartial({
|
|
@@ -184,10 +188,55 @@ class SvmSettler {
|
|
|
184
188
|
fulfilledIntent: this.getFulfilledIntentKey(intentHash),
|
|
185
189
|
delegate: this.getDelegateKey(intent.operations[0]?.user),
|
|
186
190
|
})
|
|
187
|
-
.remainingAccounts(
|
|
191
|
+
.remainingAccounts(this.getExecuteProposalRemainingAccounts(intent, proposal, tokenAccountOverrides))
|
|
188
192
|
.instruction();
|
|
189
193
|
return ix;
|
|
190
194
|
}
|
|
195
|
+
getExecuteProposalRemainingAccounts(intent, proposal, tokenAccountOverrides = []) {
|
|
196
|
+
// For now in solana we assume that the intent is just one operation with transfer
|
|
197
|
+
switch (intent.operations[0]?.opType) {
|
|
198
|
+
case shared_1.OpType.Transfer:
|
|
199
|
+
return this.getExecuteProposalRemainingAccountsTransfer(intent, proposal, tokenAccountOverrides);
|
|
200
|
+
default:
|
|
201
|
+
throw new Error(`Unsupported intent op ${intent.operations[0]?.opType}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
getExecuteProposalRemainingAccountsTransfer(intent, proposal, tokenAccountOverrides = []) {
|
|
205
|
+
// For now in solana we assume that the intent is just one operation with transfer
|
|
206
|
+
const decodedOperation = (0, svm_1.svmDecodeTransferOperation)(intent.operations[0]);
|
|
207
|
+
const { transfers } = decodedOperation;
|
|
208
|
+
const tokenProgram = { pubkey: shared_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false };
|
|
209
|
+
const token2022Program = { pubkey: shared_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false };
|
|
210
|
+
const transferAccounts = transfers.flatMap((transfer) => {
|
|
211
|
+
const recipientTa = this.getAtaOrOverride(transfer.token, transfer.recipient, tokenAccountOverrides);
|
|
212
|
+
const userTa = this.getAtaOrOverride(transfer.token, decodedOperation.user, tokenAccountOverrides);
|
|
213
|
+
return [
|
|
214
|
+
{ pubkey: (0, anchor_1.translateAddress)(transfer.token), isSigner: false, isWritable: false },
|
|
215
|
+
{ pubkey: (0, anchor_1.translateAddress)(transfer.recipient), isSigner: false, isWritable: false },
|
|
216
|
+
{ pubkey: recipientTa, isSigner: false, isWritable: true },
|
|
217
|
+
{ pubkey: userTa, isSigner: false, isWritable: true },
|
|
218
|
+
];
|
|
219
|
+
});
|
|
220
|
+
const solverFeeAccounts = intent.maxFees.flatMap((maxFee) => {
|
|
221
|
+
const feeToken = (0, anchor_1.translateAddress)(maxFee.token);
|
|
222
|
+
const solverTa = this.getAtaOrOverride(feeToken, proposal.solver, tokenAccountOverrides);
|
|
223
|
+
const userTa = this.getAtaOrOverride(feeToken, decodedOperation.user, tokenAccountOverrides);
|
|
224
|
+
return [
|
|
225
|
+
{ pubkey: feeToken, isSigner: false, isWritable: false },
|
|
226
|
+
{ pubkey: solverTa, isSigner: false, isWritable: true },
|
|
227
|
+
{ pubkey: userTa, isSigner: false, isWritable: true },
|
|
228
|
+
];
|
|
229
|
+
});
|
|
230
|
+
return [tokenProgram, token2022Program, ...transferAccounts, ...solverFeeAccounts];
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Calculates TokenKeg ATA unless an optional override is provided for a given (token,owner) bundle
|
|
234
|
+
*/
|
|
235
|
+
getAtaOrOverride(token, owner, tokenAccountOverrides = []) {
|
|
236
|
+
const overrideTa = tokenAccountOverrides.find((item) => item.token.toString() === token.toString() && item.owner.toString() === owner.toString());
|
|
237
|
+
return (0, anchor_1.translateAddress)(overrideTa?.tokenAccount ??
|
|
238
|
+
anchor_1.utils.token.associatedAddress({ mint: (0, anchor_1.translateAddress)(token), owner: (0, anchor_1.translateAddress)(owner) }));
|
|
239
|
+
}
|
|
191
240
|
getSettlerSettingsKey() {
|
|
192
241
|
return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from('settler-settings')], this.program.programId)[0];
|
|
193
242
|
}
|