Migration Guide
Migrating from V3 -> V4
viemis now a peer dependency and you will need to install it separately.
Migrating from V2 -> V3
Common
accountprop now accepts bothAddressandAccountViem object. Can also be skipped if account is hoisted toWalletClientpassed as web3Provider- some methods that did't previously use
web3Providerbut acceptedaccountprop (likepopulate...orsimulate...) now will requireweb3Providerifaccountprop 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.
coreandrpcUrlsat same time) - All dedicated SDK modules now use
type LidoSDKCommonPropsfor constructor options and no longer export separate type
Core
defineWeb3ProviderandsetWeb3Providermethods were removed.web3Provideris now immutable, to change it recreate SDK instancecreateRpcProviderandcreateWeb3Providerare now available asLidoSDKCorestatic methods with different signature. Can be used when calling constructors for SDK & modules.getErrorMessagewas removed
Internal utilities:
getSubgraphIdnow can return null when id not available for current chainperformTransactionargument signature changed
Stake
getStakeLimitInfonow returns more informative object
Events
getRebaseEventsByDayswas removedgetRebaseEventsarguments signature was changed to fit wide range of use-cases, see docsgetLastRebaseEventscovers previous use case ofgetRebaseEvents
Rewards
getRewards... props signature changed to fit wide range of use cases see docs
Props:
to,from,backprops, see docs.stepprop was removed due to conflicting defaults. Replaced withstepEntities(defaults 1000) andstepBlocks(defaults 50000) for subgraph and chain methods accordingly.getSubgraphUrlnow can receive subgraph idnullfor chains where it is not available
Results:
apris available for rebase eventstotalRewardsnow contains cumulative stETH rewards for queried period
APR
LidoSDKApr.calculateAprFromRebaseEventstatic 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,viewsand 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:
approveEOAapproveStethapproveWstethapproveByTokenapproveStethMultisigapproveWstethMultisigapproveMultisigByTokengetAllowanceByTokencheckAllowanceByTokencheckAllowanceStethcheckAllowanceWsteth
replaced with:
approvegetAllowancecheckAllowance
For checkAllowance: isNeedApprove -> isNeedApprove
Request
Most methods revamped:
requestWithdrawalandrequestWithdrawalWithPermitcover all previous functionality and morepermitis optional, if omitted will be requestedamountcan be passed instead ofrequests, amount will be split into requestssplitAmountToRequestshelper is added and is used internally to splitpopulate&simulatehelpers are added
Views
findCheckpointHintsproplastIndexis optional defaults togetLastCheckpointIndex()