Add/Import cusotm token on dex

Where it states that the minimum is 1? I know the fee is 1% additional for every transaction made (1Inch Fee)ā€¦ Iā€™ll try to add the Custom Fieldā€¦ shouldnā€™t be that hardā€¦ :slight_smile:

Check Hooks useInchDex.js :slight_smile:

  async function doSwap(params) {
    return await Moralis.Plugins.oneInch.swap({
      chain: params.chain, // The blockchain you want to use (eth/bsc/polygon)
      fromTokenAddress: params.fromToken.address, // The token you want to swap
      toTokenAddress: params.toToken.address, // The token you want to receive
      amount: Moralis.Units.Token(
        params.fromAmount,
        params.fromToken.decimals,
      ).toString(),
      fromAddress: account, // Your wallet address
      slippage: 1,
    });
  }

If you are referring to the above slippage, thatā€™s hardcoded to 1% because [ethereum-boilerplate] doesnā€™t have a slippage added. There is no minimum. The minimum starts from 0% + 1% 1Inch Fee.

https://streamable.com/j6g4n4 - working on it already. Will add a Table within the DB to store them for every wallet that connects and Importsā€¦

You are right. Iā€™ve modified line #62 to use params and it worked just fine for me with the slippage changer.

thanks for code exactly what i was looking for . love this community :heart:

2 Likes

no worries, sorry i wrote that on the fly at the time also, there is probably some mistakes in it and you will have to adjust that compoennt specifically for your use case, glad i could help

1 Like

working on it as iā€™m typing this message

rc/components/DEX/DEX.jsx
Line 57:10: ā€˜isLoadingMoreā€™ is assigned a value but never used no-unused-vars

1 Like

its been awhile since i wrote that post, are you aiming to use that search component, to sift through the 1inch pluginā€™s token list yes?

1 Like

if this is what you after then each time the search updates you will need to make a comparison between the current search term and any matches from the api then just use .map() to destructure all of the compatible options if any to display them on your frontend

2 Likes

Havent tried it yet, but you could also pre-pend or append it to the tokenList object before it maps out in the modalā€¦ Then you can have it placed in the entire list. You could also then filter it out during the map process.

InchModal.jsx

  • Before tokenList.map add the token object into that list.
