Closed ycryptx closed 6 years ago
Git on EOS?
I was able to pass an asset to a method like you described. Except, I did not have a namespace master
before my action name. It looked more like this:
void newrepo(account_name a, uint64_t cid, eosio::asset src){}
And this:
eos.contract('hello.code')
.then(hello => {hello.newrepo('acct', 0, '1 SYS', {authorization: 'hello.code'})})
.catch(err => {console.error(err)})
Or this:
> eos.transaction({"actions": [
... {
..... "account": "hello.code",
..... "name": "newrepo",
..... "authorization": [
..... {
....... "actor": "hello.code",
....... "permission": "active"
....... }
..... ],
..... "data": {
....... "a": "acct",
....... "cid": 0,
....... "src": "1.0000 SYS"
....... }
..... }
... ]})
I have a contract:
void master::newrepo(account_name a,uint64_t cid, eosio::asset src){ //bla bla bla }); }
and I call this function here:
But I'm getting the following error:
{ AssertionError [ERR_ASSERTION]: expecting asset string, got object newrepo. action.data transaction.actions at toAssetString (/Users/x/Desktop/production/node_modules/eosjs/lib/structs.js:416:10) at Object.fromObject (/Users/x/Desktop/production/node_modules/eosjs/lib/structs.js:484:16) at Object.fromObject (/Users/x/Desktop/production/node_modules/fcbuffer/lib/struct.js:143:31) at actionDataFromObject (/Users/x/Desktop/production/node_modules/eosjs/lib/structs.js:702:29) at Object.fromObject (/Users/x/Desktop/production/node_modules/fcbuffer/lib/struct.js:148:15) at Object.fromObject (/Users/x/Desktop/production/node_modules/fcbuffer/lib/types.js:384:28) at Object.fromObject (/Users/x/Desktop/production/node_modules/fcbuffer/lib/struct.js:151:34) at _callee2$ (/Users/x/Desktop/production/node_modules/eosjs/lib/write-api.js:608:38) at tryCatch (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21) at tryCatch (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40) at invoke (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:155:20) at /Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:202:11 at new Promise (<anonymous>) at callInvokeWithMethodAndArg (/Users/x/Desktop/production/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:201:16) generatedMessage: false, name: 'AssertionError [ERR_ASSERTION]', code: 'ERR_ASSERTION', actual: 'object', expected: 'string', operator: '==' }
Would appreciate the help.