Skip to content

Latest commit

 

History

History
1431 lines (1032 loc) · 64.2 KB

documentation.md

File metadata and controls

1431 lines (1032 loc) · 64.2 KB

Objects

Main : object
CamoUtil : object
BananoUtil : object
WithdrawUtil : object
DepositUtil : object
BananodeApi : object

Typedefs

BananoParts : Object
Block : Object
AccountValidationInfo : Object

Main : object

Kind: global namespace

Main.BANANO_PREFIX : string

Kind: static constant of Main

Main.setBananodeApi(_bananodeApi) ⇒ undefined

Sets the Bananode Api (useful for overriding some methods)

Kind: static method of Main
Returns: undefined - returns nothing.

Param Type Description
_bananodeApi string the new bananodeApi

Main.setAuth(auth) ⇒ undefined

Sets the Bananode Api Authorization

Kind: static method of Main
Returns: undefined - returns nothing.

Param Type Description
auth string the new authorization

Main.setHeaders(headers) ⇒ undefined

Sets the Bananode Api Headers

Kind: static method of Main
Returns: undefined - returns nothing.

Param Type Description
headers string the new headers

Main.setBananodeApiProxy(proxy) ⇒ undefined

Sets the Bananode Api Proxy (http pr https proxy)

Kind: static method of Main
Returns: undefined - returns nothing.

Param Type Description
proxy Object the new proxy

Main.getBananodeApiProxy() ⇒ Object

Gets the Bananode Api Proxy (http pr https proxy)

Kind: static method of Main
Returns: Object - returns the module.

Main.setBananodeApiUrl(url) ⇒ undefined

Sets the URL to use for the node behind the Bananode Api

Kind: static method of Main
Returns: undefined - returns nothing.

Param Type Description
url string the new url

Main.getRawStrFromBananoStr(amountStr, amountPrefix) ⇒ string

Converts an amount into a raw amount.

Kind: static method of Main
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the amount, as a string.
amountPrefix string the amount, as a string.

Main.getRawStrFromBanoshiStr(amountStr, amountPrefix) ⇒ string

Converts an amount into a raw amount.

Kind: static method of Main
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the amount, as a string.
amountPrefix string the amount, as a string.

Main.getRawStrFromNanoStr(amountStr, amountPrefix) ⇒ string

Converts an amount into a raw amount.

Kind: static method of Main
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the amount, as a string.
amountPrefix string the amount, as a string.

Main.getRawStrFromNanoshiStr(amountStr, amountPrefix) ⇒ string

Converts an amount into a raw amount.

Kind: static method of Main
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the amount, as a string.
amountPrefix string the amount, as a string.

CamoUtil : object

Kind: global namespace

CamoUtil.camoBananoReceive(toPrivateKey, fromPublicKey) ⇒ Promise.<Array.<string>>

receives banano funds at a camo address.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the received hashes in an array.

Param Type Description
toPrivateKey string the private key that receives the funds.
fromPublicKey string the public key that sent the funds.

CamoUtil.camoNanoReceive(toPrivateKey, fromPublicKey) ⇒ Promise.<Array.<string>>

receives nano funds at a camo address.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the received hashes in an array.

Param Type Description
toPrivateKey string the private key that receives the funds.
fromPublicKey string the public key that sent the funds.

CamoUtil.getCamoBananoNextPrivateKeyForReceive(seed) ⇒ Promise.<string>

finds a new private key to recieve more banano funds. the key would have no history.

Kind: static method of CamoUtil
Returns: Promise.<string> - the private key to use.

Param Type Description
seed string the seed to use to find the account.

CamoUtil.getCamoNanoNextPrivateKeyForReceive(seed) ⇒ Promise.<string>

finds a new private key to recieve more banano funds. the key would have no history.

Kind: static method of CamoUtil
Returns: Promise.<string> - the private key to use.

Param Type Description
seed string the seed to use to find the account.

CamoUtil.camoBananoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos) ⇒ Promise.<Array.<string>>

