Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snak Call Error #14

Open
deenario opened this issue Apr 16, 2019 · 1 comment
Open

Snak Call Error #14

deenario opened this issue Apr 16, 2019 · 1 comment

Comments

@deenario
Copy link

deenario commented Apr 16, 2019

I am testing burrow and snak with your given example of a calculator. The error i am getting is that when i give it a function name that is in the contract it gives me an toUpperCase error.
Type error.

danyal@danyal-HP-EliteBook-8470p:~/burrow $ snak call Calculator Mul 5,5
(node:9383) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toUpperCase' of undefined
    at /home/danyal/.nvm/versions/node/v8.15.0/lib/node_modules/snak/node_modules/burrow-contracts/lib/pipes/dev_pipe.js:124:34
    at target.(anonymous function).then (/home/danyal/.nvm/versions/node/v8.15.0/lib/node_modules/snak/node_modules/burrow-db/lib/server.js:49:20)
    at <anonymous>
(node:9383) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9383) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@deenario
Copy link
Author

I fixed the error myslef. Inside your snak Node_modlues in

DevPipe.prototype.call = function (txPayload, callback) { var address = txPayload.to var from = txPayload.from if (!from) { from = this._accountData.default } var data = txPayload.data if (data.length > 1 && data.slice(0, 2) === '0x') { data = data.slice(2) } this._burrow.txs().call(from, address, data, function (error, data) { if (error) { callback(error) } else { callback(null, data.return.toUpperCase()) } }) }

In the callback you were the data.returns with a small 'r' while the data was return like .

{ Return: '000000000000000000000000000000000000000000000000000000000000000A', GasUsed: 152 }

I modifled your callback line

From

else {
      callback(null, data.return.toUpperCase())
    }

to

else {
      callback(null, data.Return.toUpperCase())
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant