Skip to content
Merged
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
24 changes: 21 additions & 3 deletions documentation/reference.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: sdk-reference
title: SDK Reference
sidebar_position: 2
id: types-config-errors
title: Types, Config, Errors
sidebar_position: 3
---

# Configuration for the Current Network
Expand Down Expand Up @@ -45,3 +45,21 @@ type BoostData = Awaited<ReturnType<StakeWise.Services.BoostService['getData']>>
You can make calls to the built-in ethers contracts if needed. To access contracts for the current network, use `sdk.contracts`.

For example, if you want to quickly create a standard ERC20 contract, you can use the helper `sdk.contracts.helpers.createErc20(tokenAddress)`.

# Error Handling and Transaction Debugging

Each SDK method validates the arguments passed to it before execution and throws an error if any argument is invalid. For example, if you attempt to send a transaction without providing a provider during SDK initialization, an error will be thrown.

If an error occurs during a transaction, you will see a detailed error logged in the console, including the transaction data. If the error object contains a `solidityError` field, it means the error was successfully parsed and the root cause is immediately visible.

If the `solidityError` field is not present, the error log will still include the `data`, `to`, and `from` fields. Using these values, you can reproduce and debug the transaction with Tenderly:

1. Open Tenderly and go to the Simulator section.
2. Select the appropriate network.
3. Paste the `to` address into the left column (the contract address field).
4. Paste the value from the `data` field into Raw input data.
5. Paste the `from` address into the From field on the right.
6. Disable Use Pending Block.
7. Enter the current block number into the Block Number field.

After running the simulation, you will see the exact error that occurred in the smart contract, making it significantly easier to understand and resolve the issue.
2 changes: 1 addition & 1 deletion src/contracts/multicall/util/handleMulticall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const handleMulticall = async ({ contract, multicallParams }: Input) => {
const { method, args } = multicallParams[0]

// @ts-ignore: no types to describe
const estimatedGas = await contract[method].estimateGas(...args)
const estimatedGas = await wrapErrorHandler<bigint>(contract[method].estimateGas(...args), 'transaction')
const gasLimit = estimatedGas * 110n / 100n

// @ts-ignore: no types to describe
Expand Down