steemit / steem-js

Steem.js the official JavaScript library for Steem blockchain
https://www.npmjs.com/package/steem
MIT License
472 stars 222 forks source link

transfer STEEM failed by steem-js #476

Open past2017 opened 4 years ago

past2017 commented 4 years ago

tranfer STEEM by below code

var steem = require('steem');
var user="test1234"
var pass="yyyyyyyyyyyyyyyyyy"
var wif = steem.auth.toWif(user, pass, 'active');

var from="test1234"
var to="testt2222"
var amount="0.001 STEEM"
var memo="222"
steem.api.setOptions({ url: 'http://127.0.0.1:62001' });

steem.broadcast.transfer(wif, from, to, amount, memo, function(err, result) {
    console.log(err, result);
});

some error report

# node transfer.js 
{ RPCError: Bad Cast:Invalid cast from type 'array_type' to Object
    at new RPCError (/root/src/node_modules/steem/lib/api/transports/http.js:43:106)
    at /root/src/node_modules/steem/lib/api/transports/http.js:93:13
    at process._tickCallback (internal/process/next_tick.js:68:7)
  cause:
   { RPCError: Bad Cast:Invalid cast from type 'array_type' to Object
       at new RPCError (/root/src/node_modules/steem/lib/api/transports/http.js:43:106)
       at /root/src/node_modules/steem/lib/api/transports/http.js:93:13
       at process._tickCallback (internal/process/next_tick.js:68:7)
     name: 'RPCError',
     code: -32000,
     data:
      { code: 7,
        name: 'bad_cast_exception',
        message: 'Bad Cast',
        stack: [Array] } },
  isOperational: true,
  code: -32000,
  data:
   { code: 7,
     name: 'bad_cast_exception',
     message: 'Bad Cast',
     stack: [ [Object] ] } } undefined

but if i use node https://api.steemit.com, all works well, I set almost all plugins in my config.ini

plugin = witness account_by_key account_by_key_api condenser_api
plugin=account_history account_history_api network_broadcast_api transaction_status_api database_api

please help me what i need to set in config.inn to transfer STEMM well with steem-js

DoctorLai commented 10 months ago

Seems like this is a problem with your node setup?