@obolnetwork/obol-sdk 1.0.8 → 1.0.11

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.
Files changed (66) hide show
  1. package/README.md +2 -1
  2. package/dist/cjs/src/ajv.js +17 -0
  3. package/dist/cjs/src/base.js +39 -0
  4. package/dist/cjs/src/constants.js +86 -0
  5. package/dist/cjs/src/errors.js +11 -0
  6. package/dist/cjs/src/hash.js +172 -0
  7. package/dist/cjs/src/index.js +158 -0
  8. package/dist/cjs/src/schema.js +72 -0
  9. package/dist/cjs/src/services.js +32 -0
  10. package/dist/cjs/src/types.js +18 -0
  11. package/dist/cjs/src/utils.js +11 -0
  12. package/dist/cjs/src/verify.js +326 -0
  13. package/dist/cjs/test/fixtures.js +101 -0
  14. package/dist/cjs/test/methods.test.js +128 -0
  15. package/dist/esm/src/ajv.js +10 -0
  16. package/dist/esm/src/base.js +35 -0
  17. package/dist/esm/src/constants.js +79 -0
  18. package/dist/esm/src/errors.js +7 -0
  19. package/dist/esm/src/hash.js +165 -0
  20. package/dist/esm/src/index.js +140 -0
  21. package/dist/esm/src/schema.js +69 -0
  22. package/dist/esm/src/services.js +28 -0
  23. package/dist/esm/src/types.js +15 -0
  24. package/dist/esm/src/utils.js +6 -0
  25. package/dist/esm/src/verify.js +295 -0
  26. package/dist/esm/test/fixtures.js +98 -0
  27. package/dist/esm/test/methods.test.js +126 -0
  28. package/dist/types/src/ajv.d.ts +2 -0
  29. package/dist/{base.d.ts → types/src/base.d.ts} +13 -14
  30. package/dist/types/src/constants.d.ts +79 -0
  31. package/dist/{errors.d.ts → types/src/errors.d.ts} +4 -5
  32. package/dist/{hash.d.ts → types/src/hash.d.ts} +56 -64
  33. package/dist/{index.d.ts → types/src/index.d.ts} +64 -49
  34. package/dist/types/src/schema.d.ts +57 -0
  35. package/dist/types/src/services.d.ts +11 -0
  36. package/dist/{types.d.ts → types/src/types.d.ts} +153 -150
  37. package/dist/types/src/utils.d.ts +2 -0
  38. package/dist/types/src/verify.d.ts +4 -0
  39. package/dist/{fixtures.d.ts → types/test/fixtures.d.ts} +61 -62
  40. package/dist/types/test/methods.test.d.ts +1 -0
  41. package/package.json +55 -21
  42. package/src/ajv.ts +11 -0
  43. package/src/base.ts +44 -0
  44. package/src/constants.ts +118 -0
  45. package/src/errors.ts +11 -0
  46. package/src/hash.ts +250 -0
  47. package/src/index.ts +160 -0
  48. package/src/schema.ts +70 -0
  49. package/src/services.ts +20 -0
  50. package/src/types.ts +211 -0
  51. package/src/utils.ts +7 -0
  52. package/src/verify.ts +479 -0
  53. package/dist/ajv.d.ts +0 -4
  54. package/dist/ajv.d.ts.map +0 -1
  55. package/dist/base.d.ts.map +0 -1
  56. package/dist/cluster.test.d.ts +0 -2
  57. package/dist/cluster.test.d.ts.map +0 -1
  58. package/dist/constants.d.ts +0 -18
  59. package/dist/constants.d.ts.map +0 -1
  60. package/dist/errors.d.ts.map +0 -1
  61. package/dist/fixtures.d.ts.map +0 -1
  62. package/dist/hash.d.ts.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/index.es.js +0 -15527
  65. package/dist/index.js +0 -15531
  66. package/dist/types.d.ts.map +0 -1
