Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanan/sdk v2.4.5 #3

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 61 additions & 34 deletions sdk/classes/Client.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[**@obolnetwork/obol-sdk**](../index.md)

***

[@obolnetwork/obol-sdk](../index.md) / Client

Defined in: [index.ts:62](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L62)

Obol sdk Client can be used for creating, managing and activating distributed validators.

## Extends
Expand All @@ -8,20 +16,23 @@ Obol sdk Client can be used for creating, managing and activating distributed va

### new Client()

> **new Client**(`config`, `signer`?): [`Client`](Client.md)
> **new Client**(`config`, `signer`?, `provider`?): `Client`

Defined in: [index.ts:90](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L90)

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `config` | `object` | Client configurations |
| `config` | \{ `baseUrl`: `string`; `chainId`: `number`; \} | Client configurations |
| `config.baseUrl`? | `string` | obol-api url |
| `config.chainId`? | `number` | Blockchain network ID |
| `signer`? | `Signer` | ethersJS Signer |
| `signer`? | [`SignerType`](../type-aliases/SignerType.md) | ethersJS Signer |
| `provider`? | [`ProviderType`](../type-aliases/ProviderType.md) | - |

#### Returns

[`Client`](Client.md)
`Client`

Obol-SDK Client instance

Expand All @@ -32,16 +43,21 @@ An example of how to instantiate obol-sdk Client:

`Base.constructor`

#### Defined in
## Properties

index.ts:66
| Property | Modifier | Type | Description | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="incentives"></a> `incentives` | `public` | [`Incentives`](Incentives.md) | The incentives module, responsible for managing Obol tokens distribution. | [index.ts:72](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L72) |
| <a id="provider"></a> `provider` | `public` | `undefined` \| `null` \| [`ProviderType`](../type-aliases/ProviderType.md) | The blockchain provider, used to interact with the network. It can be null, undefined, or a valid provider instance and defaults to the Signer provider if Signer is passed. | [index.ts:78](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L78) |

## Methods

### acceptObolLatestTermsAndConditions()

> **acceptObolLatestTermsAndConditions**(): `Promise`\<`string`\>

Defined in: [index.ts:117](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L117)

Accepts Obol terms and conditions to be able to create or update data.

#### Returns
Expand All @@ -57,16 +73,14 @@ On unverified signature or wrong hash.
An example of how to use acceptObolLatestTermsAndConditions:
[acceptObolLatestTermsAndConditions](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L44)

#### Defined in

index.ts:79

***

### createObolRewardsSplit()

> **createObolRewardsSplit**(`rewardsSplitPayload`): `Promise`\<[`ClusterValidator`](../type-aliases/ClusterValidator.md)\>

Defined in: [index.ts:172](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L172)

Deploys OWR and Splitter Proxy.

#### Parameters
Expand All @@ -86,19 +100,17 @@ An example of how to use createObolRewardsSplit:

#### Remarks

**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
and not pushed to version control.

#### Defined in

index.ts:133

***

### createObolTotalSplit()

> **createObolTotalSplit**(`totalSplitPayload`): `Promise`\<[`ClusterValidator`](../type-aliases/ClusterValidator.md)\>

Defined in: [index.ts:293](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L293)

Deploys Splitter Proxy.

#### Parameters
Expand All @@ -118,19 +130,44 @@ An example of how to use createObolTotalSplit:

#### Remarks

**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
and not pushed to version control.

#### Defined in
***

### getOWRTranches()

> **getOWRTranches**(`owrAddress`): `Promise`\<[`OWRTranches`](../type-aliases/OWRTranches.md)\>

Defined in: [index.ts:391](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L391)

Read OWR Tranches.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `owrAddress` | `string` | Address of the Deployed OWR Contract |

#### Returns

`Promise`\<[`OWRTranches`](../type-aliases/OWRTranches.md)\>

index.ts:254
owr tranch information about principal and reward reciepient, as well as the principal amount

#### Remarks

**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
and not pushed to version control.

***

### createClusterDefinition()

> **createClusterDefinition**(`newCluster`): `Promise`\<`string`\>

Defined in: [index.ts:409](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L409)

Creates a cluster definition which contains cluster configuration.

#### Parameters
Expand All @@ -152,16 +189,14 @@ On duplicate entries, missing or wrong cluster keys.
An example of how to use createClusterDefinition:
[createObolCluster](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L59)

#### Defined in

index.ts:350

***

### acceptClusterDefinition()

> **acceptClusterDefinition**(`operatorPayload`, `configHash`): `Promise`\<[`ClusterDefinition`](../interfaces/ClusterDefinition.md)\>

Defined in: [index.ts:474](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L474)

Approves joining a cluster with specific configuration.

#### Parameters
Expand All @@ -184,16 +219,14 @@ On unauthorized, duplicate entries, missing keys, not found cluster or invalid d
An example of how to use acceptClusterDefinition:
[acceptClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L106)

#### Defined in

index.ts:415

***

### getClusterDefinition()

> **getClusterDefinition**(`configHash`): `Promise`\<[`ClusterDefinition`](../interfaces/ClusterDefinition.md)\>

Defined in: [index.ts:528](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L528)

#### Parameters

| Parameter | Type | Description |
Expand All @@ -213,16 +246,14 @@ On not found config hash.
An example of how to use getClusterDefinition:
[getObolClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L74)

