@ssv-labs/ssv-sdk 0.1.0 → 0.1.2

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.
@@ -32,7 +32,7 @@ export declare const getOperator: (client: GraphQLClient, args: GetOperatorQuery
32
32
  id: string;
33
33
  validatorCount: string;
34
34
  isPrivate: boolean;
35
- whitelistedContract: import('abitype').Address;
35
+ whitelistedContract: import('viem').Address;
36
36
  } | null>;
37
37
  export declare const getOperators: (client: GraphQLClient, args: GetOperatorsQueryVariables) => Promise<{
38
38
  publicKey: string;
@@ -40,13 +40,13 @@ export declare const getOperators: (client: GraphQLClient, args: GetOperatorsQue
40
40
  id: string;
41
41
  validatorCount: string;
42
42
  isPrivate: boolean;
43
- whitelistedContract: import('abitype').Address;
43
+ whitelistedContract: import('viem').Address;
44
44
  }[]>;
45
45
  export declare const getValidators: (client: GraphQLClient, args: GetValidatorsQueryVariables) => Promise<{
46
- id: import('abitype').Address;
46
+ id: import('viem').Address;
47
47
  }[]>;
48
48
  export declare const getValidator: (client: GraphQLClient, args: GetValidatorQueryVariables) => Promise<{
49
- id: import('abitype').Address;
49
+ id: import('viem').Address;
50
50
  } | null | undefined>;
51
51
  export declare const getClusterBalance: (client: GraphQLClient, args: GetClusterBalanceQueryVariables) => Promise<import('../../graphql/graphql').GetClusterBalanceQuery>;
52
52
  export declare const getQueries: (client: GraphQLClient) => {
@@ -20,7 +20,7 @@ export declare const hoodi: {
20
20
  ensRegistry?: import('viem').ChainContract | undefined;
21
21
  ensUniversalResolver?: import('viem').ChainContract | undefined;
22
22
  multicall3?: import('viem').ChainContract | undefined;
23
- universalSignatureVerifier?: import('viem').ChainContract | undefined;
23
+ erc6492Verifier?: import('viem').ChainContract | undefined;
24
24
  } | undefined;
25
25
  ensTlds?: readonly string[] | undefined;
26
26
  id: 560048;
@@ -30,6 +30,7 @@ export declare const hoodi: {
30
30
  readonly symbol: "ETH";
31
31
  readonly decimals: 18;
32
32
  };
33
+ experimental_preconfirmationTime?: number | undefined | undefined;
33
34
  rpcUrls: {
34
35
  readonly default: {
35
36
  readonly http: readonly ["https://rpc.hoodi.ethpandaops.io"];
@@ -51,14 +52,11 @@ export declare const chains: {
51
52
  readonly apiUrl: "https://api.etherscan.io/api";
52
53
  };
53
54
  };
54
- blockTime?: number | undefined | undefined;
55
+ blockTime: 12000;
55
56
  contracts: {
56
- readonly ensRegistry: {
57
- readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
58
- };
59
57
  readonly ensUniversalResolver: {
60
- readonly address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
61
- readonly blockCreated: 19258213;
58
+ readonly address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
59
+ readonly blockCreated: 23085558;
62
60
  };
63
61
  readonly multicall3: {
64
62
  readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
@@ -73,6 +71,7 @@ export declare const chains: {
73
71
  readonly symbol: "ETH";
74
72
  readonly decimals: 18;
75
73
  };
74
+ experimental_preconfirmationTime?: number | undefined | undefined;
76
75
  rpcUrls: {
77
76
  readonly default: {
78
77
  readonly http: readonly ["https://eth.merkle.io"];
@@ -85,49 +84,6 @@ export declare const chains: {
85
84
  formatters?: undefined;
86
85
  serializers?: import('viem').ChainSerializers<undefined, import('viem').TransactionSerializable> | undefined;
87
86
  };
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
87
  readonly hoodi: {
132
88
  blockExplorers?: {
133
89
  [key: string]: {
@@ -149,7 +105,7 @@ export declare const chains: {
149
105
  ensRegistry?: import('viem').ChainContract | undefined;
150
106
  ensUniversalResolver?: import('viem').ChainContract | undefined;
151
107
  multicall3?: import('viem').ChainContract | undefined;
152
- universalSignatureVerifier?: import('viem').ChainContract | undefined;
108
+ erc6492Verifier?: import('viem').ChainContract | undefined;
153
109
  } | undefined;
154
110
  ensTlds?: readonly string[] | undefined;
155
111
  id: 560048;
@@ -159,6 +115,7 @@ export declare const chains: {
159
115
  readonly symbol: "ETH";
160
116
  readonly decimals: 18;
161
117
  };
118
+ experimental_preconfirmationTime?: number | undefined | undefined;
162
119
  rpcUrls: {
163
120
  readonly default: {
164
121
  readonly http: readonly ["https://rpc.hoodi.ethpandaops.io"];
@@ -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 = {
@@ -55,42 +55,11 @@ 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",
93
61
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
62
+ blockTime: 12e3,
94
63
  rpcUrls: {
95
64
  default: {
96
65
  http: ["https://eth.merkle.io"]
@@ -104,12 +73,9 @@ const mainnet = /* @__PURE__ */ defineChain({
104
73
  }
105
74
  },
106
75
  contracts: {
107
- ensRegistry: {
108
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
109
- },
110
76
  ensUniversalResolver: {
111
- address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
112
- blockCreated: 19258213
77
+ address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
78
+ blockCreated: 23085558
113
79
  },
114
80
  multicall3: {
115
81
  address: "0xca11bde05977b3631167028862be2a173976ca11",
@@ -134,19 +100,20 @@ const hoodi = defineChain$1({
134
100
  });
135
101
  const chains = {
136
102
  mainnet,
137
- holesky,
138
103
  hoodi
139
104
  };
140
105
  const chainIds = Object.values(chains).map((chain) => chain.id);
141
106
  const networks = Object.values(chains).map((chain) => chain.name);
142
107
  const graph_endpoints = {
143
108
  [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"
109
+ [hoodi.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-hoodi/version/latest"
110
+ };
111
+ const paid_graph_endpoints = {
112
+ [mainnet.id]: "https://gateway.thegraph.com/api/subgraphs/id/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr",
113
+ [hoodi.id]: "https://gateway.thegraph.com/api/subgraphs/id/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh"
146
114
  };
147
115
  const rest_endpoints = {
148
116
  [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
149
- [holesky.id]: "https://api.ssv.network/api/v4/holesky",
150
117
  [hoodi.id]: "https://api.ssv.network/api/v4/hoodi"
151
118
  };
152
119
  const contracts = {
@@ -155,11 +122,6 @@ const contracts = {
155
122
  getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
156
123
  token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
157
124
  },
158
- [holesky.id]: {
159
- setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
160
- getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
161
- token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
162
- },
163
125
  [hoodi.id]: {
164
126
  setter: "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c",
165
127
  getter: "0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe",
@@ -348,7 +310,7 @@ const configArgsSchema = z.object({
348
310
  });
349
311
  return false;
350
312
  }
351
- if (!chainIds.includes(client.chain?.id)) {
313
+ if (![...chainIds].includes(client.chain?.id)) {
352
314
  ctx.addIssue({
353
315
  code: z.ZodIssueCode.custom,
354
316
  message: `Public client chain must be one of [${networks.join(", ")}]`
@@ -373,7 +335,7 @@ const configArgsSchema = z.object({
373
335
  });
374
336
  return false;
375
337
  }
376
- if (!chainIds.includes(client.chain?.id)) {
338
+ if (![...chainIds].includes(client.chain?.id)) {
377
339
  ctx.addIssue({
378
340
  code: z.ZodIssueCode.custom,
379
341
  message: `Wallet client chain must be one of [${networks.join(", ")}]`
@@ -382,16 +344,30 @@ const configArgsSchema = z.object({
382
344
  }
383
345
  return true;
384
346
  }),
385
- _: z.object({
386
- graphUrl: z.string().url().optional(),
387
- restUrl: z.string().url().optional(),
388
- contractAddresses: z.object({
347
+ extendedConfig: z.object({
348
+ subgraph: z.object({
349
+ endpoint: z.string().url().optional(),
350
+ apiKey: z.string().optional()
351
+ }).optional(),
352
+ rest: z.object({
353
+ endpoint: z.string().url().optional()
354
+ }).optional(),
355
+ contracts: z.object({
389
356
  setter: z.string().optional(),
390
357
  getter: z.string().optional(),
391
358
  token: z.string().optional()
392
359
  }).optional()
393
360
  }).optional()
394
- });
361
+ }).refine(
362
+ (val) => {
363
+ const publicClient = val.publicClient;
364
+ const walletClient = val.walletClient;
365
+ return publicClient?.chain?.id === walletClient?.chain?.id;
366
+ },
367
+ {
368
+ message: "Public and wallet client chains must be the same"
369
+ }
370
+ );
395
371
  const globals = {
396
372
  MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
397
373
  CLUSTER_SIZES: {
@@ -432,8 +408,8 @@ export {
432
408
  decodeOperatorPublicKey as E,
433
409
  tryCatch as F,
434
410
  configArgsSchema as G,
435
- chainIds as H,
436
- contracts as I,
411
+ contracts as H,
412
+ paid_graph_endpoints as I,
437
413
  graph_endpoints as J,
438
414
  KeysharesValidationErrors as K,
439
415
  rest_endpoints as L,
@@ -441,7 +417,8 @@ export {
441
417
  globals as N,
442
418
  hoodi as O,
443
419
  chains as P,
444
- networks as Q,
420
+ chainIds as Q,
421
+ networks as R,
445
422
  _percentageFormatter as _,
446
423
  bigintMin as a,
447
424
  bigintMax as b,
@@ -56,42 +56,11 @@ 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",
94
62
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
63
+ blockTime: 12e3,
95
64
  rpcUrls: {
96
65
  default: {
97
66
  http: ["https://eth.merkle.io"]
@@ -105,12 +74,9 @@ const mainnet = /* @__PURE__ */ defineChain({
105
74
  }
106
75
  },
107
76
  contracts: {
108
- ensRegistry: {
109
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
110
- },
111
77
  ensUniversalResolver: {
112
- address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
113
- blockCreated: 19258213
78
+ address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
79
+ blockCreated: 23085558
114
80
  },
115
81
  multicall3: {
116
82
  address: "0xca11bde05977b3631167028862be2a173976ca11",
@@ -135,19 +101,20 @@ const hoodi = viem.defineChain({
135
101
  });
136
102
  const chains = {
137
103
  mainnet,
138
- holesky,
139
104
  hoodi
140
105
  };
141
106
  const chainIds = Object.values(chains).map((chain) => chain.id);
142
107
  const networks = Object.values(chains).map((chain) => chain.name);
143
108
  const graph_endpoints = {
144
109
  [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"
110
+ [hoodi.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-hoodi/version/latest"
111
+ };
112
+ const paid_graph_endpoints = {
113
+ [mainnet.id]: "https://gateway.thegraph.com/api/subgraphs/id/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr",
114
+ [hoodi.id]: "https://gateway.thegraph.com/api/subgraphs/id/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh"
147
115
  };
148
116
  const rest_endpoints = {
149
117
  [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
150
- [holesky.id]: "https://api.ssv.network/api/v4/holesky",
151
118
  [hoodi.id]: "https://api.ssv.network/api/v4/hoodi"
152
119
  };
153
120
  const contracts = {
@@ -156,11 +123,6 @@ const contracts = {
156
123
  getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
157
124
  token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
158
125
  },
159
- [holesky.id]: {
160
- setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
161
- getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
162
- token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
163
- },
164
126
  [hoodi.id]: {
165
127
  setter: "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c",
166
128
  getter: "0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe",
@@ -349,7 +311,7 @@ const configArgsSchema = zod.z.object({
349
311
  });
350
312
  return false;
351
313
  }
352
- if (!chainIds.includes(client.chain?.id)) {
314
+ if (![...chainIds].includes(client.chain?.id)) {
353
315
  ctx.addIssue({
354
316
  code: zod.z.ZodIssueCode.custom,
355
317
  message: `Public client chain must be one of [${networks.join(", ")}]`
@@ -374,7 +336,7 @@ const configArgsSchema = zod.z.object({
374
336
  });
375
337
  return false;
376
338
  }
377
- if (!chainIds.includes(client.chain?.id)) {
339
+ if (![...chainIds].includes(client.chain?.id)) {
378
340
  ctx.addIssue({
379
341
  code: zod.z.ZodIssueCode.custom,
380
342
  message: `Wallet client chain must be one of [${networks.join(", ")}]`
@@ -383,16 +345,30 @@ const configArgsSchema = zod.z.object({
383
345
  }
384
346
  return true;
385
347
  }),
386
- _: zod.z.object({
387
- graphUrl: zod.z.string().url().optional(),
388
- restUrl: zod.z.string().url().optional(),
389
- contractAddresses: zod.z.object({
348
+ extendedConfig: zod.z.object({
349
+ subgraph: zod.z.object({
350
+ endpoint: zod.z.string().url().optional(),
351
+ apiKey: zod.z.string().optional()
352
+ }).optional(),
353
+ rest: zod.z.object({
354
+ endpoint: zod.z.string().url().optional()
355
+ }).optional(),
356
+ contracts: zod.z.object({
390
357
  setter: zod.z.string().optional(),
391
358
  getter: zod.z.string().optional(),
392
359
  token: zod.z.string().optional()
393
360
  }).optional()
394
361
  }).optional()
395
- });
362
+ }).refine(
363
+ (val) => {
364
+ const publicClient = val.publicClient;
365
+ const walletClient = val.walletClient;
366
+ return publicClient?.chain?.id === walletClient?.chain?.id;
367
+ },
368
+ {
369
+ message: "Public and wallet client chains must be the same"
370
+ }
371
+ );
396
372
  const globals = {
397
373
  MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
398
374
  CLUSTER_SIZES: {
@@ -460,6 +436,7 @@ exports.isKeySharesItem = isKeySharesItem;
460
436
  exports.ms = ms;
461
437
  exports.networks = networks;
462
438
  exports.numberFormatter = numberFormatter;
439
+ exports.paid_graph_endpoints = paid_graph_endpoints;
463
440
  exports.percentageFormatter = percentageFormatter;
464
441
  exports.registerValidatorsByClusterSizeLimits = registerValidatorsByClusterSizeLimits;
465
442
  exports.rest_endpoints = rest_endpoints;