# getAccount(publicKey, accountPrefix)
Get the account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey | string |
the public key. |
accountPrefix | string |
the prefix. ban_ or nano_. |
Returns
string
the account.
# getAccountPublicKey(account)
Get the public key for a given account.
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account. |
Returns
string
the public key.
# getAccountSuffix(publicKey)
Get the account suffix for a given public key (everything but ban_ or camo_ or nano_).
Parameters
Name | Types | Description |
---|---|---|
publicKey | string |
the public key. |
Returns
string
the account suffix.
# getAmountPartsFromRaw(amountRawStr, amountPrefix)
Get the banano parts (banano, banoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr | string |
the raw amount, as a string. |
amountPrefix | string |
the amount prefix, as a string. |
Returns
BananoParts
the banano parts.
# getBananoAccountValidationInfo(account)
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.
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account. |
Returns
AccountValidationInfo
an object saying if the account is valid, and why.
# getBlake2bHash(bytes, size)
returns true if the work (in bytes) for the hash (in bytes) is valid.
Parameters
Name | Types | Description |
---|---|---|
bytes | Uint8Array |
the bytes to hash. |
size | {number} |
the digest size |
Returns
Uint8Array
the bytes of the hash.
# getNanoAccountValidationInfo(account)
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.
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account. |
Returns
AccountValidationInfo
an object saying if the account is valid, and why.
# getPrivateKey(seed, seedIx)
Get the private key for a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | number |
the index to use with the seed. |
Returns
string
the private key.
# getPublicKey(privateKey)
Get the public key for a given private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key. |
Returns
Promise<string>
the public key.
# getRawStrFromMajorAmountStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Returns
string
the banano as a raw value.
# getRawStrFromMinorAmountStr(amountStr, amountPrefix)
Converts a banoshi amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the banoshi, as a string. |
amountPrefix | string |
the amount prefix, as a string. |
Returns
string
the banano as a raw value.
# getZeroedWorkBytes()
creates a new Uint8Array(8) to calculate work bytes.
Returns
Uint8Array
the bytes in a Uint8Array.
# isSeedValid(seed, seedIx)
validates a seed.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to validate. |
seedIx | string |
the index to use with the seed. |
Returns
object
{valid:[true/false] message:[if false, why]}.
# isWorkValid(hashBytes, workBytes)
returns true if the work (in bytes) for the hash (in bytes) is valid.
Parameters
Name | Types | Description |
---|---|---|
hashBytes | string |
the hash bytes to check. |
workBytes | Uint8Array |
the work bytes to check. |
Returns
boolean
true if the work is valid for the hash.
# sign(privateKey, block)
signs a block and returns the signature.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key to use to sign. |
block | Block |
block to sign |
Returns
string
the signature
# setAuth(authString)
Sets an authorization string (http 'Authorization' header), useful if node requires api key.
Parameters
Name | Types | Description |
---|---|---|
authString | string |
api key as a string\ |
Returns
undefined
returns nothing.
# getCamoAccount(camoPublicKey)
Get the camo account for a given camo public key.
Parameters
Name | Types | Description |
---|---|---|
camoPublicKey | string |
the camo public key. |
Returns
string
the camo account.
# getCamoPublicKey(privateKey)
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.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key. |
Returns
string
the camo public key.
# getSharedSecret(privateKey, publicKey)
Gets the shared secret from a camo public key and a private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key. |
publicKey | string |
the public key. |
Returns
string
the shared secret.
# isCamoAccountValid(camoAccount)
checks if a camo account is valid.
Parameters
Name | Types | Description |
---|---|---|
camoAccount | string |
the camo account. |
Returns
boolean
true if the camo account is valid.
# index()
# camoBananoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count)
get the pending blocks for the camo banano account.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
fromAccount |
|
- the account to recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
count |
|
- the max count to get. |
# camoBananoReceive(toPrivateKey, fromPublicKey)
receives banano funds at a camo address.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey |
|
- the private key that receives the funds. |
fromPublicKey |
|
- the public key that sent the funds. |
# camoBananoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos)
sends banano funds to a camo address.
Parameters
Name | Types | Description |
---|---|---|
fundingPrivateKey |
|
- the private key that sends the funds. |
fromCamoPrivateKey |
|
- the private key used to generate the shared seed. |
toCamoPublicKey |
|
- the public key that receives the funds. |
amountBananos |
|
- the amount of bananos. |
# camoBananoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos)
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.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
toAccount |
|
- the account to send to. |
amountBananos |
|
- the amount of bananos. |
# camoNanoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count)
get the pending blocks for the camo nano account.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
fromAccount |
|
- the account to recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
count |
|
- the max count to get. |
# camoNanoReceive(toPrivateKey, fromPublicKey)
receives nano funds at a camo address.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey |
|
- the private key that receives the funds. |
fromPublicKey |
|
- the public key that sent the funds. |
# camoNanoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos)
sends camo funds to a camo address.
Parameters
Name | Types | Description |
---|---|---|
fundingPrivateKey |
|
- the private key that sends the funds. |
fromCamoPrivateKey |
|
- the private key used to generate the shared seed. |
toCamoPublicKey |
|
- the public key that receives the funds. |
amountBananos |
|
- the amount of bananos. |
# camoNanoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos)
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.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
toAccount |
|
- the account to send to. |
amountBananos |
|
- the amount of bananos. |
# changeBananoRepresentativeForSeed(seed, seedIx, representative)
Sets the rep for an account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
# changeNanoRepresentativeForSeed(seed, seedIx, representative)
Sets the rep for an account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
# getAccount(publicKey, accountPrefix)
Get the account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey |
|
- the public key. |
accountPrefix |
|
- the prefix. ban_ or nano_. |
# getAccountBalanceAndPendingRaw(account)
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 {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account to use. |
# getAccountBalanceRaw(account)
Get the balance, in raw, for an account. (use other methods like getBananoPartsFromRaw to convert to banano or banoshi) Calls {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account to use. |
# getAccountHistory(account, count, head, raw)
Get the history for an account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#account_history}
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account to use. |
count |
|
- the count to use (use -1 for all). |
head |
|
- the head to start at (optional). |
raw |
|
- if true, return raw history (optional). |
# getAccountInfo(account, representativeFlag)
Get the account info for an account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#account_info}
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account to use. |
representativeFlag |
|
- the representativeFlag to use (optional). |
# getAccountPublicKey(account)
Get the public key for a given account.
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account. |
# getAccountsBalances(accounts)
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 {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
accounts |
|
- the account to use. |
# getAccountsPending(accounts, count, source)
Get the pending blocks for the account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#accounts_pending}
Parameters
Name | Types | Description |
---|---|---|
accounts |
|
- the array of pending accounts. |
count |
|
- the max count to get. |
source |
|
- if true, get source. |
# getAccountSuffix(publicKey)
Get the account suffix for a given public key (everything but ban_ or camo_ or nano_).
Parameters
Name | Types | Description |
---|---|---|
publicKey |
|
- the public key. |
# getAmountPartsFromRaw(amountRawStr, amountPrefix)
Get the banano parts (banano, banoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr |
|
- the raw amount, as a string. |
amountPrefix |
|
- the amount prefix, as a string. |
# getBananoAccount(publicKey)
Get the banano account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey |
|
- the public key. |
# getBananoAccountFromSeed(seed, seedIx)
Get the banano account with a given seed and index.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
# getBananoAccountValidationInfo(account)
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.
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account. |
# getBananoDecimalAmountAsRaw(amount)
converts amount from decimal to raw.
Parameters
Name | Types | Description |
---|---|---|
amount |
|
- the decimal amount. |
# getBananoPartsAsDecimal(bananoParts)
converts amount from bananoParts to decimal.
Parameters
Name | Types | Description |
---|---|---|
bananoParts |
|
- the banano parts to describe. |
# getBananoPartsDescription(bananoParts)
describes the banano parts in an english description.
Parameters
Name | Types | Description |
---|---|---|
bananoParts |
|
- the banano parts to describe. |
# getBananoPartsFromDecimal(decimalAmount)
converts amount from decimal to bananoParts.
Parameters
Name | Types | Description |
---|---|---|
decimalAmount |
|
- the decimal amount of bananos. |
# getBananoPartsFromRaw(amountRawStr)
Get the banano parts (banano, banoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr |
|
- the raw amount, as a string. |
# getBlake2bHash(bytes, size)
returns true if the work (in bytes) for the hash (in bytes) is valid.
Parameters
Name | Types | Description |
---|---|---|
bytes |
|
- the bytes to hash. |
size |
|
- the digest size |
# getBlockCount()
Get the network block count. Calls {@link https://docs.nano.org/commands/rpc-protocol/#block_count}
# getBlockHash(block)
Get the hash for a given block.
Parameters
Name | Types | Description |
---|---|---|
block |
|
- the seed to use to find the account. |
# getBytesFromHex(hex)
Converts a hex string to bytes in a Uint8Array.
Parameters
Name | Types | Description |
---|---|---|
hex |
|
- the hex string to use. |
# getCamoAccount(camoPublicKey)
Get the camo account for a given camo public key.
Parameters
Name | Types | Description |
---|---|---|
camoPublicKey |
|
- the camo public key. |
# getCamoAccountValidationInfo(account)
returns data on whether a camo account is valid or not, and why.
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account to check. |
# getCamoBananoAccountBalanceRaw(toPrivateKey, fromPublicKey)
gets the total banano account balance, in raw.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey |
|
- the private key that receives the funds. |
fromPublicKey |
|
- the public key that sent the funds. |
# getCamoBananoNextPrivateKeyForReceive(seed)
finds a new private key to recieve more banano funds. the key would have no history.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
# getCamoBananoSharedAccountData(seed, seedIx, account, sharedSeedIx)
get the banano shared account, used as an intermediary to send finds between the seed and the camo account.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
account |
|
- the camo account to send or recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
# getCamoNanoAccountBalanceRaw(toPrivateKey, fromPublicKey)
gets the total nano account balance, in raw.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey |
|
- the private key that receives the funds. |
fromPublicKey |
|
- the public key that sent the funds. |
# getCamoNanoNextPrivateKeyForReceive(seed)
finds a new private key to recieve more banano funds. the key would have no history.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
# getCamoNanoSharedAccountData(seed, seedIx, account, sharedSeedIx)
get the nano shared account, used as an intermediary to send finds between the seed and the camo account.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
account |
|
- the camo account to send or recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
# getCamoPublicKey(privateKey)
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.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key. |
# getHexFromBytes(bytes)
Converts bytes in a Uint8Array to a hex string.
Parameters
Name | Types | Description |
---|---|---|
bytes |
|
- the bytes to use. |
# getNanoAccount(publicKey)
Get the banano account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey |
|
- the public key. |
# getNanoAccountFromSeed(seed, seedIx)
Get the banano account with a given seed and index.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
# getNanoAccountValidationInfo(account)
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.
Parameters
Name | Types | Description |
---|---|---|
account |
|
- the account. |
# getNanoPartsFromRaw(amountRawStr)
Get the nano parts nano, nanoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr |
|
- the raw amount, as a string. |
# getPrivateKey(seed, seedIx)
Get the private key for a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
# getPublicKey(privateKey)
Get the public key for a given private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key. |
# getRawStrFromBananoStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the amount, as a string. |
amountPrefix |
|
- the amount, as a string. |
# getRawStrFromBanoshiStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the amount, as a string. |
amountPrefix |
|
- the amount, as a string. |
# getRawStrFromMajorAmountStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the amount, as a string. |
amountPrefix |
|
- the amount, as a string. |
# getRawStrFromMinorAmountStr(amountStr, amountPrefix)
Converts a banoshi amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the banoshi, as a string. |
amountPrefix |
|
- the amount prefix, as a string. |
# getRawStrFromNanoshiStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the amount, as a string. |
amountPrefix |
|
- the amount, as a string. |
# getRawStrFromNanoStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr |
|
- the amount, as a string. |
amountPrefix |
|
- the amount, as a string. |
# getSharedSecret(privateKey, publicKey)
Gets the shared secret from a camo public key and a private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key. |
publicKey |
|
- the public key. |
# getSignature(privateKey, block)
Get the signature for a given block (gets the hash of the block, and signs the hash).
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key used to sign the block. |
block |
|
- the block to sign. |
# getWorkUsingCpu(hash, workBytes)
gets work bytes using the CPU.
Parameters
Name | Types | Description |
---|---|---|
hash |
|
- the hash to use to calculate work bytes. |
workBytes |
|
- the Uint8Array(8) used to store temporary calculations. |
# isCamoAccountValid(camoAccount)
checks if a camo account is valid.
Parameters
Name | Types | Description |
---|---|---|
camoAccount |
|
- the camo account. |
# isSeedValid(seed, seedIx)
validates a seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to validate. |
seedIx |
|
- the index to use with the seed. |
# isWorkValid(hashBytes, workBytes)
returns true if the work (in bytes) for the hash (in bytes) is valid.
Parameters
Name | Types | Description |
---|---|---|
hashBytes |
|
- the hash bytes to check. |
workBytes |
|
- the work bytes to check. |
# openBananoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw)
Open a banano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
pendingBlockHash |
|
- the pending block hash. |
pendingValueRaw |
|
- the pending block hash. |
# openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw)
Open a nano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
pendingBlockHash |
|
- the pending block hash. |
pendingValueRaw |
|
- the pending block hash. |
# receiveBananoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash)
Recieve deposits for a banano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
specificPendingBlockHash |
|
- a specific block hash to receive (optional). |
# receiveCamoBananoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash)
Recieve banano deposits for a camo account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
account |
|
- the camo account to send or recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
specificPendingBlockHash |
|
- the pending block to recieve. |
# receiveCamoNanoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash)
Recieve nano deposits for a camo account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
account |
|
- the camo account to send or recieve from. |
sharedSeedIx |
|
- the index to use with the shared seed. |
specificPendingBlockHash |
|
- the pending block to recieve. |
# receiveNanoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash)
Recieve deposits for a nano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
representative |
|
- the representative. |
specificPendingBlockHash |
|
- a specific block hash to receive (optional). |
# sendAmountToBananoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback)
Sends the amount to the banano account with a callback for success and failure.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
destAccount |
|
- the destination account. |
amountRaw |
|
- the amount to send, in raw. |
successCallback |
|
- the callback to call upon success. |
failureCallback |
|
- the callback to call upon failure. |
# sendAmountToBananoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash)
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.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
destAccount |
|
- the destination account. |
amountRaw |
|
- the amount to send, in raw. |
representative |
|
- the representative (optional). |
previousHash |
|
- the previous hash (optional). |
# sendAmountToNanoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback)
Sends the amount to the nano account with a callback for success and failure.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
destAccount |
|
- the destination account. |
amountRaw |
|
- the amount to send, in raw. |
successCallback |
|
- the callback to call upon success. |
failureCallback |
|
- the callback to call upon failure. |
# sendAmountToNanoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash)
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.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
destAccount |
|
- the destination account. |
amountRaw |
|
- the amount to send, in raw. |
representative |
|
- the representative (optional). |
previousHash |
|
- the previous hash (optional). |
# sendBananoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous)
Send a withdrawal from a banano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
toAccount |
|
- the account to send to. |
amountBananos |
|
- the amount of bananos. |
representative |
|
- the new representative (optional). |
previous |
|
- the new previous (optional). |
# sendNanoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous)
Send a withdrawal from a nano account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed |
|
- the seed to use to find the account. |
seedIx |
|
- the index to use with the seed. |
toAccount |
|
- the account to send to. |
amountBananos |
|
- the amount of bananos. |
representative |
|
- the new representative (optional). |
previous |
|
- the new previous (optional). |
# setAuth(auth)
Sets the Bananode Api Authorization
Parameters
Name | Types | Description |
---|---|---|
auth |
|
- the new authorization |
# setAuth(authString)
Sets an authorization string (http 'Authorization' header), useful if node requires api key.
Parameters
Name | Types | Description |
---|---|---|
authString |
|
- api key as a string\ |
# setBananodeApi(_bananodeApi)
Sets the Bananode Api (useful for overriding some methods)
Parameters
Name | Types | Description |
---|---|---|
_bananodeApi |
|
- the new bananodeApi |
# setBananodeApiProxy(proxy)
Sets the Bananode Api Proxy (http pr https proxy)
Parameters
Name | Types | Description |
---|---|---|
proxy |
|
- the new proxy |
# setBananodeApiUrl(url)
Sets the URL to use for the node behind the Bananode Api
Parameters
Name | Types | Description |
---|---|---|
url |
|
- the new url |
# setUseRateLimit(flag)
Enables rate limiting, which looks for the rate limiting headers in the response.
Parameters
Name | Types | Description |
---|---|---|
flag |
|
- the flag to use. |
# sign(privateKey, block)
signs a block and returns the signature.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key to use to sign. |
block |
|
- block to sign |
# signHash(privateKey, hash)
signs a hash.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key to use to sign. |
hash |
|
- the hash to sign. |
# signMessage(privateKey, message)
signs a utf-8 message with private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey |
|
- the private key to use to sign. |
message |
|
- the utf-8 message to sign. |
# verify(hash, signature, publicKey)
verifys a hash.
Parameters
Name | Types | Description |
---|---|---|
hash |
|
- the hash to verify. |
signature |
|
- the signature to verify. |
publicKey |
|
- the public key to use to sign. |
# verifyMessage(publicKey, message, signature)
verifies a utf-8 message with public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey |
|
- the public key to use to sign. |
message |
|
- the utf-8 message to verify. |
signature |
|
- hex of signature. |
# BANANO_PREFIX()
# camoBananoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count)
get the pending blocks for the camo banano account.
Parameters
Name | Types | 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
Promise<string[]>
the pending hashes in an array.
# camoBananoReceive(toPrivateKey, fromPublicKey)
receives banano funds at a camo address.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey | string |
the private key that receives the funds. |
fromPublicKey | string |
the public key that sent the funds. |
Returns
Promise<string[]>
the received hashes in an array.
# camoBananoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos)
sends banano funds to a camo address.
Parameters
Name | Types | 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. |
Returns
Promise<string[]>
the sent hashes in an array.
# camoBananoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos)
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.
Parameters
Name | Types | 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. |
Returns
Promise<string[]>
the sent hashes in an array.
# camoNanoGetAccountsPending(seed, seedIx, fromAccount, sharedSeedIx, count)
get the pending blocks for the camo nano account.
Parameters
Name | Types | 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
Promise<string[]>
the pending hashes in an array.
# camoNanoReceive(toPrivateKey, fromPublicKey)
receives nano funds at a camo address.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey | string |
the private key that receives the funds. |
fromPublicKey | string |
the public key that sent the funds. |
Returns
Promise<string[]>
the received hashes in an array.
# camoNanoSend(fundingPrivateKey, fromCamoPrivateKey, toCamoPublicKey, amountBananos)
sends camo funds to a camo address.
Parameters
Name | Types | 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. |
Returns
Promise<string[]>
the sent hashes in an array.
# camoNanoSendWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos)
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.
Parameters
Name | Types | 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. |
Returns
Promise<string[]>
the sent hashes in an array.
# changeBananoRepresentativeForSeed(seed, seedIx, representative)
Sets the rep for an account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | string |
the index to use with the seed. |
representative | string |
the representative. |
Returns
Promise<string>
returns the hash returned by the change.
# changeNanoRepresentativeForSeed(seed, seedIx, representative)
Sets the rep for an account with a given seed.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | string |
the index to use with the seed. |
representative | string |
the representative. |
Returns
Promise<string>
returns the hash returned by the change.
# getAccountBalanceAndPendingRaw(account)
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 {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account to use. |
Returns
Promise<object>
the account's balances, in raw.
# getAccountBalanceRaw(account)
Get the balance, in raw, for an account. (use other methods like getBananoPartsFromRaw to convert to banano or banoshi) Calls {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account to use. |
Returns
Promise<string>
the account's balance, in raw.
# getAccountHistory(account, count, head, raw)
Get the history for an account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#account_history}
Parameters
Name | Types | 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). |
Returns
Promise<object>
the account's history.
# getAccountInfo(account, representativeFlag)
Get the account info for an account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#account_info}
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account to use. |
representativeFlag | boolean |
the representativeFlag to use (optional). |
Returns
Promise<object>
the account's info.
# getAccountsBalances(accounts)
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 {@link https://docs.nano.org/commands/rpc-protocol/#accounts_balances}
Parameters
Name | Types | Description |
---|---|---|
accounts | string[] |
the account to use. |
Returns
Promise<object>
the account's balances, in raw.
# getAccountsPending(accounts, count, source)
Get the pending blocks for the account. Calls {@link https://docs.nano.org/commands/rpc-protocol/#accounts_pending}
Parameters
Name | Types | Description |
---|---|---|
accounts | string[] |
the array of pending accounts. |
count | number |
the max count to get. |
source | string |
if true, get source. |
Returns
Promise<object>
the account's pending blocks.
# getBananoAccount(publicKey)
Get the banano account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey | string |
the public key. |
Returns
string
the account.
# getBananoAccountFromSeed(seed, seedIx)
Get the banano account with a given seed and index.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | string |
the index to use with the seed. |
Returns
Promise<string>
the account.
# getBananodeApiProxy()
Gets the Bananode Api Proxy (http pr https proxy)
Returns
Object
returns the module.
# getBananoDecimalAmountAsRaw(amount)
converts amount from decimal to raw.
Parameters
Name | Types | Description |
---|---|---|
amount | string |
the decimal amount. |
Returns
string
returns amount in raw.
# getBananoPartsAsDecimal(bananoParts)
converts amount from bananoParts to decimal.
Parameters
Name | Types | Description |
---|---|---|
bananoParts | BananoParts |
the banano parts to describe. |
Returns
string
returns the decimal amount of bananos.
# getBananoPartsDescription(bananoParts)
describes the banano parts in an english description.
Parameters
Name | Types | Description |
---|---|---|
bananoParts | BananoParts |
the banano parts to describe. |
Returns
string
returns the description of the banano parts.
# getBananoPartsFromDecimal(decimalAmount)
converts amount from decimal to bananoParts.
Parameters
Name | Types | Description |
---|---|---|
decimalAmount | string |
the decimal amount of bananos. |
Returns
BananoParts
returns the banano parts of the decimal amount.
# getBananoPartsFromRaw(amountRawStr)
Get the banano parts (banano, banoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr | string |
the raw amount, as a string. |
Returns
BananoParts
the banano parts.
# getBlockCount()
Get the network block count. Calls {@link https://docs.nano.org/commands/rpc-protocol/#block_count}
Returns
Promise<object>
the block count.
# getBlockHash(block)
Get the hash for a given block.
Parameters
Name | Types | Description |
---|---|---|
block | string |
the seed to use to find the account. |
Returns
string
the block's hash.
# getBytesFromHex(hex)
Converts a hex string to bytes in a Uint8Array.
Parameters
Name | Types | Description |
---|---|---|
hex | string |
the hex string to use. |
Returns
Uint8Array
the bytes in a Uint8Array.
# getCamoAccountValidationInfo(account)
returns data on whether a camo account is valid or not, and why.
Parameters
Name | Types | Description |
---|---|---|
account | string |
the account to check. |
Returns
object
the account validity data.
# getCamoBananoAccountBalanceRaw(toPrivateKey, fromPublicKey)
gets the total banano account balance, in raw.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey | string |
the private key that receives the funds. |
fromPublicKey | string |
the public key that sent the funds. |
Returns
Promise<string>
the account balance, in raw.
# getCamoBananoNextPrivateKeyForReceive(seed)
finds a new private key to recieve more banano funds. the key would have no history.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
Returns
Promise<string>
the private key to use.
# getCamoBananoSharedAccountData(seed, seedIx, account, sharedSeedIx)
get the banano shared account, used as an intermediary to send finds between the seed and the camo account.
Parameters
Name | Types | 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. |
Returns
Promise<string>
the shared account.
# getCamoNanoAccountBalanceRaw(toPrivateKey, fromPublicKey)
gets the total nano account balance, in raw.
Parameters
Name | Types | Description |
---|---|---|
toPrivateKey | string |
the private key that receives the funds. |
fromPublicKey | string |
the public key that sent the funds. |
Returns
Promise<string>
the account balance, in raw.
# getCamoNanoNextPrivateKeyForReceive(seed)
finds a new private key to recieve more banano funds. the key would have no history.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
Returns
Promise<string>
the private key to use.
# getCamoNanoSharedAccountData(seed, seedIx, account, sharedSeedIx)
get the nano shared account, used as an intermediary to send finds between the seed and the camo account.
Parameters
Name | Types | 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. |
Returns
Promise<string>
the shared account.
# getHexFromBytes(bytes)
Converts bytes in a Uint8Array to a hex string.
Parameters
Name | Types | Description |
---|---|---|
bytes | Uint8Array |
the bytes to use. |
Returns
string
the hex string.
# getNanoAccount(publicKey)
Get the banano account for a given public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey | string |
the public key. |
Returns
string
the account.
# getNanoAccountFromSeed(seed, seedIx)
Get the banano account with a given seed and index.
Parameters
Name | Types | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | string |
the index to use with the seed. |
Returns
Promise<string>
the account.
# getNanoPartsFromRaw(amountRawStr)
Get the nano parts nano, nanoshi, raw) for a given raw value.
Parameters
Name | Types | Description |
---|---|---|
amountRawStr | string |
the raw amount, as a string. |
Returns
BananoParts
the banano parts.
# getRawStrFromBananoStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Returns
string
the banano as a raw value.
# getRawStrFromBanoshiStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Returns
string
the banano as a raw value.
# getRawStrFromNanoshiStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Returns
string
the banano as a raw value.
# getRawStrFromNanoStr(amountStr, amountPrefix)
Converts an amount into a raw amount.
Parameters
Name | Types | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Returns
string
the banano as a raw value.
# getSignature(privateKey, block)
Get the signature for a given block (gets the hash of the block, and signs the hash).
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key used to sign the block. |
block | string |
the block to sign. |
Returns
string
the block's signature.
# getWorkUsingCpu(hash, workBytes)
gets work bytes using the CPU.
Parameters
Name | Types | Description |
---|---|---|
hash | string |
the hash to use to calculate work bytes. |
workBytes | Uint8Array |
the Uint8Array(8) used to store temporary calculations. |
Returns
string
the work bytes as a hex string.
# openBananoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw)
Open a banano account with a given seed.
Parameters
Name | Types | 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. |
Returns
Promise<string>
returns the hash returned by the open.
# openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw)
Open a nano account with a given seed.
Parameters
Name | Types | 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. |
Returns
Promise<string>
returns the hash returned by the open.
# receiveBananoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash)
Recieve deposits for a banano account with a given seed.
Parameters
Name | Types | 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). |
Returns
Promise<object>
returns the response returned by the receive.
# receiveCamoBananoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash)
Recieve banano deposits for a camo account with a given seed.
Parameters
Name | Types | 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. |
Returns
Promise<string>
the response from receiving the block.
# receiveCamoNanoDepositsForSeed(seed, seedIx, account, sharedSeedIx, specificPendingBlockHash)
Recieve nano deposits for a camo account with a given seed.
Parameters
Name | Types | 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. |
Returns
Promise<string>
the response from receiving the block.
# receiveNanoDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash)
Recieve deposits for a nano account with a given seed.
Parameters
Name | Types | 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). |
Returns
Promise<object>
returns the response returned by the receive.
# sendAmountToBananoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback)
Sends the amount to the banano account with a callback for success and failure.
Parameters
Name | Types | 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. |
Returns
Promise<string>
returns the hash returned by the send.
# sendAmountToBananoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash)
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.
Parameters
Name | Types | 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). |
Returns
Promise<string>
returns the hash returned by the send.
# sendAmountToNanoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback)
Sends the amount to the nano account with a callback for success and failure.
Parameters
Name | Types | 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. |
Returns
Promise<string>
returns the hash returned by the send.
# sendAmountToNanoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash)
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.
Parameters
Name | Types | 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). |
Returns
Promise<string>
returns the hash returned by the send.
# sendBananoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous)
Send a withdrawal from a banano account with a given seed.
Parameters
Name | Types | 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). |
Returns
Promise<object>
returns the response returned by the withdraw.
# sendNanoWithdrawalFromSeed(seed, seedIx, toAccount, amountBananos, representative, previous)
Send a withdrawal from a nano account with a given seed.
Parameters
Name | Types | 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). |
Returns
Promise<object>
returns the response returned by the withdraw.
# setAuth(auth)
Sets the Bananode Api Authorization
Parameters
Name | Types | Description |
---|---|---|
auth | string |
the new authorization |
Returns
undefined
returns nothing.
# setBananodeApi(_bananodeApi)
Sets the Bananode Api (useful for overriding some methods)
Parameters
Name | Types | Description |
---|---|---|
_bananodeApi | string |
the new bananodeApi |
Returns
undefined
returns nothing.
# setBananodeApiProxy(proxy)
Sets the Bananode Api Proxy (http pr https proxy)
Parameters
Name | Types | Description |
---|---|---|
proxy | Object |
the new proxy |
Returns
undefined
returns nothing.
# setBananodeApiUrl(url)
Sets the URL to use for the node behind the Bananode Api
Parameters
Name | Types | Description |
---|---|---|
url | string |
the new url |
Returns
undefined
returns nothing.
# setUseRateLimit(flag)
Enables rate limiting, which looks for the rate limiting headers in the response.
Parameters
Name | Types | Description |
---|---|---|
flag | string |
the flag to use. |
Returns
undefined
returns nothing.
# signHash(privateKey, hash)
signs a hash.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key to use to sign. |
hash | string |
the hash to sign. |
Returns
string
the block's hash.
# signMessage(privateKey, message)
signs a utf-8 message with private key.
Parameters
Name | Types | Description |
---|---|---|
privateKey | string |
the private key to use to sign. |
message | string |
the utf-8 message to sign. |
Returns
string
the message's hash.
# verify(hash, signature, publicKey)
verifys a hash.
Parameters
Name | Types | Description |
---|---|---|
hash | string |
the hash to verify. |
signature | string |
the signature to verify. |
publicKey | string |
the public key to use to sign. |
Returns
string
true if verification passed.
# verifyMessage(publicKey, message, signature)
verifies a utf-8 message with public key.
Parameters
Name | Types | Description |
---|---|---|
publicKey | string |
the public key to use to sign. |
message | string |
the utf-8 message to verify. |
signature | string |
hex of signature. |
Returns
string
the message's hash.
# privateKey0Bytes()
Banano/Nano hashes the private key before using it to derive a public key (nacl.js derivePublicFromSecret).
This makes it impossible to use that public key in generating a shared secret.
However, if we hash the private key, and used the hashed private key with the hashed public key it works.
Unfortunately, derivePublicFromSecret uses scalarbase, which returns different results than nacl.scalarMult.base, so it's impossible to figure out how to use the two together withount deconstructing nacl.js)