@mimicprotocol/sdk 0.0.1-rc.38 → 0.0.1-rc.39

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.
@@ -19,21 +19,21 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  data: string;
21
21
  chainId: number;
22
- timestamp: number;
23
22
  to: string;
23
+ timestamp: number;
24
24
  }, {
25
25
  data: string;
26
26
  chainId: number;
27
- timestamp: number;
28
27
  to: string;
28
+ timestamp: number;
29
29
  }>;
30
30
  }, "strip", z.ZodTypeAny, {
31
31
  name: "EvmCallQuery";
32
32
  params: {
33
33
  data: string;
34
34
  chainId: number;
35
- timestamp: number;
36
35
  to: string;
36
+ timestamp: number;
37
37
  };
38
38
  hash: string;
39
39
  }, {
@@ -41,8 +41,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
41
41
  params: {
42
42
  data: string;
43
43
  chainId: number;
44
- timestamp: number;
45
44
  to: string;
45
+ timestamp: number;
46
46
  };
47
47
  hash: string;
48
48
  }>;
@@ -54,7 +54,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
54
54
  value: string;
55
55
  }>;
56
56
  }, "strip", z.ZodTypeAny, {
57
- signature: string;
58
57
  result: {
59
58
  value: string;
60
59
  };
@@ -63,13 +62,13 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
63
62
  params: {
64
63
  data: string;
65
64
  chainId: number;
66
- timestamp: number;
67
65
  to: string;
66
+ timestamp: number;
68
67
  };
69
68
  hash: string;
70
69
  };
71
- }, {
72
70
  signature: string;
71
+ }, {
73
72
  result: {
74
73
  value: string;
75
74
  };
@@ -78,11 +77,12 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
78
77
  params: {
79
78
  data: string;
80
79
  chainId: number;
81
- timestamp: number;
82
80
  to: string;
81
+ timestamp: number;
83
82
  };
84
83
  hash: string;
85
84
  };
85
+ signature: string;
86
86
  }>, z.ZodObject<{
87
87
  signature: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
88
88
  query: z.ZodObject<{
@@ -142,7 +142,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
142
142
  value: string;
143
143
  }>;
144
144
  }, "strip", z.ZodTypeAny, {
145
- signature: string;
146
145
  result: {
147
146
  value: string;
148
147
  };
@@ -157,8 +156,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
157
156
  };
158
157
  hash: string;
159
158
  };
160
- }, {
161
159
  signature: string;
160
+ }, {
162
161
  result: {
163
162
  value: string;
164
163
  };
@@ -173,6 +172,7 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
173
172
  };
174
173
  hash: string;
175
174
  };
175
+ signature: string;
176
176
  }>, z.ZodObject<{
177
177
  signature: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
178
178
  query: z.ZodObject<{
@@ -310,7 +310,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
310
310
  };
311
311
  }>;
312
312
  }, "strip", z.ZodTypeAny, {
313
- signature: string;
314
313
  result: {
315
314
  value: {
316
315
  timestamp: number;
@@ -337,8 +336,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
337
336
  };
338
337
  hash: string;
339
338
  };
340
- }, {
341
339
  signature: string;
340
+ }, {
342
341
  result: {
343
342
  value: {
344
343
  timestamp: number;
@@ -365,6 +364,7 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
365
364
  };
366
365
  hash: string;
367
366
  };
367
+ signature: string;
368
368
  }>, z.ZodObject<{
369
369
  signature: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
370
370
  query: z.ZodObject<{
@@ -428,7 +428,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
428
428
  };
429
429
  }>;
430
430
  }, "strip", z.ZodTypeAny, {
431
- signature: string;
432
431
  result: {
433
432
  value: {
434
433
  data: string;
@@ -445,8 +444,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
445
444
  };
446
445
  hash: string;
447
446
  };
448
- }, {
449
447
  signature: string;
448
+ }, {
450
449
  result: {
451
450
  value: {
452
451
  data: string;
@@ -463,6 +462,7 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
463
462
  };
464
463
  hash: string;
465
464
  };
465
+ signature: string;
466
466
  }>, z.ZodObject<{
467
467
  signature: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
468
468
  query: z.ZodObject<{
@@ -558,7 +558,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
558
558
  };
559
559
  }>;
