I've successfully managed to use eosjs to transfer some EOS but when I'm trying to send something else (a token) it's no longer working.

For example that code is working:

import ScatterJS from 'scatterjs-core';

const scatter = ScatterJS.scatter;
const eos = scatter.eos(network, Eos, eosOptions);
const transactionOptions = { authorization:[`${account.name}@${account.authority}`] };
var res = await eos.transfer(account.name,'testacc','1.0000 EOS','', transactionOptions);

Whereas that code isn't working:

var res = await eos.transfer(account.name, 'testacc', '80.0000 EOSDAC', '', transactionOptions);

When executing that second code I get the error (caught in a try / catch handler):

{"code":500,"message":"Internal Service Error","error":{"code":3050003,"name":"eosio_assert_message_exception","what":"eosio_assert_message assertion failure","details":[{"message":"assertion failure with message: unable to find key","file":"wasm_interface.cpp","line_number":917,"method":"eosio_assert"},{"message":"pending console output: ","file":"apply_context.cpp","line_number":72,"method":"exec_one"}]}}

I honestly don't know what's wrong with my code... can anyone help me to get it to work?

  • Just for information, account.name = my EOS username. I got the value of 'account' using => const account = scatter.identity.accounts.find(x => x.blockchain === 'eos'); – Linda Dec 25 '18 at 14:36
  • Symbol EOSDAC is not supported unless you mint your own token. SO you have to send 80.0000 EOS. – Nirdesh Kumar Choudhary Dec 26 '18 at 12:16
  • Thanks for your answer but EOSDAC do exists as a token and my goal is to send the token not 80 EOS ;-) I'd like to send 80 EOSDAC so how can I do that? It's not my token but it is an already existing token so how can I send 80 EOSDAC? I'm not focused on EOSDAC it's mostly to try to make that work so that can be DICE tokens or IQ or whatever ;-) – Linda Dec 26 '18 at 21:04
  • And just for information, I can send EOSDAC from Scatter so how can I do the same from the code directly? – Linda Dec 26 '18 at 21:06
  • Does this symbol support your eosio.token code . Check symbol.hpp file..? – Nirdesh Kumar Choudhary Dec 27 '18 at 4:04

After searching the official doc and trying different approches I finally got it to work. I've used eos.transaction instead of eos.transfer and the following example is working for those interested:

var res = await eos.transaction({
    actions: [
        account: "eosjackscoin", //has to be the smart contract name of the token you want to transfer - eosio for EOS or eosjackscoin for JKR for example
        name: "transfer",
        authorization: [{
            actor: account.name,
            permission: account.authority
        data: {
            from: account.name,
            to: "destinationaccount",
            quantity: "50.0000 JKR",
            memo: ""

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.