sends banano funds to a camo address.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the sent hashes in an array.

Param Type Description
fundingPrivateKey string the private key that sends the funds.
fromCamoPrivateKey string the private key used to generate the shared seed.
toCamoPublicKey string the public key that receives the funds.
amountBananos string the amount of bananos.

CamoUtil.camoNanoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos) ⇒ Promise.<Array.<string>>

sends camo funds to a camo address.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the sent hashes in an array.

Param Type Description
fundingPrivateKey string the private key that sends the funds.
fromCamoPrivateKey string the private key used to generate the shared seed.
toCamoPublicKey string the public key that receives the funds.
amountBananos string the amount of bananos.

CamoUtil.camoBananoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos) ⇒ Promise.<Array.<string>>

sends banano funds to a camo account. This function uses seed index 0 to generate the shared secret, and seed index "seedIx" to get the private key that contains funds to send.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the sent hashes in an array.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
toAccount string the account to send to.
amountBananos string the amount of bananos.

CamoUtil.camoNanoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos) ⇒ Promise.<Array.<string>>

sends nano funds to a camo account. This function uses seed index 0 to generate the shared secret, and seed index "seedIx" to get the private key that contains funds to send.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the sent hashes in an array.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
toAccount string the account to send to.
amountBananos string the amount of bananos.

CamoUtil.camoBananoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count) ⇒ Promise.<Array.<string>>

get the pending blocks for the camo banano account.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the pending hashes in an array.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
fromAccount string the account to recieve from.
sharedSeedIx number the index to use with the shared seed.
count number the max count to get.

CamoUtil.camoNanoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count) ⇒ Promise.<Array.<string>>

get the pending blocks for the camo nano account.

Kind: static method of CamoUtil
Returns: Promise.<Array.<string>> - the pending hashes in an array.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
fromAccount string the account to recieve from.
sharedSeedIx number the index to use with the shared seed.
count number the max count to get.

CamoUtil.getCamoAccountValidationInfo(account) ⇒ object

returns data on whether a camo account is valid or not, and why.

Kind: static method of CamoUtil
Returns: object - the account validity data.

Param Type Description
account string the account to check.

CamoUtil.getCamoBananoSharedAccountData(seed, seedIx, account, sharedSeedIx) ⇒ Promise.<string>

get the banano shared account, used as an intermediary to send finds between the seed and the camo account.

Kind: static method of CamoUtil
Returns: Promise.<string> - the shared account.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
account string the camo account to send or recieve from.
sharedSeedIx string the index to use with the shared seed.

CamoUtil.getCamoNanoSharedAccountData(seed, seedIx, account, sharedSeedIx) ⇒ Promise.<string>

get the nano shared account, used as an intermediary to send finds between the seed and the camo account.

Kind: static method of CamoUtil
Returns: Promise.<string> - the shared account.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
account string the camo account to send or recieve from.
sharedSeedIx string the index to use with the shared seed.

CamoUtil.receiveCamoBananoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash) ⇒ Promise.<string>

Recieve banano deposits for a camo account with a given seed.

Kind: static method of CamoUtil
Returns: Promise.<string> - the response from receiving the block.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
account string the camo account to send or recieve from.
sharedSeedIx string the index to use with the shared seed.
specificPendingBlockHash string the pending block to recieve.

CamoUtil.receiveCamoNanoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash) ⇒ Promise.<string>

Recieve nano deposits for a camo account with a given seed.

Kind: static method of CamoUtil
Returns: Promise.<string> - the response from receiving the block.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
account string the camo account to send or recieve from.
sharedSeedIx string the index to use with the shared seed.
specificPendingBlockHash string the pending block to recieve.

CamoUtil.getCamoBananoAccountBalanceRaw(toPrivateKey, fromPublicKey) ⇒ Promise.<string>

gets the total banano account balance, in raw.

Kind: static method of CamoUtil
Returns: Promise.<string> - the account balance, in raw.

