@snapshot-labs/snapshot.js 0.12.20 → 0.12.22

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.
@@ -593,9 +593,7 @@ var definitions = {
593
593
  maxItems: 100,
594
594
  items: {
595
595
  type: "string",
596
- pattern: "^0x[a-fA-F0-9]{40}$",
597
- minLength: 42,
598
- maxLength: 42
596
+ format: "evmAddress"
599
597
  },
600
598
  title: "members",
601
599
  uniqueItems: true
@@ -605,9 +603,7 @@ var definitions = {
605
603
  maxItems: 100,
606
604
  items: {
607
605
  type: "string",
608
- pattern: "^0x[a-fA-F0-9]{40}$",
609
- minLength: 42,
610
- maxLength: 42
606
+ format: "evmAddress"
611
607
  },
612
608
  title: "admins",
613
609
  uniqueItems: true
@@ -617,9 +613,7 @@ var definitions = {
617
613
  maxItems: 100,
618
614
  items: {
619
615
  type: "string",
620
- pattern: "^0x[a-fA-F0-9]{40}$",
621
- minLength: 42,
622
- maxLength: 42
616
+ format: "evmAddress"
623
617
  },
624
618
  title: "moderators",
625
619
  uniqueItems: true
@@ -722,7 +716,7 @@ var definitions = {
722
716
  },
723
717
  delegationContract: {
724
718
  type: "string",
725
- format: "address",
719
+ format: "evmAddress",
726
720
  title: "Contract address",
727
721
  description: "The address of your delegation contract",
728
722
  examples: [
@@ -851,9 +845,14 @@ var definitions = {
851
845
  examples: [
852
846
  "e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
853
847
  ],
854
- pattern: "^0x[a-fA-F0-9]{40}$",
855
- minLength: 42,
856
- maxLength: 42
848
+ anyOf: [
849
+ {
850
+ format: "evmAddress"
851
+ },
852
+ {
853
+ format: "starknetAddress"
854
+ }
855
+ ]
857
856
  },
858
857
  network: {
859
858
  type: "string",
@@ -3917,6 +3916,17 @@ ajv.addFormat('address', {
3917
3916
  }
3918
3917
  }
3919
3918
  });
3919
+ ajv.addFormat('evmAddress', {
3920
+ validate: (value) => {
3921
+ try {
3922
+ address.getAddress(value);
3923
+ return true;
3924
+ }
3925
+ catch (e) {
3926
+ return false;
3927
+ }
3928
+ }
3929
+ });
3920
3930
  ajv.addFormat('starknetAddress', {
3921
3931
  validate: (value) => {
3922
3932
  try {
@@ -583,9 +583,7 @@ var definitions = {
583
583
  maxItems: 100,
584
584
  items: {
585
585
  type: "string",
586
- pattern: "^0x[a-fA-F0-9]{40}$",
587
- minLength: 42,
588
- maxLength: 42
586
+ format: "evmAddress"
589
587
  },
590
588
  title: "members",
591
589
  uniqueItems: true
@@ -595,9 +593,7 @@ var definitions = {
595
593
  maxItems: 100,
596
594
  items: {
597
595
  type: "string",
598
- pattern: "^0x[a-fA-F0-9]{40}$",
599
- minLength: 42,
600
- maxLength: 42
596
+ format: "evmAddress"
601
597
  },
602
598
  title: "admins",
603
599
  uniqueItems: true
@@ -607,9 +603,7 @@ var definitions = {
607
603
  maxItems: 100,
608
604
  items: {
609
605
  type: "string",
610
- pattern: "^0x[a-fA-F0-9]{40}$",
611
- minLength: 42,
612
- maxLength: 42
606
+ format: "evmAddress"
613
607
  },
614
608
  title: "moderators",
615
609
  uniqueItems: true
@@ -712,7 +706,7 @@ var definitions = {
712
706
  },
713
707
  delegationContract: {
714
708
  type: "string",
715
- format: "address",
709
+ format: "evmAddress",
716
710
  title: "Contract address",
717
711
  description: "The address of your delegation contract",
718
712
  examples: [
@@ -841,9 +835,14 @@ var definitions = {
841
835
  examples: [
842
836
  "e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
843
837
  ],
844
- pattern: "^0x[a-fA-F0-9]{40}$",
845
- minLength: 42,
846
- maxLength: 42
838
+ anyOf: [
839
+ {
840
+ format: "evmAddress"
841
+ },
842
+ {
843
+ format: "starknetAddress"
844
+ }
845
+ ]
847
846
  },
848
847
  network: {
849
848
  type: "string",
@@ -3907,6 +3906,17 @@ ajv.addFormat('address', {
3907
3906
  }
3908
3907
  }
3909
3908
  });
3909
+ ajv.addFormat('evmAddress', {
3910
+ validate: (value) => {
3911
+ try {
3912
+ getAddress(value);
3913
+ return true;
3914
+ }
3915
+ catch (e) {
3916
+ return false;
3917
+ }
3918
+ }
3919
+ });
3910
3920
  ajv.addFormat('starknetAddress', {
3911
3921
  validate: (value) => {
3912
3922
  try {