Anchor-Protocol / anchor-earn

The Earn JavaScript SDK for Anchor Protocol.
Apache License 2.0
45 stars 24 forks source link

TypeError: Cannot read property 'chainID' of undefined #29

Closed jelilat closed 2 years ago

jelilat commented 2 years ago
const { Wallet, MnemonicKey, AnchorEarn } = require('@anchor-protocol/anchor-earn');
require('dotenv').config();

const account = new MnemonicKey({
  mnemonic: process.env.MNEMONIC,
});

const anchorEarn = new AnchorEarn({
    chain: "terra",
    network: "columbus-5",
    privateKey: process.env.PRIVATE_KEY,
    mnemonic: process.env.MNEMONIC,
    address: process.env.ADDRESS,
  });

Here is my code. What am I doing wrong?

jelilat commented 2 years ago
const { CHAINS, NETWORKS, DENOMS, MnemonicKey, AnchorEarn } = require('@anchor-protocol/anchor-earn');
require('dotenv').config();

const account = new MnemonicKey({
  mnemonic: process.env.MNEMONIC,
});

const anchorEarn = new AnchorEarn({
    chain: CHAINS.TERRA,
    network: NETWORKS.COLUMBUS_5,
    // privateKey: process.env.PRIVATE_KEY,
    mnemonic: process.env.MNEMONIC,
    address: process.env.ADDRESS
  });

I've fixed this. Just needed to import CHAINS and NETWORKS