Param Type Description
toPrivateKey string the private key that receives the funds.
fromPublicKey string the public key that sent the funds.

CamoUtil.getCamoNanoAccountBalanceRaw(toPrivateKey, fromPublicKey) ⇒ Promise.<string>

gets the total nano account balance, in raw.

Kind: static method of CamoUtil
Returns: Promise.<string> - the account balance, in raw.

Param Type Description
toPrivateKey string the private key that receives the funds.
fromPublicKey string the public key that sent the funds.

CamoUtil.getCamoPublicKey(privateKey) ⇒ string

Gets the camo public key from a private key.

a normal banano public key is used in ECDSA.

a camo public key is used in ECDH.

this is why the derivation is different for the two keys.

Kind: static method of CamoUtil
Returns: string - the camo public key.

Param Type Description
privateKey string the private key.

CamoUtil.getSharedSecret(privateKey, publicKey) ⇒ string

Gets the shared secret from a camo public key and a private key.

Kind: static method of CamoUtil
Returns: string - the shared secret.

Param Type Description
privateKey string the private key.
publicKey string the public key.

CamoUtil.getCamoAccount(camoPublicKey) ⇒ string

Get the camo account for a given camo public key.

Kind: static method of CamoUtil
Returns: string - the camo account.

Param Type Description
camoPublicKey string the camo public key.

CamoUtil.isCamoAccountValid(camoAccount) ⇒ boolean

checks if a camo account is valid.

Kind: static method of CamoUtil
Returns: boolean - true if the camo account is valid.

Param Type Description
camoAccount string the camo account.

BananoUtil : object

Kind: global namespace

BananoUtil.getBananoPartsFromDecimal(decimalAmount) ⇒ BananoParts

converts amount from decimal to bananoParts.

Kind: static method of BananoUtil
Returns: BananoParts - returns the banano parts of the decimal amount.

Param Type Description
decimalAmount string the decimal amount of bananos.

BananoUtil.getBananoPartsAsDecimal(bananoParts) ⇒ string

converts amount from bananoParts to decimal.

Kind: static method of BananoUtil
Returns: string - returns the decimal amount of bananos.

Param Type Description
bananoParts BananoParts the banano parts to describe.

BananoUtil.getBananoDecimalAmountAsRaw(amount) ⇒ string

converts amount from decimal to raw.

Kind: static method of BananoUtil
Returns: string - returns amount in raw.

Param Type Description
amount string the decimal amount.

BananoUtil.getBananoPartsDescription(bananoParts) ⇒ string

describes the banano parts in an english description.

Kind: static method of BananoUtil
Returns: string - returns the description of the banano parts.

Param Type Description
bananoParts BananoParts the banano parts to describe.

BananoUtil.sendAmountToBananoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒ Promise.<string>

Sends the amount to the account with an optional representative and previous block hash. If the representative is not sent, it will be pulled from the api. If the previous is not sent, it will be pulled from the api. Be very careful with previous, as setting it incorrectly can cause an incorrect amount of funds to be sent.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the send.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
destAccount string the destination account.
amountRaw string the amount to send, in raw.
representative string the representative (optional).
previousHash string the previous hash (optional).

BananoUtil.sendAmountToNanoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒ Promise.<string>

Sends the amount to the account with an optional representative and previous block hash. If the representative is not sent, it will be pulled from the api. If the previous is not sent, it will be pulled from the api. Be very careful with previous, as setting it incorrectly can cause an incorrect amount of funds to be sent.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the send.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
destAccount string the destination account.
amountRaw string the amount to send, in raw.
representative string the representative (optional).
previousHash string the previous hash (optional).

BananoUtil.sendAmountToBananoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒ Promise.<string>

Sends the amount to the banano account with a callback for success and failure.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the send.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
destAccount string the destination account.
amountRaw string the amount to send, in raw.
successCallback string the callback to call upon success.
failureCallback string the callback to call upon failure.