@@ -1,64 +1,56 @@
1
- import { ContainerType, ByteVectorType, UintNumberType, ListCompositeType, ByteListType } from '@chainsafe/ssz';
2
- import { ValueOfFields } from '@chainsafe/ssz/lib/view/container';
3
- import { ClusterDefintion } from './types';
4
- /**
5
- * Returns the SSZ cluster config hash or the definition hash of the given cluster definition object
6
- * @param cluster The cluster whose config hash or definition hash needs to be calculated
7
- * @param configOnly A flag that indicates which hash to evaluate
8
- * @returns The config hash or he definition hash in of the corresponding cluster definition
9
- */
10
- export declare const clusterConfigOrDefinitionHash: (cluster: ClusterDefintion, configOnly: boolean) => string;
11
- export declare const hashClusterDefinitionV1X7: (cluster: ClusterDefintion, configOnly: boolean) => ValueOfFields<DefinitionFieldsV1X7>;
12
- /**
13
- * Converts a string to a Uint8Array
14
- * @param str The string to convert
15
- * @returns The converted Uint8Array
16
- */
17
- export declare const strToUint8Array: (str: string) => Uint8Array;
18
- /**
19
- * operatorContainerType is an SSZ Composite Container type for Operator.
20
- * Note that the type has fixed size for address as it is an ETH1 address (20 bytes).
21
- */
22
- declare const operatorAddressWrapperType: ContainerType<{
23
- address: ByteVectorType;
24
- }>;
25
- declare const creatorAddressWrapperType: ContainerType<{
26
- address: ByteVectorType;
27
- }>;
28
- export declare const operatorContainerType: ContainerType<{
29
- address: ByteVectorType;
30
- enr: ByteListType;
31
- config_signature: ByteVectorType;
32
- enr_signature: ByteVectorType;
33
- }>;
34
- export declare const creatorContainerType: ContainerType<{
35
- address: ByteVectorType;
36
- config_signature: ByteVectorType;
37
- }>;
38
- export declare const validatorsContainerType: ContainerType<{
39
- fee_recipient_address: ByteVectorType;
40
- withdrawal_address: ByteVectorType;
41
- }>;
42
- declare type DefinitionFieldsV1X7 = {
43
- uuid: ByteListType;
44
- name: ByteListType;
45
- version: ByteListType;
46
- timestamp: ByteListType;
47
- num_validators: UintNumberType;
48
- threshold: UintNumberType;
49
- dkg_algorithm: ByteListType;
50
- fork_version: ByteVectorType;
51
- operators: ListCompositeType<typeof operatorContainerType | typeof operatorAddressWrapperType>;
52
- creator: typeof creatorContainerType | typeof creatorAddressWrapperType;
53
- validators: ListCompositeType<typeof validatorsContainerType>;
54
- config_hash?: ByteVectorType;
55
- };
56
- export declare type DefinitionContainerTypeV1X7 = ContainerType<DefinitionFieldsV1X7>;
57
- /**
58
- * Returns the containerized cluster definition
59
- * @param cluster ClusterDefinition to calculate the type from
60
- * @returns SSZ Containerized type of cluster input
61
- */
62
- export declare const clusterDefinitionContainerTypeV1X7: (configOnly: boolean) => DefinitionContainerTypeV1X7;
63
- export {};
64
- //# sourceMappingURL=hash.d.ts.map
1
+ import { ContainerType, ByteVectorType, UintNumberType, ListCompositeType, ByteListType } from '@chainsafe/ssz';
2
+ import { ValueOfFields } from '@chainsafe/ssz/lib/view/container.js';
3
+ import { ClusterDefintion, ClusterLock } from './types.js';
4
+ /**
5
+ * @param cluster The cluster configuration or the cluster definition
6
+ * @param configOnly a boolean to indicate config hash or definition hash
7
+ * @returns The config hash or the definition hash in of the corresponding cluster
8
+ */
9
+ export declare const clusterConfigOrDefinitionHash: (cluster: ClusterDefintion, configOnly: boolean) => string;
10
+ export declare const hashClusterDefinition: (cluster: ClusterDefintion, configOnly: boolean) => ValueOfFields<DefinitionFields>;
11
+ declare const operatorAddressWrapperType: ContainerType<{
12
+ address: ByteVectorType;
13
+ }>;
14
+ declare const creatorAddressWrapperType: ContainerType<{
15
+ address: ByteVectorType;
16
+ }>;
17
+ export declare const operatorContainerType: ContainerType<{
18
+ address: ByteVectorType;
19
+ enr: ByteListType;
20
+ config_signature: ByteVectorType;
21
+ enr_signature: ByteVectorType;
22
+ }>;
23
+ export declare const creatorContainerType: ContainerType<{
24
+ address: ByteVectorType;
25
+ config_signature: ByteVectorType;
26
+ }>;
27
+ export declare const validatorsContainerType: ContainerType<{
28
+ fee_recipient_address: ByteVectorType;
29
+ withdrawal_address: ByteVectorType;
30
+ }>;
31
+ type DefinitionFields = {
32
+ uuid: ByteListType;
33
+ name: ByteListType;
34
+ version: ByteListType;
35
+ timestamp: ByteListType;
36
+ num_validators: UintNumberType;
37
+ threshold: UintNumberType;
38
+ dkg_algorithm: ByteListType;
39
+ fork_version: ByteVectorType;
40
+ operators: ListCompositeType<typeof operatorContainerType | typeof operatorAddressWrapperType>;
41
+ creator: typeof creatorContainerType | typeof creatorAddressWrapperType;
42
+ validators: ListCompositeType<typeof validatorsContainerType>;
43
+ config_hash?: ByteVectorType;
44
+ };
45
+ export type DefinitionContainerType = ContainerType<DefinitionFields>;
46
+ /**
47
+ * @param configOnly a boolean to indicate config hash or definition hash
48
+ * @returns SSZ Containerized type of cluster definition
49
+ */
50
+ export declare const clusterDefinitionContainerType: (configOnly: boolean) => DefinitionContainerType;
51
+ /**
52
+ * @param cluster The published cluster lock
53
+ * @returns The lock hash in of the corresponding cluster
54
+ */
55
+ export declare const clusterLockHash: (cluster: ClusterLock) => string;
56
+ export {};
@@ -1,49 +1,64 @@
1
- import { Signer } from 'ethers';
2
- import { Base } from './base';
3
- import { ClusterDefintion, ClusterLock, ClusterPayload } from './types';
4
- export * from "./types";
5
- /**
6
- * Obol sdk Client can be used for creating, managing and activating distributed validators.
7
- */
8
- export declare class Client extends Base {
9
- private signer;
10
- /**
11
- * @param config
12
- * @param signer ethersJS Signer
13
- * @returns Obol-SDK Client instance
14
- *
15
- * An example of how to instantiate obol-sdk Client:
16
- * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L29)
17
- */
18
- constructor(config: {
19
- baseUrl?: string | undefined;
20
- chainId?: number | undefined;
21
- }, signer: Signer);
22
- /**
23
- * Creates a cluster definition which contains cluster configuration.
24
- * @param {ClusterPayload} newCluster - The new unique cluster.
25
- * @returns {Promise<string>} config_hash.
26
- * @throws On duplicate entries, missing or wrong cluster keys.
27
- *
28
- * An example of how to use createClusterDefinition:
29
- * [createObolCluster](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
30
- */
31
- createClusterDefinition(newCluster: ClusterPayload): Promise<string>;
32
- /**
33
- * @returns {Promise<ClusterDefintion>} The cluster definition for config hash
34
- * @throws On not found config hash.
35
- *
36
- * An example of how to use getClusterDefinition:
37
- * [getObolClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
38
- */
39
- getClusterDefinition(configHash: string): Promise<ClusterDefintion>;
40
- /**
41
- * @returns {Promise<ClusterLock>} The matched cluster details (lock) from DB
42
- * @throws On not found cluster definition or lock.
43
- *
44
- * An example of how to use getClusterLock:
45
- * [getObolClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
46
- */
47
- getClusterLock(configHash: string): Promise<ClusterLock>;
48
- }
49
- //# sourceMappingURL=index.d.ts.map
1
+ import { Signer } from "ethers";
2
+ import { Base } from './base.js';
3
+ import { ClusterDefintion, ClusterLock, ClusterPayload, OperatorPayload } from './types.js';
4
+ export * from "./types.js";
5
+ export * from "./services.js";
6
+ /**
7
+ * Obol sdk Client can be used for creating, managing and activating distributed validators.
8
+ */
9
+ export declare class Client extends Base {
10
+ private signer;
11
+ /**
12
+ * @param config - Client configurations
13
+ * @param config.baseUrl - obol-api url
14
+ * @param config.chainId - Blockchain network ID
15
+ * @param signer - ethersJS Signer
16
+ * @returns Obol-SDK Client instance
17
+ *
18
+ * An example of how to instantiate obol-sdk Client:
19
+ * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L29)
20
+ */
21
+ constructor(config: {
22
+ baseUrl?: string | undefined;
23
+ chainId?: number | undefined;
24
+ }, signer?: Signer);
25
+ /**
26
+ * Creates a cluster definition which contains cluster configuration.
27
+ * @param {ClusterPayload} newCluster - The new unique cluster.
28
+ * @returns {Promise<string>} config_hash.
29
+ * @throws On duplicate entries, missing or wrong cluster keys.
30
+ *
31
+ * An example of how to use createClusterDefinition:
32
+ * [createObolCluster](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
33
+ */
34
+ createClusterDefinition(newCluster: ClusterPayload): Promise<string>;
35
+ /**
36
+ * Approves joining a cluster with specific configuration.
37
+ * @param {OperatorPayload} operatorPayload - The operator data including signatures.
38
+ * @param {string} configHash - The config hash of the cluster which the operator confirms joining to.
39
+ * @returns {Promise<ClusterDefintion>} The cluster definition.
40
+ * @throws On unauthorized, duplicate entries, missing keys, not found cluster or invalid data.
41
+ *
42
+ * An example of how to use acceptClusterDefinition:
43
+ * [acceptClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
44
+ */
45
+ acceptClusterDefinition(operatorPayload: OperatorPayload, configHash: string): Promise<ClusterDefintion>;
46
+ /**
47
+ * @param configHash - The configuration hash returned in createClusterDefinition
48
+ * @returns {Promise<ClusterDefintion>} The cluster definition for config hash
49
+ * @throws On not found config hash.
50
+ *
51
+ * An example of how to use getClusterDefinition:
52
+ * [getObolClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
53
+ */
54
+ getClusterDefinition(configHash: string): Promise<ClusterDefintion>;
55
+ /**
56
+ * @param configHash - The configuration hash in cluster-definition
57
+ * @returns {Promise<ClusterLock>} The matched cluster details (lock) from DB
58
+ * @throws On not found cluster definition or lock.
59
+ *
60
+ * An example of how to use getClusterLock:
61
+ * [getObolClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
62
+ */
63
+ getClusterLock(configHash: string): Promise<ClusterLock>;
64
+ }
@@ -0,0 +1,57 @@
1
+ export declare const operatorPayloadSchema: {
2
+ type: string;
3
+ properties: {
4
+ version: {
5
+ type: string;
6
+ };
7
+ enr: {
8
+ type: string;
9
+ };
10
+ };
11
+ required: string[];
12
+ };
13
+ export declare const definitionSchema: {
14
+ type: string;
15
+ properties: {
16
+ name: {
17
+ type: string;
18
+ };
19
+ operators: {
20
+ type: string;
21
+ minItems: number;
22
+ uniqueItems: boolean;
23
+ items: {
24
+ type: string;
25
+ properties: {
26
+ address: {
27
+ type: string;
28
+ minLength: number;
29
+ maxLength: number;
30
+ };
31
+ };
32
+ required: string[];
33
+ };
34
+ };
35
+ validators: {
36
+ type: string;
37
+ minItems: number;
38
+ items: {
39
+ type: string;
40
+ properties: {
41
+ fee_recipient_address: {
42
+ type: string;
43
+ minLength: number;
44
+ maxLength: number;
45
+ };
46
+ withdrawal_address: {
47
+ type: string;
48
+ minLength: number;
49
+ maxLength: number;
50
+ };
51
+ };
52
+ required: string[];
53
+ };
54
+ };
55
+ };
56
+ required: string[];
57
+ };
@@ -0,0 +1,11 @@
1
+ import { ClusterLock } from "./types.js";
2
+ /**
3
+ * Verifies Cluster Lock's validity.
4
+ * @param lock - cluster lock
5
+ * @returns {Promise<{ result: boolean }> } boolean result to indicate if lock is valid
6
+ * @throws on missing keys or values.
7
+ *
8
+ * An example of how to use validateClusterLock:
9
+ * [validateClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts)
10
+ */
11
+ export declare const validateClusterLock: (lock: ClusterLock) => Promise<boolean>;
@@ -1,150 +1,153 @@
1
- /**
2
- * Permitted ChainID's
3
- */
4
- export declare enum FORK_MAPPING {
5
- /** Mainnet. */
6
- "0x00000000" = 1,
7
- /** Goerli/Prater. */
8
- "0x00001020" = 5,
9
- /** Gnosis Chain. */
10
- "0x00000064" = 100,
11
- /** Holesky. */
12
- "0x01017000" = 17000
13
- }
14
- /**
15
- * Cluster Node Operator
16
- */
17
- export declare type ClusterOperator = {
18
- /** The operator address. */
19
- address: string;
20
- /** The operator ethereum node record. */
21
- enr?: string;
22
- /** The cluster fork_version. */
23
- fork_version?: string;
24
- /** The cluster version. */
25
- version?: string;
26
- /** The operator enr signature. */
27
- enr_signature?: string;
28
- /** The operator configuration signature. */
29
- config_signature?: string;
30
- };
31
- /**
32
- * Cluster Creator
33
- */
34
- export declare type ClusterCreator = {
35
- /** The creator address. */
36
- address: string;
37
- /** The cluster configuration signature. */
38
- config_signature?: string;
39
- };
40
- /**
41
- * Cluster Validator
42
- */
43
- export declare type ClusterValidator = {
44
- /** The validator fee recipient address. */
45
- fee_recipient_address: string;
46
- /** The validator reward address. */
47
- withdrawal_address: string;
48
- };
49
- /**
50
- * Cluster Required Configuration
51
- */
52
- export interface ClusterPayload {
53
- /** The cluster name. */
54
- name: string;
55
- /** The cluster nodes operators addresses. */
56
- operators: ClusterOperator[];
57
- /** The clusters validators information. */
58
- validators: ClusterValidator[];
59
- }
60
- /**
61
- * Cluster Definition
62
- */
63
- export interface ClusterDefintion extends ClusterPayload {
64
- /** The creator of the cluster. */
65
- creator: ClusterCreator;
66
- /** The cluster configuration version. */
67
- version: string;
68
- /** The cluster dkg algorithm. */
69
- dkg_algorithm: string;
70
- /** The cluster fork version. */
71
- fork_version: string;
72
- /** The cluster uuid. */
73
- uuid: string;
74
- /** The cluster creation timestamp. */
75
- timestamp: string;
76
- /** The cluster configuration hash. */
77
- config_hash: string;
78
- /** The distributed validator threshold. */
79
- threshold: number;
80
- /** The number of distributed validators in the cluster. */
81
- num_validators: number;
82
- /** The hash of the cluster definition. */
83
- definition_hash?: string;
84
- }
85
- /**
86
- * Unsigned DV Builder Registration Message
87
- */
88
- export declare type BuilderRegistrationMessage = {
89
- /** The DV fee recipient. */
90
- fee_recipient: string;
91
- /** Default is 30000000. */
92
- gas_limit: number;
93
- /** Timestamp when generating cluster lock file. */
94
- timestamp: number;
95
- /** The public key of the DV. */
96
- pubkey: string;
97
- };
98
- /**
99
- * Pre-generated Signed Validator Builder Registration
100
- */
101
- export declare type BuilderRegistration = {
102
- /** Builder registration message. */
103
- message: BuilderRegistrationMessage;
104
- /** BLS signature of the builder registration message. */
105
- signature: string;
106
- };
107
- /**
108
- * Deposit Data
109
- */
110
- export declare type DepositData = {
111
- /** The public key of the distributed validator. */
112
- pubkey: string;
113
- /** The 0x01 withdrawal address of the DV. */
114
- withdrawal_credentials: string;
115
- /** 32 ethers. */
116
- amount: string;
117
- /** A checksum for DepositData fields . */
118
- deposit_data_root: string;
119
- /** BLS signature of the deposit message. */
120
- signature: string;
121
- };
122
- /**
123
- * Distributed Validator
124
- */
125
- export declare type DistributedValidator = {
126
- /** The public key of the distributed validator. */
127
- distributed_public_key: string;
128
- /** The public key of the node distributed validator share. */
129
- public_shares: string[];
130
- /** The required deposit data for activating the DV. */
131
- deposit_data: Partial<DepositData>;
132
- /** pre-generated signed validator builder registration to be sent to builder network. */
133
- builder_registration: BuilderRegistration;
134
- };
135
- /**
136
- * Cluster Lock (Cluster Details after DKG is complete)
137
- */
138
- export interface ClusterLock {
139
- /** The cluster definition. */
140
- cluster_definition: ClusterDefintion;
141
- /** The cluster distributed validators. */
142
- distributed_validators: DistributedValidator[];
143
- /** The cluster bls signature aggregate. */
144
- signature_aggregate: string;
145
- /** The hash of the cluster lock. */
146
- lock_hash: string;
147
- /** Node Signature for the lock hash by the node secp256k1 key. */
148
- node_signatures: string[];
149
- }
150
- //# sourceMappingURL=types.d.ts.map
1
+ /**
2
+ * Permitted ChainID's
3
+ */
4
+ export declare enum FORK_MAPPING {
5
+ /** Mainnet. */
6
+ "0x00000000" = 1,
7
+ /** Goerli/Prater. */
8
+ "0x00001020" = 5,
9
+ /** Gnosis Chain. */
10
+ "0x00000064" = 100,
11
+ /** Holesky. */
12
+ "0x01017000" = 17000
13
+ }
14
+ /**
15
+ * Node operator data
16
+ */
17
+ export type ClusterOperator = {
18
+ /** The operator address. */
19
+ address: string;
20
+ /** The operator ethereum node record. */
21
+ enr?: string;
22
+ /** The cluster fork_version. */
23
+ fork_version?: string;
24
+ /** The cluster version. */
25
+ version?: string;
26
+ /** The operator enr signature. */
27
+ enr_signature?: string;
28
+ /** The operator configuration signature. */
29
+ config_signature?: string;
30
+ };
31
+ /**
32
+ * A partial view of `ClusterOperator` with `enr` and `version` as required properties.
33
+ */
34
+ export type OperatorPayload = Partial<ClusterOperator> & Required<Pick<ClusterOperator, 'enr' | 'version'>>;
35
+ /**
36
+ * Cluster creator data
37
+ */
38
+ export type ClusterCreator = {
39
+ /** The creator address. */
40
+ address: string;
41
+ /** The cluster configuration signature. */
42
+ config_signature?: string;
43
+ };
44
+ /**
45
+ * Validator withdrawal configuration
46
+ */
47
+ export type ClusterValidator = {
48
+ /** The validator fee recipient address. */
49
+ fee_recipient_address: string;
50
+ /** The validator reward address. */
51
+ withdrawal_address: string;
52
+ };
53
+ /**
54
+ * Cluster configuration
55
+ */
56
+ export type ClusterPayload = {
57
+ /** The cluster name. */
58
+ name: string;
59
+ /** The cluster nodes operators addresses. */
60
+ operators: ClusterOperator[];
61
+ /** The clusters validators information. */
62
+ validators: ClusterValidator[];
63
+ };
64
+ /**
65
+ * Cluster definition data needed for dkg
66
+ */
67
+ export interface ClusterDefintion extends ClusterPayload {
68
+ /** The creator of the cluster. */
69
+ creator: ClusterCreator;
70
+ /** The cluster configuration version. */
71
+ version: string;
72
+ /** The cluster dkg algorithm. */
73
+ dkg_algorithm: string;
74
+ /** The cluster fork version. */
75
+ fork_version: string;
76
+ /** The cluster uuid. */
77
+ uuid: string;
78
+ /** The cluster creation timestamp. */
79
+ timestamp: string;
80
+ /** The cluster configuration hash. */
81
+ config_hash: string;
82
+ /** The distributed validator threshold. */
83
+ threshold: number;
84
+ /** The number of distributed validators in the cluster. */
85
+ num_validators: number;
86
+ /** The hash of the cluster definition. */
87
+ definition_hash?: string;
88
+ }
89
+ /**
90
+ * Unsigned DV Builder Registration Message
91
+ */
92
+ export type BuilderRegistrationMessage = {
93
+ /** The DV fee recipient. */
94
+ fee_recipient: string;
95
+ /** Default is 30000000. */
96
+ gas_limit: number;
97
+ /** Timestamp when generating cluster lock file. */
98
+ timestamp: number;
99
+ /** The public key of the DV. */
100
+ pubkey: string;
101
+ };
102
+ /**
103
+ * Pre-generated Signed Validator Builder Registration
104
+ */
105
+ export type BuilderRegistration = {
106
+ /** Builder registration message. */
107
+ message: BuilderRegistrationMessage;
108
+ /** BLS signature of the builder registration message. */
109
+ signature: string;
110
+ };
111
+ /**
112
+ * Required deposit data for validator activation
113
+ */
114
+ export type DepositData = {
115
+ /** The public key of the distributed validator. */
116
+ pubkey: string;
117
+ /** The 0x01 withdrawal address of the DV. */
118
+ withdrawal_credentials: string;
119
+ /** 32 ethers. */
120
+ amount: string;
121
+ /** A checksum for DepositData fields . */
122
+ deposit_data_root: string;
123
+ /** BLS signature of the deposit message. */
124
+ signature: string;
125
+ };
126
+ /**
127
+ * Required deposit data for validator activation
128
+ */
129
+ export type DistributedValidator = {
130
+ /** The public key of the distributed validator. */
131
+ distributed_public_key: string;
132
+ /** The public key of the node distributed validator share. */
133
+ public_shares: string[];
134
+ /** The required deposit data for activating the DV. */
135
+ deposit_data: Partial<DepositData>;
136
+ /** pre-generated signed validator builder registration to be sent to builder network. */
137
+ builder_registration: BuilderRegistration;
138
+ };
139
+ /**
140
+ * Cluster Details after DKG is complete
141
+ */
142
+ export type ClusterLock = {
143
+ /** The cluster definition. */
144
+ cluster_definition: ClusterDefintion;
145
+ /** The cluster distributed validators. */
146
+ distributed_validators: DistributedValidator[];
147
+ /** The cluster bls signature aggregate. */
148
+ signature_aggregate: string;
149
+ /** The hash of the cluster lock. */
150
+ lock_hash: string;
151
+ /** Node Signature for the lock hash by the node secp256k1 key. */
152
+ node_signatures: string[];
153
+ };
@@ -0,0 +1,2 @@
1
+ export declare const hexWithout0x: (hex: string) => string;
2
+ export declare const strToUint8Array: (str: string) => Uint8Array;
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import { ClusterLock } from "./types.js";
3
+ export declare const signingRoot: (domain: Uint8Array, messageBuffer: Buffer) => Uint8Array;
4
+ export declare const isValidClusterLock: (clusterLock: ClusterLock) => Promise<boolean>;