Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKermo committed Aug 21, 2023
1 parent 6495f9f commit 9536b76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ import { BigNumber } from "@ethersproject/bignumber";
import { parseUnits } from "ethers";

const router = new FibrousRouter();

const tokenInAddress = tokens["eth"].address;
const tokenOutAddress = tokens["usdc"].address;
const tokenInDecimals = tokens["eth"].decimals;
const inputAmount = parseUnits("1", tokenInDecimals);
const inputAmount = BigNumber.from(parseUnits("1", tokenInDecimals));

const route = await fibrous.getBestRoute(
inputAmount, // amount
tokenInAddress, // token input
Expand All @@ -58,10 +60,12 @@ import { BigNumber } from "@ethersproject/bignumber";
import { parseUnits } from "ethers";

const fibrous = new FibrousRouter();

const tokenInAddress = tokens["eth"].address;
const tokenOutAddress = tokens["usdc"].address;
const tokenInDecimals = tokens["eth"].decimals;
const inputAmount = parseUnits("1", tokenInDecimals);
const inputAmount = BigNumber.from(parseUnits("1", tokenInDecimals));

// Build route options
const tokens = await fibrous.supportedTokens();
// Get a route using the getBestRoute method
Expand Down
5 changes: 3 additions & 2 deletions examples/src/buildTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Router as FibrousRouter } from "fibrous-router-sdk";
import { BigNumber } from "@ethersproject/bignumber";
import { Router as FibrousRouter } from "../../src/router/router";
import { parseUnits } from "ethers";

import { randomBytes } from "node:crypto";
Expand All @@ -14,7 +15,7 @@ async function main() {
const tokenInAddress = tokens["eth"].address;
const tokenOutAddress = tokens["usdc"].address;
const tokenInDecimals = tokens["eth"].decimals;
const inputAmount = parseUnits("1", tokenInDecimals);
const inputAmount = BigNumber.from(parseUnits("1", tokenInDecimals));
// Get a route using the getBestRoute method
const bestRoute = await fibrous.getBestRoute(
inputAmount,
Expand Down
3 changes: 2 additions & 1 deletion examples/src/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Router as FibrousRouter } from "fibrous-router-sdk";
import { parseUnits } from "ethers";
import { BigNumber } from "@ethersproject/bignumber";
async function main() {
// Create a new router instance
const fibrous = new FibrousRouter();
Expand All @@ -10,7 +11,7 @@ async function main() {
const tokenInAddress = tokens["eth"].address;
const tokenOutAddress = tokens["usdc"].address;
const tokenInDecimals = tokens["eth"].decimals;
const inputAmount = parseUnits("1", tokenInDecimals);
const inputAmount = BigNumber.from(parseUnits("1", tokenInDecimals));
// Converting 1 ETH to USDC
const route = await fibrous.getBestRoute(
inputAmount,
Expand Down

0 comments on commit 9536b76

Please sign in to comment.