EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 462 forks source link

Example for creating a token #139

Closed randytorres closed 6 years ago

randytorres commented 6 years ago

Hey James, I'm trying to create a token on the jungle testnet and I'm getting an AssertionError that doesn't make sense to me.

AssertionError {name: "AssertionError", actual: undefined, expected: true, operator: "==", message: "Missing currency stats for asset: IOS@eosio.token", …}

My Code

  maxSupply = "100.0000 IOS"
  async createToken(maxSupply) {
    try {
      const tokenContract = await eos.contract("eosio.token")
      const transaction = await tokenContract.create({
        issuer: "randyt",
        maximum_supply: maxSupply,
      })

      return transaction
    } catch (error) {
      console.error(error)
    }
  }

Why would it require currency stats for a token that doesnt exist? I get that it would check to make sure it doesn't exist but i don't see why it would require that if the token is being created. maybe im not understanding the create action correctly?

The example in the readme shows you deploying your own token contract, is that what i need to do? If not can you please provide an example for creating a token.

yankunsam commented 6 years ago

It means that you token did not create successfully.

jcalfee commented 6 years ago

It is a bug: https://github.com/EOSIO/eosjs/issues/136

jcalfee commented 6 years ago

published eosjs@13.0.1