return (
    <div style={{ overflow: "auto", height: "500px" }}>
      {!tokenList
        ? null
        : Object.keys(tokenList).map((token, index) => (
            <React.Fragment>
              {console.log(tokenList[token])}
1 Like

What was { useMoralisDapp } renamed to? I pasted in Thefabledā€™ code but ended up getting errors trying to resolve { useMoralisDapp } Iā€™m trying to install a swap panel where only my custom token and bnb can be swapped. what is the new way to get this to work?

Also I grabbed the code from the boilerplate for the swap unmodified, and after installing 1inch Plugin, iā€™m seeing ā€œerror 400ā€ when the component loads in the console.

How did you go about implementing the reverse current trade with custom token?

Looking for a hack to make a short custom token list of stable coins, also need to be able to reverse the from and to tokens on button click.

Looking for a hack to make a short custom token list of stable coins

Not sure what you mean by hack. You can build your own list of stablecoins and then use it in your app. The Ethereum Boilerplate has an example of a token list.

also need to be able to reverse the from and to tokens on button click.

You can use button onclick which swaps the input values, or state values if youā€™re using them for input values.

lol wrong choice of word.

anyway Iā€™m playing with user "thefabeledā€™ code. managed to get my custom token list in there and all seemed to be working fine, I can swap any of the listed stables into my token, but if I set my token into the ā€œfromā€ field and BNB in the ā€œtoā€ field , it gets a quote, I hit swap, and I get an alert [object Object] ā€¦ same error I was getting in the other thread. something weird is going on here and I think it has to do with Antd <inputNumber> I noticed in the fabledā€™s code and in the boilerplate code the ā€œfromā€ input is of type <inputNumber> and ā€œtoā€ input is of type <input> if I change the ā€œfromā€ field from <inputNumber> to an <input> and try to swap normally from bnb to my token, which worked before, I get the [object Object] alert, if I change both ā€œfromā€ and ā€œtoā€ inputs to <inputNumber> again [object Object] error. so I need to figure this outā€¦

regarding getting the current trade reversed with a button (which shouldnā€™t result any different than choosing tokens from the modal window manually ), I used an onClick function, and in the function used the code below, it workedā€¦ kinda the tokens traded places, custom token in the from field, I hit swap and get Bignumber errors.

  function reverseTrade() {
    // [fromToken, toToken] = [toToken, fromToken];
    setToToken(fromToken)
    setFromToken(tokendata)
  }

had to modify a few small things to get thefabeledā€™s code to work in the new react boilerplate, but its pretty much the same.

install ethereum-boilerplate , copy InchDexCustom.js into Dex component folder , useInchDex.js goes into hooks folder, you will likely need to modify some of the import paths to their respective files

load component:

<InchDexCustom chain="bsc" toTokenAddress="0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82" slippage={1}/>

InchDexCustom.js

import { useState, useEffect, useMemo } from "react";
import { useMoralis} from "react-moralis";
//import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
import InchModal from "./components/InchModal";
import useInchDex from "../../hooks/useInchDex";
import { Button, Card, Image, Input, InputNumber, Modal } from "antd";
import Text from "antd/lib/typography/Text";
import { ArrowDownOutlined } from "@ant-design/icons";
import useTokenPrice from "../../hooks/useTokenPrice";
import { tokenValue } from "../../helpers/formatters";
// import "./swap.scss";

//import erc20Abi from "./contractAbi/standardErc20Abi"
// import { useOneInchQuote } from "react-moralis";

const styles = {
//   card: {
//     width: "400px",
//     boxShadow: "0 0.5rem 1.2rem rgb(189 197 209 / 20%)",
//     border: "1px solid #e7eaf3",
//     borderRadius: "1rem",
//     fontSize: "16px",
//     fontWeight: "500",
//   },
  input: {
    padding: "0",
    fontWeight: "300",
    fontSize: "16px",
    fontFamily: "bank gothic",
    display: "block",
    width: "100%",
  },
  priceSwap: {
    display: "flex",
    justifyContent: "space-between",
    fontSize: "12px",
    fontFamily: 'bank gothic',
    color: "#434343",
    marginTop: "8px",
    padding: "0 10px",
  },
};

const nativeAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";

const chainIds = {
//   "0x1": "eth",
  "0x38": "bsc",
//   "0x89": "polygon",
};




function InchDexCustom({ chain, toTokenAddress, slippage }) {
  const { trySwap, tokenList, getQuote } = useInchDex(chain);

console.log(tokenList)
  const { Moralis, isInitialized, chainId} = useMoralis();
  const [isFromModalActive, setFromModalActive] = useState(false);
  const [isToModalActive, setToModalActive] = useState(false);
  const [fromToken, setFromToken] = useState();
  const [toToken, setToToken] = useState();
  const [fromAmount, setFromAmount] = useState();
  const [quote, setQuote] = useState();
  const [currentTrade, setCurrentTrade] = useState();
  const { fetchTokenPrice } = useTokenPrice();
  const [tokenPricesUSD, setTokenPricesUSD] = useState({});
  console.log("fromToken", fromToken);

  const options = { chain: chain, addresses: toTokenAddress }; //--------------------

  const [ tokendata, settokendata] = useState([])
  const [newslippage, setSlippage] = useState(slippage)

  const fromTokenPriceUsd = useMemo(
    () => (tokenPricesUSD?.[fromToken?.["address"]] ? tokenPricesUSD[fromToken?.["address"]] : null),
    [tokenPricesUSD, fromToken]
  );

  const toTokenPriceUsd = useMemo(
    () => (tokenPricesUSD?.[toToken?.["address"]] ? tokenPricesUSD[toToken?.["address"]] : null),
    [tokenPricesUSD, toToken]
  );
  const fromTokenAmountUsd = useMemo(() => {
    if (!fromTokenPriceUsd || !fromAmount) return null;
    return `~$ ${(fromAmount * fromTokenPriceUsd).toFixed(4)}`;
  }, [fromTokenPriceUsd, fromAmount]);

  const toTokenAmountUsd = useMemo(() => {
    if (!toTokenPriceUsd || !quote) return null;
    return `~$ ${(Moralis.Units.FromWei(quote?.toTokenAmount, quote?.toToken?.decimals) * toTokenPriceUsd).toFixed(4)}`;
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [toTokenPriceUsd, quote]);


 // start Swapper

   function changeSlippage(e){
    setSlippage(e.target.value);
   }
  // tokenPrices
  useEffect(() => {
    if (!isInitialized || !fromToken || !chain) return null;
    fetchTokenPrice({ chain: chain, address: fromToken[["address"]] }).then((price) =>
      setTokenPricesUSD({
        ...tokenPricesUSD,
        [fromToken["address"]]: price["usdPrice"],
      })
    );
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [chain, isInitialized, fromToken]);

  useEffect(() => {
    if (!isInitialized || !toToken || !chain) return null;
    fetchTokenPrice({ chain: chain, address: toToken[["address"]] }).then((price) =>
      setTokenPricesUSD({
        ...tokenPricesUSD,
        [toToken["address"]]: price["usdPrice"],
      })
    );
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [chain, isInitialized, toToken]);

  // sets the init from token
  useEffect(() => {
    if (!tokenList) return null;
    setFromToken(tokenList[nativeAddress]);
  }, [tokenList]);

  //gets and sets toToken Data,  if no address then set to native
  useEffect(async() => {
    const result =await Moralis.Web3API.token.getTokenMetadata(options)
    settokendata(result);
    if(!toToken ){
      setToToken(result[0]);
    }

    //.then(setCurrentTrade( fromToken, toTokenAddress, fromAmount, chain))
    console.log(result);
    if (tokendata){

    }
  }, [toToken]);

  const ButtonState = useMemo(() => {
    if (chainIds?.[chainId] !== chain) return { isActive: false, text: `Switch to ${chain}` };
    // if (chainIds[chainId] !== chain)
    //Change button text depending on curent state
    if (!fromAmount) return { isActive: false, text: "Enter an amount" };
    if (fromAmount && currentTrade) return { isActive: true, text: "Swap" };
    return { isActive: false, text: "Select tokens" };
  }, [fromAmount, currentTrade, chainId, chain]);

  //if data entered update the curent trade
  useEffect(() => {
    if (fromToken && toToken && fromAmount) setCurrentTrade({ fromToken, toToken, fromAmount, chain, newslippage });
  }, [toToken, fromToken, fromAmount, chain, newslippage]);

//if trade data entered fetch a quote
  useEffect(() => {
    if (currentTrade) {
        getQuote(currentTrade).then((quote) => setQuote(quote));
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [currentTrade]);

  function reverseTrade() {
    // [fromToken, toToken] = [toToken, fromToken];
    setToToken(fromToken)
    setFromToken(tokendata)
  }

  const PriceSwap = () => {
    const Quote = quote;
    // if theres no quote or address then dont swap, on error dont swap return a message
    if (!Quote || !tokenPricesUSD?.[toToken?.["address"]]) return null;
    if (Quote?.statusCode === 400) return <>{Quote.message}</>;

    console.log(Quote);

    const { fromTokenAmount, toTokenAmount } = Quote;

    const { symbol: fromSymbol } = fromToken;
    const { symbol: toSymbol } = toToken;


    const pricePerToken = parseFloat(
      tokenValue(fromTokenAmount, fromToken["decimals"]) / tokenValue(toTokenAmount, toToken["decimals"])
    ).toFixed(6);
    return (
      <Text style={styles.priceSwap}>
        Price:{" "}
        <Text>{`1 ${toSymbol} = ${pricePerToken} ${fromSymbol} ($${tokenPricesUSD[[toToken["address"]]].toFixed(
          6
        )})`}</Text>
      </Text>
    );
  };

  return (
    <>

        <Card style={{ borderRadius: "1rem", backgroundColor: "transparent" }} bodyStyle={{ padding: "0.8rem" }}>
          {/* <div style={{ marginBottom: "5px", fontSize: "14px", color: "#434343" }}>From</div> */}
          <div
            style={{
              display: "flex",
              flexFlow: "row nowrap",
            }}
          >
            <div>
              <InputNumber
                bordered={false}
                placeholder="0.000000"
                style={{ ...styles.input, marginLeft: "-10px" }}
                onChange={setFromAmount}
                value={fromAmount}   //bnb input
              />
              <Text style={{ fontWeight: "300" ,fontFamily: 'bank gothic', color: "#434343" }}>{fromTokenAmountUsd}</Text>
            </div>

            <Button
              style={{
                height: "fit-content",
                display: "flex",
                justifyContent: "space-between",
                alignItems: "center",
                borderRadius: "0.6rem",
                padding: "2px 0px",
                fontWeight: "300",
                fontSize: "14px",
                gap: "7px",
                border: "none",
              }}
              onClick={() => setFromModalActive(true)}
            >
              {fromToken ? (
                <Image
                  src={fromToken?.logoURI || "https://etherscan.io/images/main/empty-token.png"}
                  alt="nologo"
                  width="24px"
                  preview={false}
                  style={{ borderRadius: "12px" }}
                />
              ) : (
                <span>Select a token</span>
              )}
              <span>{fromToken?.symbol}</span>
              <Arrow />
            </Button>
          </div>
        </Card>
        {/* SWITCHER */}
        <div style={{ display: "flex", justifyContent: "center", padding: "10px" }}>
        <Button
              style={{
                height: "fit-content",
                display: "flex",
                justifyContent: "space-between",
                alignItems: "center",
                borderRadius: "0.6rem",
                padding: "2px 0px",
                fontWeight: "300",
                fontSize: "14px",
                gap: "7px",
                border: "none",
              }}
              onClick={() => reverseTrade()} // set to trade reverse function
            >
            <ArrowDownOutlined />
            </Button>
            </div>

        <Card style={{ borderRadius: "1rem", backgroundColor: "transparent" }} bodyStyle={{ padding: "0.8rem" }}>
          {/* <div style={{ marginBottom: "5px", fontSize: "14px", color: "#434343" }}>To</div> */}
          <div
            style={{
              display: "flex",
              flexFlow: "row nowrap",
            }}
          >
            <div>
              <Input
                bordered={false}
                placeholder="0.000000"
                style={styles.input}
                readOnly
                value={
                    quote
                      ? parseFloat(
                          Moralis?.Units?.FromWei(
                            quote?.toTokenAmount,
                            quote?.toToken?.decimals,
                          ),
                        ).toFixed(6)
                      : ""
                  }
              />

              <Text style={{ fontWeight: "300", fontFamily: 'bank gothic', color: "#434343" }}>{toTokenAmountUsd}</Text>

            </div>
            <Button
              style={{
                height: "fit-content",
                display: "flex",
                justifyContent: "space-between",
                alignItems: "center",
                borderRadius: "0.6rem",
                padding: "2px 5px",
                fontWeight: "200",
                fontSize: "14px",
                gap: "7px",
                border: "none",

              }}
              onClick={() => setToModalActive(true)}
              type={toToken ? "default" : "primary"}
            >
              {toToken ? (
                <Image
                  src={toToken?.logoURI || "https://etherscan.io/images/main/empty-token.png"}
                  alt="nologo"
                  width="24px"
                  preview={false}
                  style={{ borderRadius: "12px" }}
                />
              ) : (
                <span>Select a token</span>
              )}
              <span>{toToken?.symbol}</span>
              {/* <Arrow /> */}
            </Button>
          </div>
        </Card>
        {quote && (
          <div>
            <Text
              style={{
                display: "flex",
                justifyContent: "space-between",
                fontSize: "12px",
                fontFamily: 'bank gothic',
                color: "#434343",
                marginTop: "8px",
                padding: "0 10px",
              }}
            >
              Estimated Gas: <Text>{quote?.estimatedGas}</Text>
            </Text>
            <PriceSwap />
          </div>
        )}

      {/* <div style={{ display:"flex", justifyContent:"space-between", padding:"5px 10px"}}>
      <label htmlFor="">Slippage</label>
      <input type="range" min="0" onChange={changeSlippage} value={newslippage} max="50"  />
        <input type="number" onChange={changeSlippage} value={newslippage} max="50" min="0" name="" placeholder="slippage" id="" />
      </div> */}

        <Button
          type="primary"
          size="large"
          style={{
            width: "100%",
            marginTop: "15px",
            borderRadius: "0.6rem",
            height: "50px",
          }}
          onClick={() => trySwap(currentTrade)}
          disabled={!ButtonState.isActive}
        >
          {ButtonState.text}
        </Button>

      <Modal
        title="Select a token"
        visible={isFromModalActive}
        onCancel={() => setFromModalActive(false)}
        bodyStyle={{ padding: 0 }}
        width="450px"
        footer={null}
      >
        <InchModal
          open={isFromModalActive}
          onClose={() => setFromModalActive(false)}
          setToken={setFromToken}
          tokenList={tokenList}
        />
      </Modal>
      <Modal
        title="Select a token"
        visible={isToModalActive}
        onCancel={() => setToModalActive(false)}
        bodyStyle={{ padding: 0 }}
        width="450px"
        footer={null}
      >
        <InchModal
          open={isToModalActive}
          onClose={() => setToModalActive(false)}
          setToken={setToToken}
          tokenList={tokenList} //was "tokendata" gathered from metadata call above
        />
      </Modal>
    </>
  );
}

export default InchDexCustom;

const Arrow = () => (
  <svg
    xmlns="http://www.w3.org/2000/svg"
    width="24"
    height="24"
    viewBox="0 0 24 24"
    strokeWidth="2"
    stroke="currentColor"
    fill="none"
    strokeLinecap="round"
    strokeLinejoin="round"
  >
    <path stroke="none" d="M0 0h24v24H0z" fill="none" />
    <polyline points="6 9 12 15 18 9" />
  </svg>
);

useInchDex.js

import { useEffect, useState } from "react";
import { useMoralis } from "react-moralis";
const useInchDex = (chain) => {
  const { Moralis, account } = useMoralis();
  const [tokenList, setTokenlist] = useState();

  useEffect(() => {
    if (!Moralis?.["Plugins"]?.["oneInch"]) return null;
    //gets oneinch tokens puts them into var "tokens" then fills token list, need to change this to filter out all non stable then set tokenlist state
    // optionally make my own list and push to tokens

    Moralis.Plugins.oneInch.getSupportedTokens({ chain }).then((tokens) => setTokenlist(
      {
      
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": {
          address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          decimals: 18,
          logoURI: "https://etherscan.io/token/images/bnb_28_2.png",
          name: "Binance Smart Chain",
          symbol: "BNB",
        },
  
        "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56": {
          address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
          decimals: 18,
          logoURI: "https://bscscan.com/token/images/busd_32.png",
          name: "Binance USD Peg",
          symbol: "BUSD",
        },
        "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d": {
          address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
          decimals: 18,
          logoURI: "https://bscscan.com/token/images/centre-usdc_28.png",
          name: "USD PEG",
          symbol: "USDc",
        },
        "0x55d398326f99059fF775485246999027B3197955": {
          address: "0x55d398326f99059fF775485246999027B3197955",
          decimals: 18,
          logoURI: "https://bscscan.com/token/images/busdt_32.png",
          name: "Tether",
          symbol: "USDt",
        },
        "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82": {
          address: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",
          decimals: 18,
          logoURI: "https://bscscan.com/token/images/pancake_32.png?=v1",
          name: "Pancake Swap",
          symbol: "CAKE",
        },
      }
    ));
    // setTokenlist(tokens);
  }, [Moralis, Moralis.Plugins, chain]);

  const getQuote = async (params) =>
    await Moralis.Plugins.oneInch.quote({
      chain: params.chain, // The blockchain  you want to use (eth/bsc/polygon)
      fromTokenAddress: params.fromToken.address, // The token you want to swap
      toTokenAddress: params.toToken.address, // The token you want to receive
      amount: Moralis.Units.Token(
        params.fromAmount,
        params.fromToken.decimals
      ).toString(),
    });

  async function trySwap(params) {
    const { fromToken, fromAmount, chain } = params;
    const amount = Moralis.Units.Token(
      fromAmount,
      fromToken.decimals
    ).toString();
    if (fromToken.address !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") {
      await Moralis.Plugins.oneInch
        .hasAllowance({
          chain, // The blockchain you want to use (eth/bsc/polygon)
          fromTokenAddress: fromToken.address, // The token you want to swap
          fromAddress: account, // Your wallet address
          amount,
        })
        .then(async (allowance) => {
          console.log(allowance);
          if (!allowance) {
            await Moralis.Plugins.oneInch.approve({
              chain, // The blockchain you want to use (eth/bsc/polygon)
              tokenAddress: fromToken.address, // The token you want to swap
              fromAddress: account, // Your wallet address
            });
          }
        })
        .catch((e) => alert(e.message));
    }

    await doSwap(params)
      .then((receipt) => {
        if (receipt.statusCode !== 400) {
          alert("Swap Complete");
        }
        console.log(receipt);
      })
      .catch((e) => alert(e.message));
  }

  async function doSwap(params) {
    return await Moralis.Plugins.oneInch.swap({
      chain: params.chain, // The blockchain you want to use (eth/bsc/polygon)
      fromTokenAddress: params.fromToken.address, // The token you want to swap
      toTokenAddress: params.toToken.address, // The token you want to receive
      amount: Moralis.Units.Token(
        params.fromAmount,
        params.fromToken.decimals
      ).toString(),
      fromAddress: account, // Your wallet address
      slippage: params.newslippage ? params.newslippage : 1,
    });
  }

  return { getQuote, trySwap, tokenList };
};

export default useInchDex;

okay, it cant be the Input fields, I can swap from bnb to cake (custom added ,same way as custom token) then from cake back to bnb fine, but my custom token wont swap when its in the ā€œfromā€ field without getting that [object Object] error hmmmā€¦ I dont get it, why would it let me buy my token but not sell it ? tested on freshly downloaded boilerplate un-modifiled, except adding my token into customTokens{} in DEX.js, same deal. I can buy and sell my custom token just fine on http://app.1inch.io

could it be missing logo, logo hash , and thumbnail in the token metadata?
hereā€™s my current test server if it helps : https://tdygv2x0cuk9.usemoralis.com:2053/server

    "logo": null,
    "logo_hash": null,
    "thumbnail": null,

Wooow, ok I feel stupid now, you know you are burnt out when you forget you hard-coded the slippage in and its only enough for a buy but not a sell. Now I can rest easy, code above is working :muscle:

ooohhkay , I thought it was working because I managed to get it to sell my custom token, that was a slippage issue, but now going back after I thought it was fixed I noticed that I cannot buy tokens (unless bnb ā€œfrom amountā€ is 0.01 or less) with BnB on Binance smart chain, using my code or even on the boilerplate. give it a shot and you will see what I mean. I checked the server logs and it is saying balance is not enough even though it is enoughā€¦ [object object]

go onto the boilerplate and switch to bsc then choose bnb in the from field then any token for example wbnb in the to field, its a no go and I need to get this figured out as i am under pressure.

my current server address : https://zsoxl3z4sley.usemoralis.com:2053/server

2022-05-11T19:03:00.370Z - Error: [object Object]
    at Object.resolveError (/moralis-server/lib/triggers.js:632:17)
    at error (/moralis-server/lib/Routers/FunctionsRouter.js:184:32)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-05-11T19:03:00.365Z - Failed running cloud function oneInch_swap for user undefined with:
  Input: {"chain":"bsc","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress":"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82","amount":"40000000000000000","fromAddress":"0x906122001a3c20c381f6610065b39d973f73f362","slippage":26,"_ApplicationId":"9WlmV4ShyCrVHdFhusqHbAWwJHfzcj9R3ZKZM2q","_ClientVersion":"js1.2.4","_InstallationId":"252d989e-a427-4f82-bd4e-8616d66b55a3"}
  Error: {"message":{"status":502,"headers":{"x-powered-by":"Express","access-control-allow-origin":"*","content-type":"application/json; charset=utf-8","content-length":"187","etag":"W/\"bb-agcVl1ytxUK8IRCej3xDjg4BC8Q\"","x-response-time":"109.642ms","date":"Wed, 11 May 2022 19:03:00 GMT","connection":"close"},"buffer":{"type":"Buffer","data":[123,34,101,114,114,111,114,34,58,116,114,117,101,44,34,100,97,116,97,34,58,34,123,92,110,32,32,32,32,92,34,115,116,97,116,117,115,67,111,100,101,92,34,58,32,53,48,48,44,92,110,32,32,32,32,92,34,109,101,115,115,97,103,101,92,34,58,32,92,34,78,111,116,32,101,110,111,117,103,104,32,48,120,69,101,101,101,101,69,101,101,101,69,101,69,101,101,69,101,69,101,69,101,101,69,69,69,101,101,101,101,69,101,101,101,101,101,101,101,69,69,101,69,46,32,65,109,111,117,110,116,58,32,52,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,46,32,66,97,108,97,110,99,101,58,32,49,51,50,57,51,48,50,49,55,55,51,52,53,55,56,52,51,54,46,92,34,92,110,125,34,125]},"text":"{\"error\":true,\"data\":\"{\\n    \\\"statusCode\\\": 500,\\n    \\\"message\\\": \\\"Not enough 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE. Amount: 40000000000000000. Balance: 132930217734578436.\\\"\\n}\"}","data":{"error":true,"data":"{\n    \"statusCode\": 500,\n    \"message\": \"Not enough 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE. Amount: 40000000000000000. Balance: 132930217734578436.\"\n}"}},"code":141}

So you mean purchasing with BNB greater than 0.01 fails ??