Migration Guide
Migrating from V3 -> V4
viem
is now a peer dependency and you will need to install it separately.
Migrating from V2 -> V3
Common
account
prop now accepts bothAddress
andAccount
Viem object. Can also be skipped if account is hoisted toWalletClient
passed as web3Provider- some methods that did't previously use
web3Provider
but acceptedaccount
prop (likepopulate...
orsimulate...
) now will requireweb3Provider
ifaccount
prop is omitted in order to access possibly hoisted account - All exports from individual modules are now available from root export
@lidofinance/lido-ethereum-sdk
- For all modules constructor arguments typings are now more strict. Disallow incorrect combinations (e.g.
core
andrpcUrls
at same time) - All dedicated SDK modules now use
type LidoSDKCommonProps
for constructor options and no longer export separate type
Core
defineWeb3Provider
andsetWeb3Provider
methods were removed.web3Provider
is now immutable, to change it recreate SDK instancecreateRpcProvider
andcreateWeb3Provider
are now available asLidoSDKCore
static methods with different signature. Can be used when calling constructors for SDK & modules.getErrorMessage
was removed
Internal utilities:
getSubgraphId
now can return null when id not available for current chainperformTransaction
argument signature changed
Stake
getStakeLimitInfo
now returns more informative object
Events
getRebaseEventsByDays
was removedgetRebaseEvents
arguments signature was changed to fit wide range of use-cases, see docsgetLastRebaseEvents
covers previous use case ofgetRebaseEvents
Rewards
getRewards...
props signature changed to fit wide range of use cases see docs
Props:
to
,from
,back
props, see docs.step
prop was removed due to conflicting defaults. Replaced withstepEntities
(defaults 1000) andstepBlocks
(defaults 50000) for subgraph and chain methods accordingly.getSubgraphUrl
now can receive subgraph idnull
for chains where it is not available
Results:
apr
is available for rebase eventstotalRewards
now contains cumulative stETH rewards for queried period
APR
LidoSDKApr.calculateAprFromRebaseEvent
static method now available to calculate APR based on rebase event
Unsteth
- type
TransferProps
->UnstethTransferProps
- type
ApproveAllProps
->UnstethApproveAllProps
- type
ApproveProps
->UnstethApproveProps
- type
ApprovedForProps
->UnstethApprovedForProps
- type
IsApprovedForAllProps
->UnstethIsApprovedForAllProps
Methods:
-
setApprovalFor
->setSingleTokenApproval
-
getTokenApprovedFor
->getSingleTokenApproval
-
setApprovalForAll
->setAllTokensApproval
-
getIsApprovedForAll
->areAllTokensApproved
Withdraw
- setters for
core
,views
and others were removed
Claim
- hints are now optional, will be calculated on the spot
- you can pass request ids in any order, they will be sorted alongside corresponding hints
Approve
Excessive methods removed:
approveEOA
approveSteth
approveWsteth
approveByToken
approveStethMultisig
approveWstethMultisig
approveMultisigByToken
getAllowanceByToken
checkAllowanceByToken
checkAllowanceSteth
checkAllowanceWsteth
replaced with:
approve
getAllowance
checkAllowance
For checkAllowance
: isNeedApprove
-> isNeedApprove
Request
Most methods revamped:
requestWithdrawal
andrequestWithdrawalWithPermit
cover all previous functionality and morepermit
is optional, if omitted will be requestedamount
can be passed instead ofrequests
, amount will be split into requestssplitAmountToRequests
helper is added and is used internally to splitpopulate
&simulate
helpers are added
Views
findCheckpointHints
proplastIndex
is optional defaults togetLastCheckpointIndex()