Skip to content

Instantly share code, notes, and snippets.

@makoto
Created February 10, 2019 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makoto/8ba2b887097281fd6d4cc79e5a7f06f4 to your computer and use it in GitHub Desktop.
Save makoto/8ba2b887097281fd6d4cc79e5a7f06f4 to your computer and use it in GitHub Desktop.
makoto@Makotos-MacBook-Air: [~/src/tmp/univesal - (master)] $ more package.json
{
"name": "univesal",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:dev": "universal-login start:dev"
},
"keywords": [],
"author": "Makoto Inoue <inouemak@googlemail.com>",
"license": "ISC",
"resolutions": {
"web3": "1.0.0-beta.35"
},
"dependencies": {
"truffle": "^5.0.3",
"universal-login-sdk": "^0.1.9"
},
"devDependencies": {
"universal-login-ops": "^0.1.6"
}
}
makoto@Makotos-MacBook-Air: [~/src/tmp/univesal - (master)] $ more index.js
var UniversalLoginSDK = require('universal-login-sdk').default;
const universalLoginSDK = new UniversalLoginSDK('http://localhost::3311', 'http://localhost:18545');
var privateKey;
var contractAddress;
console.log({privateKey,contractAddress});
universalLoginSDK.create('myname.example-domain.eth').then((a,b,c)=>{
console.log({a,b,c})
privateKey =a; contractAddress=b;
console.log({privateKey,contractAddress});
})
makoto@Makotos-MacBook-Air: [~/src/tmp/univesal - (master)] $ node index.js
{ privateKey: undefined, contractAddress: undefined }
(node:24545) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at http://localhost:3311/:/identity reason: Unexpected token < in JSON at position 0
at /Users/makoto/src/tmp/univesal/node_modules/universal-login-sdk/node_modules/node-fetch/lib/index.js:241:32
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:24545) 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: 2)
(node:24545) [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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment