- Main :
object
- PawUtil :
object
- DepositUtil :
object
- PawnodeApi :
object
- PawParts :
Object
- AccountValidationInfo :
Object
Kind: global namespace
- Main :
object
- .setPawnodeApi(_pawnodeApi) ⇒
undefined
- .setAuth(auth) ⇒
undefined
- .setPawnodeApiUrl(url) ⇒
undefined
- .setPawnodeApi(_pawnodeApi) ⇒
Sets the Pawnode Api (useful for overriding some methods)
Kind: static method of Main
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
_pawnodeApi | string |
the new pawnodeApi |
Sets the Pawnode Api Authorization
Kind: static method of Main
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
auth | string |
the new authorization |
Sets the URL to use for the node behind the Pawnode Api
Kind: static method of Main
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
url | string |
the new url |
Kind: global namespace
- PawUtil :
object
- .getPawPartsFromDecimal(decimalAmount) ⇒
PawParts
- .getPawPartsAsDecimal(pawParts) ⇒
string
- .getPawDecimalAmountAsRaw(amount) ⇒
string
- .getPawPartsDescription(pawParts) ⇒
string
- .sendAmountToPawAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒
Promise.<string>
- .sendAmountToNanoAccountWithRepresentativeAndPrevious(seed, seedIx, destAccount, amountRaw, representative, previousHash) ⇒
Promise.<string>
- .sendAmountToPawAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒
Promise.<string>
- .sendAmountToNanoAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒
Promise.<string>
- .changePawRepresentativeForSeed(seed, seedIx, representative) ⇒
Promise.<string>
- .changeNanoRepresentativeForSeed(seed, seedIx, representative) ⇒
Promise.<string>
- .getPawAccountFromSeed(seed, seedIx) ⇒
Promise.<string>
- .getNanoAccountFromSeed(seed, seedIx) ⇒
Promise.<string>
- .openPawAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒
Promise.<string>
- .openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒
Promise.<string>
- .getBlockHash(block) ⇒
string
- .signHash(privateKey, hash) ⇒
string
- .verify(hash, signature, publicKey) ⇒
string
- .getSignature(privateKey, block) ⇒
string
- .getBytesFromHex(hex) ⇒
Uint8Array
- .getHexFromBytes(bytes) ⇒
string
- .getWorkUsingCpu(hash, workBytes) ⇒
string
- .getRawStrFromPawStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromPawoshiStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromNanoStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromNanoshiStr(amountStr, amountPrefix) ⇒
string
- .getPawAccount(publicKey) ⇒
string
- .getNanoAccount(publicKey) ⇒
string
- .getPawPartsFromRaw(amountRawStr) ⇒
PawParts
- .getNanoPartsFromRaw(amountRawStr) ⇒
PawParts
- .getRawStrFromMajorAmountStr(amountStr, amountPrefix) ⇒
string
- .getRawStrFromMinorAmountStr(amountStr, amountPrefix) ⇒
string
- .getAmountPartsFromRaw(amountRawStr, amountPrefix) ⇒
PawParts
- .getAccountPublicKey(account) ⇒
string
- .getAccountSuffix(publicKey) ⇒
string
- .getAccount(publicKey, accountPrefix) ⇒
string
- .isWorkValid(hashBytes, workBytes) ⇒
boolean
- .getZeroedWorkBytes() ⇒
Uint8Array
- .getPublicKey(privateKey) ⇒
string
- .isSeedValid(seed, seedIx) ⇒
object
- .getPrivateKey(seed, seedIx) ⇒
string
- .getPawAccountValidationInfo(account) ⇒
AccountValidationInfo
- .getNanoAccountValidationInfo(account) ⇒
AccountValidationInfo
- .getPawPartsFromDecimal(decimalAmount) ⇒
PawUtil.getPawPartsFromDecimal(decimalAmount) ⇒ PawParts
converts amount from decimal to pawParts.
Kind: static method of PawUtil
Returns: PawParts
- returns the paw parts of the decimal amount.
Param | Type | Description |
---|---|---|
decimalAmount | string |
the decimal amount of paws. |
converts amount from pawParts to decimal.
Kind: static method of PawUtil
Returns: string
- returns the decimal amount of paws.
Param | Type | Description |
---|---|---|
pawParts | PawParts |
the paw parts to describe. |
converts amount from decimal to raw.
Kind: static method of PawUtil
Returns: string
- returns amount in raw.
Param | Type | Description |
---|---|---|
amount | string |
the decimal amount. |
describes the paw parts in an english description.
Kind: static method of PawUtil
Returns: string
- returns the description of the paw parts.
Param | Type | Description |
---|---|---|
pawParts | PawParts |
the paw parts to describe. |
PawUtil.sendAmountToPawAccountWithRepresentativeAndPrevious(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 PawUtil
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). |
PawUtil.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 PawUtil
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). |
PawUtil.sendAmountToPawAccount(seed, seedIx, destAccount, amountRaw, successCallback, failureCallback) ⇒ Promise.<string>
Sends the amount to the paw account with a callback for success and failure.
Kind: static method of PawUtil
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. |
PawUtil.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 PawUtil
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 PawUtil
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 PawUtil
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 paw account with a given seed and index.
Kind: static method of PawUtil
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 paw account with a given seed and index.
Kind: static method of PawUtil
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. |
PawUtil.openPawAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒ Promise.<string>
Open a paw account with a given seed.
Kind: static method of PawUtil
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. |
PawUtil.openNanoAccountFromSeed(seed, seedIx, representative, pendingBlockHash, pendingValueRaw) ⇒ Promise.<string>
Open a nano account with a given seed.
Kind: static method of PawUtil
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 PawUtil
Returns: string
- the block's hash.
Param | Type | Description |
---|---|---|
block | string |
the seed to use to find the account. |
signs a hash.
Kind: static method of PawUtil
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 PawUtil
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 PawUtil
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 PawUtil
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 PawUtil
Returns: string
- the hex string.
Param | Type | Description |
---|---|---|
bytes | Uint8Array |
the bytes to use. |
gets work bytes using the CPU.
Kind: static method of PawUtil
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. |
Converts an amount into a raw amount.
Kind: static method of PawUtil
Returns: string
- the paw 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 PawUtil
Returns: string
- the paw 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 PawUtil
Returns: string
- the paw 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 PawUtil
Returns: string
- the paw as a raw value.
Param | Type | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Get the paw account for a given public key.
Kind: static method of PawUtil
Returns: string
- the account.
Param | Type | Description |
---|---|---|
publicKey | string |
the public key. |
Get the paw account for a given public key.
Kind: static method of PawUtil
Returns: string
- the account.
Param | Type | Description |
---|---|---|
publicKey | string |
the public key. |
PawUtil.getPawPartsFromRaw(amountRawStr) ⇒ PawParts
Get the paw parts (paw, pawoshi, raw) for a given raw value.
Kind: static method of PawUtil
Returns: PawParts
- the paw parts.
Param | Type | Description |
---|---|---|
amountRawStr | string |
the raw amount, as a string. |
PawUtil.getNanoPartsFromRaw(amountRawStr) ⇒ PawParts
Get the nano parts nano, nanoshi, raw) for a given raw value.
Kind: static method of PawUtil
Returns: PawParts
- the paw parts.
Param | Type | Description |
---|---|---|
amountRawStr | string |
the raw amount, as a string. |
Converts an amount into a raw amount.
Kind: static method of PawUtil
Returns: string
- the paw as a raw value.
Param | Type | Description |
---|---|---|
amountStr | string |
the amount, as a string. |
amountPrefix | string |
the amount, as a string. |
Converts a pawoshi amount into a raw amount.
Kind: static method of PawUtil
Returns: string
- the paw as a raw value.
Param | Type | Description |
---|---|---|
amountStr | string |
the pawoshi, as a string. |
amountPrefix | string |
the amount prefix, as a string. |
PawUtil.getAmountPartsFromRaw(amountRawStr, amountPrefix) ⇒ PawParts
Get the paw parts (paw, pawoshi, raw) for a given raw value.
Kind: static method of PawUtil
Returns: PawParts
- the paw 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 PawUtil
Returns: string
- the public key.
Param | Type | Description |
---|---|---|
account | string |
the account. |
Get the account suffix for a given public key (everything but paw_ or camo_ or nano_).
Kind: static method of PawUtil
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 PawUtil
Returns: string
- the account.
Param | Type | Description |
---|---|---|
publicKey | string |
the public key. |
accountPrefix | string |
the prefix. paw_ or nano_. |
returns true if the work (in bytes) for the hash (in bytes) is valid.
Kind: static method of PawUtil
Returns: boolean
- true if the work is valid for the hash.
Param | Type | Description |
---|---|---|
hashBytes | string |
the hash bytes to check. |
workBytes | string |
the work bytes to check. |
creates a new Uint8Array(8) to calculate work bytes.
Kind: static method of PawUtil
Returns: Uint8Array
- the bytes in a Uint8Array.
Get the public key for a given private key.
Kind: static method of PawUtil
Returns: string
- the public key.
Param | Type | Description |
---|---|---|
privateKey | string |
the private key. |
validates a seed.
Kind: static method of PawUtil
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 PawUtil
Returns: string
- the private key.
Param | Type | Description |
---|---|---|
seed | string |
the seed to use to find the account. |
seedIx | string |
the index to use with the seed. |
PawUtil.getPawAccountValidationInfo(account) ⇒ AccountValidationInfo
Returns an object saying if the paw account is valid or not. If the account is not valid, the message describes why it is not valid.
Kind: static method of PawUtil
Returns: AccountValidationInfo
- an object saying if the account is valid, and why.
Param | Type | Description |
---|---|---|
account | string |
the account. |
PawUtil.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 PawUtil
Returns: AccountValidationInfo
- an object saying if the account is valid, and why.
Param | Type | Description |
---|---|---|
account | string |
the account. |
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.receivePawDepositsForSeed(seed, seedIx, representative, specificPendingBlockHash) ⇒ Promise.<object>
Recieve deposits for a paw 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
- PawnodeApi :
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>
- .getAccountsPending(accounts, count, source) ⇒
Promise.<object>
- .setAuth(authString) ⇒
undefined
- .getAccountBalanceRaw(account) ⇒
Get the balance, in raw, for an account.
(use other methods like getPawPartsFromRaw to convert to paw or pawoshi)
Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances
Kind: static method of PawnodeApi
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 getPawPartsFromRaw to convert to paw or pawoshi)
Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances
Kind: static method of PawnodeApi
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 getPawPartsFromRaw to convert to paw or pawoshi)
Calls https://docs.nano.org/commands/rpc-protocol/#accounts_balances
Kind: static method of PawnodeApi
Returns: Promise.<object>
- the account's balances, in raw.
Param | Type | Description |
---|---|---|
accounts | string_array |
the account to use. |
Get the history for an account.
Calls https://docs.nano.org/commands/rpc-protocol/#account_history
Kind: static method of PawnodeApi
Returns: Promise.<object>
- the account's history.
Param | Type | Description |
---|---|---|
account | string |
the account to use. |
count | string |
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 PawnodeApi
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 PawnodeApi
Returns: Promise.<object>
- the block count.
Get the network block count.
Calls https://docs.nano.org/commands/rpc-protocol/#accounts_pending
Kind: static method of PawnodeApi
Returns: Promise.<object>
- the account's pending blocks.
Param | Type | Description |
---|---|---|
accounts | string_array |
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 PawnodeApi
Returns: undefined
- returns nothing.
Param | Type | Description |
---|---|---|
authString | string |
api key as a string\ |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
paw | string |
The amount of paw. |
pawoshi | string |
The amount of pawoshi (not counting whole paw). |
raw | string |
The amount of raw (not counting whole paw and whole pawoshi). |
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. |