Created
December 20, 2017 23:25
-
-
Save y-temp4/342566dfc19c2daecda64439b747910f to your computer and use it in GitHub Desktop.
【初心者向け】NEM LibraryとJavaScriptを使った開発にちょっとだけ入門してみる ref: https://qiita.com/y-temp4/items/9be4b041565a4bb24dab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["env"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir nem-library-sample | |
$ cd nem-library-sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install -g yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn -v | |
1.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn add nem-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn add -D babel-cli babel-preset-env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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: [] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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