560
560
  }, "strip", z.ZodTypeAny, {
561
- signature: string;
562
561
  result: {
563
562
  value: {
564
563
  accountsInfo: {
@@ -579,8 +578,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
579
578
  };
580
579
  hash: string;
581
580
  };
582
- }, {
583
581
  signature: string;
582
+ }, {
584
583
  result: {
585
584
  value: {
586
585
  accountsInfo: {
@@ -601,6 +600,7 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
601
600
  };
602
601
  hash: string;
603
602
  };
603
+ signature: string;
604
604
  }>]>, "many">>;
605
605
  hash: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
606
606
  triggerSig: z.ZodString;
@@ -621,11 +621,11 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
621
621
  version: z.ZodEffects<z.ZodString, string, string>;
622
622
  }, "strip", z.ZodTypeAny, {
623
623
  user: string;
624
- version: string;
625
- input: Record<string, unknown>;
626
- triggerSig: string;
627
624
  timestamp: number;
628
625
  hash: string;
626
+ version: string;
627
+ triggerSig: string;
628
+ input: Record<string, unknown>;
629
629
  callbackUrl: string;
630
630
  settlers: string;
631
631
  triggerConfig: {
@@ -634,7 +634,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
634
634
  };
635
635
  oracleUrls?: string[] | undefined;
636
636
  oracleResponses?: ({
637
- signature: string;
638
637
  result: {
639
638
  value: string;
640
639
  };
@@ -643,13 +642,13 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
643
642
  params: {
644
643
  data: string;
645
644
  chainId: number;
646
- timestamp: number;
647
645
  to: string;
646
+ timestamp: number;
648
647
  };
649
648
  hash: string;
650
649
  };
651
- } | {
652
650
  signature: string;
651
+ } | {
653
652
  result: {
654
653
  value: {
655
654
  accountsInfo: {
@@ -670,8 +669,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
670
669
  };
671
670
  hash: string;
672
671
  };
673
- } | {
674
672
  signature: string;
673
+ } | {
675
674
  result: {
676
675
  value: string;
677
676
  };
@@ -686,8 +685,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
686
685
  };
687
686
  hash: string;
688
687
  };
689
- } | {
690
688
  signature: string;
689
+ } | {
691
690
  result: {
692
691
  value: {
693
692
  timestamp: number;
@@ -714,8 +713,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
714
713
  };
715
714
  hash: string;
716
715
  };
717
- } | {
718
716
  signature: string;
717
+ } | {
719
718
  result: {
720
719
  value: {
721
720
  data: string;
@@ -732,14 +731,15 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
732
731
  };
733
732
  hash: string;
734
733
  };
734
+ signature: string;
735
735
  })[] | undefined;
736
736
  }, {
737
737
  user: string;
738
- version: string;
739
- input: Record<string, unknown>;
740
- triggerSig: string;
741
738
  timestamp: number;
742
739
  hash: string;
740
+ version: string;
741
+ triggerSig: string;
742
+ input: Record<string, unknown>;
743
743
  callbackUrl: string;
744
744
  settlers: string;
745
745
  triggerConfig: {
@@ -748,7 +748,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
748
748
  };
749
749
  oracleUrls?: string[] | undefined;
750
750
  oracleResponses?: ({
751
- signature: string;
752
751
  result: {
753
752
  value: string;
754
753
  };
@@ -757,13 +756,13 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
757
756
  params: {
758
757
  data: string;
759
758
  chainId: number;
760
- timestamp: number;
761
759
  to: string;
760
+ timestamp: number;
762
761
  };
763
762
  hash: string;
764
763
  };
765
- } | {
766
764
  signature: string;
765
+ } | {
767
766
  result: {
768
767
  value: {
769
768
  accountsInfo: {
@@ -784,8 +783,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
784
783
  };
785
784
  hash: string;
786
785
  };
787
- } | {
788
786
  signature: string;
787
+ } | {
789
788
  result: {
790
789
  value: string;
791
790
  };
@@ -800,8 +799,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
800
799
  };
801
800
  hash: string;
802
801
  };
803
- } | {
804
802
  signature: string;
803
+ } | {
805
804
  result: {
806
805
  value: {
807
806
  timestamp: number;
@@ -828,8 +827,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
828
827
  };
829
828
  hash: string;
830
829
  };
831
- } | {
832
830
  signature: string;
831
+ } | {
833
832
  result: {
834
833
  value: {
835
834
  data: string;
@@ -846,14 +845,15 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
846
845
  };
847
846
  hash: string;
848
847
  };
848
+ signature: string;
849
849
  })[] | undefined;
