@obolnetwork/obol-sdk 1.0.12 → 1.0.14

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 (70) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +33 -3
  3. package/dist/cjs/package.json +128 -0
  4. package/dist/cjs/src/ajv.js +2 -1
  5. package/dist/cjs/src/base.js +2 -2
  6. package/dist/cjs/src/constants.js +38 -13
  7. package/dist/cjs/src/errors.js +1 -1
  8. package/dist/cjs/src/index.js +24 -21
  9. package/dist/cjs/src/schema.js +24 -36
  10. package/dist/cjs/src/services.js +2 -2
  11. package/dist/cjs/src/types.js +0 -1
  12. package/dist/cjs/src/utils.js +36 -1
  13. package/dist/cjs/src/{verify.js → verification/common.js} +128 -155
  14. package/dist/cjs/src/verification/sszTypes.js +69 -0
  15. package/dist/cjs/src/verification/v1.6.0.js +149 -0
  16. package/dist/cjs/src/verification/v1.7.0.js +173 -0
  17. package/dist/cjs/src/verification/v1.8.0.js +183 -0
  18. package/dist/cjs/test/fixtures.js +281 -63
  19. package/dist/cjs/test/methods.test.js +58 -35
  20. package/dist/esm/package.json +128 -0
  21. package/dist/esm/src/ajv.js +2 -1
  22. package/dist/esm/src/base.js +2 -2
  23. package/dist/esm/src/constants.js +14 -12
  24. package/dist/esm/src/errors.js +1 -1
  25. package/dist/esm/src/index.js +27 -24
  26. package/dist/esm/src/schema.js +24 -36
  27. package/dist/esm/src/services.js +1 -1
  28. package/dist/esm/src/types.js +0 -1
  29. package/dist/esm/src/utils.js +34 -0
  30. package/dist/esm/src/{verify.js → verification/common.js} +114 -146
  31. package/dist/esm/src/verification/sszTypes.js +64 -0
  32. package/dist/esm/src/verification/v1.6.0.js +142 -0
  33. package/dist/esm/src/verification/v1.7.0.js +166 -0
  34. package/dist/esm/src/verification/v1.8.0.js +176 -0
  35. package/dist/esm/test/fixtures.js +280 -62
  36. package/dist/esm/test/methods.test.js +59 -36
  37. package/dist/types/src/ajv.d.ts +1 -1
  38. package/dist/types/src/base.d.ts +3 -3
  39. package/dist/types/src/constants.d.ts +8 -10
  40. package/dist/types/src/index.d.ts +16 -16
  41. package/dist/types/src/services.d.ts +1 -1
  42. package/dist/types/src/types.d.ts +33 -27
  43. package/dist/types/src/utils.d.ts +3 -0
  44. package/dist/types/src/verification/common.d.ts +32 -0
  45. package/dist/types/src/verification/sszTypes.d.ts +63 -0
  46. package/dist/types/src/verification/v1.6.0.d.ts +34 -0
  47. package/dist/types/src/verification/v1.7.0.d.ts +34 -0
  48. package/dist/types/src/verification/v1.8.0.d.ts +35 -0
  49. package/dist/types/test/fixtures.d.ts +104 -2
  50. package/package.json +42 -8
  51. package/src/ajv.ts +15 -10
  52. package/src/base.ts +25 -21
  53. package/src/constants.ts +80 -78
  54. package/src/errors.ts +6 -9
  55. package/src/index.ts +118 -81
  56. package/src/schema.ts +24 -36
  57. package/src/services.ts +15 -13
  58. package/src/types.ts +72 -74
  59. package/src/utils.ts +53 -4
  60. package/src/verification/common.ts +420 -0
  61. package/src/verification/sszTypes.ts +79 -0
  62. package/src/verification/v1.6.0.ts +226 -0
  63. package/src/verification/v1.7.0.ts +274 -0
  64. package/src/verification/v1.8.0.ts +281 -0
  65. package/dist/cjs/src/hash.js +0 -172
  66. package/dist/esm/src/hash.js +0 -165
  67. package/dist/types/src/hash.d.ts +0 -56
  68. package/dist/types/src/verify.d.ts +0 -4
  69. package/src/hash.ts +0 -250
  70. package/src/verify.ts +0 -479
