@snapshot-labs/snapshot.js 0.4.39 → 0.4.41

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.d.ts CHANGED
@@ -56,6 +56,12 @@ declare const _default: {
56
56
  pattern: string;
57
57
  maxLength: number;
58
58
  };
59
+ coingecko: {
60
+ type: string;
61
+ title: string;
62
+ pattern: string;
63
+ maxLength: number;
64
+ };
59
65
  github: {
60
66
  type: string;
61
67
  title: string;
@@ -499,6 +505,7 @@ declare const _default: {
499
505
  };
500
506
  getHash: typeof import("./sign/utils").getHash;
501
507
  verify: typeof import("./sign/utils").verify;
508
+ validate: typeof import("./utils").validate;
502
509
  SNAPSHOT_SUBGRAPH_URL: {
503
510
  1: string;
504
511
  4: string;
@@ -51,6 +51,12 @@ declare const _default: {
51
51
  pattern: string;
52
52
  maxLength: number;
53
53
  };
54
+ coingecko: {
55
+ type: string;
56
+ title: string;
57
+ pattern: string;
58
+ maxLength: number;
59
+ };
54
60
  github: {
55
61
  type: string;
56
62
  title: string;
@@ -691,6 +691,12 @@ var definitions = {
691
691
  pattern: "^[A-Za-z0-9_]*$",
692
692
  maxLength: 15
693
693
  },
694
+ coingecko: {
695
+ type: "string",
696
+ title: "coingecko",
697
+ pattern: "^[a-z0-9-]*$",
698
+ maxLength: 32
699
+ },
694
700
  github: {
695
701
  type: "string",
696
702
  title: "github",
@@ -2922,6 +2928,21 @@ var networks = {
2922
2928
  explorer: "https://snowtrace.io",
2923
2929
  start: 536483,
2924
2930
  logo: "ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"
2931
+ },
2932
+ "43288": {
2933
+ key: "43288",
2934
+ name: "Boba Avax L2",
2935
+ shortName: "Boba-Avax",
2936
+ chainId: 43288,
2937
+ network: "mainnet",
2938
+ multicall: "0x352E11Da7C12EA2440b079A335E67ff9219f6FfB",
2939
+ rpc: [
2940
+ "https://replica.avax.boba.network",
2941
+ "https://avax.boba.network"
2942
+ ],
2943
+ explorer: "https://blockexplorer.avax.boba.network/",
2944
+ start: 4832,
2945
+ logo: "ipfs://QmP1iuEynzcghrukQLfw7zh7BJwG3dJSwyZprqD4YHHsFD"
2925
2946
  },
2926
2947
  "47805": {
2927
2948
  key: "47805",
@@ -3804,6 +3825,49 @@ function getVp(address, network, strategies, snapshot, space, delegation, option
3804
3825
  });
3805
3826
  });
3806
3827
  }
3828
+ function validate$4(validation, author, space, network, snapshot, params, options) {
3829
+ return __awaiter(this, void 0, void 0, function () {
3830
+ var init, res, json;
3831
+ return __generator(this, function (_a) {
3832
+ switch (_a.label) {
3833
+ case 0:
3834
+ if (!options)
3835
+ options = {};
3836
+ if (!options.url)
3837
+ options.url = 'https://score.snapshot.org';
3838
+ init = {
3839
+ method: 'POST',
3840
+ headers: {
3841
+ Accept: 'application/json',
3842
+ 'Content-Type': 'application/json'
3843
+ },
3844
+ body: JSON.stringify({
3845
+ jsonrpc: '2.0',
3846
+ method: 'validate',
3847
+ params: {
3848
+ validation: validation,
3849
+ author: author,
3850
+ space: space,
3851
+ network: network,
3852
+ snapshot: snapshot,
3853
+ params: params
3854
+ },
3855
+ id: null
3856
+ })
3857
+ };
3858
+ return [4 /*yield*/, fetch__default['default'](options.url, init)];
3859
+ case 1:
3860
+ res = _a.sent();
3861
+ return [4 /*yield*/, res.json()];
3862
+ case 2:
3863
+ json = _a.sent();
3864
+ if (json.error)
3865
+ return [2 /*return*/, Promise.reject(json.error)];
3866
+ return [2 /*return*/, json.result];
3867
+ }
3868
+ });
3869
+ });
3870
+ }
3807
3871
  function validateSchema(schema, data) {
3808
3872
  var ajv = new Ajv__default['default']({ allErrors: true, allowUnionTypes: true, $data: true });
3809
3873
  // @ts-ignore
@@ -3822,9 +3886,9 @@ function validateSchema(schema, data) {
3822
3886
  str.startsWith('snapshot://'));
3823
3887
  }
3824
3888
  });
3825
- var validate = ajv.compile(schema);
3826
- var valid = validate(data);
3827
- return valid ? valid : validate.errors;
3889
+ var ajvValidate = ajv.compile(schema);
3890
+ var valid = ajvValidate(data);
3891
+ return valid ? valid : ajvValidate.errors;
3828
3892
  }
