eosjs icon indicating copy to clipboard operation
eosjs copied to clipboard

parse contract error?

Open wchh opened this issue 8 years ago • 2 comments

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.

wchh avatar May 28 '18 03:05 wchh

use cleos push action ... is OK.

wchh avatar May 28 '18 03:05 wchh

You typed assert instead of asset in the transaction..

Change the type asset to extended_asset .. "extended" means it supports the @contract suffix...

jcalfee avatar May 29 '18 11:05 jcalfee