Class: Wallet

Wallet(app)

A Saito-lite wallet.

Constructor

new Wallet(app)

Parameters:
Name Type Description
app *
Source:

Methods

(async) backupWallet()

Serialized the user's wallet to JSON and downloads it to their local machine
Source:

calculateBalance() → {Big}

Calculates balance from slips in the local storage wallet
Source:
Returns:
Type
Big

initialize(app)

Initialize the Saito-Lite wallet
Parameters:
Name Type Description
app Object Saito-Lite Application Context
Source:

(abstract) isOurPreferredCryptoAddress(address, to) → {Int}

A user can set their preferred crypto within the Saito Lite environment. This will be stored in their local storage and can be retrieved by other modules here for any purpose.
Parameters:
Name Type Description
address String How much of the token to transfer
to String Pubkey/address to send to
Source:
Returns:
Bool as int
Type
Int

(async) receivePayment(senders, receivers, amounts, timestamp, mycallback, ticker, tries, pollWaitTime) → {Array}

Checks that a payment has been received if the current user is the receiver.
Parameters:
Name Type Default Description
senders Array Array of addresses
receivers Array Array of addresses
amounts Array Array of amounts to send
timestamp Int Timestamp of time after which payment should be made
mycallback function (Array of {address: {String}, balance: {Int}}) -> {...}
ticker String Ticker of install crypto module
tries Int 36 (default: 36) Number of tries to query the underlying crypto API before giving up. Sending -1 will cause infinite retries.
pollWaitTime Int 5000 (default: 5000) Amount of time to wait between tries
Source:
Returns:
Array of {address: {String}, balance: {Int}}
Type
Array

(async) resetWallet()

Generates a new keypair for the user, resets all stored wallet info, and saves the new wallet to local storage.
Source:

(async) restoreWallet()

Restores the user's wallet from uploaded JSON
Source:

returnActivatedCryptos() → {Array}

Returns a list of any modules installed in this Saito-Lite node which extend AbstractCryptoModule. AbstractCryptoModules represent various cryptocurrencies like DOT, Kusama, ETH, etc.
Source:
Returns:
Array of modules
Type
Array

returnCryptoModuleByTicker(ticker) → {Module}

Gets an installed AbstractCryptoModule by ticker
Parameters:
Name Type Description
ticker String Ticker of install crypto module
Source:
Returns:
Type
Module

returnInstalledCryptos() → {Array}

Returns a list of any modules installed in this Saito-Lite node which extend AbstractCryptoModule. AbstractCryptoModules represent various cryptocurrencies like DOT, Kusama, ETH, etc.
Source:
Returns:
Array of modules
Type
Array

returnPreferredCrypto() → {Module}

A user can set their preferred crypto within the Saito Lite environment. This will be stored in their local storage and can be retrieved by other modules here for any purpose.
Source:
Returns:
Type
Module

(async) returnPreferredCryptoBalances(addresses, mycallback, ticker) → {Array}

Get's balance from user's preferred crypto module.
Parameters:
Name Type Default Description
addresses Array Array of addresses
mycallback function null (Array of {address: {String}, balance: {Int}}) -> {...}
ticker String Ticker of install crypto module
Source:
Returns:
Array of {address: {String}, balance: {Int}}
Type
Array

returnPrivateKey() → {String}

Returns Private key
Source:
Returns:
Type
String

returnPublicKey() → {String}

Returns Public key
Source:
Returns:
Type
String

saveWallet()

Saves the current wallet state to local storage.
Source:

(async) sendPayment(senders, receivers, amounts, timestamp, mycallback, ticker)

Sends payments to the addresses provided if this user is the corresponding sender. Will not send if similar payment was found after the given timestamp.
Parameters:
Name Type Description
senders Array Array of addresses
receivers Array Array of addresses
amounts Array Array of amounts to send
timestamp Int Timestamp of time after which payment should be made
mycallback function ({hash: {String}}) -> {...}
ticker String Ticker of install crypto module
Source:

setPreferredCrypto(ticker)

Set user's preferred crypto module by ticker
Parameters:
Name Type Description
ticker String Ticker of install crypto module
Source:

signAndEncryptTransaction(tx) → {Transaction}

If the to field of the transaction contains a pubkey which has previously negotiated a diffie-hellman key exchange, encrypt the message part of message, attach it to the transaction, and resign the transaction
Parameters:
Name Type Description
tx Transaction
Source:
Returns:
Type
Transaction

signMessage()

Sign an arbitrary message with wallet keypair
Source:

signTransaction(tx) → {Transaction}

Sign a transactions and attach the sig to the transation
Parameters:
Name Type Description
tx Transaction
Source:
Returns:
Type
Transaction