eosjs
eosjs copied to clipboard
parse contract error?
my action definition:
{
"name": "deposit",
"base": "",
"fields": [{
"name": "owner",
"type": "name"
},{
"name": "asset",
"type": "asset"
},{
"name": "memo",
"type": "string"
}
]
}
when:
eos.transaction({
actions: [{
account: 'xpa.ex',
name: 'deposit',
authorization: [{
actor: 'w.1',
permission: 'active',
}],
data: {
owner: 'w.1',
assert: '100.0000 [email protected]',
memo: 'my deposit'
}
}]
})
return error:
{ AssertionError [ERR_ASSERTION]: expecting asset string, got undefined deposit.asset action.data transaction.actions
at toAssetString (/Users/bear/eos/js.eos/node_modules/[email protected]@eosjs/lib/structs.js:409:10)
but if contract is eosio.token, is would OK.
use cleos push action ... is OK.
You typed assert instead of asset in the transaction..
Change the type asset to extended_asset .. "extended" means it supports the @contract suffix...