BananoUtil.sendAmountToNanoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒ Promise.<string>

Sends the amount to the nano account with a callback for success and failure.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the send.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
destAccount string the destination account.
amountRaw string the amount to send, in raw.
successCallback string the callback to call upon success.
failureCallback string the callback to call upon failure.

BananoUtil.changeBananoRepresentativeForSeed(seed, seedIx, representative) ⇒ Promise.<string>

Sets the rep for an account with a given seed.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the change.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.

BananoUtil.changeNanoRepresentativeForSeed(seed, seedIx, representative) ⇒ Promise.<string>

Sets the rep for an account with a given seed.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the change.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.

BananoUtil.getBananoAccountFromSeed(seed, seedIx) ⇒ Promise.<string>

Get the banano account with a given seed and index.

Kind: static method of BananoUtil
Returns: Promise.<string> - the account.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.

BananoUtil.getNanoAccountFromSeed(seed, seedIx) ⇒ Promise.<string>

Get the banano account with a given seed and index.

Kind: static method of BananoUtil
Returns: Promise.<string> - the account.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.

BananoUtil.openBananoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒ Promise.<string>

Open a banano account with a given seed.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the open.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.
pendingBlockHash string the pending block hash.
pendingValueRaw string the pending block hash.

BananoUtil.openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒ Promise.<string>

Open a nano account with a given seed.

Kind: static method of BananoUtil
Returns: Promise.<string> - returns the hash returned by the open.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.
pendingBlockHash string the pending block hash.
pendingValueRaw string the pending block hash.

BananoUtil.getBlockHash(block) ⇒ string

Get the hash for a given block.

Kind: static method of BananoUtil
Returns: string - the block's hash.

Param Type Description
block string the seed to use to find the account.

BananoUtil.signMessage(privateKeyOrSigner, message) ⇒ string

signs a dummy block with a hash of the utf-8 message using private key.

Kind: static method of BananoUtil
Returns: string - the message's signature.

Param Type Description
privateKeyOrSigner string the private key to use to sign.
message string the utf-8 message to sign.

BananoUtil.hashMessageToBytes(message) ⇒ Uint8Array

signs a utf-8 message with private key. Only used internally and for testing.

Kind: static method of BananoUtil
Returns: Uint8Array - hashed message's bytes.

Param Type Description
message string the utf-8 message to sign.

BananoUtil.messageDummyBlockHashBytes(privateKey, message) ⇒ Uint8Array

generates a dummy block hash that is used for message signing.

Kind: static method of BananoUtil
Returns: Uint8Array - hashed dummy block's bytes.

Param Type Description
privateKey string the private key to use to sign.
message string the utf-8 message to sign.

BananoUtil.messageDummyBlock(privateKey, message) ⇒ string

generates a dummy block that is used for message signing.

Kind: static method of BananoUtil
Returns: string - the message's block.

Param Type Description
privateKey string the private key to use to sign.
message string the utf-8 message to sign.

BananoUtil.verifyMessage(publicKey, message, signature) ⇒ boolean

verifies a utf-8 message with public key from a dummy block signature.

Kind: static method of BananoUtil
Returns: boolean - whether the signature was verified.

Param Type Description
publicKey string the public key to use to sign.
message string the utf-8 message to verify.
signature string hex of signature.

BananoUtil.signHash(privateKey, hash) ⇒ string

signs a hash.

Kind: static method of BananoUtil
Returns: string - the block's hash.

Param Type Description
privateKey string the private key to use to sign.
hash string the hash to sign.

BananoUtil.verify(hash, signature, publicKey) ⇒ string

verifys a hash.

Kind: static method of BananoUtil
Returns: string - true if verification passed.

Param Type Description
hash string the hash to verify.
signature string the signature to verify.
publicKey string the public key to use to sign.

BananoUtil.getSignature(privateKey, block) ⇒ string

Get the signature for a given block (gets the hash of the block, and signs the hash).

Kind: static method of BananoUtil
Returns: string - the block's signature.