3829
3893
  function getEnsTextRecord(ens, record, network) {
3830
3894
  if (network === void 0) { network = '1'; }
@@ -3943,6 +4007,7 @@ var utils = {
3943
4007
  validations: validations,
3944
4008
  getHash: getHash,
3945
4009
  verify: verify$1,
4010
+ validate: validate$4,
3946
4011
  SNAPSHOT_SUBGRAPH_URL: SNAPSHOT_SUBGRAPH_URL
3947
4012
  };
3948
4013
 
@@ -682,6 +682,12 @@ var definitions = {
682
682
  pattern: "^[A-Za-z0-9_]*$",
683
683
  maxLength: 15
684
684
  },
685
+ coingecko: {
686
+ type: "string",
687
+ title: "coingecko",
688
+ pattern: "^[a-z0-9-]*$",
689
+ maxLength: 32
690
+ },
685
691
  github: {
686
692
  type: "string",
687
693
  title: "github",
@@ -2913,6 +2919,21 @@ var networks = {
2913
2919
  explorer: "https://snowtrace.io",
2914
2920
  start: 536483,
2915
2921
  logo: "ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"
2922
+ },
2923
+ "43288": {
2924
+ key: "43288",
2925
+ name: "Boba Avax L2",
2926
+ shortName: "Boba-Avax",
2927
+ chainId: 43288,
2928
+ network: "mainnet",
2929
+ multicall: "0x352E11Da7C12EA2440b079A335E67ff9219f6FfB",
2930
+ rpc: [
2931
+ "https://replica.avax.boba.network",
2932
+ "https://avax.boba.network"
2933
+ ],
2934
+ explorer: "https://blockexplorer.avax.boba.network/",
2935
+ start: 4832,
2936
+ logo: "ipfs://QmP1iuEynzcghrukQLfw7zh7BJwG3dJSwyZprqD4YHHsFD"
2916
2937
  },
2917
2938
  "47805": {
2918
2939
  key: "47805",
@@ -3795,6 +3816,49 @@ function getVp(address, network, strategies, snapshot, space, delegation, option
3795
3816
  });
3796
3817
  });
3797
3818
  }
3819
+ function validate$4(validation, author, space, network, snapshot, params, options) {
3820
+ return __awaiter(this, void 0, void 0, function () {
3821
+ var init, res, json;
3822
+ return __generator(this, function (_a) {
3823
+ switch (_a.label) {
3824
+ case 0:
3825
+ if (!options)
3826
+ options = {};
3827
+ if (!options.url)
3828
+ options.url = 'https://score.snapshot.org';
3829
+ init = {
3830
+ method: 'POST',
3831
+ headers: {
3832
+ Accept: 'application/json',
3833
+ 'Content-Type': 'application/json'
3834
+ },
3835
+ body: JSON.stringify({
3836
+ jsonrpc: '2.0',
3837
+ method: 'validate',
3838
+ params: {
3839
+ validation: validation,
3840
+ author: author,
3841
+ space: space,
3842
+ network: network,
3843
+ snapshot: snapshot,
3844
+ params: params
3845
+ },
3846
+ id: null
3847
+ })
3848
+ };
3849
+ return [4 /*yield*/, fetch(options.url, init)];
3850
+ case 1:
3851
+ res = _a.sent();
3852
+ return [4 /*yield*/, res.json()];
3853
+ case 2:
3854
+ json = _a.sent();
3855
+ if (json.error)
3856
+ return [2 /*return*/, Promise.reject(json.error)];
3857
+ return [2 /*return*/, json.result];
3858
+ }
3859
+ });
3860
+ });
3861
+ }
3798
3862
  function validateSchema(schema, data) {
3799
3863
  var ajv = new Ajv({ allErrors: true, allowUnionTypes: true, $data: true });
3800
3864
  // @ts-ignore
@@ -3813,9 +3877,9 @@ function validateSchema(schema, data) {
3813
3877
  str.startsWith('snapshot://'));
3814
3878
  }
3815
3879
  });
3816
- var validate = ajv.compile(schema);
3817
- var valid = validate(data);
3818
- return valid ? valid : validate.errors;
3880
+ var ajvValidate = ajv.compile(schema);
3881
+ var valid = ajvValidate(data);
3882
+ return valid ? valid : ajvValidate.errors;
3819
3883
  }
3820
3884
  function getEnsTextRecord(ens, record, network) {
3821
3885
  if (network === void 0) { network = '1'; }
@@ -3934,6 +3998,7 @@ var utils = {
3934
3998
  validations: validations,
3935
3999
  getHash: getHash,
3936
4000
  verify: verify$1,
4001
+ validate: validate$4,
3937
4002
  SNAPSHOT_SUBGRAPH_URL: SNAPSHOT_SUBGRAPH_URL
3938
4003
  };
3939
4004