How to add custom token on token swap

hello
can i ask some guide/reference how to add custom token on token swap?

What do you mean by token swap?

i am planning to build token swap with this tutorial
https://docs.moralis.io/tutorials/token-swaps-dex-tutorial
but its limited only for native token
i need to know if its possible to add custom token address

If you mean 1Inch plugin, then you can swap there a lot of tokens.

yes correct using 1inch plugin
but can i also add my custom token ?

I don’t know exactly how you can add your custom token, my current assumption is that your token has to be in a liquidity pool and already in 1Inch list on processed tokens.

In case that you can not find there, and you only want to add a swap functionality on you site for your token, you can put a link directly on the exchange where is the liquidity pool for your token.

do you sample or guide how to do it?

I can send you an example later today

thank you
btw the token already deploy on BSC network

if i use the code below
i just need to change this address toTokenAddress: of our own token address
so they can swap native token for our token is that correct?

async function swap() {
  const receipt = await Moralis.Plugins.oneInch.swap({
    chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
    fromTokenAddress: '0x0da6ed8b13214ff28e9ca979dd37439e8a88f6c4', // The token you want to swap
    TokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive or our own token
    amount: 1000,
    fromAddress: '0x6217e65d864d77DEcbFF0CFeFA13A93f7C1dD064', // Your wallet address
    slippage: 1,
  });
  console.log(receipt);
}
1 Like

You don’t need only to deploy the token, you also have to add it to a liquidity pool on pancake swap.

yes it already have
so is that code correct?

TokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive or our own token
    amount: 1000,

You can check if it works. You can also check if your token is in the list of available tokens returned by 1Inch plugin.

ok i will try working on it so i can test
thank you for the help it’s mean a lot and its make me understand it more

hello help me build the drop down menu