#### Defined in

index.ts:469

***

### getClusterLock()

> **getClusterLock**(`configHash`): `Promise`\<[`ClusterLock`](../type-aliases/ClusterLock.md)\>

Defined in: [index.ts:547](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/index.ts#L547)

#### Parameters

| Parameter | Type | Description |
Expand All @@ -241,7 +272,3 @@ On not found cluster definition or lock.

An example of how to use getClusterLock:
[getObolClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L89)

#### Defined in

index.ts:488
112 changes: 112 additions & 0 deletions sdk/classes/Incentives.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[**@obolnetwork/obol-sdk**](../index.md)

***

[@obolnetwork/obol-sdk](../index.md) / Incentives

Defined in: [incentives.ts:24](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/incentives.ts#L24)

**`Internal`**

Incentives can be used for fetching and claiming Obol incentives.

Access it through Client.incentives.

## Example

```ts
const obolClient = new Client(config);
await obolClient.incentives.claimIncentives(address);
```

## Methods

### claimIncentives()

> **claimIncentives**(`address`): `Promise`\<[`ClaimIncentivesResponse`](../type-aliases/ClaimIncentivesResponse.md)\>

Defined in: [incentives.ts:65](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/incentives.ts#L65)

Claims Obol incentives from a Merkle Distributor contract using an address.

This method automatically fetches incentive data and verifies whether the incentives have already been claimed.
If `txHash` is `null`, it indicates that the incentives were already claimed.

Note: This method is not yet enabled and will throw an error if called.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `address` | `string` | The address to claim incentives for |

#### Returns

`Promise`\<[`ClaimIncentivesResponse`](../type-aliases/ClaimIncentivesResponse.md)\>

The transaction hash or already claimed status

#### Remarks

**⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
and not pushed to version control.

#### Throws

Will throw an error if the incentives data is not found or the claim fails

An example of how to use claimIncentives:
[obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L281)

***

### isClaimed()

> **isClaimed**(`contractAddress`, `index`): `Promise`\<`boolean`\>

Defined in: [incentives.ts:124](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/incentives.ts#L124)

Read isClaimed.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `contractAddress` | `string` | Address of the Merkle Distributor Contract |
| `index` | `number` | operator index in merkle tree |

#### Returns

`Promise`\<`boolean`\>

true if incentives are already claime

An example of how to use isClaimed:
[obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L266)

***

### getIncentivesByAddress()

> **getIncentivesByAddress**(`address`): `Promise`\<`Incentives`\>

Defined in: [incentives.ts:144](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/incentives.ts#L144)

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `address` | `string` | Operator address |

#### Returns

`Promise`\<`Incentives`\>

The matched incentives from DB

#### Throws

On not found if address not found.

An example of how to use getIncentivesByAddress:
[obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L250)
2 changes: 0 additions & 2 deletions sdk/classes/README.md

This file was deleted.

18 changes: 14 additions & 4 deletions sdk/enumerations/FORK_MAPPING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
[**@obolnetwork/obol-sdk**](../index.md)

***

[@obolnetwork/obol-sdk](../index.md) / FORK\_MAPPING

Defined in: [types.ts:13](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L13)

Permitted ChainID's

## Enumeration Members

| Enumeration Member | Value | Description | Defined in |
| ------ | ------ | ------ | ------ |
| `0x00000000` | `1` | Mainnet. | types.ts:6 |
| `0x00001020` | `5` | Goerli/Prater. | types.ts:9 |
| `0x00000064` | `100` | Gnosis Chain. | types.ts:12 |
| `0x01017000` | `17000` | Holesky. | types.ts:15 |
| <a id="0x00000000"></a> `0x00000000` | `1` | Mainnet. | [types.ts:15](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L15) |
| <a id="0x00001020"></a> `0x00001020` | `5` | Goerli/Prater. | [types.ts:18](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L18) |
| <a id="0x00000064"></a> `0x00000064` | `100` | Gnosis Chain. | [types.ts:21](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L21) |
| <a id="0x01017000"></a> `0x01017000` | `17000` | Holesky. | [types.ts:24](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L24) |
| <a id="0x90000069"></a> `0x90000069` | `11155111` | Sepolia. | [types.ts:27](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L27) |
| <a id="0x10000910"></a> `0x10000910` | `560048` | Hoodi Chain. | [types.ts:30](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/types.ts#L30) |
2 changes: 0 additions & 2 deletions sdk/enumerations/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions sdk/functions/README.md

This file was deleted.

22 changes: 22 additions & 0 deletions sdk/functions/clusterConfigOrDefinitionHash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[**@obolnetwork/obol-sdk**](../index.md)

***

[@obolnetwork/obol-sdk](../index.md) / clusterConfigOrDefinitionHash

> **clusterConfigOrDefinitionHash**(`cluster`, `configOnly`): `string`

Defined in: [verification/common.ts:64](https://github.com/ObolNetwork/obol-sdk/blob/719eeaf64437833b733de7c3e76fdb5a3bef243a/src/verification/common.ts#L64)

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `cluster` | [`ClusterDefinition`](../interfaces/ClusterDefinition.md) | The cluster configuration or the cluster definition |
| `configOnly` | `boolean` | a boolean to indicate config hash or definition hash |

## Returns

`string`

The config hash or the definition hash in of the corresponding cluster
Loading