Param Type Description
privateKey string the private key used to sign the block.
block string the block to sign.

BananoUtil.getBytesFromHex(hex) ⇒ Uint8Array

Converts a hex string to bytes in a Uint8Array.

Kind: static method of BananoUtil
Returns: Uint8Array - the bytes in a Uint8Array.

Param Type Description
hex string the hex string to use.

BananoUtil.getHexFromBytes(bytes) ⇒ string

Converts bytes in a Uint8Array to a hex string.

Kind: static method of BananoUtil
Returns: string - the hex string.

Param Type Description
bytes Uint8Array the bytes to use.

BananoUtil.getWorkUsingCpu(hash, workBytes) ⇒ string

gets work bytes using the CPU.

Kind: static method of BananoUtil
Returns: string - the work bytes as a hex string.

Param Type Description
hash string the hash to use to calculate work bytes.
workBytes Uint8Array the Uint8Array(8) used to store temporary calculations.

BananoUtil.getBananoAccount(publicKey) ⇒ string

Get the banano account for a given public key.

Kind: static method of BananoUtil
Returns: string - the account.

Param Type Description
publicKey string the public key.

BananoUtil.getNanoAccount(publicKey) ⇒ string

Get the banano account for a given public key.

Kind: static method of BananoUtil
Returns: string - the account.

Param Type Description
publicKey string the public key.

BananoUtil.getBananoPartsFromRaw(amountRawStr) ⇒ BananoParts

Get the banano parts (banano, banoshi, raw) for a given raw value.

Kind: static method of BananoUtil
Returns: BananoParts - the banano parts.

Param Type Description
amountRawStr string the raw amount, as a string.

BananoUtil.getNanoPartsFromRaw(amountRawStr) ⇒ BananoParts

Get the nano parts nano, nanoshi, raw) for a given raw value.

Kind: static method of BananoUtil
Returns: BananoParts - the banano parts.

Param Type Description
amountRawStr string the raw amount, as a string.

BananoUtil.getRawStrFromMajorAmountStr(amountStr, amountPrefix) ⇒ string

Converts an amount into a raw amount.

Kind: static method of BananoUtil
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the amount, as a string.
amountPrefix string the amount, as a string.

BananoUtil.getRawStrFromMinorAmountStr(amountStr, amountPrefix) ⇒ string

Converts a banoshi amount into a raw amount.

Kind: static method of BananoUtil
Returns: string - the banano as a raw value.

Param Type Description
amountStr string the banoshi, as a string.
amountPrefix string the amount prefix, as a string.

BananoUtil.getAmountPartsFromRaw(amountRawStr, amountPrefix) ⇒ BananoParts

Get the banano parts (banano, banoshi, raw) for a given raw value.

Kind: static method of BananoUtil
Returns: BananoParts - the banano parts.

Param Type Description
amountRawStr string the raw amount, as a string.
amountPrefix string the amount prefix, as a string.

BananoUtil.getAccountPublicKey(account) ⇒ string

Get the public key for a given account.

Kind: static method of BananoUtil
Returns: string - the public key.

Param Type Description
account string the account.

BananoUtil.getAccountSuffix(publicKey) ⇒ string

Get the account suffix for a given public key (everything but ban_ or camo_ or nano_).

Kind: static method of BananoUtil
Returns: string - the account suffix.

Param Type Description
publicKey string the public key.

BananoUtil.getAccount(publicKey, accountPrefix) ⇒ string

Get the account for a given public key.

Kind: static method of BananoUtil
Returns: string - the account.

Param Type Description
publicKey string the public key.
accountPrefix string the prefix. ban_ or nano_.

BananoUtil.sign(privateKeyOrSigner, block) ⇒ string

signs a block and returns the signature.

Kind: static method of BananoUtil
Returns: string - the signature

Param Type Description
privateKeyOrSigner string the private key to use to sign or signer object (ledger).
block Block block to sign

