mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-24 07:09:14 +01:00
DOC
This commit is contained in:
parent
1f89001a48
commit
a8fef29b7d
2 changed files with 37 additions and 2 deletions
|
@ -206,12 +206,26 @@ export class AppStorage {
|
|||
return AsyncStorage.setItem('data', JSON.stringify(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* For each wallet, fetches balance from remote endpoint.
|
||||
* Use getter for a specific wallet to get actual balance.
|
||||
* Returns void.
|
||||
*
|
||||
* @return {Promise.<void>}
|
||||
*/
|
||||
async fetchWalletBalances() {
|
||||
for (let wallet of this.wallets) {
|
||||
await wallet.fetchBalance();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches from remote endpoint all transactions for each wallet.
|
||||
* Returns void.
|
||||
* To access transactions - get them from each respective wallet.
|
||||
*
|
||||
* @return {Promise.<void>}
|
||||
*/
|
||||
async fetchWalletTransactions() {
|
||||
for (let wallet of this.wallets) {
|
||||
await wallet.fetchTransactions();
|
||||
|
@ -226,6 +240,11 @@ export class AppStorage {
|
|||
return this.wallets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for all transactions in all wallets
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
getTransactions() {
|
||||
let txs = [];
|
||||
for (let wallet of this.wallets) {
|
||||
|
@ -240,6 +259,11 @@ export class AppStorage {
|
|||
|
||||
listUnconfirmed() {}
|
||||
|
||||
/**
|
||||
* Getter for a sum of all balances of all wallets
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
getBalance() {
|
||||
let finalBalance = 0;
|
||||
for (let wal of this.wallets) {
|
||||
|
|
|
@ -62,8 +62,8 @@ export class LegacyWallet extends AbstractWallet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetches balance o the Wallet via API.
|
||||
* Returns VOID. Get the balance from getter.
|
||||
* Fetches balance of the Wallet via API.
|
||||
* Returns VOID. Get the actual balance via getter.
|
||||
*
|
||||
* @returns {Promise.<void>}
|
||||
*/
|
||||
|
@ -107,6 +107,11 @@ export class LegacyWallet extends AbstractWallet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches UTXO from API. Returns VOID.
|
||||
*
|
||||
* @return {Promise.<void>}
|
||||
*/
|
||||
async fetchUtxo() {
|
||||
const api = new Frisbee({
|
||||
baseURI: 'https://api.blockcypher.com/v1/btc/main/addrs/',
|
||||
|
@ -162,6 +167,12 @@ export class LegacyWallet extends AbstractWallet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches transactions via API. Returns VOID.
|
||||
* Use getter to get the actual list.
|
||||
*
|
||||
* @return {Promise.<void>}
|
||||
*/
|
||||
async fetchTransactions() {
|
||||
let response;
|
||||
let token = (array => {
|
||||
|
|
Loading…
Add table
Reference in a new issue