@@ -1,13 +1,13 @@
1
- import { Signer } from "ethers";
1
+ import { type Signer } from 'ethers';
2
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";
3
+ import { type ClusterDefintion, type ClusterLock, type ClusterPayload, type OperatorPayload } from './types.js';
4
+ export * from './types.js';
5
+ export * from './services.js';
6
6
  /**
7
7
  * Obol sdk Client can be used for creating, managing and activating distributed validators.
8
8
  */
9
9
  export declare class Client extends Base {
10
- private signer;
10
+ private readonly signer;
11
11
  /**
12
12
  * @param config - Client configurations
13
13
  * @param config.baseUrl - obol-api url
@@ -19,8 +19,8 @@ export declare class Client extends Base {
19
19
  * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L29)
20
20
  */
21
21
  constructor(config: {
22
- baseUrl?: string | undefined;
23
- chainId?: number | undefined;
22
+ baseUrl?: string;
23
+ chainId?: number;
24
24
  }, signer?: Signer);
25
25
  /**
26
26
  * Creates a cluster definition which contains cluster configuration.
@@ -33,15 +33,15 @@ export declare class Client extends Base {
33
33
  */
34
34
  createClusterDefinition(newCluster: ClusterPayload): Promise<string>;
35
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
- */
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
45
  acceptClusterDefinition(operatorPayload: OperatorPayload, configHash: string): Promise<ClusterDefintion>;
46
46
  /**
47
47
  * @param configHash - The configuration hash returned in createClusterDefinition
@@ -1,4 +1,4 @@
1
- import { ClusterLock } from "./types.js";
1
+ import { type ClusterLock } from './types.js';
2
2
  /**
3
3
  * Verifies Cluster Lock's validity.
4
4
  * @param lock - cluster lock
@@ -3,18 +3,18 @@
3
3
  */
4
4
  export declare enum FORK_MAPPING {
5
5
  /** Mainnet. */
6
- "0x00000000" = 1,
6
+ '0x00000000' = 1,
7
7
  /** Goerli/Prater. */
8
- "0x00001020" = 5,
8
+ '0x00001020' = 5,
9
9
  /** Gnosis Chain. */
10
- "0x00000064" = 100,
10
+ '0x00000064' = 100,
11
11
  /** Holesky. */
12
- "0x01017000" = 17000
12
+ '0x01017000' = 17000
13
13
  }
14
14
  /**
15
15
  * Node operator data
16
16
  */
17
- export type ClusterOperator = {
17
+ export interface ClusterOperator {
18
18
  /** The operator address. */
19
19
  address: string;
20
20
  /** The operator ethereum node record. */
@@ -27,7 +27,7 @@ export type ClusterOperator = {
27
27
  enr_signature?: string;
28
28
  /** The operator configuration signature. */
29
29
  config_signature?: string;
30
- };
30
+ }
31
31
  /**
32
32
  * A partial view of `ClusterOperator` with `enr` and `version` as required properties.
33
33
  */
@@ -35,32 +35,34 @@ export type OperatorPayload = Partial<ClusterOperator> & Required<Pick<ClusterOp
35
35
  /**
36
36
  * Cluster creator data
37
37
  */
38
- export type ClusterCreator = {
38
+ export interface ClusterCreator {
39
39
  /** The creator address. */
40
40
  address: string;
41
41
  /** The cluster configuration signature. */
42
42
  config_signature?: string;
43
- };
43
+ }
44
44
  /**
45
45
  * Validator withdrawal configuration
46
46
  */
47
- export type ClusterValidator = {
47
+ export interface ClusterValidator {
48
48
  /** The validator fee recipient address. */
49
49
  fee_recipient_address: string;
50
50
  /** The validator reward address. */
51
51
  withdrawal_address: string;
52
- };
52
+ }
53
53
  /**
54
54
  * Cluster configuration
55
55
  */
56
- export type ClusterPayload = {
56
+ export interface ClusterPayload {
57
57
  /** The cluster name. */
58
58
  name: string;
59
59
  /** The cluster nodes operators addresses. */
60
60
  operators: ClusterOperator[];
61
- /** The clusters validators information. */
61
+ /** The cluster validators information. */
62
62
  validators: ClusterValidator[];
63
- };
63
+ /** The cluster partial deposits in gwei or 32000000000. */
64
+ deposit_amounts?: string[];
65
+ }
64
66
  /**
65
67
  * Cluster definition data needed for dkg
66
68
  */
@@ -83,13 +85,15 @@ export interface ClusterDefintion extends ClusterPayload {
83
85
  threshold: number;
84
86
  /** The number of distributed validators in the cluster. */
85
87
  num_validators: number;
88
+ /** The cluster partial deposits in gwei or 32000000000. */
89
+ deposit_amounts?: string[];
86
90
  /** The hash of the cluster definition. */
87
91
  definition_hash?: string;
88
92
  }
89
93
  /**
90
94
  * Unsigned DV Builder Registration Message
91
95
  */
92
- export type BuilderRegistrationMessage = {
96
+ export interface BuilderRegistrationMessage {
93
97
  /** The DV fee recipient. */
94
98
  fee_recipient: string;
95
99
  /** Default is 30000000. */
@@ -98,20 +102,20 @@ export type BuilderRegistrationMessage = {
98
102
  timestamp: number;
99
103
  /** The public key of the DV. */
100
104
  pubkey: string;
101
- };
105
+ }
102
106
  /**
103
107
  * Pre-generated Signed Validator Builder Registration
104
108
  */
105
- export type BuilderRegistration = {
109
+ export interface BuilderRegistration {
106
110
  /** Builder registration message. */
107
111
  message: BuilderRegistrationMessage;
108
112
  /** BLS signature of the builder registration message. */
109
113
  signature: string;
110
- };
114
+ }
111
115
  /**
112
116
  * Required deposit data for validator activation
113
117
  */
114
- export type DepositData = {
118
+ export interface DepositData {
115
119
  /** The public key of the distributed validator. */
116
120
  pubkey: string;
117
121
  /** The 0x01 withdrawal address of the DV. */
@@ -122,24 +126,26 @@ export type DepositData = {
122
126
  deposit_data_root: string;
123
127
  /** BLS signature of the deposit message. */
124
128
  signature: string;
125
- };
129
+ }
126
130
  /**
127
131
  * Required deposit data for validator activation
128
132
  */
129
- export type DistributedValidator = {
133
+ export interface DistributedValidator {
130
134
  /** The public key of the distributed validator. */
131
135
  distributed_public_key: string;
132
136
  /** The public key of the node distributed validator share. */
133
137
  public_shares: string[];
134
- /** The required deposit data for activating the DV. */
135
- deposit_data: Partial<DepositData>;
138
+ /** The deposit data for activating the DV. */
139
+ deposit_data?: Partial<DepositData>;
140
+ /** The deposit data with partial amounts or full amount for activating the DV. */
141
+ partial_deposit_data?: Array<Partial<DepositData>>;
136
142
  /** pre-generated signed validator builder registration to be sent to builder network. */
137
- builder_registration: BuilderRegistration;
138
- };
143
+ builder_registration?: BuilderRegistration;
144
+ }
139
145
  /**
140
146
  * Cluster Details after DKG is complete
141
147
  */
142
- export type ClusterLock = {
148
+ export interface ClusterLock {
143
149
  /** The cluster definition. */
144
150
  cluster_definition: ClusterDefintion;
145
151
  /** The cluster distributed validators. */
@@ -149,5 +155,5 @@ export type ClusterLock = {
149
155
  /** The hash of the cluster lock. */
150
156
  lock_hash: string;
151
157
  /** Node Signature for the lock hash by the node secp256k1 key. */
152
- node_signatures: string[];
153
- };
158
+ node_signatures?: string[];
159
+ }
@@ -1,2 +1,5 @@
1
+ import { DefinitionFlow } from './constants';
2
+ import { type ClusterDefintion } from './types';
1
3
  export declare const hexWithout0x: (hex: string) => string;
2
4
  export declare const strToUint8Array: (str: string) => Uint8Array;
5
+ export declare const definitionFlow: (clusterDefinition: ClusterDefintion) => DefinitionFlow | null;
@@ -0,0 +1,32 @@
1
+ /// <reference types="node" />
2
+ import { type ClusterDefintion, type ClusterLock, type DepositData, type DistributedValidator } from '../types.js';
3
+ /**
4
+ * @param cluster The cluster configuration or the cluster definition
5
+ * @param configOnly a boolean to indicate config hash or definition hash
6
+ * @returns The config hash or the definition hash in of the corresponding cluster
7
+ */
8
+ export declare const clusterConfigOrDefinitionHash: (cluster: ClusterDefintion, configOnly: boolean) => string;
9
+ /**
10
+ * Returns the SSZ cluster lock hash of the given cluster lock object
11
+ * @param cluster The cluster lock whose lock hash needs to be calculated
12
+ * @returns The cluster lock hash in of the corresponding cluster lock
13
+ */
14
+ export declare const clusterLockHash: (clusterLock: ClusterLock) => string;
15
+ /**
16
+ * Verify deposit data withdrawal credintials and signature
17
+ * @param {string} forkVersion - fork version in definition file.
18
+ * @param {DistributedValidatorDto} validator - distributed validator.
19
+ * @param {string} withdrawalAddress - withdrawal address in definition file.
20
+ * @returns {boolean} - return if deposit data is valid.
21
+ */
22
+ export declare const verifyDepositData: (distributedPublicKey: string, depositData: Partial<DepositData>, withdrawalAddress: string, forkVersion: string) => {
23
+ isValidDepositData: boolean;
24
+ depositDataMsg: Uint8Array;
25
+ };
26
+ export declare const verifyBuilderRegistration: (validator: DistributedValidator, feeRecipientAddress: string, forkVersion: string) => {
27
+ isValidBuilderRegistration: boolean;
28
+ builderRegistrationMsg: Uint8Array;
29
+ };
30
+ export declare const verifyNodeSignatures: (clusterLock: ClusterLock) => boolean;
31
+ export declare const signingRoot: (domain: Uint8Array, messageBuffer: Buffer) => Uint8Array;
32
+ export declare const isValidClusterLock: (clusterLock: ClusterLock) => Promise<boolean>;
@@ -0,0 +1,63 @@
1
+ import { ByteListType, ByteVectorType, ContainerType, UintNumberType } from '@chainsafe/ssz';
2
+ export declare const operatorAddressWrapperType: ContainerType<{
3
+ address: ByteVectorType;
4
+ }>;
5
+ export declare const creatorAddressWrapperType: ContainerType<{
6
+ address: ByteVectorType;
7
+ }>;
8
+ export declare const operatorContainerType: ContainerType<{
9
+ address: ByteVectorType;
10
+ enr: ByteListType;
11
+ config_signature: ByteVectorType;
12
+ enr_signature: ByteVectorType;
13
+ }>;
14
+ export declare const creatorContainerType: ContainerType<{
15
+ address: ByteVectorType;
16
+ config_signature: ByteVectorType;
17
+ }>;
18
+ export declare const validatorsContainerType: ContainerType<{
19
+ fee_recipient_address: ByteVectorType;
20
+ withdrawal_address: ByteVectorType;
21
+ }>;
22
+ export declare const newCreatorContainerType: (configOnly: boolean) => ContainerType<any>;
23
+ export declare const newOperatorContainerType: (configOnly: boolean) => ContainerType<any>;
24
+ export declare const depositDataContainer: ContainerType<{
25
+ pubkey: ByteVectorType;
26
+ withdrawal_credentials: ByteVectorType;
27
+ amount: UintNumberType;
28
+ signature: ByteVectorType;
29
+ }>;
30
+ export declare const builderRegistrationMessageContainer: ContainerType<{
31
+ fee_recipient: ByteVectorType;
32
+ gas_limit: UintNumberType;
33
+ timestamp: UintNumberType;
34
+ pubkey: ByteVectorType;
35
+ }>;
36
+ export declare const builderRegistrationContainer: ContainerType<{
37
+ message: ContainerType<{
38
+ fee_recipient: ByteVectorType;
39
+ gas_limit: UintNumberType;
40
+ timestamp: UintNumberType;
41
+ pubkey: ByteVectorType;
42
+ }>;
43
+ signature: ByteVectorType;
44
+ }>;
45
+ export declare const builderRegistrationMessageType: ContainerType<{
46
+ fee_recipient: ByteVectorType;
47
+ gas_limit: UintNumberType;
48
+ timestamp: UintNumberType;
49
+ pubkey: ByteVectorType;
50
+ }>;
51
+ export declare const forkDataType: ContainerType<{
52
+ currentVersion: ByteVectorType;
53
+ genesisValidatorsRoot: ByteVectorType;
54
+ }>;
55
+ export declare const depositMessageType: ContainerType<{
56
+ pubkey: ByteVectorType;
57
+ withdrawal_credentials: ByteVectorType;
58
+ amount: UintNumberType;
59
+ }>;
60
+ export declare const signingRootType: ContainerType<{
61
+ objectRoot: ByteVectorType;
62
+ domain: ByteVectorType;
63
+ }>;
@@ -0,0 +1,34 @@
1
+ import { UintNumberType } from '@chainsafe/ssz/lib/type/uint';
2
+ import { type creatorAddressWrapperType, type creatorContainerType, type operatorAddressWrapperType, type operatorContainerType, validatorsContainerType } from './sszTypes';
3
+ import { ByteListType, ByteVectorType, ContainerType, ListCompositeType } from '@chainsafe/ssz';
4
+ import { type ValueOfFields } from '@chainsafe/ssz/lib/view/container';
5
+ import { type ClusterDefintion, type ClusterLock } from '../types';
6
+ type DefinitionFieldsV1X6 = {
7
+ uuid: ByteListType;
8
+ name: ByteListType;
9
+ version: ByteListType;
10
+ timestamp: ByteListType;
11
+ num_validators: UintNumberType;
12
+ threshold: UintNumberType;
13
+ dkg_algorithm: ByteListType;
14
+ fork_version: ByteVectorType;
15
+ operators: ListCompositeType<typeof operatorContainerType | typeof operatorAddressWrapperType>;
16
+ creator: typeof creatorContainerType | typeof creatorAddressWrapperType;
17
+ validators: ListCompositeType<typeof validatorsContainerType>;
18
+ config_hash?: ByteVectorType;
19
+ };
20
+ type DefinitionContainerTypeV1X6 = ContainerType<DefinitionFieldsV1X6>;
21
+ /**
22
+ * Returns the containerized cluster definition
23
+ * @param cluster ClusterDefinition to calculate the type from
24
+ * @returns SSZ Containerized type of cluster input
25
+ */
26
+ export declare const clusterDefinitionContainerTypeV1X6: (configOnly: boolean) => DefinitionContainerTypeV1X6;
27
+ export declare const hashClusterDefinitionV1X6: (cluster: ClusterDefintion, configOnly: boolean) => ValueOfFields<DefinitionFieldsV1X6>;
28
+ /**
29
+ * @param cluster The published cluster lock
30
+ * @returns The lock hash in of the corresponding cluster
31
+ */
32
+ export declare const hashClusterLockV1X6: (cluster: ClusterLock) => string;
33
+ export declare const verifyDVV1X6: (clusterLock: ClusterLock) => boolean;
34
+ export {};
@@ -0,0 +1,34 @@
1
+ import { UintNumberType } from '@chainsafe/ssz/lib/type/uint';
2
+ import { type creatorAddressWrapperType, type creatorContainerType, type operatorAddressWrapperType, type operatorContainerType, validatorsContainerType } from './sszTypes';
3
+ import { ByteListType, ByteVectorType, ContainerType, ListCompositeType } from '@chainsafe/ssz';
4
+ import { type ValueOfFields } from '@chainsafe/ssz/lib/view/container';
5
+ import { type ClusterDefintion, type ClusterLock } from '../types';
6
+ type DefinitionFieldsV1X7 = {
7
+ uuid: ByteListType;
8
+ name: ByteListType;
9
+ version: ByteListType;
10
+ timestamp: ByteListType;
11
+ num_validators: UintNumberType;
12
+ threshold: UintNumberType;
13
+ dkg_algorithm: ByteListType;
14
+ fork_version: ByteVectorType;
15
+ operators: ListCompositeType<typeof operatorContainerType | typeof operatorAddressWrapperType>;
16
+ creator: typeof creatorContainerType | typeof creatorAddressWrapperType;
17
+ validators: ListCompositeType<typeof validatorsContainerType>;
18
+ config_hash?: ByteVectorType;
19
+ };
20
+ type DefinitionContainerTypeV1X7 = ContainerType<DefinitionFieldsV1X7>;
21
+ /**
22
+ * Returns the containerized cluster definition
23
+ * @param cluster ClusterDefinition to calculate the type from
24
+ * @returns SSZ Containerized type of cluster input
25
+ */
26
+ export declare const clusterDefinitionContainerTypeV1X7: (configOnly: boolean) => DefinitionContainerTypeV1X7;
27
+ export declare const hashClusterDefinitionV1X7: (cluster: ClusterDefintion, configOnly: boolean) => ValueOfFields<DefinitionFieldsV1X7>;
28
+ /**
29
+ * @param cluster The published cluster lock
30
+ * @returns The lock hash in of the corresponding cluster
31
+ */
32
+ export declare const hashClusterLockV1X7: (cluster: ClusterLock) => string;
33
+ export declare const verifyDVV1X7: (clusterLock: ClusterLock) => boolean;
34
+ export {};
@@ -0,0 +1,35 @@
1
+ import { UintNumberType } from '@chainsafe/ssz/lib/type/uint';
2
+ import { type creatorAddressWrapperType, type creatorContainerType, type operatorAddressWrapperType, type operatorContainerType, validatorsContainerType } from './sszTypes';
3
+ import { ByteListType, ByteVectorType, ContainerType, ListBasicType, ListCompositeType } from '@chainsafe/ssz';
4
+ import { type ValueOfFields } from '@chainsafe/ssz/lib/view/container';
5
+ import { type ClusterDefintion, type ClusterLock } from '../types';
6
+ type DefinitionFieldsV1X8 = {
7
+ uuid: ByteListType;
8
+ name: ByteListType;
9
+ version: ByteListType;
10
+ timestamp: ByteListType;
11
+ num_validators: UintNumberType;
12
+ threshold: UintNumberType;
13
+ dkg_algorithm: ByteListType;
14
+ fork_version: ByteVectorType;
15
+ operators: ListCompositeType<typeof operatorContainerType | typeof operatorAddressWrapperType>;
16
+ creator: typeof creatorContainerType | typeof creatorAddressWrapperType;
17
+ validators: ListCompositeType<typeof validatorsContainerType>;
18
+ deposit_amounts: ListBasicType<UintNumberType>;
19
+ config_hash?: ByteVectorType;
20
+ };
21
+ type DefinitionContainerTypeV1X8 = ContainerType<DefinitionFieldsV1X8>;
22
+ /**
23
+ * Returns the containerized cluster definition
24
+ * @param cluster ClusterDefinition to calculate the type from
25
+ * @returns SSZ Containerized type of cluster input
26
+ */
27
+ export declare const clusterDefinitionContainerTypeV1X8: (configOnly: boolean) => DefinitionContainerTypeV1X8;
28
+ export declare const hashClusterDefinitionV1X8: (cluster: ClusterDefintion, configOnly: boolean) => ValueOfFields<DefinitionFieldsV1X8>;
29
+ /**
30
+ * @param cluster The published cluster lock
31
+ * @returns The lock hash in of the corresponding cluster
32
+ */
33
+ export declare const hashClusterLockV1X8: (cluster: ClusterLock) => string;
34
+ export declare const verifyDVV1X8: (clusterLock: ClusterLock) => boolean;
35
+ export {};
@@ -1,3 +1,54 @@
1
+ export declare const enr = "enr:-HW4QLlrtMjFLGkFT1bwdGbvZQlH8hLi0M2g44JAxEYP3BZmYpcsy9Q56HPPD87fMucjvLv4-obEFacpsg0ehRilbHeAgmlkgnY0iXNlY3AyNTZrMaEDRaa5o2aSgqyFq_ERZcQTztrOij1mFtXX1bJuVI6ieak";
2
+ export declare const clusterLockV1X6: {
3
+ cluster_definition: {
4
+ name: string;
5
+ creator: {
6
+ address: string;
7
+ config_signature: string;
8
+ };
9
+ operators: {
10
+ address: string;
11
+ enr: string;
12
+ config_signature: string;
13
+ enr_signature: string;
14
+ }[];
15
+ uuid: string;
16
+ version: string;
17
+ timestamp: string;
18
+ num_validators: number;
19
+ threshold: number;
20
+ validators: {
21
+ fee_recipient_address: string;
22
+ withdrawal_address: string;
23
+ }[];
24
+ dkg_algorithm: string;
25
+ fork_version: string;
26
+ config_hash: string;
27
+ definition_hash: string;
28
+ };
29
+ distributed_validators: {
30
+ distributed_public_key: string;
31
+ public_shares: string[];
32
+ deposit_data: {
33
+ pubkey: string;
34
+ withdrawal_credentials: string;
35
+ amount: string;
36
+ signature: string;
37
+ };
38
+ }[];
39
+ signature_aggregate: string;
40
+ lock_hash: string;
41
+ };
42
+ export declare const clusterConfigV1X7: {
43
+ name: string;
44
+ operators: {
45
+ address: string;
46
+ }[];
47
+ validators: {
48
+ fee_recipient_address: string;
49
+ withdrawal_address: string;
50
+ }[];
51
+ };
1
52
  export declare const clusterLockV1X7: {
2
53
  cluster_definition: {
3
54
  name: string;
@@ -33,7 +84,6 @@ export declare const clusterLockV1X7: {
33
84
  withdrawal_credentials: string;
34
85
  amount: string;
35
86
  signature: string;
36
- deposit_data_root: string;
37
87
  };
38
88
  builder_registration: {
39
89
  message: {
@@ -49,7 +99,7 @@ export declare const clusterLockV1X7: {
49
99
  lock_hash: string;
50
100
  node_signatures: string[];
51
101
  };
52
- export declare const clusterConfig: {
102
+ export declare const clusterConfigV1X8: {
53
103
  name: string;
54
104
  operators: {
55
105
  address: string;
@@ -58,4 +108,56 @@ export declare const clusterConfig: {
58
108
  fee_recipient_address: string;
59
109
  withdrawal_address: string;
60
110
  }[];
111
+ deposit_amounts: string[];
112
+ };
113
+ export declare const clusterLockV1X8: {
114
+ cluster_definition: {
115
+ name: string;
116
+ creator: {
117
+ address: string;
118
+ config_signature: string;
119
+ };
120
+ operators: {
121
+ address: string;
122
+ enr: string;
123
+ config_signature: string;
124
+ enr_signature: string;
125
+ }[];
126
+ uuid: string;
127
+ version: string;
128
+ timestamp: string;
129
+ num_validators: number;
130
+ threshold: number;
131
+ validators: {
132
+ fee_recipient_address: string;
133
+ withdrawal_address: string;
134
+ }[];
135
+ dkg_algorithm: string;
136
+ fork_version: string;
137
+ deposit_amounts: string[];
138
+ config_hash: string;
139
+ definition_hash: string;
140
+ };
141
+ distributed_validators: {
142
+ distributed_public_key: string;
143
+ public_shares: string[];
144
+ builder_registration: {
145
+ message: {
146
+ fee_recipient: string;
147
+ gas_limit: number;
148
+ timestamp: number;
149
+ pubkey: string;
150
+ };
151
+ signature: string;
152
+ };
153
+ partial_deposit_data: {
154
+ pubkey: string;
155
+ withdrawal_credentials: string;
156
+ amount: string;
157
+ signature: string;
158
+ }[];
159
+ }[];
160
+ signature_aggregate: string;
161
+ lock_hash: string;
162
+ node_signatures: string[];
61
163
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
- "url": "https://github.com/obolnetwork/obol-packages/issues"
6
+ "url": "https://github.com/obolnetwork/obol-sdk/issues"
7
7
  },
8
8
  "homepage": "https://docs.obol.tech/",
9
9
  "keywords": [
@@ -17,10 +17,11 @@
17
17
  "build": "npm-run-all build:clean compile",
18
18
  "test": "jest ./test/methods.test.ts",
19
19
  "generate-typedoc": "typedoc",
20
- "ds:release": "npm publish --tag latest",
21
- "ds:release:major": "npm version $(semver $npm_package_version -i major) && npm publish --tag latest",
22
- "ds:release:minor": "npm version $(semver $npm_package_version -i minor) && npm publish --tag latest",
23
- "ds:release:patch": "npm version $(semver $npm_package_version -i patch) && npm publish --tag latest"
20
+ "npm:publish": "npm publish --tag latest",
21
+ "release": "release-it",
22
+ "release:dry": "release-it --dry-run --no-npm",
23
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
24
+ "lint-ci": "eslint \"{src,apps,libs,test}/**/*.ts\""
24
25
  },
25
26
  "main": "./dist/cjs/src/index.js",
26
27
  "module": "./dist/esm/src/index.js",
@@ -28,7 +29,7 @@
28
29
  "author": "Obol Labs (https://obol.tech)",
29
30
  "repository": {
30
31
  "type": "git",
31
- "url": "git+https://github.com/obolnetwork/obol-packages.git"
32
+ "url": "git+https://github.com/obolnetwork/obol-sdk.git"
32
33
  },
33
34
  "license": "ISC",
34
35
  "publishConfig": {
@@ -44,16 +45,24 @@
44
45
  "ajv": "^8.12.0",
45
46
  "cross-fetch": "^3.1.5",
46
47
  "elliptic": "^6.5.4",
48
+ "eslint-config-standard-with-typescript": "^43.0.1",
49
+ "eslint-plugin-import": "^2.29.1",
50
+ "eslint-plugin-n": "^16.6.2",
51
+ "eslint-plugin-promise": "^6.1.1",
47
52
  "ethers": "^6.4.0",
48
53
  "nock": "^13.5.3",
54
+ "release-it": "^17.1.1",
55
+ "semver": "^7.6.0",
56
+ "typescript-eslint": "^7.1.0",
49
57
  "uuid": "^9.0.0"
50
58
  },
51
59
  "devDependencies": {
60
+ "@release-it/conventional-changelog": "^8.0.1",
52
61
  "@types/elliptic": "^6.4.18",
53
62
  "@types/jest": "^28.1.8",
54
63
  "@types/node": "^20.2.5",
55
64
  "@types/uuid": "^9.0.1",
56
- "eslint": "^8.6.0",
65
+ "eslint": "^8.57.0",
57
66
  "jest": "^28.1.3",
58
67
  "msw": "^2.2.1",
59
68
  "npm-run-all": "^4.1.5",
@@ -72,6 +81,31 @@
72
81
  "dist",
73
82
  "src"
74
83
  ],
84
+ "release-it": {
85
+ "git": {
86
+ "commitMessage": "chore(release): v${version}",
87
+ "push": true,
88
+ "commit": true,
89
+ "tag": true,
90
+ "requireCommits": false,
91
+ "requireCleanWorkingDir": false
92
+ },
93
+ "github": {
94
+ "release": true,
95
+ "draft": true
96
+ },
97
+ "npm": {
98
+ "publish": false,
99
+ "ignoreVersion": false
100
+ },
101
+ "plugins": {
102
+ "@release-it/conventional-changelog": {
103
+ "preset": "angular",
104
+ "infile": "CHANGELOG.md",
105
+ "header": "# Changelog"
106
+ }
107
+ }
108
+ },
75
109
  "jest": {
76
110
  "transform": {
77
111
  "\\.[jt]sx?$": "ts-jest"