BananoUtil.getBlake2bHash(bytes, size) ⇒ Uint8Array

returns true if the work (in bytes) for the hash (in bytes) is valid.

Kind: static method of BananoUtil
Returns: Uint8Array - the bytes of the hash.

Param Type Description
bytes Uint8Array the bytes to hash.
size Object the digest size

BananoUtil.isWorkValid(hashBytes, workBytes) ⇒ boolean

returns true if the work (in bytes) for the hash (in bytes) is valid.

Kind: static method of BananoUtil
Returns: boolean - true if the work is valid for the hash.

Param Type Description
hashBytes string the hash bytes to check.
workBytes Uint8Array the work bytes to check.

BananoUtil.getZeroedWorkBytes() ⇒ Uint8Array

creates a new Uint8Array(8) to calculate work bytes.

Kind: static method of BananoUtil
Returns: Uint8Array - the bytes in a Uint8Array.

BananoUtil.getPublicKey(privateKeyOrSigner) ⇒ Promise.<string>

Get the public key for a given private key.

Kind: static method of BananoUtil
Returns: Promise.<string> - the public key.

Param Type Description
privateKeyOrSigner string the private key or signer object (ledger).

BananoUtil.isSeedValid(seed, seedIx) ⇒ object

validates a seed.

Kind: static method of BananoUtil
Returns: object - {valid:[true/false] message:[if false, why]}.

Param Type Description
seed string the seed to use to validate.
seedIx string the index to use with the seed.

BananoUtil.getPrivateKey(seed, seedIx) ⇒ string

Get the private key for a given seed.

Kind: static method of BananoUtil
Returns: string - the private key.

Param Type Description
seed string the seed to use to find the account.
seedIx number the index to use with the seed.

BananoUtil.getBananoAccountValidationInfo(account) ⇒ AccountValidationInfo

Returns an object saying if the banano account is valid or not. If the account is not valid, the message describes why it is not valid.

Kind: static method of BananoUtil
Returns: AccountValidationInfo - an object saying if the account is valid, and why.

Param Type Description
account string the account.

BananoUtil.getNanoAccountValidationInfo(account) ⇒ AccountValidationInfo

Returns an object saying if the nano account is valid or not. If the account is not valid, the message describes why it is not valid.

Kind: static method of BananoUtil
Returns: AccountValidationInfo - an object saying if the account is valid, and why.

Param Type Description
account string the account.

WithdrawUtil : object

Kind: global namespace

WithdrawUtil.sendBananoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous) ⇒ Promise.<object>

Send a withdrawal from a banano account with a given seed.

Kind: static method of WithdrawUtil
Returns: Promise.<object> - returns the response returned by the withdraw.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
toAccount string the account to send to.
amountBananos string the amount of bananos.
representative string the new representative (optional).
previous string the new previous (optional).

WithdrawUtil.sendNanoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous) ⇒ Promise.<object>

Send a withdrawal from a nano account with a given seed.

Kind: static method of WithdrawUtil
Returns: Promise.<object> - returns the response returned by the withdraw.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
toAccount string the account to send to.
amountBananos string the amount of bananos.
representative string the new representative (optional).
previous string the new previous (optional).

DepositUtil : object

Kind: global namespace

DepositUtil.receiveNanoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash) ⇒ Promise.<object>

Recieve deposits for a nano account with a given seed.

Kind: static method of DepositUtil
Returns: Promise.<object> - returns the response returned by the receive.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.
specificPendingBlockHash string a specific block hash to receive (optional).

DepositUtil.receiveBananoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash) ⇒ Promise.<object>

Recieve deposits for a banano account with a given seed.

Kind: static method of DepositUtil
Returns: Promise.<object> - returns the response returned by the receive.

Param Type Description
seed string the seed to use to find the account.
seedIx string the index to use with the seed.
representative string the representative.
specificPendingBlockHash string a specific block hash to receive (optional).

BananodeApi : object

Kind: global namespace

