{"action":"created","issue":{"url":"https://api.github.com/repos/EOSIO/eosjs/issues/21","repository_url":"https://api.github.com/repos/EOSIO/eosjs","labels_url":"https://api.github.com/repos/EOSIO/eosjs/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/EOSIO/eosjs/issues/21/comments","events_url":"https://api.github.com/repos/EOSIO/eosjs/issues/21/events","html_url":"https://github.com/EOSIO/eosjs/issues/21","id":296095227,"number":21,"title":"Contract handling - Invalid character: '_' ","user":{"login":"robertkowalski","id":298166,"avatar_url":"https://avatars1.githubusercontent.com/u/298166?v=4","gravatar_id":"","url":"https://api.github.com/users/robertkowalski","html_url":"https://github.com/robertkowalski","followers_url":"https://api.github.com/users/robertkowalski/followers","following_url":"https://api.github.com/users/robertkowalski/following{/other_user}","gists_url":"https://api.github.com/users/robertkowalski/gists{/gist_id}","starred_url":"https://api.github.com/users/robertkowalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertkowalski/subscriptions","organizations_url":"https://api.github.com/users/robertkowalski/orgs","repos_url":"https://api.github.com/users/robertkowalski/repos","events_url":"https://api.github.com/users/robertkowalski/events{/privacy}","received_events_url":"https://api.github.com/users/robertkowalski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jcalfee","id":204121,"avatar_url":"https://avatars3.githubusercontent.com/u/204121?v=4","gravatar_id":"","url":"https://api.github.com/users/jcalfee","html_url":"https://github.com/jcalfee","followers_url":"https://api.github.com/users/jcalfee/followers","following_url":"https://api.github.com/users/jcalfee/following{/other_user}","gists_url":"https://api.github.com/users/jcalfee/gists{/gist_id}","starred_url":"https://api.github.com/users/jcalfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcalfee/subscriptions","organizations_url":"https://api.github.com/users/jcalfee/orgs","repos_url":"https://api.github.com/users/jcalfee/repos","events_url":"https://api.github.com/users/jcalfee/events{/privacy}","received_events_url":"https://api.github.com/users/jcalfee/received_events","type":"User","site_admin":false},"assignees":[{"login":"jcalfee","id":204121,"avatar_url":"https://avatars3.githubusercontent.com/u/204121?v=4","gravatar_id":"","url":"https://api.github.com/users/jcalfee","html_url":"https://github.com/jcalfee","followers_url":"https://api.github.com/users/jcalfee/followers","following_url":"https://api.github.com/users/jcalfee/following{/other_user}","gists_url":"https://api.github.com/users/jcalfee/gists{/gist_id}","starred_url":"https://api.github.com/users/jcalfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcalfee/subscriptions","organizations_url":"https://api.github.com/users/jcalfee/orgs","repos_url":"https://api.github.com/users/jcalfee/repos","events_url":"https://api.github.com/users/jcalfee/events{/privacy}","received_events_url":"https://api.github.com/users/jcalfee/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-02-10T11:54:03Z","updated_at":"2018-02-28T14:14:52Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi James,\r\n\r\nwith the latest version I still run into issues. Getting an instance of the `exchange` contract works for me, but sending the message does not.\r\n\r\n```js\r\n  const options = {\r\n    broadcast: true,\r\n    sign: true,\r\n    scope: [\r\n      \"exchange\"\r\n    ],\r\n    authorization: [{\r\n      \"account\": \"inita\",\r\n      \"permission\": \"active\"\r\n    }]\r\n  }\r\n\r\n  const msg = {\r\n    \"buyer\":{ \"name\": \"inita\", \"number\": \"1516073924\"},\r\n    \"at_price\":\"5000000000000000\",\r\n    \"expiration\":\"2018-12-31T23:59:59\",\r\n    \"quantity\": \"100\",\r\n    \"fill_or_kill\": \"0\"\r\n  }\r\n\r\n  eos\r\n    .contract('exchange', options)\r\n    .then((contract) => {\r\n      contract.buy(msg)\r\n    })\r\n```\r\n\r\nresults in:\r\n\r\n```\r\nTypeError: Invalid character: '_' message.type = \"buy_order\" transaction.messages = [{\"code\":\"exchange\",\"type\":\"buy_order\",\"authorization\":[],\"data\":{\"buyer\":{\"name\":\"inita\",\"number\":\"1516073924\"},\"at_price\":\"5000000000000000\",\"quantity\":\"100\",\"expiration\":1546300799,\"fill_or_kill\":\"0\"}}]\r\n    at charidx (/Users/robert/test/node_modules/eosjs/lib/format.js:61:25)\r\n    at encodeName (/Users/robert/test/node_modules/eosjs/lib/format.js:90:31)\r\n    at Object.appendByteBuffer (/Users/robert/test/node_modules/eosjs/lib/structs.js:97:21)\r\n    at Object.appendByteBuffer (/Users/robert/test/node_modules/fcbuffer/lib/struct.js:103:20)\r\n    at Object.appendByteBuffer (/Users/robert/test/node_modules/fcbuffer/lib/types.js:292:16)\r\n    at Object.appendByteBuffer (/Users/robert/test/node_modules/fcbuffer/lib/struct.js:103:20)\r\n    at toByteBuffer (/Users/robert/test/node_modules/fcbuffer/lib/fcbuffer.js:282:8)\r\n    at Function.toBuffer (/Users/robert/test/node_modules/fcbuffer/lib/fcbuffer.js:269:22)\r\n    at /Users/robert/test/node_modules/eosjs/lib/write-api.js:519:26\r\n    at /Users/robert/test/node_modules/eosjs/lib/write-api.js:660:7\r\n```\r\n\r\ndoes the exchange contract work for you?"},"comment":{"url":"https://api.github.com/repos/EOSIO/eosjs/issues/comments/369251847","html_url":"https://github.com/EOSIO/eosjs/issues/21#issuecomment-369251847","issue_url":"https://api.github.com/repos/EOSIO/eosjs/issues/21","id":369251847,"user":{"login":"robertkowalski","id":298166,"avatar_url":"https://avatars1.githubusercontent.com/u/298166?v=4","gravatar_id":"","url":"https://api.github.com/users/robertkowalski","html_url":"https://github.com/robertkowalski","followers_url":"https://api.github.com/users/robertkowalski/followers","following_url":"https://api.github.com/users/robertkowalski/following{/other_user}","gists_url":"https://api.github.com/users/robertkowalski/gists{/gist_id}","starred_url":"https://api.github.com/users/robertkowalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertkowalski/subscriptions","organizations_url":"https://api.github.com/users/robertkowalski/orgs","repos_url":"https://api.github.com/users/robertkowalski/repos","events_url":"https://api.github.com/users/robertkowalski/events{/privacy}","received_events_url":"https://api.github.com/users/robertkowalski/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T14:14:52Z","updated_at":"2018-02-28T14:14:52Z","author_association":"CONTRIBUTOR","body":"thanks @jcalfee \r\n\r\nrunning into another issue now, probably i don't sign the message properly?\r\n\r\n```js\r\nconst eos = eos.Localnet({\r\n  keyProvider: '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'\r\n})\r\n\r\n  const options = {\r\n    broadcast: true,\r\n    sign: true,\r\n    scope: [\r\n      \"exchange\"\r\n    ],\r\n    authorization: [{\r\n      \"account\": \"inita\",\r\n      \"permission\": \"active\"\r\n    }]\r\n  }\r\n\r\n  const msg = {\r\n    \"buyer\":{ \"name\": \"inita\", \"number\": \"1516073924\"},\r\n    \"at_price\":\"5000000000000000\",\r\n    \"expiration\":\"2018-12-31T23:59:59\",\r\n    \"quantity\": \"100\",\r\n    \"fill_or_kill\": 0\r\n  }\r\n\r\n  eos\r\n    .contract('exchange', options)\r\n    .then((contract) => {\r\n      contract.buy(msg)\r\n    })\r\n```\r\n\r\n```\r\n{ at_price: '100',\r\n  expiration: '2018-12-31T23:59:59',\r\n  quantity: '1',\r\n  fill_or_kill: 1,\r\n  buyer: { name: 'inita', number: 77829758 } }\r\n{ Error: {\"code\":400,\"message\":\"Bad Request\",\"details\":\"irrelevant signature included (3030004)\\nTransaction bears irrelevant signatures from these keys: [\\\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\\\"]\\n\\n\"}\r\n    at /Users/robert/bitfinex/sunbeam/node_modules/eosjs-api/lib/apigen.js:98:23\r\n    at <anonymous>\r\n    at process._tickCallback (internal/process/next_tick.js:160:7) status: 400, statusText: 'Bad Request' }\r\n[push_transaction error] '{\"code\":400,\"message\":\"Bad Request\",\"details\":\"irrelevant signature included (3030004)\\nTransaction bears irrelevant signatures from these keys: [\\\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\\\"]\\n\\n\"}', digest '54b51e67b9e84fb8965a0000010000008a4dd35057000000000000bc3e002d000000000093dd74c4735d5a000000000080e03779c31100000000000000000064000000000000007fad2a5c00'\r\n{\"code\":400,\"message\":\"Bad Request\",\"details\":\"irrelevant signature included (3030004)\\nTransaction bears irrelevant signatures from these keys: [\\\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\\\"]\\n\\n\"}\r\n(node:81574) UnhandledPromiseRejectionWarning: {\"code\":400,\"message\":\"Bad Request\",\"details\":\"irrelevant signature included (3030004)\\nTransaction bears irrelevant signatures from these keys: [\\\"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\\\"]\\n\\n\"}\r\n(node:81574) 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)\r\n(node:81574) [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.\r\n```"}}
{"actor":{"display_login":"robertkowalski"}}