File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,21 @@ const sdk = new LidoSDK({
5656});
5757```
5858
59+ or let the SDK create it for you by passing RPC URL(s):
60+
61+ ``` ts
62+ import { LidoSDK } from ' @lidofinance/lido-ethereum-sdk' ;
63+ // viem is still required as peer dependency for inner workings of SDK
64+ import { hoodi } from ' viem/chains' ;
65+
66+ const sdk = new LidoSDK ({
67+ // in this chainId must be provided explicitly
68+ chainId: hoodi .id ,
69+ // multiple RPC URLs are supported and used in viem's fallback transport
70+ rpcUrls: [' <RPC_URL>' ],
71+ });
72+ ```
73+
5974Replace ` <RPC_URL> ` with the address of your Ethereum provider.
6075
6176## With walletClient
Original file line number Diff line number Diff line change @@ -125,7 +125,6 @@ export default class LidoSDKCore extends LidoSDKCacheable {
125125
126126 publicClient : publicClientProp ,
127127 walletClient : walletClientProp ,
128- // eslint-disable-next-line deprecation/deprecation
129128 rpcUrls,
130129 // eslint-disable-next-line deprecation/deprecation
131130 rpcProvider,
@@ -157,8 +156,14 @@ export default class LidoSDKCore extends LidoSDKCacheable {
157156
158157 const publicClient : LidoSdkPublicClient =
159158 publicClientProp ??
160- // eslint-disable-next-line deprecation/deprecation
161- LidoSDKCore . createRpcProvider ( chainId , rpcUrls as string [ ] ) ;
159+ createPublicClient ( {
160+ batch : {
161+ multicall : true ,
162+ } ,
163+ chain : VIEM_CHAINS [ chainId ] ,
164+ // rpcUrls are checked above
165+ transport : fallback ( ( rpcUrls as string [ ] ) . map ( ( url ) => http ( url ) ) ) ,
166+ } ) ;
162167
163168 if ( publicClient ?. chain ?. id !== chainId ) {
164169 throw this . error ( {
Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ export type LidoSdkKeyedClient = {
5151
5252type LidoSDKCorePropsPublicClientProps =
5353 | {
54- /** @deprecated Use `publicClient` instead. */
5554 rpcUrls : string [ ] ;
5655 chainId : ( typeof SUPPORTED_CHAINS ) [ number ] ;
5756 publicClient ?: undefined ;
You can’t perform that action at this time.
0 commit comments