BananodeApi.getAccountBalanceRaw(account) ⇒ Promise.<string>

Get the balance, in raw, for an account.

(use other methods like getBananoPartsFromRaw to convert to banano or banoshi)

Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances

Kind: static method of BananodeApi
Returns: Promise.<string> - the account's balance, in raw.

Param Type Description
account string the account to use.

BananodeApi.getAccountBalanceAndPendingRaw(account) ⇒ Promise.<object>

Get the balance and pending values, in raw, as an object like this one: { balance: '123', pending: '123' } for an account.

(use other methods like getBananoPartsFromRaw to convert to banano or banoshi)

Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances

Kind: static method of BananodeApi
Returns: Promise.<object> - the account's balances, in raw.

Param Type Description
account string the account to use.

BananodeApi.getAccountsBalances(accounts) ⇒ Promise.<object>

Get the balances and pending values, in raw, as an object for all given account. Returns the Node object without transformation.

(use other methods like getBananoPartsFromRaw to convert to banano or banoshi)

Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances

Kind: static method of BananodeApi
Returns: Promise.<object> - the account's balances, in raw.

Param Type Description
accounts Array.<string> the account to use.

BananodeApi.getAccountHistory(account, count, head, raw) ⇒ Promise.<object>

Get the history for an account.

Calls https://docs.nano.org/commands/rpc-protocol/#account_history

Kind: static method of BananodeApi
Returns: Promise.<object> - the account's history.

Param Type Description
account string the account to use.
count number the count to use (use -1 for all).
head string the head to start at (optional).
raw string if true, return raw history (optional).

BananodeApi.getAccountInfo(account, representativeFlag) ⇒ Promise.<object>

Get the account info for an account.

Calls https://docs.nano.org/commands/rpc-protocol/#account_info

Kind: static method of BananodeApi
Returns: Promise.<object> - the account's info.

Param Type Description
account string the account to use.
representativeFlag boolean the representativeFlag to use (optional).

BananodeApi.getBlockCount() ⇒ Promise.<object>

Get the network block count.

Calls https://docs.nano.org/commands/rpc-protocol/#block_count

Kind: static method of BananodeApi
Returns: Promise.<object> - the block count.

BananodeApi.setUseRateLimit(flag) ⇒ undefined

Enables rate limiting, which looks for the rate limiting headers in the response.

Kind: static method of BananodeApi
Returns: undefined - returns nothing.

Param Type Description
flag string the flag to use.

BananodeApi.getAccountsPending(accounts, count, source) ⇒ Promise.<object>

Get the pending blocks for the account.

Calls https://docs.nano.org/commands/rpc-protocol/#accounts_pending

Kind: static method of BananodeApi
Returns: Promise.<object> - the account's pending blocks.

Param Type Description
accounts Array.<string> the array of pending accounts.
count number the max count to get.
source string if true, get source.

BananodeApi.setAuth(authString) ⇒ undefined

Sets an authorization string (http 'Authorization' header), useful if node requires api key.

Kind: static method of BananodeApi
Returns: undefined - returns nothing.

Param Type Description
authString string api key as a string

BananodeApi.setHeaders(_arbitraryHeaders) ⇒ undefined

Sets arbitrary headers

Kind: static method of BananodeApi
Returns: undefined - returns nothing.

Param Type Description
_arbitraryHeaders Object.<string, string> key-value pair object of header names (key) to header values (value), trying to specify Content-Type and Content-Length headers will not work

BananoParts : Object

Kind: global typedef
Properties

Name Type Description
banano string The amount of banano.
banoshi string The amount of banoshi (not counting whole banano).
raw string The amount of raw (not counting whole banano and whole banoshi).

Block : Object

Kind: global typedef
Properties

Name Type
type string
account string
previous string
representative string
balance string
link string
signature string
work? string

AccountValidationInfo : Object

Kind: global typedef
Properties

Name Type Description
message string The message describing why the account is valid or not.
valid boolean True if account is valid.