Skip to content

Instantly share code, notes, and snippets.

@y-temp4
Created December 20, 2017 23:25
Show Gist options
  • Save y-temp4/342566dfc19c2daecda64439b747910f to your computer and use it in GitHub Desktop.
Save y-temp4/342566dfc19c2daecda64439b747910f to your computer and use it in GitHub Desktop.
【初心者向け】NEM LibraryとJavaScriptを使った開発にちょっとだけ入門してみる ref: https://qiita.com/y-temp4/items/9be4b041565a4bb24dab
{
"presets": ["env"]
}
$ mkdir nem-library-sample
$ cd nem-library-sample
$ npm install -g yarn
$ yarn -v
1.3.2
$ yarn add nem-library
$ yarn add -D babel-cli babel-preset-env
$ yarn run build
$ node lib/index.js
AccountInfoWithMetaData {
balance:
Balance {
balance: 50482710823914,
vestedBalance: 50482622997125,
unvestedBalance: 87826789 },
importance: 0.005727549928501352,
publicAccount:
PublicAccount {
address:
Address {
value: 'TALICEROONSJCPHC63F52V6FY3SDMSVAEUGHMB7C',
networkType: 152 },
publicKey: '74375c15c6ce6bdbde59be88a069745a0de34444ea933f8c9f46ef407cf30196' },
harvestedBlocks: 134648,
cosignatoriesCount: undefined,
minCosignatories: undefined,
status: 'UNLOCKED',
remoteStatus: 'INACTIVE',
cosignatoryOf: [],
cosignatories: [] }
import {AccountHttp, NEMLibrary, NetworkTypes, Address} from "nem-library";
// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);
const address = new Address("TALICEROONSJCPHC63F52V6FY3SDMSVAEUGHMB7C");
const accountHttp = new AccountHttp();
accountHttp.getFromAddress(address).subscribe(accountInfoWithMetaData => {
console.log(accountInfoWithMetaData);
});
{
"dependencies": {
"nem-library": "^0.10.0"
},
+ "scripts": {
+ "build": "babel src -d lib"
+ },
"devDependencies": {
"@babel/cli": "^7.0.0-beta.32",
"@babel/preset-env": "^7.0.0-beta.32"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment