Error Handling

The SDK throws errors for invalid operations and network issues. Always wrap API calls in try-catch blocks:

const zlpAPI = SDK.createZLPAPI(network, provider, apiEndpoint, connectionURL)

try {
  const marketInfo = await zlpAPI.getMarketInfo()
  const depositTx = await zlpAPI.deposit('usdc', ['coinId'], 1000000)
} catch (error) {
  console.error('SDK operation failed:', error)
  if (error.message.includes('Unsupported LP token')) {
    console.error('Invalid LP token type provided')
  }
}

Last updated