[SOLVED] Covalent plugin via SDK react

I’m going through the docs at https://github.com/MoralisWeb3/plugindocs/tree/main/covalent%20plugin

I’m wondering how to use the Moralis covalent plugin via SDK without node (https://www.youtube.com/watch?v=EdNH2A8TsUA only used node for this).

I have moralis working in react fine, just wondering how to import the covalent plugin and use it.

interface GetTokenBalancesForAddressDto {
  chainId: number;
  address: Address;
  quoteCurrency?: string;
}

–> This gives a syntax error failed to process js file.

Hey @hexadecimal

You can import the Moralis SDK and proceed like in the video.
The way to use the plugin is the same one.

<html>
  <head>
    <title>Vanilla Boilerplate</title>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis/dist/moralis.js"></script>
  </head>
  <body>
    <script>
      async function start() {
        await Moralis.start({
          appId: '',
          serverUrl: '',
        });
        Moralis.initPlugins();
        const covalent = Moralis.Plugins.covalent;
        console.log(covalent);
      }
      start();
    </script>
  </body>
</html>

Regarding the interface below:

interface GetTokenBalancesForAddressDto {
  chainId: number;
  address: Address;
  quoteCurrency?: string;
}

This is TS syntax, you can treat it like an object:

const params = {
  chainId: 1,
  address: '0x000',
  quoteCurrency:'eur',
}

await Moralis.Plugins.covalent.functionName(params)

OK that makes sense thanks!

Took me a while to get it working asynchronously but it’s working now!

Found lots of info in this blog thanks for sharing this keep it up.