@ssv-labs/ssv-sdk 0.1.0 → 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.
@@ -85,49 +85,6 @@ export declare const chains: {
85
85
  formatters?: undefined;
86
86
  serializers?: import('viem').ChainSerializers<undefined, import('viem').TransactionSerializable> | undefined;
87
87
  };
88
- readonly holesky: {
89
- blockExplorers: {
90
- readonly default: {
91
- readonly name: "Etherscan";
92
- readonly url: "https://holesky.etherscan.io";
93
- readonly apiUrl: "https://api-holesky.etherscan.io/api";
94
- };
95
- };
96
- blockTime?: number | undefined | undefined;
97
- contracts: {
98
- readonly multicall3: {
99
- readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
100
- readonly blockCreated: 77;
101
- };
102
- readonly ensRegistry: {
103
- readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
104
- readonly blockCreated: 801613;
105
- };
106
- readonly ensUniversalResolver: {
107
- readonly address: "0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b";
108
- readonly blockCreated: 973484;
109
- };
110
- };
111
- ensTlds?: readonly string[] | undefined;
112
- id: 17000;
113
- name: "Holesky";
114
- nativeCurrency: {
115
- readonly name: "Holesky Ether";
116
- readonly symbol: "ETH";
117
- readonly decimals: 18;
118
- };
119
- rpcUrls: {
120
- readonly default: {
121
- readonly http: readonly ["https://ethereum-holesky-rpc.publicnode.com"];
122
- };
123
- };
124
- sourceId?: number | undefined | undefined;
125
- testnet: true;
126
- custom?: Record<string, unknown> | undefined;
127
- fees?: import('viem').ChainFees<undefined> | undefined;
128
- formatters?: undefined;
129
- serializers?: import('viem').ChainSerializers<undefined, import('viem').TransactionSerializable> | undefined;
130
- };
131
88
  readonly hoodi: {
132
89
  blockExplorers?: {
133
90
  [key: string]: {
@@ -172,10 +129,11 @@ export declare const chains: {
172
129
  serializers?: import('viem').ChainSerializers<undefined, import('viem').TransactionSerializable> | undefined;
173
130
  };
174
131
  };
175
- export declare const chainIds: (1 | 560048 | 17000)[];
176
- export declare const networks: ("Hoodi" | "Ethereum" | "Holesky")[];
132
+ export declare const chainIds: (1 | 560048)[];
133
+ export declare const networks: ("Hoodi" | "Ethereum")[];
177
134
  export type SupportedChainsIDs = (typeof chainIds)[number];
178
135
  export declare const graph_endpoints: Record<SupportedChainsIDs, string>;
136
+ export declare const paid_graph_endpoints: Record<SupportedChainsIDs, string>;
179
137
  export declare const rest_endpoints: Record<SupportedChainsIDs, string>;
180
138
  export type ContractAddresses = {
181
139
  setter: Address;
@@ -9,7 +9,6 @@ export type ConfigReturnType = {
9
9
  walletClient: WalletClient;
10
10
  chain: Chain;
11
11
  api: ReturnType<typeof createQueries> & ReturnType<typeof createSSVAPI>;
12
- graphQLClient: GraphQLClient;
13
12
  contractAddresses: {
14
13
  setter: Address;
15
14
  getter: Address;
@@ -22,8 +21,13 @@ export type ConfigReturnType = {
22
21
  };
23
22
  token: ContractInteractions<'token'>;
24
23
  };
25
- graphEndpoint: string;
26
- restEndpoint: string;
24
+ subgraph: {
25
+ client: GraphQLClient;
26
+ endpoint: string;
27
+ };
28
+ rest: {
29
+ endpoint: string;
30
+ };
27
31
  };
28
32
  export declare const isConfig: (props: unknown) => props is ConfigReturnType;
29
33
  type CreateContractInteractionsArgs = {
@@ -56,38 +56,6 @@ function defineChain(chain) {
56
56
  ...chain
57
57
  };
58
58
  }
59
- const holesky = /* @__PURE__ */ defineChain({
60
- id: 17e3,
61
- name: "Holesky",
62
- nativeCurrency: { name: "Holesky Ether", symbol: "ETH", decimals: 18 },
63
- rpcUrls: {
64
- default: {
65
- http: ["https://ethereum-holesky-rpc.publicnode.com"]
66
- }
67
- },
68
- blockExplorers: {
69
- default: {
70
- name: "Etherscan",
71
- url: "https://holesky.etherscan.io",
72
- apiUrl: "https://api-holesky.etherscan.io/api"
73
- }
74
- },
75
- contracts: {
76
- multicall3: {
77
- address: "0xca11bde05977b3631167028862be2a173976ca11",
78
- blockCreated: 77
79
- },
80
- ensRegistry: {
81
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
82
- blockCreated: 801613
83
- },
84
- ensUniversalResolver: {
85
- address: "0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",
86
- blockCreated: 973484
87
- }
88
- },
89
- testnet: true
90
- });
91
59
  const mainnet = /* @__PURE__ */ defineChain({
92
60
  id: 1,
93
61
  name: "Ethereum",
@@ -135,19 +103,20 @@ const hoodi = viem.defineChain({
135
103
  });
136
104
  const chains = {
137
105
  mainnet,
138
- holesky,
139
106
  hoodi
140
107
  };
141
108
  const chainIds = Object.values(chains).map((chain) => chain.id);
142
109
  const networks = Object.values(chains).map((chain) => chain.name);
143
110
  const graph_endpoints = {
144
111
  [mainnet.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-ethereum/version/latest",
145
- [holesky.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-holesky/version/latest",
146
- [hoodi.id]: "https://graph-node-hoodi.stage.ops.ssvlabsinternal.com/subgraphs/name/ssv-bapps-hoodi"
112
+ [hoodi.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-hoodi/version/latest"
113
+ };
114
+ const paid_graph_endpoints = {
115
+ [mainnet.id]: "https://gateway.thegraph.com/api/subgraphs/id/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr",
116
+ [hoodi.id]: "https://gateway.thegraph.com/api/subgraphs/id/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh"
147
117
  };
148
118
  const rest_endpoints = {
149
119
  [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
150
- [holesky.id]: "https://api.ssv.network/api/v4/holesky",
151
120
  [hoodi.id]: "https://api.ssv.network/api/v4/hoodi"
152
121
  };
153
122
  const contracts = {
@@ -156,11 +125,6 @@ const contracts = {
156
125
  getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
157
126
  token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
158
127
  },
159
- [holesky.id]: {
160
- setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
161
- getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
162
- token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
163
- },
164
128
  [hoodi.id]: {
165
129
  setter: "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c",
166
130
  getter: "0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe",
@@ -349,7 +313,7 @@ const configArgsSchema = zod.z.object({
349
313
  });
350
314
  return false;
351
315
  }
352
- if (!chainIds.includes(client.chain?.id)) {
316
+ if (![...chainIds].includes(client.chain?.id)) {
353
317
  ctx.addIssue({
354
318
  code: zod.z.ZodIssueCode.custom,
355
319
  message: `Public client chain must be one of [${networks.join(", ")}]`
@@ -374,7 +338,7 @@ const configArgsSchema = zod.z.object({
374
338
  });
375
339
  return false;
376
340
  }
377
- if (!chainIds.includes(client.chain?.id)) {
341
+ if (![...chainIds].includes(client.chain?.id)) {
378
342
  ctx.addIssue({
379
343
  code: zod.z.ZodIssueCode.custom,
380
344
  message: `Wallet client chain must be one of [${networks.join(", ")}]`
@@ -383,16 +347,30 @@ const configArgsSchema = zod.z.object({
383
347
  }
384
348
  return true;
385
349
  }),
386
- _: zod.z.object({
387
- graphUrl: zod.z.string().url().optional(),
388
- restUrl: zod.z.string().url().optional(),
389
- contractAddresses: zod.z.object({
350
+ extendedConfig: zod.z.object({
351
+ subgraph: zod.z.object({
352
+ endpoint: zod.z.string().url().optional(),
353
+ apiKey: zod.z.string().optional()
354
+ }).optional(),
355
+ rest: zod.z.object({
356
+ endpoint: zod.z.string().url().optional()
357
+ }).optional(),
358
+ contracts: zod.z.object({
390
359
  setter: zod.z.string().optional(),
391
360
  getter: zod.z.string().optional(),
392
361
  token: zod.z.string().optional()
393
362
  }).optional()
394
363
  }).optional()
395
- });
364
+ }).refine(
365
+ (val) => {
366
+ const publicClient = val.publicClient;
367
+ const walletClient = val.walletClient;
368
+ return publicClient?.chain?.id === walletClient?.chain?.id;
369
+ },
370
+ {
371
+ message: "Public and wallet client chains must be the same"
372
+ }
373
+ );
396
374
  const globals = {
397
375
  MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
398
376
  CLUSTER_SIZES: {
@@ -460,6 +438,7 @@ exports.isKeySharesItem = isKeySharesItem;
460
438
  exports.ms = ms;
461
439
  exports.networks = networks;
462
440
  exports.numberFormatter = numberFormatter;
441
+ exports.paid_graph_endpoints = paid_graph_endpoints;
463
442
  exports.percentageFormatter = percentageFormatter;
464
443
  exports.registerValidatorsByClusterSizeLimits = registerValidatorsByClusterSizeLimits;
465
444
  exports.rest_endpoints = rest_endpoints;
@@ -55,38 +55,6 @@ function defineChain(chain) {
55
55
  ...chain
56
56
  };
57
57
  }
58
- const holesky = /* @__PURE__ */ defineChain({
59
- id: 17e3,
60
- name: "Holesky",
61
- nativeCurrency: { name: "Holesky Ether", symbol: "ETH", decimals: 18 },
62
- rpcUrls: {
63
- default: {
64
- http: ["https://ethereum-holesky-rpc.publicnode.com"]
65
- }
66
- },
67
- blockExplorers: {
68
- default: {
69
- name: "Etherscan",
70
- url: "https://holesky.etherscan.io",
71
- apiUrl: "https://api-holesky.etherscan.io/api"
72
- }
73
- },
74
- contracts: {
75
- multicall3: {
76
- address: "0xca11bde05977b3631167028862be2a173976ca11",
77
- blockCreated: 77
78
- },
79
- ensRegistry: {
80
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
81
- blockCreated: 801613
82
- },
83
- ensUniversalResolver: {
84
- address: "0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",
85
- blockCreated: 973484
86
- }
87
- },
88
- testnet: true
89
- });
90
58
  const mainnet = /* @__PURE__ */ defineChain({
91
59
  id: 1,
92
60
  name: "Ethereum",
@@ -134,19 +102,20 @@ const hoodi = defineChain$1({
134
102
  });
135
103
  const chains = {
136
104
  mainnet,
137
- holesky,
138
105
  hoodi
139
106
  };
140
107
  const chainIds = Object.values(chains).map((chain) => chain.id);
141
108
  const networks = Object.values(chains).map((chain) => chain.name);
142
109
  const graph_endpoints = {
143
110
  [mainnet.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-ethereum/version/latest",
144
- [holesky.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-holesky/version/latest",
145
- [hoodi.id]: "https://graph-node-hoodi.stage.ops.ssvlabsinternal.com/subgraphs/name/ssv-bapps-hoodi"
111
+ [hoodi.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-hoodi/version/latest"
112
+ };
113
+ const paid_graph_endpoints = {
114
+ [mainnet.id]: "https://gateway.thegraph.com/api/subgraphs/id/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr",
115
+ [hoodi.id]: "https://gateway.thegraph.com/api/subgraphs/id/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh"
146
116
  };
147
117
  const rest_endpoints = {
148
118
  [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
149
- [holesky.id]: "https://api.ssv.network/api/v4/holesky",
150
119
  [hoodi.id]: "https://api.ssv.network/api/v4/hoodi"
151
120
  };
152
121
  const contracts = {
@@ -155,11 +124,6 @@ const contracts = {
155
124
  getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
156
125
  token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
157
126
  },
158
- [holesky.id]: {
159
- setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
160
- getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
161
- token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
162
- },
163
127
  [hoodi.id]: {
164
128
  setter: "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c",
165
129
  getter: "0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe",
@@ -348,7 +312,7 @@ const configArgsSchema = z.object({
348
312
  });
349
313
  return false;
350
314
  }
351
- if (!chainIds.includes(client.chain?.id)) {
315
+ if (![...chainIds].includes(client.chain?.id)) {
352
316
  ctx.addIssue({
353
317
  code: z.ZodIssueCode.custom,
354
318
  message: `Public client chain must be one of [${networks.join(", ")}]`
@@ -373,7 +337,7 @@ const configArgsSchema = z.object({
373
337
  });
374
338
  return false;
375
339
  }
376
- if (!chainIds.includes(client.chain?.id)) {
340
+ if (![...chainIds].includes(client.chain?.id)) {
377
341
  ctx.addIssue({
378
342
  code: z.ZodIssueCode.custom,
379
343
  message: `Wallet client chain must be one of [${networks.join(", ")}]`
@@ -382,16 +346,30 @@ const configArgsSchema = z.object({
382
346
  }
383
347
  return true;
384
348
  }),
385
- _: z.object({
386
- graphUrl: z.string().url().optional(),
387
- restUrl: z.string().url().optional(),
388
- contractAddresses: z.object({
349
+ extendedConfig: z.object({
350
+ subgraph: z.object({
351
+ endpoint: z.string().url().optional(),
352
+ apiKey: z.string().optional()
353
+ }).optional(),
354
+ rest: z.object({
355
+ endpoint: z.string().url().optional()
356
+ }).optional(),
357
+ contracts: z.object({
389
358
  setter: z.string().optional(),
390
359
  getter: z.string().optional(),
391
360
  token: z.string().optional()
392
361
  }).optional()
393
362
  }).optional()
394
- });
363
+ }).refine(
364
+ (val) => {
365
+ const publicClient = val.publicClient;
366
+ const walletClient = val.walletClient;
367
+ return publicClient?.chain?.id === walletClient?.chain?.id;
368
+ },
369
+ {
370
+ message: "Public and wallet client chains must be the same"
371
+ }
372
+ );
395
373
  const globals = {
396
374
  MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
397
375
  CLUSTER_SIZES: {
@@ -432,8 +410,8 @@ export {
432
410
  decodeOperatorPublicKey as E,
433
411
  tryCatch as F,
434
412
  configArgsSchema as G,
435
- chainIds as H,
436
- contracts as I,
413
+ contracts as H,
414
+ paid_graph_endpoints as I,
437
415
  graph_endpoints as J,
438
416
  KeysharesValidationErrors as K,
439
417
  rest_endpoints as L,
@@ -441,7 +419,8 @@ export {
441
419
  globals as N,
442
420
  hoodi as O,
443
421
  chains as P,
444
- networks as Q,
422
+ chainIds as Q,
423
+ networks as R,
445
424
  _percentageFormatter as _,
446
425
  bigintMin as a,
447
426
  bigintMax as b,