1

After typing the commands in the terminal (mac): npm init and npm install nem-sdk

I create a main.js script in the same file:

let nem = require("nem-sdk").default;
let endpoint = nem.model.objects.create("endpoint") 
(nem.model.nodes.defaultTesnet, nem.model.nodes.defaultPort);
nem.com.requests.chain.lastBlock(endpoint).then(function(block) { 
    console.log(block);
    }, function(err){
    console.log(err);
});

when I launched this file I got the following error msg:

error

femtoRgon
  • 32,893
  • 7
  • 60
  • 87
  • looks like you have to specify an endpoint to a valid node like this: https://www.npmjs.com/package/nem-sdk#41---create-endpoints – DZDomi Jul 17 '18 at 20:55

1 Answers1

1

It looks like you misspelled testnet in nem.model.nodes.defaultTesnet. It should be nem.model.nodes.defaultTestnet