850
850
  }>, {
851
851
  user: string;
852
- version: string;
853
- input: Record<string, unknown>;
854
- triggerSig: string;
855
852
  timestamp: number;
856
853
  hash: string;
854
+ version: string;
855
+ triggerSig: string;
856
+ input: Record<string, unknown>;
857
857
  callbackUrl: string;
858
858
  settlers: string;
859
859
  triggerConfig: {
@@ -862,7 +862,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
862
862
  };
863
863
  oracleUrls?: string[] | undefined;
864
864
  oracleResponses?: ({
865
- signature: string;
866
865
  result: {
867
866
  value: string;
868
867
  };
@@ -871,13 +870,13 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
871
870
  params: {
872
871
  data: string;
873
872
  chainId: number;
874
- timestamp: number;
875
873
  to: string;
874
+ timestamp: number;
876
875
  };
877
876
  hash: string;
878
877
  };
879
- } | {
880
878
  signature: string;
879
+ } | {
881
880
  result: {
882
881
  value: {
883
882
  accountsInfo: {
@@ -898,8 +897,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
898
897
  };
899
898
  hash: string;
900
899
  };
901
- } | {
902
900
  signature: string;
901
+ } | {
903
902
  result: {
904
903
  value: string;
905
904
  };
@@ -914,8 +913,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
914
913
  };
915
914
  hash: string;
916
915
  };
917
- } | {
918
916
  signature: string;
917
+ } | {
919
918
  result: {
920
919
  value: {
921
920
  timestamp: number;
@@ -942,8 +941,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
942
941
  };
943
942
  hash: string;
944
943
  };
945
- } | {
946
944
  signature: string;
945
+ } | {
947
946
  result: {
948
947
  value: {
949
948
  data: string;
@@ -960,14 +959,15 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
960
959
  };
961
960
  hash: string;
962
961
  };
962
+ signature: string;
963
963
  })[] | undefined;
964
964
  }, {
965
965
  user: string;
966
- version: string;
967
- input: Record<string, unknown>;
968
- triggerSig: string;
969
966
  timestamp: number;
970
967
  hash: string;
968
+ version: string;
969
+ triggerSig: string;
970
+ input: Record<string, unknown>;
971
971
  callbackUrl: string;
972
972
  settlers: string;
973
973
  triggerConfig: {
@@ -976,7 +976,6 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
976
976
  };
977
977
  oracleUrls?: string[] | undefined;
978
978
  oracleResponses?: ({
979
- signature: string;
980
979
  result: {
981
980
  value: string;
982
981
  };
@@ -985,13 +984,13 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
985
984
  params: {
986
985
  data: string;
987
986
  chainId: number;
988
- timestamp: number;
989
987
  to: string;
988
+ timestamp: number;
990
989
  };
991
990
  hash: string;
992
991
  };
993
- } | {
994
992
  signature: string;
993
+ } | {
995
994
  result: {
996
995
  value: {
997
996
  accountsInfo: {
@@ -1012,8 +1011,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
1012
1011
  };
1013
1012
  hash: string;
1014
1013
  };
1015
- } | {
1016
1014
  signature: string;
1015
+ } | {
1017
1016
  result: {
1018
1017
  value: string;
1019
1018
  };
@@ -1028,8 +1027,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
1028
1027
  };
1029
1028
  hash: string;
1030
1029
  };
1031
- } | {
1032
1030
  signature: string;
1031
+ } | {
1033
1032
  result: {
1034
1033
  value: {
1035
1034
  timestamp: number;
@@ -1056,8 +1055,8 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
1056
1055
  };
1057
1056
  hash: string;
1058
1057
  };
1059
- } | {
1060
1058
  signature: string;
1059
+ } | {
1061
1060
  result: {
1062
1061
  value: {
1063
1062
  data: string;
@@ -1074,6 +1073,7 @@ export declare const RunExecutionRequestValidator: z.ZodEffects<z.ZodObject<{
1074
1073
  };
1075
1074
  hash: string;
1076
1075
  };
1076
+ signature: string;
1077
1077
  })[] | undefined;
