[SOLVED] Call contract got this error , what happend?

API ERROR:  { Error: While calling encodeCalldata (body), socket hang up
    at createHangUpError (_http_client.js:323:15)
    at TLSSocket.socketOnEnd (_http_client.js:426:23)
    at TLSSocket.emit (events.js:194:15)
    at TLSSocket.EventEmitter.emit (domain.js:441:20)
    at endReadableNT (_stream_readable.js:1103:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  code: 'ECONNRESET',
  config:
   { adapter: [Function: httpAdapter],
     transformRequest: { '0': [Function: transformRequest] },
     transformResponse: { '0': [Function] },
     timeout: 0,
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     headers:
      { Accept: 'application/json, text/plain, */*',
        'Content-Type': 'application/json',
        'User-Agent': 'axios/0.18.0',
        'Content-Length': 32555 },
     method: 'post',
     url: 'https://sdk-mainnet.aepps.com/v2/debug/contracts/code/encode-calldata',

Hey, thanks for reporting! Did that error reoccur on the next try?

hello @mile, as you may know, the sophia compiler has been moved to a stand alone project and will not be bundled anymore with the node.
Check out the latest release of the js sdk that uses the stand alone compiler (available at https://compiler.aepps.com )

the link is broken. you should edit the target :wink:

fixed :smile:, thanks @marco.chain

Hi @noandrea, is the https://compiler.aepps.com should be seted the parameter --compilerUrl ?,
I use the lastest release js sdk, it got error
:heavy_check_mark: Enter your password … **********

Cannot read property 'version' of undefined undefined,


API ERROR:  { Error: Http request for https://compiler.aepps.com/encode-calldata failed with status code 400. Status: Bad Request. 
Error data: {"info":{"error":"wrong_type","data":"withdraw","path":["arguments"]},"parameter":"body","reason":"validation_error"}
    at processResponse (/Users/aepp-cli-js/node_modules/@aeternity/aepp-sdk/es/utils/http.js:46:7)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  data:
   { info: { error: 'wrong_type', data: 'withdraw', path: [Array] },
     parameter: 'body',
     reason: 'validation_error' } }

thank you

Hey @mile,

Can you share the command where you get this error please.

* ./bin/aecli.js  contract call ./wallet1 --contractAddress ct_contract_one  withdraw int 0  -u https://sdk-mainnet.aepps.com --internalUrl https://sdk-mainnet.aepps.com --compilerUrl https://compiler.aepps.com  --networkId ae_mainnet
* get error1:
* API ERROR:  { Error: Http request for https://compiler.aepps.com/encode-calldata failed with status code 400. Status: Bad Request. 
* Error data: {"info":{"error":"wrong_type","data":"withdraw","path":["arguments"]},"parameter":"body","reason":"validation_error"}

 ./bin/aecli.js  contract call ./wallet1 withdraw int 0  --contractAddress ct_contract_one -u https://compiler.aepps.com --internalUrl https://compiler.aepps.com --networkId ae_mainnet --compilerUrl https://compiler.aepps.com
got error2:
Cannot read property 'version' of undefined undefined

Thank you. I am working on update CLI contract module with latest sdk breaking changes.
Will ping you as soon as it will be done.

Thank you very much!

@mile Fix already merged: GitHub - aeternity/aepp-cli-js: Command line interface for the æternity blockchain

@nduchak.chain , thank you for the update, but when i run ‘npm install’, it got this error, is everything ok?

➜  aepp-cli-js git:(develop) npm install
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/traverse-f19a22fa/package.json'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/traverse-f19a22fa/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/traverse-f19a22fa/README.md'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/plugin-proposal-unicode-property-regex-43567fe1/test/fixtures/without-unicode-flag/unicode-10/input.js'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/plugin-proposal-unicode-property-regex-43567fe1/test/fixtures/without-unicode-flag/unicode-10/output.js'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/plugin-proposal-unicode-property-regex-43567fe1/test/fixtures/without-unicode-flag/unicode-11/input.js'
npm WARN tar ENOENT: no such file or directory, lstat '/Users/me/ae/aepp-cli-js/node_modules/.staging/docco-7805dc7f/resources/parallel/public'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/@babel/plugin-proposal-unicode-property-regex-43567fe1/test/fixtures/without-unicode-flag/unicode-11/output.js'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/nise-765ce778/README.md'
npm WARN tar ENOENT: no such file or directory, open '/Users/me/ae/aepp-cli-js/node_modules/.staging/sinon-f7f9ed9b/pkg/sinon.js'
npm WARN @aeternity/[email protected] No repository field.

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/aeternity/aepp-sdk-js.git
npm ERR! 
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2019-04-11T15_09_44_455Z-debug.log

@mile Can you get fresh changes and try again.

Thank you, The latest js sdk need the --contractSource too? but got another error, :hushed:

API ERROR: { Error: Http request for https://compiler.aepps.com/aci failed with status code 403. Status: Forbidden.
Error data: {“reason”:“Parse errors\nline 1, column 1: Unexpected token ‘.’”}
at processResponse (/Users/me/ae/aepp-cli-js/node_modules/@Albert/aepp-sdk/es/utils/http.js:40:7)
at process._tickCallback (internal/process/next_tick.js:68:7)
data:
{ reason: ‘Parse errors\nline 1, column 1: Unexpected token '.'’ } }

@mile Looks like your contract has some errors. Try to compiler it aecli contract compile CONTRACT_PATH --compilerUrl COMPILER_URL?
The latest js sdk need the --contractSource too? Yes, new compiler require source code to encode callData.

Hi @nduchak.chain I compile it success by use the command aecli contract compile CONTRACT_PATH --compilerUrl COMPILER_URL ?, but call it it show error:

API ERROR:  { Error: Http request for https://compiler.aepps.com/aci failed with status code 403. Status: Forbidden. 
Error data: {"reason":"Parse errors\nline 1, column 1: Unexpected token '.'"}
    at processResponse (/Users/me/ae/aepp-cli-js/node_modules/@aeternity/aepp-sdk/es/utils/http.js:40:7)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  data:
   { reason: 'Parse errors\nline 1, column 1: Unexpected token \'.\'' } }

Has this been resolved? I’ll ping @nduchak.chain again. Thanks.

It’s already resolved.
https://forum.aeternity.com/t/hi-nduchak-thats-very-sad-i-deploy-the-contract-few-month-ago-and-it-work-well-also-i-save-ae-tokens-on-that-contract/3136/19

2 Likes

The latest js sdk will work well, thank you.

1 Like