@obolnetwork/obol-sdk 1.0.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.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ ![Obol Logo](https://obol.tech/obolnetwork.png)
2
+
3
+ <h1 align="center">Obol SDK</h1>
4
+
5
+ This repo contains the Obol Software Development Kit, for creating Distributed Validators with the help of the[Obol API](https://docs.obol.tech/api).
6
+
7
+ ## Getting Started
8
+
9
+ Checkout our [docs](https://docs.obol.tech/docs/int/quickstart/alone).
10
+
package/dist/ajv.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { ErrorObject } from 'ajv';
2
+ import { ClusterPayload } from './types';
3
+ export declare function validateDefinition(data: ClusterPayload): ErrorObject[] | undefined | null;
4
+ //# sourceMappingURL=ajv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../src/ajv.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI,CAQzF"}
package/dist/base.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ declare type Config = {
2
+ baseUrl?: string;
3
+ chainId?: number;
4
+ };
5
+ export declare abstract class Base {
6
+ baseUrl: string;
7
+ chainId: number;
8
+ fork_version: string;
9
+ constructor({ baseUrl, chainId }: Config);
10
+ protected request<T>(endpoint: string, options?: RequestInit): Promise<T>;
11
+ }
12
+ export {};
13
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAKA,aAAK,MAAM,GAAG;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,8BAAsB,IAAI;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;gBAIT,EAAE,OAA8C,EAAE,OAAW,EAAE,EAAE,MAAM;cASnE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAqBhF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cluster.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster.test.d.ts","sourceRoot":"","sources":["../src/cluster.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ export declare const CONFLICT_ERROR_MSG = "Conflict";
2
+ export declare const CreatorConfigHashSigningTypes: {
3
+ CreatorConfigHash: {
4
+ name: string;
5
+ type: string;
6
+ }[];
7
+ };
8
+ export declare const Domain: {
9
+ name: string;
10
+ version: string;
11
+ chainId: number;
12
+ };
13
+ export declare enum FORK_MAPPING {
14
+ "0x00000000" = 1,
15
+ "0x00001020" = 5,
16
+ "0x00000064" = 100,
17
+ "0x70000069" = 1337802,
18
+ "0x80000069" = 3
19
+ }
20
+ export declare const dkg_algorithm = "default";
21
+ export declare const config_version = "v1.5.0";
22
+ export declare const SDK_VERSION = "1.0.0";
23
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,aAAa,CAAA;AAK5C,eAAO,MAAM,6BAA6B;;;;;CAEzC,CAAC;AACF,eAAO,MAAM,MAAM;;;;CAIlB,CAAA;AAED,oBAAY,YAAY;IACpB,YAAY,IAAI;IAChB,YAAY,IAAI;IAChB,YAAY,MAAM;IAClB,YAAY,UAAU;IACtB,YAAY,IAAI;CACnB;AAED,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,eAAO,MAAM,WAAW,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class ConflictError extends Error {
2
+ name: string;
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IACpC,IAAI,SAAkB;;CAQvB"}
@@ -0,0 +1,45 @@
1
+ export declare const clusterLockV1X5: {
2
+ cluster_definition: {
3
+ name: string;
4
+ creator: {
5
+ address: string;
6
+ config_signature: string;
7
+ };
8
+ operators: {
9
+ address: string;
10
+ enr: string;
11
+ config_signature: string;
12
+ enr_signature: string;
13
+ }[];
14
+ uuid: string;
15
+ version: string;
16
+ timestamp: string;
17
+ num_validators: number;
18
+ threshold: number;
19
+ validators: {
20
+ fee_recipient_address: string;
21
+ withdrawal_address: string;
22
+ }[];
23
+ dkg_algorithm: string;
24
+ fork_version: string;
25
+ config_hash: string;
26
+ definition_hash: string;
27
+ };
28
+ distributed_validators: {
29
+ distributed_public_key: string;
30
+ public_shares: string[];
31
+ }[];
32
+ signature_aggregate: string;
33
+ lock_hash: string;
34
+ };
35
+ export declare const clusterConfig: {
36
+ name: string;
37
+ operators: {
38
+ address: string;
39
+ }[];
40
+ validators: {
41
+ fee_recipient_address: string;
42
+ withdrawal_address: string;
43
+ }[];
44
+ };
45
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E3B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAazB,CAAA"}
package/dist/hash.d.ts ADDED
@@ -0,0 +1,64 @@
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 hashClusterDefinitionV1X5: (cluster: any, configOnly: boolean) => ValueOfFields<DefinitionFieldsV1X5>;
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 DefinitionFieldsV1X5 = {
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 DefinitionContainerTypeV1X5 = ContainerType<DefinitionFieldsV1X5>;
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 clusterDefinitionContainerTypeV1X5: (configOnly: boolean) => DefinitionContainerTypeV1X5;
63
+ export {};
64
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAC/B,gBAAgB,cACb,OAAO,KAClB,MAOF,CAAC;AAEF,eAAO,MAAM,yBAAyB,YAC3B,GAAG,cACA,OAAO,KAClB,cAAc,oBAAoB,CAyCpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,UAE7C,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,0BAA0B;;EAE9B,CAAC;AAEH,QAAA,MAAM,yBAAyB;;EAE7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;EAKhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;EAG/B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;EAGlC,CAAC;AAUH,aAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,YAAY,CAAC;IACxB,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,cAAc,CAAC;IAC1B,aAAa,EAAE,YAAY,CAAC;IAC5B,YAAY,EAAE,cAAc,CAAC;IAC7B,SAAS,EAAE,iBAAiB,CAC1B,OAAO,qBAAqB,GAAG,OAAO,0BAA0B,CACjE,CAAC;IACF,OAAO,EAAE,OAAO,oBAAoB,GAAG,OAAO,yBAAyB,CAAC;IACxE,UAAU,EAAE,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B,CAAC;AAEF,oBAAY,2BAA2B,GACrC,aAAa,CAAC,oBAAoB,CAAC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,eACjC,OAAO,gCAwBpB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ethers } from 'ethers';
2
+ import { Base } from './base';
3
+ import { ClusterPayload } from './types';
4
+ export declare class Client extends Base {
5
+ private signer;
6
+ constructor(config: {
7
+ baseUrl?: string | undefined;
8
+ chainId?: number | undefined;
9
+ }, signer: ethers.Wallet);
10
+ /**
11
+ * @param cluster The new unique cluster
12
+ * @returns Invite Link with config_hash
13
+ */
14
+ createClusterDefinition(newCluster: ClusterPayload): Promise<string>;
15
+ /**
16
+ * @param configHash The config hash of the requested cluster
17
+ * @returns The matched cluster details (lock) from DB
18
+ */
19
+ getClusterLock(configHash: string): Promise<any>;
20
+ }
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAiC,cAAc,EAAE,MAAM,SAAS,CAAC;AAKxE,qBAAa,MAAO,SAAQ,IAAI;IAC9B,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM;IAMzG;;;MAGE;IACI,uBAAuB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAyC1E;;;MAGE;IACI,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAQvD"}