1078
1078
  }>;
1079
1079
  export declare const RunExecutionResultValidator: z.ZodObject<{
@@ -1,4 +1,4 @@
1
- import { IdlTypes, Program, Provider, web3 } from '@coral-xyz/anchor';
1
+ import { Address, IdlTypes, Program, Provider, web3 } from '@coral-xyz/anchor';
2
2
  import { OpType, Proposal } from '../../shared';
3
3
  import { Settler } from './idls/types/settler';
4
4
  import { EntityType } from './Controller';
@@ -8,7 +8,7 @@ export default class SvmSettler {
8
8
  protected program: Program<Settler>;
9
9
  private validatorSigner;
10
10
  private proposalSigner;
11
- constructor(provider?: Provider);
11
+ constructor(provider: Provider);
12
12
  initializeIx(domain: SolanaEip712Domain): Promise<web3.TransactionInstruction>;
13
13
  updateEip712DomainIx(domain: SolanaEip712Domain): Promise<web3.TransactionInstruction>;
14
14
  createIntentIx(intentHashHex: string, params: CreateIntentParams, isFinal?: boolean): Promise<web3.TransactionInstruction>;
@@ -17,13 +17,13 @@ export default class SvmSettler {
17
17
  createProposalIx(intentHashHex: string, params: CreateProposalParams): Promise<web3.TransactionInstruction>;
18
18
  addInstructionsToProposalIx(intentHashHex: string, moreInstructions: ProposalInstruction[], finalize?: boolean): Promise<web3.TransactionInstruction>;
19
19
  claimStaleProposalIx(intentHashHex: string): Promise<web3.TransactionInstruction>;
20
- addValidatorSigIxs(intentHashHex: string, validatorEthAddress: Buffer, signature: number[], recoveryId: number): Promise<web3.TransactionInstruction[]>;
21
- addAxiaSigIxs(proposal: web3.PublicKey, axiaEthAddress: Buffer, signature: number[], recoveryId: number): Promise<web3.TransactionInstruction[]>;
20
+ addValidatorSigIxs(intentHashHex: string, validatorEthAddress: string, signature: string): Promise<web3.TransactionInstruction[]>;
21
+ addAxiaSigIxs(intentHash: string, proposal: Proposal, axiaEthAddress: string, signature: string): Promise<web3.TransactionInstruction[]>;
22
22
  getSettlerSettingsKey(): web3.PublicKey;
23
23
  getIntentKey(intentHashHex: string): web3.PublicKey;
24
24
  getFulfilledIntentKey(intentHashHex: string): web3.PublicKey;
25
- getProposalKey(intentHashHex: string, solverPubkey?: web3.PublicKey): web3.PublicKey;
26
- getEntityRegistryKey(entityType: EntityType, entityAddress: web3.PublicKey | Buffer): web3.PublicKey;
25
+ getProposalKey(intentHashHex: string, solverPubkey?: Address): web3.PublicKey;
26
+ getEntityRegistryKey(entityType: EntityType, entityAddress: Address | Buffer): web3.PublicKey;
27
27
  getSignerKey(): web3.PublicKey;
28
28
  opTypeToAnchorEnum(op: OpType): IdlTypes<Settler>['opType'];
29
29
  anchorProposalToEip712Proposal(proposalAccount: ProposalAccount, intentHash: number[]): Proposal & {
@@ -36,6 +36,7 @@ export default class SvmSettler {
36
36
  private parseTokenFees;
37
37
  private parseProposalInstructions;
38
38
  private pubkeyOrBufferToBuffer;
39
+ private parseSignature;
39
40
  }
40
41
  export {};
41
42
  //# sourceMappingURL=Settler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Settler.d.ts","sourceRoot":"","sources":["../../../src/settler/svm/Settler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGzE,OAAO,EAA+C,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAK5F,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,EAEnB,MAAM,SAAS,CAAA;AAmBhB,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAGzG,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IACnC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,cAAc,CAAgB;gBAE1B,QAAQ,CAAC,EAAE,QAAQ;IAMzB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAK9E,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC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C,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;IA+BzC,qBAAqB,IAAI,IAAI,CAAC,SAAS;IAIvC,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC,SAAS;IAMnD,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC,SAAS;IAS5D,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS;IAY7E,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,SAAS;IAQ7F,YAAY,IAAI,IAAI,CAAC,SAAS;IAK9B,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAS3D,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,oBAAoB;IAS5B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,cAAc;CASvB"}
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const anchor_1 = require("@coral-xyz/anchor");
27
+ const ethers_1 = require("ethers");
27
28
  const axia_1 = require("../../axia");
28
29
  const shared_1 = require("../../shared");
29
30
  const validator_1 = require("../../validator");
@@ -45,14 +46,14 @@ class SvmSettler {
45
46
  return ix;
46
47
  }
47
48
  async createIntentIx(intentHashHex, params, isFinal = true) {
48
- const { op, user, nonceHex, deadline, minValidations, dataHex, maxFees, eventsHex } = params;
49
+ const { op, user, nonce: nonceHex, deadline, minValidations, data: dataHex, maxFees, events: eventsHex } = params;
49
50
  const intentHash = this.parseIntentHashHex(intentHashHex);
50
51
  const nonce = this.parseIntentNonceHex(nonceHex);
51
52
  const data = (0, shared_1.hexToBytes)(dataHex);
52
53
  const maxFeesBn = this.parseTokenFees(maxFees);
53
54
  const events = this.parseIntentEventsHex(eventsHex);
54
55
  const ix = await this.program.methods
55
- .createIntent(intentHash, data, maxFeesBn, events, minValidations, this.opTypeToAnchorEnum(op), user, nonce, new anchor_1.BN(deadline), isFinal)
56
+ .createIntent(intentHash, data, maxFeesBn, events, minValidations, this.opTypeToAnchorEnum(op), (0, anchor_1.translateAddress)(user), nonce, new anchor_1.BN(deadline), isFinal)
56
57
  .accountsPartial({
57
58
  solver: this.getSignerKey(),
58
59
  solverRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Solver, this.getSignerKey()),
@@ -120,7 +121,8 @@ class SvmSettler {
120
121
  .instruction();
121
122
  return ix;
122
123
  }
123
- async addValidatorSigIxs(intentHashHex, validatorEthAddress, signature, recoveryId) {
124
+ async addValidatorSigIxs(intentHashHex, validatorEthAddress, signature) {
125
+ const { signedMessage, recoveryId } = this.parseSignature(signature);
124
126
  const eip712Preimage = this.validatorSigner.getIntentMessage({
125
127
  hash: intentHashHex,
126
128
  settler: this.program.programId.toString(),
@@ -128,8 +130,8 @@ class SvmSettler {
128
130
  });
129
131
  const secp256k1Ix = anchor_1.web3.Secp256k1Program.createInstructionWithEthAddress({
130
132
  message: (0, shared_1.hexToBytes)(eip712Preimage),
131
- ethAddress: validatorEthAddress,
132
- signature: Buffer.from(signature),
133
+ ethAddress: (0, shared_1.hexToBytes)(validatorEthAddress),
134
+ signature: signedMessage,
133
135
  recoveryId,
134
136
  });
135
137
  const ix = await this.program.methods
@@ -139,25 +141,20 @@ class SvmSettler {
139
141
  solverRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Solver, this.getSignerKey()),
140
142
  intent: this.getIntentKey(intentHashHex),
141
143
  fulfilledIntent: this.getFulfilledIntentKey(intentHashHex),
142
- validatorRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Validator, validatorEthAddress),
144
+ validatorRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Validator, (0, shared_1.hexToBytes)(validatorEthAddress)),
143
145
  settlerSettings: this.getSettlerSettingsKey(),
144
146
  ixSysvar: anchor_1.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
145
147
  })
146
148
  .instruction();
147
149
  return [secp256k1Ix, ix];
148
150
  }
149
- async addAxiaSigIxs(proposal, axiaEthAddress, signature, recoveryId) {
150
- const proposalAccount = await this.program.account.proposal.fetchNullable(proposal);
151
- if (!proposalAccount)
152
- throw new Error(`Couldn't fetch Proposal at address ${proposal}`);
153
- const intentAccount = await this.program.account.intent.fetchNullable(proposalAccount.intent);
154
- if (!intentAccount)
155
- throw new Error(`Couldn't fetch Intent at address ${proposalAccount.intent}`);
156
- const eip712Preimage = this.proposalSigner.getMessage(this.anchorProposalToEip712Proposal(proposalAccount, intentAccount.hash), { chainId: shared_1.Chains.Solana, address: this.program.programId.toString() });
151
+ async addAxiaSigIxs(intentHash, proposal, axiaEthAddress, signature) {
152
+ const { signedMessage, recoveryId } = this.parseSignature(signature);
153
+ const eip712Preimage = this.proposalSigner.getMessage({ ...proposal, intent: intentHash }, { chainId: shared_1.Chains.Solana, address: this.program.programId.toString() });
157
154
  const secp256k1Ix = anchor_1.web3.Secp256k1Program.createInstructionWithEthAddress({
158
155
  message: (0, shared_1.hexToBytes)(eip712Preimage),
159
156
  ethAddress: axiaEthAddress,
160
- signature: Buffer.from(signature),
157
+ signature: signedMessage,
161
158
  recoveryId,
162
159
  });
163
160
  const ix = await this.program.methods
@@ -165,9 +162,9 @@ class SvmSettler {
165
162
  .accountsPartial({
166
163
  solver: this.getSignerKey(),
167
164
  solverRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Solver, this.getSignerKey()),
168
- proposal,
169
- intent: proposalAccount.intent,
170
- axiaRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Axia, axiaEthAddress),
165
+ proposal: this.getProposalKey(intentHash, proposal.solver),
166
+ intent: this.getIntentKey(intentHash),
167
+ axiaRegistry: this.getEntityRegistryKey(Controller_1.EntityType.Axia, (0, shared_1.hexToBytes)(axiaEthAddress)),
171
168
  settlerSettings: this.getSettlerSettingsKey(),
172
169
  ixSysvar: anchor_1.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
173
170
  })
@@ -189,7 +186,7 @@ class SvmSettler {
189
186
  this.parseIntentHashHex(intentHashHex);
190
187
  const intentKey = this.getIntentKey(intentHashHex);
191
188
  const solver = solverPubkey || this.getSignerKey();
192
- return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from('proposal'), intentKey.toBuffer(), solver.toBuffer()], this.program.programId)[0];
189
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from('proposal'), intentKey.toBuffer(), (0, anchor_1.translateAddress)(solver).toBuffer()], this.program.programId)[0];
193
190
  }
194
191
  getEntityRegistryKey(entityType, entityAddress) {
195
192
  const addressBuffer = this.pubkeyOrBufferToBuffer(entityAddress);
@@ -254,18 +251,30 @@ class SvmSettler {
254
251
  }
255
252
  parseTokenFees(tokenFees) {
256
253
  return tokenFees.map((tokenFee) => ({
257
- ...tokenFee,
258
254
  amount: new anchor_1.BN(tokenFee.amount),
255
+ mint: (0, anchor_1.translateAddress)(tokenFee.token),
259
256
  }));
260
257
  }
261
258
  parseProposalInstructions(instructions) {
262
259
  return instructions.map((instruction) => ({
263
260
  ...instruction,
261
+ programId: (0, anchor_1.translateAddress)(instruction.programId),
264
262
  data: typeof instruction.data === 'string' ? (0, shared_1.hexToBytes)(instruction.data) : instruction.data,
265
263
  }));
266
264
  }
267
265
  pubkeyOrBufferToBuffer(pubkeyOrBuffer) {
268
- return Buffer.isBuffer(pubkeyOrBuffer) ? pubkeyOrBuffer : pubkeyOrBuffer.toBuffer();
266
+ return Buffer.isBuffer(pubkeyOrBuffer) ? pubkeyOrBuffer : (0, anchor_1.translateAddress)(pubkeyOrBuffer).toBuffer();
267
+ }
268
+ parseSignature(signature) {
269
+ if (!(0, shared_1.isValidHex)(signature))
270
+ throw new Error('Invalid signature - not hex');
271
+ if ((0, shared_1.hexToBytes)(signature).length !== 65)
272
+ throw new Error('Invalid signature - not 65 bytes');
273
+ const parsedSig = ethers_1.ethers.Signature.from(signature);
274
+ return {
275
+ signedMessage: Buffer.from(ethers_1.ethers.getBytes(parsedSig.r + parsedSig.s.slice(2))),
276
+ recoveryId: parsedSig.v - 27,
277
+ };
269
278
  }
270
279
  }
271
280
  exports.default = SvmSettler;