bronto

Router

  1. computePath

Computes the optimal path for swapping tokens.

For complete swap flow, refer to Swap Flow

Usage

const quote = await sdk.Quoter.computePath(provider, tokenIn, tokenOut, tokenInDecimals, amountIn, pools, baseTokens);
console.log({ quote });

Params

  • provider: Ethers Provider

  • tokenIn: Address of the token to swap

  • tokenOut: Address of the token to receive

  • tokenInDecimals: Decimals of the token to swap

  • amountIn: Amount of token to swap

  • pools: List of pools to consider for the path

  • baseTokens: List of base tokens to consider for multi-hop swaps

Returns

Quote

  1. swap

Swaps tokens using a computed path.

For complete swap flow, refer to Swap Flow

Usage

await sdk.Router.swap(signer, encodedPath, amountIn, minAmountOut);

Params

  • signer: Ethers Signer

  • encodedPath: Encoded path of the swap

  • amountIn: Amount of token to swap

  • minAmountOut: Minimum amount of token to receive

On this page