Skip to content

Commit

Permalink
Merge pull request #105 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop to Main
  • Loading branch information
Jeday authored Jul 14, 2023
2 parents 1d261ff + 160b4eb commit 2df55db
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
15 changes: 15 additions & 0 deletions packages/constants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Part of [Lido JS SDK](https://github.com/lidofinance/lido-js-sdk/#readme)
- [getTokenAddress](#gettokenaddress)
- [Aggregator](#aggregator)
- [getAggregatorAddress](#getaggregatoraddress)
- [WithdrawalQueue](#withdrawalqueue)
- [getWithdrawalQueueAddress](#getWithdrawalQueueAddress)

## Install

Expand Down Expand Up @@ -91,3 +93,16 @@ import { CHAINS, getAggregatorAddress } from '@lido-sdk/constants';
const aggregatorAddress = getAggregatorAddress(CHAINS.Mainnet);
console.log(aggregatorAddress); // 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
```

## WithdrawalQueue

WithdrawalQueue contract for LIDO protocol

### getWithdrawalQueueAddress

```ts
import { CHAINS, getWithdrawalQueueAddress } from '@lido-sdk/constants';

const withdrawalQueueAddress = getWithdrawalQueueAddress(CHAINS.Mainnet);
console.log(withdrawalQueueAddress); // 0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1
```
10 changes: 10 additions & 0 deletions packages/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ It uses [TypeChain](https://github.com/ethereum-ts/TypeChain) under the hood to
- [getWSTETHContract](#getwstethcontract)
- [getSTETHContract](#getstethcontract)
- [getLDOContract](#getldocontract)
- [getWithdrawalQueueContract](#getwithdrawalqueuecontract)
- [getAggregatorContract](#getaggregatorcontract)
- [Cache](#cache)

## Install
Expand Down Expand Up @@ -59,6 +61,14 @@ Returns an instance of `Contract` based on stETH contract [ABI](https://docs.eth

Returns an instance of `Contract` based on LDO token [ABI](https://docs.ethers.io/v5/api/utils/abi/). LDO Token docs can be found here: https://docs.lido.fi/lido-dao/#ldo-token

### getWithdrawalQueueContract

Returns an instance of `Contract` based on WithdrawalQueue contract [ABI](https://docs.ethers.io/v5/api/utils/abi/). Contract docs here: https://docs.lido.fi/contracts/withdrawal-queue-erc721

### getAggregatorContract

Returns an instance of `Contract` based on ChainLink USD/ETH price oracle [ABI](https://docs.ethers.io/v5/api/utils/abi/). EACAggregatorProxy https://etherscan.io/address/0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419

## Cache

To get another contract instance, getters have a third optional parameter `cacheSeed`.
Expand Down
13 changes: 11 additions & 2 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const { useContractRPC, useContractWeb3 } = contractHooksFactory(
);
```

Package `@lido-sdk/react` exports hooks for `WSTETH`, `STETH` and `LDO` contracts:
Package `@lido-sdk/react` exports hooks for `WSTETH`, `STETH`, `LDO` and `WithdrawalQueue` contracts:

```ts
useWSTETHContractRPC();
Expand All @@ -78,6 +78,11 @@ useLDOContractRPC();
useLDOContractWeb3();
```

```ts
useWithdrawalQueueContractRPC();
useWithdrawalQueueContractWeb3();
```

### ERC20 hooks factory

[Source](src/factories/tokens.ts)
Expand Down Expand Up @@ -165,14 +170,18 @@ const App = ({ children }) => {
};
```

### Hooks

All request hooks accept SWR config as optional last argument.

### useTotalSupply

```tsx
import { useTotalSupply } from '@lido-sdk/react';

const Component = () => {
const token = 'token address';
const { data, loading } = useTotalSupply(token);
const { data, loading } = useTotalSupply(token, { isPaused: !token });
const totalSupply = data?.toString();

return <div>{loading ? 'loading...' : totalSupply}</div>;
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11529,9 +11529,9 @@ resolve@^2.0.0-next.3:
linkType: hard

"trim-off-newlines@npm:^1.0.0":
version: 1.0.1
resolution: "trim-off-newlines@npm:1.0.1"
checksum: ca644908cace3d91b4c5b0fee0224640fed34a4503583e542db3f2dbec95246f2dc0f1bdfc5169e95f244f2613c0256ccc0c594ebe678fd9afdd9c5cf424562f
version: 1.0.3
resolution: "trim-off-newlines@npm:1.0.3"
checksum: faf042bb7dd4cb097ab6d358cd51012a9ff5e06f7f2c6570da2ef6f01da9da3ff22ab01080866815e3927ffbf367d57c6aab4c275c67662676b60c563142a558
languageName: node
linkType: hard

Expand Down

0 comments on commit 2df55db

Please sign in to comment.