steem-js
steem-js copied to clipboard
RPCError: Bad Cast:Invalid cast from type 'array_type' to Object
Expected behavior
Once the account_create
operation is called an appropriate STEEM amount should be burned and a corresponding account should be created.
Actual behavior
A Bad Cast:Invalid cast from type 'array_type' to Object
error is raised.
How to reproduce
Sample code:
steem.api.setOptions({ url: 'https://api.steem.house' });
var newAccountName = 'blaney',
newAccountWif = steem.formatter.createSuggestedPassword(),
publicKeys = steem.auth.generateKeys(newAccountName, newAccountWif, ['owner', 'active', 'posting', 'memo']);
steem.broadcast.accountCreate(
'...', // ownerWif
'3.000 STEEM', // fee
'piotr42', // creator
newAccountName, // newAccountName
{ weight_threshold: 1, account_auths: [], key_auths: [[publicKeys.owner, 1]] }, // owner
{ weight_threshold: 1, account_auths: [], key_auths: [[publicKeys.active, 1]] }, // active
{ weight_threshold: 1, account_auths: [], key_auths: [[publicKeys.posting, 1]] }, // posting
publicKeys.memo, // memo
'', // jsonMetadata
function(err, response) {
console.log(err, response);
});
Response:
{…}cause: RPCErrorcode: -32000columnNumber: 24327data: Object { code: 7, name: "bad_cast_exception", message: "Bad Cast", … }fileName: "file:///Users/piotr.cz/Documents/steem-client/node_modules/steem/dist/steem.min.js"lineNumber: 4message: "Bad Cast:Invalid cast from type 'array_type' to Object"name: "RPCError"stack: "e@file:///Users/piotr.cz/Documents/steem-client/node_modules/steem/dist/steem.min.js:4:24327\na/<@file:///Users/piotr.cz/Documents/steem-client/node_modules/steem/dist/steem.min.js:4:23853\n"<prototype>: Object { … }code: -32000data: {…}code: 7message: "Bad Cast"name: "bad_cast_exception"stack: Array [ {…} ]<prototype>: Object { … }isOperational: truemessage: "Bad Cast:Invalid cast from type 'array_type' to Object"name: "RPCError"stack: "e@file:///Users/piotr.cz/Documents/steem-client/node_modules/steem/dist/steem.min.js:4:24327\na/<@file:///Users/piotr.cz/Documents/steem-client/node_modules/steem/dist/steem.min.js:4:23853\n"<prototype>: Object { constructor: i(), "constructor$": Error(), stack: "" } undefined main.js:28:9
Environment information
OS: Mac OS High Sierra Node: v8.11.4 Npm: 5.6.0
Does it work when you run JSON.stringify on the owner, active, and posting authorities?
Thanks for the suggestion @Smittyvb. Unfortunately it does not work that way either.