- Main :
object
- CamoUtil :
object
- BananoUtil :
object
- WithdrawUtil :
object
- DepositUtil :
object
- BananodeApi :
object
- BananoParts :
Object
- Block :
Object
- AccountValidationInfo :
Object
Kind: global namespace
- Main :
object
- .BANANO_PREFIX :
string
- .setBananodeApi(_bananodeApi) ⇒
undefined
- .setAuth(auth) ⇒
undefined
- .setHeaders(headers) ⇒
undefined
- .setBananodeApiProxy(proxy) ⇒
undefined
- .getBananodeApiProxy() ⇒
Object
- .setBananodeApiUrl(url) ⇒
undefined
- .getRawStrFromBananoStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromBanoshiStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromNanoStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromNanoshiStr(amountStr, amountPrefix) ⇒
string
- .BANANO_PREFIX :
Kind: static constant of Main
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 |
Sets the Bananode Api Authorization
Kind: static method of Main
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
auth | string |
the new authorization |
Sets the Bananode Api Headers
Kind: static method of Main
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
headers | string |
the new headers |
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 |
Gets the Bananode Api Proxy (http pr https proxy)
Kind: static method of Main
Returns: Object
- returns the module.
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 |
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. |
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. |
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. |
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. |
Kind: global namespace
- CamoUtil :
object
- .camoBananoReceive(toPrivateKey, fromPublicKey) ⇒
Promise.<Array.<string>>
- .camoNanoReceive(toPrivateKey, fromPublicKey) ⇒
Promise.<Array.<string>>
- .getCamoBananoNextPrivateKeyForReceive(seed) ⇒
Promise.<string>
- .getCamoNanoNextPrivateKeyForReceive(seed) ⇒
Promise.<string>
- .camoBananoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos) ⇒
Promise.<Array.<string>>
- .camoNanoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos) ⇒
Promise.<Array.<string>>
- .camoBananoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos) ⇒
Promise.<Array.<string>>
- .camoNanoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos) ⇒
Promise.<Array.<string>>
- .camoBananoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count) ⇒
Promise.<Array.<string>>
- .camoNanoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count) ⇒
Promise.<Array.<string>>
- .getCamoAccountValidationInfo(account) ⇒
object
- .getCamoBananoSharedAccountData(seed, seedIx, account, sharedSeedIx) ⇒
Promise.<string>
- .getCamoNanoSharedAccountData(seed, seedIx, account, sharedSeedIx) ⇒
Promise.<string>
- .receiveCamoBananoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash) ⇒
Promise.<string>
- .receiveCamoNanoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash) ⇒
Promise.<string>
- .getCamoBananoAccountBalanceRaw(toPrivateKey, fromPublicKey) ⇒
Promise.<string>
- .getCamoNanoAccountBalanceRaw(toPrivateKey, fromPublicKey) ⇒
Promise.<string>
- .getCamoPublicKey(privateKey) ⇒
string
- .getSharedSecret(privateKey, publicKey) ⇒
string
- .getCamoAccount(camoPublicKey) ⇒
string
- .isCamoAccountValid(camoAccount) ⇒
boolean
- .camoBananoReceive(toPrivateKey, fromPublicKey) ⇒
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
Kind: global namespace
- BananoUtil :
object
- .getBananoPartsFromDecimal(decimalAmount) ⇒
BananoParts
- .getBananoPartsAsDecimal(bananoParts) ⇒
string
- .getBananoDecimalAmountAsRaw(amount) ⇒
string
- .getBananoPartsDescription(bananoParts) ⇒
string
- .sendAmountToBananoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒
Promise.<string>
- .sendAmountToNanoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒
Promise.<string>
- .sendAmountToBananoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒
Promise.<string>
- .sendAmountToNanoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒
Promise.<string>
- .changeBananoRepresentativeForSeed(seed, seedIx, representative) ⇒
Promise.<string>
- .changeNanoRepresentativeForSeed(seed, seedIx, representative) ⇒
Promise.<string>
- .getBananoAccountFromSeed(seed, seedIx) ⇒
Promise.<string>
- .getNanoAccountFromSeed(seed, seedIx) ⇒
Promise.<string>
- .openBananoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒
Promise.<string>
- .openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒
Promise.<string>
- .getBlockHash(block) ⇒
string
- .signMessage(privateKeyOrSigner, message) ⇒
string
- .hashMessageToBytes(message) ⇒
Uint8Array
- .messageDummyBlockHashBytes(privateKey, message) ⇒
Uint8Array
- .messageDummyBlock(privateKey, message) ⇒
string
- .verifyMessage(publicKey, message, signature) ⇒
boolean
- .signHash(privateKey, hash) ⇒
string
- .verify(hash, signature, publicKey) ⇒
string
- .getSignature(privateKey, block) ⇒
string
- .getBytesFromHex(hex) ⇒
Uint8Array
- .getHexFromBytes(bytes) ⇒
string
- .getWorkUsingCpu(hash, workBytes) ⇒
string
- .getBananoAccount(publicKey) ⇒
string
- .getNanoAccount(publicKey) ⇒
string
- .getBananoPartsFromRaw(amountRawStr) ⇒
BananoParts
- .getNanoPartsFromRaw(amountRawStr) ⇒
BananoParts
- .getRawStrFromMajorAmountStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromMinorAmountStr(amountStr, amountPrefix) ⇒
string
- .getAmountPartsFromRaw(amountRawStr, amountPrefix) ⇒
BananoParts
- .getAccountPublicKey(account) ⇒
string
- .getAccountSuffix(publicKey) ⇒
string
- .getAccount(publicKey, accountPrefix) ⇒
string
- .sign(privateKeyOrSigner, block) ⇒
string
- .getBlake2bHash(bytes, size) ⇒
Uint8Array
- .isWorkValid(hashBytes, workBytes) ⇒
boolean
- .getZeroedWorkBytes() ⇒
Uint8Array
- .getPublicKey(privateKeyOrSigner) ⇒
Promise.<string>
- .isSeedValid(seed, seedIx) ⇒
object
- .getPrivateKey(seed, seedIx) ⇒
string
- .getBananoAccountValidationInfo(account) ⇒
AccountValidationInfo
- .getNanoAccountValidationInfo(account) ⇒
AccountValidationInfo
- .getBananoPartsFromDecimal(decimalAmount) ⇒
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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_. |
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 |
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 |
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. |
creates a new Uint8Array(8) to calculate work bytes.
Kind: static method of BananoUtil
Returns: Uint8Array
- the bytes in a Uint8Array.
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). |
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. |
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. |
Kind: global namespace
- WithdrawUtil :
object
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). |
Kind: global namespace
- DepositUtil :
object
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). |
Kind: global namespace
- BananodeApi :
object
- .getAccountBalanceRaw(account) ⇒
Promise.<string>
- .getAccountBalanceAndPendingRaw(account) ⇒
Promise.<object>
- .getAccountsBalances(accounts) ⇒
Promise.<object>
- .getAccountHistory(account, count, head, raw) ⇒
Promise.<object>
- .getAccountInfo(account, representativeFlag) ⇒
Promise.<object>
- .getBlockCount() ⇒
Promise.<object>
- .setUseRateLimit(flag) ⇒
undefined
- .getAccountsPending(accounts, count, source) ⇒
Promise.<object>
- .setAuth(authString) ⇒
undefined
- .setHeaders(_arbitraryHeaders) ⇒
undefined
- .getAccountBalanceRaw(account) ⇒
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. |
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. |
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. |
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). |
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). |
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.
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. |
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. |
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 |
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 |
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). |
Kind: global typedef
Properties
Name | Type |
---|---|
type | string |
account | string |
previous | string |
representative | string |
balance | string |
link | string |
signature | string |
work? | string |
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. |