new Admin(neb)
Admin API constructor.
Class encapsulate methods for admin APIs commands.
Parameters:
| Name | Type | Description |
|---|---|---|
neb |
Neb | Instance of Neb library. |
- See:
Example
var admin = new Admin( new Neb() ); // or just var admin = new Neb().admin;
Methods
-
nodeInfo()
-
Method get info about nodes in Nebulas Network.
Returns:
Example
var admin = new Neb().admin; admin.nodeInfo().then(function(info) { //code }); -
accounts()
-
Method get list of available addresses.
Returns:
Example
var admin = new Neb().admin; admin.accounts().then(function(accounts) { //code }); -
newAccount(options)
-
Method create a new account in Nebulas network with provided passphrase.
Parameters:
Name Type Description optionsObject Properties
Name Type Description passphrasePassword Returns:
Example
var admin = new Neb().admin; admin.newAccount({passphrase: "passphrase"}).then(function(address) { //code }); -
unlockAccount(options)
-
Method unlock account with provided passphrase. After the default unlock time, the account will be locked.
Parameters:
Name Type Description optionsObject Properties
Name Type Description addressHexString passphrasePassword durationNumber Returns:
Example
var admin = new Neb().admin; admin.unlockAccount({ address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh", passphrase: "passphrase", duration: 1000000000 }).then(function(isUnLocked) { //code }); -
lockAccount(options)
-
Method lock account.
Parameters:
Name Type Description optionsObject Properties
Name Type Description addressHexString Returns:
Example
var admin = new Neb().admin; admin.lockAccount({address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh"}).then(function(isLocked) { //code }); -
sendTransaction(options)
-
Method wrap transaction sending functionality.
Parameters:
Name Type Description optionsTransactionOptions Returns:
Example
var admin = new Neb().admin; admin.sendTransaction({ from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5", to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000 }).then(function(tx) { //code }); -
signHash(options)
-
Method sign hash.
Parameters:
Name Type Description optionsObject Properties
Name Type Description addressHexString hashBase64 of hash bytes with base64 encode. algUInt32 Returns:
Example
var admin = new Neb().admin; admin.SignHash({ address: "n1cYKNHTeVW9v1NQRWuhZZn9ETbqAYozckh", hash: "OGQ5NjllZWY2ZWNhZDNjMjlhM2E2MjkyODBlNjg2Y2YwYzNmNWQ1YTg2YWZmM2NhMTIwMjBjOTIzYWRjNmM5Mg==", alg: 1 }).then(function(data) { //code }); -
signTransactionWithPassphrase(options)
-
Method sign transaction with passphrase. The transaction's from addrees must be unlock before sign call.
Parameters:
Name Type Description optionsTransactionOptions Properties
Name Type Description passphrasePassword Returns:
Example
var admin = new Neb().admin; admin.signTransactionWithPassphrase({ from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5", to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000, passphrase: "passphrase" }).then(function(tx) { //code }); -
sendTransactionWithPassphrase(options)
-
Method send transaction with passphrase.
Parameters:
Name Type Description optionsTransactionOptions Properties
Name Type Description passphrasePassword Returns:
Example
var admin = new Neb().admin; admin.sendTransactionWithPassphrase({ from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5", to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17", value: 10, nonce: 12, gasPrice: 1000000, gasLimit: 2000000, passphrase: "passphrase" }).then(function(tx) { //code }); -
startPprof(options)
-
Method start listen provided port.
Parameters:
Name Type Description optionsObject Properties
Name Type Description listenString Listen port. Returns:
Example
var admin = new Neb().admin; admin.startPprof({listen: '8080'}).then(function(isListenStrted) { //code }); -
getConfig()
-
Method get config of node in Nebulas Network.
Returns:
Example
var admin = new Neb().admin; admin.getConfig().then(function(info) { //code });
Nebulas JavaScript API